UNPKG

prettier-plugin-solidity

Version:

A Prettier Plugin for automatically formatting your Solidity code.

1 lines 763 kB
var t,e,r,s,i,n={3121(t){var e;"undefined"!=typeof globalThis||"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self&&self,e=()=>{var t=(()=>{var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i={};((e,r)=>{for(var s in r)t(e,s,{get:r[s],enumerable:!0})})(i,{ParserError:()=>Oe,default:()=>Fe,parse:()=>Pe,tokenize:()=>De,visit:()=>qe});var n={92:()=>{}},a={};function o(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={exports:{}};return n[t](r,r.exports,o),r.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var c={};(()=>{o.d(c,{dx:()=>W,q2:()=>At,FO:()=>Ee,xf:()=>ke,Gy:()=>Le,s4:()=>Nt,c7:()=>Oe,_7:()=>ce,tx:()=>_e,gp:()=>xe,cK:()=>Ct,zs:()=>ge,AV:()=>ke,Xp:()=>x,VS:()=>v,ul:()=>z,hW:()=>Mt,x1:()=>Xt,z5:()=>ee,oN:()=>de,TB:()=>pe,u1:()=>me,_b:()=>Pe,$F:()=>se,_T:()=>Fe,db:()=>ie,Zx:()=>te,_x:()=>Pt,r8:()=>q,JI:()=>K,TP:()=>N,WU:()=>t,Nj:()=>h,ZP:()=>Xe});class t{constructor(){this.source=null,this.type=null,this.channel=null,this.start=null,this.stop=null,this.tokenIndex=null,this.line=null,this.column=null,this._text=null}getTokenSource(){return this.source[0]}getInputStream(){return this.source[1]}get text(){return this._text}set text(t){this._text=t}}function e(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!(t[r]===e[r]||t[r].equals&&t[r].equals(e[r])))return!1;return!0}t.INVALID_TYPE=0,t.EPSILON=-2,t.MIN_USER_TOKEN_TYPE=1,t.EOF=-1,t.DEFAULT_CHANNEL=0,t.HIDDEN_CHANNEL=1;const r=Math.round(Math.random()*Math.pow(2,32));function s(t){if(!t)return 0;const e=typeof t,s="string"===e?t:!("object"!==e||!t.toString)&&t.toString();if(!s)return 0;let i,n;const a=3&s.length,o=s.length-a;let c=r;const l=3432918353,h=461845907;let u=0;for(;u<o;)n=255&s.charCodeAt(u)|(255&s.charCodeAt(++u))<<8|(255&s.charCodeAt(++u))<<16|(255&s.charCodeAt(++u))<<24,++u,n=(65535&n)*l+(((n>>>16)*l&65535)<<16)&4294967295,n=n<<15|n>>>17,n=(65535&n)*h+(((n>>>16)*h&65535)<<16)&4294967295,c^=n,c=c<<13|c>>>19,i=5*(65535&c)+((5*(c>>>16)&65535)<<16)&4294967295,c=27492+(65535&i)+((58964+(i>>>16)&65535)<<16);switch(n=0,a){case 3:n^=(255&s.charCodeAt(u+2))<<16;case 2:n^=(255&s.charCodeAt(u+1))<<8;case 1:n^=255&s.charCodeAt(u),n=(65535&n)*l+(((n>>>16)*l&65535)<<16)&4294967295,n=n<<15|n>>>17,n=(65535&n)*h+(((n>>>16)*h&65535)<<16)&4294967295,c^=n}return c^=s.length,c^=c>>>16,c=2246822507*(65535&c)+((2246822507*(c>>>16)&65535)<<16)&4294967295,c^=c>>>13,c=3266489909*(65535&c)+((3266489909*(c>>>16)&65535)<<16)&4294967295,c^=c>>>16,c>>>0}class i{constructor(){this.count=0,this.hash=0}update(){for(let t=0;t<arguments.length;t++){const e=arguments[t];if(null!=e)if(Array.isArray(e))this.update.apply(this,e);else{let t=0;switch(typeof e){case"undefined":case"function":continue;case"number":case"boolean":t=e;break;case"string":t=s(e);break;default:e.updateHashCode?e.updateHashCode(this):console.log("No updateHashCode for "+e.toString());continue}t*=3432918353,t=t<<15|t>>>17,t*=461845907,this.count=this.count+1;let r=this.hash^t;r=r<<13|r>>>19,r=5*r+3864292196,this.hash=r}}}finish(){let t=this.hash^4*this.count;return t^=t>>>16,t*=2246822507,t^=t>>>13,t*=3266489909,t^=t>>>16,t}static hashStuff(){const t=new i;return t.update.apply(t,arguments),t.finish()}}function n(t){return t?"string"==typeof t?s(t):t.hashCode():-1}function a(t,e){return t?t.equals(e):t===e}function l(t){return null===t?"null":t}function h(t){return Array.isArray(t)?"["+t.map(l).join(", ")+"]":"null"}const u="h-";class d{constructor(t,e){this.data={},this.hashFunction=t||n,this.equalsFunction=e||a}add(t){const e=u+this.hashFunction(t);if(e in this.data){const r=this.data[e];for(let e=0;e<r.length;e++)if(this.equalsFunction(t,r[e]))return r[e];return r.push(t),t}return this.data[e]=[t],t}has(t){return null!=this.get(t)}get(t){const e=u+this.hashFunction(t);if(e in this.data){const r=this.data[e];for(let e=0;e<r.length;e++)if(this.equalsFunction(t,r[e]))return r[e]}return null}values(){return Object.keys(this.data).filter(t=>t.startsWith(u)).flatMap(t=>this.data[t],this)}toString(){return h(this.values())}get length(){return Object.keys(this.data).filter(t=>t.startsWith(u)).map(t=>this.data[t].length,this).reduce((t,e)=>t+e,0)}}class p{hashCode(){const t=new i;return this.updateHashCode(t),t.finish()}evaluate(t,e){}evalPrecedence(t,e){return this}static andContext(t,e){if(null===t||t===p.NONE)return e;if(null===e||e===p.NONE)return t;const r=new m(t,e);return 1===r.opnds.length?r.opnds[0]:r}static orContext(t,e){if(null===t)return e;if(null===e)return t;if(t===p.NONE||e===p.NONE)return p.NONE;const r=new y(t,e);return 1===r.opnds.length?r.opnds[0]:r}}class m extends p{constructor(t,e){super();const r=new d;t instanceof m?t.opnds.map(function(t){r.add(t)}):r.add(t),e instanceof m?e.opnds.map(function(t){r.add(t)}):r.add(e);const s=f(r);if(s.length>0){let t=null;s.map(function(e){(null===t||e.precedence<t.precedence)&&(t=e)}),r.add(t)}this.opnds=Array.from(r.values())}equals(t){return this===t||t instanceof m&&e(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"AND")}evaluate(t,e){for(let r=0;r<this.opnds.length;r++)if(!this.opnds[r].evaluate(t,e))return!1;return!0}evalPrecedence(t,e){let r=!1;const s=[];for(let i=0;i<this.opnds.length;i++){const n=this.opnds[i],a=n.evalPrecedence(t,e);if(r|=a!==n,null===a)return null;a!==p.NONE&&s.push(a)}if(!r)return this;if(0===s.length)return p.NONE;let i=null;return s.map(function(t){i=null===i?t:p.andContext(i,t)}),i}toString(){const t=this.opnds.map(t=>t.toString());return(t.length>3?t.slice(3):t).join("&&")}}class y extends p{constructor(t,e){super();const r=new d;t instanceof y?t.opnds.map(function(t){r.add(t)}):r.add(t),e instanceof y?e.opnds.map(function(t){r.add(t)}):r.add(e);const s=f(r);if(s.length>0){const t=s.sort(function(t,e){return t.compareTo(e)}),e=t[t.length-1];r.add(e)}this.opnds=Array.from(r.values())}equals(t){return this===t||t instanceof y&&e(this.opnds,t.opnds)}updateHashCode(t){t.update(this.opnds,"OR")}evaluate(t,e){for(let r=0;r<this.opnds.length;r++)if(this.opnds[r].evaluate(t,e))return!0;return!1}evalPrecedence(t,e){let r=!1;const s=[];for(let i=0;i<this.opnds.length;i++){const n=this.opnds[i],a=n.evalPrecedence(t,e);if(r|=a!==n,a===p.NONE)return p.NONE;null!==a&&s.push(a)}return r?(0===s.length||s.map(function(t){return t}),null):this}toString(){const t=this.opnds.map(t=>t.toString());return(t.length>3?t.slice(3):t).join("||")}}function f(t){const e=[];return t.values().map(function(t){t instanceof p.PrecedencePredicate&&e.push(t)}),e}function g(t,e){if(null===t){const t={state:null,alt:null,context:null,semanticContext:null};return e&&(t.reachesIntoOuterContext=0),t}{const r={};return r.state=t.state||null,r.alt=void 0===t.alt?null:t.alt,r.context=t.context||null,r.semanticContext=t.semanticContext||null,e&&(r.reachesIntoOuterContext=t.reachesIntoOuterContext||0,r.precedenceFilterSuppressed=t.precedenceFilterSuppressed||!1),r}}class w{constructor(t,e){this.checkContext(t,e),t=g(t),e=g(e,!0),this.state=null!==t.state?t.state:e.state,this.alt=null!==t.alt?t.alt:e.alt,this.context=null!==t.context?t.context:e.context,this.semanticContext=null!==t.semanticContext?t.semanticContext:null!==e.semanticContext?e.semanticContext:p.NONE,this.reachesIntoOuterContext=e.reachesIntoOuterContext,this.precedenceFilterSuppressed=e.precedenceFilterSuppressed}checkContext(t,e){null!==t.context&&void 0!==t.context||null!==e&&null!==e.context&&void 0!==e.context||(this.context=null)}hashCode(){const t=new i;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)}equals(t){return this===t||t instanceof w&&this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&(null===this.context?null===t.context:this.context.equals(t.context))&&this.semanticContext.equals(t.semanticContext)&&this.precedenceFilterSuppressed===t.precedenceFilterSuppressed}hashCodeForConfigSet(){const t=new i;return t.update(this.state.stateNumber,this.alt,this.semanticContext),t.finish()}equalsForConfigSet(t){return this===t||t instanceof w&&this.state.stateNumber===t.state.stateNumber&&this.alt===t.alt&&this.semanticContext.equals(t.semanticContext)}toString(){return"("+this.state+","+this.alt+(null!==this.context?",["+this.context.toString()+"]":"")+(this.semanticContext!==p.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class x{constructor(t,e){this.start=t,this.stop=e}clone(){return new x(this.start,this.stop)}contains(t){return t>=this.start&&t<this.stop}toString(){return this.start===this.stop-1?this.start.toString():this.start.toString()+".."+(this.stop-1).toString()}get length(){return this.stop-this.start}}x.INVALID_INTERVAL=new x(-1,-2);class v{constructor(){this.intervals=null,this.readOnly=!1}first(e){return null===this.intervals||0===this.intervals.length?t.INVALID_TYPE:this.intervals[0].start}addOne(t){this.addInterval(new x(t,t+1))}addRange(t,e){this.addInterval(new x(t,e+1))}addInterval(t){if(null===this.intervals)this.intervals=[],this.intervals.push(t.clone());else{for(let e=0;e<this.intervals.length;e++){const r=this.intervals[e];if(t.stop<r.start)return void this.intervals.splice(e,0,t);if(t.stop===r.start)return void(this.intervals[e]=new x(t.start,r.stop));if(t.start<=r.stop)return this.intervals[e]=new x(Math.min(r.start,t.start),Math.max(r.stop,t.stop)),void this.reduce(e)}this.intervals.push(t.clone())}}addSet(t){return null!==t.intervals&&t.intervals.forEach(t=>this.addInterval(t),this),this}reduce(t){if(t<this.intervals.length-1){const e=this.intervals[t],r=this.intervals[t+1];e.stop>=r.stop?(this.intervals.splice(t+1,1),this.reduce(t)):e.stop>=r.start&&(this.intervals[t]=new x(e.start,r.stop),this.intervals.splice(t+1,1))}}complement(t,e){const r=new v;return r.addInterval(new x(t,e+1)),null!==this.intervals&&this.intervals.forEach(t=>r.removeRange(t)),r}contains(t){if(null===this.intervals)return!1;for(let e=0;e<this.intervals.length;e++)if(this.intervals[e].contains(t))return!0;return!1}removeRange(t){if(t.start===t.stop-1)this.removeOne(t.start);else if(null!==this.intervals){let e=0;for(let r=0;r<this.intervals.length;r++){const r=this.intervals[e];if(t.stop<=r.start)return;if(t.start>r.start&&t.stop<r.stop){this.intervals[e]=new x(r.start,t.start);const s=new x(t.stop,r.stop);return void this.intervals.splice(e,0,s)}t.start<=r.start&&t.stop>=r.stop?(this.intervals.splice(e,1),e-=1):t.start<r.stop?this.intervals[e]=new x(r.start,t.start):t.stop<r.stop&&(this.intervals[e]=new x(t.stop,r.stop)),e+=1}}}removeOne(t){if(null!==this.intervals)for(let e=0;e<this.intervals.length;e++){const r=this.intervals[e];if(t<r.start)return;if(t===r.start&&t===r.stop-1)return void this.intervals.splice(e,1);if(t===r.start)return void(this.intervals[e]=new x(r.start+1,r.stop));if(t===r.stop-1)return void(this.intervals[e]=new x(r.start,r.stop-1));if(t<r.stop-1){const s=new x(r.start,t);return r.start=t+1,void this.intervals.splice(e,0,s)}}}toString(t,e,r){return t=t||null,e=e||null,r=r||!1,null===this.intervals?"{}":null!==t||null!==e?this.toTokenString(t,e):r?this.toCharString():this.toIndexString()}toCharString(){const e=[];for(let r=0;r<this.intervals.length;r++){const s=this.intervals[r];s.stop===s.start+1?s.start===t.EOF?e.push("<EOF>"):e.push("'"+String.fromCharCode(s.start)+"'"):e.push("'"+String.fromCharCode(s.start)+"'..'"+String.fromCharCode(s.stop-1)+"'")}return e.length>1?"{"+e.join(", ")+"}":e[0]}toIndexString(){const e=[];for(let r=0;r<this.intervals.length;r++){const s=this.intervals[r];s.stop===s.start+1?s.start===t.EOF?e.push("<EOF>"):e.push(s.start.toString()):e.push(s.start.toString()+".."+(s.stop-1).toString())}return e.length>1?"{"+e.join(", ")+"}":e[0]}toTokenString(t,e){const r=[];for(let s=0;s<this.intervals.length;s++){const i=this.intervals[s];for(let s=i.start;s<i.stop;s++)r.push(this.elementName(t,e,s))}return r.length>1?"{"+r.join(", ")+"}":r[0]}elementName(e,r,s){return s===t.EOF?"<EOF>":s===t.EPSILON?"<EPSILON>":e[s]||r[s]}get length(){return this.intervals.map(t=>t.length).reduce((t,e)=>t+e)}}class b{constructor(){this.atn=null,this.stateNumber=b.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null}toString(){return this.stateNumber}equals(t){return t instanceof b&&this.stateNumber===t.stateNumber}isNonGreedyExitState(){return!1}addTransition(t,e){void 0===e&&(e=-1),0===this.transitions.length?this.epsilonOnlyTransitions=t.isEpsilon:this.epsilonOnlyTransitions!==t.isEpsilon&&(this.epsilonOnlyTransitions=!1),-1===e?this.transitions.push(t):this.transitions.splice(e,1,t)}}b.INVALID_TYPE=0,b.BASIC=1,b.RULE_START=2,b.BLOCK_START=3,b.PLUS_BLOCK_START=4,b.STAR_BLOCK_START=5,b.TOKEN_START=6,b.RULE_STOP=7,b.BLOCK_END=8,b.STAR_LOOP_BACK=9,b.STAR_LOOP_ENTRY=10,b.PLUS_LOOP_BACK=11,b.LOOP_END=12,b.serializationNames=["INVALID","BASIC","RULE_START","BLOCK_START","PLUS_BLOCK_START","STAR_BLOCK_START","TOKEN_START","RULE_STOP","BLOCK_END","STAR_LOOP_BACK","STAR_LOOP_ENTRY","PLUS_LOOP_BACK","LOOP_END"],b.INVALID_STATE_NUMBER=-1;class _ extends b{constructor(){return super(),this.stateType=b.RULE_STOP,this}}class E{constructor(t){if(null==t)throw"target cannot be null.";this.target=t,this.isEpsilon=!1,this.label=null}}E.EPSILON=1,E.RANGE=2,E.RULE=3,E.PREDICATE=4,E.ATOM=5,E.ACTION=6,E.SET=7,E.NOT_SET=8,E.WILDCARD=9,E.PRECEDENCE=10,E.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],E.serializationTypes={EpsilonTransition:E.EPSILON,RangeTransition:E.RANGE,RuleTransition:E.RULE,PredicateTransition:E.PREDICATE,AtomTransition:E.ATOM,ActionTransition:E.ACTION,SetTransition:E.SET,NotSetTransition:E.NOT_SET,WildcardTransition:E.WILDCARD,PrecedencePredicateTransition:E.PRECEDENCE};class T extends E{constructor(t,e,r,s){super(t),this.ruleIndex=e,this.precedence=r,this.followState=s,this.serializationType=E.RULE,this.isEpsilon=!0}matches(t,e,r){return!1}}class S extends E{constructor(e,r){super(e),this.serializationType=E.SET,null!=r?this.label=r:(this.label=new v,this.label.addOne(t.INVALID_TYPE))}matches(t,e,r){return this.label.contains(t)}toString(){return this.label.toString()}}class k extends S{constructor(t,e){super(t,e),this.serializationType=E.NOT_SET}matches(t,e,r){return t>=e&&t<=r&&!super.matches(t,e,r)}toString(){return"~"+super.toString()}}class R extends E{constructor(t){super(t),this.serializationType=E.WILDCARD}matches(t,e,r){return t>=e&&t<=r}toString(){return"."}}class A extends E{constructor(t){super(t)}}class C{}class L extends C{}class I extends L{}class K extends I{get ruleContext(){throw new Error("missing interface implementation")}}class N extends I{}class O extends N{}const D={toStringTree:function(t,e,r){e=e||null,null!==(r=r||null)&&(e=r.ruleNames);let s=D.getNodeText(t,e);s=s.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r");const i=t.getChildCount();if(0===i)return s;let n="("+s+" ";i>0&&(s=D.toStringTree(t.getChild(0),e),n=n.concat(s));for(let r=1;r<i;r++)s=D.toStringTree(t.getChild(r),e),n=n.concat(" "+s);return n=n.concat(")"),n},getNodeText:function(e,r,s){if(r=r||null,null!==(s=s||null)&&(r=s.ruleNames),null!==r){if(e instanceof K){const t=e.ruleContext.getAltNumber();return 0!=t?r[e.ruleIndex]+":"+t:r[e.ruleIndex]}if(e instanceof O)return e.toString();if(e instanceof N&&null!==e.symbol)return e.symbol.text}const i=e.getPayload();return i instanceof t?i.text:e.getPayload().toString()},getChildren:function(t){const e=[];for(let r=0;r<t.getChildCount();r++)e.push(t.getChild(r));return e},getAncestors:function(t){let e=[];for(t=t.getParent();null!==t;)e=[t].concat(e),t=t.getParent();return e},findAllTokenNodes:function(t,e){return D.findAllNodes(t,e,!0)},findAllRuleNodes:function(t,e){return D.findAllNodes(t,e,!1)},findAllNodes:function(t,e,r){const s=[];return D._findAllNodes(t,e,r,s),s},_findAllNodes:function(t,e,r,s){r&&t instanceof N?t.symbol.type===e&&s.push(t):!r&&t instanceof K&&t.ruleIndex===e&&s.push(t);for(let i=0;i<t.getChildCount();i++)D._findAllNodes(t.getChild(i),e,r,s)},descendants:function(t){let e=[t];for(let r=0;r<t.getChildCount();r++)e=e.concat(D.descendants(t.getChild(r)));return e}},P=D;class q extends K{constructor(t,e){super(),this.parentCtx=t||null,this.invokingState=e||-1}depth(){let t=0,e=this;for(;null!==e;)e=e.parentCtx,t+=1;return t}isEmpty(){return-1===this.invokingState}getSourceInterval(){return x.INVALID_INTERVAL}get ruleContext(){return this}getPayload(){return this}getText(){return 0===this.getChildCount()?"":this.children.map(function(t){return t.getText()}).join("")}getAltNumber(){return 0}setAltNumber(t){}getChild(t){return null}getChildCount(){return 0}accept(t){return t.visitChildren(this)}toStringTree(t,e){return P.toStringTree(this,t,e)}toString(t,e){t=t||null,e=e||null;let r=this,s="[";for(;null!==r&&r!==e;){if(null===t)r.isEmpty()||(s+=r.invokingState);else{const e=r.ruleIndex;s+=e>=0&&e<t.length?t[e]:""+e}null===r.parentCtx||null===t&&r.parentCtx.isEmpty()||(s+=" "),r=r.parentCtx}return s+="]",s}}class M{constructor(t){this.cachedHashCode=t}isEmpty(){return this===M.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===M.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(t){t.update(this.cachedHashCode)}}M.EMPTY=null,M.EMPTY_RETURN_STATE=2147483647,M.globalNodeCount=1,M.id=M.globalNodeCount,M.trace_atn_sim=!1;class F extends M{constructor(t,e){const r=new i;return r.update(t,e),super(r.finish()),this.parents=t,this.returnStates=e,this}isEmpty(){return this.returnStates[0]===M.EMPTY_RETURN_STATE}getParent(t){return this.parents[t]}getReturnState(t){return this.returnStates[t]}equals(t){return this===t||t instanceof F&&this.hashCode()===t.hashCode()&&e(this.returnStates,t.returnStates)&&e(this.parents,t.parents)}toString(){if(this.isEmpty())return"[]";{let t="[";for(let e=0;e<this.returnStates.length;e++)e>0&&(t+=", "),this.returnStates[e]!==M.EMPTY_RETURN_STATE?(t+=this.returnStates[e],null!==this.parents[e]?t=t+" "+this.parents[e]:t+="null"):t+="$";return t+"]"}}get length(){return this.returnStates.length}}class U extends M{constructor(t,e){let r=0;const s=new i;null!==t?s.update(t,e):s.update(1),r=s.finish(),super(r),this.parentCtx=t,this.returnState=e}getParent(t){return this.parentCtx}getReturnState(t){return this.returnState}equals(t){return this===t||t instanceof U&&this.hashCode()===t.hashCode()&&this.returnState===t.returnState&&(null==this.parentCtx?null==t.parentCtx:this.parentCtx.equals(t.parentCtx))}toString(){const t=null===this.parentCtx?"":this.parentCtx.toString();return 0===t.length?this.returnState===M.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+t}get length(){return 1}static create(t,e){return e===M.EMPTY_RETURN_STATE&&null===t?M.EMPTY:new U(t,e)}}class Y extends U{constructor(){super(null,M.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(t){return null}getReturnState(t){return this.returnState}equals(t){return this===t}toString(){return"$"}}M.EMPTY=new Y;const V="h-";class j{constructor(t,e){this.data={},this.hashFunction=t||n,this.equalsFunction=e||a}set(t,e){const r=V+this.hashFunction(t);if(r in this.data){const s=this.data[r];for(let r=0;r<s.length;r++){const i=s[r];if(this.equalsFunction(t,i.key)){const t=i.value;return i.value=e,t}}return s.push({key:t,value:e}),e}return this.data[r]=[{key:t,value:e}],e}containsKey(t){const e=V+this.hashFunction(t);if(e in this.data){const r=this.data[e];for(let e=0;e<r.length;e++){const s=r[e];if(this.equalsFunction(t,s.key))return!0}}return!1}get(t){const e=V+this.hashFunction(t);if(e in this.data){const r=this.data[e];for(let e=0;e<r.length;e++){const s=r[e];if(this.equalsFunction(t,s.key))return s.value}}return null}entries(){return Object.keys(this.data).filter(t=>t.startsWith(V)).flatMap(t=>this.data[t],this)}getKeys(){return this.entries().map(t=>t.key)}getValues(){return this.entries().map(t=>t.value)}toString(){return"["+this.entries().map(t=>"{"+t.key+":"+t.value+"}").join(", ")+"]"}get length(){return Object.keys(this.data).filter(t=>t.startsWith(V)).map(t=>this.data[t].length,this).reduce((t,e)=>t+e,0)}}function B(t,e){if(null==e&&(e=q.EMPTY),null===e.parentCtx||e===q.EMPTY)return M.EMPTY;const r=B(t,e.parentCtx),s=t.states[e.invokingState].transitions[0];return U.create(r,s.followState.stateNumber)}function H(t,e,r){if(t.isEmpty())return t;let s=r.get(t)||null;if(null!==s)return s;if(s=e.get(t),null!==s)return r.set(t,s),s;let i=!1,n=[];for(let s=0;s<n.length;s++){const a=H(t.getParent(s),e,r);if(i||a!==t.getParent(s)){if(!i){n=[];for(let e=0;e<t.length;e++)n[e]=t.getParent(e);i=!0}n[s]=a}}if(!i)return e.add(t),r.set(t,t),t;let a=null;return a=0===n.length?M.EMPTY:1===n.length?U.create(n[0],t.getReturnState(0)):new F(n,t.returnStates),e.add(a),r.set(a,a),r.set(t,a),a}function $(t,e,r,s){if(t===e)return t;if(t instanceof U&&e instanceof U)return function(t,e,r,s){if(null!==s){let r=s.get(t,e);if(null!==r)return r;if(r=s.get(e,t),null!==r)return r}const i=function(t,e,r){if(r){if(t===M.EMPTY)return M.EMPTY;if(e===M.EMPTY)return M.EMPTY}else{if(t===M.EMPTY&&e===M.EMPTY)return M.EMPTY;if(t===M.EMPTY){const t=[e.returnState,M.EMPTY_RETURN_STATE],r=[e.parentCtx,null];return new F(r,t)}if(e===M.EMPTY){const e=[t.returnState,M.EMPTY_RETURN_STATE],r=[t.parentCtx,null];return new F(r,e)}}return null}(t,e,r);if(null!==i)return null!==s&&s.set(t,e,i),i;if(t.returnState===e.returnState){const i=$(t.parentCtx,e.parentCtx,r,s);if(i===t.parentCtx)return t;if(i===e.parentCtx)return e;const n=U.create(i,t.returnState);return null!==s&&s.set(t,e,n),n}{let r=null;if((t===e||null!==t.parentCtx&&t.parentCtx===e.parentCtx)&&(r=t.parentCtx),null!==r){const i=[t.returnState,e.returnState];t.returnState>e.returnState&&(i[0]=e.returnState,i[1]=t.returnState);const n=new F([r,r],i);return null!==s&&s.set(t,e,n),n}const i=[t.returnState,e.returnState];let n=[t.parentCtx,e.parentCtx];t.returnState>e.returnState&&(i[0]=e.returnState,i[1]=t.returnState,n=[e.parentCtx,t.parentCtx]);const a=new F(n,i);return null!==s&&s.set(t,e,a),a}}(t,e,r,s);if(r){if(t instanceof Y)return t;if(e instanceof Y)return e}return t instanceof U&&(t=new F([t.getParent()],[t.returnState])),e instanceof U&&(e=new F([e.getParent()],[e.returnState])),function(t,e,r,s){if(null!==s){let r=s.get(t,e);if(null!==r)return M.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),r;if(r=s.get(e,t),null!==r)return M.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> previous"),r}let i=0,n=0,a=0,o=new Array(t.returnStates.length+e.returnStates.length).fill(0),c=new Array(t.returnStates.length+e.returnStates.length).fill(null);for(;i<t.returnStates.length&&n<e.returnStates.length;){const l=t.parents[i],h=e.parents[n];if(t.returnStates[i]===e.returnStates[n]){const e=t.returnStates[i];e===M.EMPTY_RETURN_STATE&&null===l&&null===h||null!==l&&null!==h&&l===h?(c[a]=l,o[a]=e):(c[a]=$(l,h,r,s),o[a]=e),i+=1,n+=1}else t.returnStates[i]<e.returnStates[n]?(c[a]=l,o[a]=t.returnStates[i],i+=1):(c[a]=h,o[a]=e.returnStates[n],n+=1);a+=1}if(i<t.returnStates.length)for(let e=i;e<t.returnStates.length;e++)c[a]=t.parents[e],o[a]=t.returnStates[e],a+=1;else for(let t=n;t<e.returnStates.length;t++)c[a]=e.parents[t],o[a]=e.returnStates[t],a+=1;if(a<c.length){if(1===a){const r=U.create(c[0],o[0]);return null!==s&&s.set(t,e,r),r}c=c.slice(0,a),o=o.slice(0,a)}const l=new F(c,o);return l.equals(t)?(null!==s&&s.set(t,e,t),M.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> a"),t):l.equals(e)?(null!==s&&s.set(t,e,e),M.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> b"),e):(function(t){const e=new j;for(let r=0;r<t.length;r++){const s=t[r];e.containsKey(s)||e.set(s,s)}for(let r=0;r<t.length;r++)t[r]=e.get(t[r])}(c),null!==s&&s.set(t,e,l),M.trace_atn_sim&&console.log("mergeArrays a="+t+",b="+e+" -> "+l),l)}(t,e,r,s)}class G{constructor(){this.data=[]}add(t){this.data[t]=!0}or(t){Object.keys(t.data).map(t=>this.add(t),this)}remove(t){delete this.data[t]}has(t){return!0===this.data[t]}values(){return Object.keys(this.data)}minValue(){return Math.min.apply(null,this.values())}hashCode(){return i.hashStuff(this.values())}equals(t){return t instanceof G&&e(this.data,t.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.values().length}}class z{constructor(t){this.atn=t}getDecisionLookahead(t){if(null===t)return null;const e=t.transitions.length,r=[];for(let s=0;s<e;s++){r[s]=new v;const e=new d,i=!1;this._LOOK(t.transition(s).target,null,M.EMPTY,r[s],e,new G,i,!1),(0===r[s].length||r[s].contains(z.HIT_PRED))&&(r[s]=null)}return r}LOOK(t,e,r){const s=new v,i=null!==(r=r||null)?B(t.atn,r):null;return this._LOOK(t,e,i,s,new d,new G,!0,!0),s}_LOOK(e,r,s,i,n,a,o,c){const l=new w({state:e,alt:0,context:s},null);if(!n.has(l)){if(n.add(l),e===r){if(null===s)return void i.addOne(t.EPSILON);if(s.isEmpty()&&c)return void i.addOne(t.EOF)}if(e instanceof _){if(null===s)return void i.addOne(t.EPSILON);if(s.isEmpty()&&c)return void i.addOne(t.EOF);if(s!==M.EMPTY){const t=a.has(e.ruleIndex);try{a.remove(e.ruleIndex);for(let t=0;t<s.length;t++){const e=this.atn.states[s.getReturnState(t)];this._LOOK(e,r,s.getParent(t),i,n,a,o,c)}}finally{t&&a.add(e.ruleIndex)}return}}for(let l=0;l<e.transitions.length;l++){const h=e.transitions[l];if(h.constructor===T){if(a.has(h.target.ruleIndex))continue;const t=U.create(s,h.followState.stateNumber);try{a.add(h.target.ruleIndex),this._LOOK(h.target,r,t,i,n,a,o,c)}finally{a.remove(h.target.ruleIndex)}}else if(h instanceof A)o?this._LOOK(h.target,r,s,i,n,a,o,c):i.addOne(z.HIT_PRED);else if(h.isEpsilon)this._LOOK(h.target,r,s,i,n,a,o,c);else if(h.constructor===R)i.addRange(t.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let e=h.label;null!==e&&(h instanceof k&&(e=e.complement(t.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),i.addSet(e))}}}}}z.HIT_PRED=t.INVALID_TYPE;class W{constructor(t,e){this.grammarType=t,this.maxTokenType=e,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[]}nextTokensInContext(t,e){return new z(this).LOOK(t,null,e)}nextTokensNoContext(t){return null!==t.nextTokenWithinRule||(t.nextTokenWithinRule=this.nextTokensInContext(t,null),t.nextTokenWithinRule.readOnly=!0),t.nextTokenWithinRule}nextTokens(t,e){return void 0===e?this.nextTokensNoContext(t):this.nextTokensInContext(t,e)}addState(t){null!==t&&(t.atn=this,t.stateNumber=this.states.length),this.states.push(t)}removeState(t){this.states[t.stateNumber]=null}defineDecisionState(t){return this.decisionToState.push(t),t.decision=this.decisionToState.length-1,t.decision}getDecisionState(t){return 0===this.decisionToState.length?null:this.decisionToState[t]}getExpectedTokens(e,r){if(e<0||e>=this.states.length)throw"Invalid state number.";const s=this.states[e];let i=this.nextTokens(s);if(!i.contains(t.EPSILON))return i;const n=new v;for(n.addSet(i),n.removeOne(t.EPSILON);null!==r&&r.invokingState>=0&&i.contains(t.EPSILON);){const e=this.states[r.invokingState].transitions[0];i=this.nextTokens(e.followState),n.addSet(i),n.removeOne(t.EPSILON),r=r.parentCtx}return i.contains(t.EPSILON)&&n.addOne(t.EOF),n}}W.INVALID_ALT_NUMBER=0;class X extends b{constructor(){super(),this.stateType=b.BASIC}}class Q extends b{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class J extends Q{constructor(){return super(),this.endState=null,this}}class Z extends b{constructor(){return super(),this.stateType=b.BLOCK_END,this.startState=null,this}}class tt extends b{constructor(){return super(),this.stateType=b.LOOP_END,this.loopBackState=null,this}}class et extends b{constructor(){return super(),this.stateType=b.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class rt extends Q{constructor(){return super(),this.stateType=b.TOKEN_START,this}}class st extends Q{constructor(){return super(),this.stateType=b.PLUS_LOOP_BACK,this}}class it extends b{constructor(){return super(),this.stateType=b.STAR_LOOP_BACK,this}}class nt extends Q{constructor(){return super(),this.stateType=b.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class at extends J{constructor(){return super(),this.stateType=b.PLUS_BLOCK_START,this.loopBackState=null,this}}class ot extends J{constructor(){return super(),this.stateType=b.STAR_BLOCK_START,this}}class ct extends J{constructor(){return super(),this.stateType=b.BLOCK_START,this}}class lt extends E{constructor(t,e){super(t),this.label_=e,this.label=this.makeLabel(),this.serializationType=E.ATOM}makeLabel(){const t=new v;return t.addOne(this.label_),t}matches(t,e,r){return this.label_===t}toString(){return this.label_}}class ht extends E{constructor(t,e,r){super(t),this.serializationType=E.RANGE,this.start=e,this.stop=r,this.label=this.makeLabel()}makeLabel(){const t=new v;return t.addRange(this.start,this.stop),t}matches(t,e,r){return t>=this.start&&t<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class ut extends E{constructor(t,e,r,s){super(t),this.serializationType=E.ACTION,this.ruleIndex=e,this.actionIndex=void 0===r?-1:r,this.isCtxDependent=void 0!==s&&s,this.isEpsilon=!0}matches(t,e,r){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class dt extends E{constructor(t,e){super(t),this.serializationType=E.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e}matches(t,e,r){return!1}toString(){return"epsilon"}}class pt extends p{constructor(t,e,r){super(),this.ruleIndex=void 0===t?-1:t,this.predIndex=void 0===e?-1:e,this.isCtxDependent=void 0!==r&&r}evaluate(t,e){const r=this.isCtxDependent?e:null;return t.sempred(r,this.ruleIndex,this.predIndex)}updateHashCode(t){t.update(this.ruleIndex,this.predIndex,this.isCtxDependent)}equals(t){return this===t||t instanceof pt&&this.ruleIndex===t.ruleIndex&&this.predIndex===t.predIndex&&this.isCtxDependent===t.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}p.NONE=new pt;class mt extends A{constructor(t,e,r,s){super(t),this.serializationType=E.PREDICATE,this.ruleIndex=e,this.predIndex=r,this.isCtxDependent=s,this.isEpsilon=!0}matches(t,e,r){return!1}getPredicate(){return new pt(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class yt extends p{constructor(t){super(),this.precedence=void 0===t?0:t}evaluate(t,e){return t.precpred(e,this.precedence)}evalPrecedence(t,e){return t.precpred(e,this.precedence)?p.NONE:null}compareTo(t){return this.precedence-t.precedence}updateHashCode(t){t.update(this.precedence)}equals(t){return this===t||t instanceof yt&&this.precedence===t.precedence}toString(){return"{"+this.precedence+">=prec}?"}}p.PrecedencePredicate=yt;class ft extends A{constructor(t,e){super(t),this.serializationType=E.PRECEDENCE,this.precedence=e,this.isEpsilon=!0}matches(t,e,r){return!1}getPredicate(){return new yt(this.precedence)}toString(){return this.precedence+" >= _p"}}class gt{constructor(t){void 0===t&&(t=null),this.readOnly=!1,this.verifyATN=null===t||t.verifyATN,this.generateRuleBypassTransitions=null!==t&&t.generateRuleBypassTransitions}}gt.defaultOptions=new gt,gt.defaultOptions.readOnly=!0;class wt{constructor(t){this.actionType=t,this.isPositionDependent=!1}hashCode(){const t=new i;return this.updateHashCode(t),t.finish()}updateHashCode(t){t.update(this.actionType)}equals(t){return this===t}}class xt extends wt{constructor(){super(6)}execute(t){t.skip()}toString(){return"skip"}}xt.INSTANCE=new xt;class vt extends wt{constructor(t){super(0),this.channel=t}execute(t){t._channel=this.channel}updateHashCode(t){t.update(this.actionType,this.channel)}equals(t){return this===t||t instanceof vt&&this.channel===t.channel}toString(){return"channel("+this.channel+")"}}class bt extends wt{constructor(t,e){super(1),this.ruleIndex=t,this.actionIndex=e,this.isPositionDependent=!0}execute(t){t.action(null,this.ruleIndex,this.actionIndex)}updateHashCode(t){t.update(this.actionType,this.ruleIndex,this.actionIndex)}equals(t){return this===t||t instanceof bt&&this.ruleIndex===t.ruleIndex&&this.actionIndex===t.actionIndex}}class _t extends wt{constructor(){super(3)}execute(t){t.more()}toString(){return"more"}}_t.INSTANCE=new _t;class Et extends wt{constructor(t){super(7),this.type=t}execute(t){t.type=this.type}updateHashCode(t){t.update(this.actionType,this.type)}equals(t){return this===t||t instanceof Et&&this.type===t.type}toString(){return"type("+this.type+")"}}class Tt extends wt{constructor(t){super(5),this.mode=t}execute(t){t.pushMode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof Tt&&this.mode===t.mode}toString(){return"pushMode("+this.mode+")"}}class St extends wt{constructor(){super(4)}execute(t){t.popMode()}toString(){return"popMode"}}St.INSTANCE=new St;class kt extends wt{constructor(t){super(2),this.mode=t}execute(t){t.mode(this.mode)}updateHashCode(t){t.update(this.actionType,this.mode)}equals(t){return this===t||t instanceof kt&&this.mode===t.mode}toString(){return"mode("+this.mode+")"}}function Rt(t,e){const r=[];return r[t-1]=e,r.map(function(t){return e})}class At{constructor(t){null==t&&(t=gt.defaultOptions),this.deserializationOptions=t,this.stateFactories=null,this.actionFactories=null}deserialize(t){const e=this.reset(t);this.checkVersion(e),e&&this.skipUUID();const r=this.readATN();this.readStates(r,e),this.readRules(r,e),this.readModes(r);const s=[];return this.readSets(r,s,this.readInt.bind(this)),e&&this.readSets(r,s,this.readInt32.bind(this)),this.readEdges(r,s),this.readDecisions(r),this.readLexerActions(r,e),this.markPrecedenceDecisions(r),this.verifyATN(r),this.deserializationOptions.generateRuleBypassTransitions&&1===r.grammarType&&(this.generateRuleBypassTransitions(r),this.verifyATN(r)),r}reset(t){if(3===(t.charCodeAt?t.charCodeAt(0):t[0])){const e=function(t){const e=t.charCodeAt(0);return e>1?e-2:e+65534},r=t.split("").map(e);return r[0]=t.charCodeAt(0),this.data=r,this.pos=0,!0}return this.data=t,this.pos=0,!1}skipUUID(){let t=0;for(;t++<8;)this.readInt()}checkVersion(t){const e=this.readInt();if(!t&&4!==e)throw"Could not deserialize ATN with version "+e+" (expected 4)."}readATN(){const t=this.readInt(),e=this.readInt();return new W(t,e)}readStates(t,e){let r,s,i;const n=[],a=[],o=this.readInt();for(let r=0;r<o;r++){const r=this.readInt();if(r===b.INVALID_TYPE){t.addState(null);continue}let s=this.readInt();e&&65535===s&&(s=-1);const i=this.stateFactory(r,s);if(r===b.LOOP_END){const t=this.readInt();n.push([i,t])}else if(i instanceof J){const t=this.readInt();a.push([i,t])}t.addState(i)}for(r=0;r<n.length;r++)s=n[r],s[0].loopBackState=t.states[s[1]];for(r=0;r<a.length;r++)s=a[r],s[0].endState=t.states[s[1]];let c=this.readInt();for(r=0;r<c;r++)i=this.readInt(),t.states[i].nonGreedy=!0;let l=this.readInt();for(r=0;r<l;r++)i=this.readInt(),t.states[i].isPrecedenceRule=!0}readRules(e,r){let s;const i=this.readInt();for(0===e.grammarType&&(e.ruleToTokenType=Rt(i,0)),e.ruleToStartState=Rt(i,0),s=0;s<i;s++){const i=this.readInt();if(e.ruleToStartState[s]=e.states[i],0===e.grammarType){let i=this.readInt();r&&65535===i&&(i=t.EOF),e.ruleToTokenType[s]=i}}for(e.ruleToStopState=Rt(i,0),s=0;s<e.states.length;s++){const t=e.states[s];t instanceof _&&(e.ruleToStopState[t.ruleIndex]=t,e.ruleToStartState[t.ruleIndex].stopState=t)}}readModes(t){const e=this.readInt();for(let r=0;r<e;r++){let e=this.readInt();t.modeToStartState.push(t.states[e])}}readSets(t,e,r){const s=this.readInt();for(let t=0;t<s;t++){const t=new v;e.push(t);const s=this.readInt();0!==this.readInt()&&t.addOne(-1);for(let e=0;e<s;e++){const e=r(),s=r();t.addRange(e,s)}}}readEdges(t,e){let r,s,i,n,a;const o=this.readInt();for(r=0;r<o;r++){const r=this.readInt(),s=this.readInt(),i=this.readInt(),a=this.readInt(),o=this.readInt(),c=this.readInt();n=this.edgeFactory(t,i,r,s,a,o,c,e),t.states[r].addTransition(n)}for(r=0;r<t.states.length;r++)for(i=t.states[r],s=0;s<i.transitions.length;s++){const e=i.transitions[s];if(!(e instanceof T))continue;let r=-1;t.ruleToStartState[e.target.ruleIndex].isPrecedenceRule&&0===e.precedence&&(r=e.target.ruleIndex),n=new dt(e.followState,r),t.ruleToStopState[e.target.ruleIndex].addTransition(n)}for(r=0;r<t.states.length;r++){if(i=t.states[r],i instanceof J){if(null===i.endState)throw"IllegalState";if(null!==i.endState.startState)throw"IllegalState";i.endState.startState=i}if(i instanceof st)for(s=0;s<i.transitions.length;s++)a=i.transitions[s].target,a instanceof at&&(a.loopBackState=i);else if(i instanceof it)for(s=0;s<i.transitions.length;s++)a=i.transitions[s].target,a instanceof nt&&(a.loopBackState=i)}}readDecisions(t){const e=this.readInt();for(let r=0;r<e;r++){const e=this.readInt(),s=t.states[e];t.decisionToState.push(s),s.decision=r}}readLexerActions(t,e){if(0===t.grammarType){const r=this.readInt();t.lexerActions=Rt(r,null);for(let s=0;s<r;s++){const r=this.readInt();let i=this.readInt();e&&65535===i&&(i=-1);let n=this.readInt();e&&65535===n&&(n=-1),t.lexerActions[s]=this.lexerActionFactory(r,i,n)}}}generateRuleBypassTransitions(t){let e;const r=t.ruleToStartState.length;for(e=0;e<r;e++)t.ruleToTokenType[e]=t.maxTokenType+e+1;for(e=0;e<r;e++)this.generateRuleBypassTransition(t,e)}generateRuleBypassTransition(t,e){let r,s;const i=new ct;i.ruleIndex=e,t.addState(i);const n=new Z;n.ruleIndex=e,t.addState(n),i.endState=n,t.defineDecisionState(i),n.startState=i;let a=null,o=null;if(t.ruleToStartState[e].isPrecedenceRule){for(o=null,r=0;r<t.states.length;r++)if(s=t.states[r],this.stateIsEndStateFor(s,e)){o=s,a=s.loopBackState.transitions[0];break}if(null===a)throw"Couldn't identify final state of the precedence rule prefix section."}else o=t.ruleToStopState[e];for(r=0;r<t.states.length;r++){s=t.states[r];for(let t=0;t<s.transitions.length;t++){const e=s.transitions[t];e!==a&&e.target===o&&(e.target=n)}}const c=t.ruleToStartState[e],l=c.transitions.length;for(;l>0;)i.addTransition(c.transitions[l-1]),c.transitions=c.transitions.slice(-1);t.ruleToStartState[e].addTransition(new dt(i)),n.addTransition(new dt(o));const h=new X;t.addState(h),h.addTransition(new lt(n,t.ruleToTokenType[e])),i.addTransition(new dt(h))}stateIsEndStateFor(t,e){if(t.ruleIndex!==e)return null;if(!(t instanceof nt))return null;const r=t.transitions[t.transitions.length-1].target;return r instanceof tt&&r.epsilonOnlyTransitions&&r.transitions[0].target instanceof _?t:null}markPrecedenceDecisions(t){for(let e=0;e<t.states.length;e++){const r=t.states[e];if(r instanceof nt&&t.ruleToStartState[r.ruleIndex].isPrecedenceRule){const t=r.transitions[r.transitions.length-1].target;t instanceof tt&&t.epsilonOnlyTransitions&&t.transitions[0].target instanceof _&&(r.isPrecedenceDecision=!0)}}}verifyATN(t){if(this.deserializationOptions.verifyATN)for(let e=0;e<t.states.length;e++){const r=t.states[e];if(null!==r)if(this.checkCondition(r.epsilonOnlyTransitions||r.transitions.length<=1),r instanceof at)this.checkCondition(null!==r.loopBackState);else if(r instanceof nt)if(this.checkCondition(null!==r.loopBackState),this.checkCondition(2===r.transitions.length),r.transitions[0].target instanceof ot)this.checkCondition(r.transitions[1].target instanceof tt),this.checkCondition(!r.nonGreedy);else{if(!(r.transitions[0].target instanceof tt))throw"IllegalState";this.checkCondition(r.transitions[1].target instanceof ot),this.checkCondition(r.nonGreedy)}else r instanceof it?(this.checkCondition(1===r.transitions.length),this.checkCondition(r.transitions[0].target instanceof nt)):r instanceof tt?this.checkCondition(null!==r.loopBackState):r instanceof et?this.checkCondition(null!==r.stopState):r instanceof J?this.checkCondition(null!==r.endState):r instanceof Z?this.checkCondition(null!==r.startState):r instanceof Q?this.checkCondition(r.transitions.length<=1||r.decision>=0):this.checkCondition(r.transitions.length<=1||r instanceof _)}}checkCondition(t,e){if(!t)throw null==e&&(e="IllegalState"),e}readInt(){return this.data[this.pos++]}readInt32(){return this.readInt()|this.readInt()<<16}edgeFactory(e,r,s,i,n,a,o,c){const l=e.states[i];switch(r){case E.EPSILON:return new dt(l);case E.RANGE:return new ht(l,0!==o?t.EOF:n,a);case E.RULE:return new T(e.states[n],a,o,l);case E.PREDICATE:return new mt(l,n,a,0!==o);case E.PRECEDENCE:return new ft(l,n);case E.ATOM:return new lt(l,0!==o?t.EOF:n);case E.ACTION:return new ut(l,n,a,0!==o);case E.SET:return new S(l,c[n]);case E.NOT_SET:return new k(l,c[n]);case E.WILDCARD:return new R(l);default:throw"The specified transition type: "+r+" is not valid."}}stateFactory(t,e){if(null===this.stateFactories){const t=[];t[b.INVALID_TYPE]=null,t[b.BASIC]=()=>new X,t[b.RULE_START]=()=>new et,t[b.BLOCK_START]=()=>new ct,t[b.PLUS_BLOCK_START]=()=>new at,t[b.STAR_BLOCK_START]=()=>new ot,t[b.TOKEN_START]=()=>new rt,t[b.RULE_STOP]=()=>new _,t[b.BLOCK_END]=()=>new Z,t[b.STAR_LOOP_BACK]=()=>new it,t[b.STAR_LOOP_ENTRY]=()=>new nt,t[b.PLUS_LOOP_BACK]=()=>new st,t[b.LOOP_END]=()=>new tt,this.stateFactories=t}if(t>this.stateFactories.length||null===this.stateFactories[t])throw"The specified state type "+t+" is not valid.";{const r=this.stateFactories[t]();if(null!==r)return r.ruleIndex=e,r}}lexerActionFactory(t,e,r){if(null===this.actionFactories){const t=[];t[0]=(t,e)=>new vt(t),t[1]=(t,e)=>new bt(t,e),t[2]=(t,e)=>new kt(t),t[3]=(t,e)=>_t.INSTANCE,t[4]=(t,e)=>St.INSTANCE,t[5]=(t,e)=>new Tt(t),t[6]=(t,e)=>xt.INSTANCE,t[7]=(t,e)=>new Et(t),this.actionFactories=t}if(t>this.actionFactories.length||null===this.actionFactories[t])throw"The specified lexer action type "+t+" is not valid.";return this.actionFactories[t](e,r)}}class Ct{syntaxError(t,e,r,s,i,n){}reportAmbiguity(t,e,r,s,i,n,a){}reportAttemptingFullContext(t,e,r,s,i,n){}reportContextSensitivity(t,e,r,s,i,n){}}class Lt extends Ct{constructor(){super()}syntaxError(t,e,r,s,i,n){console.error("line "+r+":"+s+" "+i)}}Lt.INSTANCE=new Lt;class It extends Ct{constructor(t){if(super(),null===t)throw"delegates";return this.delegates=t,this}syntaxError(t,e,r,s,i,n){this.delegates.map(a=>a.syntaxError(t,e,r,s,i,n))}reportAmbiguity(t,e,r,s,i,n,a){this.delegates.map(o=>o.reportAmbiguity(t,e,r,s,i,n,a))}reportAttemptingFullContext(t,e,r,s,i,n){this.delegates.map(a=>a.reportAttemptingFullContext(t,e,r,s,i,n))}reportContextSensitivity(t,e,r,s,i,n){this.delegates.map(a=>a.reportContextSensitivity(t,e,r,s,i,n))}}class Kt{constructor(){this._listeners=[Lt.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(t){const e="4.13.1";e!==t&&console.log("ANTLR runtime and generated code versions disagree: "+e+"!="+t)}addErrorListener(t){this._listeners.push(t)}removeErrorListeners(){this._listeners=[]}getLiteralNames(){return Object.getPrototypeOf(this).constructor.literalNames||[]}getSymbolicNames(){return Object.getPrototypeOf(this).constructor.symbolicNames||[]}getTokenNames(){if(!this.tokenNames){const t=this.getLiteralNames(),e=this.getSymbolicNames(),r=t.length>e.length?t.length:e.length;this.tokenNames=[];for(let s=0;s<r;s++)this.tokenNames[s]=t[s]||e[s]||"<INVALID"}return this.tokenNames}getTokenTypeMap(){const e=this.getTokenNames();if(null===e)throw"The current recognizer does not provide a list of token names.";let r=this.tokenTypeMapCache[e];return void 0===r&&(r=e.reduce(function(t,e,r){t[e]=r}),r.EOF=t.EOF,this.tokenTypeMapCache[e]=r),r}getRuleIndexMap(){const t=this.ruleNames;if(null===t)throw"The current recognizer does not provide a list of rule names.";let e=this.ruleIndexMapCache[t];return void 0===e&&(e=t.reduce(function(t,e,r){t[e]=r}),this.ruleIndexMapCache[t]=e),e}getTokenType(e){const r=this.getTokenTypeMap()[e];return void 0!==r?r:t.INVALID_TYPE}getErrorHeader(t){return"line "+t.getOffendingToken().line+":"+t.getOffendingToken().column}getTokenErrorDisplay(e){if(null===e)return"<no token>";let r=e.text;return null===r&&(r=e.type===t.EOF?"<EOF>":"<"+e.type+">"),r=r.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+r+"'"}getErrorListenerDispatch(){return new It(this._listeners)}sempred(t,e,r){return!0}precpred(t,e){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(t){this._stateNumber=t}}Kt.tokenTypeMapCache={},Kt.ruleIndexMapCache={};class Nt extends t{constructor(e,r,s,i,n){super(),this.source=void 0!==e?e:Nt.EMPTY_SOURCE,this.type=void 0!==r?r:null,this.channel=void 0!==s?s:t.DEFAULT_CHANNEL,this.start=void 0!==i?i:-1,this.stop=void 0!==n?n:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=e[0].line,this.column=e[0].column):this.column=-1}clone(){const t=new Nt(this.source,this.type,this.channel,this.start,this.stop);return t.tokenIndex=this.tokenIndex,t.line=this.line,t.column=this.column,t.text=this.text,t}cloneWithType(e){const r=new Nt(this.source,e,this.channel,this.start,this.stop);return r.tokenIndex=this.tokenIndex,r.line=this.line,r.column=this.column,e===t.EOF&&(r.text=""),r}toString(){let t=this.text;return t=null!==t?t.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):"<no text>","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+t+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"}get text(){if(null!==this._text)return this._text;const t=this.getInputStream();if(null===t)return null;const e=t.size;return this.start<e&&this.stop<e?t.getText(this.start,this.stop):"<EOF>"}set text(t){this._text=t}}Nt.EMPTY_SOURCE=[null,null];class Ot{}class Dt extends Ot{constructor(t){super(),this.copyText=void 0!==t&&t}create(t,e,r,s,i,n,a,o){const c=new Nt(t,e,s,i,n);return c.line=a,c.column=o,null!==r?c.text=r:this.copyText&&null!==t[1]&&(c.text=t[1].getText(i,n)),c}createThin(t,e){const r=new Nt(null,t);return r.text=e,r}}Dt.DEFAULT=new Dt;class Pt extends Error{constructor(t){super(t.message),Error.captureStackTrace&&Error.captureStackTrace(this,Pt),this.message=t.message,this.recognizer=t.recognizer,this.input=t.input,this.ctx=t.ctx,this.offendingToken=null,this.offendingState=-1,null!==this.recognizer&&(this.offendingState=this.recognizer.state)}getExpectedTokens(){return null!==this.recognizer?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null}toString(){return this.message}}class qt extends Pt{constructor(t,e,r,s){super({message:"",recognizer:t,input:e,ctx:null}),this.startIndex=r,this.deadEndConfigs=s}toString(){let t="";return this.startIndex>=0&&this.startIndex<this.input.size&&(t=this.input.getText(new x(this.startIndex,this.startIndex))),"LexerNoViableAltException"+t}}class Mt extends Kt{constructor(e){super(),this._input=e,this._factory=Dt.DEFAULT,this._tokenFactorySourcePair=[this,e],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=t.DEFAULT_CHANNEL,this._type=t.INVALID_TYPE,this._modeStack=[],this._mode=Mt.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=t.INVALID_TYPE,this._channel=t.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=Mt.DEFAULT_MODE,this._modeStack=[],this._interp.reset()}nextToken(){if(null===this._input)throw"nextToken requires a non-null input stream.";const e=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=t.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let e=!1;for(;;){this._type=t.INVALID_TYPE;let r=Mt.SKIP;try{r=this._interp.match(this._input,this._mode)}catch(t){if(!(t instanceof Pt))throw console.log(t.stack),t;this.notifyListeners(t),this.recover(t)}if(this._input.LA(1)===t.EOF&&(this._hitEOF=!0),this._type===t.INVALID_TYPE&&(this._type=r),this._type===Mt.SKIP){e=!0;break}if(this._type!==Mt.MORE)break}if(!e)return null===this._token&&this.emit(),this._token}}finally{this._input.release(e)}}skip(){this._type=Mt.SKIP}more(){this._type=Mt.MORE}mode(t){this._mode=t}pushMode(t){this._interp.debug&&console.log("pushMode "+t),this._modeStack.push(this._mode),this.mode(t)}popMode(){if(0===this._modeStack.length)throw"Empty Stack";return this._interp.debug&&console.log("popMode back to "+this._modeStack.slice(0,-1)),this.mode(this._modeStack.pop()),this._mode}emitToken(t){this._token=t}emit(){const t=this._factory.create(this._tokenFactorySourcePair,this._type,this._text,this._channel,this._tokenStartCharIndex,this.getCharIndex()-1,this._tokenStartLine,this._tokenStartColumn);return this.emitToken(t),t}emitEOF(){const e=this.column,r=this.line,s=this._factory.create(this._tokenFactorySourcePair,t.EOF,null,t.DEFAULT_CHANNEL,this._input.index,this._input.index-1,r,e);return this.emitToken(s),s}getCharIndex(){return this._input.index}getAllTokens(){const e=[];let r=this.nextToken();for(;r.type!==t.EOF;)e.push(r),r=this.nextToken();return e}notifyListeners(t){const e=this._tokenStartCharIndex,r=this._input.index,s=this._input.getText(e,r),i="token recognition error at: '"+this.getErrorDisplay(s)+"'";this.getErrorListenerDispatch().syntaxError(this,null,this._tokenStartLine,this._tokenStartColumn,i,t)}getErrorDisplay(t){const e=[];for(let r=0;r<t.length;r++)e.push(t[r]);return e.join("")}getErrorDisplayForChar(e){return e.charCodeAt(0)===t.EOF?"<EOF>":"\n"===e?"\\n":"\t"===e?"\\t":"\r"===e?"\\r":e}getCharErrorDisplay(t){return"'"+this.getErrorDisplayForChar(t)+"'"}recover(e){this._input.LA(1)!==t.EOF&&(e instanceof qt?this.