UNPKG

mathjslab

Version:

MathJSLab - An interpreter with language syntax like MATLAB®/Octave, ISBN 978-65-00-82338-7.

1 lines 596 kB
var __webpack_modules__={168(e,t,r){r.d(t,{Dj:()=>cr,JG:()=>rr,M8:()=>Yt,MG:()=>Zt,Pg:()=>or,X2:()=>ir,ay:()=>nr,eP:()=>tr,fr:()=>$t,iH:()=>Wt,iX:()=>ar,jB:()=>Xt,ou:()=>ur,pG:()=>er,re:()=>sr,tD:()=>lr});var n={763:()=>{}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s={};a.d(s,{MG:()=>X,fr:()=>Pe,sR:()=>bt,Zo:()=>Nt,iH:()=>Rt,rt:()=>Fe,jB:()=>kt,M8:()=>mt,$t:()=>Mt,aq:()=>Et,pG:()=>Oe,eP:()=>yt,KU:()=>_t,zW:()=>wt,IX:()=>L,mY:()=>T,a7:()=>W,JG:()=>ze,ay:()=>Ye,X2:()=>it,WU:()=>xt,Uw:()=>Ct,gw:()=>ft,iX:()=>Bt,re:()=>st,Pg:()=>qt,tD:()=>ot,R$:()=>nt,Dj:()=>Be,m7:()=>z,NZ:()=>F,xo:()=>k,ou:()=>o,qC:()=>Jt,mD:()=>x,Ay:()=>Qt});class o{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(e){this._text=e}}function l(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!(e[r]===t[r]||e[r].equals&&e[r].equals(t[r])))return!1;return!0}o.INVALID_TYPE=0,o.EPSILON=-2,o.MIN_USER_TOKEN_TYPE=1,o.EOF=-1,o.DEFAULT_CHANNEL=0,o.HIDDEN_CHANNEL=1;const c=Math.round(Math.random()*Math.pow(2,32));function u(e){if(!e)return 0;const t=typeof e,r="string"===t?e:!("object"!==t||!e.toString)&&e.toString();if(!r)return 0;let n,i;const a=3&r.length,s=r.length-a;let o=c;const l=3432918353,u=461845907;let m=0;for(;m<s;)i=255&r.charCodeAt(m)|(255&r.charCodeAt(++m))<<8|(255&r.charCodeAt(++m))<<16|(255&r.charCodeAt(++m))<<24,++m,i=(65535&i)*l+(((i>>>16)*l&65535)<<16)&4294967295,i=i<<15|i>>>17,i=(65535&i)*u+(((i>>>16)*u&65535)<<16)&4294967295,o^=i,o=o<<13|o>>>19,n=5*(65535&o)+((5*(o>>>16)&65535)<<16)&4294967295,o=27492+(65535&n)+((58964+(n>>>16)&65535)<<16);switch(i=0,a){case 3:i^=(255&r.charCodeAt(m+2))<<16;case 2:i^=(255&r.charCodeAt(m+1))<<8;case 1:i^=255&r.charCodeAt(m),i=(65535&i)*l+(((i>>>16)*l&65535)<<16)&4294967295,i=i<<15|i>>>17,i=(65535&i)*u+(((i>>>16)*u&65535)<<16)&4294967295,o^=i}return o^=r.length,o^=o>>>16,o=2246822507*(65535&o)+((2246822507*(o>>>16)&65535)<<16)&4294967295,o^=o>>>13,o=3266489909*(65535&o)+((3266489909*(o>>>16)&65535)<<16)&4294967295,o^=o>>>16,o>>>0}class m{constructor(){this.count=0,this.hash=0}update(){for(let e=0;e<arguments.length;e++){const t=arguments[e];if(null!=t)if(Array.isArray(t))this.update.apply(this,t);else{let e=0;switch(typeof t){case"undefined":case"function":continue;case"number":case"boolean":e=t;break;case"string":e=u(t);break;default:t.updateHashCode?t.updateHashCode(this):console.log("No updateHashCode for "+t.toString());continue}e*=3432918353,e=e<<15|e>>>17,e*=461845907,this.count=this.count+1;let r=this.hash^e;r=r<<13|r>>>19,r=5*r+3864292196,this.hash=r}}}finish(){let e=this.hash^4*this.count;return e^=e>>>16,e*=2246822507,e^=e>>>13,e*=3266489909,e^=e>>>16,e}static hashStuff(){const e=new m;return e.update.apply(e,arguments),e.finish()}}function h(e){return e?"string"==typeof e?u(e):e.hashCode():-1}function p(e,t){return e&&e.equals?e.equals(t):e===t}function d(e){return null===e?"null":e}function x(e){return Array.isArray(e)?"["+e.map(d).join(", ")+"]":"null"}class C{constructor(e,t){this.buckets=new Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=e||h,this.equalsFunction=t||p}get(e){if(null==e)return e;const t=this._getBucket(e);if(!t)return null;for(const r of t)if(this.equalsFunction(r,e))return r;return null}add(e){return this.getOrAdd(e)===e}getOrAdd(e){this._expand();const t=this._getSlot(e);let r=this.buckets[t];if(!r)return r=[e],this.buckets[t]=r,this.itemCount++,e;for(const t of r)if(this.equalsFunction(t,e))return t;return r.push(e),this.itemCount++,e}has(e){return null!=this.get(e)}values(){return this.buckets.filter(e=>null!=e).flat(1)}toString(){return x(this.values())}get length(){return this.itemCount}_getSlot(e){return this.hashFunction(e)&this.buckets.length-1}_getBucket(e){return this.buckets[this._getSlot(e)]}_expand(){if(this.itemCount<=this.threshold)return;const e=this.buckets,t=2*this.buckets.length;this.buckets=new Array(t),this.threshold=Math.floor(.75*t);for(const t of e)if(t)for(const e of t){const t=this._getSlot(e);let r=this.buckets[t];r||(r=[],this.buckets[t]=r),r.push(e)}}}class f{hashCode(){const e=new m;return this.updateHashCode(e),e.finish()}evaluate(e,t){}evalPrecedence(e,t){return this}static andContext(e,t){if(null===e||e===f.NONE)return t;if(null===t||t===f.NONE)return e;const r=new g(e,t);return 1===r.opnds.length?r.opnds[0]:r}static orContext(e,t){if(null===e)return t;if(null===t)return e;if(e===f.NONE||t===f.NONE)return f.NONE;const r=new _(e,t);return 1===r.opnds.length?r.opnds[0]:r}}class g extends f{constructor(e,t){super();const r=new C;e instanceof g?e.opnds.map(function(e){r.add(e)}):r.add(e),t instanceof g?t.opnds.map(function(e){r.add(e)}):r.add(t);const n=y(r);if(n.length>0){let e=null;n.map(function(t){(null===e||t.precedence<e.precedence)&&(e=t)}),r.add(e)}this.opnds=Array.from(r.values())}equals(e){return this===e||e instanceof g&&l(this.opnds,e.opnds)}updateHashCode(e){e.update(this.opnds,"AND")}evaluate(e,t){for(let r=0;r<this.opnds.length;r++)if(!this.opnds[r].evaluate(e,t))return!1;return!0}evalPrecedence(e,t){let r=!1;const n=[];for(let i=0;i<this.opnds.length;i++){const a=this.opnds[i],s=a.evalPrecedence(e,t);if(r|=s!==a,null===s)return null;s!==f.NONE&&n.push(s)}if(!r)return this;if(0===n.length)return f.NONE;let i=null;return n.map(function(e){i=null===i?e:f.andContext(i,e)}),i}toString(){const e=this.opnds.map(e=>e.toString());return(e.length>3?e.slice(3):e).join("&&")}}class _ extends f{constructor(e,t){super();const r=new C;e instanceof _?e.opnds.map(function(e){r.add(e)}):r.add(e),t instanceof _?t.opnds.map(function(e){r.add(e)}):r.add(t);const n=y(r);if(n.length>0){const e=n.sort(function(e,t){return e.compareTo(t)}),t=e[e.length-1];r.add(t)}this.opnds=Array.from(r.values())}equals(e){return this===e||e instanceof _&&l(this.opnds,e.opnds)}updateHashCode(e){e.update(this.opnds,"OR")}evaluate(e,t){for(let r=0;r<this.opnds.length;r++)if(this.opnds[r].evaluate(e,t))return!0;return!1}evalPrecedence(e,t){let r=!1;const n=[];for(let i=0;i<this.opnds.length;i++){const a=this.opnds[i],s=a.evalPrecedence(e,t);if(r|=s!==a,s===f.NONE)return f.NONE;null!==s&&n.push(s)}return r?(0===n.length||n.map(function(e){return e}),null):this}toString(){const e=this.opnds.map(e=>e.toString());return(e.length>3?e.slice(3):e).join("||")}}function y(e){const t=[];return e.values().map(function(e){e instanceof f.PrecedencePredicate&&t.push(e)}),t}function A(e,t){if(null===e){const e={state:null,alt:null,context:null,semanticContext:null};return t&&(e.reachesIntoOuterContext=0),e}{const r={};return r.state=e.state||null,r.alt=void 0===e.alt?null:e.alt,r.context=e.context||null,r.semanticContext=e.semanticContext||null,t&&(r.reachesIntoOuterContext=e.reachesIntoOuterContext||0,r.precedenceFilterSuppressed=e.precedenceFilterSuppressed||!1),r}}class E{constructor(e,t){this.checkContext(e,t),e=A(e),t=A(t,!0),this.state=null!==e.state?e.state:t.state,this.alt=null!==e.alt?e.alt:t.alt,this.context=null!==e.context?e.context:t.context,this.semanticContext=null!==e.semanticContext?e.semanticContext:null!==t.semanticContext?t.semanticContext:f.NONE,this.reachesIntoOuterContext=t.reachesIntoOuterContext,this.precedenceFilterSuppressed=t.precedenceFilterSuppressed}checkContext(e,t){null!==e.context&&void 0!==e.context||null!==t&&null!==t.context&&void 0!==t.context||(this.context=null)}hashCode(){const e=new m;return this.updateHashCode(e),e.finish()}updateHashCode(e){e.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)}equals(e){return this===e||e instanceof E&&this.state.stateNumber===e.state.stateNumber&&this.alt===e.alt&&(null===this.context?null===e.context:this.context.equals(e.context))&&this.semanticContext.equals(e.semanticContext)&&this.precedenceFilterSuppressed===e.precedenceFilterSuppressed}hashCodeForConfigSet(){const e=new m;return e.update(this.state.stateNumber,this.alt,this.semanticContext),e.finish()}equalsForConfigSet(e){return this===e||e instanceof E&&this.state.stateNumber===e.state.stateNumber&&this.alt===e.alt&&this.semanticContext.equals(e.semanticContext)}toString(){return"("+this.state+","+this.alt+(null!==this.context?",["+this.context.toString()+"]":"")+(this.semanticContext!==f.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"}}class L{constructor(e,t){this.start=e,this.stop=t}clone(){return new L(this.start,this.stop)}contains(e){return e>=this.start&&e<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}}L.INVALID_INTERVAL=new L(-1,-2);class T{constructor(){this.intervals=null,this.readOnly=!1}first(e){return null===this.intervals||0===this.intervals.length?o.INVALID_TYPE:this.intervals[0].start}addOne(e){this.addInterval(new L(e,e+1))}addRange(e,t){this.addInterval(new L(e,t+1))}addInterval(e){if(null===this.intervals)this.intervals=[],this.intervals.push(e.clone());else{for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];if(e.stop<r.start)return void this.intervals.splice(t,0,e);if(e.stop===r.start)return void(this.intervals[t]=new L(e.start,r.stop));if(e.start<=r.stop)return this.intervals[t]=new L(Math.min(r.start,e.start),Math.max(r.stop,e.stop)),void this.reduce(t)}this.intervals.push(e.clone())}}addSet(e){return null!==e.intervals&&e.intervals.forEach(e=>this.addInterval(e),this),this}reduce(e){if(e<this.intervals.length-1){const t=this.intervals[e],r=this.intervals[e+1];t.stop>=r.stop?(this.intervals.splice(e+1,1),this.reduce(e)):t.stop>=r.start&&(this.intervals[e]=new L(t.start,r.stop),this.intervals.splice(e+1,1))}}complement(e,t){const r=new T;return r.addInterval(new L(e,t+1)),null!==this.intervals&&this.intervals.forEach(e=>r.removeRange(e)),r}contains(e){if(null===this.intervals)return!1;for(let t=0;t<this.intervals.length;t++)if(this.intervals[t].contains(e))return!0;return!1}removeRange(e){if(e.start===e.stop-1)this.removeOne(e.start);else if(null!==this.intervals){let t=0;for(let r=0;r<this.intervals.length;r++){const r=this.intervals[t];if(e.stop<=r.start)return;if(e.start>r.start&&e.stop<r.stop){this.intervals[t]=new L(r.start,e.start);const n=new L(e.stop,r.stop);return void this.intervals.splice(t,0,n)}e.start<=r.start&&e.stop>=r.stop?(this.intervals.splice(t,1),t-=1):e.start<r.stop?this.intervals[t]=new L(r.start,e.start):e.stop<r.stop&&(this.intervals[t]=new L(e.stop,r.stop)),t+=1}}}removeOne(e){if(null!==this.intervals)for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];if(e<r.start)return;if(e===r.start&&e===r.stop-1)return void this.intervals.splice(t,1);if(e===r.start)return void(this.intervals[t]=new L(r.start+1,r.stop));if(e===r.stop-1)return void(this.intervals[t]=new L(r.start,r.stop-1));if(e<r.stop-1){const n=new L(r.start,e);return r.start=e+1,void this.intervals.splice(t,0,n)}}}toString(e,t,r){return e=e||null,t=t||null,r=r||!1,null===this.intervals?"{}":null!==e||null!==t?this.toTokenString(e,t):r?this.toCharString():this.toIndexString()}toCharString(){const e=[];for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];r.stop===r.start+1?r.start===o.EOF?e.push("<EOF>"):e.push("'"+String.fromCharCode(r.start)+"'"):e.push("'"+String.fromCharCode(r.start)+"'..'"+String.fromCharCode(r.stop-1)+"'")}return e.length>1?"{"+e.join(", ")+"}":e[0]}toIndexString(){const e=[];for(let t=0;t<this.intervals.length;t++){const r=this.intervals[t];r.stop===r.start+1?r.start===o.EOF?e.push("<EOF>"):e.push(r.start.toString()):e.push(r.start.toString()+".."+(r.stop-1).toString())}return e.length>1?"{"+e.join(", ")+"}":e[0]}toTokenString(e,t){const r=[];for(let n=0;n<this.intervals.length;n++){const i=this.intervals[n];for(let n=i.start;n<i.stop;n++)r.push(this.elementName(e,t,n))}return r.length>1?"{"+r.join(", ")+"}":r[0]}elementName(e,t,r){return r===o.EOF?"<EOF>":r===o.EPSILON?"<EPSILON>":e[r]||t[r]}get length(){return this.intervals.map(e=>e.length).reduce((e,t)=>e+t)}}class M{constructor(){this.atn=null,this.stateNumber=M.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null}toString(){return this.stateNumber}equals(e){return e instanceof M&&this.stateNumber===e.stateNumber}isNonGreedyExitState(){return!1}addTransition(e,t){void 0===t&&(t=-1),0===this.transitions.length?this.epsilonOnlyTransitions=e.isEpsilon:this.epsilonOnlyTransitions!==e.isEpsilon&&(this.epsilonOnlyTransitions=!1),-1===t?this.transitions.push(e):this.transitions.splice(t,1,e)}}M.INVALID_TYPE=0,M.BASIC=1,M.RULE_START=2,M.BLOCK_START=3,M.PLUS_BLOCK_START=4,M.STAR_BLOCK_START=5,M.TOKEN_START=6,M.RULE_STOP=7,M.BLOCK_END=8,M.STAR_LOOP_BACK=9,M.STAR_LOOP_ENTRY=10,M.PLUS_LOOP_BACK=11,M.LOOP_END=12,M.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"],M.INVALID_STATE_NUMBER=-1;class b extends M{constructor(){return super(),this.stateType=M.RULE_STOP,this}}class S{constructor(e){if(null==e)throw"target cannot be null.";this.target=e,this.isEpsilon=!1,this.label=null}}S.EPSILON=1,S.RANGE=2,S.RULE=3,S.PREDICATE=4,S.ATOM=5,S.ACTION=6,S.SET=7,S.NOT_SET=8,S.WILDCARD=9,S.PRECEDENCE=10,S.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"],S.serializationTypes={EpsilonTransition:S.EPSILON,RangeTransition:S.RANGE,RuleTransition:S.RULE,PredicateTransition:S.PREDICATE,AtomTransition:S.ATOM,ActionTransition:S.ACTION,SetTransition:S.SET,NotSetTransition:S.NOT_SET,WildcardTransition:S.WILDCARD,PrecedencePredicateTransition:S.PRECEDENCE};class N extends S{constructor(e,t,r,n){super(e),this.ruleIndex=t,this.precedence=r,this.followState=n,this.serializationType=S.RULE,this.isEpsilon=!0}matches(e,t,r){return!1}}class w extends S{constructor(e,t){super(e),this.serializationType=S.SET,null!=t?this.label=t:(this.label=new T,this.label.addOne(o.INVALID_TYPE))}matches(e,t,r){return this.label.contains(e)}toString(){return this.label.toString()}}class I extends w{constructor(e,t){super(e,t),this.serializationType=S.NOT_SET}matches(e,t,r){return e>=t&&e<=r&&!super.matches(e,t,r)}toString(){return"~"+super.toString()}}class P extends S{constructor(e){super(e),this.serializationType=S.WILDCARD}matches(e,t,r){return e>=t&&e<=r}toString(){return"."}}class O extends S{constructor(e){super(e)}}class R{}class v extends R{}class D extends v{}class F extends D{get ruleContext(){throw new Error("missing interface implementation")}}class k extends D{}class U extends k{}const B={toStringTree:function(e,t,r){t=t||null,null!==(r=r||null)&&(t=r.ruleNames);let n=B.getNodeText(e,t);n=function(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}(n);const i=e.getChildCount();if(0===i)return n;let a="("+n+" ";i>0&&(n=B.toStringTree(e.getChild(0),t),a=a.concat(n));for(let r=1;r<i;r++)n=B.toStringTree(e.getChild(r),t),a=a.concat(" "+n);return a=a.concat(")"),a},getNodeText:function(e,t,r){if(t=t||null,null!==(r=r||null)&&(t=r.ruleNames),null!==t){if(e instanceof F){const r=e.ruleContext.getAltNumber();return 0!=r?t[e.ruleIndex]+":"+r:t[e.ruleIndex]}if(e instanceof U)return e.toString();if(e instanceof k&&null!==e.symbol)return e.symbol.text}const n=e.getPayload();return n instanceof o?n.text:e.getPayload().toString()},getChildren:function(e){const t=[];for(let r=0;r<e.getChildCount();r++)t.push(e.getChild(r));return t},getAncestors:function(e){let t=[];for(e=e.getParent();null!==e;)t=[e].concat(t),e=e.getParent();return t},findAllTokenNodes:function(e,t){return B.findAllNodes(e,t,!0)},findAllRuleNodes:function(e,t){return B.findAllNodes(e,t,!1)},findAllNodes:function(e,t,r){const n=[];return B._findAllNodes(e,t,r,n),n},_findAllNodes:function(e,t,r,n){r&&e instanceof k?e.symbol.type===t&&n.push(e):!r&&e instanceof F&&e.ruleIndex===t&&n.push(e);for(let i=0;i<e.getChildCount();i++)B._findAllNodes(e.getChild(i),t,r,n)},descendants:function(e){let t=[e];for(let r=0;r<e.getChildCount();r++)t=t.concat(B.descendants(e.getChild(r)));return t}},K=B;class z extends F{constructor(e,t){super(),this.parentCtx=e||null,this.invokingState=t||-1}depth(){let e=0,t=this;for(;null!==t;)t=t.parentCtx,e+=1;return e}isEmpty(){return-1===this.invokingState}getSourceInterval(){return L.INVALID_INTERVAL}get ruleContext(){return this}getPayload(){return this}getText(){return 0===this.getChildCount()?"":this.children.map(function(e){return e.getText()}).join("")}getAltNumber(){return 0}setAltNumber(e){}getChild(e){return null}getChildCount(){return 0}accept(e){return e.visitChildren(this)}toStringTree(e,t){return K.toStringTree(this,e,t)}toString(e,t){e=e||null,t=t||null;let r=this,n="[";for(;null!==r&&r!==t;){if(null===e)r.isEmpty()||(n+=r.invokingState);else{const t=r.ruleIndex;n+=t>=0&&t<e.length?e[t]:""+t}null===r.parentCtx||null===e&&r.parentCtx.isEmpty()||(n+=" "),r=r.parentCtx}return n+="]",n}}class q{constructor(e){this.cachedHashCode=e}isEmpty(){return this===q.EMPTY}hasEmptyPath(){return this.getReturnState(this.length-1)===q.EMPTY_RETURN_STATE}hashCode(){return this.cachedHashCode}updateHashCode(e){e.update(this.cachedHashCode)}}q.EMPTY=null,q.EMPTY_RETURN_STATE=2147483647,q.globalNodeCount=1,q.id=q.globalNodeCount,q.trace_atn_sim=!1;class J extends q{constructor(e,t){const r=new m;return r.update(e,t),super(r.finish()),this.parents=e,this.returnStates=t,this}isEmpty(){return this.returnStates[0]===q.EMPTY_RETURN_STATE}getParent(e){return this.parents[e]}getReturnState(e){return this.returnStates[e]}equals(e){return this===e||e instanceof J&&this.hashCode()===e.hashCode()&&l(this.returnStates,e.returnStates)&&l(this.parents,e.parents)}toString(){if(this.isEmpty())return"[]";{let e="[";for(let t=0;t<this.returnStates.length;t++)t>0&&(e+=", "),this.returnStates[t]!==q.EMPTY_RETURN_STATE?(e+=this.returnStates[t],null!==this.parents[t]?e=e+" "+this.parents[t]:e+="null"):e+="$";return e+"]"}}get length(){return this.returnStates.length}}class V extends q{constructor(e,t){let r=0;const n=new m;null!==e?n.update(e,t):n.update(1),r=n.finish(),super(r),this.parentCtx=e,this.returnState=t}getParent(e){return this.parentCtx}getReturnState(e){return this.returnState}equals(e){return this===e||e instanceof V&&this.hashCode()===e.hashCode()&&this.returnState===e.returnState&&(null==this.parentCtx?null==e.parentCtx:this.parentCtx.equals(e.parentCtx))}toString(){const e=null===this.parentCtx?"":this.parentCtx.toString();return 0===e.length?this.returnState===q.EMPTY_RETURN_STATE?"$":""+this.returnState:this.returnState+" "+e}get length(){return 1}static create(e,t){return t===q.EMPTY_RETURN_STATE&&null===e?q.EMPTY:new V(e,t)}}class H extends V{constructor(){super(null,q.EMPTY_RETURN_STATE)}isEmpty(){return!0}getParent(e){return null}getReturnState(e){return this.returnState}equals(e){return this===e}toString(){return"$"}}q.EMPTY=new H;class j{constructor(e,t){this.buckets=new Array(16),this.threshold=Math.floor(12),this.itemCount=0,this.hashFunction=e||h,this.equalsFunction=t||p}set(e,t){this._expand();const r=this._getSlot(e);let n=this.buckets[r];if(!n)return n=[[e,t]],this.buckets[r]=n,this.itemCount++,t;const i=n.find(t=>this.equalsFunction(t[0],e),this);if(i){const e=i[1];return i[1]=t,e}return n.push([e,t]),this.itemCount++,t}containsKey(e){const t=this._getBucket(e);return!!t&&!!t.find(t=>this.equalsFunction(t[0],e),this)}get(e){const t=this._getBucket(e);if(!t)return null;const r=t.find(t=>this.equalsFunction(t[0],e),this);return r?r[1]:null}entries(){return this.buckets.filter(e=>null!=e).flat(1)}getKeys(){return this.entries().map(e=>e[0])}getValues(){return this.entries().map(e=>e[1])}toString(){return"["+this.entries().map(e=>"{"+e[0]+":"+e[1]+"}").join(", ")+"]"}get length(){return this.itemCount}_getSlot(e){return this.hashFunction(e)&this.buckets.length-1}_getBucket(e){return this.buckets[this._getSlot(e)]}_expand(){if(this.itemCount<=this.threshold)return;const e=this.buckets,t=2*this.buckets.length;this.buckets=new Array(t),this.threshold=Math.floor(.75*t);for(const t of e)if(t)for(const e of t){const t=this._getSlot(e[0]);let r=this.buckets[t];r||(r=[],this.buckets[t]=r),r.push(e)}}}function G(e,t){if(null==t&&(t=z.EMPTY),null===t.parentCtx||t===z.EMPTY)return q.EMPTY;const r=G(e,t.parentCtx),n=e.states[t.invokingState].transitions[0];return V.create(r,n.followState.stateNumber)}function Q(e,t,r){if(e.isEmpty())return e;let n=r.get(e)||null;if(null!==n)return n;if(n=t.get(e),null!==n)return r.set(e,n),n;let i=!1,a=[];for(let n=0;n<a.length;n++){const s=Q(e.getParent(n),t,r);if(i||s!==e.getParent(n)){if(!i){a=[];for(let t=0;t<e.length;t++)a[t]=e.getParent(t);i=!0}a[n]=s}}if(!i)return t.add(e),r.set(e,e),e;let s=null;return s=0===a.length?q.EMPTY:1===a.length?V.create(a[0],e.getReturnState(0)):new J(a,e.returnStates),t.add(s),r.set(s,s),r.set(e,s),s}function Z(e,t,r,n){if(e===t)return e;if(e instanceof V&&t instanceof V)return function(e,t,r,n){if(null!==n){let r=n.get(e,t);if(null!==r)return r;if(r=n.get(t,e),null!==r)return r}const i=function(e,t,r){if(r){if(e===q.EMPTY)return q.EMPTY;if(t===q.EMPTY)return q.EMPTY}else{if(e===q.EMPTY&&t===q.EMPTY)return q.EMPTY;if(e===q.EMPTY){const e=[t.returnState,q.EMPTY_RETURN_STATE],r=[t.parentCtx,null];return new J(r,e)}if(t===q.EMPTY){const t=[e.returnState,q.EMPTY_RETURN_STATE],r=[e.parentCtx,null];return new J(r,t)}}return null}(e,t,r);if(null!==i)return null!==n&&n.set(e,t,i),i;if(e.returnState===t.returnState){const i=Z(e.parentCtx,t.parentCtx,r,n);if(i===e.parentCtx)return e;if(i===t.parentCtx)return t;const a=V.create(i,e.returnState);return null!==n&&n.set(e,t,a),a}{let r=null;if((e===t||null!==e.parentCtx&&e.parentCtx===t.parentCtx)&&(r=e.parentCtx),null!==r){const i=[e.returnState,t.returnState];e.returnState>t.returnState&&(i[0]=t.returnState,i[1]=e.returnState);const a=new J([r,r],i);return null!==n&&n.set(e,t,a),a}const i=[e.returnState,t.returnState];let a=[e.parentCtx,t.parentCtx];e.returnState>t.returnState&&(i[0]=t.returnState,i[1]=e.returnState,a=[t.parentCtx,e.parentCtx]);const s=new J(a,i);return null!==n&&n.set(e,t,s),s}}(e,t,r,n);if(r){if(e instanceof H)return e;if(t instanceof H)return t}return e instanceof V&&(e=new J([e.getParent()],[e.returnState])),t instanceof V&&(t=new J([t.getParent()],[t.returnState])),function(e,t,r,n){if(null!==n){let r=n.get(e,t);if(null!==r)return q.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> previous"),r;if(r=n.get(t,e),null!==r)return q.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> previous"),r}let i=0,a=0,s=0,o=new Array(e.returnStates.length+t.returnStates.length).fill(0),l=new Array(e.returnStates.length+t.returnStates.length).fill(null);for(;i<e.returnStates.length&&a<t.returnStates.length;){const c=e.parents[i],u=t.parents[a];if(e.returnStates[i]===t.returnStates[a]){const t=e.returnStates[i];t===q.EMPTY_RETURN_STATE&&null===c&&null===u||null!==c&&null!==u&&c===u?(l[s]=c,o[s]=t):(l[s]=Z(c,u,r,n),o[s]=t),i+=1,a+=1}else e.returnStates[i]<t.returnStates[a]?(l[s]=c,o[s]=e.returnStates[i],i+=1):(l[s]=u,o[s]=t.returnStates[a],a+=1);s+=1}if(i<e.returnStates.length)for(let t=i;t<e.returnStates.length;t++)l[s]=e.parents[t],o[s]=e.returnStates[t],s+=1;else for(let e=a;e<t.returnStates.length;e++)l[s]=t.parents[e],o[s]=t.returnStates[e],s+=1;if(s<l.length){if(1===s){const r=V.create(l[0],o[0]);return null!==n&&n.set(e,t,r),r}l=l.slice(0,s),o=o.slice(0,s)}const c=new J(l,o);return c.equals(e)?(null!==n&&n.set(e,t,e),q.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> a"),e):c.equals(t)?(null!==n&&n.set(e,t,t),q.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> b"),t):(function(e){const t=new j;for(let r=0;r<e.length;r++){const n=e[r];t.containsKey(n)||t.set(n,n)}for(let r=0;r<e.length;r++)e[r]=t.get(e[r])}(l),null!==n&&n.set(e,t,c),q.trace_atn_sim&&console.log("mergeArrays a="+e+",b="+t+" -> "+c),c)}(e,t,r,n)}class ${constructor(){this.data=new Uint32Array(1)}set(e){$._checkIndex(e),this._resize(e),this.data[e>>>5]|=1<<e%32}get(e){$._checkIndex(e);const t=e>>>5;return!(t>=this.data.length||!(this.data[t]&1<<e%32))}clear(e){$._checkIndex(e);const t=e>>>5;t<this.data.length&&(this.data[t]&=~(1<<e))}or(e){const t=Math.min(this.data.length,e.data.length);for(let r=0;r<t;++r)this.data[r]|=e.data[r];if(this.data.length<e.data.length){this._resize((e.data.length<<5)-1);const r=e.data.length;for(let n=t;n<r;++n)this.data[n]=e.data[n]}}values(){const e=new Array(this.length);let t=0;const r=this.data.length;for(let n=0;n<r;++n){let r=this.data[n];for(;0!==r;){const i=r&-r;e[t++]=(n<<5)+$._bitCount(i-1),r^=i}}return e}minValue(){for(let e=0;e<this.data.length;++e){let t=this.data[e];if(0!==t){let r=0;for(;!(1&t);)r++,t>>=1;return r+32*e}}return 0}hashCode(){return m.hashStuff(this.values())}equals(e){return e instanceof $&&l(this.data,e.data)}toString(){return"{"+this.values().join(", ")+"}"}get length(){return this.data.map(e=>$._bitCount(e)).reduce((e,t)=>e+t,0)}_resize(e){const t=e+32>>>5;if(t<=this.data.length)return;const r=new Uint32Array(t);r.set(this.data),r.fill(0,this.data.length),this.data=r}static _checkIndex(e){if(e<0)throw new RangeError("index cannot be negative")}static _bitCount(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,0+(e+=e>>16)&63}}class W{constructor(e){this.atn=e}getDecisionLookahead(e){if(null===e)return null;const t=e.transitions.length,r=[];for(let n=0;n<t;n++){r[n]=new T;const t=new C,i=!1;this._LOOK(e.transition(n).target,null,q.EMPTY,r[n],t,new $,i,!1),(0===r[n].length||r[n].contains(W.HIT_PRED))&&(r[n]=null)}return r}LOOK(e,t,r){const n=new T,i=null!==(r=r||null)?G(e.atn,r):null;return this._LOOK(e,t,i,n,new C,new $,!0,!0),n}_LOOK(e,t,r,n,i,a,s,l){const c=new E({state:e,alt:0,context:r},null);if(!i.has(c)){if(i.add(c),e===t){if(null===r)return void n.addOne(o.EPSILON);if(r.isEmpty()&&l)return void n.addOne(o.EOF)}if(e instanceof b){if(null===r)return void n.addOne(o.EPSILON);if(r.isEmpty()&&l)return void n.addOne(o.EOF);if(r!==q.EMPTY){const o=a.get(e.ruleIndex);try{a.clear(e.ruleIndex);for(let e=0;e<r.length;e++){const o=this.atn.states[r.getReturnState(e)];this._LOOK(o,t,r.getParent(e),n,i,a,s,l)}}finally{o&&a.set(e.ruleIndex)}return}}for(let c=0;c<e.transitions.length;c++){const u=e.transitions[c];if(u.constructor===N){if(a.get(u.target.ruleIndex))continue;const e=V.create(r,u.followState.stateNumber);try{a.set(u.target.ruleIndex),this._LOOK(u.target,t,e,n,i,a,s,l)}finally{a.clear(u.target.ruleIndex)}}else if(u instanceof O)s?this._LOOK(u.target,t,r,n,i,a,s,l):n.addOne(W.HIT_PRED);else if(u.isEpsilon)this._LOOK(u.target,t,r,n,i,a,s,l);else if(u.constructor===P)n.addRange(o.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType);else{let e=u.label;null!==e&&(u instanceof I&&(e=e.complement(o.MIN_USER_TOKEN_TYPE,this.atn.maxTokenType)),n.addSet(e))}}}}}W.HIT_PRED=o.INVALID_TYPE;class X{constructor(e,t){this.grammarType=e,this.maxTokenType=t,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[]}nextTokensInContext(e,t){return new W(this).LOOK(e,null,t)}nextTokensNoContext(e){return null!==e.nextTokenWithinRule||(e.nextTokenWithinRule=this.nextTokensInContext(e,null),e.nextTokenWithinRule.readOnly=!0),e.nextTokenWithinRule}nextTokens(e,t){return void 0===t?this.nextTokensNoContext(e):this.nextTokensInContext(e,t)}addState(e){null!==e&&(e.atn=this,e.stateNumber=this.states.length),this.states.push(e)}removeState(e){this.states[e.stateNumber]=null}defineDecisionState(e){return this.decisionToState.push(e),e.decision=this.decisionToState.length-1,e.decision}getDecisionState(e){return 0===this.decisionToState.length?null:this.decisionToState[e]}getExpectedTokens(e,t){if(e<0||e>=this.states.length)throw"Invalid state number.";const r=this.states[e];let n=this.nextTokens(r);if(!n.contains(o.EPSILON))return n;const i=new T;for(i.addSet(n),i.removeOne(o.EPSILON);null!==t&&t.invokingState>=0&&n.contains(o.EPSILON);){const e=this.states[t.invokingState].transitions[0];n=this.nextTokens(e.followState),i.addSet(n),i.removeOne(o.EPSILON),t=t.parentCtx}return n.contains(o.EPSILON)&&i.addOne(o.EOF),i}}X.INVALID_ALT_NUMBER=0;class Y extends M{constructor(){super(),this.stateType=M.BASIC}}class ee extends M{constructor(){return super(),this.decision=-1,this.nonGreedy=!1,this}}class te extends ee{constructor(){return super(),this.endState=null,this}}class re extends M{constructor(){return super(),this.stateType=M.BLOCK_END,this.startState=null,this}}class ne extends M{constructor(){return super(),this.stateType=M.LOOP_END,this.loopBackState=null,this}}class ie extends M{constructor(){return super(),this.stateType=M.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}}class ae extends ee{constructor(){return super(),this.stateType=M.TOKEN_START,this}}class se extends ee{constructor(){return super(),this.stateType=M.PLUS_LOOP_BACK,this}}class oe extends M{constructor(){return super(),this.stateType=M.STAR_LOOP_BACK,this}}class le extends ee{constructor(){return super(),this.stateType=M.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}}class ce extends te{constructor(){return super(),this.stateType=M.PLUS_BLOCK_START,this.loopBackState=null,this}}class ue extends te{constructor(){return super(),this.stateType=M.STAR_BLOCK_START,this}}class me extends te{constructor(){return super(),this.stateType=M.BLOCK_START,this}}class he extends S{constructor(e,t){super(e),this.label_=t,this.label=this.makeLabel(),this.serializationType=S.ATOM}makeLabel(){const e=new T;return e.addOne(this.label_),e}matches(e,t,r){return this.label_===e}toString(){return this.label_}}class pe extends S{constructor(e,t,r){super(e),this.serializationType=S.RANGE,this.start=t,this.stop=r,this.label=this.makeLabel()}makeLabel(){const e=new T;return e.addRange(this.start,this.stop),e}matches(e,t,r){return e>=this.start&&e<=this.stop}toString(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"}}class de extends S{constructor(e,t,r,n){super(e),this.serializationType=S.ACTION,this.ruleIndex=t,this.actionIndex=void 0===r?-1:r,this.isCtxDependent=void 0!==n&&n,this.isEpsilon=!0}matches(e,t,r){return!1}toString(){return"action_"+this.ruleIndex+":"+this.actionIndex}}class xe extends S{constructor(e,t){super(e),this.serializationType=S.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=t}matches(e,t,r){return!1}toString(){return"epsilon"}}class Ce extends f{constructor(e,t,r){super(),this.ruleIndex=void 0===e?-1:e,this.predIndex=void 0===t?-1:t,this.isCtxDependent=void 0!==r&&r}evaluate(e,t){const r=this.isCtxDependent?t:null;return e.sempred(r,this.ruleIndex,this.predIndex)}updateHashCode(e){e.update(this.ruleIndex,this.predIndex,this.isCtxDependent)}equals(e){return this===e||e instanceof Ce&&this.ruleIndex===e.ruleIndex&&this.predIndex===e.predIndex&&this.isCtxDependent===e.isCtxDependent}toString(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"}}f.NONE=new Ce;class fe extends O{constructor(e,t,r,n){super(e),this.serializationType=S.PREDICATE,this.ruleIndex=t,this.predIndex=r,this.isCtxDependent=n,this.isEpsilon=!0}matches(e,t,r){return!1}getPredicate(){return new Ce(this.ruleIndex,this.predIndex,this.isCtxDependent)}toString(){return"pred_"+this.ruleIndex+":"+this.predIndex}}class ge extends f{constructor(e){super(),this.precedence=void 0===e?0:e}evaluate(e,t){return e.precpred(t,this.precedence)}evalPrecedence(e,t){return e.precpred(t,this.precedence)?f.NONE:null}compareTo(e){return this.precedence-e.precedence}updateHashCode(e){e.update(this.precedence)}equals(e){return this===e||e instanceof ge&&this.precedence===e.precedence}toString(){return"{"+this.precedence+">=prec}?"}}f.PrecedencePredicate=ge;class _e extends O{constructor(e,t){super(e),this.serializationType=S.PRECEDENCE,this.precedence=t,this.isEpsilon=!0}matches(e,t,r){return!1}getPredicate(){return new ge(this.precedence)}toString(){return this.precedence+" >= _p"}}class ye{constructor(e){void 0===e&&(e=null),this.readOnly=!1,this.verifyATN=null===e||e.verifyATN,this.generateRuleBypassTransitions=null!==e&&e.generateRuleBypassTransitions}}ye.defaultOptions=new ye,ye.defaultOptions.readOnly=!0;class Ae{constructor(e){this.actionType=e,this.isPositionDependent=!1}hashCode(){const e=new m;return this.updateHashCode(e),e.finish()}updateHashCode(e){e.update(this.actionType)}equals(e){return this===e}}class Ee extends Ae{constructor(){super(6)}execute(e){e.skip()}toString(){return"skip"}}Ee.INSTANCE=new Ee;class Le extends Ae{constructor(e){super(0),this.channel=e}execute(e){e._channel=this.channel}updateHashCode(e){e.update(this.actionType,this.channel)}equals(e){return this===e||e instanceof Le&&this.channel===e.channel}toString(){return"channel("+this.channel+")"}}class Te extends Ae{constructor(e,t){super(1),this.ruleIndex=e,this.actionIndex=t,this.isPositionDependent=!0}execute(e){e.action(null,this.ruleIndex,this.actionIndex)}updateHashCode(e){e.update(this.actionType,this.ruleIndex,this.actionIndex)}equals(e){return this===e||e instanceof Te&&this.ruleIndex===e.ruleIndex&&this.actionIndex===e.actionIndex}}class Me extends Ae{constructor(){super(3)}execute(e){e.more()}toString(){return"more"}}Me.INSTANCE=new Me;class be extends Ae{constructor(e){super(7),this.type=e}execute(e){e.type=this.type}updateHashCode(e){e.update(this.actionType,this.type)}equals(e){return this===e||e instanceof be&&this.type===e.type}toString(){return"type("+this.type+")"}}class Se extends Ae{constructor(e){super(5),this.mode=e}execute(e){e.pushMode(this.mode)}updateHashCode(e){e.update(this.actionType,this.mode)}equals(e){return this===e||e instanceof Se&&this.mode===e.mode}toString(){return"pushMode("+this.mode+")"}}class Ne extends Ae{constructor(){super(4)}execute(e){e.popMode()}toString(){return"popMode"}}Ne.INSTANCE=new Ne;class we extends Ae{constructor(e){super(2),this.mode=e}execute(e){e.setMode(this.mode)}updateHashCode(e){e.update(this.actionType,this.mode)}equals(e){return this===e||e instanceof we&&this.mode===e.mode}toString(){return"mode("+this.mode+")"}}function Ie(e,t){const r=[];return r[e-1]=t,r.map(function(e){return t})}class Pe{constructor(e){null==e&&(e=ye.defaultOptions),this.deserializationOptions=e,this.stateFactories=null,this.actionFactories=null}deserialize(e){const t=this.reset(e);this.checkVersion(t),t&&this.skipUUID();const r=this.readATN();this.readStates(r,t),this.readRules(r,t),this.readModes(r);const n=[];return this.readSets(r,n,this.readInt.bind(this)),t&&this.readSets(r,n,this.readInt32.bind(this)),this.readEdges(r,n),this.readDecisions(r),this.readLexerActions(r,t),this.markPrecedenceDecisions(r),this.verifyATN(r),this.deserializationOptions.generateRuleBypassTransitions&&1===r.grammarType&&(this.generateRuleBypassTransitions(r),this.verifyATN(r)),r}reset(e){if(3===(e.charCodeAt?e.charCodeAt(0):e[0])){const t=function(e){const t=e.charCodeAt(0);return t>1?t-2:t+65534},r=e.split("").map(t);return r[0]=e.charCodeAt(0),this.data=r,this.pos=0,!0}return this.data=e,this.pos=0,!1}skipUUID(){let e=0;for(;e++<8;)this.readInt()}checkVersion(e){const t=this.readInt();if(!e&&4!==t)throw"Could not deserialize ATN with version "+t+" (expected 4)."}readATN(){const e=this.readInt(),t=this.readInt();return new X(e,t)}readStates(e,t){let r,n,i;const a=[],s=[],o=this.readInt();for(let r=0;r<o;r++){const r=this.readInt();if(r===M.INVALID_TYPE){e.addState(null);continue}let n=this.readInt();t&&65535===n&&(n=-1);const i=this.stateFactory(r,n);if(r===M.LOOP_END){const e=this.readInt();a.push([i,e])}else if(i instanceof te){const e=this.readInt();s.push([i,e])}e.addState(i)}for(r=0;r<a.length;r++)n=a[r],n[0].loopBackState=e.states[n[1]];for(r=0;r<s.length;r++)n=s[r],n[0].endState=e.states[n[1]];let l=this.readInt();for(r=0;r<l;r++)i=this.readInt(),e.states[i].nonGreedy=!0;let c=this.readInt();for(r=0;r<c;r++)i=this.readInt(),e.states[i].isPrecedenceRule=!0}readRules(e,t){let r;const n=this.readInt();for(0===e.grammarType&&(e.ruleToTokenType=Ie(n,0)),e.ruleToStartState=Ie(n,0),r=0;r<n;r++){const n=this.readInt();if(e.ruleToStartState[r]=e.states[n],0===e.grammarType){let n=this.readInt();t&&65535===n&&(n=o.EOF),e.ruleToTokenType[r]=n}}for(e.ruleToStopState=Ie(n,0),r=0;r<e.states.length;r++){const t=e.states[r];t instanceof b&&(e.ruleToStopState[t.ruleIndex]=t,e.ruleToStartState[t.ruleIndex].stopState=t)}}readModes(e){const t=this.readInt();for(let r=0;r<t;r++){let t=this.readInt();e.modeToStartState.push(e.states[t])}}readSets(e,t,r){const n=this.readInt();for(let e=0;e<n;e++){const e=new T;t.push(e);const n=this.readInt();0!==this.readInt()&&e.addOne(-1);for(let t=0;t<n;t++){const t=r(),n=r();e.addRange(t,n)}}}readEdges(e,t){let r,n,i,a,s;const o=this.readInt();for(r=0;r<o;r++){const r=this.readInt(),n=this.readInt(),i=this.readInt(),s=this.readInt(),o=this.readInt(),l=this.readInt();a=this.edgeFactory(e,i,r,n,s,o,l,t),e.states[r].addTransition(a)}for(r=0;r<e.states.length;r++)for(i=e.states[r],n=0;n<i.transitions.length;n++){const t=i.transitions[n];if(!(t instanceof N))continue;let r=-1;e.ruleToStartState[t.target.ruleIndex].isPrecedenceRule&&0===t.precedence&&(r=t.target.ruleIndex),a=new xe(t.followState,r),e.ruleToStopState[t.target.ruleIndex].addTransition(a)}for(r=0;r<e.states.length;r++){if(i=e.states[r],i instanceof te){if(null===i.endState)throw"IllegalState";if(null!==i.endState.startState)throw"IllegalState";i.endState.startState=i}if(i instanceof se)for(n=0;n<i.transitions.length;n++)s=i.transitions[n].target,s instanceof ce&&(s.loopBackState=i);else if(i instanceof oe)for(n=0;n<i.transitions.length;n++)s=i.transitions[n].target,s instanceof le&&(s.loopBackState=i)}}readDecisions(e){const t=this.readInt();for(let r=0;r<t;r++){const t=this.readInt(),n=e.states[t];e.decisionToState.push(n),n.decision=r}}readLexerActions(e,t){if(0===e.grammarType){const r=this.readInt();e.lexerActions=Ie(r,null);for(let n=0;n<r;n++){const r=this.readInt();let i=this.readInt();t&&65535===i&&(i=-1);let a=this.readInt();t&&65535===a&&(a=-1),e.lexerActions[n]=this.lexerActionFactory(r,i,a)}}}generateRuleBypassTransitions(e){let t;const r=e.ruleToStartState.length;for(t=0;t<r;t++)e.ruleToTokenType[t]=e.maxTokenType+t+1;for(t=0;t<r;t++)this.generateRuleBypassTransition(e,t)}generateRuleBypassTransition(e,t){let r,n;const i=new me;i.ruleIndex=t,e.addState(i);const a=new re;a.ruleIndex=t,e.addState(a),i.endState=a,e.defineDecisionState(i),a.startState=i;let s=null,o=null;if(e.ruleToStartState[t].isPrecedenceRule){for(o=null,r=0;r<e.states.length;r++)if(n=e.states[r],this.stateIsEndStateFor(n,t)){o=n,s=n.loopBackState.transitions[0];break}if(null===s)throw"Couldn't identify final state of the precedence rule prefix section."}else o=e.ruleToStopState[t];for(r=0;r<e.states.length;r++){n=e.states[r];for(let e=0;e<n.transitions.length;e++){const t=n.transitions[e];t!==s&&t.target===o&&(t.target=a)}}const l=e.ruleToStartState[t],c=l.transitions.length;for(;c>0;)i.addTransition(l.transitions[c-1]),l.transitions=l.transitions.slice(-1);e.ruleToStartState[t].addTransition(new xe(i)),a.addTransition(new xe(o));const u=new Y;e.addState(u),u.addTransition(new he(a,e.ruleToTokenType[t])),i.addTransition(new xe(u))}stateIsEndStateFor(e,t){if(e.ruleIndex!==t)return null;if(!(e instanceof le))return null;const r=e.transitions[e.transitions.length-1].target;return r instanceof ne&&r.epsilonOnlyTransitions&&r.transitions[0].target instanceof b?e:null}markPrecedenceDecisions(e){for(let t=0;t<e.states.length;t++){const r=e.states[t];if(r instanceof le&&e.ruleToStartState[r.ruleIndex].isPrecedenceRule){const e=r.transitions[r.transitions.length-1].target;e instanceof ne&&e.epsilonOnlyTransitions&&e.transitions[0].target instanceof b&&(r.isPrecedenceDecision=!0)}}}verifyATN(e){if(this.deserializationOptions.verifyATN)for(let t=0;t<e.states.length;t++){const r=e.states[t];if(null!==r)if(this.checkCondition(r.epsilonOnlyTransitions||r.transitions.length<=1),r instanceof ce)this.checkCondition(null!==r.loopBackState);else if(r instanceof le)if(this.checkCondition(null!==r.loopBackState),this.checkCondition(2===r.transitions.length),r.transitions[0].target instanceof ue)this.checkCondition(r.transitions[1].target instanceof ne),this.checkCondition(!r.nonGreedy);else{if(!(r.transitions[0].target instanceof ne))throw"IllegalState";this.checkCondition(r.transitions[1].target instanceof ue),this.checkCondition(r.nonGreedy)}else r instanceof oe?(this.checkCondition(1===r.transitions.length),this.checkCondition(r.transitions[0].target instanceof le)):r instanceof ne?this.checkCondition(null!==r.loopBackState):r instanceof ie?this.checkCondition(null!==r.stopState):r instanceof te?this.checkCondition(null!==r.endState):r instanceof re?this.checkCondition(null!==r.startState):r instanceof ee?this.checkCondition(r.transitions.length<=1||r.decision>=0):this.checkCondition(r.transitions.length<=1||r instanceof b)}}checkCondition(e,t){if(!e)throw null==t&&(t="IllegalState"),t}readInt(){return this.data[this.pos++]}readInt32(){return this.readInt()|this.readInt()<<16}edgeFactory(e,t,r,n,i,a,s,l){const c=e.states[n];switch(t){case S.EPSILON:return new xe(c);case S.RANGE:return new pe(c,0!==s?o.EOF:i,a);case S.RULE:return new N(e.states[i],a,s,c);case S.PREDICATE:return new fe(c,i,a,0!==s);case S.PRECEDENCE:return new _e(c,i);case S.ATOM:return new he(c,0!==s?o.EOF:i);case S.ACTION:return new de(c,i,a,0!==s);case S.SET:return new w(c,l[i]);case S.NOT_SET:return new I(c,l[i]);case S.WILDCARD:return new P(c);default:throw"The specified transition type: "+t+" is not valid."}}stateFactory(e,t){if(null===this.stateFactories){const e=[];e[M.INVALID_TYPE]=null,e[M.BASIC]=()=>new Y,e[M.RULE_START]=()=>new ie,e[M.BLOCK_START]=()=>new me,e[M.PLUS_BLOCK_START]=()=>new ce,e[M.STAR_BLOCK_START]=()=>new ue,e[M.TOKEN_START]=()=>new ae,e[M.RULE_STOP]=()=>new b,e[M.BLOCK_END]=()=>new re,e[M.STAR_LOOP_BACK]=()=>new oe,e[M.STAR_LOOP_ENTRY]=()=>new le,e[M.PLUS_LOOP_BACK]=()=>new se,e[M.LOOP_END]=()=>new ne,this.stateFactories=e}if(e>this.stateFactories.length||null===this.stateFactories[e])throw"The specified state type "+e+" is not valid.";{const r=this.stateFactories[e]();if(null!==r)return r.ruleIndex=t,r}}lexerActionFactory(e,t,r){if(null===this.actionFactories){const e=[];e[0]=(e,t)=>new Le(e),e[1]=(e,t)=>new Te(e,t),e[2]=(e,t)=>new we(e),e[3]=(e,t)=>Me.INSTANCE,e[4]=(e,t)=>Ne.INSTANCE,e[5]=(e,t)=>new Se(e),e[6]=(e,t)=>Ee.INSTANCE,e[7]=(e,t)=>new be(e),this.actionFactories=e}if(e>this.actionFactories.length||null===this.actionFactories[e])throw"The specified lexer action type "+e+" is not valid.";return this.actionFactories[e](t,r)}}class Oe{syntaxError(e,t,r,n,i,a){}reportAmbiguity(e,t,r,n,i,a,s){}reportAttemptingFullContext(e,t,r,n,i,a){}reportContextSensitivity(e,t,r,n,i,a){}}class Re extends Oe{constructor(){super()}syntaxError(e,t,r,n,i,a){console.error("line "+r+":"+n+" "+i)}}Re.INSTANCE=new Re;class ve extends Oe{constructor(e){if(super(),null===e)throw"delegates";return this.delegates=e,this}syntaxError(e,t,r,n,i,a){this.delegates.map(s=>s.syntaxError(e,t,r,n,i,a))}reportAmbiguity(e,t,r,n,i,a,s){this.delegates.map(o=>o.reportAmbiguity(e,t,r,n,i,a,s))}reportAttemptingFullContext(e,t,r,n,i,a){this.delegates.map(s=>s.reportAttemptingFullContext(e,t,r,n,i,a))}reportContextSensitivity(e,t,r,n,i,a){this.delegates.map(s=>s.reportContextSensitivity(e,t,r,n,i,a))}}class De{constructor(){this._listeners=[Re.INSTANCE],this._interp=null,this._stateNumber=-1}checkVersion(e){const t="4.13.2";t!==e&&console.log("ANTLR runtime and generated code versions disagree: "+t+"!="+e)}addErrorListener(e){this._listeners.push(e)}removeErrorListeners(){this._listeners=[]}getLiteralNames(){return Object.getPrototypeOf(this).constructor.literalNames||[]}getSymbolicNames(){return Object.getPrototypeOf(this).constructor.symbolicNames||[]}getTokenNames(){if(!this.tokenNames){const e=this.getLiteralNames(),t=this.getSymbolicNames(),r=e.length>t.length?e.length:t.length;this.tokenNames=[];for(let n=0;n<r;n++)this.tokenNames[n]=e[n]||t[n]||"<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 t=this.tokenTypeMapCache[e];return void 0===t&&(t=e.reduce(function(e,t,r){e[t]=r}),t.EOF=o.EOF,this.tokenTypeMapCache[e]=t),t}getRuleIndexMap(){const e=this.ruleNames;if(null===e)throw"The current recognizer does not provide a list of rule names.";let t=this.ruleIndexMapCache[e];return void 0===t&&(t=e.reduce(function(e,t,r){e[t]=r}),this.ruleIndexMapCache[e]=t),t}getTokenType(e){const t=this.getTokenTypeMap()[e];return void 0!==t?t:o.INVALID_TYPE}getErrorHeader(e){return"line "+e.getOffendingToken().line+":"+e.getOffendingToken().column}getTokenErrorDisplay(e){if(null===e)return"<no token>";let t=e.text;return null===t&&(t=e.type===o.EOF?"<EOF>":"<"+e.type+">"),t=t.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t"),"'"+t+"'"}getErrorListenerDispatch(){return console.warn("Calling deprecated method in Recognizer class: getErrorListenerDispatch()"),this.getErrorListener()}getErrorListener(){return new ve(this._listeners)}sempred(e,t,r){return!0}precpred(e,t){return!0}get atn(){return this._interp.atn}get state(){return this._stateNumber}set state(e){this._stateNumber=e}}De.tokenTypeMapCache={},De.ruleIndexMapCache={};class Fe extends o{constructor(e,t,r,n,i){super(),this.source=void 0!==e?e:Fe.EMPTY_SOURCE,this.type=void 0!==t?t:null,this.channel=void 0!==r?r:o.DEFAULT_CHANNEL,this.start=void 0!==n?n:-1,this.stop=void 0!==i?i:-1,this.tokenIndex=-1,null!==this.source[0]?(this.line=e[0].line,this.column=e[0].column):this.column=-1}clone(){const e=new Fe(this.source,this.type,this.channel,this.start,this.stop);return e.tokenIndex=this.tokenIndex,e.line=this.line,e.column=this.column,e.text=this.text,e}cloneWithType(e){const t=new Fe(this.source,e,this.channel,this.start,this.stop);return t.tokenIndex=this.tokenIndex,t.line=this.line,t.column=this.column,e===o.EOF&&(t.text=""),t}toString(){let e=this.text;return e=null!==e?e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):"<no text>","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+e+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"}get text(){if(null!==this._text)return this._text;const e=this.getInputStream();if(null===e)return null;const t=e.size;return this.start<t&&this.stop<t?e.getText(this.start,this.stop):"<EOF>"}set text(e){this._text=e}}Fe.EMPTY_SOURCE=[null,null];class ke{}class Ue extends ke{constructor(e){super(),this.copyText=void 0!==e&&e}create(e,t,r,n,i,a,s,o){const l=new Fe(e,t,n,i,a);return l.line=s,l.column=o,null!==r?l.text=r:this.copyText&&null!==e[1]&&(l.text=e[1].getText(i,a)),l}createThin(e,t){const r=new Fe(null,e);return r.text=t,r}}Ue.DEFAULT=new Ue;class Be extends Error{constructor(e){super(e.message),Error.captureStackTrace&&Error.captureStackTrace(this,Be),this.message=e.message,this.recognizer=e.recognizer,this.input=e.input,this.ctx=e.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 Ke extends Be{constructor(e,t,r,n){super({message:"",recognizer:e,input:t,ctx:null}),this.startIndex=r,this.deadEndConfigs=n}toString(){let e="";return this.startIndex>=0&&this.startIndex<this.input.size&&(e=this.input.getText(new L(this.startIndex,this.startIndex))),"LexerNoViableAltException"+e}}class ze extends De{constructor(e){super(),this._input=e,this._factory=Ue.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=o.DEFAULT_CHANNEL,this._type=o.INVALID_TYPE,this._modeStack=[],this._mode=ze.DEFAULT_MODE,this._text=null}reset(){null!==this._input&&this._input.seek(0),this._token=null,this._type=o.INVALID_TYPE,this._channel=o.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=ze.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=o.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;let t=!1;for(;;){this._type=o.INVALID_TYPE;let r=ze.SKIP;try{r=this._interp.match(this._input,this._mode)}catch(e){if(!(e instanceof Be))throw console.log(e.stack),e;this.notifyListeners(e),this.recover(e)}if(this._input.LA(1)===o.EOF&&(this._hitEOF=!0),this._type===o.INVALID_TYPE&&(this._type=r),this._type===ze.SKIP){t=!0;break}if(this._type!==ze.MORE)break}if(!t)return null===this._token&&this.emit(),this._token}}finally{this._input.release(e)}}skip(){this._type=ze.SKIP}more(){this._type=ze.MORE}mode(e){console.warn("Calling