crewx 0.8.8-rc.2 → 0.8.8-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli-commands.js +1 -1
- package/dist/assets/{MarketPage-Bh1UfiC2.js → MarketPage-B5JbqK4T.js} +9 -14
- package/dist/assets/{PromptTab-DYmYVBKo.js → PromptTab-_97mSbLk.js} +7 -7
- package/dist/assets/{arc-C14FbhzP.js → arc-3FDm7TxG.js} +1 -1
- package/dist/assets/architectureDiagram-UYN6MBPD-D8X56UlC.js +36 -0
- package/dist/assets/blockDiagram-ZHA2E4KO-B6jUnEVc.js +121 -0
- package/dist/assets/{c4Diagram-6F5ED5ID-DLSfQS-Z.js → c4Diagram-6F5ED5ID-Cy8x6Ims.js} +1 -1
- package/dist/assets/channel-Bs0J8jjN.js +1 -0
- package/dist/assets/{chunk-5HRBRIJM-j7YcJ7Bx.js → chunk-5HRBRIJM-Bh819Q5A.js} +1 -1
- package/dist/assets/{chunk-7U56Z5CX-Baqt1cj3.js → chunk-7U56Z5CX-CfNtPGa8.js} +1 -1
- package/dist/assets/{chunk-ASOPGD6M-F1YJ2mzH.js → chunk-ASOPGD6M-CMR1ElQ6.js} +1 -1
- package/dist/assets/{chunk-KFBOBJHC-Dvhzl6G9.js → chunk-KFBOBJHC-Dm2I1dHM.js} +1 -1
- package/dist/assets/{chunk-T2TOU4HS-BDczCXP6.js → chunk-T2TOU4HS-0tf-aNtk.js} +1 -1
- package/dist/assets/{chunk-TMUBEWPD-4BhwBH_F.js → chunk-TMUBEWPD-b5ZrpKJw.js} +1 -1
- package/dist/assets/classDiagram-LNE6IOMH-B1-6qC07.js +1 -0
- package/dist/assets/classDiagram-v2-MQ7JQ4JX-B1-6qC07.js +1 -0
- package/dist/assets/dagre-4EVJKHTY-zYmFBlwR.js +4 -0
- package/dist/assets/diagram-QW4FP2JN-DkZngH-Z.js +24 -0
- package/dist/assets/{erDiagram-6RL3IURR-DRhNKkH0.js → erDiagram-6RL3IURR-8TfuIQ6D.js} +2 -2
- package/dist/assets/{flowDiagram-7ASYPVHJ-BDJZsUJS.js → flowDiagram-7ASYPVHJ-BnhSLZTo.js} +1 -1
- package/dist/assets/{ganttDiagram-NTVNEXSI-BYBeyULV.js → ganttDiagram-NTVNEXSI--jDGPnYB.js} +3 -3
- package/dist/assets/gitGraph-YCYPL57B-DkCOt6bF.js +133 -0
- package/dist/assets/gitGraphDiagram-NRZ2UAAF-D4p17Lzw.js +65 -0
- package/dist/assets/graph-BlwPajkw.js +1 -0
- package/dist/assets/infoDiagram-A4XQUW5V-COnYi0Q8.js +2 -0
- package/dist/assets/{journeyDiagram-G5WM74LC-BhSSQ4Od.js → journeyDiagram-G5WM74LC-CTZcqDJf.js} +1 -1
- package/dist/assets/{kanban-definition-QRCXZQQD-CZOkitn-.js → kanban-definition-QRCXZQQD-CezLYsK3.js} +1 -1
- package/dist/assets/layout-Bvwu4dCi.js +1 -0
- package/dist/assets/{linear-BRR4YPhd.js → linear-BcYBjD0V.js} +1 -1
- package/dist/assets/main-CgT_Atre.js +1210 -0
- package/dist/assets/main-kJ_DZpZU.css +10 -0
- package/dist/assets/{mindmap-definition-GWI6TPTV-CiMg1rSL.js → mindmap-definition-GWI6TPTV-NM7qIPkp.js} +1 -1
- package/dist/assets/pieDiagram-YF2LJOPJ-Ck2UBMrZ.js +30 -0
- package/dist/assets/{quadrantDiagram-OS5C2QUG-cYMjsA0L.js → quadrantDiagram-OS5C2QUG-0OKnDbeW.js} +1 -1
- package/dist/assets/{requirementDiagram-MIRIMTAZ-D8piGWQV.js → requirementDiagram-MIRIMTAZ-Nq_mStSk.js} +2 -2
- package/dist/assets/{sankeyDiagram-Y46BX6SQ-DfNocUti.js → sankeyDiagram-Y46BX6SQ-ZPgHNk3C.js} +1 -1
- package/dist/assets/{sequenceDiagram-G6AWOVSC-Xu2X2iUX.js → sequenceDiagram-G6AWOVSC-BRzYMlx2.js} +1 -1
- package/dist/assets/stateDiagram-MAYHULR4-CCNAeCLE.js +1 -0
- package/dist/assets/stateDiagram-v2-4JROLMXI-Bz1kxCVf.js +1 -0
- package/dist/assets/{timeline-definition-U7ZMHBDA-CNra78s7.js → timeline-definition-U7ZMHBDA-BSw5vmnf.js} +1 -1
- package/dist/assets/{xychartDiagram-6QU3TZC5-BSwY5sKC.js → xychartDiagram-6QU3TZC5-BuqrahPf.js} +2 -2
- package/dist/index.html +2 -2
- package/dist-server/app.module.js +4 -0
- package/dist-server/bootstrap/crewx-server.js +6 -3
- package/dist-server/common/limits/defaults.js +2 -0
- package/dist-server/domain/auth/auth.module.js +2 -1
- package/dist-server/domain/auth/guards/base-auth.guard.js +36 -14
- package/dist-server/domain/doc/doc.controller.js +21 -0
- package/dist-server/domain/doc/doc.service.js +36 -6
- package/dist-server/domain/doc/image-constants.js +11 -0
- package/dist-server/domain/events/events.module.js +31 -0
- package/dist-server/domain/events/server-conversation.plugin.js +45 -0
- package/dist-server/domain/events/workspace-event.bus.js +32 -0
- package/dist-server/domain/events/workspace-event.types.js +12 -0
- package/dist-server/domain/events/workspace-events-test.controller.js +83 -0
- package/dist-server/domain/events/workspace-events.controller.js +47 -0
- package/dist-server/domain/mcp/browser-session.store.js +50 -0
- package/dist-server/domain/mcp/chromex-blacklist.js +26 -0
- package/dist-server/domain/mcp/chromex-negotiate.controller.js +77 -0
- package/dist-server/domain/mcp/chromex-negotiate.dto.js +95 -0
- package/dist-server/domain/mcp/chromex-negotiate.service.js +249 -0
- package/dist-server/domain/mcp/mcp-auth.guard.js +40 -26
- package/dist-server/domain/mcp/mcp.constants.js +4 -1
- package/dist-server/domain/mcp/mcp.controller.js +5 -4
- package/dist-server/domain/mcp/mcp.module.js +6 -2
- package/dist-server/domain/mcp/mcp.service.js +62 -5
- package/dist-server/domain/message/dto/send-message.dto.js +48 -1
- package/dist-server/domain/message/message.controller.js +40 -1
- package/dist-server/domain/message/message.service.js +50 -5
- package/dist-server/domain/task/task.service.js +34 -13
- package/dist-server/domain/thread/thread.controller.js +16 -0
- package/dist-server/domain/thread/thread.module.js +2 -0
- package/dist-server/domain/thread/thread.service.js +80 -11
- package/dist-server/domain/token/token.controller.js +73 -0
- package/dist-server/domain/token/token.dto.js +56 -0
- package/dist-server/domain/token/token.module.js +22 -0
- package/dist-server/domain/token/token.service.js +228 -0
- package/dist-server/main.js +23 -2
- package/dist-server/modules/crewx-pool.service.js +129 -5
- package/dist-server/modules/crewx.module.js +6 -0
- package/package.json +17 -14
- package/packages/cli/dist/builtin.js +2 -0
- package/packages/cli/dist/commands/init.js +5 -5
- package/packages/cli/dist/commands/registry.js +1 -1
- package/packages/cli/package.json +2 -1
- package/dist/assets/_baseUniq-B5kIqYhv.js +0 -1
- package/dist/assets/architectureDiagram-UYN6MBPD-Bvk4uHjQ.js +0 -36
- package/dist/assets/blockDiagram-ZHA2E4KO-C9-iioqe.js +0 -121
- package/dist/assets/channel-B1S1YSXQ.js +0 -1
- package/dist/assets/classDiagram-LNE6IOMH-BMiPdBl0.js +0 -1
- package/dist/assets/classDiagram-v2-MQ7JQ4JX-BMiPdBl0.js +0 -1
- package/dist/assets/clone-DkRtovKq.js +0 -1
- package/dist/assets/dagre-4EVJKHTY-LsgK-pqb.js +0 -4
- package/dist/assets/diagram-QW4FP2JN-uvhH5Eln.js +0 -24
- package/dist/assets/gitGraph-YCYPL57B-D9Hkzkze.js +0 -133
- package/dist/assets/gitGraphDiagram-NRZ2UAAF-oWiYlrjZ.js +0 -65
- package/dist/assets/graph-D66Q_If6.js +0 -1
- package/dist/assets/infoDiagram-A4XQUW5V-aJ6i9Snw.js +0 -2
- package/dist/assets/layout-CaxkerSC.js +0 -1
- package/dist/assets/main-3IYf82MG.css +0 -10
- package/dist/assets/main-DCHJFonK.js +0 -1167
- package/dist/assets/min-uKYaLZUT.js +0 -1
- package/dist/assets/pieDiagram-YF2LJOPJ-BFJ_DAm-.js +0 -30
- package/dist/assets/stateDiagram-MAYHULR4-WmJVTQsF.js +0 -1
- package/dist/assets/stateDiagram-v2-4JROLMXI-DNAOV6w0.js +0 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var Ih=Object.defineProperty;var xh=(t,e,n)=>e in t?Ih(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var At=(t,e,n)=>(xh(t,typeof e!="symbol"?e+"":e,n),n);import{c2 as Sn}from"./main-CgT_Atre.js";function ue(t){return typeof t=="object"&&t!==null&&typeof t.$type=="string"}function qe(t){return typeof t=="object"&&t!==null&&typeof t.$refText=="string"}function Ch(t){return typeof t=="object"&&t!==null&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.path=="string"}function Rr(t){return typeof t=="object"&&t!==null&&ue(t.container)&&qe(t.reference)&&typeof t.message=="string"}class il{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,n){return ue(e)&&this.isSubtype(e.$type,n)}isSubtype(e,n){if(e===n)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[n];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,n);return r[n]=s,s}}getAllSubTypes(e){const n=this.allSubtypes[e];if(n)return n;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function tn(t){return typeof t=="object"&&t!==null&&Array.isArray(t.content)}function sl(t){return typeof t=="object"&&t!==null&&typeof t.tokenType=="object"}function al(t){return tn(t)&&typeof t.fullText=="string"}class oe{constructor(e,n){this.startFn=e,this.nextFn=n}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let n=0,r=e.next();for(;!r.done;)n++,r=e.next();return n}toArray(){const e=[],n=this.iterator();let r;do r=n.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,n){const r=this.map(i=>[e?e(i):i,n?n(i):i]);return new Map(r)}toString(){return this.join()}concat(e){const n=e[Symbol.iterator]();return new oe(()=>({first:this.startFn(),firstDone:!1}),r=>{let i;if(!r.firstDone){do if(i=this.nextFn(r.first),!i.done)return i;while(!i.done);r.firstDone=!0}do if(i=n.next(),!i.done)return i;while(!i.done);return Ce})}join(e=","){const n=this.iterator();let r="",i,s=!1;do i=n.next(),i.done||(s&&(r+=e),r+=wh(i.value)),s=!0;while(!i.done);return r}indexOf(e,n=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=n&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(!e(r.value))return!1;r=n.next()}return!0}some(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return!0;r=n.next()}return!1}forEach(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;)e(i.value,r),i=n.next(),r++}map(e){return new oe(this.startFn,n=>{const{done:r,value:i}=this.nextFn(n);return r?Ce:{done:!1,value:e(i)}})}filter(e){return new oe(this.startFn,n=>{let r;do if(r=this.nextFn(n),!r.done&&e(r.value))return r;while(!r.done);return Ce})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,n){const r=this.iterator();let i=n,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,n){return this.recursiveReduce(this.iterator(),e,n)}recursiveReduce(e,n,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,n,r);return s===void 0?i.value:n(s,i.value)}find(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(e(r.value))return r.value;r=n.next()}}findIndex(e){const n=this.iterator();let r=0,i=n.next();for(;!i.done;){if(e(i.value))return r;i=n.next(),r++}return-1}includes(e){const n=this.iterator();let r=n.next();for(;!r.done;){if(r.value===e)return!0;r=n.next()}return!1}flatMap(e){return new oe(()=>({this:this.startFn()}),n=>{do{if(n.iterator){const s=n.iterator.next();if(s.done)n.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(n.this);if(!r){const s=e(i);if(wr(s))n.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(n.iterator);return Ce})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const n=e>1?this.flat(e-1):this;return new oe(()=>({this:n.startFn()}),r=>{do{if(r.iterator){const a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}const{done:i,value:s}=n.nextFn(r.this);if(!i)if(wr(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return Ce})}head(){const n=this.iterator().next();if(!n.done)return n.value}tail(e=1){return new oe(()=>{const n=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(n).done)return n;return n},this.nextFn)}limit(e){return new oe(()=>({size:0,state:this.startFn()}),n=>(n.size++,n.size>e?Ce:this.nextFn(n.state)))}distinct(e){const n=new Set;return this.filter(r=>{const i=e?e(r):r;return n.has(i)?!1:(n.add(i),!0)})}exclude(e,n){const r=new Set;for(const i of e){const s=n?n(i):i;r.add(s)}return this.filter(i=>{const s=n?n(i):i;return!r.has(s)})}}function wh(t){return typeof t=="string"?t:typeof t>"u"?"undefined":typeof t.toString=="function"?t.toString():Object.prototype.toString.call(t)}function wr(t){return!!t&&typeof t[Symbol.iterator]=="function"}const Nh=new oe(()=>{},()=>Ce),Ce=Object.freeze({done:!0,value:void 0});function ne(...t){if(t.length===1){const e=t[0];if(e instanceof oe)return e;if(wr(e))return new oe(()=>e[Symbol.iterator](),n=>n.next());if(typeof e.length=="number")return new oe(()=>({index:0}),n=>n.index<e.length?{done:!1,value:e[n.index++]}:Ce)}return t.length>1?new oe(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const n=e.iterator.next();if(!n.done)return n;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<t.length){const n=t[e.collIndex++];wr(n)?e.iterator=n[Symbol.iterator]():n&&typeof n.length=="number"&&(e.array=n)}}while(e.iterator||e.array||e.collIndex<t.length);return Ce}):Nh}class Xs extends oe{constructor(e,n,r){super(()=>({iterators:r!=null&&r.includeRoot?[[e][Symbol.iterator]()]:[n(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(n(a.value)[Symbol.iterator]()),a}return Ce})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var ss;(function(t){function e(s){return s.reduce((a,o)=>a+o,0)}t.sum=e;function n(s){return s.reduce((a,o)=>a*o,0)}t.product=n;function r(s){return s.reduce((a,o)=>Math.min(a,o))}t.min=r;function i(s){return s.reduce((a,o)=>Math.max(a,o))}t.max=i})(ss||(ss={}));function as(t){return new Xs(t,e=>tn(e)?e.content:[],{includeRoot:!0})}function bh(t,e){for(;t.container;)if(t=t.container,t===e)return!0;return!1}function os(t){return{start:{character:t.startColumn-1,line:t.startLine-1},end:{character:t.endColumn,line:t.endLine-1}}}function Nr(t){if(!t)return;const{offset:e,end:n,range:r}=t;return{range:r,offset:e,end:n,length:n-e}}var Rt;(function(t){t[t.Before=0]="Before",t[t.After=1]="After",t[t.OverlapFront=2]="OverlapFront",t[t.OverlapBack=3]="OverlapBack",t[t.Inside=4]="Inside"})(Rt||(Rt={}));function kh(t,e){if(t.end.line<e.start.line||t.end.line===e.start.line&&t.end.character<t.start.character)return Rt.Before;if(t.start.line>e.end.line||t.start.line===e.end.line&&t.start.character>e.end.character)return Rt.After;const n=t.start.line>e.start.line||t.start.line===e.start.line&&t.start.character>=e.start.character,r=t.end.line<e.end.line||t.end.line===e.end.line&&t.end.character<=e.end.character;return n&&r?Rt.Inside:n?Rt.OverlapBack:Rt.OverlapFront}function Oh(t,e){return kh(t,e)>Rt.After}const Ph=/^[\w\p{L}]$/u;function Lh(t,e){if(t){const n=Mh(t,!0);if(n&&Qa(n,e))return n;if(al(t)){const r=t.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=t.content[i];if(Qa(s,e))return s}}}}function Qa(t,e){return sl(t)&&e.includes(t.tokenType.name)}function Mh(t,e=!0){for(;t.container;){const n=t.container;let r=n.content.indexOf(t);for(;r>0;){r--;const i=n.content[r];if(e||!i.hidden)return i}t=n}}class ol extends Error{constructor(e,n){super(e?`${n} at ${e.range.start.line}:${e.range.start.character}`:n)}}function ni(t){throw new Error("Error! The input value was not handled.")}const Fi="AbstractRule",Gi="AbstractType",Za="Condition",Dh="TypeDefinition",eo="ValueLiteral",cl="AbstractElement";function Fh(t){return F.isInstance(t,cl)}const Gh="ArrayLiteral",Uh="ArrayType",ul="BooleanLiteral";function Bh(t){return F.isInstance(t,ul)}const ll="Conjunction";function jh(t){return F.isInstance(t,ll)}const fl="Disjunction";function Hh(t){return F.isInstance(t,fl)}const Wh="Grammar",dl="InferredType";function hl(t){return F.isInstance(t,dl)}const pl="Interface";function gl(t){return F.isInstance(t,pl)}const ml="Negation";function zh(t){return F.isInstance(t,ml)}const Kh="NumberLiteral",Vh="Parameter",yl="ParameterReference";function qh(t){return F.isInstance(t,yl)}const Tl="ParserRule";function be(t){return F.isInstance(t,Tl)}const Yh="ReferenceType",Xh="ReturnType";function Jh(t){return F.isInstance(t,Xh)}const vl="SimpleType";function Qh(t){return F.isInstance(t,vl)}const Zh="StringLiteral",cs="TerminalRule";function jt(t){return F.isInstance(t,cs)}const Al="Type";function El(t){return F.isInstance(t,Al)}const ep="UnionType",Rl="Action";function ri(t){return F.isInstance(t,Rl)}const $l="Alternatives";function Sl(t){return F.isInstance(t,$l)}const _l="Assignment";function Lt(t){return F.isInstance(t,_l)}const Il="CharacterRange";function tp(t){return F.isInstance(t,Il)}const xl="CrossReference";function Js(t){return F.isInstance(t,xl)}const Cl="EndOfFile";function np(t){return F.isInstance(t,Cl)}const wl="Group";function Qs(t){return F.isInstance(t,wl)}const Nl="Keyword";function Mt(t){return F.isInstance(t,Nl)}const bl="NegatedToken";function rp(t){return F.isInstance(t,bl)}const kl="RegexToken";function ip(t){return F.isInstance(t,kl)}const Ol="RuleCall";function Dt(t){return F.isInstance(t,Ol)}const Pl="TerminalAlternatives";function sp(t){return F.isInstance(t,Pl)}const Ll="TerminalGroup";function ap(t){return F.isInstance(t,Ll)}const Ml="TerminalRuleCall";function op(t){return F.isInstance(t,Ml)}const Dl="UnorderedGroup";function Fl(t){return F.isInstance(t,Dl)}const Gl="UntilToken";function cp(t){return F.isInstance(t,Gl)}const Ul="Wildcard";function up(t){return F.isInstance(t,Ul)}class Bl extends il{getAllTypes(){return["AbstractElement","AbstractRule","AbstractType","Action","Alternatives","ArrayLiteral","ArrayType","Assignment","BooleanLiteral","CharacterRange","Condition","Conjunction","CrossReference","Disjunction","EndOfFile","Grammar","GrammarImport","Group","InferredType","Interface","Keyword","NamedArgument","NegatedToken","Negation","NumberLiteral","Parameter","ParameterReference","ParserRule","ReferenceType","RegexToken","ReturnType","RuleCall","SimpleType","StringLiteral","TerminalAlternatives","TerminalGroup","TerminalRule","TerminalRuleCall","Type","TypeAttribute","TypeDefinition","UnionType","UnorderedGroup","UntilToken","ValueLiteral","Wildcard"]}computeIsSubtype(e,n){switch(e){case Rl:case $l:case _l:case Il:case xl:case Cl:case wl:case Nl:case bl:case kl:case Ol:case Pl:case Ll:case Ml:case Dl:case Gl:case Ul:return this.isSubtype(cl,n);case Gh:case Kh:case Zh:return this.isSubtype(eo,n);case Uh:case Yh:case vl:case ep:return this.isSubtype(Dh,n);case ul:return this.isSubtype(Za,n)||this.isSubtype(eo,n);case ll:case fl:case ml:case yl:return this.isSubtype(Za,n);case dl:case pl:case Al:return this.isSubtype(Gi,n);case Tl:return this.isSubtype(Fi,n)||this.isSubtype(Gi,n);case cs:return this.isSubtype(Fi,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return Gi;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Fi;case"Grammar:usedGrammars":return Wh;case"NamedArgument:parameter":case"ParameterReference:parameter":return Vh;case"TerminalRuleCall:rule":return cs;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"AbstractElement":return{name:"AbstractElement",properties:[{name:"cardinality"},{name:"lookahead"}]};case"ArrayLiteral":return{name:"ArrayLiteral",properties:[{name:"elements",defaultValue:[]}]};case"ArrayType":return{name:"ArrayType",properties:[{name:"elementType"}]};case"BooleanLiteral":return{name:"BooleanLiteral",properties:[{name:"true",defaultValue:!1}]};case"Conjunction":return{name:"Conjunction",properties:[{name:"left"},{name:"right"}]};case"Disjunction":return{name:"Disjunction",properties:[{name:"left"},{name:"right"}]};case"Grammar":return{name:"Grammar",properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case"GrammarImport":return{name:"GrammarImport",properties:[{name:"path"}]};case"InferredType":return{name:"InferredType",properties:[{name:"name"}]};case"Interface":return{name:"Interface",properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case"NamedArgument":return{name:"NamedArgument",properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case"Negation":return{name:"Negation",properties:[{name:"value"}]};case"NumberLiteral":return{name:"NumberLiteral",properties:[{name:"value"}]};case"Parameter":return{name:"Parameter",properties:[{name:"name"}]};case"ParameterReference":return{name:"ParameterReference",properties:[{name:"parameter"}]};case"ParserRule":return{name:"ParserRule",properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case"ReferenceType":return{name:"ReferenceType",properties:[{name:"referenceType"}]};case"ReturnType":return{name:"ReturnType",properties:[{name:"name"}]};case"SimpleType":return{name:"SimpleType",properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case"StringLiteral":return{name:"StringLiteral",properties:[{name:"value"}]};case"TerminalRule":return{name:"TerminalRule",properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case"Type":return{name:"Type",properties:[{name:"name"},{name:"type"}]};case"TypeAttribute":return{name:"TypeAttribute",properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case"UnionType":return{name:"UnionType",properties:[{name:"types",defaultValue:[]}]};case"Action":return{name:"Action",properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case"Alternatives":return{name:"Alternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"Assignment":return{name:"Assignment",properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case"CharacterRange":return{name:"CharacterRange",properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case"CrossReference":return{name:"CrossReference",properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case"EndOfFile":return{name:"EndOfFile",properties:[{name:"cardinality"},{name:"lookahead"}]};case"Group":return{name:"Group",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case"Keyword":return{name:"Keyword",properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case"NegatedToken":return{name:"NegatedToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"RegexToken":return{name:"RegexToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case"RuleCall":return{name:"RuleCall",properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"TerminalAlternatives":return{name:"TerminalAlternatives",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalGroup":return{name:"TerminalGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"TerminalRuleCall":return{name:"TerminalRuleCall",properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case"UnorderedGroup":return{name:"UnorderedGroup",properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case"UntilToken":return{name:"UntilToken",properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case"Wildcard":return{name:"Wildcard",properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const F=new Bl;function lp(t){for(const[e,n]of Object.entries(t))e.startsWith("$")||(Array.isArray(n)?n.forEach((r,i)=>{ue(r)&&(r.$container=t,r.$containerProperty=e,r.$containerIndex=i)}):ue(n)&&(n.$container=t,n.$containerProperty=e))}function ii(t,e){let n=t;for(;n;){if(e(n))return n;n=n.$container}}function Xe(t){const n=fp(t).$document;if(!n)throw new Error("AST node has no document.");return n}function fp(t){for(;t.$container;)t=t.$container;return t}function Zs(t,e){if(!t)throw new Error("Node must be an AstNode.");const n=e==null?void 0:e.range;return new oe(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=t[i];if(ue(s)){if(r.keyIndex++,to(s,n))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const a=r.arrayIndex++,o=s[a];if(ue(o)&&to(o,n))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return Ce})}function ir(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new Xs(t,n=>Zs(n,e))}function Jt(t,e){if(!t)throw new Error("Root node must be an AstNode.");return new Xs(t,n=>Zs(n,e),{includeRoot:!0})}function to(t,e){var n;if(!e)return!0;const r=(n=t.$cstNode)===null||n===void 0?void 0:n.range;return r?Oh(r,e):!1}function jl(t){return new oe(()=>({keys:Object.keys(t),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const n=e.keys[e.keyIndex];if(!n.startsWith("$")){const r=t[n];if(qe(r))return e.keyIndex++,{done:!1,value:{reference:r,container:t,property:n}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(qe(s))return{done:!1,value:{reference:s,container:t,property:n,index:i}}}e.arrayIndex=0}}e.keyIndex++}return Ce})}function dp(t,e){const n=t.getTypeMetaData(e.$type),r=e;for(const i of n.properties)i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=Hl(i.defaultValue))}function Hl(t){return Array.isArray(t)?[...t.map(Hl)]:t}function N(t){return t.charCodeAt(0)}function Ui(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function _n(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function Yt(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function hp(){throw Error("Internal Error - Should never get here!")}function no(t){return t.type==="Character"}const br=[];for(let t=N("0");t<=N("9");t++)br.push(t);const kr=[N("_")].concat(br);for(let t=N("a");t<=N("z");t++)kr.push(t);for(let t=N("A");t<=N("Z");t++)kr.push(t);const ro=[N(" "),N("\f"),N(`
|
|
2
|
+
`),N("\r"),N(" "),N("\v"),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N(" "),N("\u2028"),N("\u2029"),N(" "),N(" "),N(" "),N("\uFEFF")],pp=/[0-9a-fA-F]/,mr=/[0-9]/,gp=/[1-9]/;class Wl{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const n=this.disjunction();this.consumeChar("/");const r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":_n(r,"global");break;case"i":_n(r,"ignoreCase");break;case"m":_n(r,"multiLine");break;case"u":_n(r,"unicode");break;case"y":_n(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:n,loc:this.loc(0)}}disjunction(){const e=[],n=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(n)}}alternative(){const e=[],n=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(n)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let n;switch(this.popChar()){case"=":n="Lookahead";break;case"!":n="NegativeLookahead";break}Yt(n);const r=this.disjunction();return this.consumeChar(")"),{type:n,value:r,loc:this.loc(e)}}return hp()}quantifier(e=!1){let n;const r=this.idx;switch(this.popChar()){case"*":n={atLeast:0,atMost:1/0};break;case"+":n={atLeast:1,atMost:1/0};break;case"?":n={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":n={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),n={atLeast:i,atMost:s}):n={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&n===void 0)return;Yt(n);break}if(!(e===!0&&n===void 0)&&Yt(n))return this.peekChar(0)==="?"?(this.consumeChar("?"),n.greedy=!1):n.greedy=!0,n.type="Quantifier",n.loc=this.loc(r),n}atom(){let e;const n=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Yt(e))return e.loc=this.loc(n),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[N(`
|
|
3
|
+
`),N("\r"),N("\u2028"),N("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,n=!1;switch(this.popChar()){case"d":e=br;break;case"D":e=br,n=!0;break;case"s":e=ro;break;case"S":e=ro,n=!0;break;case"w":e=kr;break;case"W":e=kr,n=!0;break}if(Yt(e))return{type:"Set",value:e,complement:n}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=N("\f");break;case"n":e=N(`
|
|
4
|
+
`);break;case"r":e=N("\r");break;case"t":e=N(" ");break;case"v":e=N("\v");break}if(Yt(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:N("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:N(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
5
|
+
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:N(e)}}}characterClass(){const e=[];let n=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),n=!0);this.isClassAtom();){const r=this.classAtom();if(r.type,no(r)&&this.isRangeDash()){this.consumeChar("-");const i=this.classAtom();if(i.type,no(i)){if(i.value<r.value)throw Error("Range out of order in character class");e.push({from:r.value,to:i.value})}else Ui(r.value,e),e.push(N("-")),Ui(i.value,e)}else Ui(r.value,e)}return this.consumeChar("]"),{type:"Set",complement:n,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
|
6
|
+
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:N("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;switch(this.consumeChar("("),this.peekChar(0)){case"?":this.consumeChar("?"),this.consumeChar(":"),e=!1;break;default:this.groupIdx++;break}const n=this.disjunction();this.consumeChar(")");const r={type:"Group",capturing:e,value:n};return e&&(r.idx=this.groupIdx),r}positiveInteger(){let e=this.popChar();if(gp.test(e)===!1)throw Error("Expecting a positive integer");for(;mr.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(mr.test(e)===!1)throw Error("Expecting an integer");for(;mr.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){const e=this.popChar();switch(e){case`
|
|
7
|
+
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:N(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return mr.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
|
|
8
|
+
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){const e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
|
|
9
|
+
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let n="";for(let i=0;i<e;i++){const s=this.popChar();if(pp.test(s)===!1)throw Error("Expecting a HexDecimal digits");n+=s}return{type:"Character",value:parseInt(n,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){const e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class si{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}const mp=/\r?\n/gm,yp=new Wl;class Tp extends si{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join("")}reset(e){this.multiline=!1,this.regex=e,this.startRegexp="",this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){const n=String.fromCharCode(e.value);if(!this.multiline&&n===`
|
|
10
|
+
`&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const r=ai(n);this.endRegexpStack.push(r),this.isStarting&&(this.startRegexp+=r)}}visitSet(e){if(!this.multiline){const n=this.regex.substring(e.loc.begin,e.loc.end),r=new RegExp(n);this.multiline=!!`
|
|
11
|
+
`.match(r)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{const n=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(n),this.isStarting&&(this.startRegexp+=n)}}visitChildren(e){e.type==="Group"&&e.quantifier||super.visitChildren(e)}}const Bi=new Tp;function vp(t){try{return typeof t=="string"&&(t=new RegExp(t)),t=t.toString(),Bi.reset(t),Bi.visit(yp.pattern(t)),Bi.multiline}catch{return!1}}function io(t){return(typeof t=="string"?new RegExp(t):t).test(" ")}function ai(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ap(t){return Array.prototype.map.call(t,e=>/\w/.test(e)?`[${e.toLowerCase()}${e.toUpperCase()}]`:ai(e)).join("")}function Ep(t,e){const n=Rp(t),r=e.match(n);return!!r&&r[0].length>0}function Rp(t){typeof t=="string"&&(t=new RegExp(t));const e=t,n=t.source;let r=0;function i(){let s="",a;function o(u){s+=n.substr(r,u),r+=u}function c(u){s+="(?:"+n.substr(r,u)+"|$)",r+=u}for(;r<n.length;)switch(n[r]){case"\\":switch(n[r+1]){case"c":c(3);break;case"x":c(4);break;case"u":e.unicode?n[r+2]==="{"?c(n.indexOf("}",r)-r+1):c(6):c(2);break;case"p":case"P":e.unicode?c(n.indexOf("}",r)-r+1):c(2);break;case"k":c(n.indexOf(">",r)-r+1);break;default:c(2);break}break;case"[":a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],c(a[0].length);break;case"|":case"^":case"$":case"*":case"+":case"?":o(1);break;case"{":a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):c(1);break;case"(":if(n[r+1]==="?")switch(n[r+2]){case":":s+="(?:",r+=3,s+=i()+"|$)";break;case"=":s+="(?=",r+=3,s+=i()+")";break;case"!":a=r,r+=3,i(),s+=n.substr(a,r-a);break;case"<":switch(n[r+3]){case"=":case"!":a=r,r+=4,i(),s+=n.substr(a,r-a);break;default:o(n.indexOf(">",r)-r+1),s+=i()+"|$)";break}break}else o(1),s+=i()+"|$)";break;case")":return++r,s;default:c(1);break}return s}return new RegExp(i(),t.flags)}function $p(t){return t.rules.find(e=>be(e)&&e.entry)}function Sp(t){return t.rules.filter(e=>jt(e)&&e.hidden)}function zl(t,e){const n=new Set,r=$p(t);if(!r)return new Set(t.rules);const i=[r].concat(Sp(t));for(const a of i)Kl(a,n,e);const s=new Set;for(const a of t.rules)(n.has(a.name)||jt(a)&&a.hidden)&&s.add(a);return s}function Kl(t,e,n){e.add(t.name),ir(t).forEach(r=>{if(Dt(r)||n){const i=r.rule.ref;i&&!e.has(i.name)&&Kl(i,e,n)}})}function _p(t){if(t.terminal)return t.terminal;if(t.type.ref){const e=ql(t.type.ref);return e==null?void 0:e.terminal}}function Ip(t){return t.hidden&&!na(t).test(" ")}function xp(t,e){return!t||!e?[]:ea(t,e,t.astNode,!0)}function Vl(t,e,n){if(!t||!e)return;const r=ea(t,e,t.astNode,!0);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function ea(t,e,n,r){if(!r){const i=ii(t.grammarSource,Lt);if(i&&i.feature===e)return[t]}return tn(t)&&t.astNode===n?t.content.flatMap(i=>ea(i,e,n,!1)):[]}function Cp(t,e,n){if(!t)return;const r=wp(t,e,t==null?void 0:t.astNode);if(r.length!==0)return n!==void 0?n=Math.max(0,Math.min(n,r.length-1)):n=0,r[n]}function wp(t,e,n){if(t.astNode!==n)return[];if(Mt(t.grammarSource)&&t.grammarSource.value===e)return[t];const r=as(t).iterator();let i;const s=[];do if(i=r.next(),!i.done){const a=i.value;a.astNode===n?Mt(a.grammarSource)&&a.grammarSource.value===e&&s.push(a):r.prune()}while(!i.done);return s}function Np(t){var e;const n=t.astNode;for(;n===((e=t.container)===null||e===void 0?void 0:e.astNode);){const r=ii(t.grammarSource,Lt);if(r)return r;t=t.container}}function ql(t){let e=t;return hl(e)&&(ri(e.$container)?e=e.$container.$container:be(e.$container)?e=e.$container:ni(e.$container)),Yl(t,e,new Map)}function Yl(t,e,n){var r;function i(s,a){let o;return ii(s,Lt)||(o=Yl(a,a,n)),n.set(t,o),o}if(n.has(t))return n.get(t);n.set(t,void 0);for(const s of ir(e)){if(Lt(s)&&s.feature.toLowerCase()==="name")return n.set(t,s),s;if(Dt(s)&&be(s.rule.ref))return i(s,s.rule.ref);if(Qh(s)&&(!((r=s.typeRef)===null||r===void 0)&&r.ref))return i(s,s.typeRef.ref)}}function ta(t){return Xl(t,new Set)}function Xl(t,e){if(e.has(t))return!0;e.add(t);for(const n of ir(t))if(Dt(n)){if(!n.rule.ref||be(n.rule.ref)&&!Xl(n.rule.ref,e))return!1}else{if(Lt(n))return!1;if(ri(n))return!1}return!!t.definition}function Jl(t){if(t.inferredType)return t.inferredType.name;if(t.dataType)return t.dataType;if(t.returnType){const e=t.returnType.ref;if(e){if(be(e))return e.name;if(gl(e)||El(e))return e.name}}}function oi(t){var e;if(be(t))return ta(t)?t.name:(e=Jl(t))!==null&&e!==void 0?e:t.name;if(gl(t)||El(t)||Jh(t))return t.name;if(ri(t)){const n=bp(t);if(n)return n}else if(hl(t))return t.name;throw new Error("Cannot get name of Unknown Type")}function bp(t){var e;if(t.inferredType)return t.inferredType.name;if(!((e=t.type)===null||e===void 0)&&e.ref)return oi(t.type.ref)}function kp(t){var e,n,r;return jt(t)?(n=(e=t.type)===null||e===void 0?void 0:e.name)!==null&&n!==void 0?n:"string":ta(t)?t.name:(r=Jl(t))!==null&&r!==void 0?r:t.name}function na(t){const e={s:!1,i:!1,u:!1},n=pn(t.definition,e),r=Object.entries(e).filter(([,i])=>i).map(([i])=>i).join("");return new RegExp(n,r)}const ra=/[\s\S]/.source;function pn(t,e){if(sp(t))return Op(t);if(ap(t))return Pp(t);if(tp(t))return Dp(t);if(op(t)){const n=t.rule.ref;if(!n)throw new Error("Missing rule reference.");return ct(pn(n.definition),{cardinality:t.cardinality,lookahead:t.lookahead})}else{if(rp(t))return Mp(t);if(cp(t))return Lp(t);if(ip(t)){const n=t.regex.lastIndexOf("/"),r=t.regex.substring(1,n),i=t.regex.substring(n+1);return e&&(e.i=i.includes("i"),e.s=i.includes("s"),e.u=i.includes("u")),ct(r,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}else{if(up(t))return ct(ra,{cardinality:t.cardinality,lookahead:t.lookahead});throw new Error(`Invalid terminal element: ${t==null?void 0:t.$type}`)}}}function Op(t){return ct(t.elements.map(e=>pn(e)).join("|"),{cardinality:t.cardinality,lookahead:t.lookahead})}function Pp(t){return ct(t.elements.map(e=>pn(e)).join(""),{cardinality:t.cardinality,lookahead:t.lookahead})}function Lp(t){return ct(`${ra}*?${pn(t.terminal)}`,{cardinality:t.cardinality,lookahead:t.lookahead})}function Mp(t){return ct(`(?!${pn(t.terminal)})${ra}*?`,{cardinality:t.cardinality,lookahead:t.lookahead})}function Dp(t){return t.right?ct(`[${ji(t.left)}-${ji(t.right)}]`,{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1}):ct(ji(t.left),{cardinality:t.cardinality,lookahead:t.lookahead,wrap:!1})}function ji(t){return ai(t.value)}function ct(t,e){var n;return(e.wrap!==!1||e.lookahead)&&(t=`(${(n=e.lookahead)!==null&&n!==void 0?n:""}${t})`),e.cardinality?`${t}${e.cardinality}`:t}function Fp(t){const e=[],n=t.Grammar;for(const r of n.rules)jt(r)&&Ip(r)&&vp(na(r))&&e.push(r.name);return{multilineCommentRules:e,nameRegexp:Ph}}var Ql=typeof global=="object"&&global&&global.Object===Object&&global,Gp=typeof self=="object"&&self&&self.Object===Object&&self,Qe=Ql||Gp||Function("return this")(),ke=Qe.Symbol,Zl=Object.prototype,Up=Zl.hasOwnProperty,Bp=Zl.toString,In=ke?ke.toStringTag:void 0;function jp(t){var e=Up.call(t,In),n=t[In];try{t[In]=void 0;var r=!0}catch{}var i=Bp.call(t);return r&&(e?t[In]=n:delete t[In]),i}var Hp=Object.prototype,Wp=Hp.toString;function zp(t){return Wp.call(t)}var Kp="[object Null]",Vp="[object Undefined]",so=ke?ke.toStringTag:void 0;function Ct(t){return t==null?t===void 0?Vp:Kp:so&&so in Object(t)?jp(t):zp(t)}function je(t){return t!=null&&typeof t=="object"}var qp="[object Symbol]";function ci(t){return typeof t=="symbol"||je(t)&&Ct(t)==qp}function ui(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var M=Array.isArray,ao=ke?ke.prototype:void 0,oo=ao?ao.toString:void 0;function ef(t){if(typeof t=="string")return t;if(M(t))return ui(t,ef)+"";if(ci(t))return oo?oo.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var Yp=/\s/;function Xp(t){for(var e=t.length;e--&&Yp.test(t.charAt(e)););return e}var Jp=/^\s+/;function Qp(t){return t&&t.slice(0,Xp(t)+1).replace(Jp,"")}function Oe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var co=NaN,Zp=/^[-+]0x[0-9a-f]+$/i,eg=/^0b[01]+$/i,tg=/^0o[0-7]+$/i,ng=parseInt;function rg(t){if(typeof t=="number")return t;if(ci(t))return co;if(Oe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Oe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Qp(t);var n=eg.test(t);return n||tg.test(t)?ng(t.slice(2),n?2:8):Zp.test(t)?co:+t}var uo=1/0,ig=17976931348623157e292;function sg(t){if(!t)return t===0?t:0;if(t=rg(t),t===uo||t===-uo){var e=t<0?-1:1;return e*ig}return t===t?t:0}function li(t){var e=sg(t),n=e%1;return e===e?n?e-n:e:0}function nn(t){return t}var ag="[object AsyncFunction]",og="[object Function]",cg="[object GeneratorFunction]",ug="[object Proxy]";function ht(t){if(!Oe(t))return!1;var e=Ct(t);return e==og||e==cg||e==ag||e==ug}var Hi=Qe["__core-js_shared__"],lo=function(){var t=/[^.]+$/.exec(Hi&&Hi.keys&&Hi.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function lg(t){return!!lo&&lo in t}var fg=Function.prototype,dg=fg.toString;function Ht(t){if(t!=null){try{return dg.call(t)}catch{}try{return t+""}catch{}}return""}var hg=/[\\^$.*+?()[\]{}|]/g,pg=/^\[object .+?Constructor\]$/,gg=Function.prototype,mg=Object.prototype,yg=gg.toString,Tg=mg.hasOwnProperty,vg=RegExp("^"+yg.call(Tg).replace(hg,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ag(t){if(!Oe(t)||lg(t))return!1;var e=ht(t)?vg:pg;return e.test(Ht(t))}function Eg(t,e){return t==null?void 0:t[e]}function Wt(t,e){var n=Eg(t,e);return Ag(n)?n:void 0}var us=Wt(Qe,"WeakMap"),fo=Object.create,Rg=function(){function t(){}return function(e){if(!Oe(e))return{};if(fo)return fo(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function $g(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function X(){}function Sg(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var _g=800,Ig=16,xg=Date.now;function Cg(t){var e=0,n=0;return function(){var r=xg(),i=Ig-(r-n);if(n=r,i>0){if(++e>=_g)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function wg(t){return function(){return t}}var Or=function(){try{var t=Wt(Object,"defineProperty");return t({},"",{}),t}catch{}}(),Ng=Or?function(t,e){return Or(t,"toString",{configurable:!0,enumerable:!1,value:wg(e),writable:!0})}:nn,bg=Cg(Ng);function tf(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function nf(t,e,n,r){for(var i=t.length,s=n+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function kg(t){return t!==t}function Og(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function ia(t,e,n){return e===e?Og(t,e,n):nf(t,kg,n)}function rf(t,e){var n=t==null?0:t.length;return!!n&&ia(t,e,0)>-1}var Pg=9007199254740991,Lg=/^(?:0|[1-9]\d*)$/;function fi(t,e){var n=typeof t;return e=e??Pg,!!e&&(n=="number"||n!="symbol"&&Lg.test(t))&&t>-1&&t%1==0&&t<e}function sa(t,e,n){e=="__proto__"&&Or?Or(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function sr(t,e){return t===e||t!==t&&e!==e}var Mg=Object.prototype,Dg=Mg.hasOwnProperty;function di(t,e,n){var r=t[e];(!(Dg.call(t,e)&&sr(r,n))||n===void 0&&!(e in t))&&sa(t,e,n)}function aa(t,e,n,r){var i=!n;n||(n={});for(var s=-1,a=e.length;++s<a;){var o=e[s],c=void 0;c===void 0&&(c=t[o]),i?sa(n,o,c):di(n,o,c)}return n}var ho=Math.max;function Fg(t,e,n){return e=ho(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=ho(r.length-e,0),a=Array(s);++i<s;)a[i]=r[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=r[i];return o[e]=n(a),$g(t,this,o)}}function oa(t,e){return bg(Fg(t,e,nn),t+"")}var Gg=9007199254740991;function ca(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Gg}function Ze(t){return t!=null&&ca(t.length)&&!ht(t)}function sf(t,e,n){if(!Oe(n))return!1;var r=typeof e;return(r=="number"?Ze(n)&&fi(e,n.length):r=="string"&&e in n)?sr(n[e],t):!1}function Ug(t){return oa(function(e,n){var r=-1,i=n.length,s=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(s=t.length>3&&typeof s=="function"?(i--,s):void 0,a&&sf(n[0],n[1],a)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var o=n[r];o&&t(e,o,r,s)}return e})}var Bg=Object.prototype;function ar(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||Bg;return t===n}function jg(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var Hg="[object Arguments]";function po(t){return je(t)&&Ct(t)==Hg}var af=Object.prototype,Wg=af.hasOwnProperty,zg=af.propertyIsEnumerable,hi=po(function(){return arguments}())?po:function(t){return je(t)&&Wg.call(t,"callee")&&!zg.call(t,"callee")};function Kg(){return!1}var of=typeof exports=="object"&&exports&&!exports.nodeType&&exports,go=of&&typeof module=="object"&&module&&!module.nodeType&&module,Vg=go&&go.exports===of,mo=Vg?Qe.Buffer:void 0,qg=mo?mo.isBuffer:void 0,Ln=qg||Kg,Yg="[object Arguments]",Xg="[object Array]",Jg="[object Boolean]",Qg="[object Date]",Zg="[object Error]",em="[object Function]",tm="[object Map]",nm="[object Number]",rm="[object Object]",im="[object RegExp]",sm="[object Set]",am="[object String]",om="[object WeakMap]",cm="[object ArrayBuffer]",um="[object DataView]",lm="[object Float32Array]",fm="[object Float64Array]",dm="[object Int8Array]",hm="[object Int16Array]",pm="[object Int32Array]",gm="[object Uint8Array]",mm="[object Uint8ClampedArray]",ym="[object Uint16Array]",Tm="[object Uint32Array]",B={};B[lm]=B[fm]=B[dm]=B[hm]=B[pm]=B[gm]=B[mm]=B[ym]=B[Tm]=!0;B[Yg]=B[Xg]=B[cm]=B[Jg]=B[um]=B[Qg]=B[Zg]=B[em]=B[tm]=B[nm]=B[rm]=B[im]=B[sm]=B[am]=B[om]=!1;function vm(t){return je(t)&&ca(t.length)&&!!B[Ct(t)]}function pi(t){return function(e){return t(e)}}var cf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,On=cf&&typeof module=="object"&&module&&!module.nodeType&&module,Am=On&&On.exports===cf,Wi=Am&&Ql.process,$t=function(){try{var t=On&&On.require&&On.require("util").types;return t||Wi&&Wi.binding&&Wi.binding("util")}catch{}}(),yo=$t&&$t.isTypedArray,ua=yo?pi(yo):vm,Em=Object.prototype,Rm=Em.hasOwnProperty;function uf(t,e){var n=M(t),r=!n&&hi(t),i=!n&&!r&&Ln(t),s=!n&&!r&&!i&&ua(t),a=n||r||i||s,o=a?jg(t.length,String):[],c=o.length;for(var u in t)(e||Rm.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||fi(u,c)))&&o.push(u);return o}function lf(t,e){return function(n){return t(e(n))}}var $m=lf(Object.keys,Object),Sm=Object.prototype,_m=Sm.hasOwnProperty;function ff(t){if(!ar(t))return $m(t);var e=[];for(var n in Object(t))_m.call(t,n)&&n!="constructor"&&e.push(n);return e}function Pe(t){return Ze(t)?uf(t):ff(t)}var Im=Object.prototype,xm=Im.hasOwnProperty,Re=Ug(function(t,e){if(ar(e)||Ze(e)){aa(e,Pe(e),t);return}for(var n in e)xm.call(e,n)&&di(t,n,e[n])});function Cm(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var wm=Object.prototype,Nm=wm.hasOwnProperty;function bm(t){if(!Oe(t))return Cm(t);var e=ar(t),n=[];for(var r in t)r=="constructor"&&(e||!Nm.call(t,r))||n.push(r);return n}function df(t){return Ze(t)?uf(t,!0):bm(t)}var km=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Om=/^\w*$/;function la(t,e){if(M(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||ci(t)?!0:Om.test(t)||!km.test(t)||e!=null&&t in Object(e)}var Mn=Wt(Object,"create");function Pm(){this.__data__=Mn?Mn(null):{},this.size=0}function Lm(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Mm="__lodash_hash_undefined__",Dm=Object.prototype,Fm=Dm.hasOwnProperty;function Gm(t){var e=this.__data__;if(Mn){var n=e[t];return n===Mm?void 0:n}return Fm.call(e,t)?e[t]:void 0}var Um=Object.prototype,Bm=Um.hasOwnProperty;function jm(t){var e=this.__data__;return Mn?e[t]!==void 0:Bm.call(e,t)}var Hm="__lodash_hash_undefined__";function Wm(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Mn&&e===void 0?Hm:e,this}function Ft(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ft.prototype.clear=Pm;Ft.prototype.delete=Lm;Ft.prototype.get=Gm;Ft.prototype.has=jm;Ft.prototype.set=Wm;function zm(){this.__data__=[],this.size=0}function gi(t,e){for(var n=t.length;n--;)if(sr(t[n][0],e))return n;return-1}var Km=Array.prototype,Vm=Km.splice;function qm(t){var e=this.__data__,n=gi(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Vm.call(e,n,1),--this.size,!0}function Ym(t){var e=this.__data__,n=gi(e,t);return n<0?void 0:e[n][1]}function Xm(t){return gi(this.__data__,t)>-1}function Jm(t,e){var n=this.__data__,r=gi(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function pt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}pt.prototype.clear=zm;pt.prototype.delete=qm;pt.prototype.get=Ym;pt.prototype.has=Xm;pt.prototype.set=Jm;var Dn=Wt(Qe,"Map");function Qm(){this.size=0,this.__data__={hash:new Ft,map:new(Dn||pt),string:new Ft}}function Zm(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function mi(t,e){var n=t.__data__;return Zm(e)?n[typeof e=="string"?"string":"hash"]:n.map}function ey(t){var e=mi(this,t).delete(t);return this.size-=e?1:0,e}function ty(t){return mi(this,t).get(t)}function ny(t){return mi(this,t).has(t)}function ry(t,e){var n=mi(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function gt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}gt.prototype.clear=Qm;gt.prototype.delete=ey;gt.prototype.get=ty;gt.prototype.has=ny;gt.prototype.set=ry;var iy="Expected a function";function fa(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(iy);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var a=t.apply(this,r);return n.cache=s.set(i,a)||s,a};return n.cache=new(fa.Cache||gt),n}fa.Cache=gt;var sy=500;function ay(t){var e=fa(t,function(r){return n.size===sy&&n.clear(),r}),n=e.cache;return e}var oy=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cy=/\\(\\)?/g,uy=ay(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(oy,function(n,r,i,s){e.push(i?s.replace(cy,"$1"):r||n)}),e});function ly(t){return t==null?"":ef(t)}function yi(t,e){return M(t)?t:la(t,e)?[t]:uy(ly(t))}function or(t){if(typeof t=="string"||ci(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function da(t,e){e=yi(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[or(e[n++])];return n&&n==r?t:void 0}function fy(t,e,n){var r=t==null?void 0:da(t,e);return r===void 0?n:r}function ha(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var To=ke?ke.isConcatSpreadable:void 0;function dy(t){return M(t)||hi(t)||!!(To&&t&&t[To])}function pa(t,e,n,r,i){var s=-1,a=t.length;for(n||(n=dy),i||(i=[]);++s<a;){var o=t[s];n(o)?ha(i,o):r||(i[i.length]=o)}return i}function Ge(t){var e=t==null?0:t.length;return e?pa(t):[]}var hf=lf(Object.getPrototypeOf,Object);function pf(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}function hy(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function py(){this.__data__=new pt,this.size=0}function gy(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function my(t){return this.__data__.get(t)}function yy(t){return this.__data__.has(t)}var Ty=200;function vy(t,e){var n=this.__data__;if(n instanceof pt){var r=n.__data__;if(!Dn||r.length<Ty-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new gt(r)}return n.set(t,e),this.size=n.size,this}function Ye(t){var e=this.__data__=new pt(t);this.size=e.size}Ye.prototype.clear=py;Ye.prototype.delete=gy;Ye.prototype.get=my;Ye.prototype.has=yy;Ye.prototype.set=vy;function Ay(t,e){return t&&aa(e,Pe(e),t)}var gf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vo=gf&&typeof module=="object"&&module&&!module.nodeType&&module,Ey=vo&&vo.exports===gf,Ao=Ey?Qe.Buffer:void 0,Eo=Ao?Ao.allocUnsafe:void 0;function Ry(t,e){var n=t.length,r=Eo?Eo(n):new t.constructor(n);return t.copy(r),r}function ga(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var a=t[n];e(a,n,t)&&(s[i++]=a)}return s}function mf(){return[]}var $y=Object.prototype,Sy=$y.propertyIsEnumerable,Ro=Object.getOwnPropertySymbols,ma=Ro?function(t){return t==null?[]:(t=Object(t),ga(Ro(t),function(e){return Sy.call(t,e)}))}:mf;function _y(t,e){return aa(t,ma(t),e)}var Iy=Object.getOwnPropertySymbols,xy=Iy?function(t){for(var e=[];t;)ha(e,ma(t)),t=hf(t);return e}:mf;function yf(t,e,n){var r=e(t);return M(t)?r:ha(r,n(t))}function ls(t){return yf(t,Pe,ma)}function Cy(t){return yf(t,df,xy)}var fs=Wt(Qe,"DataView"),ds=Wt(Qe,"Promise"),Qt=Wt(Qe,"Set"),$o="[object Map]",wy="[object Object]",So="[object Promise]",_o="[object Set]",Io="[object WeakMap]",xo="[object DataView]",Ny=Ht(fs),by=Ht(Dn),ky=Ht(ds),Oy=Ht(Qt),Py=Ht(us),we=Ct;(fs&&we(new fs(new ArrayBuffer(1)))!=xo||Dn&&we(new Dn)!=$o||ds&&we(ds.resolve())!=So||Qt&&we(new Qt)!=_o||us&&we(new us)!=Io)&&(we=function(t){var e=Ct(t),n=e==wy?t.constructor:void 0,r=n?Ht(n):"";if(r)switch(r){case Ny:return xo;case by:return $o;case ky:return So;case Oy:return _o;case Py:return Io}return e});var Ly=Object.prototype,My=Ly.hasOwnProperty;function Dy(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&My.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var Pr=Qe.Uint8Array;function Fy(t){var e=new t.constructor(t.byteLength);return new Pr(e).set(new Pr(t)),e}function Gy(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var Uy=/\w*$/;function By(t){var e=new t.constructor(t.source,Uy.exec(t));return e.lastIndex=t.lastIndex,e}var Co=ke?ke.prototype:void 0,wo=Co?Co.valueOf:void 0;function jy(t){return wo?Object(wo.call(t)):{}}function Hy(t,e){var n=t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var Wy="[object Boolean]",zy="[object Date]",Ky="[object Map]",Vy="[object Number]",qy="[object RegExp]",Yy="[object Set]",Xy="[object String]",Jy="[object Symbol]",Qy="[object ArrayBuffer]",Zy="[object DataView]",eT="[object Float32Array]",tT="[object Float64Array]",nT="[object Int8Array]",rT="[object Int16Array]",iT="[object Int32Array]",sT="[object Uint8Array]",aT="[object Uint8ClampedArray]",oT="[object Uint16Array]",cT="[object Uint32Array]";function uT(t,e,n){var r=t.constructor;switch(e){case Qy:return Fy(t);case Wy:case zy:return new r(+t);case Zy:return Gy(t);case eT:case tT:case nT:case rT:case iT:case sT:case aT:case oT:case cT:return Hy(t);case Ky:return new r;case Vy:case Xy:return new r(t);case qy:return By(t);case Yy:return new r;case Jy:return jy(t)}}function lT(t){return typeof t.constructor=="function"&&!ar(t)?Rg(hf(t)):{}}var fT="[object Map]";function dT(t){return je(t)&&we(t)==fT}var No=$t&&$t.isMap,hT=No?pi(No):dT,pT="[object Set]";function gT(t){return je(t)&&we(t)==pT}var bo=$t&&$t.isSet,mT=bo?pi(bo):gT,Tf="[object Arguments]",yT="[object Array]",TT="[object Boolean]",vT="[object Date]",AT="[object Error]",vf="[object Function]",ET="[object GeneratorFunction]",RT="[object Map]",$T="[object Number]",Af="[object Object]",ST="[object RegExp]",_T="[object Set]",IT="[object String]",xT="[object Symbol]",CT="[object WeakMap]",wT="[object ArrayBuffer]",NT="[object DataView]",bT="[object Float32Array]",kT="[object Float64Array]",OT="[object Int8Array]",PT="[object Int16Array]",LT="[object Int32Array]",MT="[object Uint8Array]",DT="[object Uint8ClampedArray]",FT="[object Uint16Array]",GT="[object Uint32Array]",G={};G[Tf]=G[yT]=G[wT]=G[NT]=G[TT]=G[vT]=G[bT]=G[kT]=G[OT]=G[PT]=G[LT]=G[RT]=G[$T]=G[Af]=G[ST]=G[_T]=G[IT]=G[xT]=G[MT]=G[DT]=G[FT]=G[GT]=!0;G[AT]=G[vf]=G[CT]=!1;function $r(t,e,n,r,i,s){var a;if(a!==void 0)return a;if(!Oe(t))return t;var o=M(t);if(o)return a=Dy(t),Sg(t,a);var c=we(t),u=c==vf||c==ET;if(Ln(t))return Ry(t);if(c==Af||c==Tf||u&&!i)return a=u?{}:lT(t),_y(t,Ay(a,t));if(!G[c])return i?t:{};a=uT(t,c),s||(s=new Ye);var l=s.get(t);if(l)return l;s.set(t,a),mT(t)?t.forEach(function(h){a.add($r(h,e,n,h,t,s))}):hT(t)&&t.forEach(function(h,g){a.set(g,$r(h,e,n,g,t,s))});var f=ls,d=o?void 0:f(t);return tf(d||t,function(h,g){d&&(g=h,h=t[g]),di(a,g,$r(h,e,n,g,t,s))}),a}var UT=4;function ie(t){return $r(t,UT)}function cr(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var s=t[e];s&&(i[r++]=s)}return i}var BT="__lodash_hash_undefined__";function jT(t){return this.__data__.set(t,BT),this}function HT(t){return this.__data__.has(t)}function rn(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new gt;++e<n;)this.add(t[e])}rn.prototype.add=rn.prototype.push=jT;rn.prototype.has=HT;function Ef(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function ya(t,e){return t.has(e)}var WT=1,zT=2;function Rf(t,e,n,r,i,s){var a=n&WT,o=t.length,c=e.length;if(o!=c&&!(a&&c>o))return!1;var u=s.get(t),l=s.get(e);if(u&&l)return u==e&&l==t;var f=-1,d=!0,h=n&zT?new rn:void 0;for(s.set(t,e),s.set(e,t);++f<o;){var g=t[f],m=e[f];if(r)var T=a?r(m,g,f,e,t,s):r(g,m,f,t,e,s);if(T!==void 0){if(T)continue;d=!1;break}if(h){if(!Ef(e,function(y,E){if(!ya(h,E)&&(g===y||i(g,y,n,r,s)))return h.push(E)})){d=!1;break}}else if(!(g===m||i(g,m,n,r,s))){d=!1;break}}return s.delete(t),s.delete(e),d}function KT(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function Ta(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var VT=1,qT=2,YT="[object Boolean]",XT="[object Date]",JT="[object Error]",QT="[object Map]",ZT="[object Number]",ev="[object RegExp]",tv="[object Set]",nv="[object String]",rv="[object Symbol]",iv="[object ArrayBuffer]",sv="[object DataView]",ko=ke?ke.prototype:void 0,zi=ko?ko.valueOf:void 0;function av(t,e,n,r,i,s,a){switch(n){case sv:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case iv:return!(t.byteLength!=e.byteLength||!s(new Pr(t),new Pr(e)));case YT:case XT:case ZT:return sr(+t,+e);case JT:return t.name==e.name&&t.message==e.message;case ev:case nv:return t==e+"";case QT:var o=KT;case tv:var c=r&VT;if(o||(o=Ta),t.size!=e.size&&!c)return!1;var u=a.get(t);if(u)return u==e;r|=qT,a.set(t,e);var l=Rf(o(t),o(e),r,i,s,a);return a.delete(t),l;case rv:if(zi)return zi.call(t)==zi.call(e)}return!1}var ov=1,cv=Object.prototype,uv=cv.hasOwnProperty;function lv(t,e,n,r,i,s){var a=n&ov,o=ls(t),c=o.length,u=ls(e),l=u.length;if(c!=l&&!a)return!1;for(var f=c;f--;){var d=o[f];if(!(a?d in e:uv.call(e,d)))return!1}var h=s.get(t),g=s.get(e);if(h&&g)return h==e&&g==t;var m=!0;s.set(t,e),s.set(e,t);for(var T=a;++f<c;){d=o[f];var y=t[d],E=e[d];if(r)var v=a?r(E,y,d,e,t,s):r(y,E,d,t,e,s);if(!(v===void 0?y===E||i(y,E,n,r,s):v)){m=!1;break}T||(T=d=="constructor")}if(m&&!T){var S=t.constructor,O=e.constructor;S!=O&&"constructor"in t&&"constructor"in e&&!(typeof S=="function"&&S instanceof S&&typeof O=="function"&&O instanceof O)&&(m=!1)}return s.delete(t),s.delete(e),m}var fv=1,Oo="[object Arguments]",Po="[object Array]",yr="[object Object]",dv=Object.prototype,Lo=dv.hasOwnProperty;function hv(t,e,n,r,i,s){var a=M(t),o=M(e),c=a?Po:we(t),u=o?Po:we(e);c=c==Oo?yr:c,u=u==Oo?yr:u;var l=c==yr,f=u==yr,d=c==u;if(d&&Ln(t)){if(!Ln(e))return!1;a=!0,l=!1}if(d&&!l)return s||(s=new Ye),a||ua(t)?Rf(t,e,n,r,i,s):av(t,e,c,n,r,i,s);if(!(n&fv)){var h=l&&Lo.call(t,"__wrapped__"),g=f&&Lo.call(e,"__wrapped__");if(h||g){var m=h?t.value():t,T=g?e.value():e;return s||(s=new Ye),i(m,T,n,r,s)}}return d?(s||(s=new Ye),lv(t,e,n,r,i,s)):!1}function va(t,e,n,r,i){return t===e?!0:t==null||e==null||!je(t)&&!je(e)?t!==t&&e!==e:hv(t,e,n,r,va,i)}var pv=1,gv=2;function mv(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var a=n[i];if(a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=n[i];var o=a[0],c=t[o],u=a[1];if(a[2]){if(c===void 0&&!(o in t))return!1}else{var l=new Ye,f;if(!(f===void 0?va(u,c,pv|gv,r,l):f))return!1}}return!0}function $f(t){return t===t&&!Oe(t)}function yv(t){for(var e=Pe(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,$f(i)]}return e}function Sf(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function Tv(t){var e=yv(t);return e.length==1&&e[0][2]?Sf(e[0][0],e[0][1]):function(n){return n===t||mv(n,t,e)}}function vv(t,e){return t!=null&&e in Object(t)}function _f(t,e,n){e=yi(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var a=or(e[r]);if(!(s=t!=null&&n(t,a)))break;t=t[a]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&ca(i)&&fi(a,i)&&(M(t)||hi(t)))}function Av(t,e){return t!=null&&_f(t,e,vv)}var Ev=1,Rv=2;function $v(t,e){return la(t)&&$f(e)?Sf(or(t),e):function(n){var r=fy(n,t);return r===void 0&&r===e?Av(n,t):va(e,r,Ev|Rv)}}function Sv(t){return function(e){return e==null?void 0:e[t]}}function _v(t){return function(e){return da(e,t)}}function Iv(t){return la(t)?Sv(or(t)):_v(t)}function et(t){return typeof t=="function"?t:t==null?nn:typeof t=="object"?M(t)?$v(t[0],t[1]):Tv(t):Iv(t)}function xv(t,e,n,r){for(var i=-1,s=t==null?0:t.length;++i<s;){var a=t[i];e(r,a,n(a),t)}return r}function Cv(t){return function(e,n,r){for(var i=-1,s=Object(e),a=r(e),o=a.length;o--;){var c=a[++i];if(n(s[c],c,s)===!1)break}return e}}var wv=Cv();function Nv(t,e){return t&&wv(t,e,Pe)}function bv(t,e){return function(n,r){if(n==null)return n;if(!Ze(n))return t(n,r);for(var i=n.length,s=-1,a=Object(n);++s<i&&r(a[s],s,a)!==!1;);return n}}var zt=bv(Nv);function kv(t,e,n,r){return zt(t,function(i,s,a){e(r,i,n(i),a)}),r}function Ov(t,e){return function(n,r){var i=M(n)?xv:kv,s=e?e():{};return i(n,t,et(r),s)}}var If=Object.prototype,Pv=If.hasOwnProperty,Aa=oa(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&sf(e[0],e[1],i)&&(r=1);++n<r;)for(var s=e[n],a=df(s),o=-1,c=a.length;++o<c;){var u=a[o],l=t[u];(l===void 0||sr(l,If[u])&&!Pv.call(t,u))&&(t[u]=s[u])}return t});function Mo(t){return je(t)&&Ze(t)}var Lv=200;function Mv(t,e,n,r){var i=-1,s=rf,a=!0,o=t.length,c=[],u=e.length;if(!o)return c;e.length>=Lv&&(s=ya,a=!1,e=new rn(e));e:for(;++i<o;){var l=t[i],f=l;if(l=l!==0?l:0,a&&f===f){for(var d=u;d--;)if(e[d]===f)continue e;c.push(l)}else s(e,f,r)||c.push(l)}return c}var Ti=oa(function(t,e){return Mo(t)?Mv(t,pa(e,1,Mo,!0)):[]});function sn(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function te(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:li(e),pf(t,e<0?0:e,r)):[]}function Fn(t,e,n){var r=t==null?0:t.length;return r?(e=e===void 0?1:li(e),e=r-e,pf(t,0,e<0?0:e)):[]}function Dv(t){return typeof t=="function"?t:nn}function w(t,e){var n=M(t)?tf:zt;return n(t,Dv(e))}function Fv(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Gv(t,e){var n=!0;return zt(t,function(r,i,s){return n=!!e(r,i,s),n}),n}function Ue(t,e,n){var r=M(t)?Fv:Gv;return r(t,et(e))}function xf(t,e){var n=[];return zt(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function Me(t,e){var n=M(t)?ga:xf;return n(t,et(e))}function Uv(t){return function(e,n,r){var i=Object(e);if(!Ze(e)){var s=et(n);e=Pe(e),n=function(o){return s(i[o],o,i)}}var a=t(e,n,r);return a>-1?i[s?e[a]:a]:void 0}}var Bv=Math.max;function jv(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:li(n);return i<0&&(i=Bv(r+i,0)),nf(t,et(e),i)}var an=Uv(jv);function He(t){return t&&t.length?t[0]:void 0}function Hv(t,e){var n=-1,r=Ze(t)?Array(t.length):[];return zt(t,function(i,s,a){r[++n]=e(i,s,a)}),r}function x(t,e){var n=M(t)?ui:Hv;return n(t,et(e))}function Ne(t,e){return pa(x(t,e))}var Wv=Object.prototype,zv=Wv.hasOwnProperty,Kv=Ov(function(t,e,n){zv.call(t,n)?t[n].push(e):sa(t,n,[e])}),Vv=Object.prototype,qv=Vv.hasOwnProperty;function Yv(t,e){return t!=null&&qv.call(t,e)}function C(t,e){return t!=null&&_f(t,e,Yv)}var Xv="[object String]";function ge(t){return typeof t=="string"||!M(t)&&je(t)&&Ct(t)==Xv}function Jv(t,e){return ui(e,function(n){return t[n]})}function J(t){return t==null?[]:Jv(t,Pe(t))}var Qv=Math.max;function he(t,e,n,r){t=Ze(t)?t:J(t),n=n?li(n):0;var i=t.length;return n<0&&(n=Qv(i+n,0)),ge(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&ia(t,e,n)>-1}function Do(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=0;return ia(t,e,i)}var Zv="[object Map]",eA="[object Set]",tA=Object.prototype,nA=tA.hasOwnProperty;function U(t){if(t==null)return!0;if(Ze(t)&&(M(t)||typeof t=="string"||typeof t.splice=="function"||Ln(t)||ua(t)||hi(t)))return!t.length;var e=we(t);if(e==Zv||e==eA)return!t.size;if(ar(t))return!ff(t).length;for(var n in t)if(nA.call(t,n))return!1;return!0}var rA="[object RegExp]";function iA(t){return je(t)&&Ct(t)==rA}var Fo=$t&&$t.isRegExp,lt=Fo?pi(Fo):iA;function ft(t){return t===void 0}var sA="Expected a function";function aA(t){if(typeof t!="function")throw new TypeError(sA);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function oA(t,e,n,r){if(!Oe(t))return t;e=yi(e,t);for(var i=-1,s=e.length,a=s-1,o=t;o!=null&&++i<s;){var c=or(e[i]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=a){var l=o[c];u=void 0,u===void 0&&(u=Oe(l)?l:fi(e[i+1])?[]:{})}di(o,c,u),o=o[c]}return t}function cA(t,e,n){for(var r=-1,i=e.length,s={};++r<i;){var a=e[r],o=da(t,a);n(o,a)&&oA(s,yi(a,t),o)}return s}function We(t,e){if(t==null)return{};var n=ui(Cy(t),function(r){return[r]});return e=et(e),cA(t,n,function(r,i){return e(r,i[0])})}function uA(t,e,n,r,i){return i(t,function(s,a,o){n=r?(r=!1,s):e(n,s,a,o)}),n}function $e(t,e,n){var r=M(t)?hy:uA,i=arguments.length<3;return r(t,et(e),n,i,zt)}function vi(t,e){var n=M(t)?ga:xf;return n(t,aA(et(e)))}function lA(t,e){var n;return zt(t,function(r,i,s){return n=e(r,i,s),!n}),!!n}function Cf(t,e,n){var r=M(t)?Ef:lA;return r(t,et(e))}var fA=1/0,dA=Qt&&1/Ta(new Qt([,-0]))[1]==fA?function(t){return new Qt(t)}:X,hA=200;function pA(t,e,n){var r=-1,i=rf,s=t.length,a=!0,o=[],c=o;if(s>=hA){var u=dA(t);if(u)return Ta(u);a=!1,i=ya,c=new rn}else c=o;e:for(;++r<s;){var l=t[r],f=l;if(l=l!==0?l:0,a&&f===f){for(var d=c.length;d--;)if(c[d]===f)continue e;o.push(l)}else i(c,f,n)||(c!==o&&c.push(f),o.push(l))}return o}function Ea(t){return t&&t.length?pA(t):[]}function hs(t){console&&console.error&&console.error(`Error: ${t}`)}function wf(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Nf(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function bf(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function gA(t){return mA(t)?t.LABEL:t.name}function mA(t){return ge(t.LABEL)&&t.LABEL!==""}class tt{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),w(this.definition,n=>{n.accept(e)})}}class le extends tt{constructor(e){super([]),this.idx=1,Re(this,We(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class gn extends tt{constructor(e){super(e.definition),this.orgText="",Re(this,We(e,n=>n!==void 0))}}class me extends tt{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Re(this,We(e,n=>n!==void 0))}}class re extends tt{constructor(e){super(e.definition),this.idx=1,Re(this,We(e,n=>n!==void 0))}}class Se extends tt{constructor(e){super(e.definition),this.idx=1,Re(this,We(e,n=>n!==void 0))}}class _e extends tt{constructor(e){super(e.definition),this.idx=1,Re(this,We(e,n=>n!==void 0))}}class V extends tt{constructor(e){super(e.definition),this.idx=1,Re(this,We(e,n=>n!==void 0))}}class ye extends tt{constructor(e){super(e.definition),this.idx=1,Re(this,We(e,n=>n!==void 0))}}class Te extends tt{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Re(this,We(e,n=>n!==void 0))}}class H{constructor(e){this.idx=1,Re(this,We(e,n=>n!==void 0))}accept(e){e.visit(this)}}function yA(t){return x(t,Sr)}function Sr(t){function e(n){return x(n,Sr)}if(t instanceof le){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ge(t.label)&&(n.label=t.label),n}else{if(t instanceof me)return{type:"Alternative",definition:e(t.definition)};if(t instanceof re)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Se)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof _e)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Sr(new H({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof ye)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Sr(new H({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof V)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof Te)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof H){const n={type:"Terminal",name:t.terminalType.name,label:gA(t.terminalType),idx:t.idx};ge(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=lt(r)?r.source:r),n}else{if(t instanceof gn)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}class mn{visit(e){const n=e;switch(n.constructor){case le:return this.visitNonTerminal(n);case me:return this.visitAlternative(n);case re:return this.visitOption(n);case Se:return this.visitRepetitionMandatory(n);case _e:return this.visitRepetitionMandatoryWithSeparator(n);case ye:return this.visitRepetitionWithSeparator(n);case V:return this.visitRepetition(n);case Te:return this.visitAlternation(n);case H:return this.visitTerminal(n);case gn:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function TA(t){return t instanceof me||t instanceof re||t instanceof V||t instanceof Se||t instanceof _e||t instanceof ye||t instanceof H||t instanceof gn}function Lr(t,e=[]){return t instanceof re||t instanceof V||t instanceof ye?!0:t instanceof Te?Cf(t.definition,r=>Lr(r,e)):t instanceof le&&he(e,t)?!1:t instanceof tt?(t instanceof le&&e.push(t),Ue(t.definition,r=>Lr(r,e))):!1}function vA(t){return t instanceof Te}function Ve(t){if(t instanceof le)return"SUBRULE";if(t instanceof re)return"OPTION";if(t instanceof Te)return"OR";if(t instanceof Se)return"AT_LEAST_ONE";if(t instanceof _e)return"AT_LEAST_ONE_SEP";if(t instanceof ye)return"MANY_SEP";if(t instanceof V)return"MANY";if(t instanceof H)return"CONSUME";throw Error("non exhaustive match")}class Ai{walk(e,n=[]){w(e.definition,(r,i)=>{const s=te(e.definition,i+1);if(r instanceof le)this.walkProdRef(r,s,n);else if(r instanceof H)this.walkTerminal(r,s,n);else if(r instanceof me)this.walkFlat(r,s,n);else if(r instanceof re)this.walkOption(r,s,n);else if(r instanceof Se)this.walkAtLeastOne(r,s,n);else if(r instanceof _e)this.walkAtLeastOneSep(r,s,n);else if(r instanceof ye)this.walkManySep(r,s,n);else if(r instanceof V)this.walkMany(r,s,n);else if(r instanceof Te)this.walkOr(r,s,n);else throw Error("non exhaustive match")})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new re({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=Go(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new re({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=Go(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);w(e.definition,s=>{const a=new me({definition:[s]});this.walk(a,i)})}}function Go(t,e,n){return[new re({definition:[new H({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function ur(t){if(t instanceof le)return ur(t.referencedRule);if(t instanceof H)return RA(t);if(TA(t))return AA(t);if(vA(t))return EA(t);throw Error("non exhaustive match")}function AA(t){let e=[];const n=t.definition;let r=0,i=n.length>r,s,a=!0;for(;i&&a;)s=n[r],a=Lr(s),e=e.concat(ur(s)),r=r+1,i=n.length>r;return Ea(e)}function EA(t){const e=x(t.definition,n=>ur(n));return Ea(Ge(e))}function RA(t){return[t.terminalType]}const kf="_~IN~_";class $A extends Ai{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=_A(e.referencedRule,e.idx)+this.topProd.name,s=n.concat(r),a=new me({definition:s}),o=ur(a);this.follows[i]=o}}function SA(t){const e={};return w(t,n=>{const r=new $A(n).startWalking();Re(e,r)}),e}function _A(t,e){return t.name+e+kf}let _r={};const IA=new Wl;function Ei(t){const e=t.toString();if(_r.hasOwnProperty(e))return _r[e];{const n=IA.pattern(e);return _r[e]=n,n}}function xA(){_r={}}const Of="Complement Sets are not supported for first char optimization",Mr=`Unable to use "first char" lexer optimizations:
|
|
12
|
+
`;function CA(t,e=!1){try{const n=Ei(t);return ps(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===Of)e&&wf(`${Mr} Unable to optimize: < ${t.toString()} >
|
|
13
|
+
Complement Sets cannot be automatically optimized.
|
|
14
|
+
This will disable the lexer's first char optimizations.
|
|
15
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
|
|
16
|
+
This will disable the lexer's first char optimizations.
|
|
17
|
+
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),hs(`${Mr}
|
|
18
|
+
Failed parsing: < ${t.toString()} >
|
|
19
|
+
Using the @chevrotain/regexp-to-ast library
|
|
20
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function ps(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)ps(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const s=r[i];switch(s.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const a=s;switch(a.type){case"Character":Tr(a.value,e,n);break;case"Set":if(a.complement===!0)throw Error(Of);w(a.value,c=>{if(typeof c=="number")Tr(c,e,n);else{const u=c;if(n===!0)for(let l=u.from;l<=u.to;l++)Tr(l,e,n);else{for(let l=u.from;l<=u.to&&l<bn;l++)Tr(l,e,n);if(u.to>=bn){const l=u.from>=bn?u.from:bn,f=u.to,d=St(l),h=St(f);for(let g=d;g<=h;g++)e[g]=g}}}});break;case"Group":ps(a.value,e,n);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&gs(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return J(e)}function Tr(t,e,n){const r=St(t);e[r]=r,n===!0&&wA(t,e)}function wA(t,e){const n=String.fromCharCode(t),r=n.toUpperCase();if(r!==n){const i=St(r.charCodeAt(0));e[i]=i}else{const i=n.toLowerCase();if(i!==n){const s=St(i.charCodeAt(0));e[s]=s}}}function Uo(t,e){return an(t.value,n=>{if(typeof n=="number")return he(e,n);{const r=n;return an(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function gs(t){const e=t.quantifier;return e&&e.atLeast===0?!0:t.value?M(t.value)?Ue(t.value,gs):gs(t.value):!1}class NA extends si{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){he(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Uo(e,this.targetCharCodes)===void 0&&(this.found=!0):Uo(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Ra(t,e){if(e instanceof RegExp){const n=Ei(e),r=new NA(t);return r.visit(n),r.found}else return an(e,n=>he(t,n.charCodeAt(0)))!==void 0}const Gt="PATTERN",Nn="defaultMode",vr="modes";let Pf=typeof new RegExp("(?:)").sticky=="boolean";function bA(t,e){e=Aa(e,{useSticky:Pf,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
21
|
+
`],tracer:(E,v)=>v()});const n=e.tracer;n("initCharCodeToOptimizedIndexMap",()=>{eE()});let r;n("Reject Lexer.NA",()=>{r=vi(t,E=>E[Gt]===pe.NA)});let i=!1,s;n("Transform Patterns",()=>{i=!1,s=x(r,E=>{const v=E[Gt];if(lt(v)){const S=v.source;return S.length===1&&S!=="^"&&S!=="$"&&S!=="."&&!v.ignoreCase?S:S.length===2&&S[0]==="\\"&&!he(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],S[1])?S[1]:e.useSticky?jo(v):Bo(v)}else{if(ht(v))return i=!0,{exec:v};if(typeof v=="object")return i=!0,v;if(typeof v=="string"){if(v.length===1)return v;{const S=v.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),O=new RegExp(S);return e.useSticky?jo(O):Bo(O)}}else throw Error("non exhaustive match")}})});let a,o,c,u,l;n("misc mapping",()=>{a=x(r,E=>E.tokenTypeIdx),o=x(r,E=>{const v=E.GROUP;if(v!==pe.SKIPPED){if(ge(v))return v;if(ft(v))return!1;throw Error("non exhaustive match")}}),c=x(r,E=>{const v=E.LONGER_ALT;if(v)return M(v)?x(v,O=>Do(r,O)):[Do(r,v)]}),u=x(r,E=>E.PUSH_MODE),l=x(r,E=>C(E,"POP_MODE"))});let f;n("Line Terminator Handling",()=>{const E=Df(e.lineTerminatorCharacters);f=x(r,v=>!1),e.positionTracking!=="onlyOffset"&&(f=x(r,v=>C(v,"LINE_BREAKS")?!!v.LINE_BREAKS:Mf(v,E)===!1&&Ra(E,v.PATTERN)))});let d,h,g,m;n("Misc Mapping #2",()=>{d=x(r,Lf),h=x(s,JA),g=$e(r,(E,v)=>{const S=v.GROUP;return ge(S)&&S!==pe.SKIPPED&&(E[S]=[]),E},{}),m=x(s,(E,v)=>({pattern:s[v],longerAlt:c[v],canLineTerminator:f[v],isCustom:d[v],short:h[v],group:o[v],push:u[v],pop:l[v],tokenTypeIdx:a[v],tokenType:r[v]}))});let T=!0,y=[];return e.safeMode||n("First Char Optimization",()=>{y=$e(r,(E,v,S)=>{if(typeof v.PATTERN=="string"){const O=v.PATTERN.charCodeAt(0),se=St(O);Ki(E,se,m[S])}else if(M(v.START_CHARS_HINT)){let O;w(v.START_CHARS_HINT,se=>{const De=typeof se=="string"?se.charCodeAt(0):se,ve=St(De);O!==ve&&(O=ve,Ki(E,ve,m[S]))})}else if(lt(v.PATTERN))if(v.PATTERN.unicode)T=!1,e.ensureOptimizations&&hs(`${Mr} Unable to analyze < ${v.PATTERN.toString()} > pattern.
|
|
22
|
+
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
23
|
+
This will disable the lexer's first char optimizations.
|
|
24
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const O=CA(v.PATTERN,e.ensureOptimizations);U(O)&&(T=!1),w(O,se=>{Ki(E,se,m[S])})}else e.ensureOptimizations&&hs(`${Mr} TokenType: <${v.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
25
|
+
This will disable the lexer's first char optimizations.
|
|
26
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),T=!1;return E},[])}),{emptyGroups:g,patternIdxToConfig:m,charCodeToPatternIdxToConfig:y,hasCustom:i,canBeOptimized:T}}function kA(t,e){let n=[];const r=PA(t);n=n.concat(r.errors);const i=LA(r.valid),s=i.valid;return n=n.concat(i.errors),n=n.concat(OA(s)),n=n.concat(HA(s)),n=n.concat(WA(s,e)),n=n.concat(zA(s)),n}function OA(t){let e=[];const n=Me(t,r=>lt(r[Gt]));return e=e.concat(DA(n)),e=e.concat(UA(n)),e=e.concat(BA(n)),e=e.concat(jA(n)),e=e.concat(FA(n)),e}function PA(t){const e=Me(t,i=>!C(i,Gt)),n=x(e,i=>({message:"Token Type: ->"+i.name+"<- missing static 'PATTERN' property",type:q.MISSING_PATTERN,tokenTypes:[i]})),r=Ti(t,e);return{errors:n,valid:r}}function LA(t){const e=Me(t,i=>{const s=i[Gt];return!lt(s)&&!ht(s)&&!C(s,"exec")&&!ge(s)}),n=x(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:q.INVALID_PATTERN,tokenTypes:[i]})),r=Ti(t,e);return{errors:n,valid:r}}const MA=/[^\\][$]/;function DA(t){class e extends si{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const n=Me(t,i=>{const s=i.PATTERN;try{const a=Ei(s),o=new e;return o.visit(a),o.found}catch{return MA.test(s.source)}});return x(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|
27
|
+
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
28
|
+
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function FA(t){const e=Me(t,r=>r.PATTERN.test(""));return x(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' must not match an empty string",type:q.EMPTY_MATCH_PATTERN,tokenTypes:[r]}))}const GA=/[^\\[][\^]|^\^/;function UA(t){class e extends si{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const n=Me(t,i=>{const s=i.PATTERN;try{const a=Ei(s),o=new e;return o.visit(a),o.found}catch{return GA.test(s.source)}});return x(n,i=>({message:`Unexpected RegExp Anchor Error:
|
|
29
|
+
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
30
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function BA(t){const e=Me(t,r=>{const i=r[Gt];return i instanceof RegExp&&(i.multiline||i.global)});return x(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:q.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[r]}))}function jA(t){const e=[];let n=x(t,s=>$e(t,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!he(e,o)&&o.PATTERN!==pe.NA&&(e.push(o),a.push(o)),a),[]));n=cr(n);const r=Me(n,s=>s.length>1);return x(r,s=>{const a=x(s,c=>c.name);return{message:`The same RegExp pattern ->${He(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:q.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function HA(t){const e=Me(t,r=>{if(!C(r,"GROUP"))return!1;const i=r.GROUP;return i!==pe.SKIPPED&&i!==pe.NA&&!ge(i)});return x(e,r=>({message:"Token Type: ->"+r.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:q.INVALID_GROUP_TYPE_FOUND,tokenTypes:[r]}))}function WA(t,e){const n=Me(t,i=>i.PUSH_MODE!==void 0&&!he(e,i.PUSH_MODE));return x(n,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:q.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function zA(t){const e=[],n=$e(t,(r,i,s)=>{const a=i.PATTERN;return a===pe.NA||(ge(a)?r.push({str:a,idx:s,tokenType:i}):lt(a)&&VA(a)&&r.push({str:a.source,idx:s,tokenType:i})),r},[]);return w(t,(r,i)=>{w(n,({str:s,idx:a,tokenType:o})=>{if(i<a&&KA(s,r.PATTERN)){const c=`Token: ->${o.name}<- can never be matched.
|
|
31
|
+
Because it appears AFTER the Token Type ->${r.name}<-in the lexer's definition.
|
|
32
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:q.UNREACHABLE_PATTERN,tokenTypes:[r,o]})}})}),e}function KA(t,e){if(lt(e)){const n=e.exec(t);return n!==null&&n.index===0}else{if(ht(e))return e(t,0,[],{});if(C(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function VA(t){return an([".","\\","[","]","|","^","$","(",")","?","*","+","{"],n=>t.source.indexOf(n)!==-1)===void 0}function Bo(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function jo(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function qA(t,e,n){const r=[];return C(t,Nn)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+Nn+`> property in its definition
|
|
33
|
+
`,type:q.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),C(t,vr)||r.push({message:"A MultiMode Lexer cannot be initialized without a <"+vr+`> property in its definition
|
|
34
|
+
`,type:q.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),C(t,vr)&&C(t,Nn)&&!C(t.modes,t.defaultMode)&&r.push({message:`A MultiMode Lexer cannot be initialized with a ${Nn}: <${t.defaultMode}>which does not exist
|
|
35
|
+
`,type:q.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),C(t,vr)&&w(t.modes,(i,s)=>{w(i,(a,o)=>{if(ft(a))r.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}>
|
|
36
|
+
`,type:q.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(C(a,"LONGER_ALT")){const c=M(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];w(c,u=>{!ft(u)&&!he(i,u)&&r.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${u.name}> on token <${a.name}> outside of mode <${s}>
|
|
37
|
+
`,type:q.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),r}function YA(t,e,n){const r=[];let i=!1;const s=cr(Ge(J(t.modes))),a=vi(s,c=>c[Gt]===pe.NA),o=Df(n);return e&&w(a,c=>{const u=Mf(c,o);if(u!==!1){const f={message:ZA(c,u),type:u.issue,tokenType:c};r.push(f)}else C(c,"LINE_BREAKS")?c.LINE_BREAKS===!0&&(i=!0):Ra(o,c.PATTERN)&&(i=!0)}),e&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
|
|
38
|
+
This Lexer has been defined to track line and column information,
|
|
39
|
+
But none of the Token Types can be identified as matching a line terminator.
|
|
40
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
41
|
+
for details.`,type:q.NO_LINE_BREAKS_FLAGS}),r}function XA(t){const e={},n=Pe(t);return w(n,r=>{const i=t[r];if(M(i))e[r]=[];else throw Error("non exhaustive match")}),e}function Lf(t){const e=t.PATTERN;if(lt(e))return!1;if(ht(e))return!0;if(C(e,"exec"))return!0;if(ge(e))return!1;throw Error("non exhaustive match")}function JA(t){return ge(t)&&t.length===1?t.charCodeAt(0):!1}const QA={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function Mf(t,e){if(C(t,"LINE_BREAKS"))return!1;if(lt(t.PATTERN)){try{Ra(e,t.PATTERN)}catch(n){return{issue:q.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}else{if(ge(t.PATTERN))return!1;if(Lf(t))return{issue:q.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function ZA(t,e){if(e.issue===q.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
42
|
+
The problem is in the <${t.name}> Token Type
|
|
43
|
+
Root cause: ${e.errMsg}.
|
|
44
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===q.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
45
|
+
The problem is in the <${t.name}> Token Type
|
|
46
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Df(t){return x(t,n=>ge(n)?n.charCodeAt(0):n)}function Ki(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const bn=256;let Ir=[];function St(t){return t<bn?t:Ir[t]}function eE(){if(U(Ir)){Ir=new Array(65536);for(let t=0;t<65536;t++)Ir[t]=t>255?255+~~(t/255):t}}function lr(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[n]===!0}function Dr(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let Ho=1;const Ff={};function fr(t){const e=tE(t);nE(e),iE(e),rE(e),w(e,n=>{n.isParent=n.categoryMatches.length>0})}function tE(t){let e=ie(t),n=t,r=!0;for(;r;){n=cr(Ge(x(n,s=>s.CATEGORIES)));const i=Ti(n,e);e=e.concat(i),U(i)?r=!1:n=i}return e}function nE(t){w(t,e=>{Uf(e)||(Ff[Ho]=e,e.tokenTypeIdx=Ho++),Wo(e)&&!M(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Wo(e)||(e.CATEGORIES=[]),sE(e)||(e.categoryMatches=[]),aE(e)||(e.categoryMatchesMap={})})}function rE(t){w(t,e=>{e.categoryMatches=[],w(e.categoryMatchesMap,(n,r)=>{e.categoryMatches.push(Ff[r].tokenTypeIdx)})})}function iE(t){w(t,e=>{Gf([],e)})}function Gf(t,e){w(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),w(e.CATEGORIES,n=>{const r=t.concat(e);he(r,n)||Gf(r,n)})}function Uf(t){return C(t,"tokenTypeIdx")}function Wo(t){return C(t,"CATEGORIES")}function sE(t){return C(t,"categoryMatches")}function aE(t){return C(t,"categoryMatchesMap")}function oE(t){return C(t,"tokenTypeIdx")}const cE={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,n,r,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`}};var q;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(q||(q={}));const kn={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
47
|
+
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:cE,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(kn);class pe{constructor(e,n=kn){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);const{time:o,value:c}=Nf(s),u=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${a}<-- <${i}> time: ${o}ms`),this.traceInitIndent--,c}else return s()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
48
|
+
a boolean 2nd argument is no longer supported`);this.config=Re({},kn,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===kn.lineTerminatorsPattern)this.config.lineTerminatorsPattern=QA;else if(this.config.lineTerminatorCharacters===kn.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
49
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),M(e)?i={modes:{defaultMode:ie(e)},defaultMode:Nn}:(s=!1,i=ie(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(qA(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(YA(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},w(i.modes,(o,c)=>{i.modes[c]=vi(o,u=>ft(u))});const a=Pe(i.modes);if(w(i.modes,(o,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(kA(o,a))}),U(this.lexerDefinitionErrors)){fr(o);let u;this.TRACE_INIT("analyzeTokenTypes",()=>{u=bA(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=Re({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!U(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const c=x(this.lexerDefinitionErrors,u=>u.message).join(`-----------------------
|
|
50
|
+
`);throw new Error(`Errors detected in definition of Lexer:
|
|
51
|
+
`+c)}w(this.lexerDefinitionWarning,o=>{wf(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(Pf?(this.chopInput=nn,this.match=this.matchWithTest):(this.updateLastIndex=X,this.match=this.matchWithExec),s&&(this.handleModes=X),this.trackStartLines===!1&&(this.computeNewColumn=nn),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=X),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const o=$e(this.canModeBeOptimized,(c,u,l)=>(u===!1&&c.push(l),c),[]);if(n.ensureOptimizations&&!U(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized.
|
|
52
|
+
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
53
|
+
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{xA()}),this.TRACE_INIT("toFastProperties",()=>{bf(this)})})}tokenize(e,n=this.defaultMode){if(!U(this.lexerDefinitionErrors)){const i=x(this.lexerDefinitionErrors,s=>s.message).join(`-----------------------
|
|
54
|
+
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
55
|
+
`+i)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,s,a,o,c,u,l,f,d,h,g,m,T,y;const E=e,v=E.length;let S=0,O=0;const se=this.hasCustom?0:Math.floor(e.length/10),De=new Array(se),ve=[];let Ke=this.trackStartLines?1:void 0,Ie=this.trackStartLines?1:void 0;const $=XA(this.emptyGroups),A=this.trackStartLines,R=this.config.lineTerminatorsPattern;let _=0,P=[],k=[];const b=[],Ae=[];Object.freeze(Ae);let Q;function K(){return P}function bt(ae){const xe=St(ae),qt=k[xe];return qt===void 0?Ae:qt}const _h=ae=>{if(b.length===1&&ae.tokenType.PUSH_MODE===void 0){const xe=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ae);ve.push({offset:ae.startOffset,line:ae.startLine,column:ae.startColumn,length:ae.image.length,message:xe})}else{b.pop();const xe=sn(b);P=this.patternIdxToConfig[xe],k=this.charCodeToPatternIdxToConfig[xe],_=P.length;const qt=this.canModeBeOptimized[xe]&&this.config.safeMode===!1;k&&qt?Q=bt:Q=K}};function Ya(ae){b.push(ae),k=this.charCodeToPatternIdxToConfig[ae],P=this.patternIdxToConfig[ae],_=P.length,_=P.length;const xe=this.canModeBeOptimized[ae]&&this.config.safeMode===!1;k&&xe?Q=bt:Q=K}Ya.call(this,n);let Fe;const Xa=this.config.recoveryEnabled;for(;S<v;){c=null;const ae=E.charCodeAt(S),xe=Q(ae),qt=xe.length;for(r=0;r<qt;r++){Fe=xe[r];const Ee=Fe.pattern;u=null;const nt=Fe.short;if(nt!==!1?ae===nt&&(c=Ee):Fe.isCustom===!0?(y=Ee.exec(E,S,De,$),y!==null?(c=y[0],y.payload!==void 0&&(u=y.payload)):c=null):(this.updateLastIndex(Ee,S),c=this.match(Ee,e,S)),c!==null){if(o=Fe.longerAlt,o!==void 0){const vt=o.length;for(s=0;s<vt;s++){const rt=P[o[s]],kt=rt.pattern;if(l=null,rt.isCustom===!0?(y=kt.exec(E,S,De,$),y!==null?(a=y[0],y.payload!==void 0&&(l=y.payload)):a=null):(this.updateLastIndex(kt,S),a=this.match(kt,e,S)),a&&a.length>c.length){c=a,u=l,Fe=rt;break}}}break}}if(c!==null){if(f=c.length,d=Fe.group,d!==void 0&&(h=Fe.tokenTypeIdx,g=this.createTokenInstance(c,S,h,Fe.tokenType,Ke,Ie,f),this.handlePayload(g,u),d===!1?O=this.addToken(De,O,g):$[d].push(g)),e=this.chopInput(e,f),S=S+f,Ie=this.computeNewColumn(Ie,f),A===!0&&Fe.canLineTerminator===!0){let Ee=0,nt,vt;R.lastIndex=0;do nt=R.test(c),nt===!0&&(vt=R.lastIndex-1,Ee++);while(nt===!0);Ee!==0&&(Ke=Ke+Ee,Ie=f-vt,this.updateTokenEndLineColumnLocation(g,d,vt,Ee,Ke,Ie,f))}this.handleModes(Fe,_h,Ya,g)}else{const Ee=S,nt=Ke,vt=Ie;let rt=Xa===!1;for(;rt===!1&&S<v;)for(e=this.chopInput(e,1),S++,i=0;i<_;i++){const kt=P[i],Di=kt.pattern,Ja=kt.short;if(Ja!==!1?E.charCodeAt(S)===Ja&&(rt=!0):kt.isCustom===!0?rt=Di.exec(E,S,De,$)!==null:(this.updateLastIndex(Di,S),rt=Di.exec(e)!==null),rt===!0)break}if(m=S-Ee,Ie=this.computeNewColumn(Ie,m),T=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(E,Ee,m,nt,vt),ve.push({offset:Ee,line:nt,column:vt,length:m,message:T}),Xa===!1)break}}return this.hasCustom||(De.length=O),{tokens:De,groups:$,errors:ve}}handleModes(e,n,r,i){if(e.pop===!0){const s=e.push;n(i),s!==void 0&&r.call(this,s)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,n){return e.substring(n)}updateLastIndex(e,n){e.lastIndex=n}updateTokenEndLineColumnLocation(e,n,r,i,s,a,o){let c,u;n!==void 0&&(c=r===o-1,u=c?-1:0,i===1&&c===!0||(e.endLine=s+u,e.endColumn=a-1+-u))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,s,a){return{image:e,startOffset:n,startLine:s,startColumn:a,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:n+o-1,startLine:s,endLine:s,startColumn:a,endColumn:a+o-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,n++,n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}pe.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";pe.NA=/NOT_APPLICABLE/;function Zt(t){return Bf(t)?t.LABEL:t.name}function Bf(t){return ge(t.LABEL)&&t.LABEL!==""}const uE="parent",zo="categories",Ko="label",Vo="group",qo="push_mode",Yo="pop_mode",Xo="longer_alt",Jo="line_breaks",Qo="start_chars_hint";function jf(t){return lE(t)}function lE(t){const e=t.pattern,n={};if(n.name=t.name,ft(e)||(n.PATTERN=e),C(t,uE))throw`The parent property is no longer supported.
|
|
56
|
+
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return C(t,zo)&&(n.CATEGORIES=t[zo]),fr([n]),C(t,Ko)&&(n.LABEL=t[Ko]),C(t,Vo)&&(n.GROUP=t[Vo]),C(t,Yo)&&(n.POP_MODE=t[Yo]),C(t,qo)&&(n.PUSH_MODE=t[qo]),C(t,Xo)&&(n.LONGER_ALT=t[Xo]),C(t,Jo)&&(n.LINE_BREAKS=t[Jo]),C(t,Qo)&&(n.START_CHARS_HINT=t[Qo]),n}const _t=jf({name:"EOF",pattern:pe.NA});fr([_t]);function $a(t,e,n,r,i,s,a,o){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:s,startColumn:a,endColumn:o,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function Hf(t,e){return lr(t,e)}const Xt={buildMismatchTokenMessage({expected:t,actual:e,previous:n,ruleName:r}){return`Expecting ${Bf(t)?`--> ${Zt(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const s="Expecting: ",o=`
|
|
57
|
+
but found: '`+He(e).image+"'";if(r)return s+r+o;{const c=$e(t,(d,h)=>d.concat(h),[]),u=x(c,d=>`[${x(d,h=>Zt(h)).join(", ")}]`),f=`one of these possible Token sequences:
|
|
58
|
+
${x(u,(d,h)=>` ${h+1}. ${d}`).join(`
|
|
59
|
+
`)}`;return s+f+o}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",a=`
|
|
60
|
+
but found: '`+He(e).image+"'";if(n)return i+n+a;{const c=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
61
|
+
<${x(t,u=>`[${x(u,l=>Zt(l)).join(",")}]`).join(" ,")}>`;return i+c+a}}};Object.freeze(Xt);const fE={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
|
|
62
|
+
inside top level rule: ->`+t.name+"<-"}},Pt={buildDuplicateFoundError(t,e){function n(l){return l instanceof H?l.terminalType.name:l instanceof le?l.nonTerminalName:""}const r=t.name,i=He(e),s=i.idx,a=Ve(i),o=n(i),c=s>0;let u=`->${a}${c?s:""}<- ${o?`with argument: ->${o}<-`:""}
|
|
63
|
+
appears more than once (${e.length} times) in the top level rule: ->${r}<-.
|
|
64
|
+
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
65
|
+
`;return u=u.replace(/[ \t]+/g," "),u=u.replace(/\s\s+/g,`
|
|
66
|
+
`),u},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
|
|
67
|
+
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
|
|
68
|
+
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
69
|
+
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
70
|
+
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){const e=x(t.prefixPath,i=>Zt(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|
71
|
+
in <OR${n}> inside <${t.topLevelRule.name}> Rule,
|
|
72
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
73
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
74
|
+
For Further details.`},buildAlternationAmbiguityError(t){const e=x(t.prefixPath,i=>Zt(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${t.topLevelRule.name}> Rule,
|
|
75
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
76
|
+
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
77
|
+
For Further details.`,r},buildEmptyRepetitionError(t){let e=Ve(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
|
|
78
|
+
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
79
|
+
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
|
|
80
|
+
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
81
|
+
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){const e=t.topLevelRule.name,n=x(t.leftRecursionPath,s=>s.name),r=`${e} --> ${n.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
|
|
82
|
+
rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
83
|
+
without consuming any Tokens. The grammar path that causes this is:
|
|
84
|
+
${r}
|
|
85
|
+
To fix this refactor your grammar to remove the left recursion.
|
|
86
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof gn?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function dE(t,e){const n=new hE(t,e);return n.resolveRefs(),n.errors}class hE extends mn{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){w(J(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:fe.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class pE extends Ai{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=ie(this.path.ruleStack).reverse(),this.occurrenceStack=ie(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){U(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class gE extends pE{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),s=new me({definition:i});this.possibleTokTypes=ur(s),this.found=!0}}}class Ri extends Ai{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class mE extends Ri{walkMany(e,n,r){if(e.idx===this.occurrence){const i=He(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof H&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class Zo extends Ri{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=He(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof H&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class yE extends Ri{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=He(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof H&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class ec extends Ri{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=He(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof H&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function ms(t,e,n=[]){n=ie(n);let r=[],i=0;function s(o){return o.concat(te(t,i+1))}function a(o){const c=ms(s(o),e,n);return r.concat(c)}for(;n.length<e&&i<t.length;){const o=t[i];if(o instanceof me)return a(o.definition);if(o instanceof le)return a(o.definition);if(o instanceof re)r=a(o.definition);else if(o instanceof Se){const c=o.definition.concat([new V({definition:o.definition})]);return a(c)}else if(o instanceof _e){const c=[new me({definition:o.definition}),new V({definition:[new H({terminalType:o.separator})].concat(o.definition)})];return a(c)}else if(o instanceof ye){const c=o.definition.concat([new V({definition:[new H({terminalType:o.separator})].concat(o.definition)})]);r=a(c)}else if(o instanceof V){const c=o.definition.concat([new V({definition:o.definition})]);r=a(c)}else{if(o instanceof Te)return w(o.definition,c=>{U(c.definition)===!1&&(r=a(c.definition))}),r;if(o instanceof H)n.push(o.terminalType);else throw Error("non exhaustive match")}i++}return r.push({partialPath:n,suffixDef:te(t,i)}),r}function Wf(t,e,n,r){const i="EXIT_NONE_TERMINAL",s=[i],a="EXIT_ALTERNATIVE";let o=!1;const c=e.length,u=c-r-1,l=[],f=[];for(f.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!U(f);){const d=f.pop();if(d===a){o&&sn(f).idx<=u&&f.pop();continue}const h=d.def,g=d.idx,m=d.ruleStack,T=d.occurrenceStack;if(U(h))continue;const y=h[0];if(y===i){const E={idx:g,def:te(h),ruleStack:Fn(m),occurrenceStack:Fn(T)};f.push(E)}else if(y instanceof H)if(g<c-1){const E=g+1,v=e[E];if(n(v,y.terminalType)){const S={idx:E,def:te(h),ruleStack:m,occurrenceStack:T};f.push(S)}}else if(g===c-1)l.push({nextTokenType:y.terminalType,nextTokenOccurrence:y.idx,ruleStack:m,occurrenceStack:T}),o=!0;else throw Error("non exhaustive match");else if(y instanceof le){const E=ie(m);E.push(y.nonTerminalName);const v=ie(T);v.push(y.idx);const S={idx:g,def:y.definition.concat(s,te(h)),ruleStack:E,occurrenceStack:v};f.push(S)}else if(y instanceof re){const E={idx:g,def:te(h),ruleStack:m,occurrenceStack:T};f.push(E),f.push(a);const v={idx:g,def:y.definition.concat(te(h)),ruleStack:m,occurrenceStack:T};f.push(v)}else if(y instanceof Se){const E=new V({definition:y.definition,idx:y.idx}),v=y.definition.concat([E],te(h)),S={idx:g,def:v,ruleStack:m,occurrenceStack:T};f.push(S)}else if(y instanceof _e){const E=new H({terminalType:y.separator}),v=new V({definition:[E].concat(y.definition),idx:y.idx}),S=y.definition.concat([v],te(h)),O={idx:g,def:S,ruleStack:m,occurrenceStack:T};f.push(O)}else if(y instanceof ye){const E={idx:g,def:te(h),ruleStack:m,occurrenceStack:T};f.push(E),f.push(a);const v=new H({terminalType:y.separator}),S=new V({definition:[v].concat(y.definition),idx:y.idx}),O=y.definition.concat([S],te(h)),se={idx:g,def:O,ruleStack:m,occurrenceStack:T};f.push(se)}else if(y instanceof V){const E={idx:g,def:te(h),ruleStack:m,occurrenceStack:T};f.push(E),f.push(a);const v=new V({definition:y.definition,idx:y.idx}),S=y.definition.concat([v],te(h)),O={idx:g,def:S,ruleStack:m,occurrenceStack:T};f.push(O)}else if(y instanceof Te)for(let E=y.definition.length-1;E>=0;E--){const v=y.definition[E],S={idx:g,def:v.definition.concat(te(h)),ruleStack:m,occurrenceStack:T};f.push(S),f.push(a)}else if(y instanceof me)f.push({idx:g,def:y.definition.concat(te(h)),ruleStack:m,occurrenceStack:T});else if(y instanceof gn)f.push(TE(y,g,m,T));else throw Error("non exhaustive match")}return l}function TE(t,e,n,r){const i=ie(n);i.push(t.name);const s=ie(r);return s.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:s}}var z;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(z||(z={}));function Sa(t){if(t instanceof re||t==="Option")return z.OPTION;if(t instanceof V||t==="Repetition")return z.REPETITION;if(t instanceof Se||t==="RepetitionMandatory")return z.REPETITION_MANDATORY;if(t instanceof _e||t==="RepetitionMandatoryWithSeparator")return z.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof ye||t==="RepetitionWithSeparator")return z.REPETITION_WITH_SEPARATOR;if(t instanceof Te||t==="Alternation")return z.ALTERNATION;throw Error("non exhaustive match")}function tc(t){const{occurrence:e,rule:n,prodType:r,maxLookahead:i}=t,s=Sa(r);return s===z.ALTERNATION?$i(e,n,i):Si(e,n,s,i)}function vE(t,e,n,r,i,s){const a=$i(t,e,n),o=Vf(a)?Dr:lr;return s(a,r,o,i)}function AE(t,e,n,r,i,s){const a=Si(t,e,i,n),o=Vf(a)?Dr:lr;return s(a[0],o,r)}function EE(t,e,n,r){const i=t.length,s=Ue(t,a=>Ue(a,o=>o.length===1));if(e)return function(a){const o=x(a,c=>c.GATE);for(let c=0;c<i;c++){const u=t[c],l=u.length,f=o[c];if(!(f!==void 0&&f.call(this)===!1))e:for(let d=0;d<l;d++){const h=u[d],g=h.length;for(let m=0;m<g;m++){const T=this.LA(m+1);if(n(T,h[m])===!1)continue e}return c}}};if(s&&!r){const a=x(t,c=>Ge(c)),o=$e(a,(c,u,l)=>(w(u,f=>{C(c,f.tokenTypeIdx)||(c[f.tokenTypeIdx]=l),w(f.categoryMatches,d=>{C(c,d)||(c[d]=l)})}),c),{});return function(){const c=this.LA(1);return o[c.tokenTypeIdx]}}else return function(){for(let a=0;a<i;a++){const o=t[a],c=o.length;e:for(let u=0;u<c;u++){const l=o[u],f=l.length;for(let d=0;d<f;d++){const h=this.LA(d+1);if(n(h,l[d])===!1)continue e}return a}}}}function RE(t,e,n){const r=Ue(t,s=>s.length===1),i=t.length;if(r&&!n){const s=Ge(t);if(s.length===1&&U(s[0].categoryMatches)){const o=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{const a=$e(s,(o,c,u)=>(o[c.tokenTypeIdx]=!0,w(c.categoryMatches,l=>{o[l]=!0}),o),[]);return function(){const o=this.LA(1);return a[o.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;s<i;s++){const a=t[s],o=a.length;for(let c=0;c<o;c++){const u=this.LA(c+1);if(e(u,a[c])===!1)continue e}return!0}return!1}}class $E extends Ai{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===n?(this.restDef=r.concat(i),!0):!1}walkOption(e,n,r){this.checkIsTarget(e,z.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,z.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,z.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,z.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,z.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class zf extends mn{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(e,n){e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,z.OPTION)}visitRepetition(e){this.checkIsTarget(e,z.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,z.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,z.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,z.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,z.ALTERNATION)}}function nc(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function Vi(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let s=0;s<e.length;s++){const a=e[s];i.push(a+"_"+r.tokenTypeIdx);for(let o=0;o<r.categoryMatches.length;o++){const c="_"+r.categoryMatches[o];i.push(a+c)}}e=i}return e}function SE(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let s=0;s<e.length;s++){const a=e[s];if(i[a]===!0)return!1}}return!0}function Kf(t,e){const n=x(t,a=>ms([a],1)),r=nc(n.length),i=x(n,a=>{const o={};return w(a,c=>{const u=Vi(c.partialPath);w(u,l=>{o[l]=!0})}),o});let s=n;for(let a=1;a<=e;a++){const o=s;s=nc(o.length);for(let c=0;c<o.length;c++){const u=o[c];for(let l=0;l<u.length;l++){const f=u[l].partialPath,d=u[l].suffixDef,h=Vi(f);if(SE(i,h,c)||U(d)||f.length===e){const m=r[c];if(ys(m,f)===!1){m.push(f);for(let T=0;T<h.length;T++){const y=h[T];i[c][y]=!0}}}else{const m=ms(d,a+1,f);s[c]=s[c].concat(m),w(m,T=>{const y=Vi(T.partialPath);w(y,E=>{i[c][E]=!0})})}}}}return r}function $i(t,e,n,r){const i=new zf(t,z.ALTERNATION,r);return e.accept(i),Kf(i.result,n)}function Si(t,e,n,r){const i=new zf(t,n);e.accept(i);const s=i.result,o=new $E(e,t,n).startWalking(),c=new me({definition:s}),u=new me({definition:o});return Kf([c,u],r)}function ys(t,e){e:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const s=e[i],a=r[i];if((s===a||a.categoryMatchesMap[s.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function _E(t,e){return t.length<e.length&&Ue(t,(n,r)=>{const i=e[r];return n===i||i.categoryMatchesMap[n.tokenTypeIdx]})}function Vf(t){return Ue(t,e=>Ue(e,n=>Ue(n,r=>U(r.categoryMatches))))}function IE(t){const e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return x(e,n=>Object.assign({type:fe.CUSTOM_LOOKAHEAD_VALIDATION},n))}function xE(t,e,n,r){const i=Ne(t,c=>CE(c,n)),s=UE(t,e,n),a=Ne(t,c=>ME(c,n)),o=Ne(t,c=>bE(c,t,r,n));return i.concat(s,a,o)}function CE(t,e){const n=new NE;t.accept(n);const r=n.allProductions,i=Kv(r,wE),s=We(i,o=>o.length>1);return x(J(s),o=>{const c=He(o),u=e.buildDuplicateFoundError(t,o),l=Ve(c),f={message:u,type:fe.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:l,occurrence:c.idx},d=qf(c);return d&&(f.parameter=d),f})}function wE(t){return`${Ve(t)}_#_${t.idx}_#_${qf(t)}`}function qf(t){return t instanceof H?t.terminalType.name:t instanceof le?t.nonTerminalName:""}class NE extends mn{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function bE(t,e,n,r){const i=[];if($e(e,(a,o)=>o.name===t.name?a+1:a,0)>1){const a=r.buildDuplicateRuleNameError({topLevelRule:t,grammarName:n});i.push({message:a,type:fe.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function kE(t,e,n){const r=[];let i;return he(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:fe.INVALID_RULE_OVERRIDE,ruleName:t})),r}function Yf(t,e,n,r=[]){const i=[],s=xr(e.definition);if(U(s))return[];{const a=t.name;he(s,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:fe.LEFT_RECURSION,ruleName:a});const c=Ti(s,r.concat([t])),u=Ne(c,l=>{const f=ie(r);return f.push(l),Yf(t,l,n,f)});return i.concat(u)}}function xr(t){let e=[];if(U(t))return e;const n=He(t);if(n instanceof le)e.push(n.referencedRule);else if(n instanceof me||n instanceof re||n instanceof Se||n instanceof _e||n instanceof ye||n instanceof V)e=e.concat(xr(n.definition));else if(n instanceof Te)e=Ge(x(n.definition,s=>xr(s.definition)));else if(!(n instanceof H))throw Error("non exhaustive match");const r=Lr(n),i=t.length>1;if(r&&i){const s=te(t);return e.concat(xr(s))}else return e}class _a extends mn{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function OE(t,e){const n=new _a;t.accept(n);const r=n.alternations;return Ne(r,s=>{const a=Fn(s.definition);return Ne(a,(o,c)=>{const u=Wf([o],[],lr,1);return U(u)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:s,emptyChoiceIdx:c}),type:fe.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:s.idx,alternative:c+1}]:[]})})}function PE(t,e,n){const r=new _a;t.accept(r);let i=r.alternations;return i=vi(i,a=>a.ignoreAmbiguities===!0),Ne(i,a=>{const o=a.idx,c=a.maxLookahead||e,u=$i(o,t,c,a),l=FE(u,a,t,n),f=GE(u,a,t,n);return l.concat(f)})}class LE extends mn{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function ME(t,e){const n=new _a;t.accept(n);const r=n.alternations;return Ne(r,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:s}),type:fe.TOO_MANY_ALTS,ruleName:t.name,occurrence:s.idx}]:[])}function DE(t,e,n){const r=[];return w(t,i=>{const s=new LE;i.accept(s);const a=s.allProductions;w(a,o=>{const c=Sa(o),u=o.maxLookahead||e,l=o.idx,d=Si(l,i,c,u)[0];if(U(Ge(d))){const h=n.buildEmptyRepetitionError({topLevelRule:i,repetition:o});r.push({message:h,type:fe.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),r}function FE(t,e,n,r){const i=[],s=$e(t,(o,c,u)=>(e.definition[u].ignoreAmbiguities===!0||w(c,l=>{const f=[u];w(t,(d,h)=>{u!==h&&ys(d,l)&&e.definition[h].ignoreAmbiguities!==!0&&f.push(h)}),f.length>1&&!ys(i,l)&&(i.push(l),o.push({alts:f,path:l}))}),o),[]);return x(s,o=>{const c=x(o.alts,l=>l+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:c,prefixPath:o.path}),type:fe.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:e.idx,alternatives:o.alts}})}function GE(t,e,n,r){const i=$e(t,(a,o,c)=>{const u=x(o,l=>({idx:c,path:l}));return a.concat(u)},[]);return cr(Ne(i,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];const c=a.idx,u=a.path,l=Me(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<c&&_E(d.path,u));return x(l,d=>{const h=[d.idx+1,c+1],g=e.idx===0?"":e.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:e,ambiguityIndices:h,prefixPath:d.path}),type:fe.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:g,alternatives:h}})}))}function UE(t,e,n){const r=[],i=x(e,s=>s.name);return w(t,s=>{const a=s.name;if(he(i,a)){const o=n.buildNamespaceConflictError(s);r.push({message:o,type:fe.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),r}function BE(t){const e=Aa(t,{errMsgProvider:fE}),n={};return w(t.rules,r=>{n[r.name]=r}),dE(n,e.errMsgProvider)}function jE(t){return t=Aa(t,{errMsgProvider:Pt}),xE(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}const Xf="MismatchedTokenException",Jf="NoViableAltException",Qf="EarlyExitException",Zf="NotAllInputParsedException",ed=[Xf,Jf,Qf,Zf];Object.freeze(ed);function Fr(t){return he(ed,t.name)}class _i extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class td extends _i{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Xf}}class HE extends _i{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Jf}}class WE extends _i{constructor(e,n){super(e,n),this.name=Zf}}class zE extends _i{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Qf}}const qi={},nd="InRuleRecoveryException";class KE extends Error{constructor(e){super(e),this.name=nd}}class VE{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=C(e,"recoveryEnabled")?e.recoveryEnabled:dt.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=qE)}getTokenToInsert(e){const n=$a(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return n.isInsertedInRecovery=!0,n}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,n,r,i){const s=this.findReSyncTokenType(),a=this.exportLexerState(),o=[];let c=!1;const u=this.LA(1);let l=this.LA(1);const f=()=>{const d=this.LA(0),h=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:u,previous:d,ruleName:this.getCurrRuleFullName()}),g=new td(h,u,this.LA(0));g.resyncedTokens=Fn(o),this.SAVE_ERROR(g)};for(;!c;)if(this.tokenMatcher(l,i)){f();return}else if(r.call(this)){f(),e.apply(this,n);return}else this.tokenMatcher(l,s)?c=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,n,r){return!(r===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,n)))}getFollowsForInRuleRecovery(e,n){const r=this.getCurrentGrammarPath(e,n);return this.getNextPossibleTokenTypes(r)}tryInRuleRecovery(e,n){if(this.canRecoverWithSingleTokenInsertion(e,n))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const r=this.SKIP_TOKEN();return this.consumeToken(),r}throw new KE("sad sad panda")}canPerformInRuleRecovery(e,n){return this.canRecoverWithSingleTokenInsertion(e,n)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,n){if(!this.canTokenTypeBeInsertedInRecovery(e)||U(n))return!1;const r=this.LA(1);return an(n,s=>this.tokenMatcher(r,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const n=this.getCurrFollowKey(),r=this.getFollowSetFromFollowKey(n);return he(r,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let n=this.LA(1),r=2;for(;;){const i=an(e,s=>Hf(n,s));if(i!==void 0)return i;n=this.LA(r),r++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return qi;const e=this.getLastExplicitRuleShortName(),n=this.getLastExplicitRuleOccurrenceIndex(),r=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:n,inRule:this.shortRuleNameToFullName(r)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,n=this.RULE_OCCURRENCE_STACK;return x(e,(r,i)=>i===0?qi:{ruleName:this.shortRuleNameToFullName(r),idxInCallingRule:n[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){const e=x(this.buildFullFollowKeyStack(),n=>this.getFollowSetFromFollowKey(n));return Ge(e)}getFollowSetFromFollowKey(e){if(e===qi)return[_t];const n=e.ruleName+e.idxInCallingRule+kf+e.inRule;return this.resyncFollows[n]}addToResyncTokens(e,n){return this.tokenMatcher(e,_t)||n.push(e),n}reSyncTo(e){const n=[];let r=this.LA(1);for(;this.tokenMatcher(r,e)===!1;)r=this.SKIP_TOKEN(),this.addToResyncTokens(r,n);return Fn(n)}attemptInRepetitionRecovery(e,n,r,i,s,a,o){}getCurrentGrammarPath(e,n){const r=this.getHumanReadableRuleStack(),i=ie(this.RULE_OCCURRENCE_STACK);return{ruleStack:r,occurrenceStack:i,lastTok:e,lastTokOccurrence:n}}getHumanReadableRuleStack(){return x(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function qE(t,e,n,r,i,s,a){const o=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[o];if(c===void 0){const d=this.getCurrRuleFullName(),h=this.getGAstProductions()[d];c=new s(h,i).startWalking(),this.firstAfterRepMap[o]=c}let u=c.token,l=c.occurrence;const f=c.isEndOfRule;this.RULE_STACK.length===1&&f&&u===void 0&&(u=_t,l=1),!(u===void 0||l===void 0)&&this.shouldInRepetitionRecoveryBeTried(u,l,a)&&this.tryInRepetitionRecovery(t,e,n,u)}const YE=4,wt=8,rd=1<<wt,id=2<<wt,Ts=3<<wt,vs=4<<wt,As=5<<wt,Cr=6<<wt;function Yi(t,e,n){return n|e|t}class Ia{constructor(e){var n;this.maxLookahead=(n=e==null?void 0:e.maxLookahead)!==null&&n!==void 0?n:dt.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(U(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),s=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...s]}return n}validateNoLeftRecursion(e){return Ne(e,n=>Yf(n,n,Pt))}validateEmptyOrAlternatives(e){return Ne(e,n=>OE(n,Pt))}validateAmbiguousAlternationAlternatives(e,n){return Ne(e,r=>PE(r,n,Pt))}validateSomeNonEmptyLookaheadPath(e,n){return DE(e,n,Pt)}buildLookaheadForAlternation(e){return vE(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,EE)}buildLookaheadForOptional(e){return AE(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Sa(e.prodType),RE)}}class XE{initLooksAhead(e){this.dynamicTokensEnabled=C(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:dt.dynamicTokensEnabled,this.maxLookahead=C(e,"maxLookahead")?e.maxLookahead:dt.maxLookahead,this.lookaheadStrategy=C(e,"lookaheadStrategy")?e.lookaheadStrategy:new Ia({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){w(e,n=>{this.TRACE_INIT(`${n.name} Rule Lookahead`,()=>{const{alternation:r,repetition:i,option:s,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:c}=QE(n);w(r,u=>{const l=u.idx===0?"":u.idx;this.TRACE_INIT(`${Ve(u)}${l}`,()=>{const f=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:u.idx,rule:n,maxLookahead:u.maxLookahead||this.maxLookahead,hasPredicates:u.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=Yi(this.fullRuleNameToShort[n.name],rd,u.idx);this.setLaFuncCache(d,f)})}),w(i,u=>{this.computeLookaheadFunc(n,u.idx,Ts,"Repetition",u.maxLookahead,Ve(u))}),w(s,u=>{this.computeLookaheadFunc(n,u.idx,id,"Option",u.maxLookahead,Ve(u))}),w(a,u=>{this.computeLookaheadFunc(n,u.idx,vs,"RepetitionMandatory",u.maxLookahead,Ve(u))}),w(o,u=>{this.computeLookaheadFunc(n,u.idx,Cr,"RepetitionMandatoryWithSeparator",u.maxLookahead,Ve(u))}),w(c,u=>{this.computeLookaheadFunc(n,u.idx,As,"RepetitionWithSeparator",u.maxLookahead,Ve(u))})})})}computeLookaheadFunc(e,n,r,i,s,a){this.TRACE_INIT(`${a}${n===0?"":n}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:n,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),c=Yi(this.fullRuleNameToShort[e.name],r,n);this.setLaFuncCache(c,o)})}getKeyForAutomaticLookahead(e,n){const r=this.getLastExplicitRuleShortName();return Yi(r,e,n)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,n){this.lookAheadFuncsCache.set(e,n)}}class JE extends mn{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const Ar=new JE;function QE(t){Ar.reset(),t.accept(Ar);const e=Ar.dslMethods;return Ar.reset(),e}function rc(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function ic(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function ZE(t,e,n){t.children[n]===void 0?t.children[n]=[e]:t.children[n].push(e)}function eR(t,e,n){t.children[e]===void 0?t.children[e]=[n]:t.children[e].push(n)}const tR="name";function sd(t,e){Object.defineProperty(t,tR,{enumerable:!1,configurable:!0,writable:!1,value:e})}function nR(t,e){const n=Pe(t),r=n.length;for(let i=0;i<r;i++){const s=n[i],a=t[s],o=a.length;for(let c=0;c<o;c++){const u=a[c];u.tokenTypeIdx===void 0&&this[u.name](u.children,e)}}}function rR(t,e){const n=function(){};sd(n,t+"BaseSemantics");const r={visit:function(i,s){if(M(i)&&(i=i[0]),!ft(i))return this[i.name](i.children,s)},validateVisitor:function(){const i=sR(this,e);if(!U(i)){const s=x(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
87
|
+
${s.join(`
|
|
88
|
+
|
|
89
|
+
`).replace(/\n/g,`
|
|
90
|
+
`)}`)}}};return n.prototype=r,n.prototype.constructor=n,n._RULE_NAMES=e,n}function iR(t,e,n){const r=function(){};sd(r,t+"BaseSemanticsWithDefaults");const i=Object.create(n.prototype);return w(e,s=>{i[s]=nR}),r.prototype=i,r.prototype.constructor=r,r}var Es;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Es||(Es={}));function sR(t,e){return aR(t,e)}function aR(t,e){const n=Me(e,i=>ht(t[i])===!1),r=x(n,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:Es.MISSING_METHOD,methodName:i}));return cr(r)}class oR{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=C(e,"nodeLocationTracking")?e.nodeLocationTracking:dt.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=X,this.cstFinallyStateUpdate=X,this.cstPostTerminal=X,this.cstPostNonTerminal=X,this.cstPostRule=X;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ic,this.setNodeLocationFromNode=ic,this.cstPostRule=X,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=rc,this.setNodeLocationFromNode=rc,this.cstPostRule=X,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=X,this.setNodeLocationFromNode=X,this.cstPostRule=X,this.setInitialNodeLocation=X;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const n=this.LA(1);e.location={startOffset:n.startOffset,startLine:n.startLine,startColumn:n.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const n={name:e,children:Object.create(null)};this.setInitialNodeLocation(n),this.CST_STACK.push(n)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?(r.endOffset=n.endOffset,r.endLine=n.endLine,r.endColumn=n.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)}cstPostRuleOnlyOffset(e){const n=this.LA(0),r=e.location;r.startOffset<=n.startOffset?r.endOffset=n.endOffset:r.startOffset=NaN}cstPostTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];ZE(r,n,e),this.setNodeLocationFromToken(r.location,n)}cstPostNonTerminal(e,n){const r=this.CST_STACK[this.CST_STACK.length-1];eR(r,n,e),this.setNodeLocationFromNode(r.location,e.location)}getBaseCstVisitorConstructor(){if(ft(this.baseCstVisitorConstructor)){const e=rR(this.className,Pe(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(ft(this.baseCstVisitorWithDefaultsConstructor)){const e=iR(this.className,Pe(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class cR{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Ur}LA(e){const n=this.currIdx+e;return n<0||this.tokVectorLength<=n?Ur:this.tokVector[n]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class uR{ACTION(e){return e.call(this)}consume(e,n,r){return this.consumeInternal(n,e,r)}subrule(e,n,r){return this.subruleInternal(n,e,r)}option(e,n){return this.optionInternal(n,e)}or(e,n){return this.orInternal(n,e)}many(e,n){return this.manyInternal(e,n)}atLeastOne(e,n){return this.atLeastOneInternal(e,n)}CONSUME(e,n){return this.consumeInternal(e,0,n)}CONSUME1(e,n){return this.consumeInternal(e,1,n)}CONSUME2(e,n){return this.consumeInternal(e,2,n)}CONSUME3(e,n){return this.consumeInternal(e,3,n)}CONSUME4(e,n){return this.consumeInternal(e,4,n)}CONSUME5(e,n){return this.consumeInternal(e,5,n)}CONSUME6(e,n){return this.consumeInternal(e,6,n)}CONSUME7(e,n){return this.consumeInternal(e,7,n)}CONSUME8(e,n){return this.consumeInternal(e,8,n)}CONSUME9(e,n){return this.consumeInternal(e,9,n)}SUBRULE(e,n){return this.subruleInternal(e,0,n)}SUBRULE1(e,n){return this.subruleInternal(e,1,n)}SUBRULE2(e,n){return this.subruleInternal(e,2,n)}SUBRULE3(e,n){return this.subruleInternal(e,3,n)}SUBRULE4(e,n){return this.subruleInternal(e,4,n)}SUBRULE5(e,n){return this.subruleInternal(e,5,n)}SUBRULE6(e,n){return this.subruleInternal(e,6,n)}SUBRULE7(e,n){return this.subruleInternal(e,7,n)}SUBRULE8(e,n){return this.subruleInternal(e,8,n)}SUBRULE9(e,n){return this.subruleInternal(e,9,n)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,n,r=Br){if(he(this.definedRulesNames,e)){const a={message:Pt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:fe.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const i=this.defineRule(e,n,r);return this[e]=i,i}OVERRIDE_RULE(e,n,r=Br){const i=kE(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);const s=this.defineRule(e,n,r);return this[e]=s,s}BACKTRACK(e,n){return function(){this.isBackTrackingStack.push(1);const r=this.saveRecogState();try{return e.apply(this,n),!0}catch(i){if(Fr(i))return!1;throw i}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return yA(J(this.gastProductionsCache))}}class lR{initRecognizerEngine(e,n){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Dr,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},C(n,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
91
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
92
|
+
For Further details.`);if(M(e)){if(U(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
93
|
+
Note that the first argument for the parser constructor
|
|
94
|
+
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
95
|
+
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
96
|
+
For Further details.`)}if(M(e))this.tokensMap=$e(e,(s,a)=>(s[a.name]=a,s),{});else if(C(e,"modes")&&Ue(Ge(J(e.modes)),oE)){const s=Ge(J(e.modes)),a=Ea(s);this.tokensMap=$e(a,(o,c)=>(o[c.name]=c,o),{})}else if(Oe(e))this.tokensMap=ie(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=_t;const r=C(e,"modes")?Ge(J(e.modes)):J(e),i=Ue(r,s=>U(s.categoryMatches));this.tokenMatcher=i?Dr:lr,fr(J(this.tokensMap))}defineRule(e,n,r){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
97
|
+
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const i=C(r,"resyncEnabled")?r.resyncEnabled:Br.resyncEnabled,s=C(r,"recoveryValueFunc")?r.recoveryValueFunc:Br.recoveryValueFunc,a=this.ruleShortNameIdx<<YE+wt;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let o;return this.outputCst===!0?o=function(...l){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,l);const f=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(f),f}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}}:o=function(...l){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),n.apply(this,l)}catch(f){return this.invokeRuleCatch(f,i,s)}finally{this.ruleFinallyStateUpdate()}},Object.assign(o,{ruleName:e,originalGrammarAction:n})}invokeRuleCatch(e,n,r){const i=this.RULE_STACK.length===1,s=n&&!this.isBackTracking()&&this.recoveryEnabled;if(Fr(e)){const a=e;if(s){const o=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(o))if(a.resyncedTokens=this.reSyncTo(o),this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];return c.recoveredNode=!0,c}else return r(e);else{if(this.outputCst){const c=this.CST_STACK[this.CST_STACK.length-1];c.recoveredNode=!0,a.partialCstResult=c}throw a}}else{if(i)return this.moveToTerminatedState(),r(e);throw a}}else throw e}optionInternal(e,n){const r=this.getKeyForAutomaticLookahead(id,n);return this.optionInternalLogic(e,n,r)}optionInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof e!="function"){s=e.DEF;const a=e.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=e;if(i.call(this)===!0)return s.call(this)}atLeastOneInternal(e,n){const r=this.getKeyForAutomaticLookahead(vs,e);return this.atLeastOneInternalLogic(e,n,r)}atLeastOneInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const a=n.GATE;if(a!==void 0){const o=i;i=()=>a.call(this)&&o.call(this)}}else s=n;if(i.call(this)===!0){let a=this.doSingleRepetition(s);for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,z.REPETITION_MANDATORY,n.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,n],i,vs,e,yE)}atLeastOneSepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(Cr,e);this.atLeastOneSepFirstInternalLogic(e,n,r)}atLeastOneSepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,ec],o,Cr,e,ec)}else throw this.raiseEarlyExitException(e,z.REPETITION_MANDATORY_WITH_SEPARATOR,n.ERR_MSG)}manyInternal(e,n){const r=this.getKeyForAutomaticLookahead(Ts,e);return this.manyInternalLogic(e,n,r)}manyInternalLogic(e,n,r){let i=this.getLaFuncFromCache(r),s;if(typeof n!="function"){s=n.DEF;const o=n.GATE;if(o!==void 0){const c=i;i=()=>o.call(this)&&c.call(this)}}else s=n;let a=!0;for(;i.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,n],i,Ts,e,mE,a)}manySepFirstInternal(e,n){const r=this.getKeyForAutomaticLookahead(As,e);this.manySepFirstInternalLogic(e,n,r)}manySepFirstInternalLogic(e,n,r){const i=n.DEF,s=n.SEP;if(this.getLaFuncFromCache(r).call(this)===!0){i.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,i,Zo],o,As,e,Zo)}}repetitionSepSecondInternal(e,n,r,i,s){for(;r();)this.CONSUME(n),i.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,i,s],r,Cr,e,s)}doSingleRepetition(e){const n=this.getLexerPosition();return e.call(this),this.getLexerPosition()>n}orInternal(e,n){const r=this.getKeyForAutomaticLookahead(rd,n),i=M(e)?e:e.DEF,a=this.getLaFuncFromCache(r).call(this,i);if(a!==void 0)return i[a].ALT.call(this);this.raiseNoAltException(n,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),n=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new WE(n,e))}}subruleInternal(e,n,r){let i;try{const s=r!==void 0?r.ARGS:void 0;return this.subruleIdx=n,i=e.apply(this,s),this.cstPostNonTerminal(i,r!==void 0&&r.LABEL!==void 0?r.LABEL:e.ruleName),i}catch(s){throw this.subruleInternalError(s,r,e.ruleName)}}subruleInternalError(e,n,r){throw Fr(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,n!==void 0&&n.LABEL!==void 0?n.LABEL:r),delete e.partialCstResult),e}consumeInternal(e,n,r){let i;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),i=s):this.consumeInternalError(e,s,r)}catch(s){i=this.consumeInternalRecovery(e,n,s)}return this.cstPostTerminal(r!==void 0&&r.LABEL!==void 0?r.LABEL:e.name,i),i}consumeInternalError(e,n,r){let i;const s=this.LA(0);throw r!==void 0&&r.ERR_MSG?i=r.ERR_MSG:i=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:n,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new td(i,n,s))}consumeInternalRecovery(e,n,r){if(this.recoveryEnabled&&r.name==="MismatchedTokenException"&&!this.isBackTracking()){const i=this.getFollowsForInRuleRecovery(e,n);try{return this.tryInRuleRecovery(e,i)}catch(s){throw s.name===nd?r:s}}else throw r}saveRecogState(){const e=this.errors,n=ie(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:n,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,n,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(n)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),_t)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class fR{initErrorHandler(e){this._errors=[],this.errorMessageProvider=C(e,"errorMessageProvider")?e.errorMessageProvider:dt.errorMessageProvider}SAVE_ERROR(e){if(Fr(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:ie(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return ie(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,n,r){const i=this.getCurrRuleFullName(),s=this.getGAstProductions()[i],o=Si(e,s,n,this.maxLookahead)[0],c=[];for(let l=1;l<=this.maxLookahead;l++)c.push(this.LA(l));const u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:c,previous:this.LA(0),customUserDescription:r,ruleName:i});throw this.SAVE_ERROR(new zE(u,this.LA(1),this.LA(0)))}raiseNoAltException(e,n){const r=this.getCurrRuleFullName(),i=this.getGAstProductions()[r],s=$i(e,i,this.maxLookahead),a=[];for(let u=1;u<=this.maxLookahead;u++)a.push(this.LA(u));const o=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:a,previous:o,customUserDescription:n,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new HE(c,this.LA(1),o))}}class dR{initContentAssist(){}computeContentAssist(e,n){const r=this.gastProductionsCache[e];if(ft(r))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Wf([r],n,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const n=He(e.ruleStack),i=this.getGAstProductions()[n];return new gE(i,e).startWalking()}}const Ii={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Ii);const sc=!0,ac=Math.pow(2,wt)-1,ad=jf({name:"RECORDING_PHASE_TOKEN",pattern:pe.NA});fr([ad]);const od=$a(ad,`This IToken indicates the Parser is in Recording Phase
|
|
98
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(od);const hR={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
99
|
+
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class pR{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const n=e>0?e:"";this[`CONSUME${n}`]=function(r,i){return this.consumeInternalRecord(r,e,i)},this[`SUBRULE${n}`]=function(r,i){return this.subruleInternalRecord(r,e,i)},this[`OPTION${n}`]=function(r){return this.optionInternalRecord(r,e)},this[`OR${n}`]=function(r){return this.orInternalRecord(r,e)},this[`MANY${n}`]=function(r){this.manyInternalRecord(e,r)},this[`MANY_SEP${n}`]=function(r){this.manySepFirstInternalRecord(e,r)},this[`AT_LEAST_ONE${n}`]=function(r){this.atLeastOneInternalRecord(e,r)},this[`AT_LEAST_ONE_SEP${n}`]=function(r){this.atLeastOneSepFirstInternalRecord(e,r)}}this.consume=function(e,n,r){return this.consumeInternalRecord(n,e,r)},this.subrule=function(e,n,r){return this.subruleInternalRecord(n,e,r)},this.option=function(e,n){return this.optionInternalRecord(n,e)},this.or=function(e,n){return this.orInternalRecord(n,e)},this.many=function(e,n){this.manyInternalRecord(e,n)},this.atLeastOne=function(e,n){this.atLeastOneInternalRecord(e,n)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let n=0;n<10;n++){const r=n>0?n:"";delete e[`CONSUME${r}`],delete e[`SUBRULE${r}`],delete e[`OPTION${r}`],delete e[`OR${r}`],delete e[`MANY${r}`],delete e[`MANY_SEP${r}`],delete e[`AT_LEAST_ONE${r}`],delete e[`AT_LEAST_ONE_SEP${r}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,n){return()=>!0}LA_RECORD(e){return Ur}topLevelRuleRecord(e,n){try{const r=new gn({definition:[],name:e});return r.name=e,this.recordingProdStack.push(r),n.call(this),this.recordingProdStack.pop(),r}catch(r){if(r.KNOWN_RECORDER_ERROR!==!0)try{r.message=r.message+`
|
|
100
|
+
This error was thrown during the "grammar recording phase" For more info see:
|
|
101
|
+
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw r}throw r}}optionInternalRecord(e,n){return xn.call(this,re,e,n)}atLeastOneInternalRecord(e,n){xn.call(this,Se,n,e)}atLeastOneSepFirstInternalRecord(e,n){xn.call(this,_e,n,e,sc)}manyInternalRecord(e,n){xn.call(this,V,n,e)}manySepFirstInternalRecord(e,n){xn.call(this,ye,n,e,sc)}orInternalRecord(e,n){return gR.call(this,e,n)}subruleInternalRecord(e,n,r){if(Gr(n),!e||C(e,"ruleName")===!1){const o=new Error(`<SUBRULE${oc(n)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
102
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const i=sn(this.recordingProdStack),s=e.ruleName,a=new le({idx:n,nonTerminalName:s,label:r==null?void 0:r.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?hR:Ii}consumeInternalRecord(e,n,r){if(Gr(n),!Uf(e)){const a=new Error(`<CONSUME${oc(n)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
103
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const i=sn(this.recordingProdStack),s=new H({idx:n,terminalType:e,label:r==null?void 0:r.LABEL});return i.definition.push(s),od}}function xn(t,e,n,r=!1){Gr(n);const i=sn(this.recordingProdStack),s=ht(e)?e:e.DEF,a=new t({definition:[],idx:n});return r&&(a.separator=e.SEP),C(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),i.definition.push(a),this.recordingProdStack.pop(),Ii}function gR(t,e){Gr(e);const n=sn(this.recordingProdStack),r=M(t)===!1,i=r===!1?t:t.DEF,s=new Te({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});C(t,"MAX_LOOKAHEAD")&&(s.maxLookahead=t.MAX_LOOKAHEAD);const a=Cf(i,o=>ht(o.GATE));return s.hasPredicates=a,n.definition.push(s),w(i,o=>{const c=new me({definition:[]});s.definition.push(c),C(o,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:C(o,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),o.ALT.call(this),this.recordingProdStack.pop()}),Ii}function oc(t){return t===0?"":`${t}`}function Gr(t){if(t<0||t>ac){const e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
104
|
+
Idx value must be a none negative value smaller than ${ac+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class mR{initPerformanceTracer(e){if(C(e,"traceInitPerf")){const n=e.traceInitPerf,r=typeof n=="number";this.traceInitMaxIdent=r?n:1/0,this.traceInitPerf=r?n>0:n}else this.traceInitMaxIdent=0,this.traceInitPerf=dt.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,n){if(this.traceInitPerf===!0){this.traceInitIndent++;const r=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${r}--> <${e}>`);const{time:i,value:s}=Nf(n),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${r}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,s}else return n()}}function yR(t,e){e.forEach(n=>{const r=n.prototype;Object.getOwnPropertyNames(r).forEach(i=>{if(i==="constructor")return;const s=Object.getOwnPropertyDescriptor(r,i);s&&(s.get||s.set)?Object.defineProperty(t.prototype,i,s):t.prototype[i]=n.prototype[i]})})}const Ur=$a(_t,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Ur);const dt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Xt,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Br=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var fe;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(fe||(fe={}));function cc(t=void 0){return function(){return t}}class dr{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{bf(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),w(this.definedRulesNames,i=>{const a=this[i].originalGrammarAction;let o;this.TRACE_INIT(`${i} Rule`,()=>{o=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=o})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=BE({rules:J(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(U(r)&&this.skipValidations===!1){const i=jE({rules:J(this.gastProductionsCache),tokenTypes:J(this.tokensMap),errMsgProvider:Pt,grammarName:n}),s=IE({lookaheadStrategy:this.lookaheadStrategy,rules:J(this.gastProductionsCache),tokenTypes:J(this.tokensMap),grammarName:n});this.definitionErrors=this.definitionErrors.concat(i,s)}}),U(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=SA(J(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,s;(s=(i=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(i,{rules:J(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(J(this.gastProductionsCache))})),!dr.DEFER_DEFINITION_ERRORS_HANDLING&&!U(this.definitionErrors))throw e=x(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
|
|
105
|
+
${e.join(`
|
|
106
|
+
-------------------------------
|
|
107
|
+
`)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),C(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
108
|
+
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
109
|
+
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
110
|
+
For further details.`);this.skipValidations=C(n,"skipValidations")?n.skipValidations:dt.skipValidations}}dr.DEFER_DEFINITION_ERRORS_HANDLING=!1;yR(dr,[VE,XE,oR,cR,lR,uR,fR,dR,pR,mR]);class TR extends dr{constructor(e,n=dt){const r=ie(n);r.outputCst=!1,super(e,r)}}function cd(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function vR(){this.__data__=[],this.size=0}function ud(t,e){return t===e||t!==t&&e!==e}function xi(t,e){for(var n=t.length;n--;)if(ud(t[n][0],e))return n;return-1}var AR=Array.prototype,ER=AR.splice;function RR(t){var e=this.__data__,n=xi(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ER.call(e,n,1),--this.size,!0}function $R(t){var e=this.__data__,n=xi(e,t);return n<0?void 0:e[n][1]}function SR(t){return xi(this.__data__,t)>-1}function _R(t,e){var n=this.__data__,r=xi(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function mt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}mt.prototype.clear=vR;mt.prototype.delete=RR;mt.prototype.get=$R;mt.prototype.has=SR;mt.prototype.set=_R;function IR(){this.__data__=new mt,this.size=0}function xR(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function CR(t){return this.__data__.get(t)}function wR(t){return this.__data__.has(t)}var ld=typeof global=="object"&&global&&global.Object===Object&&global,NR=typeof self=="object"&&self&&self.Object===Object&&self,yt=ld||NR||Function("return this")(),Je=yt.Symbol,fd=Object.prototype,bR=fd.hasOwnProperty,kR=fd.toString,Cn=Je?Je.toStringTag:void 0;function OR(t){var e=bR.call(t,Cn),n=t[Cn];try{t[Cn]=void 0;var r=!0}catch{}var i=kR.call(t);return r&&(e?t[Cn]=n:delete t[Cn]),i}var PR=Object.prototype,LR=PR.toString;function MR(t){return LR.call(t)}var DR="[object Null]",FR="[object Undefined]",uc=Je?Je.toStringTag:void 0;function yn(t){return t==null?t===void 0?FR:DR:uc&&uc in Object(t)?OR(t):MR(t)}function xa(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var GR="[object AsyncFunction]",UR="[object Function]",BR="[object GeneratorFunction]",jR="[object Proxy]";function dd(t){if(!xa(t))return!1;var e=yn(t);return e==UR||e==BR||e==GR||e==jR}var Xi=yt["__core-js_shared__"],lc=function(){var t=/[^.]+$/.exec(Xi&&Xi.keys&&Xi.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function HR(t){return!!lc&&lc in t}var WR=Function.prototype,zR=WR.toString;function Kt(t){if(t!=null){try{return zR.call(t)}catch{}try{return t+""}catch{}}return""}var KR=/[\\^$.*+?()[\]{}|]/g,VR=/^\[object .+?Constructor\]$/,qR=Function.prototype,YR=Object.prototype,XR=qR.toString,JR=YR.hasOwnProperty,QR=RegExp("^"+XR.call(JR).replace(KR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ZR(t){if(!xa(t)||HR(t))return!1;var e=dd(t)?QR:VR;return e.test(Kt(t))}function e$(t,e){return t==null?void 0:t[e]}function Tn(t,e){var n=e$(t,e);return ZR(n)?n:void 0}var Gn=Tn(yt,"Map"),Un=Tn(Object,"create");function t$(){this.__data__=Un?Un(null):{},this.size=0}function n$(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var r$="__lodash_hash_undefined__",i$=Object.prototype,s$=i$.hasOwnProperty;function a$(t){var e=this.__data__;if(Un){var n=e[t];return n===r$?void 0:n}return s$.call(e,t)?e[t]:void 0}var o$=Object.prototype,c$=o$.hasOwnProperty;function u$(t){var e=this.__data__;return Un?e[t]!==void 0:c$.call(e,t)}var l$="__lodash_hash_undefined__";function f$(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Un&&e===void 0?l$:e,this}function Ut(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ut.prototype.clear=t$;Ut.prototype.delete=n$;Ut.prototype.get=a$;Ut.prototype.has=u$;Ut.prototype.set=f$;function d$(){this.size=0,this.__data__={hash:new Ut,map:new(Gn||mt),string:new Ut}}function h$(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Ci(t,e){var n=t.__data__;return h$(e)?n[typeof e=="string"?"string":"hash"]:n.map}function p$(t){var e=Ci(this,t).delete(t);return this.size-=e?1:0,e}function g$(t){return Ci(this,t).get(t)}function m$(t){return Ci(this,t).has(t)}function y$(t,e){var n=Ci(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function Tt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Tt.prototype.clear=d$;Tt.prototype.delete=p$;Tt.prototype.get=g$;Tt.prototype.has=m$;Tt.prototype.set=y$;var T$=200;function v$(t,e){var n=this.__data__;if(n instanceof mt){var r=n.__data__;if(!Gn||r.length<T$-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Tt(r)}return n.set(t,e),this.size=n.size,this}function ut(t){var e=this.__data__=new mt(t);this.size=e.size}ut.prototype.clear=IR;ut.prototype.delete=xR;ut.prototype.get=CR;ut.prototype.has=wR;ut.prototype.set=v$;var A$="__lodash_hash_undefined__";function E$(t){return this.__data__.set(t,A$),this}function R$(t){return this.__data__.has(t)}function Bn(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Tt;++e<n;)this.add(t[e])}Bn.prototype.add=Bn.prototype.push=E$;Bn.prototype.has=R$;function $$(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function hd(t,e){return t.has(e)}var S$=1,_$=2;function pd(t,e,n,r,i,s){var a=n&S$,o=t.length,c=e.length;if(o!=c&&!(a&&c>o))return!1;var u=s.get(t),l=s.get(e);if(u&&l)return u==e&&l==t;var f=-1,d=!0,h=n&_$?new Bn:void 0;for(s.set(t,e),s.set(e,t);++f<o;){var g=t[f],m=e[f];if(r)var T=a?r(m,g,f,e,t,s):r(g,m,f,t,e,s);if(T!==void 0){if(T)continue;d=!1;break}if(h){if(!$$(e,function(y,E){if(!hd(h,E)&&(g===y||i(g,y,n,r,s)))return h.push(E)})){d=!1;break}}else if(!(g===m||i(g,m,n,r,s))){d=!1;break}}return s.delete(t),s.delete(e),d}var fc=yt.Uint8Array;function I$(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function Ca(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var x$=1,C$=2,w$="[object Boolean]",N$="[object Date]",b$="[object Error]",k$="[object Map]",O$="[object Number]",P$="[object RegExp]",L$="[object Set]",M$="[object String]",D$="[object Symbol]",F$="[object ArrayBuffer]",G$="[object DataView]",dc=Je?Je.prototype:void 0,Ji=dc?dc.valueOf:void 0;function U$(t,e,n,r,i,s,a){switch(n){case G$:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case F$:return!(t.byteLength!=e.byteLength||!s(new fc(t),new fc(e)));case w$:case N$:case O$:return ud(+t,+e);case b$:return t.name==e.name&&t.message==e.message;case P$:case M$:return t==e+"";case k$:var o=I$;case L$:var c=r&x$;if(o||(o=Ca),t.size!=e.size&&!c)return!1;var u=a.get(t);if(u)return u==e;r|=C$,a.set(t,e);var l=pd(o(t),o(e),r,i,s,a);return a.delete(t),l;case D$:if(Ji)return Ji.call(t)==Ji.call(e)}return!1}function gd(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var de=Array.isArray;function B$(t,e,n){var r=e(t);return de(t)?r:gd(r,n(t))}function md(t,e){for(var n=-1,r=t==null?0:t.length,i=0,s=[];++n<r;){var a=t[n];e(a,n,t)&&(s[i++]=a)}return s}function j$(){return[]}var H$=Object.prototype,W$=H$.propertyIsEnumerable,hc=Object.getOwnPropertySymbols,z$=hc?function(t){return t==null?[]:(t=Object(t),md(hc(t),function(e){return W$.call(t,e)}))}:j$;function K$(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function on(t){return t!=null&&typeof t=="object"}var V$="[object Arguments]";function pc(t){return on(t)&&yn(t)==V$}var yd=Object.prototype,q$=yd.hasOwnProperty,Y$=yd.propertyIsEnumerable,wi=pc(function(){return arguments}())?pc:function(t){return on(t)&&q$.call(t,"callee")&&!Y$.call(t,"callee")};function X$(){return!1}var Td=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gc=Td&&typeof module=="object"&&module&&!module.nodeType&&module,J$=gc&&gc.exports===Td,mc=J$?yt.Buffer:void 0,Q$=mc?mc.isBuffer:void 0,jr=Q$||X$,Z$=9007199254740991,eS=/^(?:0|[1-9]\d*)$/;function vd(t,e){var n=typeof t;return e=e??Z$,!!e&&(n=="number"||n!="symbol"&&eS.test(t))&&t>-1&&t%1==0&&t<e}var tS=9007199254740991;function wa(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=tS}var nS="[object Arguments]",rS="[object Array]",iS="[object Boolean]",sS="[object Date]",aS="[object Error]",oS="[object Function]",cS="[object Map]",uS="[object Number]",lS="[object Object]",fS="[object RegExp]",dS="[object Set]",hS="[object String]",pS="[object WeakMap]",gS="[object ArrayBuffer]",mS="[object DataView]",yS="[object Float32Array]",TS="[object Float64Array]",vS="[object Int8Array]",AS="[object Int16Array]",ES="[object Int32Array]",RS="[object Uint8Array]",$S="[object Uint8ClampedArray]",SS="[object Uint16Array]",_S="[object Uint32Array]",j={};j[yS]=j[TS]=j[vS]=j[AS]=j[ES]=j[RS]=j[$S]=j[SS]=j[_S]=!0;j[nS]=j[rS]=j[gS]=j[iS]=j[mS]=j[sS]=j[aS]=j[oS]=j[cS]=j[uS]=j[lS]=j[fS]=j[dS]=j[hS]=j[pS]=!1;function IS(t){return on(t)&&wa(t.length)&&!!j[yn(t)]}function xS(t){return function(e){return t(e)}}var Ad=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pn=Ad&&typeof module=="object"&&module&&!module.nodeType&&module,CS=Pn&&Pn.exports===Ad,Qi=CS&&ld.process,yc=function(){try{var t=Pn&&Pn.require&&Pn.require("util").types;return t||Qi&&Qi.binding&&Qi.binding("util")}catch{}}(),Tc=yc&&yc.isTypedArray,Na=Tc?xS(Tc):IS,wS=Object.prototype,NS=wS.hasOwnProperty;function bS(t,e){var n=de(t),r=!n&&wi(t),i=!n&&!r&&jr(t),s=!n&&!r&&!i&&Na(t),a=n||r||i||s,o=a?K$(t.length,String):[],c=o.length;for(var u in t)NS.call(t,u)&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||vd(u,c)))&&o.push(u);return o}var kS=Object.prototype;function Ed(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||kS;return t===n}function OS(t,e){return function(n){return t(e(n))}}var PS=OS(Object.keys,Object),LS=Object.prototype,MS=LS.hasOwnProperty;function Rd(t){if(!Ed(t))return PS(t);var e=[];for(var n in Object(t))MS.call(t,n)&&n!="constructor"&&e.push(n);return e}function Ni(t){return t!=null&&wa(t.length)&&!dd(t)}function ba(t){return Ni(t)?bS(t):Rd(t)}function vc(t){return B$(t,ba,z$)}var DS=1,FS=Object.prototype,GS=FS.hasOwnProperty;function US(t,e,n,r,i,s){var a=n&DS,o=vc(t),c=o.length,u=vc(e),l=u.length;if(c!=l&&!a)return!1;for(var f=c;f--;){var d=o[f];if(!(a?d in e:GS.call(e,d)))return!1}var h=s.get(t),g=s.get(e);if(h&&g)return h==e&&g==t;var m=!0;s.set(t,e),s.set(e,t);for(var T=a;++f<c;){d=o[f];var y=t[d],E=e[d];if(r)var v=a?r(E,y,d,e,t,s):r(y,E,d,t,e,s);if(!(v===void 0?y===E||i(y,E,n,r,s):v)){m=!1;break}T||(T=d=="constructor")}if(m&&!T){var S=t.constructor,O=e.constructor;S!=O&&"constructor"in t&&"constructor"in e&&!(typeof S=="function"&&S instanceof S&&typeof O=="function"&&O instanceof O)&&(m=!1)}return s.delete(t),s.delete(e),m}var Rs=Tn(yt,"DataView"),$s=Tn(yt,"Promise"),en=Tn(yt,"Set"),Ss=Tn(yt,"WeakMap"),Ac="[object Map]",BS="[object Object]",Ec="[object Promise]",Rc="[object Set]",$c="[object WeakMap]",Sc="[object DataView]",jS=Kt(Rs),HS=Kt(Gn),WS=Kt($s),zS=Kt(en),KS=Kt(Ss),st=yn;(Rs&&st(new Rs(new ArrayBuffer(1)))!=Sc||Gn&&st(new Gn)!=Ac||$s&&st($s.resolve())!=Ec||en&&st(new en)!=Rc||Ss&&st(new Ss)!=$c)&&(st=function(t){var e=yn(t),n=e==BS?t.constructor:void 0,r=n?Kt(n):"";if(r)switch(r){case jS:return Sc;case HS:return Ac;case WS:return Ec;case zS:return Rc;case KS:return $c}return e});var VS=1,_c="[object Arguments]",Ic="[object Array]",Er="[object Object]",qS=Object.prototype,xc=qS.hasOwnProperty;function YS(t,e,n,r,i,s){var a=de(t),o=de(e),c=a?Ic:st(t),u=o?Ic:st(e);c=c==_c?Er:c,u=u==_c?Er:u;var l=c==Er,f=u==Er,d=c==u;if(d&&jr(t)){if(!jr(e))return!1;a=!0,l=!1}if(d&&!l)return s||(s=new ut),a||Na(t)?pd(t,e,n,r,i,s):U$(t,e,c,n,r,i,s);if(!(n&VS)){var h=l&&xc.call(t,"__wrapped__"),g=f&&xc.call(e,"__wrapped__");if(h||g){var m=h?t.value():t,T=g?e.value():e;return s||(s=new ut),i(m,T,n,r,s)}}return d?(s||(s=new ut),US(t,e,n,r,i,s)):!1}function ka(t,e,n,r,i){return t===e?!0:t==null||e==null||!on(t)&&!on(e)?t!==t&&e!==e:YS(t,e,n,r,ka,i)}var XS=1,JS=2;function QS(t,e,n,r){var i=n.length,s=i;if(t==null)return!s;for(t=Object(t);i--;){var a=n[i];if(a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=n[i];var o=a[0],c=t[o],u=a[1];if(a[2]){if(c===void 0&&!(o in t))return!1}else{var l=new ut,f;if(!(f===void 0?ka(u,c,XS|JS,r,l):f))return!1}}return!0}function $d(t){return t===t&&!xa(t)}function ZS(t){for(var e=ba(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,$d(i)]}return e}function Sd(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function e_(t){var e=ZS(t);return e.length==1&&e[0][2]?Sd(e[0][0],e[0][1]):function(n){return n===t||QS(n,t,e)}}var t_="[object Symbol]";function bi(t){return typeof t=="symbol"||on(t)&&yn(t)==t_}var n_=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r_=/^\w*$/;function Oa(t,e){if(de(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||bi(t)?!0:r_.test(t)||!n_.test(t)||e!=null&&t in Object(e)}var i_="Expected a function";function Pa(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(i_);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var a=t.apply(this,r);return n.cache=s.set(i,a)||s,a};return n.cache=new(Pa.Cache||Tt),n}Pa.Cache=Tt;var s_=500;function a_(t){var e=Pa(t,function(r){return n.size===s_&&n.clear(),r}),n=e.cache;return e}var o_=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c_=/\\(\\)?/g,u_=a_(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(o_,function(n,r,i,s){e.push(i?s.replace(c_,"$1"):r||n)}),e}),Cc=Je?Je.prototype:void 0,wc=Cc?Cc.toString:void 0;function _d(t){if(typeof t=="string")return t;if(de(t))return cd(t,_d)+"";if(bi(t))return wc?wc.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function l_(t){return t==null?"":_d(t)}function Id(t,e){return de(t)?t:Oa(t,e)?[t]:u_(l_(t))}function ki(t){if(typeof t=="string"||bi(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function xd(t,e){e=Id(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[ki(e[n++])];return n&&n==r?t:void 0}function f_(t,e,n){var r=t==null?void 0:xd(t,e);return r===void 0?n:r}function d_(t,e){return t!=null&&e in Object(t)}function h_(t,e,n){e=Id(e,t);for(var r=-1,i=e.length,s=!1;++r<i;){var a=ki(e[r]);if(!(s=t!=null&&n(t,a)))break;t=t[a]}return s||++r!=i?s:(i=t==null?0:t.length,!!i&&wa(i)&&vd(a,i)&&(de(t)||wi(t)))}function p_(t,e){return t!=null&&h_(t,e,d_)}var g_=1,m_=2;function y_(t,e){return Oa(t)&&$d(e)?Sd(ki(t),e):function(n){var r=f_(n,t);return r===void 0&&r===e?p_(n,t):ka(e,r,g_|m_)}}function La(t){return t}function T_(t){return function(e){return e==null?void 0:e[t]}}function v_(t){return function(e){return xd(e,t)}}function A_(t){return Oa(t)?T_(ki(t)):v_(t)}function Oi(t){return typeof t=="function"?t:t==null?La:typeof t=="object"?de(t)?y_(t[0],t[1]):e_(t):A_(t)}function E_(t){return function(e,n,r){for(var i=-1,s=Object(e),a=r(e),o=a.length;o--;){var c=a[++i];if(n(s[c],c,s)===!1)break}return e}}var R_=E_();function $_(t,e){return t&&R_(t,e,ba)}function S_(t,e){return function(n,r){if(n==null)return n;if(!Ni(n))return t(n,r);for(var i=n.length,s=-1,a=Object(n);++s<i&&r(a[s],s,a)!==!1;);return n}}var Pi=S_($_);function __(t,e){var n=-1,r=Ni(t)?Array(t.length):[];return Pi(t,function(i,s,a){r[++n]=e(i,s,a)}),r}function ot(t,e){var n=de(t)?cd:__;return n(t,Oi(e))}function I_(t,e){var n=[];return Pi(t,function(r,i,s){e(r,i,s)&&n.push(r)}),n}function x_(t,e){var n=de(t)?md:I_;return n(t,Oi(e))}function cn(t,e,n){return`${t.name}_${e}_${n}`}const It=1,C_=2,Cd=4,wd=5,hr=7,w_=8,N_=9,b_=10,k_=11,Nd=12;class Ma{constructor(e){this.target=e}isEpsilon(){return!1}}class Da extends Ma{constructor(e,n){super(e),this.tokenType=n}}class bd extends Ma{constructor(e){super(e)}isEpsilon(){return!0}}class Fa extends Ma{constructor(e,n,r){super(e),this.rule=n,this.followState=r}isEpsilon(){return!0}}function O_(t){const e={decisionMap:{},decisionStates:[],ruleToStartState:new Map,ruleToStopState:new Map,states:[]};P_(e,t);const n=t.length;for(let r=0;r<n;r++){const i=t[r],s=Vt(e,i,i);s!==void 0&&z_(e,i,s)}return e}function P_(t,e){const n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Z(t,i,void 0,{type:C_}),a=Z(t,i,void 0,{type:hr});s.stop=a,t.ruleToStartState.set(i,s),t.ruleToStopState.set(i,a)}}function kd(t,e,n){return n instanceof H?Ga(t,e,n.terminalType,n):n instanceof le?W_(t,e,n):n instanceof Te?G_(t,e,n):n instanceof re?U_(t,e,n):n instanceof V?L_(t,e,n):n instanceof ye?M_(t,e,n):n instanceof Se?D_(t,e,n):n instanceof _e?F_(t,e,n):Vt(t,e,n)}function L_(t,e,n){const r=Z(t,e,n,{type:wd});Nt(t,r);const i=vn(t,e,r,n,Vt(t,e,n));return Pd(t,e,n,i)}function M_(t,e,n){const r=Z(t,e,n,{type:wd});Nt(t,r);const i=vn(t,e,r,n,Vt(t,e,n)),s=Ga(t,e,n.separator,n);return Pd(t,e,n,i,s)}function D_(t,e,n){const r=Z(t,e,n,{type:Cd});Nt(t,r);const i=vn(t,e,r,n,Vt(t,e,n));return Od(t,e,n,i)}function F_(t,e,n){const r=Z(t,e,n,{type:Cd});Nt(t,r);const i=vn(t,e,r,n,Vt(t,e,n)),s=Ga(t,e,n.separator,n);return Od(t,e,n,i,s)}function G_(t,e,n){const r=Z(t,e,n,{type:It});Nt(t,r);const i=ot(n.definition,a=>kd(t,e,a));return vn(t,e,r,n,...i)}function U_(t,e,n){const r=Z(t,e,n,{type:It});Nt(t,r);const i=vn(t,e,r,n,Vt(t,e,n));return B_(t,e,n,i)}function Vt(t,e,n){const r=x_(ot(n.definition,i=>kd(t,e,i)),i=>i!==void 0);return r.length===1?r[0]:r.length===0?void 0:H_(t,r)}function Od(t,e,n,r,i){const s=r.left,a=r.right,o=Z(t,e,n,{type:k_});Nt(t,o);const c=Z(t,e,n,{type:Nd});return s.loopback=o,c.loopback=o,t.decisionMap[cn(e,i?"RepetitionMandatoryWithSeparator":"RepetitionMandatory",n.idx)]=o,Y(a,o),i===void 0?(Y(o,s),Y(o,c)):(Y(o,c),Y(o,i.left),Y(i.right,s)),{left:s,right:c}}function Pd(t,e,n,r,i){const s=r.left,a=r.right,o=Z(t,e,n,{type:b_});Nt(t,o);const c=Z(t,e,n,{type:Nd}),u=Z(t,e,n,{type:N_});return o.loopback=u,c.loopback=u,Y(o,s),Y(o,c),Y(a,u),i!==void 0?(Y(u,c),Y(u,i.left),Y(i.right,s)):Y(u,o),t.decisionMap[cn(e,i?"RepetitionWithSeparator":"Repetition",n.idx)]=o,{left:o,right:c}}function B_(t,e,n,r){const i=r.left,s=r.right;return Y(i,s),t.decisionMap[cn(e,"Option",n.idx)]=i,r}function Nt(t,e){return t.decisionStates.push(e),e.decision=t.decisionStates.length-1,e.decision}function vn(t,e,n,r,...i){const s=Z(t,e,r,{type:w_,start:n});n.end=s;for(const o of i)o!==void 0?(Y(n,o.left),Y(o.right,s)):Y(n,s);const a={left:n,right:s};return t.decisionMap[cn(e,j_(r),r.idx)]=n,a}function j_(t){if(t instanceof Te)return"Alternation";if(t instanceof re)return"Option";if(t instanceof V)return"Repetition";if(t instanceof ye)return"RepetitionWithSeparator";if(t instanceof Se)return"RepetitionMandatory";if(t instanceof _e)return"RepetitionMandatoryWithSeparator";throw new Error("Invalid production type encountered")}function H_(t,e){const n=e.length;for(let s=0;s<n-1;s++){const a=e[s];let o;a.left.transitions.length===1&&(o=a.left.transitions[0]);const c=o instanceof Fa,u=o,l=e[s+1].left;a.left.type===It&&a.right.type===It&&o!==void 0&&(c&&u.followState===a.right||o.target===a.right)?(c?u.followState=l:o.target=l,K_(t,a.right)):Y(a.right,l)}const r=e[0],i=e[n-1];return{left:r.left,right:i.right}}function Ga(t,e,n,r){const i=Z(t,e,r,{type:It}),s=Z(t,e,r,{type:It});return Ua(i,new Da(s,n)),{left:i,right:s}}function W_(t,e,n){const r=n.referencedRule,i=t.ruleToStartState.get(r),s=Z(t,e,n,{type:It}),a=Z(t,e,n,{type:It}),o=new Fa(i,r,a);return Ua(s,o),{left:s,right:a}}function z_(t,e,n){const r=t.ruleToStartState.get(e);Y(r,n.left);const i=t.ruleToStopState.get(e);return Y(n.right,i),{left:r,right:i}}function Y(t,e){const n=new bd(e);Ua(t,n)}function Z(t,e,n,r){const i=Object.assign({atn:t,production:n,epsilonOnlyTransitions:!1,rule:e,transitions:[],nextTokenWithinRule:[],stateNumber:t.states.length},r);return t.states.push(i),i}function Ua(t,e){t.transitions.length===0&&(t.epsilonOnlyTransitions=e.isEpsilon()),t.transitions.push(e)}function K_(t,e){t.states.splice(t.states.indexOf(e),1)}const Hr={};class _s{constructor(){this.map={},this.configs=[]}get size(){return this.configs.length}finalize(){this.map={}}add(e){const n=Ld(e);n in this.map||(this.map[n]=this.configs.length,this.configs.push(e))}get elements(){return this.configs}get alts(){return ot(this.configs,e=>e.alt)}get key(){let e="";for(const n in this.map)e+=n+":";return e}}function Ld(t,e=!0){return`${e?`a${t.alt}`:""}s${t.state.stateNumber}:${t.stack.map(n=>n.stateNumber.toString()).join("_")}`}function V_(t,e,n){for(var r=-1,i=t.length;++r<i;){var s=t[r],a=e(s);if(a!=null&&(o===void 0?a===a&&!bi(a):n(a,o)))var o=a,c=s}return c}function q_(t,e){return t<e}function Y_(t){return t&&t.length?V_(t,La,q_):void 0}var Nc=Je?Je.isConcatSpreadable:void 0;function X_(t){return de(t)||wi(t)||!!(Nc&&t&&t[Nc])}function Md(t,e,n,r,i){var s=-1,a=t.length;for(n||(n=X_),i||(i=[]);++s<a;){var o=t[s];n(o)?gd(i,o):i[i.length]=o}return i}function J_(t,e){return Md(ot(t,e))}function Q_(t,e,n,r){for(var i=t.length,s=n+-1;++s<i;)if(e(t[s],s,t))return s;return-1}function Z_(t){return t!==t}function eI(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function tI(t,e,n){return e===e?eI(t,e,n):Q_(t,Z_,n)}function nI(t,e){var n=t==null?0:t.length;return!!n&&tI(t,e,0)>-1}function rI(){}var iI=1/0,sI=en&&1/Ca(new en([,-0]))[1]==iI?function(t){return new en(t)}:rI,aI=200;function oI(t,e,n){var r=-1,i=nI,s=t.length,a=!0,o=[],c=o;if(s>=aI){var u=e?null:sI(t);if(u)return Ca(u);a=!1,i=hd,c=new Bn}else c=e?[]:o;e:for(;++r<s;){var l=t[r],f=e?e(l):l;if(l=l!==0?l:0,a&&f===f){for(var d=c.length;d--;)if(c[d]===f)continue e;e&&c.push(f),o.push(l)}else i(c,f,n)||(c!==o&&c.push(f),o.push(l))}return o}function cI(t,e){return t&&t.length?oI(t,Oi(e)):[]}function uI(t){var e=t==null?0:t.length;return e?Md(t):[]}function lI(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function fI(t){return typeof t=="function"?t:La}function Zi(t,e){var n=de(t)?lI:Pi;return n(t,fI(e))}var dI="[object Map]",hI="[object Set]",pI=Object.prototype,gI=pI.hasOwnProperty;function mI(t){if(t==null)return!0;if(Ni(t)&&(de(t)||typeof t=="string"||typeof t.splice=="function"||jr(t)||Na(t)||wi(t)))return!t.length;var e=st(t);if(e==dI||e==hI)return!t.size;if(Ed(t))return!Rd(t).length;for(var n in t)if(gI.call(t,n))return!1;return!0}function yI(t,e,n,r){var i=-1,s=t==null?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}function TI(t,e,n,r,i){return i(t,function(s,a,o){n=r?(r=!1,s):e(n,s,a,o)}),n}function bc(t,e,n){var r=de(t)?yI:TI,i=arguments.length<3;return r(t,Oi(e),n,i,Pi)}function vI(t,e){const n={};return r=>{const i=r.toString();let s=n[i];return s!==void 0||(s={atnStartState:t,decision:e,states:{}},n[i]=s),s}}class Dd{constructor(){this.predicates=[]}is(e){return e>=this.predicates.length||this.predicates[e]}set(e,n){this.predicates[e]=n}toString(){let e="";const n=this.predicates.length;for(let r=0;r<n;r++)e+=this.predicates[r]===!0?"1":"0";return e}}const kc=new Dd;class AI extends Ia{constructor(e){var n;super(),this.logging=(n=e==null?void 0:e.logging)!==null&&n!==void 0?n:r=>console.log(r)}initialize(e){this.atn=O_(e.rules),this.dfas=EI(this.atn)}validateAmbiguousAlternationAlternatives(){return[]}validateEmptyOrAlternatives(){return[]}buildLookaheadForAlternation(e){const{prodOccurrence:n,rule:r,hasPredicates:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,c=cn(r,"Alternation",n),l=this.atn.decisionMap[c].decision,f=ot(tc({maxLookahead:1,occurrence:n,prodType:"Alternation",rule:r}),d=>ot(d,h=>h[0]));if(Oc(f,!1)&&!s){const d=bc(f,(h,g,m)=>(Zi(g,T=>{T&&(h[T.tokenTypeIdx]=m,Zi(T.categoryMatches,y=>{h[y]=m}))}),h),{});return i?function(h){var g;const m=this.LA(1),T=d[m.tokenTypeIdx];if(h!==void 0&&T!==void 0){const y=(g=h[T])===null||g===void 0?void 0:g.GATE;if(y!==void 0&&y.call(this)===!1)return}return T}:function(){const h=this.LA(1);return d[h.tokenTypeIdx]}}else return i?function(d){const h=new Dd,g=d===void 0?0:d.length;for(let T=0;T<g;T++){const y=d==null?void 0:d[T].GATE;h.set(T,y===void 0||y.call(this))}const m=es.call(this,a,l,h,o);return typeof m=="number"?m:void 0}:function(){const d=es.call(this,a,l,kc,o);return typeof d=="number"?d:void 0}}buildLookaheadForOptional(e){const{prodOccurrence:n,rule:r,prodType:i,dynamicTokensEnabled:s}=e,a=this.dfas,o=this.logging,c=cn(r,i,n),l=this.atn.decisionMap[c].decision,f=ot(tc({maxLookahead:1,occurrence:n,prodType:i,rule:r}),d=>ot(d,h=>h[0]));if(Oc(f)&&f[0][0]&&!s){const d=f[0],h=uI(d);if(h.length===1&&mI(h[0].categoryMatches)){const m=h[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===m}}else{const g=bc(h,(m,T)=>(T!==void 0&&(m[T.tokenTypeIdx]=!0,Zi(T.categoryMatches,y=>{m[y]=!0})),m),{});return function(){const m=this.LA(1);return g[m.tokenTypeIdx]===!0}}}return function(){const d=es.call(this,a,l,kc,o);return typeof d=="object"?!1:d===0}}}function Oc(t,e=!0){const n=new Set;for(const r of t){const i=new Set;for(const s of r){if(s===void 0){if(e)break;return!1}const a=[s.tokenTypeIdx].concat(s.categoryMatches);for(const o of a)if(n.has(o)){if(!i.has(o))return!1}else n.add(o),i.add(o)}}return!0}function EI(t){const e=t.decisionStates.length,n=Array(e);for(let r=0;r<e;r++)n[r]=vI(t.decisionStates[r],r);return n}function es(t,e,n,r){const i=t[e](n);let s=i.start;if(s===void 0){const o=kI(i.atnStartState);s=Gd(i,Fd(o)),i.start=s}return RI.apply(this,[i,s,n,r])}function RI(t,e,n,r){let i=e,s=1;const a=[];let o=this.LA(s++);for(;;){let c=CI(i,o);if(c===void 0&&(c=$I.apply(this,[t,i,o,s,n,r])),c===Hr)return xI(a,i,o);if(c.isAcceptState===!0)return c.prediction;i=c,a.push(o),o=this.LA(s++)}}function $I(t,e,n,r,i,s){const a=wI(e.configs,n,i);if(a.size===0)return Pc(t,e,n,Hr),Hr;let o=Fd(a);const c=bI(a,i);if(c!==void 0)o.isAcceptState=!0,o.prediction=c,o.configs.uniqueAlt=c;else if(MI(a)){const u=Y_(a.alts);o.isAcceptState=!0,o.prediction=u,o.configs.uniqueAlt=u,SI.apply(this,[t,r,a.alts,s])}return o=Pc(t,e,n,o),o}function SI(t,e,n,r){const i=[];for(let u=1;u<=e;u++)i.push(this.LA(u).tokenType);const s=t.atnStartState,a=s.rule,o=s.production,c=_I({topLevelRule:a,ambiguityIndices:n,production:o,prefixPath:i});r(c)}function _I(t){const e=ot(t.prefixPath,i=>Zt(i)).join(", "),n=t.production.idx===0?"":t.production.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(", ")}> in <${II(t.production)}${n}> inside <${t.topLevelRule.name}> Rule,
|
|
111
|
+
<${e}> may appears as a prefix path in all these alternatives.
|
|
112
|
+
`;return r=r+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
113
|
+
For Further details.`,r}function II(t){if(t instanceof le)return"SUBRULE";if(t instanceof re)return"OPTION";if(t instanceof Te)return"OR";if(t instanceof Se)return"AT_LEAST_ONE";if(t instanceof _e)return"AT_LEAST_ONE_SEP";if(t instanceof ye)return"MANY_SEP";if(t instanceof V)return"MANY";if(t instanceof H)return"CONSUME";throw Error("non exhaustive match")}function xI(t,e,n){const r=J_(e.configs.elements,s=>s.state.transitions),i=cI(r.filter(s=>s instanceof Da).map(s=>s.tokenType),s=>s.tokenTypeIdx);return{actualToken:n,possibleTokenTypes:i,tokenPath:t}}function CI(t,e){return t.edges[e.tokenTypeIdx]}function wI(t,e,n){const r=new _s,i=[];for(const a of t.elements){if(n.is(a.alt)===!1)continue;if(a.state.type===hr){i.push(a);continue}const o=a.state.transitions.length;for(let c=0;c<o;c++){const u=a.state.transitions[c],l=NI(u,e);l!==void 0&&r.add({state:l,alt:a.alt,stack:a.stack})}}let s;if(i.length===0&&r.size===1&&(s=r),s===void 0){s=new _s;for(const a of r.elements)Wr(a,s)}if(i.length>0&&!PI(s))for(const a of i)s.add(a);return s}function NI(t,e){if(t instanceof Da&&Hf(e,t.tokenType))return t.target}function bI(t,e){let n;for(const r of t.elements)if(e.is(r.alt)===!0){if(n===void 0)n=r.alt;else if(n!==r.alt)return}return n}function Fd(t){return{configs:t,edges:{},isAcceptState:!1,prediction:-1}}function Pc(t,e,n,r){return r=Gd(t,r),e.edges[n.tokenTypeIdx]=r,r}function Gd(t,e){if(e===Hr)return e;const n=e.configs.key,r=t.states[n];return r!==void 0?r:(e.configs.finalize(),t.states[n]=e,e)}function kI(t){const e=new _s,n=t.transitions.length;for(let r=0;r<n;r++){const s={state:t.transitions[r].target,alt:r,stack:[]};Wr(s,e)}return e}function Wr(t,e){const n=t.state;if(n.type===hr){if(t.stack.length>0){const i=[...t.stack],a={state:i.pop(),alt:t.alt,stack:i};Wr(a,e)}else e.add(t);return}n.epsilonOnlyTransitions||e.add(t);const r=n.transitions.length;for(let i=0;i<r;i++){const s=n.transitions[i],a=OI(t,s);a!==void 0&&Wr(a,e)}}function OI(t,e){if(e instanceof bd)return{state:e.target,alt:t.alt,stack:t.stack};if(e instanceof Fa){const n=[...t.stack,e.followState];return{state:e.target,alt:t.alt,stack:n}}}function PI(t){for(const e of t.elements)if(e.state.type===hr)return!0;return!1}function LI(t){for(const e of t.elements)if(e.state.type!==hr)return!1;return!0}function MI(t){if(LI(t))return!0;const e=DI(t.elements);return FI(e)&&!GI(e)}function DI(t){const e=new Map;for(const n of t){const r=Ld(n,!1);let i=e.get(r);i===void 0&&(i={},e.set(r,i)),i[n.alt]=!0}return e}function FI(t){for(const e of Array.from(t.values()))if(Object.keys(e).length>1)return!0;return!1}function GI(t){for(const e of Array.from(t.values()))if(Object.keys(e).length===1)return!0;return!1}var Lc;(function(t){function e(n){return typeof n=="string"}t.is=e})(Lc||(Lc={}));var Is;(function(t){function e(n){return typeof n=="string"}t.is=e})(Is||(Is={}));var Mc;(function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(Mc||(Mc={}));var zr;(function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647;function e(n){return typeof n=="number"&&t.MIN_VALUE<=n&&n<=t.MAX_VALUE}t.is=e})(zr||(zr={}));var D;(function(t){function e(r,i){return r===Number.MAX_VALUE&&(r=zr.MAX_VALUE),i===Number.MAX_VALUE&&(i=zr.MAX_VALUE),{line:r,character:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&p.uinteger(i.line)&&p.uinteger(i.character)}t.is=n})(D||(D={}));var L;(function(t){function e(r,i,s,a){if(p.uinteger(r)&&p.uinteger(i)&&p.uinteger(s)&&p.uinteger(a))return{start:D.create(r,i),end:D.create(s,a)};if(D.is(r)&&D.is(i))return{start:r,end:i};throw new Error(`Range#create called with invalid arguments[${r}, ${i}, ${s}, ${a}]`)}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&D.is(i.start)&&D.is(i.end)}t.is=n})(L||(L={}));var Kr;(function(t){function e(r,i){return{uri:r,range:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.range)&&(p.string(i.uri)||p.undefined(i.uri))}t.is=n})(Kr||(Kr={}));var Dc;(function(t){function e(r,i,s,a){return{targetUri:r,targetRange:i,targetSelectionRange:s,originSelectionRange:a}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.targetRange)&&p.string(i.targetUri)&&L.is(i.targetSelectionRange)&&(L.is(i.originSelectionRange)||p.undefined(i.originSelectionRange))}t.is=n})(Dc||(Dc={}));var xs;(function(t){function e(r,i,s,a){return{red:r,green:i,blue:s,alpha:a}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.numberRange(i.red,0,1)&&p.numberRange(i.green,0,1)&&p.numberRange(i.blue,0,1)&&p.numberRange(i.alpha,0,1)}t.is=n})(xs||(xs={}));var Fc;(function(t){function e(r,i){return{range:r,color:i}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&L.is(i.range)&&xs.is(i.color)}t.is=n})(Fc||(Fc={}));var Gc;(function(t){function e(r,i,s){return{label:r,textEdit:i,additionalTextEdits:s}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.string(i.label)&&(p.undefined(i.textEdit)||ln.is(i))&&(p.undefined(i.additionalTextEdits)||p.typedArray(i.additionalTextEdits,ln.is))}t.is=n})(Gc||(Gc={}));var Uc;(function(t){t.Comment="comment",t.Imports="imports",t.Region="region"})(Uc||(Uc={}));var Bc;(function(t){function e(r,i,s,a,o,c){const u={startLine:r,endLine:i};return p.defined(s)&&(u.startCharacter=s),p.defined(a)&&(u.endCharacter=a),p.defined(o)&&(u.kind=o),p.defined(c)&&(u.collapsedText=c),u}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.uinteger(i.startLine)&&p.uinteger(i.startLine)&&(p.undefined(i.startCharacter)||p.uinteger(i.startCharacter))&&(p.undefined(i.endCharacter)||p.uinteger(i.endCharacter))&&(p.undefined(i.kind)||p.string(i.kind))}t.is=n})(Bc||(Bc={}));var Cs;(function(t){function e(r,i){return{location:r,message:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&Kr.is(i.location)&&p.string(i.message)}t.is=n})(Cs||(Cs={}));var jc;(function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4})(jc||(jc={}));var Hc;(function(t){t.Unnecessary=1,t.Deprecated=2})(Hc||(Hc={}));var Wc;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&p.string(r.href)}t.is=e})(Wc||(Wc={}));var Vr;(function(t){function e(r,i,s,a,o,c){let u={range:r,message:i};return p.defined(s)&&(u.severity=s),p.defined(a)&&(u.code=a),p.defined(o)&&(u.source=o),p.defined(c)&&(u.relatedInformation=c),u}t.create=e;function n(r){var i;let s=r;return p.defined(s)&&L.is(s.range)&&p.string(s.message)&&(p.number(s.severity)||p.undefined(s.severity))&&(p.integer(s.code)||p.string(s.code)||p.undefined(s.code))&&(p.undefined(s.codeDescription)||p.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(p.string(s.source)||p.undefined(s.source))&&(p.undefined(s.relatedInformation)||p.typedArray(s.relatedInformation,Cs.is))}t.is=n})(Vr||(Vr={}));var un;(function(t){function e(r,i,...s){let a={title:r,command:i};return p.defined(s)&&s.length>0&&(a.arguments=s),a}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.title)&&p.string(i.command)}t.is=n})(un||(un={}));var ln;(function(t){function e(s,a){return{range:s,newText:a}}t.replace=e;function n(s,a){return{range:{start:s,end:s},newText:a}}t.insert=n;function r(s){return{range:s,newText:""}}t.del=r;function i(s){const a=s;return p.objectLiteral(a)&&p.string(a.newText)&&L.is(a.range)}t.is=i})(ln||(ln={}));var ws;(function(t){function e(r,i,s){const a={label:r};return i!==void 0&&(a.needsConfirmation=i),s!==void 0&&(a.description=s),a}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&p.string(i.label)&&(p.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(p.string(i.description)||i.description===void 0)}t.is=n})(ws||(ws={}));var fn;(function(t){function e(n){const r=n;return p.string(r)}t.is=e})(fn||(fn={}));var zc;(function(t){function e(s,a,o){return{range:s,newText:a,annotationId:o}}t.replace=e;function n(s,a,o){return{range:{start:s,end:s},newText:a,annotationId:o}}t.insert=n;function r(s,a){return{range:s,newText:"",annotationId:a}}t.del=r;function i(s){const a=s;return ln.is(a)&&(ws.is(a.annotationId)||fn.is(a.annotationId))}t.is=i})(zc||(zc={}));var Ns;(function(t){function e(r,i){return{textDocument:r,edits:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&Ls.is(i.textDocument)&&Array.isArray(i.edits)}t.is=n})(Ns||(Ns={}));var bs;(function(t){function e(r,i,s){let a={kind:"create",uri:r};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}t.create=e;function n(r){let i=r;return i&&i.kind==="create"&&p.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||p.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||p.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||fn.is(i.annotationId))}t.is=n})(bs||(bs={}));var ks;(function(t){function e(r,i,s,a){let o={kind:"rename",oldUri:r,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(o.options=s),a!==void 0&&(o.annotationId=a),o}t.create=e;function n(r){let i=r;return i&&i.kind==="rename"&&p.string(i.oldUri)&&p.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||p.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||p.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||fn.is(i.annotationId))}t.is=n})(ks||(ks={}));var Os;(function(t){function e(r,i,s){let a={kind:"delete",uri:r};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}t.create=e;function n(r){let i=r;return i&&i.kind==="delete"&&p.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||p.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||p.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||fn.is(i.annotationId))}t.is=n})(Os||(Os={}));var Ps;(function(t){function e(n){let r=n;return r&&(r.changes!==void 0||r.documentChanges!==void 0)&&(r.documentChanges===void 0||r.documentChanges.every(i=>p.string(i.kind)?bs.is(i)||ks.is(i)||Os.is(i):Ns.is(i)))}t.is=e})(Ps||(Ps={}));var Kc;(function(t){function e(r){return{uri:r}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)}t.is=n})(Kc||(Kc={}));var Vc;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&p.integer(i.version)}t.is=n})(Vc||(Vc={}));var Ls;(function(t){function e(r,i){return{uri:r,version:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&(i.version===null||p.integer(i.version))}t.is=n})(Ls||(Ls={}));var qc;(function(t){function e(r,i,s,a){return{uri:r,languageId:i,version:s,text:a}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.string(i.uri)&&p.string(i.languageId)&&p.integer(i.version)&&p.string(i.text)}t.is=n})(qc||(qc={}));var Ms;(function(t){t.PlainText="plaintext",t.Markdown="markdown";function e(n){const r=n;return r===t.PlainText||r===t.Markdown}t.is=e})(Ms||(Ms={}));var jn;(function(t){function e(n){const r=n;return p.objectLiteral(n)&&Ms.is(r.kind)&&p.string(r.value)}t.is=e})(jn||(jn={}));var Yc;(function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25})(Yc||(Yc={}));var Xc;(function(t){t.PlainText=1,t.Snippet=2})(Xc||(Xc={}));var Jc;(function(t){t.Deprecated=1})(Jc||(Jc={}));var Qc;(function(t){function e(r,i,s){return{newText:r,insert:i,replace:s}}t.create=e;function n(r){const i=r;return i&&p.string(i.newText)&&L.is(i.insert)&&L.is(i.replace)}t.is=n})(Qc||(Qc={}));var Zc;(function(t){t.asIs=1,t.adjustIndentation=2})(Zc||(Zc={}));var eu;(function(t){function e(n){const r=n;return r&&(p.string(r.detail)||r.detail===void 0)&&(p.string(r.description)||r.description===void 0)}t.is=e})(eu||(eu={}));var tu;(function(t){function e(n){return{label:n}}t.create=e})(tu||(tu={}));var nu;(function(t){function e(n,r){return{items:n||[],isIncomplete:!!r}}t.create=e})(nu||(nu={}));var qr;(function(t){function e(r){return r.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}t.fromPlainText=e;function n(r){const i=r;return p.string(i)||p.objectLiteral(i)&&p.string(i.language)&&p.string(i.value)}t.is=n})(qr||(qr={}));var ru;(function(t){function e(n){let r=n;return!!r&&p.objectLiteral(r)&&(jn.is(r.contents)||qr.is(r.contents)||p.typedArray(r.contents,qr.is))&&(n.range===void 0||L.is(n.range))}t.is=e})(ru||(ru={}));var iu;(function(t){function e(n,r){return r?{label:n,documentation:r}:{label:n}}t.create=e})(iu||(iu={}));var su;(function(t){function e(n,r,...i){let s={label:n};return p.defined(r)&&(s.documentation=r),p.defined(i)?s.parameters=i:s.parameters=[],s}t.create=e})(su||(su={}));var au;(function(t){t.Text=1,t.Read=2,t.Write=3})(au||(au={}));var ou;(function(t){function e(n,r){let i={range:n};return p.number(r)&&(i.kind=r),i}t.create=e})(ou||(ou={}));var cu;(function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26})(cu||(cu={}));var uu;(function(t){t.Deprecated=1})(uu||(uu={}));var lu;(function(t){function e(n,r,i,s,a){let o={name:n,kind:r,location:{uri:s,range:i}};return a&&(o.containerName=a),o}t.create=e})(lu||(lu={}));var fu;(function(t){function e(n,r,i,s){return s!==void 0?{name:n,kind:r,location:{uri:i,range:s}}:{name:n,kind:r,location:{uri:i}}}t.create=e})(fu||(fu={}));var du;(function(t){function e(r,i,s,a,o,c){let u={name:r,detail:i,kind:s,range:a,selectionRange:o};return c!==void 0&&(u.children=c),u}t.create=e;function n(r){let i=r;return i&&p.string(i.name)&&p.number(i.kind)&&L.is(i.range)&&L.is(i.selectionRange)&&(i.detail===void 0||p.string(i.detail))&&(i.deprecated===void 0||p.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}t.is=n})(du||(du={}));var hu;(function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"})(hu||(hu={}));var Yr;(function(t){t.Invoked=1,t.Automatic=2})(Yr||(Yr={}));var pu;(function(t){function e(r,i,s){let a={diagnostics:r};return i!=null&&(a.only=i),s!=null&&(a.triggerKind=s),a}t.create=e;function n(r){let i=r;return p.defined(i)&&p.typedArray(i.diagnostics,Vr.is)&&(i.only===void 0||p.typedArray(i.only,p.string))&&(i.triggerKind===void 0||i.triggerKind===Yr.Invoked||i.triggerKind===Yr.Automatic)}t.is=n})(pu||(pu={}));var gu;(function(t){function e(r,i,s){let a={title:r},o=!0;return typeof i=="string"?(o=!1,a.kind=i):un.is(i)?a.command=i:a.edit=i,o&&s!==void 0&&(a.kind=s),a}t.create=e;function n(r){let i=r;return i&&p.string(i.title)&&(i.diagnostics===void 0||p.typedArray(i.diagnostics,Vr.is))&&(i.kind===void 0||p.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||un.is(i.command))&&(i.isPreferred===void 0||p.boolean(i.isPreferred))&&(i.edit===void 0||Ps.is(i.edit))}t.is=n})(gu||(gu={}));var mu;(function(t){function e(r,i){let s={range:r};return p.defined(i)&&(s.data=i),s}t.create=e;function n(r){let i=r;return p.defined(i)&&L.is(i.range)&&(p.undefined(i.command)||un.is(i.command))}t.is=n})(mu||(mu={}));var yu;(function(t){function e(r,i){return{tabSize:r,insertSpaces:i}}t.create=e;function n(r){let i=r;return p.defined(i)&&p.uinteger(i.tabSize)&&p.boolean(i.insertSpaces)}t.is=n})(yu||(yu={}));var Tu;(function(t){function e(r,i,s){return{range:r,target:i,data:s}}t.create=e;function n(r){let i=r;return p.defined(i)&&L.is(i.range)&&(p.undefined(i.target)||p.string(i.target))}t.is=n})(Tu||(Tu={}));var vu;(function(t){function e(r,i){return{range:r,parent:i}}t.create=e;function n(r){let i=r;return p.objectLiteral(i)&&L.is(i.range)&&(i.parent===void 0||t.is(i.parent))}t.is=n})(vu||(vu={}));var Au;(function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"})(Au||(Au={}));var Eu;(function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"})(Eu||(Eu={}));var Ru;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&(r.resultId===void 0||typeof r.resultId=="string")&&Array.isArray(r.data)&&(r.data.length===0||typeof r.data[0]=="number")}t.is=e})(Ru||(Ru={}));var $u;(function(t){function e(r,i){return{range:r,text:i}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&p.string(i.text)}t.is=n})($u||($u={}));var Su;(function(t){function e(r,i,s){return{range:r,variableName:i,caseSensitiveLookup:s}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&p.boolean(i.caseSensitiveLookup)&&(p.string(i.variableName)||i.variableName===void 0)}t.is=n})(Su||(Su={}));var _u;(function(t){function e(r,i){return{range:r,expression:i}}t.create=e;function n(r){const i=r;return i!=null&&L.is(i.range)&&(p.string(i.expression)||i.expression===void 0)}t.is=n})(_u||(_u={}));var Iu;(function(t){function e(r,i){return{frameId:r,stoppedLocation:i}}t.create=e;function n(r){const i=r;return p.defined(i)&&L.is(r.stoppedLocation)}t.is=n})(Iu||(Iu={}));var Ds;(function(t){t.Type=1,t.Parameter=2;function e(n){return n===1||n===2}t.is=e})(Ds||(Ds={}));var Fs;(function(t){function e(r){return{value:r}}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&(i.tooltip===void 0||p.string(i.tooltip)||jn.is(i.tooltip))&&(i.location===void 0||Kr.is(i.location))&&(i.command===void 0||un.is(i.command))}t.is=n})(Fs||(Fs={}));var xu;(function(t){function e(r,i,s){const a={position:r,label:i};return s!==void 0&&(a.kind=s),a}t.create=e;function n(r){const i=r;return p.objectLiteral(i)&&D.is(i.position)&&(p.string(i.label)||p.typedArray(i.label,Fs.is))&&(i.kind===void 0||Ds.is(i.kind))&&i.textEdits===void 0||p.typedArray(i.textEdits,ln.is)&&(i.tooltip===void 0||p.string(i.tooltip)||jn.is(i.tooltip))&&(i.paddingLeft===void 0||p.boolean(i.paddingLeft))&&(i.paddingRight===void 0||p.boolean(i.paddingRight))}t.is=n})(xu||(xu={}));var Cu;(function(t){function e(n){return{kind:"snippet",value:n}}t.createSnippet=e})(Cu||(Cu={}));var wu;(function(t){function e(n,r,i,s){return{insertText:n,filterText:r,range:i,command:s}}t.create=e})(wu||(wu={}));var Nu;(function(t){function e(n){return{items:n}}t.create=e})(Nu||(Nu={}));var bu;(function(t){t.Invoked=0,t.Automatic=1})(bu||(bu={}));var ku;(function(t){function e(n,r){return{range:n,text:r}}t.create=e})(ku||(ku={}));var Ou;(function(t){function e(n,r){return{triggerKind:n,selectedCompletionInfo:r}}t.create=e})(Ou||(Ou={}));var Pu;(function(t){function e(n){const r=n;return p.objectLiteral(r)&&Is.is(r.uri)&&p.string(r.name)}t.is=e})(Pu||(Pu={}));var Lu;(function(t){function e(s,a,o,c){return new UI(s,a,o,c)}t.create=e;function n(s){let a=s;return!!(p.defined(a)&&p.string(a.uri)&&(p.undefined(a.languageId)||p.string(a.languageId))&&p.uinteger(a.lineCount)&&p.func(a.getText)&&p.func(a.positionAt)&&p.func(a.offsetAt))}t.is=n;function r(s,a){let o=s.getText(),c=i(a,(l,f)=>{let d=l.range.start.line-f.range.start.line;return d===0?l.range.start.character-f.range.start.character:d}),u=o.length;for(let l=c.length-1;l>=0;l--){let f=c[l],d=s.offsetAt(f.range.start),h=s.offsetAt(f.range.end);if(h<=u)o=o.substring(0,d)+f.newText+o.substring(h,o.length);else throw new Error("Overlapping edit");u=d}return o}t.applyEdits=r;function i(s,a){if(s.length<=1)return s;const o=s.length/2|0,c=s.slice(0,o),u=s.slice(o);i(c,a),i(u,a);let l=0,f=0,d=0;for(;l<c.length&&f<u.length;)a(c[l],u[f])<=0?s[d++]=c[l++]:s[d++]=u[f++];for(;l<c.length;)s[d++]=c[l++];for(;f<u.length;)s[d++]=u[f++];return s}})(Lu||(Lu={}));let UI=class{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],n=this._content,r=!0;for(let i=0;i<n.length;i++){r&&(e.push(i),r=!1);let s=n.charAt(i);r=s==="\r"||s===`
|
|
114
|
+
`,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
|
|
115
|
+
`&&i++}r&&n.length>0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return D.create(0,e);for(;r<i;){let a=Math.floor((r+i)/2);n[a]>e?i=a:r=a+1}let s=r-1;return D.create(s,e-n[s])}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line],i=e.line+1<n.length?n[e.line+1]:this._content.length;return Math.max(Math.min(r+e.character,i),r)}get lineCount(){return this.getLineOffsets().length}};var p;(function(t){const e=Object.prototype.toString;function n(h){return typeof h<"u"}t.defined=n;function r(h){return typeof h>"u"}t.undefined=r;function i(h){return h===!0||h===!1}t.boolean=i;function s(h){return e.call(h)==="[object String]"}t.string=s;function a(h){return e.call(h)==="[object Number]"}t.number=a;function o(h,g,m){return e.call(h)==="[object Number]"&&g<=h&&h<=m}t.numberRange=o;function c(h){return e.call(h)==="[object Number]"&&-2147483648<=h&&h<=2147483647}t.integer=c;function u(h){return e.call(h)==="[object Number]"&&0<=h&&h<=2147483647}t.uinteger=u;function l(h){return e.call(h)==="[object Function]"}t.func=l;function f(h){return h!==null&&typeof h=="object"}t.objectLiteral=f;function d(h,g){return Array.isArray(h)&&h.every(g)}t.typedArray=d})(p||(p={}));class BI{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]}buildRootNode(e){return this.rootNode=new Bd(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){const n=new Ba;return n.grammarSource=e,n.root=this.rootNode,this.current.content.push(n),this.nodeStack.push(n),n}buildLeafNode(e,n){const r=new Gs(e.startOffset,e.image.length,os(e),e.tokenType,!1);return r.grammarSource=n,r.root=this.rootNode,this.current.content.push(r),r}removeNode(e){const n=e.container;if(n){const r=n.content.indexOf(e);r>=0&&n.content.splice(r,1)}}construct(e){const n=this.current;typeof e.$type=="string"&&(this.current.astNode=e),e.$cstNode=n;const r=this.nodeStack.pop();(r==null?void 0:r.content.length)===0&&this.removeNode(r)}addHiddenTokens(e){for(const n of e){const r=new Gs(n.startOffset,n.image.length,os(n),n.tokenType,!0);r.root=this.rootNode,this.addHiddenToken(this.rootNode,r)}}addHiddenToken(e,n){const{offset:r,end:i}=n;for(let s=0;s<e.content.length;s++){const a=e.content[s],{offset:o,end:c}=a;if(tn(a)&&r>o&&i<c){this.addHiddenToken(a,n);return}else if(i<=o){e.content.splice(s,0,n);return}}e.content.push(n)}}class Ud{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){var e,n;const r=typeof((e=this._astNode)===null||e===void 0?void 0:e.$type)=="string"?this._astNode:(n=this.container)===null||n===void 0?void 0:n.astNode;if(!r)throw new Error("This node has no associated AST element");return r}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}}class Gs extends Ud{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,n,r,i,s=!1){super(),this._hidden=s,this._offset=e,this._tokenType=i,this._length=n,this._range=r}}class Ba extends Ud{constructor(){super(...arguments),this.content=new ja(this)}get children(){return this.content}get offset(){var e,n;return(n=(e=this.firstNonHiddenNode)===null||e===void 0?void 0:e.offset)!==null&&n!==void 0?n:0}get length(){return this.end-this.offset}get end(){var e,n;return(n=(e=this.lastNonHiddenNode)===null||e===void 0?void 0:e.end)!==null&&n!==void 0?n:0}get range(){const e=this.firstNonHiddenNode,n=this.lastNonHiddenNode;if(e&&n){if(this._rangeCache===void 0){const{range:r}=e,{range:i}=n;this._rangeCache={start:r.start,end:i.end.line<r.start.line?r.start:i.end}}return this._rangeCache}else return{start:D.create(0,0),end:D.create(0,0)}}get firstNonHiddenNode(){for(const e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){const n=this.content[e];if(!n.hidden)return n}return this.content[this.content.length-1]}}class ja extends Array{constructor(e){super(),this.parent=e,Object.setPrototypeOf(this,ja.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,n,...r){return this.addParents(r),super.splice(e,n,...r)}addParents(e){for(const n of e)n.container=this.parent}}class Bd extends Ba{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text="",this._text=e??""}}const Us=Symbol("Datatype");function ts(t){return t.$type===Us}const Mu="",jd=t=>t.endsWith(Mu)?t:t+Mu;class Hd{constructor(e){this._unorderedGroups=new Map,this.lexer=e.parser.Lexer;const n=this.lexer.definition;this.wrapper=new KI(n,Object.assign(Object.assign({},e.parser.ParserConfig),{errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,n){this.wrapper.wrapOr(e,n)}optional(e,n){this.wrapper.wrapOption(e,n)}many(e,n){this.wrapper.wrapMany(e,n)}atLeastOne(e,n){this.wrapper.wrapAtLeastOne(e,n)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}}class jI extends Hd{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new BI,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,n){const r=e.fragment?void 0:ta(e)?Us:oi(e),i=this.wrapper.DEFINE_RULE(jd(e.name),this.startImplementation(r,n).bind(this));return e.entry&&(this.mainRule=i),i}parse(e){this.nodeBuilder.buildRootNode(e);const n=this.lexer.tokenize(e);this.wrapper.input=n.tokens;const r=this.mainRule.call(this.wrapper,{});return this.nodeBuilder.addHiddenTokens(n.hidden),this.unorderedGroups.clear(),{value:r,lexerErrors:n.errors,parserErrors:this.wrapper.errors}}startImplementation(e,n){return r=>{if(!this.isRecording()){const s={$type:e};this.stack.push(s),e===Us&&(s.value="")}let i;try{i=n(r)}catch{i=void 0}return!this.isRecording()&&i===void 0&&(i=this.construct()),i}}consume(e,n,r){const i=this.wrapper.wrapConsume(e,n);if(!this.isRecording()&&this.isValidToken(i)){const s=this.nodeBuilder.buildLeafNode(i,r),{assignment:a,isCrossRef:o}=this.getAssignment(r),c=this.current;if(a){const u=Mt(r)?i.image:this.converter.convert(i.image,s);this.assign(a.operator,a.feature,u,s,o)}else if(ts(c)){let u=i.image;Mt(r)||(u=this.converter.convert(u,s).toString()),c.value+=u}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset=="number"&&!isNaN(e.endOffset)}subrule(e,n,r,i){let s;this.isRecording()||(s=this.nodeBuilder.buildCompositeNode(r));const a=this.wrapper.wrapSubrule(e,n,i);!this.isRecording()&&s&&s.length>0&&this.performSubruleAssignment(a,r,s)}performSubruleAssignment(e,n,r){const{assignment:i,isCrossRef:s}=this.getAssignment(n);if(i)this.assign(i.operator,i.feature,e,r,s);else if(!i){const a=this.current;if(ts(a))a.value+=e.toString();else if(typeof e=="object"&&e){const o=e.$type,c=this.assignWithoutOverride(e,a);o&&(c.$type=o);const u=c;this.stack.pop(),this.stack.push(u)}}}action(e,n){if(!this.isRecording()){let r=this.current;if(!r.$cstNode&&n.feature&&n.operator){r=this.construct(!1);const s=r.$cstNode.feature;this.nodeBuilder.buildCompositeNode(s)}const i={$type:e};this.stack.pop(),this.stack.push(i),n.feature&&n.operator&&this.assign(n.operator,n.feature,r,r.$cstNode,!1)}}construct(e=!0){if(this.isRecording())return;const n=this.current;return lp(n),this.nodeBuilder.construct(n),e&&this.stack.pop(),ts(n)?this.converter.convert(n.value,n.$cstNode):(dp(this.astReflection,n),n)}getAssignment(e){if(!this.assignmentMap.has(e)){const n=ii(e,Lt);this.assignmentMap.set(e,{assignment:n,isCrossRef:n?Js(n.terminal):!1})}return this.assignmentMap.get(e)}assign(e,n,r,i,s){const a=this.current;let o;switch(s&&typeof r=="string"?o=this.linker.buildReference(a,n,i,r):o=r,e){case"=":{a[n]=o;break}case"?=":{a[n]=!0;break}case"+=":Array.isArray(a[n])||(a[n]=[]),a[n].push(o)}}assignWithoutOverride(e,n){for(const[r,i]of Object.entries(n)){const s=e[r];s===void 0?e[r]=i:Array.isArray(s)&&Array.isArray(i)&&(i.push(...s),e[r]=i)}return e}get definitionErrors(){return this.wrapper.definitionErrors}}class HI{buildMismatchTokenMessage(e){return Xt.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return Xt.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return Xt.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return Xt.buildEarlyExitMessage(e)}}class Wd extends HI{buildMismatchTokenMessage({expected:e,actual:n}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(":KW")?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${n.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}}class WI extends Hd{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){this.resetState();const n=this.lexer.tokenize(e);return this.tokens=n.tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,n){const r=this.wrapper.DEFINE_RULE(jd(e.name),this.startImplementation(n).bind(this));return e.entry&&(this.mainRule=r),r}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return n=>{const r=this.keepStackSize();try{e(n)}finally{this.resetStackSize(r)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){const e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,n,r){this.wrapper.wrapConsume(e,n),this.isRecording()||(this.lastElementStack=[...this.elementStack,r],this.nextTokenIndex=this.currIdx+1)}subrule(e,n,r,i){this.before(r),this.wrapper.wrapSubrule(e,n,i),this.after(r)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){const n=this.elementStack.lastIndexOf(e);n>=0&&this.elementStack.splice(n)}}get currIdx(){return this.wrapper.currIdx}}const zI={recoveryEnabled:!0,nodeLocationTracking:"full",skipValidations:!0,errorMessageProvider:new Wd};class KI extends TR{constructor(e,n){const r=n&&"maxLookahead"in n;super(e,Object.assign(Object.assign(Object.assign({},zI),{lookaheadStrategy:r?new Ia({maxLookahead:n.maxLookahead}):new AI}),n))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,n){return this.RULE(e,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,n){return this.consume(e,n)}wrapSubrule(e,n,r){return this.subrule(e,n,{ARGS:[r]})}wrapOr(e,n){this.or(e,n)}wrapOption(e,n){this.option(e,n)}wrapMany(e,n){this.many(e,n)}wrapAtLeastOne(e,n){this.atLeastOne(e,n)}}function zd(t,e,n){return VI({parser:e,tokens:n,rules:new Map,ruleNames:new Map},t),e}function VI(t,e){const n=zl(e,!1),r=ne(e.rules).filter(be).filter(i=>n.has(i));for(const i of r){const s=Object.assign(Object.assign({},t),{consume:1,optional:1,subrule:1,many:1,or:1});s.rules.set(i.name,t.parser.rule(i,Bt(s,i.definition)))}}function Bt(t,e,n=!1){let r;if(Mt(e))r=ex(t,e);else if(ri(e))r=qI(t,e);else if(Lt(e))r=Bt(t,e.terminal);else if(Js(e))r=Kd(t,e);else if(Dt(e))r=YI(t,e);else if(Sl(e))r=JI(t,e);else if(Fl(e))r=QI(t,e);else if(Qs(e))r=ZI(t,e);else if(np(e)){const i=t.consume++;r=()=>t.parser.consume(i,_t,e)}else throw new ol(e.$cstNode,`Unexpected element type: ${e.$type}`);return Vd(t,n?void 0:Xr(e),r,e.cardinality)}function qI(t,e){const n=oi(e);return()=>t.parser.action(n,e)}function YI(t,e){const n=e.rule.ref;if(be(n)){const r=t.subrule++,i=e.arguments.length>0?XI(n,e.arguments):()=>({});return s=>t.parser.subrule(r,qd(t,n),e,i(s))}else if(jt(n)){const r=t.consume++,i=Bs(t,n.name);return()=>t.parser.consume(r,i,e)}else if(n)ni();else throw new ol(e.$cstNode,`Undefined rule type: ${e.$type}`)}function XI(t,e){const n=e.map(r=>at(r.value));return r=>{const i={};for(let s=0;s<n.length;s++){const a=t.parameters[s],o=n[s];i[a.name]=o(r)}return i}}function at(t){if(Hh(t)){const e=at(t.left),n=at(t.right);return r=>e(r)||n(r)}else if(jh(t)){const e=at(t.left),n=at(t.right);return r=>e(r)&&n(r)}else if(zh(t)){const e=at(t.value);return n=>!e(n)}else if(qh(t)){const e=t.parameter.ref.name;return n=>n!==void 0&&n[e]===!0}else if(Bh(t)){const e=!!t.true;return()=>e}ni()}function JI(t,e){if(e.elements.length===1)return Bt(t,e.elements[0]);{const n=[];for(const i of e.elements){const s={ALT:Bt(t,i,!0)},a=Xr(i);a&&(s.GATE=at(a)),n.push(s)}const r=t.or++;return i=>t.parser.alternatives(r,n.map(s=>{const a={ALT:()=>s.ALT(i)},o=s.GATE;return o&&(a.GATE=()=>o(i)),a}))}}function QI(t,e){if(e.elements.length===1)return Bt(t,e.elements[0]);const n=[];for(const o of e.elements){const c={ALT:Bt(t,o,!0)},u=Xr(o);u&&(c.GATE=at(u)),n.push(c)}const r=t.or++,i=(o,c)=>{const u=c.getRuleStack().join("-");return`uGroup_${o}_${u}`},s=o=>t.parser.alternatives(r,n.map((c,u)=>{const l={ALT:()=>!0},f=t.parser;l.ALT=()=>{if(c.ALT(o),!f.isRecording()){const h=i(r,f);f.unorderedGroups.get(h)||f.unorderedGroups.set(h,[]);const g=f.unorderedGroups.get(h);typeof(g==null?void 0:g[u])>"u"&&(g[u]=!0)}};const d=c.GATE;return d?l.GATE=()=>d(o):l.GATE=()=>{const h=f.unorderedGroups.get(i(r,f));return!(h!=null&&h[u])},l})),a=Vd(t,Xr(e),s,"*");return o=>{a(o),t.parser.isRecording()||t.parser.unorderedGroups.delete(i(r,t.parser))}}function ZI(t,e){const n=e.elements.map(r=>Bt(t,r));return r=>n.forEach(i=>i(r))}function Xr(t){if(Qs(t))return t.guardCondition}function Kd(t,e,n=e.terminal){if(n)if(Dt(n)&&be(n.rule.ref)){const r=t.subrule++;return i=>t.parser.subrule(r,qd(t,n.rule.ref),e,i)}else if(Dt(n)&&jt(n.rule.ref)){const r=t.consume++,i=Bs(t,n.rule.ref.name);return()=>t.parser.consume(r,i,e)}else if(Mt(n)){const r=t.consume++,i=Bs(t,n.value);return()=>t.parser.consume(r,i,e)}else throw new Error("Could not build cross reference parser");else{if(!e.type.ref)throw new Error("Could not resolve reference to type: "+e.type.$refText);const r=ql(e.type.ref),i=r==null?void 0:r.terminal;if(!i)throw new Error("Could not find name assignment for type: "+oi(e.type.ref));return Kd(t,e,i)}}function ex(t,e){const n=t.consume++,r=t.tokens[e.value];if(!r)throw new Error("Could not find token for keyword: "+e.value);return()=>t.parser.consume(n,r,e)}function Vd(t,e,n,r){const i=e&&at(e);if(!r)if(i){const s=t.or++;return a=>t.parser.alternatives(s,[{ALT:()=>n(a),GATE:()=>i(a)},{ALT:cc(),GATE:()=>!i(a)}])}else return n;if(r==="*"){const s=t.many++;return a=>t.parser.many(s,{DEF:()=>n(a),GATE:i?()=>i(a):void 0})}else if(r==="+"){const s=t.many++;if(i){const a=t.or++;return o=>t.parser.alternatives(a,[{ALT:()=>t.parser.atLeastOne(s,{DEF:()=>n(o)}),GATE:()=>i(o)},{ALT:cc(),GATE:()=>!i(o)}])}else return a=>t.parser.atLeastOne(s,{DEF:()=>n(a)})}else if(r==="?"){const s=t.optional++;return a=>t.parser.optional(s,{DEF:()=>n(a),GATE:i?()=>i(a):void 0})}else ni()}function qd(t,e){const n=tx(t,e),r=t.rules.get(n);if(!r)throw new Error(`Rule "${n}" not found."`);return r}function tx(t,e){if(be(e))return e.name;if(t.ruleNames.has(e))return t.ruleNames.get(e);{let n=e,r=n.$container,i=e.$type;for(;!be(r);)(Qs(r)||Sl(r)||Fl(r))&&(i=r.elements.indexOf(n).toString()+":"+i),n=r,r=r.$container;return i=r.name+":"+i,t.ruleNames.set(e,i),i}}function Bs(t,e){const n=t.tokens[e];if(!n)throw new Error(`Token "${e}" not found."`);return n}function nx(t){const e=t.Grammar,n=t.parser.Lexer,r=new WI(t);return zd(e,r,n.definition),r.finalize(),r}function rx(t){const e=ix(t);return e.finalize(),e}function ix(t){const e=t.Grammar,n=t.parser.Lexer,r=new jI(t);return zd(e,r,n.definition)}class Yd{buildTokens(e,n){const r=ne(zl(e,!1)),i=this.buildTerminalTokens(r),s=this.buildKeywordTokens(r,i,n);return i.forEach(a=>{const o=a.PATTERN;typeof o=="object"&&o&&"test"in o&&io(o)?s.unshift(a):s.push(a)}),s}buildTerminalTokens(e){return e.filter(jt).filter(n=>!n.fragment).map(n=>this.buildTerminalToken(n)).toArray()}buildTerminalToken(e){const n=na(e),r=this.requiresCustomPattern(n)?this.regexPatternFunction(n):n,i={name:e.name,PATTERN:r,LINE_BREAKS:!0};return e.hidden&&(i.GROUP=io(n)?pe.SKIPPED:"hidden"),i}requiresCustomPattern(e){return e.flags.includes("u")?!0:!!(e.source.includes("?<=")||e.source.includes("?<!"))}regexPatternFunction(e){const n=new RegExp(e,e.flags+"y");return(r,i)=>(n.lastIndex=i,n.exec(r))}buildKeywordTokens(e,n,r){return e.filter(be).flatMap(i=>ir(i).filter(Mt)).distinct(i=>i.value).toArray().sort((i,s)=>s.value.length-i.value.length).map(i=>this.buildKeywordToken(i,n,!!(r!=null&&r.caseInsensitive)))}buildKeywordToken(e,n,r){return{name:e.value,PATTERN:this.buildKeywordPattern(e,r),LONGER_ALT:this.findLongerAlt(e,n)}}buildKeywordPattern(e,n){return n?new RegExp(Ap(e.value)):e.value}findLongerAlt(e,n){return n.reduce((r,i)=>{const s=i==null?void 0:i.PATTERN;return s!=null&&s.source&&Ep("^"+s.source+"$",e.value)&&r.push(i),r},[])}}class Xd{convert(e,n){let r=n.grammarSource;if(Js(r)&&(r=_p(r)),Dt(r)){const i=r.rule.ref;if(!i)throw new Error("This cst node was not parsed by a rule.");return this.runConverter(i,e,n)}return e}runConverter(e,n,r){var i;switch(e.name.toUpperCase()){case"INT":return it.convertInt(n);case"STRING":return it.convertString(n);case"ID":return it.convertID(n)}switch((i=kp(e))===null||i===void 0?void 0:i.toLowerCase()){case"number":return it.convertNumber(n);case"boolean":return it.convertBoolean(n);case"bigint":return it.convertBigint(n);case"date":return it.convertDate(n);default:return n}}}var it;(function(t){function e(u){let l="";for(let f=1;f<u.length-1;f++){const d=u.charAt(f);if(d==="\\"){const h=u.charAt(++f);l+=n(h)}else l+=d}return l}t.convertString=e;function n(u){switch(u){case"b":return"\b";case"f":return"\f";case"n":return`
|
|
116
|
+
`;case"r":return"\r";case"t":return" ";case"v":return"\v";case"0":return"\0";default:return u}}function r(u){return u.charAt(0)==="^"?u.substring(1):u}t.convertID=r;function i(u){return parseInt(u)}t.convertInt=i;function s(u){return BigInt(u)}t.convertBigint=s;function a(u){return new Date(u)}t.convertDate=a;function o(u){return Number(u)}t.convertNumber=o;function c(u){return u.toLowerCase()==="true"}t.convertBoolean=c})(it||(it={}));var Hn={},Li={};Object.defineProperty(Li,"__esModule",{value:!0});let js;function Hs(){if(js===void 0)throw new Error("No runtime abstraction layer installed");return js}(function(t){function e(n){if(n===void 0)throw new Error("No runtime abstraction layer provided");js=n}t.install=e})(Hs||(Hs={}));Li.default=Hs;var ce={};Object.defineProperty(ce,"__esModule",{value:!0});ce.stringArray=ce.array=ce.func=ce.error=ce.number=ce.string=ce.boolean=void 0;function sx(t){return t===!0||t===!1}ce.boolean=sx;function Jd(t){return typeof t=="string"||t instanceof String}ce.string=Jd;function ax(t){return typeof t=="number"||t instanceof Number}ce.number=ax;function ox(t){return t instanceof Error}ce.error=ox;function cx(t){return typeof t=="function"}ce.func=cx;function Qd(t){return Array.isArray(t)}ce.array=Qd;function ux(t){return Qd(t)&&t.every(e=>Jd(e))}ce.stringArray=ux;var dn={};Object.defineProperty(dn,"__esModule",{value:!0});dn.Emitter=dn.Event=void 0;const lx=Li;var Du;(function(t){const e={dispose(){}};t.None=function(){return e}})(Du||(dn.Event=Du={}));class fx{add(e,n=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(n),Array.isArray(r)&&r.push({dispose:()=>this.remove(e,n)})}remove(e,n=null){if(!this._callbacks)return;let r=!1;for(let i=0,s=this._callbacks.length;i<s;i++)if(this._callbacks[i]===e)if(this._contexts[i]===n){this._callbacks.splice(i,1),this._contexts.splice(i,1);return}else r=!0;if(r)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...e){if(!this._callbacks)return[];const n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let s=0,a=r.length;s<a;s++)try{n.push(r[s].apply(i[s],e))}catch(o){(0,lx.default)().console.error(o)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}}class Mi{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,n,r)=>{this._callbacks||(this._callbacks=new fx),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,n);const i={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,n),i.dispose=Mi._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(i),i}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}dn.Emitter=Mi;Mi._noop=function(){};var ee;Object.defineProperty(Hn,"__esModule",{value:!0});var Ws=Hn.CancellationTokenSource=ee=Hn.CancellationToken=void 0;const dx=Li,hx=ce,zs=dn;var Jr;(function(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:zs.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:zs.Event.None});function e(n){const r=n;return r&&(r===t.None||r===t.Cancelled||hx.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(Jr||(ee=Hn.CancellationToken=Jr={}));const px=Object.freeze(function(t,e){const n=(0,dx.default)().timer.setTimeout(t.bind(e),0);return{dispose(){n.dispose()}}});class Fu{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?px:(this._emitter||(this._emitter=new zs.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}class gx{get token(){return this._token||(this._token=new Fu),this._token}cancel(){this._token?this._token.cancel():this._token=Jr.Cancelled}dispose(){this._token?this._token instanceof Fu&&this._token.dispose():this._token=Jr.None}}Ws=Hn.CancellationTokenSource=gx;function mx(){return new Promise(t=>{typeof setImmediate>"u"?setTimeout(t,0):setImmediate(t)})}let Gu=0,yx=10;const Qr=Symbol("OperationCancelled");function Ha(t){return t===Qr}async function Be(t){if(t===ee.None)return;const e=Date.now();if(e-Gu>=yx&&(Gu=e,await mx()),t.isCancellationRequested)throw Qr}class Wa{constructor(){this.promise=new Promise((e,n)=>{this.resolve=r=>(e(r),this),this.reject=r=>(n(r),this)})}}class Wn{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){const n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(const r of e)if(Wn.isIncremental(r)){const i=eh(r.range),s=this.offsetAt(i.start),a=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(a,this._content.length);const o=Math.max(i.start.line,0),c=Math.max(i.end.line,0);let u=this._lineOffsets;const l=Uu(r.text,!1,s);if(c-o===l.length)for(let d=0,h=l.length;d<h;d++)u[d+o+1]=l[d];else l.length<1e4?u.splice(o+1,c-o,...l):this._lineOffsets=u=u.slice(0,o+1).concat(l,u.slice(c+1));const f=r.text.length-(a-s);if(f!==0)for(let d=o+1+l.length,h=u.length;d<h;d++)u[d]=u[d]+f}else if(Wn.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=Uu(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);const n=this.getLineOffsets();let r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){const a=Math.floor((r+i)/2);n[a]>e?i=a:r=a+1}const s=r-1;return e=this.ensureBeforeEOL(e,n[s]),{line:s,character:e-n[s]}}offsetAt(e){const n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;const r=n[e.line];if(e.character<=0)return r;const i=e.line+1<n.length?n[e.line+1]:this._content.length,s=Math.min(r+e.character,i);return this.ensureBeforeEOL(s,r)}ensureBeforeEOL(e,n){for(;e>n&&Zd(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){const n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}}var Ks;(function(t){function e(i,s,a,o){return new Wn(i,s,a,o)}t.create=e;function n(i,s,a){if(i instanceof Wn)return i.update(s,a),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,s){const a=i.getText(),o=Vs(s.map(Tx),(l,f)=>{const d=l.range.start.line-f.range.start.line;return d===0?l.range.start.character-f.range.start.character:d});let c=0;const u=[];for(const l of o){const f=i.offsetAt(l.range.start);if(f<c)throw new Error("Overlapping edit");f>c&&u.push(a.substring(c,f)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(a.substr(c)),u.join("")}t.applyEdits=r})(Ks||(Ks={}));function Vs(t,e){if(t.length<=1)return t;const n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);Vs(r,e),Vs(i,e);let s=0,a=0,o=0;for(;s<r.length&&a<i.length;)e(r[s],i[a])<=0?t[o++]=r[s++]:t[o++]=i[a++];for(;s<r.length;)t[o++]=r[s++];for(;a<i.length;)t[o++]=i[a++];return t}function Uu(t,e,n=0){const r=e?[n]:[];for(let i=0;i<t.length;i++){const s=t.charCodeAt(i);Zd(s)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function Zd(t){return t===13||t===10}function eh(t){const e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function Tx(t){const e=eh(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var th;(()=>{var t={470:i=>{function s(c){if(typeof c!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(c))}function a(c,u){for(var l,f="",d=0,h=-1,g=0,m=0;m<=c.length;++m){if(m<c.length)l=c.charCodeAt(m);else{if(l===47)break;l=47}if(l===47){if(!(h===m-1||g===1))if(h!==m-1&&g===2){if(f.length<2||d!==2||f.charCodeAt(f.length-1)!==46||f.charCodeAt(f.length-2)!==46){if(f.length>2){var T=f.lastIndexOf("/");if(T!==f.length-1){T===-1?(f="",d=0):d=(f=f.slice(0,T)).length-1-f.lastIndexOf("/"),h=m,g=0;continue}}else if(f.length===2||f.length===1){f="",d=0,h=m,g=0;continue}}u&&(f.length>0?f+="/..":f="..",d=2)}else f.length>0?f+="/"+c.slice(h+1,m):f=c.slice(h+1,m),d=m-h-1;h=m,g=0}else l===46&&g!==-1?++g:g=-1}return f}var o={resolve:function(){for(var c,u="",l=!1,f=arguments.length-1;f>=-1&&!l;f--){var d;f>=0?d=arguments[f]:(c===void 0&&(c=process.cwd()),d=c),s(d),d.length!==0&&(u=d+"/"+u,l=d.charCodeAt(0)===47)}return u=a(u,!l),l?u.length>0?"/"+u:"/":u.length>0?u:"."},normalize:function(c){if(s(c),c.length===0)return".";var u=c.charCodeAt(0)===47,l=c.charCodeAt(c.length-1)===47;return(c=a(c,!u)).length!==0||u||(c="."),c.length>0&&l&&(c+="/"),u?"/"+c:c},isAbsolute:function(c){return s(c),c.length>0&&c.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var c,u=0;u<arguments.length;++u){var l=arguments[u];s(l),l.length>0&&(c===void 0?c=l:c+="/"+l)}return c===void 0?".":o.normalize(c)},relative:function(c,u){if(s(c),s(u),c===u||(c=o.resolve(c))===(u=o.resolve(u)))return"";for(var l=1;l<c.length&&c.charCodeAt(l)===47;++l);for(var f=c.length,d=f-l,h=1;h<u.length&&u.charCodeAt(h)===47;++h);for(var g=u.length-h,m=d<g?d:g,T=-1,y=0;y<=m;++y){if(y===m){if(g>m){if(u.charCodeAt(h+y)===47)return u.slice(h+y+1);if(y===0)return u.slice(h+y)}else d>m&&(c.charCodeAt(l+y)===47?T=y:y===0&&(T=0));break}var E=c.charCodeAt(l+y);if(E!==u.charCodeAt(h+y))break;E===47&&(T=y)}var v="";for(y=l+T+1;y<=f;++y)y!==f&&c.charCodeAt(y)!==47||(v.length===0?v+="..":v+="/..");return v.length>0?v+u.slice(h+T):(h+=T,u.charCodeAt(h)===47&&++h,u.slice(h))},_makeLong:function(c){return c},dirname:function(c){if(s(c),c.length===0)return".";for(var u=c.charCodeAt(0),l=u===47,f=-1,d=!0,h=c.length-1;h>=1;--h)if((u=c.charCodeAt(h))===47){if(!d){f=h;break}}else d=!1;return f===-1?l?"/":".":l&&f===1?"//":c.slice(0,f)},basename:function(c,u){if(u!==void 0&&typeof u!="string")throw new TypeError('"ext" argument must be a string');s(c);var l,f=0,d=-1,h=!0;if(u!==void 0&&u.length>0&&u.length<=c.length){if(u.length===c.length&&u===c)return"";var g=u.length-1,m=-1;for(l=c.length-1;l>=0;--l){var T=c.charCodeAt(l);if(T===47){if(!h){f=l+1;break}}else m===-1&&(h=!1,m=l+1),g>=0&&(T===u.charCodeAt(g)?--g==-1&&(d=l):(g=-1,d=m))}return f===d?d=m:d===-1&&(d=c.length),c.slice(f,d)}for(l=c.length-1;l>=0;--l)if(c.charCodeAt(l)===47){if(!h){f=l+1;break}}else d===-1&&(h=!1,d=l+1);return d===-1?"":c.slice(f,d)},extname:function(c){s(c);for(var u=-1,l=0,f=-1,d=!0,h=0,g=c.length-1;g>=0;--g){var m=c.charCodeAt(g);if(m!==47)f===-1&&(d=!1,f=g+1),m===46?u===-1?u=g:h!==1&&(h=1):u!==-1&&(h=-1);else if(!d){l=g+1;break}}return u===-1||f===-1||h===0||h===1&&u===f-1&&u===l+1?"":c.slice(u,f)},format:function(c){if(c===null||typeof c!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof c);return function(u,l){var f=l.dir||l.root,d=l.base||(l.name||"")+(l.ext||"");return f?f===l.root?f+d:f+"/"+d:d}(0,c)},parse:function(c){s(c);var u={root:"",dir:"",base:"",ext:"",name:""};if(c.length===0)return u;var l,f=c.charCodeAt(0),d=f===47;d?(u.root="/",l=1):l=0;for(var h=-1,g=0,m=-1,T=!0,y=c.length-1,E=0;y>=l;--y)if((f=c.charCodeAt(y))!==47)m===-1&&(T=!1,m=y+1),f===46?h===-1?h=y:E!==1&&(E=1):h!==-1&&(E=-1);else if(!T){g=y+1;break}return h===-1||m===-1||E===0||E===1&&h===m-1&&h===g+1?m!==-1&&(u.base=u.name=g===0&&d?c.slice(1,m):c.slice(g,m)):(g===0&&d?(u.name=c.slice(1,h),u.base=c.slice(1,m)):(u.name=c.slice(g,h),u.base=c.slice(g,m)),u.ext=c.slice(h,m)),g>0?u.dir=c.slice(0,g-1):d&&(u.dir="/"),u},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,i.exports=o}},e={};function n(i){var s=e[i];if(s!==void 0)return s.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}n.d=(i,s)=>{for(var a in s)n.o(s,a)&&!n.o(i,a)&&Object.defineProperty(i,a,{enumerable:!0,get:s[a]})},n.o=(i,s)=>Object.prototype.hasOwnProperty.call(i,s),n.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var r={};(()=>{let i;n.r(r),n.d(r,{URI:()=>d,Utils:()=>Ie}),typeof process=="object"?i=process.platform==="win32":typeof navigator=="object"&&(i=navigator.userAgent.indexOf("Windows")>=0);const s=/^\w[\w\d+.-]*$/,a=/^\//,o=/^\/\//;function c($,A){if(!$.scheme&&A)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${$.authority}", path: "${$.path}", query: "${$.query}", fragment: "${$.fragment}"}`);if($.scheme&&!s.test($.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if($.path){if($.authority){if(!a.test($.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(o.test($.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}const u="",l="/",f=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{constructor(A,R,_,P,k,b=!1){At(this,"scheme");At(this,"authority");At(this,"path");At(this,"query");At(this,"fragment");typeof A=="object"?(this.scheme=A.scheme||u,this.authority=A.authority||u,this.path=A.path||u,this.query=A.query||u,this.fragment=A.fragment||u):(this.scheme=function(Ae,Q){return Ae||Q?Ae:"file"}(A,b),this.authority=R||u,this.path=function(Ae,Q){switch(Ae){case"https":case"http":case"file":Q?Q[0]!==l&&(Q=l+Q):Q=l}return Q}(this.scheme,_||u),this.query=P||u,this.fragment=k||u,c(this,b))}static isUri(A){return A instanceof d||!!A&&typeof A.authority=="string"&&typeof A.fragment=="string"&&typeof A.path=="string"&&typeof A.query=="string"&&typeof A.scheme=="string"&&typeof A.fsPath=="string"&&typeof A.with=="function"&&typeof A.toString=="function"}get fsPath(){return E(this)}with(A){if(!A)return this;let{scheme:R,authority:_,path:P,query:k,fragment:b}=A;return R===void 0?R=this.scheme:R===null&&(R=u),_===void 0?_=this.authority:_===null&&(_=u),P===void 0?P=this.path:P===null&&(P=u),k===void 0?k=this.query:k===null&&(k=u),b===void 0?b=this.fragment:b===null&&(b=u),R===this.scheme&&_===this.authority&&P===this.path&&k===this.query&&b===this.fragment?this:new g(R,_,P,k,b)}static parse(A,R=!1){const _=f.exec(A);return _?new g(_[2]||u,se(_[4]||u),se(_[5]||u),se(_[7]||u),se(_[9]||u),R):new g(u,u,u,u,u)}static file(A){let R=u;if(i&&(A=A.replace(/\\/g,l)),A[0]===l&&A[1]===l){const _=A.indexOf(l,2);_===-1?(R=A.substring(2),A=l):(R=A.substring(2,_),A=A.substring(_)||l)}return new g("file",R,A,u,u)}static from(A){const R=new g(A.scheme,A.authority,A.path,A.query,A.fragment);return c(R,!0),R}toString(A=!1){return v(this,A)}toJSON(){return this}static revive(A){if(A){if(A instanceof d)return A;{const R=new g(A);return R._formatted=A.external,R._fsPath=A._sep===h?A.fsPath:null,R}}return A}}const h=i?1:void 0;class g extends d{constructor(){super(...arguments);At(this,"_formatted",null);At(this,"_fsPath",null)}get fsPath(){return this._fsPath||(this._fsPath=E(this)),this._fsPath}toString(R=!1){return R?v(this,!0):(this._formatted||(this._formatted=v(this,!1)),this._formatted)}toJSON(){const R={$mid:1};return this._fsPath&&(R.fsPath=this._fsPath,R._sep=h),this._formatted&&(R.external=this._formatted),this.path&&(R.path=this.path),this.scheme&&(R.scheme=this.scheme),this.authority&&(R.authority=this.authority),this.query&&(R.query=this.query),this.fragment&&(R.fragment=this.fragment),R}}const m={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 T($,A,R){let _,P=-1;for(let k=0;k<$.length;k++){const b=$.charCodeAt(k);if(b>=97&&b<=122||b>=65&&b<=90||b>=48&&b<=57||b===45||b===46||b===95||b===126||A&&b===47||R&&b===91||R&&b===93||R&&b===58)P!==-1&&(_+=encodeURIComponent($.substring(P,k)),P=-1),_!==void 0&&(_+=$.charAt(k));else{_===void 0&&(_=$.substr(0,k));const Ae=m[b];Ae!==void 0?(P!==-1&&(_+=encodeURIComponent($.substring(P,k)),P=-1),_+=Ae):P===-1&&(P=k)}}return P!==-1&&(_+=encodeURIComponent($.substring(P))),_!==void 0?_:$}function y($){let A;for(let R=0;R<$.length;R++){const _=$.charCodeAt(R);_===35||_===63?(A===void 0&&(A=$.substr(0,R)),A+=m[_]):A!==void 0&&(A+=$[R])}return A!==void 0?A:$}function E($,A){let R;return R=$.authority&&$.path.length>1&&$.scheme==="file"?`//${$.authority}${$.path}`:$.path.charCodeAt(0)===47&&($.path.charCodeAt(1)>=65&&$.path.charCodeAt(1)<=90||$.path.charCodeAt(1)>=97&&$.path.charCodeAt(1)<=122)&&$.path.charCodeAt(2)===58?$.path[1].toLowerCase()+$.path.substr(2):$.path,i&&(R=R.replace(/\//g,"\\")),R}function v($,A){const R=A?y:T;let _="",{scheme:P,authority:k,path:b,query:Ae,fragment:Q}=$;if(P&&(_+=P,_+=":"),(k||P==="file")&&(_+=l,_+=l),k){let K=k.indexOf("@");if(K!==-1){const bt=k.substr(0,K);k=k.substr(K+1),K=bt.lastIndexOf(":"),K===-1?_+=R(bt,!1,!1):(_+=R(bt.substr(0,K),!1,!1),_+=":",_+=R(bt.substr(K+1),!1,!0)),_+="@"}k=k.toLowerCase(),K=k.lastIndexOf(":"),K===-1?_+=R(k,!1,!0):(_+=R(k.substr(0,K),!1,!0),_+=k.substr(K))}if(b){if(b.length>=3&&b.charCodeAt(0)===47&&b.charCodeAt(2)===58){const K=b.charCodeAt(1);K>=65&&K<=90&&(b=`/${String.fromCharCode(K+32)}:${b.substr(3)}`)}else if(b.length>=2&&b.charCodeAt(1)===58){const K=b.charCodeAt(0);K>=65&&K<=90&&(b=`${String.fromCharCode(K+32)}:${b.substr(2)}`)}_+=R(b,!0,!1)}return Ae&&(_+="?",_+=R(Ae,!1,!1)),Q&&(_+="#",_+=A?Q:T(Q,!1,!1)),_}function S($){try{return decodeURIComponent($)}catch{return $.length>3?$.substr(0,3)+S($.substr(3)):$}}const O=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function se($){return $.match(O)?$.replace(O,A=>S(A)):$}var De=n(470);const ve=De.posix||De,Ke="/";var Ie;(function($){$.joinPath=function(A,...R){return A.with({path:ve.join(A.path,...R)})},$.resolvePath=function(A,...R){let _=A.path,P=!1;_[0]!==Ke&&(_=Ke+_,P=!0);let k=ve.resolve(_,...R);return P&&k[0]===Ke&&!A.authority&&(k=k.substring(1)),A.with({path:k})},$.dirname=function(A){if(A.path.length===0||A.path===Ke)return A;let R=ve.dirname(A.path);return R.length===1&&R.charCodeAt(0)===46&&(R=""),A.with({path:R})},$.basename=function(A){return ve.basename(A.path)},$.extname=function(A){return ve.extname(A.path)}})(Ie||(Ie={}))})(),th=r})();const{URI:hn,Utils:wn}=th;var xt;(function(t){t.basename=wn.basename,t.dirname=wn.dirname,t.extname=wn.extname,t.joinPath=wn.joinPath,t.resolvePath=wn.resolvePath;function e(r,i){return(r==null?void 0:r.toString())===(i==null?void 0:i.toString())}t.equals=e;function n(r,i){const s=typeof r=="string"?r:r.path,a=typeof i=="string"?i:i.path,o=s.split("/").filter(d=>d.length>0),c=a.split("/").filter(d=>d.length>0);let u=0;for(;u<o.length&&o[u]===c[u];u++);const l="../".repeat(o.length-u),f=c.slice(u).join("/");return l+f}t.relative=n})(xt||(xt={}));var W;(function(t){t[t.Changed=0]="Changed",t[t.Parsed=1]="Parsed",t[t.IndexedContent=2]="IndexedContent",t[t.ComputedScopes=3]="ComputedScopes",t[t.Linked=4]="Linked",t[t.IndexedReferences=5]="IndexedReferences",t[t.Validated=6]="Validated"})(W||(W={}));class vx{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,n=ee.None){const r=await this.fileSystemProvider.readFile(e);return this.createAsync(e,r,n)}fromTextDocument(e,n,r){return n=n??hn.parse(e.uri),r?this.createAsync(n,e,r):this.create(n,e)}fromString(e,n,r){return r?this.createAsync(n,e,r):this.create(n,e)}fromModel(e,n){return this.create(n,{$model:e})}create(e,n){if(typeof n=="string"){const r=this.parse(e,n);return this.createLangiumDocument(r,e,void 0,n)}else if("$model"in n){const r={value:n.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(r,e)}else{const r=this.parse(e,n.getText());return this.createLangiumDocument(r,e,n)}}async createAsync(e,n,r){if(typeof n=="string"){const i=await this.parseAsync(e,n,r);return this.createLangiumDocument(i,e,void 0,n)}else{const i=await this.parseAsync(e,n.getText(),r);return this.createLangiumDocument(i,e,n)}}createLangiumDocument(e,n,r,i){let s;if(r)s={parseResult:e,uri:n,state:W.Parsed,references:[],textDocument:r};else{const a=this.createTextDocumentGetter(n,i);s={parseResult:e,uri:n,state:W.Parsed,references:[],get textDocument(){return a()}}}return e.value.$document=s,s}async update(e,n){var r,i;const s=(r=e.parseResult.value.$cstNode)===null||r===void 0?void 0:r.root.fullText,a=(i=this.textDocuments)===null||i===void 0?void 0:i.get(e.uri.toString()),o=a?a.getText():await this.fileSystemProvider.readFile(e.uri);if(a)Object.defineProperty(e,"textDocument",{value:a});else{const c=this.createTextDocumentGetter(e.uri,o);Object.defineProperty(e,"textDocument",{get:c})}return s!==o&&(e.parseResult=await this.parseAsync(e.uri,o,n),e.parseResult.value.$document=e),e.state=W.Parsed,e}parse(e,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(n)}parseAsync(e,n,r){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(n,r)}createTextDocumentGetter(e,n){const r=this.serviceRegistry;let i;return()=>i??(i=Ks.create(e.toString(),r.getServices(e).LanguageMetaData.languageId,0,n??""))}}class Ax{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory}get all(){return ne(this.documentMap.values())}addDocument(e){const n=e.uri.toString();if(this.documentMap.has(n))throw new Error(`A document with the URI '${n}' is already present.`);this.documentMap.set(n,e)}getDocument(e){const n=e.toString();return this.documentMap.get(n)}async getOrCreateDocument(e,n){let r=this.getDocument(e);return r||(r=await this.langiumDocumentFactory.fromUri(e,n),this.addDocument(r),r)}createDocument(e,n,r){if(r)return this.langiumDocumentFactory.fromString(n,e,r).then(i=>(this.addDocument(i),i));{const i=this.langiumDocumentFactory.fromString(n,e);return this.addDocument(i),i}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=W.Changed,r.precomputedScopes=void 0,r.references=[],r.diagnostics=void 0),r}deleteDocument(e){const n=e.toString(),r=this.documentMap.get(n);return r&&(r.state=W.Changed,this.documentMap.delete(n)),r}}class Ex{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,n=ee.None){for(const r of Jt(e.parseResult.value))await Be(n),jl(r).forEach(i=>this.doLink(i,e))}doLink(e,n){const r=e.reference;if(r._ref===void 0)try{const i=this.getCandidate(e);if(Rr(i))r._ref=i;else if(r._nodeDescription=i,this.langiumDocuments().hasDocument(i.documentUri)){const s=this.loadAstNode(i);r._ref=s??this.createLinkingError(e,i)}}catch(i){r._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${r.$refText}': ${i}`})}n.references.push(r)}unlink(e){for(const n of e.references)delete n._ref,delete n._nodeDescription;e.references=[]}getCandidate(e){const r=this.scopeProvider.getScope(e).getElement(e.reference.$refText);return r??this.createLinkingError(e)}buildReference(e,n,r,i){const s=this,a={$refNode:r,$refText:i,get ref(){var o;if(ue(this._ref))return this._ref;if(Ch(this._nodeDescription)){const c=s.loadAstNode(this._nodeDescription);this._ref=c??s.createLinkingError({reference:a,container:e,property:n},this._nodeDescription)}else if(this._ref===void 0){const c=s.getLinkedNode({reference:a,container:e,property:n});if(c.error&&Xe(e).state<W.ComputedScopes)return;this._ref=(o=c.node)!==null&&o!==void 0?o:c.error,this._nodeDescription=c.descr}return ue(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Rr(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){try{const n=this.getCandidate(e);if(Rr(n))return{error:n};const r=this.loadAstNode(n);return r?{node:r,descr:n}:{descr:n,error:this.createLinkingError(e,n)}}catch(n){return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${n}`})}}}loadAstNode(e){if(e.node)return e.node;const n=this.langiumDocuments().getDocument(e.documentUri);if(n)return this.astNodeLocator.getAstNode(n.parseResult.value,e.path)}createLinkingError(e,n){const r=Xe(e.container);r.state<W.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${r.uri}).`);const i=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${i} named '${e.reference.$refText}'.`,targetDescription:n})}}function Rx(t){return typeof t.name=="string"}class $x{getName(e){if(Rx(e))return e.name}getNameNode(e){return Vl(e.$cstNode,"name")}}class Sx{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){const n=Np(e),r=e.astNode;if(n&&r){const i=r[n.feature];if(qe(i))return i.ref;if(Array.isArray(i)){for(const s of i)if(qe(s)&&s.$refNode&&s.$refNode.offset<=e.offset&&s.$refNode.end>=e.end)return s.ref}}if(r){const i=this.nameProvider.getNameNode(r);if(i&&(i===e||bh(e,i)))return r}}}findDeclarationNode(e){const n=this.findDeclaration(e);if(n!=null&&n.$cstNode){const r=this.nameProvider.getNameNode(n);return r??n.$cstNode}}findReferences(e,n){const r=[];if(n.includeDeclaration){const s=this.getReferenceToSelf(e);s&&r.push(s)}let i=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return n.documentUri&&(i=i.filter(s=>xt.equals(s.sourceUri,n.documentUri))),r.push(...i),ne(r)}getReferenceToSelf(e){const n=this.nameProvider.getNameNode(e);if(n){const r=Xe(e),i=this.nodeLocator.getAstNodePath(e);return{sourceUri:r.uri,sourcePath:i,targetUri:r.uri,targetPath:i,segment:Nr(n),local:!0}}}}class za{constructor(e){if(this.map=new Map,e)for(const[n,r]of e)this.add(n,r)}get size(){return ss.sum(ne(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,n){if(n===void 0)return this.map.delete(e);{const r=this.map.get(e);if(r){const i=r.indexOf(n);if(i>=0)return r.length===1?this.map.delete(e):r.splice(i,1),!0}return!1}}get(e){var n;return(n=this.map.get(e))!==null&&n!==void 0?n:[]}has(e,n){if(n===void 0)return this.map.has(e);{const r=this.map.get(e);return r?r.indexOf(n)>=0:!1}}add(e,n){return this.map.has(e)?this.map.get(e).push(n):this.map.set(e,[n]),this}addAll(e,n){return this.map.has(e)?this.map.get(e).push(...n):this.map.set(e,Array.from(n)),this}forEach(e){this.map.forEach((n,r)=>n.forEach(i=>e(i,r,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return ne(this.map.entries()).flatMap(([e,n])=>n.map(r=>[e,r]))}keys(){return ne(this.map.keys())}values(){return ne(this.map.values()).flat()}entriesGroupedByKey(){return ne(this.map.entries())}}class Bu{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(const[n,r]of e)this.set(n,r)}clear(){this.map.clear(),this.inverse.clear()}set(e,n){return this.map.set(e,n),this.inverse.set(n,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){const n=this.map.get(e);return n!==void 0?(this.map.delete(e),this.inverse.delete(n),!0):!1}}class _x{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,n=ee.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,n)}async computeExportsForNode(e,n,r=Zs,i=ee.None){const s=[];this.exportNode(e,s,n);for(const a of r(e))await Be(i),this.exportNode(a,s,n);return s}exportNode(e,n,r){const i=this.nameProvider.getName(e);i&&n.push(this.descriptions.createDescription(e,i,r))}async computeLocalScopes(e,n=ee.None){const r=e.parseResult.value,i=new za;for(const s of ir(r))await Be(n),this.processNode(s,e,i);return i}processNode(e,n,r){const i=e.$container;if(i){const s=this.nameProvider.getName(e);s&&r.add(i,this.descriptions.createDescription(e,s,n))}}}class ju{constructor(e,n,r){var i;this.elements=e,this.outerScope=n,this.caseInsensitive=(i=r==null?void 0:r.caseInsensitive)!==null&&i!==void 0?i:!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){const n=this.caseInsensitive?this.elements.find(r=>r.name.toLowerCase()===e.toLowerCase()):this.elements.find(r=>r.name===e);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}}class Ix{constructor(e,n,r){var i;this.elements=new Map,this.caseInsensitive=(i=r==null?void 0:r.caseInsensitive)!==null&&i!==void 0?i:!1;for(const s of e){const a=this.caseInsensitive?s.name.toLowerCase():s.name;this.elements.set(a,s)}this.outerScope=n}getElement(e){const n=this.caseInsensitive?e.toLowerCase():e,r=this.elements.get(n);if(r)return r;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=ne(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}}class nh{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw new Error("This cache has already been disposed")}}class xx extends nh{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,n){this.throwIfDisposed(),this.cache.set(e,n)}get(e,n){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(n){const r=n();return this.cache.set(e,r),r}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}}class Cx extends nh{constructor(e){super(),this.cache=new Map,this.converter=e??(n=>n)}has(e,n){return this.throwIfDisposed(),this.cacheForContext(e).has(n)}set(e,n,r){this.throwIfDisposed(),this.cacheForContext(e).set(n,r)}get(e,n,r){this.throwIfDisposed();const i=this.cacheForContext(e);if(i.has(n))return i.get(n);if(r){const s=r();return i.set(n,s),s}else return}delete(e,n){return this.throwIfDisposed(),this.cacheForContext(e).delete(n)}clear(e){if(this.throwIfDisposed(),e){const n=this.converter(e);this.cache.delete(n)}else this.cache.clear()}cacheForContext(e){const n=this.converter(e);let r=this.cache.get(n);return r||(r=new Map,this.cache.set(n,r)),r}}class wx extends xx{constructor(e){super(),this.onDispose(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}}class Nx{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new wx(e.shared)}getScope(e){const n=[],r=this.reflection.getReferenceType(e),i=Xe(e.container).precomputedScopes;if(i){let a=e.container;do{const o=i.get(a);o.length>0&&n.push(ne(o).filter(c=>this.reflection.isSubtype(c.type,r))),a=a.$container}while(a)}let s=this.getGlobalScope(r,e);for(let a=n.length-1;a>=0;a--)s=this.createScope(n[a],s);return s}createScope(e,n,r){return new ju(ne(e),n,r)}createScopeForNodes(e,n,r){const i=ne(e).map(s=>{const a=this.nameProvider.getName(s);if(a)return this.descriptions.createDescription(s,a)}).nonNullable();return new ju(i,n,r)}getGlobalScope(e,n){return this.globalScopeCache.get(e,()=>new Ix(this.indexManager.allElements(e)))}}function bx(t){return typeof t.$comment=="string"}function Hu(t){return typeof t=="object"&&!!t&&("$ref"in t||"$error"in t)}class kx{constructor(e){this.ignoreProperties=new Set(["$container","$containerProperty","$containerIndex","$document","$cstNode"]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,n={}){const r=n==null?void 0:n.replacer,i=(a,o)=>this.replacer(a,o,n),s=r?(a,o)=>r(a,o,i):i;try{return this.currentDocument=Xe(e),JSON.stringify(e,s,n==null?void 0:n.space)}finally{this.currentDocument=void 0}}deserialize(e,n={}){const r=JSON.parse(e);return this.linkNode(r,r,n),r}replacer(e,n,{refText:r,sourceText:i,textRegions:s,comments:a,uriConverter:o}){var c,u,l,f;if(!this.ignoreProperties.has(e))if(qe(n)){const d=n.ref,h=r?n.$refText:void 0;if(d){const g=Xe(d);let m="";this.currentDocument&&this.currentDocument!==g&&(o?m=o(g.uri,n):m=g.uri.toString());const T=this.astNodeLocator.getAstNodePath(d);return{$ref:`${m}#${T}`,$refText:h}}else return{$error:(u=(c=n.error)===null||c===void 0?void 0:c.message)!==null&&u!==void 0?u:"Could not resolve reference",$refText:h}}else if(ue(n)){let d;if(s&&(d=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},n)),(!e||n.$document)&&(d!=null&&d.$textRegion)&&(d.$textRegion.documentURI=(l=this.currentDocument)===null||l===void 0?void 0:l.uri.toString())),i&&!e&&(d??(d=Object.assign({},n)),d.$sourceText=(f=n.$cstNode)===null||f===void 0?void 0:f.text),a){d??(d=Object.assign({},n));const h=this.commentProvider.getComment(n);h&&(d.$comment=h.replace(/\r/g,""))}return d??n}else return n}addAstNodeRegionWithAssignmentsTo(e){const n=r=>({offset:r.offset,end:r.end,length:r.length,range:r.range});if(e.$cstNode){const r=e.$textRegion=n(e.$cstNode),i=r.assignments={};return Object.keys(e).filter(s=>!s.startsWith("$")).forEach(s=>{const a=xp(e.$cstNode,s).map(n);a.length!==0&&(i[s]=a)}),e}}linkNode(e,n,r,i,s,a){for(const[c,u]of Object.entries(e))if(Array.isArray(u))for(let l=0;l<u.length;l++){const f=u[l];Hu(f)?u[l]=this.reviveReference(e,c,n,f,r):ue(f)&&this.linkNode(f,n,r,e,c,l)}else Hu(u)?e[c]=this.reviveReference(e,c,n,u,r):ue(u)&&this.linkNode(u,n,r,e,c);const o=e;o.$container=i,o.$containerProperty=s,o.$containerIndex=a}reviveReference(e,n,r,i,s){let a=i.$refText,o=i.$error;if(i.$ref){const c=this.getRefNode(r,i.$ref,s.uriConverter);if(ue(c))return a||(a=this.nameProvider.getName(c)),{$refText:a??"",ref:c};o=c}if(o){const c={$refText:a??""};return c.error={container:e,property:n,message:o,reference:c},c}else return}getRefNode(e,n,r){try{const i=n.indexOf("#");if(i===0){const c=this.astNodeLocator.getAstNode(e,n.substring(1));return c||"Could not resolve path: "+n}if(i<0){const c=r?r(n):hn.parse(n),u=this.langiumDocuments.getDocument(c);return u?u.parseResult.value:"Could not find document for URI: "+n}const s=r?r(n.substring(0,i)):hn.parse(n.substring(0,i)),a=this.langiumDocuments.getDocument(s);if(!a)return"Could not find document for URI: "+n;if(i===n.length-1)return a.parseResult.value;const o=this.astNodeLocator.getAstNode(a.parseResult.value,n.substring(i+1));return o||"Could not resolve URI: "+n}catch(i){return String(i)}}}class Ox{register(e){if(!this.singleton&&!this.map){this.singleton=e;return}if(!this.map&&(this.map={},this.singleton)){for(const n of this.singleton.LanguageMetaData.fileExtensions)this.map[n]=this.singleton;this.singleton=void 0}for(const n of e.LanguageMetaData.fileExtensions)this.map[n]!==void 0&&this.map[n]!==e&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${e.LanguageMetaData.languageId}'.`),this.map[n]=e}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.map===void 0)throw new Error("The service registry is empty. Use `register` to register the services of a language.");const n=xt.extname(e),r=this.map[n];if(!r)throw new Error(`The service registry contains no services for the extension '${n}'.`);return r}get all(){return this.singleton!==void 0?[this.singleton]:this.map!==void 0?Object.values(this.map):[]}}function Wu(t){return{code:t}}var Zr;(function(t){t.all=["fast","slow","built-in"]})(Zr||(Zr={}));class Px{constructor(e){this.entries=new za,this.reflection=e.shared.AstReflection}register(e,n=this,r="fast"){if(r==="built-in")throw new Error("The 'built-in' category is reserved for lexer, parser, and linker errors.");for(const[i,s]of Object.entries(e)){const a=s;if(Array.isArray(a))for(const o of a){const c={check:this.wrapValidationException(o,n),category:r};this.addEntry(i,c)}else if(typeof a=="function"){const o={check:this.wrapValidationException(a,n),category:r};this.addEntry(i,o)}}}wrapValidationException(e,n){return async(r,i,s)=>{try{await e.call(n,r,i,s)}catch(a){if(Ha(a))throw a;console.error("An error occurred during validation:",a);const o=a instanceof Error?a.message:String(a);a instanceof Error&&a.stack&&console.error(a.stack),i("error","An error occurred during validation: "+o,{node:r})}}}addEntry(e,n){if(e==="AstNode"){this.entries.add("AstNode",n);return}for(const r of this.reflection.getAllSubTypes(e))this.entries.add(r,n)}getChecks(e,n){let r=ne(this.entries.get(e)).concat(this.entries.get("AstNode"));return n&&(r=r.filter(i=>n.includes(i.category))),r.map(i=>i.check)}}class Lx{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,n={},r=ee.None){const i=e.parseResult,s=[];if(await Be(r),(!n.categories||n.categories.includes("built-in"))&&(this.processLexingErrors(i,s,n),n.stopAfterLexingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===Et.LexingError})||(this.processParsingErrors(i,s,n),n.stopAfterParsingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===Et.ParsingError}))||(this.processLinkingErrors(e,s,n),n.stopAfterLinkingErrors&&s.some(a=>{var o;return((o=a.data)===null||o===void 0?void 0:o.code)===Et.LinkingError}))))return s;try{s.push(...await this.validateAst(i.value,n,r))}catch(a){if(Ha(a))throw a;console.error("An error occurred during validation:",a)}return await Be(r),s}processLexingErrors(e,n,r){for(const i of e.lexerErrors){const s={severity:ns("error"),range:{start:{line:i.line-1,character:i.column-1},end:{line:i.line-1,character:i.column+i.length-1}},message:i.message,data:Wu(Et.LexingError),source:this.getSource()};n.push(s)}}processParsingErrors(e,n,r){for(const i of e.parserErrors){let s;if(isNaN(i.token.startOffset)){if("previousToken"in i){const a=i.previousToken;if(isNaN(a.startOffset)){const o={line:0,character:0};s={start:o,end:o}}else{const o={line:a.endLine-1,character:a.endColumn};s={start:o,end:o}}}}else s=os(i.token);if(s){const a={severity:ns("error"),range:s,message:i.message,data:Wu(Et.ParsingError),source:this.getSource()};n.push(a)}}}processLinkingErrors(e,n,r){for(const i of e.references){const s=i.error;if(s){const a={node:s.container,property:s.property,index:s.index,data:{code:Et.LinkingError,containerType:s.container.$type,property:s.property,refText:s.reference.$refText}};n.push(this.toDiagnostic("error",s.message,a))}}}async validateAst(e,n,r=ee.None){const i=[],s=(a,o,c)=>{i.push(this.toDiagnostic(a,o,c))};return await Promise.all(Jt(e).map(async a=>{await Be(r);const o=this.validationRegistry.getChecks(a.$type,n.categories);for(const c of o)await c(a,s,r)})),i}toDiagnostic(e,n,r){return{message:n,range:Mx(r),severity:ns(e),code:r.code,codeDescription:r.codeDescription,tags:r.tags,relatedInformation:r.relatedInformation,data:r.data,source:this.getSource()}}getSource(){return this.metadata.languageId}}function Mx(t){if(t.range)return t.range;let e;return typeof t.property=="string"?e=Vl(t.node.$cstNode,t.property,t.index):typeof t.keyword=="string"&&(e=Cp(t.node.$cstNode,t.keyword,t.index)),e??(e=t.node.$cstNode),e?e.range:{start:{line:0,character:0},end:{line:0,character:0}}}function ns(t){switch(t){case"error":return 1;case"warning":return 2;case"info":return 3;case"hint":return 4;default:throw new Error("Invalid diagnostic severity: "+t)}}var Et;(function(t){t.LexingError="lexing-error",t.ParsingError="parsing-error",t.LinkingError="linking-error"})(Et||(Et={}));class Dx{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,n,r=Xe(e)){n??(n=this.nameProvider.getName(e));const i=this.astNodeLocator.getAstNodePath(e);if(!n)throw new Error(`Node at path ${i} has no name.`);let s;const a=()=>{var o;return s??(s=Nr((o=this.nameProvider.getNameNode(e))!==null&&o!==void 0?o:e.$cstNode))};return{node:e,name:n,get nameSegment(){return a()},selectionSegment:Nr(e.$cstNode),type:e.$type,documentUri:r.uri,path:i}}}class Fx{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,n=ee.None){const r=[],i=e.parseResult.value;for(const s of Jt(i))await Be(n),jl(s).filter(a=>!Rr(a)).forEach(a=>{const o=this.createDescription(a);o&&r.push(o)});return r}createDescription(e){const n=e.reference.$nodeDescription,r=e.reference.$refNode;if(!n||!r)return;const i=Xe(e.container).uri;return{sourceUri:i,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:n.documentUri,targetPath:n.path,segment:Nr(r),local:xt.equals(n.documentUri,i)}}}class Gx{constructor(){this.segmentSeparator="/",this.indexSeparator="@"}getAstNodePath(e){if(e.$container){const n=this.getAstNodePath(e.$container),r=this.getPathSegment(e);return n+this.segmentSeparator+r}return""}getPathSegment({$containerProperty:e,$containerIndex:n}){if(!e)throw new Error("Missing '$containerProperty' in AST node.");return n!==void 0?e+this.indexSeparator+n:e}getAstNode(e,n){return n.split(this.segmentSeparator).reduce((i,s)=>{if(!i||s.length===0)return i;const a=s.indexOf(this.indexSeparator);if(a>0){const o=s.substring(0,a),c=parseInt(s.substring(a+1)),u=i[o];return u==null?void 0:u[c]}return i[s]},e)}}class Ux{constructor(e){this._ready=new Wa,this.settings={},this.workspaceConfig=!1,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){var n,r;this.workspaceConfig=(r=(n=e.capabilities.workspace)===null||n===void 0?void 0:n.configuration)!==null&&r!==void 0?r:!1}async initialized(e){if(this.workspaceConfig){if(e.register){const n=this.serviceRegistry.all;e.register({section:n.map(r=>this.toSectionName(r.LanguageMetaData.languageId))})}if(e.fetchConfiguration){const n=this.serviceRegistry.all.map(i=>({section:this.toSectionName(i.LanguageMetaData.languageId)})),r=await e.fetchConfiguration(n);n.forEach((i,s)=>{this.updateSectionConfiguration(i.section,r[s])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(n=>{this.updateSectionConfiguration(n,e.settings[n])})}updateSectionConfiguration(e,n){this.settings[e]=n}async getConfiguration(e,n){await this.ready;const r=this.toSectionName(e);if(this.settings[r])return this.settings[r][n]}toSectionName(e){return`${e}`}}var ei;(function(t){function e(n){return{dispose:async()=>await n()}}t.create=e})(ei||(ei={}));class Bx{constructor(e){this.updateBuildOptions={validation:{categories:["built-in","fast"]}},this.updateListeners=[],this.buildPhaseListeners=new za,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=W.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,n={},r=ee.None){var i,s;for(const a of e){const o=a.uri.toString();if(a.state===W.Validated){if(typeof n.validation=="boolean"&&n.validation)a.state=W.IndexedReferences,a.diagnostics=void 0,this.buildState.delete(o);else if(typeof n.validation=="object"){const c=this.buildState.get(o),u=(i=c==null?void 0:c.result)===null||i===void 0?void 0:i.validationChecks;if(u){const f=((s=n.validation.categories)!==null&&s!==void 0?s:Zr.all).filter(d=>!u.includes(d));f.length>0&&(this.buildState.set(o,{completed:!1,options:{validation:Object.assign(Object.assign({},n.validation),{categories:f})},result:c.result}),a.state=W.IndexedReferences)}}}else this.buildState.delete(o)}this.currentState=W.Changed,await this.emitUpdate(e.map(a=>a.uri),[]),await this.buildDocuments(e,n,r)}async update(e,n,r=ee.None){this.currentState=W.Changed;for(const a of n)this.langiumDocuments.deleteDocument(a),this.buildState.delete(a.toString()),this.indexManager.remove(a);for(const a of e){if(!this.langiumDocuments.invalidateDocument(a)){const c=this.langiumDocumentFactory.fromModel({$type:"INVALID"},a);c.state=W.Changed,this.langiumDocuments.addDocument(c)}this.buildState.delete(a.toString())}const i=ne(e).concat(n).map(a=>a.toString()).toSet();this.langiumDocuments.all.filter(a=>!i.has(a.uri.toString())&&this.shouldRelink(a,i)).forEach(a=>{this.serviceRegistry.getServices(a.uri).references.Linker.unlink(a),a.state=Math.min(a.state,W.ComputedScopes),a.diagnostics=void 0}),await this.emitUpdate(e,n),await Be(r);const s=this.langiumDocuments.all.filter(a=>{var o;return a.state<W.Linked||!(!((o=this.buildState.get(a.uri.toString()))===null||o===void 0)&&o.completed)}).toArray();await this.buildDocuments(s,this.updateBuildOptions,r)}async emitUpdate(e,n){await Promise.all(this.updateListeners.map(r=>r(e,n)))}shouldRelink(e,n){return e.references.some(r=>r.error!==void 0)?!0:this.indexManager.isAffected(e,n)}onUpdate(e){return this.updateListeners.push(e),ei.create(()=>{const n=this.updateListeners.indexOf(e);n>=0&&this.updateListeners.splice(n,1)})}async buildDocuments(e,n,r){this.prepareBuild(e,n),await this.runCancelable(e,W.Parsed,r,s=>this.langiumDocumentFactory.update(s,r)),await this.runCancelable(e,W.IndexedContent,r,s=>this.indexManager.updateContent(s,r)),await this.runCancelable(e,W.ComputedScopes,r,async s=>{const a=this.serviceRegistry.getServices(s.uri).references.ScopeComputation;s.precomputedScopes=await a.computeLocalScopes(s,r)}),await this.runCancelable(e,W.Linked,r,s=>this.serviceRegistry.getServices(s.uri).references.Linker.link(s,r)),await this.runCancelable(e,W.IndexedReferences,r,s=>this.indexManager.updateReferences(s,r));const i=e.filter(s=>this.shouldValidate(s));await this.runCancelable(i,W.Validated,r,s=>this.validate(s,r));for(const s of e){const a=this.buildState.get(s.uri.toString());a&&(a.completed=!0)}}prepareBuild(e,n){for(const r of e){const i=r.uri.toString(),s=this.buildState.get(i);(!s||s.completed)&&this.buildState.set(i,{completed:!1,options:n,result:s==null?void 0:s.result})}}async runCancelable(e,n,r,i){const s=e.filter(a=>a.state<n);for(const a of s)await Be(r),await i(a),a.state=n;await this.notifyBuildPhase(s,n,r),this.currentState=n}onBuildPhase(e,n){return this.buildPhaseListeners.add(e,n),ei.create(()=>{this.buildPhaseListeners.delete(e,n)})}waitUntil(e,n,r){let i;if(n&&"path"in n?i=n:r=n,r??(r=ee.None),i){const s=this.langiumDocuments.getDocument(i);if(s&&s.state>e)return Promise.resolve(i)}return this.currentState>=e?Promise.resolve(void 0):r.isCancellationRequested?Promise.reject(Qr):new Promise((s,a)=>{const o=this.onBuildPhase(e,()=>{if(o.dispose(),c.dispose(),i){const u=this.langiumDocuments.getDocument(i);s(u==null?void 0:u.uri)}else s(void 0)}),c=r.onCancellationRequested(()=>{o.dispose(),c.dispose(),a(Qr)})})}async notifyBuildPhase(e,n,r){if(e.length===0)return;const i=this.buildPhaseListeners.get(n);for(const s of i)await Be(r),await s(e,r)}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,n){var r,i;const s=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,a=this.getBuildOptions(e).validation,o=typeof a=="object"?a:void 0,c=await s.validateDocument(e,o,n);e.diagnostics?e.diagnostics.push(...c):e.diagnostics=c;const u=this.buildState.get(e.uri.toString());if(u){(r=u.result)!==null&&r!==void 0||(u.result={});const l=(i=o==null?void 0:o.categories)!==null&&i!==void 0?i:Zr.all;u.result.validationChecks?u.result.validationChecks.push(...l):u.result.validationChecks=[...l]}}getBuildOptions(e){var n,r;return(r=(n=this.buildState.get(e.uri.toString()))===null||n===void 0?void 0:n.options)!==null&&r!==void 0?r:{}}}class jx{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Cx,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,n){const r=Xe(e).uri,i=[];return this.referenceIndex.forEach(s=>{s.forEach(a=>{xt.equals(a.targetUri,r)&&a.targetPath===n&&i.push(a)})}),ne(i)}allElements(e,n){let r=ne(this.symbolIndex.keys());return n&&(r=r.filter(i=>!n||n.has(i))),r.map(i=>this.getFileDescriptions(i,e)).flat()}getFileDescriptions(e,n){var r;return n?this.symbolByTypeIndex.get(e,n,()=>{var s;return((s=this.symbolIndex.get(e))!==null&&s!==void 0?s:[]).filter(o=>this.astReflection.isSubtype(o.type,n))}):(r=this.symbolIndex.get(e))!==null&&r!==void 0?r:[]}remove(e){const n=e.toString();this.symbolIndex.delete(n),this.symbolByTypeIndex.clear(n),this.referenceIndex.delete(n)}async updateContent(e,n=ee.None){const i=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,n),s=e.uri.toString();this.symbolIndex.set(s,i),this.symbolByTypeIndex.clear(s)}async updateReferences(e,n=ee.None){const i=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,n);this.referenceIndex.set(e.uri.toString(),i)}isAffected(e,n){const r=this.referenceIndex.get(e.uri.toString());return r?r.some(i=>!i.local&&n.has(i.targetUri.toString())):!1}}class Hx{constructor(e){this.initialBuildOptions={},this._ready=new Wa,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}initialize(e){var n;this.folders=(n=e.workspaceFolders)!==null&&n!==void 0?n:void 0}initialized(e){return this.mutex.write(n=>{var r;return this.initializeWorkspace((r=this.folders)!==null&&r!==void 0?r:[],n)})}async initializeWorkspace(e,n=ee.None){const r=await this.performStartup(e);await Be(n),await this.documentBuilder.build(r,this.initialBuildOptions,n)}async performStartup(e){const n=this.serviceRegistry.all.flatMap(s=>s.LanguageMetaData.fileExtensions),r=[],i=s=>{r.push(s),this.langiumDocuments.hasDocument(s.uri)||this.langiumDocuments.addDocument(s)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(s=>[s,this.getRootFolder(s)]).map(async s=>this.traverseFolder(...s,n,i))),this._ready.resolve(),r}loadAdditionalDocuments(e,n){return Promise.resolve()}getRootFolder(e){return hn.parse(e.uri)}async traverseFolder(e,n,r,i){const s=await this.fileSystemProvider.readDirectory(n);await Promise.all(s.map(async a=>{if(this.includeEntry(e,a,r)){if(a.isDirectory)await this.traverseFolder(e,a.uri,r,i);else if(a.isFile){const o=await this.langiumDocuments.getOrCreateDocument(a.uri);i(o)}}}))}includeEntry(e,n,r){const i=xt.basename(n.uri);if(i.startsWith("."))return!1;if(n.isDirectory)return i!=="node_modules"&&i!=="out";if(n.isFile){const s=xt.extname(n.uri);return r.includes(s)}return!1}}class Wx{constructor(e){const n=e.parser.TokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(n);const r=zu(n)?Object.values(n):n;this.chevrotainLexer=new pe(r,{positionTracking:"full"})}get definition(){return this.tokenTypes}tokenize(e){var n;const r=this.chevrotainLexer.tokenize(e);return{tokens:r.tokens,errors:r.errors,hidden:(n=r.groups.hidden)!==null&&n!==void 0?n:[]}}toTokenTypeDictionary(e){if(zu(e))return e;const n=rh(e)?Object.values(e.modes).flat():e,r={};return n.forEach(i=>r[i.name]=i),r}}function zx(t){return Array.isArray(t)&&(t.length===0||"name"in t[0])}function rh(t){return t&&"modes"in t&&"defaultMode"in t}function zu(t){return!zx(t)&&!rh(t)}function Kx(t,e,n){let r,i;typeof t=="string"?(i=e,r=n):(i=t.range.start,r=e),i||(i=D.create(0,0));const s=ih(t),a=Ka(r),o=Yx({lines:s,position:i,options:a});return eC({index:0,tokens:o,position:i})}function Vx(t,e){const n=Ka(e),r=ih(t);if(r.length===0)return!1;const i=r[0],s=r[r.length-1],a=n.start,o=n.end;return!!(a!=null&&a.exec(i))&&!!(o!=null&&o.exec(s))}function ih(t){let e="";return typeof t=="string"?e=t:e=t.text,e.split(mp)}const Ku=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,qx=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function Yx(t){var e,n,r;const i=[];let s=t.position.line,a=t.position.character;for(let o=0;o<t.lines.length;o++){const c=o===0,u=o===t.lines.length-1;let l=t.lines[o],f=0;if(c&&t.options.start){const h=(e=t.options.start)===null||e===void 0?void 0:e.exec(l);h&&(f=h.index+h[0].length)}else{const h=(n=t.options.line)===null||n===void 0?void 0:n.exec(l);h&&(f=h.index+h[0].length)}if(u){const h=(r=t.options.end)===null||r===void 0?void 0:r.exec(l);h&&(l=l.substring(0,h.index))}if(l=l.substring(0,Zx(l)),qs(l,f)>=l.length){if(i.length>0){const h=D.create(s,a);i.push({type:"break",content:"",range:L.create(h,h)})}}else{Ku.lastIndex=f;const h=Ku.exec(l);if(h){const g=h[0],m=h[1],T=D.create(s,a+f),y=D.create(s,a+f+g.length);i.push({type:"tag",content:m,range:L.create(T,y)}),f+=g.length,f=qs(l,f)}if(f<l.length){const g=l.substring(f),m=Array.from(g.matchAll(qx));i.push(...Xx(m,g,s,a+f))}}s++,a=0}return i.length>0&&i[i.length-1].type==="break"?i.slice(0,-1):i}function Xx(t,e,n,r){const i=[];if(t.length===0){const s=D.create(n,r),a=D.create(n,r+e.length);i.push({type:"text",content:e,range:L.create(s,a)})}else{let s=0;for(const o of t){const c=o.index,u=e.substring(s,c);u.length>0&&i.push({type:"text",content:e.substring(s,c),range:L.create(D.create(n,s+r),D.create(n,c+r))});let l=u.length+1;const f=o[1];if(i.push({type:"inline-tag",content:f,range:L.create(D.create(n,s+l+r),D.create(n,s+l+f.length+r))}),l+=f.length,o.length===4){l+=o[2].length;const d=o[3];i.push({type:"text",content:d,range:L.create(D.create(n,s+l+r),D.create(n,s+l+d.length+r))})}else i.push({type:"text",content:"",range:L.create(D.create(n,s+l+r),D.create(n,s+l+r))});s=c+o[0].length}const a=e.substring(s);a.length>0&&i.push({type:"text",content:a,range:L.create(D.create(n,s+r),D.create(n,s+r+a.length))})}return i}const Jx=/\S/,Qx=/\s*$/;function qs(t,e){const n=t.substring(e).match(Jx);return n?e+n.index:t.length}function Zx(t){const e=t.match(Qx);if(e&&typeof e.index=="number")return e.index}function eC(t){var e,n,r,i;const s=D.create(t.position.line,t.position.character);if(t.tokens.length===0)return new Vu([],L.create(s,s));const a=[];for(;t.index<t.tokens.length;){const u=tC(t,a[a.length-1]);u&&a.push(u)}const o=(n=(e=a[0])===null||e===void 0?void 0:e.range.start)!==null&&n!==void 0?n:s,c=(i=(r=a[a.length-1])===null||r===void 0?void 0:r.range.end)!==null&&i!==void 0?i:s;return new Vu(a,L.create(o,c))}function tC(t,e){const n=t.tokens[t.index];if(n.type==="tag")return ah(t,!1);if(n.type==="text"||n.type==="inline-tag")return sh(t);nC(n,e),t.index++}function nC(t,e){if(e){const n=new ch("",t.range);"inlines"in e?e.inlines.push(n):e.content.inlines.push(n)}}function sh(t){let e=t.tokens[t.index];const n=e;let r=e;const i=[];for(;e&&e.type!=="break"&&e.type!=="tag";)i.push(rC(t)),r=e,e=t.tokens[t.index];return new Ys(i,L.create(n.range.start,r.range.end))}function rC(t){return t.tokens[t.index].type==="inline-tag"?ah(t,!0):oh(t)}function ah(t,e){const n=t.tokens[t.index++],r=n.content.substring(1),i=t.tokens[t.index];if((i==null?void 0:i.type)==="text")if(e){const s=oh(t);return new is(r,new Ys([s],s.range),e,L.create(n.range.start,s.range.end))}else{const s=sh(t);return new is(r,s,e,L.create(n.range.start,s.range.end))}else{const s=n.range;return new is(r,new Ys([],s),e,s)}}function oh(t){const e=t.tokens[t.index++];return new ch(e.content,e.range)}function Ka(t){if(!t)return Ka({start:"/**",end:"*/",line:"*"});const{start:e,end:n,line:r}=t;return{start:rs(e,!0),end:rs(n,!1),line:rs(r,!0)}}function rs(t,e){if(typeof t=="string"||typeof t=="object"){const n=typeof t=="string"?ai(t):t.source;return e?new RegExp(`^\\s*${n}`):new RegExp(`\\s*${n}\\s*$`)}else return t}class Vu{constructor(e,n){this.elements=e,this.range=n}getTag(e){return this.getAllTags().find(n=>n.name===e)}getTags(e){return this.getAllTags().filter(n=>n.name===e)}getAllTags(){return this.elements.filter(e=>"name"in e)}toString(){let e="";for(const n of this.elements)if(e.length===0)e=n.toString();else{const r=n.toString();e+=qu(e)+r}return e.trim()}toMarkdown(e){let n="";for(const r of this.elements)if(n.length===0)n=r.toMarkdown(e);else{const i=r.toMarkdown(e);n+=qu(n)+i}return n.trim()}}class is{constructor(e,n,r,i){this.name=e,this.content=n,this.inline=r,this.range=i}toString(){let e=`@${this.name}`;const n=this.content.toString();return this.content.inlines.length===1?e=`${e} ${n}`:this.content.inlines.length>1&&(e=`${e}
|
|
117
|
+
${n}`),this.inline?`{${e}}`:e}toMarkdown(e){var n,r;return(r=(n=e==null?void 0:e.renderTag)===null||n===void 0?void 0:n.call(e,this))!==null&&r!==void 0?r:this.toMarkdownDefault(e)}toMarkdownDefault(e){const n=this.content.toMarkdown(e);if(this.inline){const s=iC(this.name,n,e??{});if(typeof s=="string")return s}let r="";(e==null?void 0:e.tag)==="italic"||(e==null?void 0:e.tag)===void 0?r="*":(e==null?void 0:e.tag)==="bold"?r="**":(e==null?void 0:e.tag)==="bold-italic"&&(r="***");let i=`${r}@${this.name}${r}`;return this.content.inlines.length===1?i=`${i} — ${n}`:this.content.inlines.length>1&&(i=`${i}
|
|
118
|
+
${n}`),this.inline?`{${i}}`:i}}function iC(t,e,n){var r,i;if(t==="linkplain"||t==="linkcode"||t==="link"){const s=e.indexOf(" ");let a=e;if(s>0){const c=qs(e,s);a=e.substring(c),e=e.substring(0,s)}return(t==="linkcode"||t==="link"&&n.link==="code")&&(a=`\`${a}\``),(i=(r=n.renderLink)===null||r===void 0?void 0:r.call(n,e,a))!==null&&i!==void 0?i:sC(e,a)}}function sC(t,e){try{return hn.parse(t,!0),`[${e}](${t})`}catch{return t}}class Ys{constructor(e,n){this.inlines=e,this.range=n}toString(){let e="";for(let n=0;n<this.inlines.length;n++){const r=this.inlines[n],i=this.inlines[n+1];e+=r.toString(),i&&i.range.start.line>r.range.start.line&&(e+=`
|
|
119
|
+
`)}return e}toMarkdown(e){let n="";for(let r=0;r<this.inlines.length;r++){const i=this.inlines[r],s=this.inlines[r+1];n+=i.toMarkdown(e),s&&s.range.start.line>i.range.start.line&&(n+=`
|
|
120
|
+
`)}return n}}class ch{constructor(e,n){this.text=e,this.range=n}toString(){return this.text}toMarkdown(){return this.text}}function qu(t){return t.endsWith(`
|
|
121
|
+
`)?`
|
|
122
|
+
`:`
|
|
123
|
+
|
|
124
|
+
`}class aC{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){const n=this.commentProvider.getComment(e);if(n&&Vx(n))return Kx(n).toMarkdown({renderLink:(i,s)=>this.documentationLinkRenderer(e,i,s),renderTag:i=>this.documentationTagRenderer(e,i)})}documentationLinkRenderer(e,n,r){var i;const s=(i=this.findNameInPrecomputedScopes(e,n))!==null&&i!==void 0?i:this.findNameInGlobalScope(e,n);if(s&&s.nameSegment){const a=s.nameSegment.range.start.line+1,o=s.nameSegment.range.start.character+1,c=s.documentUri.with({fragment:`L${a},${o}`});return`[${r}](${c.toString()})`}else return}documentationTagRenderer(e,n){}findNameInPrecomputedScopes(e,n){const i=Xe(e).precomputedScopes;if(!i)return;let s=e;do{const o=i.get(s).find(c=>c.name===n);if(o)return o;s=s.$container}while(s)}findNameInGlobalScope(e,n){return this.indexManager.allElements().find(i=>i.name===n)}}class oC{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){var n;return bx(e)?e.$comment:(n=Lh(e.$cstNode,this.grammarConfig().multilineCommentRules))===null||n===void 0?void 0:n.text}}class cC{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e){return Promise.resolve(this.syncParser.parse(e))}}class uC{constructor(){this.previousTokenSource=new Ws,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();const n=new Ws;return this.previousTokenSource=n,this.enqueue(this.writeQueue,e,n.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,n,r){const i=new Wa,s={action:n,deferred:i,cancellationToken:r??ee.None};return e.push(s),this.performNextOperation(),i.promise}async performNextOperation(){if(!this.done)return;const e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:n,deferred:r,cancellationToken:i})=>{try{const s=await Promise.resolve().then(()=>n(i));r.resolve(s)}catch(s){Ha(s)?r.resolve(void 0):r.reject(s)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}}class lC{constructor(e){this.grammarElementIdMap=new Bu,this.tokenTypeIdMap=new Bu,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors.map(n=>Object.assign({},n)),parserErrors:e.parserErrors.map(n=>Object.assign({},n)),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}createDehyrationContext(e){const n=new Map,r=new Map;for(const i of Jt(e))n.set(i,{});if(e.$cstNode)for(const i of as(e.$cstNode))r.set(i,{});return{astNodes:n,cstNodes:r}}dehydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(r.$cstNode=this.dehydrateCstNode(e.$cstNode,n));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)ue(o)?a.push(this.dehydrateAstNode(o,n)):qe(o)?a.push(this.dehydrateReference(o,n)):a.push(o)}else ue(s)?r[i]=this.dehydrateAstNode(s,n):qe(s)?r[i]=this.dehydrateReference(s,n):s!==void 0&&(r[i]=s);return r}dehydrateReference(e,n){const r={};return r.$refText=e.$refText,e.$refNode&&(r.$refNode=n.cstNodes.get(e.$refNode)),r}dehydrateCstNode(e,n){const r=n.cstNodes.get(e);return al(e)?r.fullText=e.fullText:r.grammarSource=this.getGrammarElementId(e.grammarSource),r.hidden=e.hidden,r.astNode=n.astNodes.get(e.astNode),tn(e)?r.content=e.content.map(i=>this.dehydrateCstNode(i,n)):sl(e)&&(r.tokenType=e.tokenType.name,r.offset=e.offset,r.length=e.length,r.startLine=e.range.start.line,r.startColumn=e.range.start.character,r.endLine=e.range.end.line,r.endColumn=e.range.end.character),r}hydrate(e){const n=e.value,r=this.createHydrationContext(n);return"$cstNode"in n&&this.hydrateCstNode(n.$cstNode,r),{lexerErrors:e.lexerErrors,parserErrors:e.parserErrors,value:this.hydrateAstNode(n,r)}}createHydrationContext(e){const n=new Map,r=new Map;for(const s of Jt(e))n.set(s,{});let i;if(e.$cstNode)for(const s of as(e.$cstNode)){let a;"fullText"in s?(a=new Bd(s.fullText),i=a):"content"in s?a=new Ba:"tokenType"in s&&(a=this.hydrateCstLeafNode(s)),a&&(r.set(s,a),a.root=i)}return{astNodes:n,cstNodes:r}}hydrateAstNode(e,n){const r=n.astNodes.get(e);r.$type=e.$type,r.$containerIndex=e.$containerIndex,r.$containerProperty=e.$containerProperty,e.$cstNode&&(r.$cstNode=n.cstNodes.get(e.$cstNode));for(const[i,s]of Object.entries(e))if(!i.startsWith("$"))if(Array.isArray(s)){const a=[];r[i]=a;for(const o of s)ue(o)?a.push(this.setParent(this.hydrateAstNode(o,n),r)):qe(o)?a.push(this.hydrateReference(o,r,i,n)):a.push(o)}else ue(s)?r[i]=this.setParent(this.hydrateAstNode(s,n),r):qe(s)?r[i]=this.hydrateReference(s,r,i,n):s!==void 0&&(r[i]=s);return r}setParent(e,n){return e.$container=n,e}hydrateReference(e,n,r,i){return this.linker.buildReference(n,r,i.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,n,r=0){const i=n.cstNodes.get(e);if(typeof e.grammarSource=="number"&&(i.grammarSource=this.getGrammarElement(e.grammarSource)),i.astNode=n.astNodes.get(e.astNode),tn(i))for(const s of e.content){const a=this.hydrateCstNode(s,n,r++);i.content.push(a)}return i}hydrateCstLeafNode(e){const n=this.getTokenType(e.tokenType),r=e.offset,i=e.length,s=e.startLine,a=e.startColumn,o=e.endLine,c=e.endColumn,u=e.hidden;return new Gs(r,i,{start:{line:s,character:a},end:{line:o,character:c}},n,u)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap();const n=this.grammarElementIdMap.getKey(e);if(n)return n;throw new Error("Invalid grammar element id: "+e)}createGrammarElementIdMap(){let e=0;for(const n of Jt(this.grammar))Fh(n)&&this.grammarElementIdMap.set(n,e++)}}function An(t){return{documentation:{CommentProvider:e=>new oC(e),DocumentationProvider:e=>new aC(e)},parser:{AsyncParser:e=>new cC(e),GrammarConfig:e=>Fp(e),LangiumParser:e=>rx(e),CompletionParser:e=>nx(e),ValueConverter:()=>new Xd,TokenBuilder:()=>new Yd,Lexer:e=>new Wx(e),ParserErrorMessageProvider:()=>new Wd},workspace:{AstNodeLocator:()=>new Gx,AstNodeDescriptionProvider:e=>new Dx(e),ReferenceDescriptionProvider:e=>new Fx(e)},references:{Linker:e=>new Ex(e),NameProvider:()=>new $x,ScopeProvider:e=>new Nx(e),ScopeComputation:e=>new _x(e),References:e=>new Sx(e)},serializer:{Hydrator:e=>new lC(e),JsonSerializer:e=>new kx(e)},validation:{DocumentValidator:e=>new Lx(e),ValidationRegistry:e=>new Px(e)},shared:()=>t.shared}}function En(t){return{ServiceRegistry:()=>new Ox,workspace:{LangiumDocuments:e=>new Ax(e),LangiumDocumentFactory:e=>new vx(e),DocumentBuilder:e=>new Bx(e),IndexManager:e=>new jx(e),WorkspaceManager:e=>new Hx(e),FileSystemProvider:e=>t.fileSystemProvider(e),WorkspaceLock:()=>new uC,ConfigurationProvider:e=>new Ux(e)}}}var Yu;(function(t){t.merge=(e,n)=>ti(ti({},e),n)})(Yu||(Yu={}));function Le(t,e,n,r,i,s,a,o,c){const u=[t,e,n,r,i,s,a,o,c].reduce(ti,{});return uh(u)}const Xu=Symbol("isProxy");function uh(t,e){const n=new Proxy({},{deleteProperty:()=>!1,get:(r,i)=>Qu(r,i,t,e||n),getOwnPropertyDescriptor:(r,i)=>(Qu(r,i,t,e||n),Object.getOwnPropertyDescriptor(r,i)),has:(r,i)=>i in t,ownKeys:()=>[...Reflect.ownKeys(t),Xu]});return n[Xu]=!0,n}const Ju=Symbol();function Qu(t,e,n,r){if(e in t){if(t[e]instanceof Error)throw new Error("Construction failure. Please make sure that your dependencies are constructable.",{cause:t[e]});if(t[e]===Ju)throw new Error('Cycle detected. Please make "'+String(e)+'" lazy. See https://langium.org/docs/configuration-services/#resolving-cyclic-dependencies');return t[e]}else if(e in n){const i=n[e];t[e]=Ju;try{t[e]=typeof i=="function"?i(r):uh(i,r)}catch(s){throw t[e]=s instanceof Error?s:void 0,s}return t[e]}else return}function ti(t,e){if(e){for(const[n,r]of Object.entries(e))if(r!==void 0){const i=t[n];i!==null&&r!==null&&typeof i=="object"&&typeof r=="object"?t[n]=ti(i,r):t[n]=r}}return t}class fC{readFile(){throw new Error("No file system is available.")}async readDirectory(){return[]}}const Rn={fileSystemProvider:()=>new fC},dC={Grammar:()=>{},LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[".langium"],languageId:"langium"})},hC={AstReflection:()=>new Bl};function pC(){const t=Le(En(Rn),hC),e=Le(An({shared:t}),dC);return t.ServiceRegistry.register(e),e}function pr(t){var e;const n=pC(),r=n.serializer.JsonSerializer.deserialize(t);return n.shared.workspace.LangiumDocumentFactory.fromModel(r,hn.parse(`memory://${(e=r.name)!==null&&e!==void 0?e:"grammar"}.langium`)),r}var gC=Object.defineProperty,I=(t,e)=>gC(t,"name",{value:e,configurable:!0}),mC="Statement",yC="Architecture";function TC(t){return ze.isInstance(t,yC)}I(TC,"isArchitecture");var lh="Branch";function vC(t){return ze.isInstance(t,lh)}I(vC,"isBranch");var AC="Checkout",EC="CherryPicking",fh="Commit";function RC(t){return ze.isInstance(t,fh)}I(RC,"isCommit");var $C="Common";function SC(t){return ze.isInstance(t,$C)}I(SC,"isCommon");var dh="GitGraph";function _C(t){return ze.isInstance(t,dh)}I(_C,"isGitGraph");var IC="Info";function xC(t){return ze.isInstance(t,IC)}I(xC,"isInfo");var hh="Merge";function CC(t){return ze.isInstance(t,hh)}I(CC,"isMerge");var wC="Packet";function NC(t){return ze.isInstance(t,wC)}I(NC,"isPacket");var bC="PacketBlock";function kC(t){return ze.isInstance(t,bC)}I(kC,"isPacketBlock");var OC="Pie";function PC(t){return ze.isInstance(t,OC)}I(PC,"isPie");var LC="PieSection";function MC(t){return ze.isInstance(t,LC)}I(MC,"isPieSection");var DC="Direction",zn,ph=(zn=class extends il{getAllTypes(){return["Architecture","Branch","Checkout","CherryPicking","Commit","Common","Direction","Edge","GitGraph","Group","Info","Junction","Merge","Packet","PacketBlock","Pie","PieSection","Service","Statement"]}computeIsSubtype(e,n){switch(e){case lh:case AC:case EC:case fh:case hh:return this.isSubtype(mC,n);case DC:return this.isSubtype(dh,n);default:return!1}}getReferenceType(e){const n=`${e.container.$type}:${e.property}`;switch(n){default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case"Architecture":return{name:"Architecture",properties:[{name:"accDescr"},{name:"accTitle"},{name:"edges",defaultValue:[]},{name:"groups",defaultValue:[]},{name:"junctions",defaultValue:[]},{name:"services",defaultValue:[]},{name:"title"}]};case"Branch":return{name:"Branch",properties:[{name:"name"},{name:"order"}]};case"Checkout":return{name:"Checkout",properties:[{name:"branch"}]};case"CherryPicking":return{name:"CherryPicking",properties:[{name:"id"},{name:"parent"},{name:"tags",defaultValue:[]}]};case"Commit":return{name:"Commit",properties:[{name:"id"},{name:"message"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Common":return{name:"Common",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Edge":return{name:"Edge",properties:[{name:"lhsDir"},{name:"lhsGroup",defaultValue:!1},{name:"lhsId"},{name:"lhsInto",defaultValue:!1},{name:"rhsDir"},{name:"rhsGroup",defaultValue:!1},{name:"rhsId"},{name:"rhsInto",defaultValue:!1},{name:"title"}]};case"GitGraph":return{name:"GitGraph",properties:[{name:"accDescr"},{name:"accTitle"},{name:"statements",defaultValue:[]},{name:"title"}]};case"Group":return{name:"Group",properties:[{name:"icon"},{name:"id"},{name:"in"},{name:"title"}]};case"Info":return{name:"Info",properties:[{name:"accDescr"},{name:"accTitle"},{name:"title"}]};case"Junction":return{name:"Junction",properties:[{name:"id"},{name:"in"}]};case"Merge":return{name:"Merge",properties:[{name:"branch"},{name:"id"},{name:"tags",defaultValue:[]},{name:"type"}]};case"Packet":return{name:"Packet",properties:[{name:"accDescr"},{name:"accTitle"},{name:"blocks",defaultValue:[]},{name:"title"}]};case"PacketBlock":return{name:"PacketBlock",properties:[{name:"end"},{name:"label"},{name:"start"}]};case"Pie":return{name:"Pie",properties:[{name:"accDescr"},{name:"accTitle"},{name:"sections",defaultValue:[]},{name:"showData",defaultValue:!1},{name:"title"}]};case"PieSection":return{name:"PieSection",properties:[{name:"label"},{name:"value"}]};case"Service":return{name:"Service",properties:[{name:"icon"},{name:"iconText"},{name:"id"},{name:"in"},{name:"title"}]};case"Direction":return{name:"Direction",properties:[{name:"accDescr"},{name:"accTitle"},{name:"dir"},{name:"statements",defaultValue:[]},{name:"title"}]};default:return{name:e,properties:[]}}}},I(zn,"MermaidAstReflection"),zn),ze=new ph,Zu,FC=I(()=>Zu??(Zu=pr('{"$type":"Grammar","isDeclared":true,"name":"Info","imports":[],"rules":[{"$type":"ParserRule","name":"Info","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"info"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"Keyword","value":"showInfo"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"*"}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"?"}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"InfoGrammar"),el,GC=I(()=>el??(el=pr(`{"$type":"Grammar","isDeclared":true,"name":"Packet","imports":[],"rules":[{"$type":"ParserRule","name":"Packet","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"packet-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"blocks","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PacketBlock","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"start","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"end","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}}],"cardinality":"?"},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/0|[1-9][0-9]*/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}`)),"PacketGrammar"),tl,UC=I(()=>tl??(tl=pr('{"$type":"Grammar","isDeclared":true,"name":"Pie","imports":[],"rules":[{"$type":"ParserRule","name":"Pie","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"pie"},{"$type":"Assignment","feature":"showData","operator":"?=","terminal":{"$type":"Keyword","value":"showData"},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"*"}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"Assignment","feature":"sections","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]},"cardinality":"+"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"PieSection","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"label","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}},{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"value","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"PIE_SECTION_LABEL","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]+\\"/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"PIE_SECTION_VALUE","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/(0|[1-9][0-9]*)(\\\\.[0-9]+)?/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"PieGrammar"),nl,BC=I(()=>nl??(nl=pr('{"$type":"Grammar","isDeclared":true,"name":"Architecture","imports":[],"rules":[{"$type":"ParserRule","name":"Architecture","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"Keyword","value":"architecture-beta"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]}]},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[],"cardinality":"*"}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","fragment":true,"definition":{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"groups","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}},{"$type":"Assignment","feature":"services","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@6"},"arguments":[]}},{"$type":"Assignment","feature":"junctions","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@7"},"arguments":[]}},{"$type":"Assignment","feature":"edges","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@8"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"LeftPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Keyword","value":":"},{"$type":"Assignment","feature":"lhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"RightPort","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"rhsDir","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@9"},"arguments":[]}},{"$type":"Keyword","value":":"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Arrow","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]},{"$type":"Assignment","feature":"lhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"--"},{"$type":"Group","elements":[{"$type":"Keyword","value":"-"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]}},{"$type":"Keyword","value":"-"}]}]},{"$type":"Assignment","feature":"rhsInto","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Group","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"group"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Service","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"service"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"iconText","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"Assignment","feature":"icon","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]}}],"cardinality":"?"},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},"cardinality":"?"},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Junction","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"junction"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"in"},{"$type":"Assignment","feature":"in","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Edge","definition":{"$type":"Group","elements":[{"$type":"Assignment","feature":"lhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"lhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]},{"$type":"Assignment","feature":"rhsId","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@10"},"arguments":[]}},{"$type":"Assignment","feature":"rhsGroup","operator":"?=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"ARROW_DIRECTION","definition":{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"TerminalAlternatives","elements":[{"$type":"CharacterRange","left":{"$type":"Keyword","value":"L"}},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"R"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"T"}}]},{"$type":"CharacterRange","left":{"$type":"Keyword","value":"B"}}]},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ID","definition":{"$type":"RegexToken","regex":"/[\\\\w]+/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TEXT_ICON","definition":{"$type":"RegexToken","regex":"/\\\\(\\"[^\\"]+\\"\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_ICON","definition":{"$type":"RegexToken","regex":"/\\\\([\\\\w-:]+\\\\)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARCH_TITLE","definition":{"$type":"RegexToken","regex":"/\\\\[[\\\\w ]+\\\\]/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_GROUP","definition":{"$type":"RegexToken","regex":"/\\\\{group\\\\}/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ARROW_INTO","definition":{"$type":"RegexToken","regex":"/<|>/"},"fragment":false,"hidden":false},{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@21"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false}],"definesHiddenTokens":false,"hiddenTokens":[],"interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"types":[],"usedGrammars":[]}')),"ArchitectureGrammar"),rl,jC=I(()=>rl??(rl=pr(`{"$type":"Grammar","isDeclared":true,"name":"GitGraph","interfaces":[{"$type":"Interface","name":"Common","attributes":[{"$type":"TypeAttribute","name":"accDescr","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"accTitle","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}},{"$type":"TypeAttribute","name":"title","isOptional":true,"type":{"$type":"SimpleType","primitiveType":"string"}}],"superTypes":[]}],"rules":[{"$type":"ParserRule","name":"TitleAndAccessibilities","fragment":true,"definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Assignment","feature":"accDescr","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@3"},"arguments":[]}},{"$type":"Assignment","feature":"accTitle","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@4"},"arguments":[]}},{"$type":"Assignment","feature":"title","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@5"},"arguments":[]}}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}],"cardinality":"+"},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"EOL","fragment":true,"dataType":"string","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"+"},{"$type":"EndOfFile"}]},"definesHiddenTokens":false,"entry":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"NEWLINE","definition":{"$type":"RegexToken","regex":"/\\\\r?\\\\n/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_DESCR","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accDescr(?:[\\\\t ]*:([^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)|\\\\s*{([^}]*)})/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ACC_TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*accTitle[\\\\t ]*:(?:[^\\\\n\\\\r]*?(?=%%)|[^\\\\n\\\\r]*)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"TITLE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*title(?:[\\\\t ][^\\\\n\\\\r]*?(?=%%)|[\\\\t ][^\\\\n\\\\r]*|)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","hidden":true,"name":"WHITESPACE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]+/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"YAML","definition":{"$type":"RegexToken","regex":"/---[\\\\t ]*\\\\r?\\\\n(?:[\\\\S\\\\s]*?\\\\r?\\\\n)?---(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"DIRECTIVE","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%{[\\\\S\\\\s]*?}%%(?:\\\\r?\\\\n|(?!\\\\S))/"},"fragment":false},{"$type":"TerminalRule","hidden":true,"name":"SINGLE_LINE_COMMENT","definition":{"$type":"RegexToken","regex":"/[\\\\t ]*%%[^\\\\n\\\\r]*/"},"fragment":false},{"$type":"ParserRule","name":"GitGraph","entry":true,"definition":{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"Keyword","value":":"}]},{"$type":"Keyword","value":"gitGraph:"},{"$type":"Group","elements":[{"$type":"Keyword","value":"gitGraph"},{"$type":"RuleCall","rule":{"$ref":"#/rules@12"},"arguments":[]},{"$type":"Keyword","value":":"}]}]},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Group","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[],"cardinality":"*"},{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@0"},"arguments":[]},{"$type":"Assignment","feature":"statements","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@11"},"arguments":[]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@2"},"arguments":[]}],"cardinality":"*"}]}]},"definesHiddenTokens":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Statement","definition":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@13"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@14"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@15"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@16"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@17"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Direction","definition":{"$type":"Assignment","feature":"dir","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"LR"},{"$type":"Keyword","value":"TB"},{"$type":"Keyword","value":"BT"}]}},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Commit","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"commit"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"msg:","cardinality":"?"},{"$type":"Assignment","feature":"message","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Branch","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"branch"},{"$type":"Assignment","feature":"name","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Group","elements":[{"$type":"Keyword","value":"order:"},{"$type":"Assignment","feature":"order","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@18"},"arguments":[]}}],"cardinality":"?"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Merge","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"merge"},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"type:"},{"$type":"Assignment","feature":"type","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"NORMAL"},{"$type":"Keyword","value":"REVERSE"},{"$type":"Keyword","value":"HIGHLIGHT"}]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"Checkout","definition":{"$type":"Group","elements":[{"$type":"Alternatives","elements":[{"$type":"Keyword","value":"checkout"},{"$type":"Keyword","value":"switch"}]},{"$type":"Assignment","feature":"branch","operator":"=","terminal":{"$type":"Alternatives","elements":[{"$type":"RuleCall","rule":{"$ref":"#/rules@19"},"arguments":[]},{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}]}},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"ParserRule","name":"CherryPicking","definition":{"$type":"Group","elements":[{"$type":"Keyword","value":"cherry-pick"},{"$type":"Alternatives","elements":[{"$type":"Group","elements":[{"$type":"Keyword","value":"id:"},{"$type":"Assignment","feature":"id","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"tag:"},{"$type":"Assignment","feature":"tags","operator":"+=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]},{"$type":"Group","elements":[{"$type":"Keyword","value":"parent:"},{"$type":"Assignment","feature":"parent","operator":"=","terminal":{"$type":"RuleCall","rule":{"$ref":"#/rules@20"},"arguments":[]}}]}],"cardinality":"*"},{"$type":"RuleCall","rule":{"$ref":"#/rules@1"},"arguments":[]}]},"definesHiddenTokens":false,"entry":false,"fragment":false,"hiddenTokens":[],"parameters":[],"wildcard":false},{"$type":"TerminalRule","name":"INT","type":{"$type":"ReturnType","name":"number"},"definition":{"$type":"RegexToken","regex":"/[0-9]+(?=\\\\s)/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"ID","type":{"$type":"ReturnType","name":"string"},"definition":{"$type":"RegexToken","regex":"/\\\\w([-\\\\./\\\\w]*[-\\\\w])?/"},"fragment":false,"hidden":false},{"$type":"TerminalRule","name":"STRING","definition":{"$type":"RegexToken","regex":"/\\"[^\\"]*\\"|'[^']*'/"},"fragment":false,"hidden":false}],"definesHiddenTokens":false,"hiddenTokens":[],"imports":[],"types":[],"usedGrammars":[]}`)),"GitGraphGrammar"),HC={languageId:"info",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},WC={languageId:"packet",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},zC={languageId:"pie",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},KC={languageId:"architecture",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},VC={languageId:"gitGraph",fileExtensions:[".mmd",".mermaid"],caseInsensitive:!1},gr={AstReflection:I(()=>new ph,"AstReflection")},qC={Grammar:I(()=>FC(),"Grammar"),LanguageMetaData:I(()=>HC,"LanguageMetaData"),parser:{}},YC={Grammar:I(()=>GC(),"Grammar"),LanguageMetaData:I(()=>WC,"LanguageMetaData"),parser:{}},XC={Grammar:I(()=>UC(),"Grammar"),LanguageMetaData:I(()=>zC,"LanguageMetaData"),parser:{}},JC={Grammar:I(()=>BC(),"Grammar"),LanguageMetaData:I(()=>KC,"LanguageMetaData"),parser:{}},QC={Grammar:I(()=>jC(),"Grammar"),LanguageMetaData:I(()=>VC,"LanguageMetaData"),parser:{}},ZC=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,ew=/accTitle[\t ]*:([^\n\r]*)/,tw=/title([\t ][^\n\r]*|)/,nw={ACC_DESCR:ZC,ACC_TITLE:ew,TITLE:tw},Kn,Va=(Kn=class extends Xd{runConverter(e,n,r){let i=this.runCommonConverter(e,n,r);return i===void 0&&(i=this.runCustomConverter(e,n,r)),i===void 0?super.runConverter(e,n,r):i}runCommonConverter(e,n,r){const i=nw[e.name];if(i===void 0)return;const s=i.exec(n);if(s!==null){if(s[1]!==void 0)return s[1].trim().replace(/[\t ]{2,}/gm," ");if(s[2]!==void 0)return s[2].replace(/^\s*/gm,"").replace(/\s+$/gm,"").replace(/[\t ]{2,}/gm," ").replace(/[\n\r]{2,}/gm,`
|
|
125
|
+
`)}}},I(Kn,"AbstractMermaidValueConverter"),Kn),Vn,qa=(Vn=class extends Va{runCustomConverter(e,n,r){}},I(Vn,"CommonValueConverter"),Vn),qn,$n=(qn=class extends Yd{constructor(e){super(),this.keywords=new Set(e)}buildKeywordTokens(e,n,r){const i=super.buildKeywordTokens(e,n,r);return i.forEach(s=>{this.keywords.has(s.name)&&s.PATTERN!==void 0&&(s.PATTERN=new RegExp(s.PATTERN.toString()+"(?:(?=%%)|(?!\\S))"))}),i}},I(qn,"AbstractMermaidTokenBuilder"),qn),Yn;Yn=class extends $n{},I(Yn,"CommonTokenBuilder");var Xn,rw=(Xn=class extends $n{constructor(){super(["gitGraph"])}},I(Xn,"GitGraphTokenBuilder"),Xn),gh={parser:{TokenBuilder:I(()=>new rw,"TokenBuilder"),ValueConverter:I(()=>new qa,"ValueConverter")}};function mh(t=Rn){const e=Le(En(t),gr),n=Le(An({shared:e}),QC,gh);return e.ServiceRegistry.register(n),{shared:e,GitGraph:n}}I(mh,"createGitGraphServices");var Jn,iw=(Jn=class extends $n{constructor(){super(["info","showInfo"])}},I(Jn,"InfoTokenBuilder"),Jn),yh={parser:{TokenBuilder:I(()=>new iw,"TokenBuilder"),ValueConverter:I(()=>new qa,"ValueConverter")}};function Th(t=Rn){const e=Le(En(t),gr),n=Le(An({shared:e}),qC,yh);return e.ServiceRegistry.register(n),{shared:e,Info:n}}I(Th,"createInfoServices");var Qn,sw=(Qn=class extends $n{constructor(){super(["packet-beta"])}},I(Qn,"PacketTokenBuilder"),Qn),vh={parser:{TokenBuilder:I(()=>new sw,"TokenBuilder"),ValueConverter:I(()=>new qa,"ValueConverter")}};function Ah(t=Rn){const e=Le(En(t),gr),n=Le(An({shared:e}),YC,vh);return e.ServiceRegistry.register(n),{shared:e,Packet:n}}I(Ah,"createPacketServices");var Zn,aw=(Zn=class extends $n{constructor(){super(["pie","showData"])}},I(Zn,"PieTokenBuilder"),Zn),er,ow=(er=class extends Va{runCustomConverter(e,n,r){if(e.name==="PIE_SECTION_LABEL")return n.replace(/"/g,"").trim()}},I(er,"PieValueConverter"),er),Eh={parser:{TokenBuilder:I(()=>new aw,"TokenBuilder"),ValueConverter:I(()=>new ow,"ValueConverter")}};function Rh(t=Rn){const e=Le(En(t),gr),n=Le(An({shared:e}),XC,Eh);return e.ServiceRegistry.register(n),{shared:e,Pie:n}}I(Rh,"createPieServices");var tr,cw=(tr=class extends $n{constructor(){super(["architecture"])}},I(tr,"ArchitectureTokenBuilder"),tr),nr,uw=(nr=class extends Va{runCustomConverter(e,n,r){if(e.name==="ARCH_ICON")return n.replace(/[()]/g,"").trim();if(e.name==="ARCH_TEXT_ICON")return n.replace(/["()]/g,"");if(e.name==="ARCH_TITLE")return n.replace(/[[\]]/g,"").trim()}},I(nr,"ArchitectureValueConverter"),nr),$h={parser:{TokenBuilder:I(()=>new cw,"TokenBuilder"),ValueConverter:I(()=>new uw,"ValueConverter")}};function Sh(t=Rn){const e=Le(En(t),gr),n=Le(An({shared:e}),JC,$h);return e.ServiceRegistry.register(n),{shared:e,Architecture:n}}I(Sh,"createArchitectureServices");var Ot={},lw={info:I(async()=>{const{createInfoServices:t}=await Sn(()=>Promise.resolve().then(()=>hw),void 0),e=t().Info.parser.LangiumParser;Ot.info=e},"info"),packet:I(async()=>{const{createPacketServices:t}=await Sn(()=>Promise.resolve().then(()=>pw),void 0),e=t().Packet.parser.LangiumParser;Ot.packet=e},"packet"),pie:I(async()=>{const{createPieServices:t}=await Sn(()=>Promise.resolve().then(()=>gw),void 0),e=t().Pie.parser.LangiumParser;Ot.pie=e},"pie"),architecture:I(async()=>{const{createArchitectureServices:t}=await Sn(()=>Promise.resolve().then(()=>mw),void 0),e=t().Architecture.parser.LangiumParser;Ot.architecture=e},"architecture"),gitGraph:I(async()=>{const{createGitGraphServices:t}=await Sn(()=>Promise.resolve().then(()=>yw),void 0),e=t().GitGraph.parser.LangiumParser;Ot.gitGraph=e},"gitGraph")};async function fw(t,e){const n=lw[t];if(!n)throw new Error(`Unknown diagram type: ${t}`);Ot[t]||await n();const i=Ot[t].parse(e);if(i.lexerErrors.length>0||i.parserErrors.length>0)throw new dw(i);return i.value}I(fw,"parse");var rr,dw=(rr=class extends Error{constructor(e){const n=e.lexerErrors.map(i=>i.message).join(`
|
|
126
|
+
`),r=e.parserErrors.map(i=>i.message).join(`
|
|
127
|
+
`);super(`Parsing failed: ${n} ${r}`),this.result=e}},I(rr,"MermaidParseError"),rr);const hw=Object.freeze(Object.defineProperty({__proto__:null,InfoModule:yh,createInfoServices:Th},Symbol.toStringTag,{value:"Module"})),pw=Object.freeze(Object.defineProperty({__proto__:null,PacketModule:vh,createPacketServices:Ah},Symbol.toStringTag,{value:"Module"})),gw=Object.freeze(Object.defineProperty({__proto__:null,PieModule:Eh,createPieServices:Rh},Symbol.toStringTag,{value:"Module"})),mw=Object.freeze(Object.defineProperty({__proto__:null,ArchitectureModule:$h,createArchitectureServices:Sh},Symbol.toStringTag,{value:"Module"})),yw=Object.freeze(Object.defineProperty({__proto__:null,GitGraphModule:gh,createGitGraphServices:mh},Symbol.toStringTag,{value:"Module"}));export{fw as p};
|
|
128
|
+
function __vite__mapDeps(indexes) {
|
|
129
|
+
if (!__vite__mapDeps.viteFileDeps) {
|
|
130
|
+
__vite__mapDeps.viteFileDeps = []
|
|
131
|
+
}
|
|
132
|
+
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
|
133
|
+
}
|