@guihz/trading-vue-editor-tes 0.0.214 → 0.0.216
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/assets/{parserTccWorker-C_OkdWJ6.js → parserTccWorker-CCpcd6u0.js} +5 -5
- package/lib/assets/scriptsRunWorker-B3l8bZZ1.js +69 -0
- package/lib/components/editor/parseScript/buildInVarNamespace/strategy.d.ts +2 -2
- package/lib/components/editor/parseScript/parseToJs.d.ts +7 -1
- package/lib/components/editor/parseScript/utils.d.ts +1 -0
- package/lib/components/editor/utils/parserTcc.d.ts +1 -0
- package/lib/components/editor/utils/parserTccWorker.d.ts +1 -0
- package/lib/trading-vue-editor.js +2 -2
- package/lib/trading-vue-editor.umd.cjs +1 -1
- package/package.json +1 -1
- package/lib/assets/scriptsRunWorker-CRZrOXN_.js +0 -69
@@ -10,10 +10,10 @@ var ab=Object.defineProperty;var ub=(po,pi,Or)=>pi in po?ab(po,pi,{enumerable:!0
|
|
10
10
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var l,_=!0,o=!1;return{s:function(){m=m.call(f)},n:function(){var u=m.next();return _=u.done,u},e:function(u){o=!0,l=u},f:function(){try{_||m.return==null||m.return()}finally{if(o)throw l}}}}function t_(f,i){(i==null||i>f.length)&&(i=f.length);for(var m=0,s=new Array(i);m<i;m++)s[m]=f[m];return s}function ru(f,i){if(!(f instanceof i))throw new TypeError("Cannot call a class as a function")}function n_(f,i){for(var m=0;m<i.length;m++){var s=i[m];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(f,r_(s.key),s)}}function iu(f,i,m){return i&&n_(f.prototype,i),m&&n_(f,m),Object.defineProperty(f,"prototype",{writable:!1}),f}function r_(f){var i=function(m,s){if(ta(m)!=="object"||m===null)return m;var p=m[Symbol.toPrimitive];if(p!==void 0){var l=p.call(m,"string");if(ta(l)!=="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(m)}(f);return ta(i)==="symbol"?i:String(i)}Yi.EMPTY=new up;var il,ol,hp,i_=function(){function f(i){ru(this,f),this.tokens=i,this.programs=new Map}return iu(f,[{key:"getTokenStream",value:function(){return this.tokens}},{key:"insertAfter",value:function(i,m){var s,p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.DEFAULT_PROGRAM_NAME;s=typeof i=="number"?i:i.tokenIndex;var l=this.getProgram(p),_=new s_(this.tokens,s,l.length,m);l.push(_)}},{key:"insertBefore",value:function(i,m){var s,p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.DEFAULT_PROGRAM_NAME;s=typeof i=="number"?i:i.tokenIndex;var l=this.getProgram(p),_=new ra(this.tokens,s,l.length,m);l.push(_)}},{key:"replaceSingle",value:function(i,m){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.DEFAULT_PROGRAM_NAME;this.replace(i,i,m,s)}},{key:"replace",value:function(i,m,s){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f.DEFAULT_PROGRAM_NAME;if(typeof i!="number"&&(i=i.tokenIndex),typeof m!="number"&&(m=m.tokenIndex),i>m||i<0||m<0||m>=this.tokens.size)throw new RangeError("replace: range invalid: ".concat(i,"..").concat(m,"(size=").concat(this.tokens.size,")"));var l=this.getProgram(p),_=new sl(this.tokens,i,m,l.length,s);l.push(_)}},{key:"delete",value:function(i,m){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.DEFAULT_PROGRAM_NAME;m===void 0&&(m=i),this.replace(i,m,null,s)}},{key:"getProgram",value:function(i){var m=this.programs.get(i);return m==null&&(m=this.initializeProgram(i)),m}},{key:"initializeProgram",value:function(i){var m=[];return this.programs.set(i,m),m}},{key:"getText",value:function(i){var m,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f.DEFAULT_PROGRAM_NAME;m=i instanceof ve?i:new ve(0,this.tokens.size-1),typeof i=="string"&&(s=i);var p=this.programs.get(s),l=m.start,_=m.stop;if(_>this.tokens.size-1&&(_=this.tokens.size-1),l<0&&(l=0),p==null||p.length===0)return this.tokens.getText(new ve(l,_));for(var o=[],u=this.reduceToSingleOperationPerIndex(p),E=l;E<=_&&E<this.tokens.size;){var A=u.get(E);u.delete(E);var x=this.tokens.get(E);A==null?(x.type!==n.EOF&&o.push(String(x.text)),E++):E=A.execute(o)}if(_===this.tokens.size-1){var I,ne=na(u.values());try{for(ne.s();!(I=ne.n()).done;){var we=I.value;we.index>=this.tokens.size-1&&o.push(we.text.toString())}}catch(De){ne.e(De)}finally{ne.f()}}return o.join("")}},{key:"reduceToSingleOperationPerIndex",value:function(i){for(var m=0;m<i.length;m++){var s=i[m];if(s!=null&&s instanceof sl){var p,l=s,_=na(this.getKindOfOps(i,ra,m));try{for(_.s();!(p=_.n()).done;){var o=p.value;o.index===l.index?(i[o.instructionIndex]=void 0,l.text=o.text.toString()+(l.text!=null?l.text.toString():"")):o.index>l.index&&o.index<=l.lastIndex&&(i[o.instructionIndex]=void 0)}}catch(Cr){_.e(Cr)}finally{_.f()}var u,E=na(this.getKindOfOps(i,sl,m));try{for(E.s();!(u=E.n()).done;){var A=u.value;if(A.index>=l.index&&A.lastIndex<=l.lastIndex)i[A.instructionIndex]=void 0;else{var x=A.lastIndex<l.index||A.index>l.lastIndex;if(A.text!=null||l.text!=null||x){if(!x)throw new Error("replace op boundaries of ".concat(l," overlap with previous ").concat(A))}else i[A.instructionIndex]=void 0,l.index=Math.min(A.index,l.index),l.lastIndex=Math.max(A.lastIndex,l.lastIndex)}}}catch(Cr){E.e(Cr)}finally{E.f()}}}for(var I=0;I<i.length;I++){var ne=i[I];if(ne!=null&&ne instanceof ra){var we,De=ne,He=na(this.getKindOfOps(i,ra,I));try{for(He.s();!(we=He.n()).done;){var st=we.value;st.index===De.index&&(st instanceof s_?(De.text=this.catOpText(st.text,De.text),i[st.instructionIndex]=void 0):st instanceof ra&&(De.text=this.catOpText(De.text,st.text),i[st.instructionIndex]=void 0))}}catch(Cr){He.e(Cr)}finally{He.f()}var ze,_n=na(this.getKindOfOps(i,sl,I));try{for(_n.s();!(ze=_n.n()).done;){var pn=ze.value;if(De.index!==pn.index){if(De.index>=pn.index&&De.index<=pn.lastIndex)throw new Error("insert op ".concat(De," within boundaries of previous ").concat(pn))}else pn.text=this.catOpText(De.text,pn.text),i[I]=void 0}}catch(Cr){_n.e(Cr)}finally{_n.f()}}}var zn,$r=new Map,wi=na(i);try{for(wi.s();!(zn=wi.n()).done;){var Ri=zn.value;if(Ri!=null){if($r.get(Ri.index)!=null)throw new Error("should only be one op per index");$r.set(Ri.index,Ri)}}}catch(Cr){wi.e(Cr)}finally{wi.f()}return $r}},{key:"catOpText",value:function(i,m){var s="",p="";return i!=null&&(s=i.toString()),m!=null&&(p=m.toString()),s+p}},{key:"getKindOfOps",value:function(i,m,s){return i.slice(0,s).filter(function(p){return p&&p instanceof m})}}]),f}();il=i_,hp="default",(ol=r_(ol="DEFAULT_PROGRAM_NAME"))in il?Object.defineProperty(il,ol,{value:hp,enumerable:!0,configurable:!0,writable:!0}):il[ol]=hp;var o_=function(){function f(i,m,s,p){ru(this,f),this.tokens=i,this.instructionIndex=s,this.index=m,this.text=p===void 0?"":p}return iu(f,[{key:"toString",value:function(){var i=this.constructor.name,m=i.indexOf("$");return"<"+(i=i.substring(m+1,i.length))+"@"+this.tokens.get(this.index)+':"'+this.text+'">'}}]),f}(),ra=function(f){cp(m,f);var i=fp(m);function m(s,p,l,_){return ru(this,m),i.call(this,s,p,l,_)}return iu(m,[{key:"execute",value:function(s){return this.text&&s.push(this.text.toString()),this.tokens.get(this.index).type!==n.EOF&&s.push(String(this.tokens.get(this.index).text)),this.index+1}}]),m}(o_),s_=function(f){cp(m,f);var i=fp(m);function m(s,p,l,_){return ru(this,m),i.call(this,s,p+1,l,_)}return iu(m)}(ra),sl=function(f){cp(m,f);var i=fp(m);function m(s,p,l,_,o){var u;return ru(this,m),(u=i.call(this,s,p,_,o)).lastIndex=l,u}return iu(m,[{key:"execute",value:function(s){return this.text&&s.push(this.text.toString()),this.lastIndex+1}},{key:"toString",value:function(){return this.text==null?"<DeleteOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+">":"<ReplaceOp@"+this.tokens.get(this.index)+".."+this.tokens.get(this.lastIndex)+':"'+this.text+'">'}}]),m}(o_);const sb={atn:wg,dfa:Pg,context:Fg,misc:Mg,tree:$g,error:Wg,Token:n,CommonToken:Ia,CharStreams:qm,CharStream:tu,InputStream:tu,CommonTokenStream:Zm,Lexer:sr,Parser:ip,ParserRuleContext:up,Interval:ve,IntervalSet:ie,LL1Analyzer:Bo,Utils:Yg,TokenStreamRewriter:i_}})();var Dr=kt.dx,pp=kt.q2;kt.FO,kt.xf,kt.Gy;var a_=kt.s4,u_=kt.c7,dp=kt._7;kt.gp;var c_=kt.cK,l_=kt.zs,f_=kt.AV;kt.Xp,kt.VS,kt.ul;var h_=kt.hW,p_=kt.x1,di=kt.z5;kt.oN;var d_=kt.TB;kt.u1;var m_=kt._b,__=kt.$F,Ye=kt._T,mp=kt.db,y_=kt.Zx,Je=kt._x;kt.r8,kt.JI,kt.TP;var _p=kt.WU;kt.Nj,kt.ZP;const B=class B extends m_{get grammarFileName(){return"tccScriptParser.g4"}get literalNames(){return B.literalNames}get symbolicNames(){return B.symbolicNames}get ruleNames(){return B.ruleNames}get serializedATN(){return B._serializedATN}createFailedPredicateException(e,n){return new l_(this,e,n)}constructor(e){super(e),this._interp=new __(this,B._ATN,B.DecisionsToDFA,new mp)}program(){let e=new g_(this,this._ctx,this.state);this.enterRule(e,0,B.RULE_program);let n;try{this.enterOuterAlt(e,1);{for(this.state=106,this._errHandler.sync(this),n=this._input.LA(1);n===4||n===6||!(n-36&-32)&&1<<n-36&38635767;){switch(this.state=104,this._errHandler.sync(this),this._input.LA(1)){case 61:this.state=102,this.match(B.NEWLINE);break;case 4:case 6:case 36:case 37:case 38:case 40:case 41:case 42:case 43:case 47:case 51:case 52:case 54:case 55:case 58:this.state=103,this.globalStmt();break;default:throw new di(this)}this.state=108,this._errHandler.sync(this),n=this._input.LA(1)}this.state=109,this.match(B.EOF)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}globalStmt(){let e=new al(this,this._ctx,this.state);this.enterRule(e,2,B.RULE_globalStmt);let n;try{switch(this.state=123,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,3,this._ctx)){case 1:this.enterOuterAlt(e,1),this.state=111,this.variableDeclarationStmt(),this.state=113,this._errHandler.sync(this),n=this._input.LA(1),n===8&&(this.state=112,this.match(B.Comma)),this.state=115,this.match(B.NEWLINE);break;case 2:this.enterOuterAlt(e,2),this.state=117,this.blockStmt();break;case 3:this.enterOuterAlt(e,3),this.state=118,this.importStmt();break;case 4:this.enterOuterAlt(e,4),this.state=119,this.arrowFunction();break;case 5:this.enterOuterAlt(e,5),this.state=120,this.arrowMethod();break;case 6:this.enterOuterAlt(e,6),this.state=121,this.typeStatement();break;case 7:this.enterOuterAlt(e,7),this.state=122,this.enumStatement();break}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}blockStmt(){let e=new yp(this,this._ctx,this.state);this.enterRule(e,4,B.RULE_blockStmt);try{let n;this.enterOuterAlt(e,1);{for(this.state=130,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,4,this._ctx);n!==2&&n!==Dr.INVALID_ALT_NUMBER;)n===1&&(this.state=125,this.variableDeclarationStmt(),this.state=126,this.match(B.Comma)),this.state=132,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,4,this._ctx);switch(this.state=135,this._errHandler.sync(this),this._input.LA(1)){case 4:case 6:case 38:case 40:case 47:case 51:case 54:case 55:case 58:this.state=133,this.varBlockStmt();break;case 37:case 41:case 42:case 43:this.state=134,this.blockExpression();break;default:throw new di(this)}}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}stmt(){let e=new ul(this,this._ctx,this.state);this.enterRule(e,6,B.RULE_stmt);let n;try{switch(this.state=144,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,7,this._ctx)){case 1:this.enterOuterAlt(e,1),this.state=137,this.simpleStmt(),this.state=139,this._errHandler.sync(this),n=this._input.LA(1),n===8&&(this.state=138,this.match(B.Comma)),this.state=141,this.match(B.NEWLINE);break;case 2:this.enterOuterAlt(e,2),this.state=143,this.expressionBlockSequence();break}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}simpleStmt(){let e=new cl(this,this._ctx,this.state);this.enterRule(e,8,B.RULE_simpleStmt);try{switch(this.state=150,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,8,this._ctx)){case 1:this.enterOuterAlt(e,1),this.state=146,this.expressionSequence();break;case 2:this.enterOuterAlt(e,2),this.state=147,this.blockSequence();break;case 3:this.enterOuterAlt(e,3),this.state=148,this.brackethesized();break;case 4:this.enterOuterAlt(e,4),this.state=149,this.flowStmt();break}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}flowStmt(){let e=new gp(this,this._ctx,this.state);this.enterRule(e,10,B.RULE_flowStmt);let n;try{this.enterOuterAlt(e,1),this.state=152,n=this._input.LA(1),n===34||n===39?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}block(){let e=new ia(this,this._ctx,this.state);this.enterRule(e,12,B.RULE_block);let n;try{switch(this.state=161,this._errHandler.sync(this),this._input.LA(1)){case 4:case 6:case 12:case 13:case 31:case 32:case 33:case 34:case 38:case 39:case 40:case 46:case 47:case 51:case 54:case 55:case 56:case 57:case 58:this.enterOuterAlt(e,1),this.state=154,this.simpleStmt(),this.state=156,this._errHandler.sync(this),n=this._input.LA(1),n===8&&(this.state=155,this.match(B.Comma)),this.state=158,this.match(B.NEWLINE);break;case 61:this.enterOuterAlt(e,2),this.state=160,this.blockLine();break;default:throw new di(this)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}blockLine(){let e=new mo(this,this._ctx,this.state);this.enterRule(e,14,B.RULE_blockLine);let n;try{this.enterOuterAlt(e,1);{this.state=163,this.match(B.NEWLINE),this.state=164,this.match(B.INDENT),this.state=166,this._errHandler.sync(this),n=this._input.LA(1);do this.state=165,this.stmt(),this.state=168,this._errHandler.sync(this),n=this._input.LA(1);while(!(n&-32)&&1<<n&2147496016||!(n-32&-32)&&1<<n-32&130600935);this.state=170,this.match(B.DEDENT)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}variableDeclarationStmt(){let e=new ou(this,this._ctx,this.state);this.enterRule(e,16,B.RULE_variableDeclarationStmt);try{let n;this.enterOuterAlt(e,1);{switch(this.state=174,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,12,this._ctx)){case 1:this.state=172,this.methodStmt();break;case 2:this.state=173,this.variableDeclarationList();break}for(this.state=183,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,14,this._ctx);n!==2&&n!==Dr.INVALID_ALT_NUMBER;){if(n===1)switch(this.state=176,this.match(B.Comma),this.state=179,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,13,this._ctx)){case 1:this.state=177,this.methodStmt();break;case 2:this.state=178,this.variableDeclarationList();break}this.state=185,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,14,this._ctx)}}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}variableDeclarationList(){let e=new Ni(this,this._ctx,this.state);this.enterRule(e,18,B.RULE_variableDeclarationList);try{switch(this.state=194,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,15,this._ctx)){case 1:e=new v_(this,e),this.enterOuterAlt(e,1),this.state=186,this.varArrayDeclaration(),this.state=187,this.match(B.Assign),this.state=188,this.singleExpression(0);break;case 2:e=new b_(this,e),this.enterOuterAlt(e,2),this.state=190,this.name(),this.state=191,this.assignmentOperator(),this.state=192,this.singleExpression(0);break}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}varModifier(){let e=new ll(this,this._ctx,this.state);this.enterRule(e,20,B.RULE_varModifier);let n;try{this.enterOuterAlt(e,1),this.state=196,n=this._input.LA(1),n===38||n===40?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}blockSequence(){let e=new bp(this,this._ctx,this.state);this.enterRule(e,22,B.RULE_blockSequence);try{let n;this.enterOuterAlt(e,1);{switch(this.state=200,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,16,this._ctx)){case 1:this.state=198,this.singleExpression(0);break;case 2:this.state=199,this.variableDeclarationList();break}for(this.state=209,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,18,this._ctx);n!==2&&n!==Dr.INVALID_ALT_NUMBER;){if(n===1)switch(this.state=202,this.match(B.Comma),this.state=205,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,17,this._ctx)){case 1:this.state=203,this.singleExpression(0);break;case 2:this.state=204,this.variableDeclarationList();break}this.state=211,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,18,this._ctx)}}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}expressionSequence(){let e=new fl(this,this._ctx,this.state);this.enterRule(e,24,B.RULE_expressionSequence);try{let n;for(this.enterOuterAlt(e,1),this.state=212,this.singleExpression(0),this.state=217,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,19,this._ctx);n!==2&&n!==Dr.INVALID_ALT_NUMBER;)n===1&&(this.state=213,this.match(B.Comma),this.state=214,this.singleExpression(0)),this.state=219,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,19,this._ctx)}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}expressionBlockSequence(){let e=new vp(this,this._ctx,this.state);this.enterRule(e,26,B.RULE_expressionBlockSequence);try{let n;this.enterOuterAlt(e,1);{for(this.state=228,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,21,this._ctx);n!==2&&n!==Dr.INVALID_ALT_NUMBER;){if(n===1){switch(this.state=222,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,20,this._ctx)){case 1:this.state=220,this.singleExpression(0);break;case 2:this.state=221,this.variableDeclarationList();break}this.state=224,this.match(B.Comma)}this.state=230,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,21,this._ctx)}switch(this.state=233,this._errHandler.sync(this),this._input.LA(1)){case 4:case 6:case 38:case 40:case 47:case 51:case 54:case 55:case 58:this.state=231,this.varBlockStmt();break;case 37:case 41:case 42:case 43:this.state=232,this.blockExpression();break;default:throw new di(this)}}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}varBlockStmt(){let e=new hl(this,this._ctx,this.state);this.enterRule(e,28,B.RULE_varBlockStmt);try{this.enterOuterAlt(e,1);{switch(this.state=241,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,23,this._ctx)){case 1:this.state=235,this.varArrayDeclaration(),this.state=236,this.match(B.Assign);break;case 2:this.state=238,this.name(),this.state=239,this.assignmentOperator();break}this.state=243,this.blockExpression()}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}varArrayDeclaration(){let e=new oa(this,this._ctx,this.state);this.enterRule(e,30,B.RULE_varArrayDeclaration);let n;try{switch(this.state=263,this._errHandler.sync(this),this._input.LA(1)){case 38:case 40:case 47:case 51:case 54:case 55:case 58:e=new S_(this,e),this.enterOuterAlt(e,1);{switch(this.state=246,this._errHandler.sync(this),n=this._input.LA(1),(n===38||n===40)&&(this.state=245,this.varModifier()),this.state=249,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,25,this._ctx)){case 1:this.state=248,this.typeGather();break}this.state=251,this.identifier()}break;case 4:e=new E_(this,e),this.enterOuterAlt(e,2);{for(this.state=252,this.match(B.OpenBracket),this.state=253,this.identifier(),this.state=258,this._errHandler.sync(this),n=this._input.LA(1);n===8;)this.state=254,this.match(B.Comma),this.state=255,this.identifier(),this.state=260,this._errHandler.sync(this),n=this._input.LA(1);this.state=261,this.match(B.CloseBracket)}break;default:throw new di(this)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}blockExpression(){let e=new su(this,this._ctx,this.state);this.enterRule(e,32,B.RULE_blockExpression);try{switch(this.state=269,this._errHandler.sync(this),this._input.LA(1)){case 43:this.enterOuterAlt(e,1),this.state=265,this.ifStatement();break;case 37:this.enterOuterAlt(e,2),this.state=266,this.forStatement();break;case 42:this.enterOuterAlt(e,3),this.state=267,this.whileStatement();break;case 41:this.enterOuterAlt(e,4),this.state=268,this.switchStatement();break;default:throw new di(this)}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}singleExpression(e){e===void 0&&(e=0);let n=this._ctx,r=this.state,a=new $e(this,this._ctx,r),c=a,h=34;this.enterRecursionRule(a,34,B.RULE_singleExpression,e);let d;try{let v;this.enterOuterAlt(a,1);{switch(this.state=283,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,29,this._ctx)){case 1:a=new P_(this,a),this._ctx=a,c=a,this.state=272,this.methodStmt();break;case 2:a=new R_(this,a),this._ctx=a,c=a,this.state=273,d=this._input.LA(1),d===12||d===13?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=274,this.singleExpression(12);break;case 3:a=new N_(this,a),this._ctx=a,c=a,this.state=275,this.match(B.Not),this.state=276,this.singleExpression(11);break;case 4:a=new D_(this,a),this._ctx=a,c=a,this.state=277,this.name();break;case 5:a=new k_(this,a),this._ctx=a,c=a,this.state=278,this.literal();break;case 6:a=new T_(this,a),this._ctx=a,c=a,this.state=279,this.match(B.OpenParen),this.state=280,this.singleExpression(0),this.state=281,this.match(B.CloseParen);break}for(this._ctx.stop=this._input.LT(-1),this.state=316,this._errHandler.sync(this),v=this._interp.adaptivePredict(this._input,31,this._ctx);v!==2&&v!==Dr.INVALID_ALT_NUMBER;){if(v===1)switch(this._parseListeners!=null&&this.triggerExitRuleEvent(),c=a,this.state=314,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,30,this._ctx)){case 1:{if(a=new M_(this,new $e(this,n,r)),this.pushNewRecursionContext(a,h,B.RULE_singleExpression),this.state=285,!this.precpred(this._ctx,10))throw this.createFailedPredicateException("this.precpred(this._ctx, 10)");this.state=286,d=this._input.LA(1),!(d&-32)&&1<<d&114688?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=287,this.singleExpression(11)}break;case 2:{if(a=new x_(this,new $e(this,n,r)),this.pushNewRecursionContext(a,h,B.RULE_singleExpression),this.state=288,!this.precpred(this._ctx,9))throw this.createFailedPredicateException("this.precpred(this._ctx, 9)");this.state=289,d=this._input.LA(1),d===12||d===13?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=290,this.singleExpression(10)}break;case 3:{if(a=new A_(this,new $e(this,n,r)),this.pushNewRecursionContext(a,h,B.RULE_singleExpression),this.state=291,!this.precpred(this._ctx,8))throw this.createFailedPredicateException("this.precpred(this._ctx, 8)");this.state=292,d=this._input.LA(1),!(d&-32)&&1<<d&3932160?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=293,this.singleExpression(9)}break;case 4:{if(a=new F_(this,new $e(this,n,r)),this.pushNewRecursionContext(a,h,B.RULE_singleExpression),this.state=294,!this.precpred(this._ctx,7))throw this.createFailedPredicateException("this.precpred(this._ctx, 7)");this.state=295,d=this._input.LA(1),d===22||d===23?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this),this.state=296,this.singleExpression(8)}break;case 5:{if(a=new O_(this,new $e(this,n,r)),this.pushNewRecursionContext(a,h,B.RULE_singleExpression),this.state=297,!this.precpred(this._ctx,6))throw this.createFailedPredicateException("this.precpred(this._ctx, 6)");this.state=298,this.match(B.And),this.state=299,this.singleExpression(7)}break;case 6:{if(a=new w_(this,new $e(this,n,r)),this.pushNewRecursionContext(a,h,B.RULE_singleExpression),this.state=300,!this.precpred(this._ctx,5))throw this.createFailedPredicateException("this.precpred(this._ctx, 5)");this.state=301,this.match(B.Or),this.state=302,this.singleExpression(6)}break;case 7:{if(a=new C_(this,new $e(this,n,r)),this.pushNewRecursionContext(a,h,B.RULE_singleExpression),this.state=303,!this.precpred(this._ctx,4))throw this.createFailedPredicateException("this.precpred(this._ctx, 4)");this.state=304,this.match(B.QuestionMark),this.state=305,this.singleExpression(0),this.state=306,this.match(B.Colon),this.state=307,this.singleExpression(4)}break;case 8:{if(a=new I_(this,new $e(this,n,r)),this.pushNewRecursionContext(a,h,B.RULE_singleExpression),this.state=309,!this.precpred(this._ctx,13))throw this.createFailedPredicateException("this.precpred(this._ctx, 13)");this.state=310,this.match(B.OpenBracket),this.state=311,this.singleExpression(0),this.state=312,this.match(B.CloseBracket)}break}this.state=318,this._errHandler.sync(this),v=this._interp.adaptivePredict(this._input,31,this._ctx)}}}catch(v){if(v instanceof Je)a.exception=v,this._errHandler.reportError(this,v),this._errHandler.recover(this,v);else throw v}finally{this.unrollRecursionContexts(n)}return a}brackethesized(){let e=new pl(this,this._ctx,this.state);this.enterRule(e,36,B.RULE_brackethesized);try{this.enterOuterAlt(e,1),this.state=319,this.match(B.OpenBracket),this.state=320,this.expressionSequence(),this.state=321,this.match(B.CloseBracket)}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}arguments(){let e=new Ep(this,this._ctx,this.state);this.enterRule(e,38,B.RULE_arguments);let n;try{let r;this.enterOuterAlt(e,1);{if(this.state=323,this.match(B.OpenParen),this.state=335,this._errHandler.sync(this),n=this._input.LA(1),!(n&-32)&&1<<n&2147496016||!(n-32&-32)&&1<<n-32&130596867){for(this.state=324,this.argument(),this.state=329,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,32,this._ctx);r!==2&&r!==Dr.INVALID_ALT_NUMBER;)r===1&&(this.state=325,this.match(B.Comma),this.state=326,this.argument()),this.state=331,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,32,this._ctx);this.state=333,this._errHandler.sync(this),n=this._input.LA(1),n===8&&(this.state=332,this.match(B.Comma))}this.state=337,this.match(B.CloseParen)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}argument(){let e=new dl(this,this._ctx,this.state);this.enterRule(e,40,B.RULE_argument);try{this.enterOuterAlt(e,1);{switch(this.state=342,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,35,this._ctx)){case 1:this.state=339,this.identifier(),this.state=340,this.match(B.Assign);break}switch(this.state=346,this._errHandler.sync(this),this._input.LA(1)){case 6:case 12:case 13:case 31:case 32:case 33:case 46:case 47:case 51:case 54:case 55:case 56:case 57:case 58:this.state=344,this.singleExpression(0);break;case 4:this.state=345,this.brackethesized();break;default:throw new di(this)}}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}ifStatement(){let e=new Sp(this,this._ctx,this.state);this.enterRule(e,42,B.RULE_ifStatement);let n;try{let r;this.enterOuterAlt(e,1);{for(this.state=348,this.match(B.If),this.state=349,this.singleExpression(0),this.state=350,this.blockLine(),this.state=358,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,37,this._ctx);r!==2&&r!==Dr.INVALID_ALT_NUMBER;)r===1&&(this.state=351,this.match(B.Else),this.state=352,this.match(B.If),this.state=353,this.singleExpression(0),this.state=354,this.blockLine()),this.state=360,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,37,this._ctx);this.state=363,this._errHandler.sync(this),n=this._input.LA(1),n===48&&(this.state=361,this.match(B.Else),this.state=362,this.blockLine())}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}forStatement(){let e=new au(this,this._ctx,this.state);this.enterRule(e,44,B.RULE_forStatement);let n;try{switch(this.state=397,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,43,this._ctx)){case 1:e=new L_(this,e),this.enterOuterAlt(e,1);{switch(this.state=365,this.match(B.For),this.state=367,this._errHandler.sync(this),n=this._input.LA(1),(n===38||n===40)&&(this.state=366,this.varModifier()),this.state=370,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,40,this._ctx)){case 1:this.state=369,this.typeGather();break}this.state=372,this.identifier(),this.state=373,this.match(B.Assign),this.state=374,this.singleExpression(0),this.state=375,this.match(B.To),this.state=376,this.singleExpression(0),this.state=379,this._errHandler.sync(this),n=this._input.LA(1),n===50&&(this.state=377,this.match(B.By),this.state=378,this.singleExpression(0)),this.state=381,this.blockLine()}break;case 2:e=new B_(this,e),this.enterOuterAlt(e,2);{switch(this.state=383,this.match(B.For),this.state=391,this._errHandler.sync(this),this._input.LA(1)){case 47:case 51:case 54:case 55:case 58:this.state=384,this.identifier();break;case 4:this.state=385,this.match(B.OpenBracket),this.state=386,this.identifier(),this.state=387,this.match(B.Comma),this.state=388,this.identifier(),this.state=389,this.match(B.CloseBracket);break;default:throw new di(this)}this.state=393,this.match(B.In),this.state=394,this.singleExpression(0),this.state=395,this.blockLine()}break}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}switchStatement(){let e=new Tp(this,this._ctx,this.state);this.enterRule(e,46,B.RULE_switchStatement);let n;try{this.enterOuterAlt(e,1);{switch(this.state=399,this.match(B.Switch),this.state=401,this._errHandler.sync(this),n=this._input.LA(1),(!(n&-32)&&1<<n&2147496e3||!(n-32&-32)&&1<<n-32&130596867)&&(this.state=400,this.singleExpression(0)),this.state=403,this.match(B.NEWLINE),this.state=404,this.match(B.INDENT),this.state=417,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,47,this._ctx)){case 1:{this.state=406,this._errHandler.sync(this),n=this._input.LA(1);do this.state=405,this.caseClause(),this.state=408,this._errHandler.sync(this),n=this._input.LA(1);while(!(n&-32)&&1<<n&2147496e3||!(n-32&-32)&&1<<n-32&130596867)}break;case 2:{for(this.state=413,this._errHandler.sync(this),n=this._input.LA(1);!(n&-32)&&1<<n&2147496e3||!(n-32&-32)&&1<<n-32&130596867;)this.state=410,this.caseClause(),this.state=415,this._errHandler.sync(this),n=this._input.LA(1);this.state=416,this.defaultCaluse()}break}this.state=419,this.match(B.DEDENT)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}caseClause(){let e=new ml(this,this._ctx,this.state);this.enterRule(e,48,B.RULE_caseClause);try{this.enterOuterAlt(e,1),this.state=421,this.singleExpression(0),this.state=422,this.match(B.ARROW),this.state=423,this.block()}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}defaultCaluse(){let e=new xp(this,this._ctx,this.state);this.enterRule(e,50,B.RULE_defaultCaluse);try{this.enterOuterAlt(e,1),this.state=425,this.match(B.ARROW),this.state=426,this.block()}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}whileStatement(){let e=new Ap(this,this._ctx,this.state);this.enterRule(e,52,B.RULE_whileStatement);try{this.enterOuterAlt(e,1),this.state=428,this.match(B.While),this.state=429,this.singleExpression(0),this.state=430,this.blockLine()}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}importStmt(){let e=new Cp(this,this._ctx,this.state);this.enterRule(e,54,B.RULE_importStmt);let n;try{let r;this.enterOuterAlt(e,1);{for(this.state=432,this.importElement(),this.state=437,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,48,this._ctx);r!==2&&r!==Dr.INVALID_ALT_NUMBER;)r===1&&(this.state=433,this.match(B.Comma),this.state=434,this.importElement()),this.state=439,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,48,this._ctx);this.state=441,this._errHandler.sync(this),n=this._input.LA(1),n===8&&(this.state=440,this.match(B.Comma)),this.state=443,this.match(B.NEWLINE)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}importElement(){let e=new _l(this,this._ctx,this.state);this.enterRule(e,56,B.RULE_importElement);let n;try{this.enterOuterAlt(e,1),this.state=445,this.match(B.Import),this.state=446,this.identifier(),this.state=447,this.match(B.Divide),this.state=448,this.identifier(),this.state=449,this.match(B.Divide),this.state=450,this.match(B.IntegerLiteral),this.state=453,this._errHandler.sync(this),n=this._input.LA(1),n===53&&(this.state=451,this.match(B.As),this.state=452,this.identifier())}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}literal(){let e=new Op(this,this._ctx,this.state);this.enterRule(e,58,B.RULE_literal);let n;try{this.enterOuterAlt(e,1),this.state=455,n=this._input.LA(1),!(n-31&-32)&&1<<n-31&100663303?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}methodStmt(){let e=new uu(this,this._ctx,this.state);this.enterRule(e,60,B.RULE_methodStmt);try{let n;for(this.enterOuterAlt(e,1),this.state=457,this.methodElement(),this.state=462,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,51,this._ctx);n!==2&&n!==Dr.INVALID_ALT_NUMBER;)n===1&&(this.state=458,this.match(B.Point),this.state=459,this.methodElement()),this.state=464,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,51,this._ctx)}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}methodElement(){let e=new sa(this,this._ctx,this.state);this.enterRule(e,62,B.RULE_methodElement);try{this.enterOuterAlt(e,1),this.state=465,this.methodName(),this.state=466,this.arguments()}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}methodName(){let e=new Dp(this,this._ctx,this.state);this.enterRule(e,64,B.RULE_methodName);let n;try{let r;this.enterOuterAlt(e,1);{switch(this.state=481,this._errHandler.sync(this),this._input.LA(1)){case 47:case 51:case 54:case 55:case 58:for(this.state=473,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,52,this._ctx);r!==2&&r!==Dr.INVALID_ALT_NUMBER;)r===1&&(this.state=468,this.identifier(),this.state=469,this.match(B.Point)),this.state=475,this._errHandler.sync(this),r=this._interp.adaptivePredict(this._input,52,this._ctx);break;case 6:this.state=476,this.match(B.OpenParen),this.state=477,this.singleExpression(0),this.state=478,this.match(B.CloseParen),this.state=479,this.match(B.Point);break;default:throw new di(this)}this.state=483,this.identifier(),this.state=492,this._errHandler.sync(this),n=this._input.LA(1),n===18&&(this.state=484,this.match(B.LessThan),this.state=485,this.typeName(),this.state=488,this._errHandler.sync(this),n=this._input.LA(1),n===8&&(this.state=486,this.match(B.Comma),this.state=487,this.typeName()),this.state=490,this.match(B.MoreThan))}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arrowFunction(){let e=new kp(this,this._ctx,this.state);this.enterRule(e,66,B.RULE_arrowFunction);let n;try{this.enterOuterAlt(e,1),this.state=495,this._errHandler.sync(this),n=this._input.LA(1),n===36&&(this.state=494,this.match(B.Export)),this.state=497,this.identifier(),this.state=498,this.arrowFunctionParameters(),this.state=499,this.match(B.ARROW),this.state=500,this.block()}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arrowFunctionParameters(){let e=new wp(this,this._ctx,this.state);this.enterRule(e,68,B.RULE_arrowFunctionParameters);let n;try{this.enterOuterAlt(e,1),this.state=502,this.match(B.OpenParen),this.state=504,this._errHandler.sync(this),n=this._input.LA(1),!(n-47&-32)&&1<<n-47&2449&&(this.state=503,this.formalParameterList()),this.state=506,this.match(B.CloseParen)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}formalParameterList(){let e=new yl(this,this._ctx,this.state);this.enterRule(e,70,B.RULE_formalParameterList);let n;try{for(this.enterOuterAlt(e,1),this.state=508,this.formalParameterArg(),this.state=513,this._errHandler.sync(this),n=this._input.LA(1);n===8;)this.state=509,this.match(B.Comma),this.state=510,this.formalParameterArg(),this.state=515,this._errHandler.sync(this),n=this._input.LA(1)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}formalParameterArg(){let e=new gl(this,this._ctx,this.state);this.enterRule(e,72,B.RULE_formalParameterArg);let n;try{this.enterOuterAlt(e,1);{switch(this.state=517,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,59,this._ctx)){case 1:this.state=516,this.typeGather();break}this.state=519,this.identifier(),this.state=522,this._errHandler.sync(this),n=this._input.LA(1),n===9&&(this.state=520,this.match(B.Assign),this.state=521,this.singleExpression(0))}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arrowMethod(){let e=new Rp(this,this._ctx,this.state);this.enterRule(e,74,B.RULE_arrowMethod);let n;try{this.enterOuterAlt(e,1),this.state=525,this._errHandler.sync(this),n=this._input.LA(1),n===36&&(this.state=524,this.match(B.Export)),this.state=527,this.match(B.Method),this.state=528,this.identifier(),this.state=529,this.arrowMethodParameters(),this.state=530,this.match(B.ARROW),this.state=531,this.block()}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}arrowMethodParameters(){let e=new Np(this,this._ctx,this.state);this.enterRule(e,76,B.RULE_arrowMethodParameters);let n;try{this.enterOuterAlt(e,1),this.state=533,this.match(B.OpenParen),this.state=534,this.typeGather(),this.state=535,this.identifier(),this.state=538,this._errHandler.sync(this),n=this._input.LA(1),n===9&&(this.state=536,this.match(B.Assign),this.state=537,this.singleExpression(0)),this.state=542,this._errHandler.sync(this),n=this._input.LA(1),n===8&&(this.state=540,this.match(B.Comma),this.state=541,this.formalParameterList()),this.state=544,this.match(B.CloseParen)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}typeStatement(){let e=new Ip(this,this._ctx,this.state);this.enterRule(e,78,B.RULE_typeStatement);let n;try{this.enterOuterAlt(e,1);{this.state=547,this._errHandler.sync(this),n=this._input.LA(1),n===36&&(this.state=546,this.match(B.Export)),this.state=549,this.match(B.Type),this.state=550,this.identifier(),this.state=551,this.match(B.NEWLINE),this.state=552,this.match(B.INDENT),this.state=554,this._errHandler.sync(this),n=this._input.LA(1);do this.state=553,this.typeElement(),this.state=556,this._errHandler.sync(this),n=this._input.LA(1);while(!(n-40&-32)&&1<<n-40&313473);this.state=558,this.match(B.DEDENT)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}typeElement(){let e=new bl(this,this._ctx,this.state);this.enterRule(e,80,B.RULE_typeElement);let n;try{this.enterOuterAlt(e,1);{switch(this.state=561,this._errHandler.sync(this),n=this._input.LA(1),n===40&&(this.state=560,this.match(B.Varip)),this.state=564,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,67,this._ctx)){case 1:this.state=563,this.typeGather();break}this.state=566,this.identifier(),this.state=569,this._errHandler.sync(this),n=this._input.LA(1),n===9&&(this.state=567,this.match(B.Assign),this.state=568,this.singleExpression(0)),this.state=571,this.match(B.NEWLINE)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}assignmentOperator(){let e=new vl(this,this._ctx,this.state);this.enterRule(e,82,B.RULE_assignmentOperator);let n;try{this.enterOuterAlt(e,1),this.state=573,n=this._input.LA(1),!(n&-32)&&1<<n&1593835520?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}typeMap(){let e=new El(this,this._ctx,this.state);this.enterRule(e,84,B.RULE_typeMap);try{this.enterOuterAlt(e,1),this.state=575,this.match(B.Map),this.state=576,this.match(B.LessThan),this.state=577,this.typeName(),this.state=578,this.match(B.Comma),this.state=579,this.typeName(),this.state=580,this.match(B.MoreThan)}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}typeSeries(){let e=new Pp(this,this._ctx,this.state);this.enterRule(e,86,B.RULE_typeSeries);try{switch(this.enterOuterAlt(e,1),this.state=582,this.typeName(),this.state=586,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,69,this._ctx)){case 1:this.state=583,this.typeName();break;case 2:this.state=584,this.typeArray();break;case 3:this.state=585,this.typeMap();break}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}typeArray(){let e=new Sl(this,this._ctx,this.state);this.enterRule(e,88,B.RULE_typeArray);try{switch(this.state=597,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,70,this._ctx)){case 1:this.enterOuterAlt(e,1),this.state=588,this.typeName(),this.state=589,this.match(B.LessThan),this.state=590,this.typeName(),this.state=591,this.match(B.MoreThan);break;case 2:this.enterOuterAlt(e,2),this.state=593,this.typeName(),this.state=594,this.match(B.OpenBracket),this.state=595,this.match(B.CloseBracket);break}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}typeGather(){let e=new jo(this,this._ctx,this.state);this.enterRule(e,90,B.RULE_typeGather);try{switch(this.state=603,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,71,this._ctx)){case 1:this.enterOuterAlt(e,1),this.state=599,this.typeName();break;case 2:this.enterOuterAlt(e,2),this.state=600,this.typeArray();break;case 3:this.enterOuterAlt(e,3),this.state=601,this.typeMap();break;case 4:this.enterOuterAlt(e,4),this.state=602,this.typeSeries();break}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}identifier(){let e=new yn(this,this._ctx,this.state);this.enterRule(e,92,B.RULE_identifier);let n;try{this.enterOuterAlt(e,1),this.state=605,n=this._input.LA(1),!(n-47&-32)&&1<<n-47&2449?(this._errHandler.reportMatch(this),this.consume()):this._errHandler.recoverInline(this)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}typeName(){let e=new mi(this,this._ctx,this.state);this.enterRule(e,94,B.RULE_typeName);let n;try{this.enterOuterAlt(e,1),this.state=607,this.identifier(),this.state=610,this._errHandler.sync(this),n=this._input.LA(1),n===3&&(this.state=608,this.match(B.Point),this.state=609,this.identifier())}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}name(){let e=new cu(this,this._ctx,this.state);this.enterRule(e,96,B.RULE_name);try{let n;switch(this.state=633,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,76,this._ctx)){case 1:this.enterOuterAlt(e,1);{for(this.state=620,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,74,this._ctx);n!==2&&n!==Dr.INVALID_ALT_NUMBER;){if(n===1){switch(this.state=614,this._errHandler.sync(this),this._interp.adaptivePredict(this._input,73,this._ctx)){case 1:this.state=612,this.identifier();break;case 2:this.state=613,this.methodElement();break}this.state=616,this.match(B.Point)}this.state=622,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,74,this._ctx)}this.state=623,this.identifier()}break;case 2:this.enterOuterAlt(e,2);{this.state=624,this.match(B.OpenParen),this.state=625,this.singleExpression(0),this.state=626,this.match(B.CloseParen),this.state=629,this._errHandler.sync(this),n=1;do{switch(n){case 1:this.state=627,this.match(B.Point),this.state=628,this.identifier();break;default:throw new di(this)}this.state=631,this._errHandler.sync(this),n=this._interp.adaptivePredict(this._input,75,this._ctx)}while(n!==2&&n!==Dr.INVALID_ALT_NUMBER)}break}}catch(n){if(n instanceof Je)e.exception=n,this._errHandler.reportError(this,n),this._errHandler.recover(this,n);else throw n}finally{this.exitRule()}return e}enumStatement(){let e=new Fp(this,this._ctx,this.state);this.enterRule(e,98,B.RULE_enumStatement);let n;try{this.enterOuterAlt(e,1);{this.state=636,this._errHandler.sync(this),n=this._input.LA(1),n===36&&(this.state=635,this.match(B.Export)),this.state=638,this.match(B.Enum),this.state=639,this.identifier(),this.state=640,this.match(B.NEWLINE),this.state=641,this.match(B.INDENT),this.state=643,this._errHandler.sync(this),n=this._input.LA(1);do this.state=642,this.enumElement(),this.state=645,this._errHandler.sync(this),n=this._input.LA(1);while(!(n-47&-32)&&1<<n-47&2449);this.state=647,this.match(B.DEDENT)}}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}enumElement(){let e=new Tl(this,this._ctx,this.state);this.enterRule(e,100,B.RULE_enumElement);let n;try{this.enterOuterAlt(e,1),this.state=649,this.identifier(),this.state=652,this._errHandler.sync(this),n=this._input.LA(1),n===9&&(this.state=650,this.match(B.Assign),this.state=651,this.match(B.StringLiteral)),this.state=654,this.match(B.NEWLINE)}catch(r){if(r instanceof Je)e.exception=r,this._errHandler.reportError(this,r),this._errHandler.recover(this,r);else throw r}finally{this.exitRule()}return e}sempred(e,n,r){switch(n){case 17:return this.singleExpression_sempred(e,r)}return!0}singleExpression_sempred(e,n){switch(n){case 0:return this.precpred(this._ctx,10);case 1:return this.precpred(this._ctx,9);case 2:return this.precpred(this._ctx,8);case 3:return this.precpred(this._ctx,7);case 4:return this.precpred(this._ctx,6);case 5:return this.precpred(this._ctx,5);case 6:return this.precpred(this._ctx,4);case 7:return this.precpred(this._ctx,13)}return!0}static get _ATN(){return B.__ATN||(B.__ATN=new pp().deserialize(B._serializedATN)),B.__ATN}};w(B,"INDENT",1),w(B,"DEDENT",2),w(B,"Point",3),w(B,"OpenBracket",4),w(B,"CloseBracket",5),w(B,"OpenParen",6),w(B,"CloseParen",7),w(B,"Comma",8),w(B,"Assign",9),w(B,"QuestionMark",10),w(B,"Colon",11),w(B,"Plus",12),w(B,"Minus",13),w(B,"Multiply",14),w(B,"Divide",15),w(B,"Modulus",16),w(B,"Hashtag",17),w(B,"LessThan",18),w(B,"MoreThan",19),w(B,"LessThanEquals",20),w(B,"GreaterThanEquals",21),w(B,"Equals_",22),w(B,"NotEquals",23),w(B,"MultiplyAssign",24),w(B,"DivideAssign",25),w(B,"ModulusAssign",26),w(B,"PlusAssign",27),w(B,"MinusAssign",28),w(B,"ARROW",29),w(B,"ColonEquals",30),w(B,"BooleanLiteral",31),w(B,"IntegerLiteral",32),w(B,"DecimalLiteral",33),w(B,"Break",34),w(B,"And",35),w(B,"Export",36),w(B,"For",37),w(B,"Var",38),w(B,"Continue",39),w(B,"Varip",40),w(B,"Switch",41),w(B,"While",42),w(B,"If",43),w(B,"In",44),w(B,"Or",45),w(B,"Not",46),w(B,"Method",47),w(B,"Else",48),w(B,"To",49),w(B,"By",50),w(B,"Type",51),w(B,"Import",52),w(B,"As",53),w(B,"Enum",54),w(B,"Map",55),w(B,"ColorLiteral",56),w(B,"StringLiteral",57),w(B,"Identifier",58),w(B,"HIDDEN_",59),w(B,"COMMENT_",60),w(B,"NEWLINE",61),w(B,"EOF",_p.EOF),w(B,"RULE_program",0),w(B,"RULE_globalStmt",1),w(B,"RULE_blockStmt",2),w(B,"RULE_stmt",3),w(B,"RULE_simpleStmt",4),w(B,"RULE_flowStmt",5),w(B,"RULE_block",6),w(B,"RULE_blockLine",7),w(B,"RULE_variableDeclarationStmt",8),w(B,"RULE_variableDeclarationList",9),w(B,"RULE_varModifier",10),w(B,"RULE_blockSequence",11),w(B,"RULE_expressionSequence",12),w(B,"RULE_expressionBlockSequence",13),w(B,"RULE_varBlockStmt",14),w(B,"RULE_varArrayDeclaration",15),w(B,"RULE_blockExpression",16),w(B,"RULE_singleExpression",17),w(B,"RULE_brackethesized",18),w(B,"RULE_arguments",19),w(B,"RULE_argument",20),w(B,"RULE_ifStatement",21),w(B,"RULE_forStatement",22),w(B,"RULE_switchStatement",23),w(B,"RULE_caseClause",24),w(B,"RULE_defaultCaluse",25),w(B,"RULE_whileStatement",26),w(B,"RULE_importStmt",27),w(B,"RULE_importElement",28),w(B,"RULE_literal",29),w(B,"RULE_methodStmt",30),w(B,"RULE_methodElement",31),w(B,"RULE_methodName",32),w(B,"RULE_arrowFunction",33),w(B,"RULE_arrowFunctionParameters",34),w(B,"RULE_formalParameterList",35),w(B,"RULE_formalParameterArg",36),w(B,"RULE_arrowMethod",37),w(B,"RULE_arrowMethodParameters",38),w(B,"RULE_typeStatement",39),w(B,"RULE_typeElement",40),w(B,"RULE_assignmentOperator",41),w(B,"RULE_typeMap",42),w(B,"RULE_typeSeries",43),w(B,"RULE_typeArray",44),w(B,"RULE_typeGather",45),w(B,"RULE_identifier",46),w(B,"RULE_typeName",47),w(B,"RULE_name",48),w(B,"RULE_enumStatement",49),w(B,"RULE_enumElement",50),w(B,"literalNames",[null,null,null,"'.'","'['","']'","'('","')'","','","'='","'?'","':'","'+'","'-'","'*'","'/'","'%'","'#'","'<'","'>'","'<='","'>='","'=='","'!='","'*='","'/='","'%='","'+='","'-='","'=>'","':='",null,null,null,"'break'","'and'","'export'","'for'","'var'","'continue'","'varip'","'switch'","'while'","'if'","'in'","'or'","'not'","'method'","'else'","'to'","'by'","'type'","'import'","'as'","'enum'","'map'"]),w(B,"symbolicNames",[null,"INDENT","DEDENT","Point","OpenBracket","CloseBracket","OpenParen","CloseParen","Comma","Assign","QuestionMark","Colon","Plus","Minus","Multiply","Divide","Modulus","Hashtag","LessThan","MoreThan","LessThanEquals","GreaterThanEquals","Equals_","NotEquals","MultiplyAssign","DivideAssign","ModulusAssign","PlusAssign","MinusAssign","ARROW","ColonEquals","BooleanLiteral","IntegerLiteral","DecimalLiteral","Break","And","Export","For","Var","Continue","Varip","Switch","While","If","In","Or","Not","Method","Else","To","By","Type","Import","As","Enum","Map","ColorLiteral","StringLiteral","Identifier","HIDDEN_","COMMENT_","NEWLINE"]),w(B,"ruleNames",["program","globalStmt","blockStmt","stmt","simpleStmt","flowStmt","block","blockLine","variableDeclarationStmt","variableDeclarationList","varModifier","blockSequence","expressionSequence","expressionBlockSequence","varBlockStmt","varArrayDeclaration","blockExpression","singleExpression","brackethesized","arguments","argument","ifStatement","forStatement","switchStatement","caseClause","defaultCaluse","whileStatement","importStmt","importElement","literal","methodStmt","methodElement","methodName","arrowFunction","arrowFunctionParameters","formalParameterList","formalParameterArg","arrowMethod","arrowMethodParameters","typeStatement","typeElement","assignmentOperator","typeMap","typeSeries","typeArray","typeGather","identifier","typeName","name","enumStatement","enumElement"]),w(B,"_serializedATN",[4,1,61,657,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,1,0,1,0,5,0,105,8,0,10,0,12,0,108,9,0,1,0,1,0,1,1,1,1,3,1,114,8,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,124,8,1,1,2,1,2,1,2,5,2,129,8,2,10,2,12,2,132,9,2,1,2,1,2,3,2,136,8,2,1,3,1,3,3,3,140,8,3,1,3,1,3,1,3,3,3,145,8,3,1,4,1,4,1,4,1,4,3,4,151,8,4,1,5,1,5,1,6,1,6,3,6,157,8,6,1,6,1,6,1,6,3,6,162,8,6,1,7,1,7,1,7,4,7,167,8,7,11,7,12,7,168,1,7,1,7,1,8,1,8,3,8,175,8,8,1,8,1,8,1,8,3,8,180,8,8,5,8,182,8,8,10,8,12,8,185,9,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,3,9,195,8,9,1,10,1,10,1,11,1,11,3,11,201,8,11,1,11,1,11,1,11,3,11,206,8,11,5,11,208,8,11,10,11,12,11,211,9,11,1,12,1,12,1,12,5,12,216,8,12,10,12,12,12,219,9,12,1,13,1,13,3,13,223,8,13,1,13,1,13,5,13,227,8,13,10,13,12,13,230,9,13,1,13,1,13,3,13,234,8,13,1,14,1,14,1,14,1,14,1,14,1,14,3,14,242,8,14,1,14,1,14,1,15,3,15,247,8,15,1,15,3,15,250,8,15,1,15,1,15,1,15,1,15,1,15,5,15,257,8,15,10,15,12,15,260,9,15,1,15,1,15,3,15,264,8,15,1,16,1,16,1,16,1,16,3,16,270,8,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,284,8,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,5,17,315,8,17,10,17,12,17,318,9,17,1,18,1,18,1,18,1,18,1,19,1,19,1,19,1,19,5,19,328,8,19,10,19,12,19,331,9,19,1,19,3,19,334,8,19,3,19,336,8,19,1,19,1,19,1,20,1,20,1,20,3,20,343,8,20,1,20,1,20,3,20,347,8,20,1,21,1,21,1,21,1,21,1,21,1,21,1,21,1,21,5,21,357,8,21,10,21,12,21,360,9,21,1,21,1,21,3,21,364,8,21,1,22,1,22,3,22,368,8,22,1,22,3,22,371,8,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,3,22,380,8,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,3,22,392,8,22,1,22,1,22,1,22,1,22,3,22,398,8,22,1,23,1,23,3,23,402,8,23,1,23,1,23,1,23,4,23,407,8,23,11,23,12,23,408,1,23,5,23,412,8,23,10,23,12,23,415,9,23,1,23,3,23,418,8,23,1,23,1,23,1,24,1,24,1,24,1,24,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,27,1,27,1,27,5,27,436,8,27,10,27,12,27,439,9,27,1,27,3,27,442,8,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1,28,3,28,454,8,28,1,29,1,29,1,30,1,30,1,30,5,30,461,8,30,10,30,12,30,464,9,30,1,31,1,31,1,31,1,32,1,32,1,32,5,32,472,8,32,10,32,12,32,475,9,32,1,32,1,32,1,32,1,32,1,32,3,32,482,8,32,1,32,1,32,1,32,1,32,1,32,3,32,489,8,32,1,32,1,32,3,32,493,8,32,1,33,3,33,496,8,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,3,34,505,8,34,1,34,1,34,1,35,1,35,1,35,5,35,512,8,35,10,35,12,35,515,9,35,1,36,3,36,518,8,36,1,36,1,36,1,36,3,36,523,8,36,1,37,3,37,526,8,37,1,37,1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,38,3,38,539,8,38,1,38,1,38,3,38,543,8,38,1,38,1,38,1,39,3,39,548,8,39,1,39,1,39,1,39,1,39,1,39,4,39,555,8,39,11,39,12,39,556,1,39,1,39,1,40,3,40,562,8,40,1,40,3,40,565,8,40,1,40,1,40,1,40,3,40,570,8,40,1,40,1,40,1,41,1,41,1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,3,43,587,8,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,598,8,44,1,45,1,45,1,45,1,45,3,45,604,8,45,1,46,1,46,1,47,1,47,1,47,3,47,611,8,47,1,48,1,48,3,48,615,8,48,1,48,1,48,5,48,619,8,48,10,48,12,48,622,9,48,1,48,1,48,1,48,1,48,1,48,1,48,4,48,630,8,48,11,48,12,48,631,3,48,634,8,48,1,49,3,49,637,8,49,1,49,1,49,1,49,1,49,1,49,4,49,644,8,49,11,49,12,49,645,1,49,1,49,1,50,1,50,1,50,3,50,653,8,50,1,50,1,50,1,50,0,1,34,51,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,0,9,2,0,34,34,39,39,2,0,38,38,40,40,1,0,12,13,1,0,14,16,1,0,18,21,1,0,22,23,2,0,31,33,56,57,2,0,24,28,30,30,4,0,47,47,51,51,54,55,58,58,707,0,106,1,0,0,0,2,123,1,0,0,0,4,130,1,0,0,0,6,144,1,0,0,0,8,150,1,0,0,0,10,152,1,0,0,0,12,161,1,0,0,0,14,163,1,0,0,0,16,174,1,0,0,0,18,194,1,0,0,0,20,196,1,0,0,0,22,200,1,0,0,0,24,212,1,0,0,0,26,228,1,0,0,0,28,241,1,0,0,0,30,263,1,0,0,0,32,269,1,0,0,0,34,283,1,0,0,0,36,319,1,0,0,0,38,323,1,0,0,0,40,342,1,0,0,0,42,348,1,0,0,0,44,397,1,0,0,0,46,399,1,0,0,0,48,421,1,0,0,0,50,425,1,0,0,0,52,428,1,0,0,0,54,432,1,0,0,0,56,445,1,0,0,0,58,455,1,0,0,0,60,457,1,0,0,0,62,465,1,0,0,0,64,481,1,0,0,0,66,495,1,0,0,0,68,502,1,0,0,0,70,508,1,0,0,0,72,517,1,0,0,0,74,525,1,0,0,0,76,533,1,0,0,0,78,547,1,0,0,0,80,561,1,0,0,0,82,573,1,0,0,0,84,575,1,0,0,0,86,582,1,0,0,0,88,597,1,0,0,0,90,603,1,0,0,0,92,605,1,0,0,0,94,607,1,0,0,0,96,633,1,0,0,0,98,636,1,0,0,0,100,649,1,0,0,0,102,105,5,61,0,0,103,105,3,2,1,0,104,102,1,0,0,0,104,103,1,0,0,0,105,108,1,0,0,0,106,104,1,0,0,0,106,107,1,0,0,0,107,109,1,0,0,0,108,106,1,0,0,0,109,110,5,0,0,1,110,1,1,0,0,0,111,113,3,16,8,0,112,114,5,8,0,0,113,112,1,0,0,0,113,114,1,0,0,0,114,115,1,0,0,0,115,116,5,61,0,0,116,124,1,0,0,0,117,124,3,4,2,0,118,124,3,54,27,0,119,124,3,66,33,0,120,124,3,74,37,0,121,124,3,78,39,0,122,124,3,98,49,0,123,111,1,0,0,0,123,117,1,0,0,0,123,118,1,0,0,0,123,119,1,0,0,0,123,120,1,0,0,0,123,121,1,0,0,0,123,122,1,0,0,0,124,3,1,0,0,0,125,126,3,16,8,0,126,127,5,8,0,0,127,129,1,0,0,0,128,125,1,0,0,0,129,132,1,0,0,0,130,128,1,0,0,0,130,131,1,0,0,0,131,135,1,0,0,0,132,130,1,0,0,0,133,136,3,28,14,0,134,136,3,32,16,0,135,133,1,0,0,0,135,134,1,0,0,0,136,5,1,0,0,0,137,139,3,8,4,0,138,140,5,8,0,0,139,138,1,0,0,0,139,140,1,0,0,0,140,141,1,0,0,0,141,142,5,61,0,0,142,145,1,0,0,0,143,145,3,26,13,0,144,137,1,0,0,0,144,143,1,0,0,0,145,7,1,0,0,0,146,151,3,24,12,0,147,151,3,22,11,0,148,151,3,36,18,0,149,151,3,10,5,0,150,146,1,0,0,0,150,147,1,0,0,0,150,148,1,0,0,0,150,149,1,0,0,0,151,9,1,0,0,0,152,153,7,0,0,0,153,11,1,0,0,0,154,156,3,8,4,0,155,157,5,8,0,0,156,155,1,0,0,0,156,157,1,0,0,0,157,158,1,0,0,0,158,159,5,61,0,0,159,162,1,0,0,0,160,162,3,14,7,0,161,154,1,0,0,0,161,160,1,0,0,0,162,13,1,0,0,0,163,164,5,61,0,0,164,166,5,1,0,0,165,167,3,6,3,0,166,165,1,0,0,0,167,168,1,0,0,0,168,166,1,0,0,0,168,169,1,0,0,0,169,170,1,0,0,0,170,171,5,2,0,0,171,15,1,0,0,0,172,175,3,60,30,0,173,175,3,18,9,0,174,172,1,0,0,0,174,173,1,0,0,0,175,183,1,0,0,0,176,179,5,8,0,0,177,180,3,60,30,0,178,180,3,18,9,0,179,177,1,0,0,0,179,178,1,0,0,0,180,182,1,0,0,0,181,176,1,0,0,0,182,185,1,0,0,0,183,181,1,0,0,0,183,184,1,0,0,0,184,17,1,0,0,0,185,183,1,0,0,0,186,187,3,30,15,0,187,188,5,9,0,0,188,189,3,34,17,0,189,195,1,0,0,0,190,191,3,96,48,0,191,192,3,82,41,0,192,193,3,34,17,0,193,195,1,0,0,0,194,186,1,0,0,0,194,190,1,0,0,0,195,19,1,0,0,0,196,197,7,1,0,0,197,21,1,0,0,0,198,201,3,34,17,0,199,201,3,18,9,0,200,198,1,0,0,0,200,199,1,0,0,0,201,209,1,0,0,0,202,205,5,8,0,0,203,206,3,34,17,0,204,206,3,18,9,0,205,203,1,0,0,0,205,204,1,0,0,0,206,208,1,0,0,0,207,202,1,0,0,0,208,211,1,0,0,0,209,207,1,0,0,0,209,210,1,0,0,0,210,23,1,0,0,0,211,209,1,0,0,0,212,217,3,34,17,0,213,214,5,8,0,0,214,216,3,34,17,0,215,213,1,0,0,0,216,219,1,0,0,0,217,215,1,0,0,0,217,218,1,0,0,0,218,25,1,0,0,0,219,217,1,0,0,0,220,223,3,34,17,0,221,223,3,18,9,0,222,220,1,0,0,0,222,221,1,0,0,0,223,224,1,0,0,0,224,225,5,8,0,0,225,227,1,0,0,0,226,222,1,0,0,0,227,230,1,0,0,0,228,226,1,0,0,0,228,229,1,0,0,0,229,233,1,0,0,0,230,228,1,0,0,0,231,234,3,28,14,0,232,234,3,32,16,0,233,231,1,0,0,0,233,232,1,0,0,0,234,27,1,0,0,0,235,236,3,30,15,0,236,237,5,9,0,0,237,242,1,0,0,0,238,239,3,96,48,0,239,240,3,82,41,0,240,242,1,0,0,0,241,235,1,0,0,0,241,238,1,0,0,0,242,243,1,0,0,0,243,244,3,32,16,0,244,29,1,0,0,0,245,247,3,20,10,0,246,245,1,0,0,0,246,247,1,0,0,0,247,249,1,0,0,0,248,250,3,90,45,0,249,248,1,0,0,0,249,250,1,0,0,0,250,251,1,0,0,0,251,264,3,92,46,0,252,253,5,4,0,0,253,258,3,92,46,0,254,255,5,8,0,0,255,257,3,92,46,0,256,254,1,0,0,0,257,260,1,0,0,0,258,256,1,0,0,0,258,259,1,0,0,0,259,261,1,0,0,0,260,258,1,0,0,0,261,262,5,5,0,0,262,264,1,0,0,0,263,246,1,0,0,0,263,252,1,0,0,0,264,31,1,0,0,0,265,270,3,42,21,0,266,270,3,44,22,0,267,270,3,52,26,0,268,270,3,46,23,0,269,265,1,0,0,0,269,266,1,0,0,0,269,267,1,0,0,0,269,268,1,0,0,0,270,33,1,0,0,0,271,272,6,17,-1,0,272,284,3,60,30,0,273,274,7,2,0,0,274,284,3,34,17,12,275,276,5,46,0,0,276,284,3,34,17,11,277,284,3,96,48,0,278,284,3,58,29,0,279,280,5,6,0,0,280,281,3,34,17,0,281,282,5,7,0,0,282,284,1,0,0,0,283,271,1,0,0,0,283,273,1,0,0,0,283,275,1,0,0,0,283,277,1,0,0,0,283,278,1,0,0,0,283,279,1,0,0,0,284,316,1,0,0,0,285,286,10,10,0,0,286,287,7,3,0,0,287,315,3,34,17,11,288,289,10,9,0,0,289,290,7,2,0,0,290,315,3,34,17,10,291,292,10,8,0,0,292,293,7,4,0,0,293,315,3,34,17,9,294,295,10,7,0,0,295,296,7,5,0,0,296,315,3,34,17,8,297,298,10,6,0,0,298,299,5,35,0,0,299,315,3,34,17,7,300,301,10,5,0,0,301,302,5,45,0,0,302,315,3,34,17,6,303,304,10,4,0,0,304,305,5,10,0,0,305,306,3,34,17,0,306,307,5,11,0,0,307,308,3,34,17,4,308,315,1,0,0,0,309,310,10,13,0,0,310,311,5,4,0,0,311,312,3,34,17,0,312,313,5,5,0,0,313,315,1,0,0,0,314,285,1,0,0,0,314,288,1,0,0,0,314,291,1,0,0,0,314,294,1,0,0,0,314,297,1,0,0,0,314,300,1,0,0,0,314,303,1,0,0,0,314,309,1,0,0,0,315,318,1,0,0,0,316,314,1,0,0,0,316,317,1,0,0,0,317,35,1,0,0,0,318,316,1,0,0,0,319,320,5,4,0,0,320,321,3,24,12,0,321,322,5,5,0,0,322,37,1,0,0,0,323,335,5,6,0,0,324,329,3,40,20,0,325,326,5,8,0,0,326,328,3,40,20,0,327,325,1,0,0,0,328,331,1,0,0,0,329,327,1,0,0,0,329,330,1,0,0,0,330,333,1,0,0,0,331,329,1,0,0,0,332,334,5,8,0,0,333,332,1,0,0,0,333,334,1,0,0,0,334,336,1,0,0,0,335,324,1,0,0,0,335,336,1,0,0,0,336,337,1,0,0,0,337,338,5,7,0,0,338,39,1,0,0,0,339,340,3,92,46,0,340,341,5,9,0,0,341,343,1,0,0,0,342,339,1,0,0,0,342,343,1,0,0,0,343,346,1,0,0,0,344,347,3,34,17,0,345,347,3,36,18,0,346,344,1,0,0,0,346,345,1,0,0,0,347,41,1,0,0,0,348,349,5,43,0,0,349,350,3,34,17,0,350,358,3,14,7,0,351,352,5,48,0,0,352,353,5,43,0,0,353,354,3,34,17,0,354,355,3,14,7,0,355,357,1,0,0,0,356,351,1,0,0,0,357,360,1,0,0,0,358,356,1,0,0,0,358,359,1,0,0,0,359,363,1,0,0,0,360,358,1,0,0,0,361,362,5,48,0,0,362,364,3,14,7,0,363,361,1,0,0,0,363,364,1,0,0,0,364,43,1,0,0,0,365,367,5,37,0,0,366,368,3,20,10,0,367,366,1,0,0,0,367,368,1,0,0,0,368,370,1,0,0,0,369,371,3,90,45,0,370,369,1,0,0,0,370,371,1,0,0,0,371,372,1,0,0,0,372,373,3,92,46,0,373,374,5,9,0,0,374,375,3,34,17,0,375,376,5,49,0,0,376,379,3,34,17,0,377,378,5,50,0,0,378,380,3,34,17,0,379,377,1,0,0,0,379,380,1,0,0,0,380,381,1,0,0,0,381,382,3,14,7,0,382,398,1,0,0,0,383,391,5,37,0,0,384,392,3,92,46,0,385,386,5,4,0,0,386,387,3,92,46,0,387,388,5,8,0,0,388,389,3,92,46,0,389,390,5,5,0,0,390,392,1,0,0,0,391,384,1,0,0,0,391,385,1,0,0,0,392,393,1,0,0,0,393,394,5,44,0,0,394,395,3,34,17,0,395,396,3,14,7,0,396,398,1,0,0,0,397,365,1,0,0,0,397,383,1,0,0,0,398,45,1,0,0,0,399,401,5,41,0,0,400,402,3,34,17,0,401,400,1,0,0,0,401,402,1,0,0,0,402,403,1,0,0,0,403,404,5,61,0,0,404,417,5,1,0,0,405,407,3,48,24,0,406,405,1,0,0,0,407,408,1,0,0,0,408,406,1,0,0,0,408,409,1,0,0,0,409,418,1,0,0,0,410,412,3,48,24,0,411,410,1,0,0,0,412,415,1,0,0,0,413,411,1,0,0,0,413,414,1,0,0,0,414,416,1,0,0,0,415,413,1,0,0,0,416,418,3,50,25,0,417,406,1,0,0,0,417,413,1,0,0,0,418,419,1,0,0,0,419,420,5,2,0,0,420,47,1,0,0,0,421,422,3,34,17,0,422,423,5,29,0,0,423,424,3,12,6,0,424,49,1,0,0,0,425,426,5,29,0,0,426,427,3,12,6,0,427,51,1,0,0,0,428,429,5,42,0,0,429,430,3,34,17,0,430,431,3,14,7,0,431,53,1,0,0,0,432,437,3,56,28,0,433,434,5,8,0,0,434,436,3,56,28,0,435,433,1,0,0,0,436,439,1,0,0,0,437,435,1,0,0,0,437,438,1,0,0,0,438,441,1,0,0,0,439,437,1,0,0,0,440,442,5,8,0,0,441,440,1,0,0,0,441,442,1,0,0,0,442,443,1,0,0,0,443,444,5,61,0,0,444,55,1,0,0,0,445,446,5,52,0,0,446,447,3,92,46,0,447,448,5,15,0,0,448,449,3,92,46,0,449,450,5,15,0,0,450,453,5,32,0,0,451,452,5,53,0,0,452,454,3,92,46,0,453,451,1,0,0,0,453,454,1,0,0,0,454,57,1,0,0,0,455,456,7,6,0,0,456,59,1,0,0,0,457,462,3,62,31,0,458,459,5,3,0,0,459,461,3,62,31,0,460,458,1,0,0,0,461,464,1,0,0,0,462,460,1,0,0,0,462,463,1,0,0,0,463,61,1,0,0,0,464,462,1,0,0,0,465,466,3,64,32,0,466,467,3,38,19,0,467,63,1,0,0,0,468,469,3,92,46,0,469,470,5,3,0,0,470,472,1,0,0,0,471,468,1,0,0,0,472,475,1,0,0,0,473,471,1,0,0,0,473,474,1,0,0,0,474,482,1,0,0,0,475,473,1,0,0,0,476,477,5,6,0,0,477,478,3,34,17,0,478,479,5,7,0,0,479,480,5,3,0,0,480,482,1,0,0,0,481,473,1,0,0,0,481,476,1,0,0,0,482,483,1,0,0,0,483,492,3,92,46,0,484,485,5,18,0,0,485,488,3,94,47,0,486,487,5,8,0,0,487,489,3,94,47,0,488,486,1,0,0,0,488,489,1,0,0,0,489,490,1,0,0,0,490,491,5,19,0,0,491,493,1,0,0,0,492,484,1,0,0,0,492,493,1,0,0,0,493,65,1,0,0,0,494,496,5,36,0,0,495,494,1,0,0,0,495,496,1,0,0,0,496,497,1,0,0,0,497,498,3,92,46,0,498,499,3,68,34,0,499,500,5,29,0,0,500,501,3,12,6,0,501,67,1,0,0,0,502,504,5,6,0,0,503,505,3,70,35,0,504,503,1,0,0,0,504,505,1,0,0,0,505,506,1,0,0,0,506,507,5,7,0,0,507,69,1,0,0,0,508,513,3,72,36,0,509,510,5,8,0,0,510,512,3,72,36,0,511,509,1,0,0,0,512,515,1,0,0,0,513,511,1,0,0,0,513,514,1,0,0,0,514,71,1,0,0,0,515,513,1,0,0,0,516,518,3,90,45,0,517,516,1,0,0,0,517,518,1,0,0,0,518,519,1,0,0,0,519,522,3,92,46,0,520,521,5,9,0,0,521,523,3,34,17,0,522,520,1,0,0,0,522,523,1,0,0,0,523,73,1,0,0,0,524,526,5,36,0,0,525,524,1,0,0,0,525,526,1,0,0,0,526,527,1,0,0,0,527,528,5,47,0,0,528,529,3,92,46,0,529,530,3,76,38,0,530,531,5,29,0,0,531,532,3,12,6,0,532,75,1,0,0,0,533,534,5,6,0,0,534,535,3,90,45,0,535,538,3,92,46,0,536,537,5,9,0,0,537,539,3,34,17,0,538,536,1,0,0,0,538,539,1,0,0,0,539,542,1,0,0,0,540,541,5,8,0,0,541,543,3,70,35,0,542,540,1,0,0,0,542,543,1,0,0,0,543,544,1,0,0,0,544,545,5,7,0,0,545,77,1,0,0,0,546,548,5,36,0,0,547,546,1,0,0,0,547,548,1,0,0,0,548,549,1,0,0,0,549,550,5,51,0,0,550,551,3,92,46,0,551,552,5,61,0,0,552,554,5,1,0,0,553,555,3,80,40,0,554,553,1,0,0,0,555,556,1,0,0,0,556,554,1,0,0,0,556,557,1,0,0,0,557,558,1,0,0,0,558,559,5,2,0,0,559,79,1,0,0,0,560,562,5,40,0,0,561,560,1,0,0,0,561,562,1,0,0,0,562,564,1,0,0,0,563,565,3,90,45,0,564,563,1,0,0,0,564,565,1,0,0,0,565,566,1,0,0,0,566,569,3,92,46,0,567,568,5,9,0,0,568,570,3,34,17,0,569,567,1,0,0,0,569,570,1,0,0,0,570,571,1,0,0,0,571,572,5,61,0,0,572,81,1,0,0,0,573,574,7,7,0,0,574,83,1,0,0,0,575,576,5,55,0,0,576,577,5,18,0,0,577,578,3,94,47,0,578,579,5,8,0,0,579,580,3,94,47,0,580,581,5,19,0,0,581,85,1,0,0,0,582,586,3,94,47,0,583,587,3,94,47,0,584,587,3,88,44,0,585,587,3,84,42,0,586,583,1,0,0,0,586,584,1,0,0,0,586,585,1,0,0,0,587,87,1,0,0,0,588,589,3,94,47,0,589,590,5,18,0,0,590,591,3,94,47,0,591,592,5,19,0,0,592,598,1,0,0,0,593,594,3,94,47,0,594,595,5,4,0,0,595,596,5,5,0,0,596,598,1,0,0,0,597,588,1,0,0,0,597,593,1,0,0,0,598,89,1,0,0,0,599,604,3,94,47,0,600,604,3,88,44,0,601,604,3,84,42,0,602,604,3,86,43,0,603,599,1,0,0,0,603,600,1,0,0,0,603,601,1,0,0,0,603,602,1,0,0,0,604,91,1,0,0,0,605,606,7,8,0,0,606,93,1,0,0,0,607,610,3,92,46,0,608,609,5,3,0,0,609,611,3,92,46,0,610,608,1,0,0,0,610,611,1,0,0,0,611,95,1,0,0,0,612,615,3,92,46,0,613,615,3,62,31,0,614,612,1,0,0,0,614,613,1,0,0,0,615,616,1,0,0,0,616,617,5,3,0,0,617,619,1,0,0,0,618,614,1,0,0,0,619,622,1,0,0,0,620,618,1,0,0,0,620,621,1,0,0,0,621,623,1,0,0,0,622,620,1,0,0,0,623,634,3,92,46,0,624,625,5,6,0,0,625,626,3,34,17,0,626,629,5,7,0,0,627,628,5,3,0,0,628,630,3,92,46,0,629,627,1,0,0,0,630,631,1,0,0,0,631,629,1,0,0,0,631,632,1,0,0,0,632,634,1,0,0,0,633,620,1,0,0,0,633,624,1,0,0,0,634,97,1,0,0,0,635,637,5,36,0,0,636,635,1,0,0,0,636,637,1,0,0,0,637,638,1,0,0,0,638,639,5,54,0,0,639,640,3,92,46,0,640,641,5,61,0,0,641,643,5,1,0,0,642,644,3,100,50,0,643,642,1,0,0,0,644,645,1,0,0,0,645,643,1,0,0,0,645,646,1,0,0,0,646,647,1,0,0,0,647,648,5,2,0,0,648,99,1,0,0,0,649,652,3,92,46,0,650,651,5,9,0,0,651,653,5,57,0,0,652,650,1,0,0,0,652,653,1,0,0,0,653,654,1,0,0,0,654,655,5,61,0,0,655,101,1,0,0,0,80,104,106,113,123,130,135,139,144,150,156,161,168,174,179,183,194,200,205,209,217,222,228,233,241,246,249,258,263,269,283,314,316,329,333,335,342,346,358,363,367,370,379,391,397,401,408,413,417,437,441,453,462,473,481,488,492,495,504,513,517,522,525,538,542,547,556,561,564,569,586,597,603,610,614,620,631,633,636,645,652]),w(B,"__ATN"),w(B,"DecisionsToDFA",B._ATN.decisionToState.map((e,n)=>new dp(e,n)));let M=B;class g_ extends Ye{constructor(e,n,r){super(n,r),this.parser=e}EOF(){return this.getToken(M.EOF,0)}NEWLINE_list(){return this.getTokens(M.NEWLINE)}NEWLINE(e){return this.getToken(M.NEWLINE,e)}globalStmt_list(){return this.getTypedRuleContexts(al)}globalStmt(e){return this.getTypedRuleContext(al,e)}get ruleIndex(){return M.RULE_program}accept(e){return e.visitProgram?e.visitProgram(this):e.visitChildren(this)}}class al extends Ye{constructor(e,n,r){super(n,r),this.parser=e}variableDeclarationStmt(){return this.getTypedRuleContext(ou,0)}NEWLINE(){return this.getToken(M.NEWLINE,0)}Comma(){return this.getToken(M.Comma,0)}blockStmt(){return this.getTypedRuleContext(yp,0)}importStmt(){return this.getTypedRuleContext(Cp,0)}arrowFunction(){return this.getTypedRuleContext(kp,0)}arrowMethod(){return this.getTypedRuleContext(Rp,0)}typeStatement(){return this.getTypedRuleContext(Ip,0)}enumStatement(){return this.getTypedRuleContext(Fp,0)}get ruleIndex(){return M.RULE_globalStmt}accept(e){return e.visitGlobalStmt?e.visitGlobalStmt(this):e.visitChildren(this)}}class yp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}varBlockStmt(){return this.getTypedRuleContext(hl,0)}blockExpression(){return this.getTypedRuleContext(su,0)}variableDeclarationStmt_list(){return this.getTypedRuleContexts(ou)}variableDeclarationStmt(e){return this.getTypedRuleContext(ou,e)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}get ruleIndex(){return M.RULE_blockStmt}accept(e){return e.visitBlockStmt?e.visitBlockStmt(this):e.visitChildren(this)}}class ul extends Ye{constructor(e,n,r){super(n,r),this.parser=e}simpleStmt(){return this.getTypedRuleContext(cl,0)}NEWLINE(){return this.getToken(M.NEWLINE,0)}Comma(){return this.getToken(M.Comma,0)}expressionBlockSequence(){return this.getTypedRuleContext(vp,0)}get ruleIndex(){return M.RULE_stmt}accept(e){return e.visitStmt?e.visitStmt(this):e.visitChildren(this)}}class cl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}expressionSequence(){return this.getTypedRuleContext(fl,0)}blockSequence(){return this.getTypedRuleContext(bp,0)}brackethesized(){return this.getTypedRuleContext(pl,0)}flowStmt(){return this.getTypedRuleContext(gp,0)}get ruleIndex(){return M.RULE_simpleStmt}accept(e){return e.visitSimpleStmt?e.visitSimpleStmt(this):e.visitChildren(this)}}class gp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Break(){return this.getToken(M.Break,0)}Continue(){return this.getToken(M.Continue,0)}get ruleIndex(){return M.RULE_flowStmt}accept(e){return e.visitFlowStmt?e.visitFlowStmt(this):e.visitChildren(this)}}class ia extends Ye{constructor(e,n,r){super(n,r),this.parser=e}simpleStmt(){return this.getTypedRuleContext(cl,0)}NEWLINE(){return this.getToken(M.NEWLINE,0)}Comma(){return this.getToken(M.Comma,0)}blockLine(){return this.getTypedRuleContext(mo,0)}get ruleIndex(){return M.RULE_block}accept(e){return e.visitBlock?e.visitBlock(this):e.visitChildren(this)}}class mo extends Ye{constructor(e,n,r){super(n,r),this.parser=e}NEWLINE(){return this.getToken(M.NEWLINE,0)}INDENT(){return this.getToken(M.INDENT,0)}DEDENT(){return this.getToken(M.DEDENT,0)}stmt_list(){return this.getTypedRuleContexts(ul)}stmt(e){return this.getTypedRuleContext(ul,e)}get ruleIndex(){return M.RULE_blockLine}accept(e){return e.visitBlockLine?e.visitBlockLine(this):e.visitChildren(this)}}class ou extends Ye{constructor(e,n,r){super(n,r),this.parser=e}methodStmt_list(){return this.getTypedRuleContexts(uu)}methodStmt(e){return this.getTypedRuleContext(uu,e)}variableDeclarationList_list(){return this.getTypedRuleContexts(Ni)}variableDeclarationList(e){return this.getTypedRuleContext(Ni,e)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}get ruleIndex(){return M.RULE_variableDeclarationStmt}accept(e){return e.visitVariableDeclarationStmt?e.visitVariableDeclarationStmt(this):e.visitChildren(this)}}class Ni extends Ye{constructor(e,n,r){super(n,r),this.parser=e}get ruleIndex(){return M.RULE_variableDeclarationList}copyFrom(e){super.copyFrom(e)}}class b_ extends Ni{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}name(){return this.getTypedRuleContext(cu,0)}assignmentOperator(){return this.getTypedRuleContext(vl,0)}singleExpression(){return this.getTypedRuleContext($e,0)}accept(e){return e.visitAgainAssign?e.visitAgainAssign(this):e.visitChildren(this)}}class v_ extends Ni{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}varArrayDeclaration(){return this.getTypedRuleContext(oa,0)}Assign(){return this.getToken(M.Assign,0)}singleExpression(){return this.getTypedRuleContext($e,0)}accept(e){return e.visitDeclareAssign?e.visitDeclareAssign(this):e.visitChildren(this)}}class ll extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Var(){return this.getToken(M.Var,0)}Varip(){return this.getToken(M.Varip,0)}get ruleIndex(){return M.RULE_varModifier}accept(e){return e.visitVarModifier?e.visitVarModifier(this):e.visitChildren(this)}}class bp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}variableDeclarationList_list(){return this.getTypedRuleContexts(Ni)}variableDeclarationList(e){return this.getTypedRuleContext(Ni,e)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}get ruleIndex(){return M.RULE_blockSequence}accept(e){return e.visitBlockSequence?e.visitBlockSequence(this):e.visitChildren(this)}}class fl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}get ruleIndex(){return M.RULE_expressionSequence}accept(e){return e.visitExpressionSequence?e.visitExpressionSequence(this):e.visitChildren(this)}}class vp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}varBlockStmt(){return this.getTypedRuleContext(hl,0)}blockExpression(){return this.getTypedRuleContext(su,0)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}variableDeclarationList_list(){return this.getTypedRuleContexts(Ni)}variableDeclarationList(e){return this.getTypedRuleContext(Ni,e)}get ruleIndex(){return M.RULE_expressionBlockSequence}accept(e){return e.visitExpressionBlockSequence?e.visitExpressionBlockSequence(this):e.visitChildren(this)}}class hl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}blockExpression(){return this.getTypedRuleContext(su,0)}varArrayDeclaration(){return this.getTypedRuleContext(oa,0)}Assign(){return this.getToken(M.Assign,0)}name(){return this.getTypedRuleContext(cu,0)}assignmentOperator(){return this.getTypedRuleContext(vl,0)}get ruleIndex(){return M.RULE_varBlockStmt}accept(e){return e.visitVarBlockStmt?e.visitVarBlockStmt(this):e.visitChildren(this)}}class oa extends Ye{constructor(e,n,r){super(n,r),this.parser=e}get ruleIndex(){return M.RULE_varArrayDeclaration}copyFrom(e){super.copyFrom(e)}}class E_ extends oa{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}OpenBracket(){return this.getToken(M.OpenBracket,0)}identifier_list(){return this.getTypedRuleContexts(yn)}identifier(e){return this.getTypedRuleContext(yn,e)}CloseBracket(){return this.getToken(M.CloseBracket,0)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}accept(e){return e.visitVarMultiple?e.visitVarMultiple(this):e.visitChildren(this)}}class S_ extends oa{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}identifier(){return this.getTypedRuleContext(yn,0)}varModifier(){return this.getTypedRuleContext(ll,0)}typeGather(){return this.getTypedRuleContext(jo,0)}accept(e){return e.visitVarSingle?e.visitVarSingle(this):e.visitChildren(this)}}class su extends Ye{constructor(e,n,r){super(n,r),this.parser=e}ifStatement(){return this.getTypedRuleContext(Sp,0)}forStatement(){return this.getTypedRuleContext(au,0)}whileStatement(){return this.getTypedRuleContext(Ap,0)}switchStatement(){return this.getTypedRuleContext(Tp,0)}get ruleIndex(){return M.RULE_blockExpression}accept(e){return e.visitBlockExpression?e.visitBlockExpression(this):e.visitChildren(this)}}class $e extends Ye{constructor(e,n,r){super(n,r),this.parser=e}get ruleIndex(){return M.RULE_singleExpression}copyFrom(e){super.copyFrom(e)}}class T_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}OpenParen(){return this.getToken(M.OpenParen,0)}singleExpression(){return this.getTypedRuleContext($e,0)}CloseParen(){return this.getToken(M.CloseParen,0)}accept(e){return e.visitParenthesizedExpression?e.visitParenthesizedExpression(this):e.visitChildren(this)}}class x_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}Plus(){return this.getToken(M.Plus,0)}Minus(){return this.getToken(M.Minus,0)}accept(e){return e.visitAdditiveExpression?e.visitAdditiveExpression(this):e.visitChildren(this)}}class A_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}LessThan(){return this.getToken(M.LessThan,0)}MoreThan(){return this.getToken(M.MoreThan,0)}LessThanEquals(){return this.getToken(M.LessThanEquals,0)}GreaterThanEquals(){return this.getToken(M.GreaterThanEquals,0)}accept(e){return e.visitRelationalExpression?e.visitRelationalExpression(this):e.visitChildren(this)}}class C_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}QuestionMark(){return this.getToken(M.QuestionMark,0)}Colon(){return this.getToken(M.Colon,0)}accept(e){return e.visitTernaryExpression?e.visitTernaryExpression(this):e.visitChildren(this)}}class O_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}And(){return this.getToken(M.And,0)}accept(e){return e.visitLogicalAndExpression?e.visitLogicalAndExpression(this):e.visitChildren(this)}}class D_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}name(){return this.getTypedRuleContext(cu,0)}accept(e){return e.visitNameExpression?e.visitNameExpression(this):e.visitChildren(this)}}class k_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}literal(){return this.getTypedRuleContext(Op,0)}accept(e){return e.visitLiteralExpression?e.visitLiteralExpression(this):e.visitChildren(this)}}class w_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}Or(){return this.getToken(M.Or,0)}accept(e){return e.visitLogicalOrExpression?e.visitLogicalOrExpression(this):e.visitChildren(this)}}class R_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression(){return this.getTypedRuleContext($e,0)}Minus(){return this.getToken(M.Minus,0)}Plus(){return this.getToken(M.Plus,0)}accept(e){return e.visitUnaryExpression?e.visitUnaryExpression(this):e.visitChildren(this)}}class N_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}Not(){return this.getToken(M.Not,0)}singleExpression(){return this.getTypedRuleContext($e,0)}accept(e){return e.visitNotExpression?e.visitNotExpression(this):e.visitChildren(this)}}class I_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}OpenBracket(){return this.getToken(M.OpenBracket,0)}CloseBracket(){return this.getToken(M.CloseBracket,0)}accept(e){return e.visitMemberIndexExpression?e.visitMemberIndexExpression(this):e.visitChildren(this)}}class P_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}methodStmt(){return this.getTypedRuleContext(uu,0)}accept(e){return e.visitMethodExpression?e.visitMethodExpression(this):e.visitChildren(this)}}class F_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}Equals_(){return this.getToken(M.Equals_,0)}NotEquals(){return this.getToken(M.NotEquals,0)}accept(e){return e.visitEqualityExpression?e.visitEqualityExpression(this):e.visitChildren(this)}}class M_ extends $e{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}Multiply(){return this.getToken(M.Multiply,0)}Divide(){return this.getToken(M.Divide,0)}Modulus(){return this.getToken(M.Modulus,0)}accept(e){return e.visitMultiplicativeExpression?e.visitMultiplicativeExpression(this):e.visitChildren(this)}}class pl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}OpenBracket(){return this.getToken(M.OpenBracket,0)}expressionSequence(){return this.getTypedRuleContext(fl,0)}CloseBracket(){return this.getToken(M.CloseBracket,0)}get ruleIndex(){return M.RULE_brackethesized}accept(e){return e.visitBrackethesized?e.visitBrackethesized(this):e.visitChildren(this)}}class Ep extends Ye{constructor(e,n,r){super(n,r),this.parser=e}OpenParen(){return this.getToken(M.OpenParen,0)}CloseParen(){return this.getToken(M.CloseParen,0)}argument_list(){return this.getTypedRuleContexts(dl)}argument(e){return this.getTypedRuleContext(dl,e)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}get ruleIndex(){return M.RULE_arguments}accept(e){return e.visitArguments?e.visitArguments(this):e.visitChildren(this)}}class dl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}singleExpression(){return this.getTypedRuleContext($e,0)}brackethesized(){return this.getTypedRuleContext(pl,0)}identifier(){return this.getTypedRuleContext(yn,0)}Assign(){return this.getToken(M.Assign,0)}get ruleIndex(){return M.RULE_argument}accept(e){return e.visitArgument?e.visitArgument(this):e.visitChildren(this)}}class Sp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}If_list(){return this.getTokens(M.If)}If(e){return this.getToken(M.If,e)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}blockLine_list(){return this.getTypedRuleContexts(mo)}blockLine(e){return this.getTypedRuleContext(mo,e)}Else_list(){return this.getTokens(M.Else)}Else(e){return this.getToken(M.Else,e)}get ruleIndex(){return M.RULE_ifStatement}accept(e){return e.visitIfStatement?e.visitIfStatement(this):e.visitChildren(this)}}class au extends Ye{constructor(e,n,r){super(n,r),this.parser=e}get ruleIndex(){return M.RULE_forStatement}copyFrom(e){super.copyFrom(e)}}class L_ extends au{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}For(){return this.getToken(M.For,0)}identifier(){return this.getTypedRuleContext(yn,0)}Assign(){return this.getToken(M.Assign,0)}singleExpression_list(){return this.getTypedRuleContexts($e)}singleExpression(e){return this.getTypedRuleContext($e,e)}To(){return this.getToken(M.To,0)}blockLine(){return this.getTypedRuleContext(mo,0)}varModifier(){return this.getTypedRuleContext(ll,0)}typeGather(){return this.getTypedRuleContext(jo,0)}By(){return this.getToken(M.By,0)}accept(e){return e.visitForToStatement?e.visitForToStatement(this):e.visitChildren(this)}}class B_ extends au{constructor(e,n){super(e,n.parentCtx,n.invokingState),super.copyFrom(n)}For(){return this.getToken(M.For,0)}In(){return this.getToken(M.In,0)}singleExpression(){return this.getTypedRuleContext($e,0)}blockLine(){return this.getTypedRuleContext(mo,0)}identifier_list(){return this.getTypedRuleContexts(yn)}identifier(e){return this.getTypedRuleContext(yn,e)}OpenBracket(){return this.getToken(M.OpenBracket,0)}Comma(){return this.getToken(M.Comma,0)}CloseBracket(){return this.getToken(M.CloseBracket,0)}accept(e){return e.visitForInStatement?e.visitForInStatement(this):e.visitChildren(this)}}class Tp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Switch(){return this.getToken(M.Switch,0)}NEWLINE(){return this.getToken(M.NEWLINE,0)}INDENT(){return this.getToken(M.INDENT,0)}DEDENT(){return this.getToken(M.DEDENT,0)}singleExpression(){return this.getTypedRuleContext($e,0)}defaultCaluse(){return this.getTypedRuleContext(xp,0)}caseClause_list(){return this.getTypedRuleContexts(ml)}caseClause(e){return this.getTypedRuleContext(ml,e)}get ruleIndex(){return M.RULE_switchStatement}accept(e){return e.visitSwitchStatement?e.visitSwitchStatement(this):e.visitChildren(this)}}class ml extends Ye{constructor(e,n,r){super(n,r),this.parser=e}singleExpression(){return this.getTypedRuleContext($e,0)}ARROW(){return this.getToken(M.ARROW,0)}block(){return this.getTypedRuleContext(ia,0)}get ruleIndex(){return M.RULE_caseClause}accept(e){return e.visitCaseClause?e.visitCaseClause(this):e.visitChildren(this)}}class xp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}ARROW(){return this.getToken(M.ARROW,0)}block(){return this.getTypedRuleContext(ia,0)}get ruleIndex(){return M.RULE_defaultCaluse}accept(e){return e.visitDefaultCaluse?e.visitDefaultCaluse(this):e.visitChildren(this)}}class Ap extends Ye{constructor(e,n,r){super(n,r),this.parser=e}While(){return this.getToken(M.While,0)}singleExpression(){return this.getTypedRuleContext($e,0)}blockLine(){return this.getTypedRuleContext(mo,0)}get ruleIndex(){return M.RULE_whileStatement}accept(e){return e.visitWhileStatement?e.visitWhileStatement(this):e.visitChildren(this)}}class Cp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}importElement_list(){return this.getTypedRuleContexts(_l)}importElement(e){return this.getTypedRuleContext(_l,e)}NEWLINE(){return this.getToken(M.NEWLINE,0)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}get ruleIndex(){return M.RULE_importStmt}accept(e){return e.visitImportStmt?e.visitImportStmt(this):e.visitChildren(this)}}class _l extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Import(){return this.getToken(M.Import,0)}identifier_list(){return this.getTypedRuleContexts(yn)}identifier(e){return this.getTypedRuleContext(yn,e)}Divide_list(){return this.getTokens(M.Divide)}Divide(e){return this.getToken(M.Divide,e)}IntegerLiteral(){return this.getToken(M.IntegerLiteral,0)}As(){return this.getToken(M.As,0)}get ruleIndex(){return M.RULE_importElement}accept(e){return e.visitImportElement?e.visitImportElement(this):e.visitChildren(this)}}class Op extends Ye{constructor(e,n,r){super(n,r),this.parser=e}BooleanLiteral(){return this.getToken(M.BooleanLiteral,0)}ColorLiteral(){return this.getToken(M.ColorLiteral,0)}StringLiteral(){return this.getToken(M.StringLiteral,0)}IntegerLiteral(){return this.getToken(M.IntegerLiteral,0)}DecimalLiteral(){return this.getToken(M.DecimalLiteral,0)}get ruleIndex(){return M.RULE_literal}accept(e){return e.visitLiteral?e.visitLiteral(this):e.visitChildren(this)}}class uu extends Ye{constructor(e,n,r){super(n,r),this.parser=e}methodElement_list(){return this.getTypedRuleContexts(sa)}methodElement(e){return this.getTypedRuleContext(sa,e)}Point_list(){return this.getTokens(M.Point)}Point(e){return this.getToken(M.Point,e)}get ruleIndex(){return M.RULE_methodStmt}accept(e){return e.visitMethodStmt?e.visitMethodStmt(this):e.visitChildren(this)}}class sa extends Ye{constructor(e,n,r){super(n,r),this.parser=e}methodName(){return this.getTypedRuleContext(Dp,0)}arguments(){return this.getTypedRuleContext(Ep,0)}get ruleIndex(){return M.RULE_methodElement}accept(e){return e.visitMethodElement?e.visitMethodElement(this):e.visitChildren(this)}}class Dp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(yn)}identifier(e){return this.getTypedRuleContext(yn,e)}OpenParen(){return this.getToken(M.OpenParen,0)}singleExpression(){return this.getTypedRuleContext($e,0)}CloseParen(){return this.getToken(M.CloseParen,0)}Point_list(){return this.getTokens(M.Point)}Point(e){return this.getToken(M.Point,e)}LessThan(){return this.getToken(M.LessThan,0)}typeName_list(){return this.getTypedRuleContexts(mi)}typeName(e){return this.getTypedRuleContext(mi,e)}MoreThan(){return this.getToken(M.MoreThan,0)}Comma(){return this.getToken(M.Comma,0)}get ruleIndex(){return M.RULE_methodName}accept(e){return e.visitMethodName?e.visitMethodName(this):e.visitChildren(this)}}class kp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}identifier(){return this.getTypedRuleContext(yn,0)}arrowFunctionParameters(){return this.getTypedRuleContext(wp,0)}ARROW(){return this.getToken(M.ARROW,0)}block(){return this.getTypedRuleContext(ia,0)}Export(){return this.getToken(M.Export,0)}get ruleIndex(){return M.RULE_arrowFunction}accept(e){return e.visitArrowFunction?e.visitArrowFunction(this):e.visitChildren(this)}}class wp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}OpenParen(){return this.getToken(M.OpenParen,0)}CloseParen(){return this.getToken(M.CloseParen,0)}formalParameterList(){return this.getTypedRuleContext(yl,0)}get ruleIndex(){return M.RULE_arrowFunctionParameters}accept(e){return e.visitArrowFunctionParameters?e.visitArrowFunctionParameters(this):e.visitChildren(this)}}class yl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}formalParameterArg_list(){return this.getTypedRuleContexts(gl)}formalParameterArg(e){return this.getTypedRuleContext(gl,e)}Comma_list(){return this.getTokens(M.Comma)}Comma(e){return this.getToken(M.Comma,e)}get ruleIndex(){return M.RULE_formalParameterList}accept(e){return e.visitFormalParameterList?e.visitFormalParameterList(this):e.visitChildren(this)}}class gl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}identifier(){return this.getTypedRuleContext(yn,0)}typeGather(){return this.getTypedRuleContext(jo,0)}Assign(){return this.getToken(M.Assign,0)}singleExpression(){return this.getTypedRuleContext($e,0)}get ruleIndex(){return M.RULE_formalParameterArg}accept(e){return e.visitFormalParameterArg?e.visitFormalParameterArg(this):e.visitChildren(this)}}class Rp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Method(){return this.getToken(M.Method,0)}identifier(){return this.getTypedRuleContext(yn,0)}arrowMethodParameters(){return this.getTypedRuleContext(Np,0)}ARROW(){return this.getToken(M.ARROW,0)}block(){return this.getTypedRuleContext(ia,0)}Export(){return this.getToken(M.Export,0)}get ruleIndex(){return M.RULE_arrowMethod}accept(e){return e.visitArrowMethod?e.visitArrowMethod(this):e.visitChildren(this)}}class Np extends Ye{constructor(e,n,r){super(n,r),this.parser=e}OpenParen(){return this.getToken(M.OpenParen,0)}typeGather(){return this.getTypedRuleContext(jo,0)}identifier(){return this.getTypedRuleContext(yn,0)}CloseParen(){return this.getToken(M.CloseParen,0)}Assign(){return this.getToken(M.Assign,0)}singleExpression(){return this.getTypedRuleContext($e,0)}Comma(){return this.getToken(M.Comma,0)}formalParameterList(){return this.getTypedRuleContext(yl,0)}get ruleIndex(){return M.RULE_arrowMethodParameters}accept(e){return e.visitArrowMethodParameters?e.visitArrowMethodParameters(this):e.visitChildren(this)}}class Ip extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Type(){return this.getToken(M.Type,0)}identifier(){return this.getTypedRuleContext(yn,0)}NEWLINE(){return this.getToken(M.NEWLINE,0)}INDENT(){return this.getToken(M.INDENT,0)}DEDENT(){return this.getToken(M.DEDENT,0)}Export(){return this.getToken(M.Export,0)}typeElement_list(){return this.getTypedRuleContexts(bl)}typeElement(e){return this.getTypedRuleContext(bl,e)}get ruleIndex(){return M.RULE_typeStatement}accept(e){return e.visitTypeStatement?e.visitTypeStatement(this):e.visitChildren(this)}}class bl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}identifier(){return this.getTypedRuleContext(yn,0)}NEWLINE(){return this.getToken(M.NEWLINE,0)}Varip(){return this.getToken(M.Varip,0)}typeGather(){return this.getTypedRuleContext(jo,0)}Assign(){return this.getToken(M.Assign,0)}singleExpression(){return this.getTypedRuleContext($e,0)}get ruleIndex(){return M.RULE_typeElement}accept(e){return e.visitTypeElement?e.visitTypeElement(this):e.visitChildren(this)}}class vl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}ColonEquals(){return this.getToken(M.ColonEquals,0)}MultiplyAssign(){return this.getToken(M.MultiplyAssign,0)}DivideAssign(){return this.getToken(M.DivideAssign,0)}ModulusAssign(){return this.getToken(M.ModulusAssign,0)}PlusAssign(){return this.getToken(M.PlusAssign,0)}MinusAssign(){return this.getToken(M.MinusAssign,0)}get ruleIndex(){return M.RULE_assignmentOperator}accept(e){return e.visitAssignmentOperator?e.visitAssignmentOperator(this):e.visitChildren(this)}}class El extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Map(){return this.getToken(M.Map,0)}LessThan(){return this.getToken(M.LessThan,0)}Comma(){return this.getToken(M.Comma,0)}typeName_list(){return this.getTypedRuleContexts(mi)}typeName(e){return this.getTypedRuleContext(mi,e)}MoreThan(){return this.getToken(M.MoreThan,0)}get ruleIndex(){return M.RULE_typeMap}accept(e){return e.visitTypeMap?e.visitTypeMap(this):e.visitChildren(this)}}class Pp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}typeName_list(){return this.getTypedRuleContexts(mi)}typeName(e){return this.getTypedRuleContext(mi,e)}typeArray(){return this.getTypedRuleContext(Sl,0)}typeMap(){return this.getTypedRuleContext(El,0)}get ruleIndex(){return M.RULE_typeSeries}accept(e){return e.visitTypeSeries?e.visitTypeSeries(this):e.visitChildren(this)}}class Sl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}typeName_list(){return this.getTypedRuleContexts(mi)}typeName(e){return this.getTypedRuleContext(mi,e)}LessThan(){return this.getToken(M.LessThan,0)}MoreThan(){return this.getToken(M.MoreThan,0)}OpenBracket(){return this.getToken(M.OpenBracket,0)}CloseBracket(){return this.getToken(M.CloseBracket,0)}get ruleIndex(){return M.RULE_typeArray}accept(e){return e.visitTypeArray?e.visitTypeArray(this):e.visitChildren(this)}}class jo extends Ye{constructor(e,n,r){super(n,r),this.parser=e}typeName(){return this.getTypedRuleContext(mi,0)}typeArray(){return this.getTypedRuleContext(Sl,0)}typeMap(){return this.getTypedRuleContext(El,0)}typeSeries(){return this.getTypedRuleContext(Pp,0)}get ruleIndex(){return M.RULE_typeGather}accept(e){return e.visitTypeGather?e.visitTypeGather(this):e.visitChildren(this)}}class yn extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Identifier(){return this.getToken(M.Identifier,0)}Map(){return this.getToken(M.Map,0)}Type(){return this.getToken(M.Type,0)}Enum(){return this.getToken(M.Enum,0)}Method(){return this.getToken(M.Method,0)}get ruleIndex(){return M.RULE_identifier}accept(e){return e.visitIdentifier?e.visitIdentifier(this):e.visitChildren(this)}}class mi extends Ye{constructor(e,n,r){super(n,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(yn)}identifier(e){return this.getTypedRuleContext(yn,e)}Point(){return this.getToken(M.Point,0)}get ruleIndex(){return M.RULE_typeName}accept(e){return e.visitTypeName?e.visitTypeName(this):e.visitChildren(this)}}class cu extends Ye{constructor(e,n,r){super(n,r),this.parser=e}identifier_list(){return this.getTypedRuleContexts(yn)}identifier(e){return this.getTypedRuleContext(yn,e)}Point_list(){return this.getTokens(M.Point)}Point(e){return this.getToken(M.Point,e)}methodElement_list(){return this.getTypedRuleContexts(sa)}methodElement(e){return this.getTypedRuleContext(sa,e)}OpenParen(){return this.getToken(M.OpenParen,0)}singleExpression(){return this.getTypedRuleContext($e,0)}CloseParen(){return this.getToken(M.CloseParen,0)}get ruleIndex(){return M.RULE_name}accept(e){return e.visitName?e.visitName(this):e.visitChildren(this)}}class Fp extends Ye{constructor(e,n,r){super(n,r),this.parser=e}Enum(){return this.getToken(M.Enum,0)}identifier(){return this.getTypedRuleContext(yn,0)}NEWLINE(){return this.getToken(M.NEWLINE,0)}INDENT(){return this.getToken(M.INDENT,0)}DEDENT(){return this.getToken(M.DEDENT,0)}Export(){return this.getToken(M.Export,0)}enumElement_list(){return this.getTypedRuleContexts(Tl)}enumElement(e){return this.getTypedRuleContext(Tl,e)}get ruleIndex(){return M.RULE_enumStatement}accept(e){return e.visitEnumStatement?e.visitEnumStatement(this):e.visitChildren(this)}}class Tl extends Ye{constructor(e,n,r){super(n,r),this.parser=e}identifier(){return this.getTypedRuleContext(yn,0)}NEWLINE(){return this.getToken(M.NEWLINE,0)}Assign(){return this.getToken(M.Assign,0)}StringLiteral(){return this.getToken(M.StringLiteral,0)}get ruleIndex(){return M.RULE_enumElement}accept(e){return e.visitEnumElement?e.visitEnumElement(this):e.visitChildren(this)}}class U_ extends h_{constructor(n){super(n);w(this,"tokens");w(this,"indents");w(this,"opened");this.tokens=[],this.indents=[],this.opened=0}reset(){this.tokens=[],this.indents=[],this.opened=0,super.reset()}emitToken(n){super.emitToken(n),this.tokens.push(n)}nextToken(){if(this._input.LA(1)===M.EOF&&this.indents.length){for(this.tokens=this.tokens.filter(function(r){return r.type!==M.EOF}),this.emitToken(this.commonToken(M.NEWLINE,`
|
11
11
|
`));this.indents.length;)this.emitToken(this.createDedent()),this.indents.pop();this.emitToken(this.commonToken(M.EOF,"<EOF>"))}const n=super.nextToken();return this.tokens.length?this.tokens.shift():n}createDedent(){return this.commonToken(M.DEDENT,"")}getCharIndex(){return this._input.index}commonToken(n,r){const a=this.getCharIndex()-1,c=r.length?a-r.length+1:a;return new a_([this,this._input],n,0,c,a)}getIndentationCount(n){let r=0;for(let a=0;a<n.length;a++)n[a]===" "?r+=4-r%4:r++;return r}atStartOfInput(){return this.getCharIndex()===0}openBrace(){this.opened++}closeBrace(){this.opened--}onNewLine(){const n=this.text.replace(/[^\r\n]+/g,""),r=this.text.replace(/[\r\n]+/g,""),a=this._input.LA(1),c=this._input.LA(2),h=this.getIndentationCount(r);if(this.opened>0||c!=-1&&(a===13||a===10||a===47&&c===47||h%4))this.skip();else{this.emitToken(this.commonToken(M.NEWLINE,n));const d=this.indents.length?this.indents[this.indents.length-1]:0;if(h===d)this.skip();else if(h>d)this.indents.push(h),this.emitToken(this.commonToken(M.INDENT,r));else for(;this.indents.length&&this.indents[this.indents.length-1]>h;)this.emitToken(this.createDedent()),this.indents.pop()}}}const Re=class Re extends U_{constructor(e){super(e),this._interp=new p_(this,Re._ATN,Re.DecisionsToDFA,new mp)}get grammarFileName(){return"tccScriptLexer.g4"}get literalNames(){return Re.literalNames}get symbolicNames(){return Re.symbolicNames}get ruleNames(){return Re.ruleNames}get serializedATN(){return Re._serializedATN}get channelNames(){return Re.channelNames}get modeNames(){return Re.modeNames}action(e,n,r){switch(n){case 1:this.OpenBracket_action(e,r);break;case 2:this.CloseBracket_action(e,r);break;case 3:this.OpenParen_action(e,r);break;case 4:this.CloseParen_action(e,r);break;case 58:this.NEWLINE_action(e,r);break}}OpenBracket_action(e,n){switch(n){case 0:this.openBrace();break}}CloseBracket_action(e,n){switch(n){case 1:this.closeBrace();break}}OpenParen_action(e,n){switch(n){case 2:this.openBrace();break}}CloseParen_action(e,n){switch(n){case 3:this.closeBrace();break}}NEWLINE_action(e,n){switch(n){case 4:this.onNewLine();break}}sempred(e,n,r){switch(n){case 58:return this.NEWLINE_sempred(e,r)}return!0}NEWLINE_sempred(e,n){switch(n){case 0:return this.atStartOfInput()}return!0}static get _ATN(){return Re.__ATN||(Re.__ATN=new pp().deserialize(Re._serializedATN)),Re.__ATN}};w(Re,"INDENT",1),w(Re,"DEDENT",2),w(Re,"Point",3),w(Re,"OpenBracket",4),w(Re,"CloseBracket",5),w(Re,"OpenParen",6),w(Re,"CloseParen",7),w(Re,"Comma",8),w(Re,"Assign",9),w(Re,"QuestionMark",10),w(Re,"Colon",11),w(Re,"Plus",12),w(Re,"Minus",13),w(Re,"Multiply",14),w(Re,"Divide",15),w(Re,"Modulus",16),w(Re,"Hashtag",17),w(Re,"LessThan",18),w(Re,"MoreThan",19),w(Re,"LessThanEquals",20),w(Re,"GreaterThanEquals",21),w(Re,"Equals_",22),w(Re,"NotEquals",23),w(Re,"MultiplyAssign",24),w(Re,"DivideAssign",25),w(Re,"ModulusAssign",26),w(Re,"PlusAssign",27),w(Re,"MinusAssign",28),w(Re,"ARROW",29),w(Re,"ColonEquals",30),w(Re,"BooleanLiteral",31),w(Re,"IntegerLiteral",32),w(Re,"DecimalLiteral",33),w(Re,"Break",34),w(Re,"And",35),w(Re,"Export",36),w(Re,"For",37),w(Re,"Var",38),w(Re,"Continue",39),w(Re,"Varip",40),w(Re,"Switch",41),w(Re,"While",42),w(Re,"If",43),w(Re,"In",44),w(Re,"Or",45),w(Re,"Not",46),w(Re,"Method",47),w(Re,"Else",48),w(Re,"To",49),w(Re,"By",50),w(Re,"Type",51),w(Re,"Import",52),w(Re,"As",53),w(Re,"Enum",54),w(Re,"Map",55),w(Re,"ColorLiteral",56),w(Re,"StringLiteral",57),w(Re,"Identifier",58),w(Re,"HIDDEN_",59),w(Re,"COMMENT_",60),w(Re,"NEWLINE",61),w(Re,"EOF",_p.EOF),w(Re,"channelNames",["DEFAULT_TOKEN_CHANNEL","HIDDEN"]),w(Re,"literalNames",[null,null,null,"'.'","'['","']'","'('","')'","','","'='","'?'","':'","'+'","'-'","'*'","'/'","'%'","'#'","'<'","'>'","'<='","'>='","'=='","'!='","'*='","'/='","'%='","'+='","'-='","'=>'","':='",null,null,null,"'break'","'and'","'export'","'for'","'var'","'continue'","'varip'","'switch'","'while'","'if'","'in'","'or'","'not'","'method'","'else'","'to'","'by'","'type'","'import'","'as'","'enum'","'map'"]),w(Re,"symbolicNames",[null,"INDENT","DEDENT","Point","OpenBracket","CloseBracket","OpenParen","CloseParen","Comma","Assign","QuestionMark","Colon","Plus","Minus","Multiply","Divide","Modulus","Hashtag","LessThan","MoreThan","LessThanEquals","GreaterThanEquals","Equals_","NotEquals","MultiplyAssign","DivideAssign","ModulusAssign","PlusAssign","MinusAssign","ARROW","ColonEquals","BooleanLiteral","IntegerLiteral","DecimalLiteral","Break","And","Export","For","Var","Continue","Varip","Switch","While","If","In","Or","Not","Method","Else","To","By","Type","Import","As","Enum","Map","ColorLiteral","StringLiteral","Identifier","HIDDEN_","COMMENT_","NEWLINE"]),w(Re,"modeNames",["DEFAULT_MODE"]),w(Re,"ruleNames",["Point","OpenBracket","CloseBracket","OpenParen","CloseParen","Comma","Assign","QuestionMark","Colon","Plus","Minus","Multiply","Divide","Modulus","Hashtag","LessThan","MoreThan","LessThanEquals","GreaterThanEquals","Equals_","NotEquals","MultiplyAssign","DivideAssign","ModulusAssign","PlusAssign","MinusAssign","ARROW","ColonEquals","BooleanLiteral","IntegerLiteral","DecimalLiteral","Break","And","Export","For","Var","Continue","Varip","Switch","While","If","In","Or","Not","Method","Else","To","By","Type","Import","As","Enum","Map","ColorLiteral","StringLiteral","Identifier","HIDDEN_","COMMENT_","NEWLINE","SHORT_STRING","DIGIT","DIGITS","HEX_DIGIT","SPACES","COMMENT","EXP"]),w(Re,"_serializedATN",[4,0,61,447,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,65,7,65,1,0,1,0,1,1,1,1,1,1,1,2,1,2,1,2,1,3,1,3,1,3,1,4,1,4,1,4,1,5,1,5,1,6,1,6,1,7,1,7,1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,17,1,18,1,18,1,18,1,19,1,19,1,19,1,20,1,20,1,20,1,21,1,21,1,21,1,22,1,22,1,22,1,23,1,23,1,23,1,24,1,24,1,24,1,25,1,25,1,25,1,26,1,26,1,26,1,27,1,27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1,28,3,28,214,8,28,1,29,1,29,1,30,1,30,1,30,3,30,221,8,30,1,30,1,30,1,30,1,30,3,30,227,8,30,3,30,229,8,30,1,30,3,30,232,8,30,3,30,234,8,30,1,31,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,37,1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,1,38,1,38,1,38,1,39,1,39,1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,41,1,41,1,41,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,47,1,47,1,47,1,48,1,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49,1,49,1,50,1,50,1,50,1,51,1,51,1,51,1,51,1,51,1,52,1,52,1,52,1,52,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,1,53,3,53,362,8,53,1,54,1,54,1,55,1,55,5,55,368,8,55,10,55,12,55,371,9,55,1,56,1,56,1,56,1,56,1,57,1,57,1,57,1,57,1,58,1,58,1,58,3,58,384,8,58,1,58,1,58,3,58,388,8,58,1,58,3,58,391,8,58,3,58,393,8,58,1,58,1,58,1,59,1,59,1,59,1,59,5,59,401,8,59,10,59,12,59,404,9,59,1,59,1,59,1,59,1,59,1,59,5,59,411,8,59,10,59,12,59,414,9,59,1,59,3,59,417,8,59,1,60,1,60,1,61,4,61,422,8,61,11,61,12,61,423,1,62,1,62,1,63,4,63,429,8,63,11,63,12,63,430,1,64,1,64,1,64,1,64,5,64,437,8,64,10,64,12,64,440,9,64,1,65,1,65,3,65,444,8,65,1,65,1,65,0,0,66,1,3,3,4,5,5,7,6,9,7,11,8,13,9,15,10,17,11,19,12,21,13,23,14,25,15,27,16,29,17,31,18,33,19,35,20,37,21,39,22,41,23,43,24,45,25,47,26,49,27,51,28,53,29,55,30,57,31,59,32,61,33,63,34,65,35,67,36,69,37,71,38,73,39,75,40,77,41,79,42,81,43,83,44,85,45,87,46,89,47,91,48,93,49,95,50,97,51,99,52,101,53,103,54,105,55,107,56,109,57,111,58,113,59,115,60,117,61,119,0,121,0,123,0,125,0,127,0,129,0,131,0,1,0,10,3,0,65,90,95,95,97,122,4,0,48,57,65,90,95,95,97,122,1,0,39,39,1,0,34,34,1,0,48,57,3,0,48,57,65,70,97,102,3,0,9,9,32,32,160,160,2,0,10,10,12,13,2,0,69,69,101,101,2,0,43,43,45,45,460,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,1,0,0,0,0,117,1,0,0,0,1,133,1,0,0,0,3,135,1,0,0,0,5,138,1,0,0,0,7,141,1,0,0,0,9,144,1,0,0,0,11,147,1,0,0,0,13,149,1,0,0,0,15,151,1,0,0,0,17,153,1,0,0,0,19,155,1,0,0,0,21,157,1,0,0,0,23,159,1,0,0,0,25,161,1,0,0,0,27,163,1,0,0,0,29,165,1,0,0,0,31,167,1,0,0,0,33,169,1,0,0,0,35,171,1,0,0,0,37,174,1,0,0,0,39,177,1,0,0,0,41,180,1,0,0,0,43,183,1,0,0,0,45,186,1,0,0,0,47,189,1,0,0,0,49,192,1,0,0,0,51,195,1,0,0,0,53,198,1,0,0,0,55,201,1,0,0,0,57,213,1,0,0,0,59,215,1,0,0,0,61,233,1,0,0,0,63,235,1,0,0,0,65,241,1,0,0,0,67,245,1,0,0,0,69,252,1,0,0,0,71,256,1,0,0,0,73,260,1,0,0,0,75,269,1,0,0,0,77,275,1,0,0,0,79,282,1,0,0,0,81,288,1,0,0,0,83,291,1,0,0,0,85,294,1,0,0,0,87,297,1,0,0,0,89,301,1,0,0,0,91,308,1,0,0,0,93,313,1,0,0,0,95,316,1,0,0,0,97,319,1,0,0,0,99,324,1,0,0,0,101,331,1,0,0,0,103,334,1,0,0,0,105,339,1,0,0,0,107,361,1,0,0,0,109,363,1,0,0,0,111,365,1,0,0,0,113,372,1,0,0,0,115,376,1,0,0,0,117,392,1,0,0,0,119,416,1,0,0,0,121,418,1,0,0,0,123,421,1,0,0,0,125,425,1,0,0,0,127,428,1,0,0,0,129,432,1,0,0,0,131,441,1,0,0,0,133,134,5,46,0,0,134,2,1,0,0,0,135,136,5,91,0,0,136,137,6,1,0,0,137,4,1,0,0,0,138,139,5,93,0,0,139,140,6,2,1,0,140,6,1,0,0,0,141,142,5,40,0,0,142,143,6,3,2,0,143,8,1,0,0,0,144,145,5,41,0,0,145,146,6,4,3,0,146,10,1,0,0,0,147,148,5,44,0,0,148,12,1,0,0,0,149,150,5,61,0,0,150,14,1,0,0,0,151,152,5,63,0,0,152,16,1,0,0,0,153,154,5,58,0,0,154,18,1,0,0,0,155,156,5,43,0,0,156,20,1,0,0,0,157,158,5,45,0,0,158,22,1,0,0,0,159,160,5,42,0,0,160,24,1,0,0,0,161,162,5,47,0,0,162,26,1,0,0,0,163,164,5,37,0,0,164,28,1,0,0,0,165,166,5,35,0,0,166,30,1,0,0,0,167,168,5,60,0,0,168,32,1,0,0,0,169,170,5,62,0,0,170,34,1,0,0,0,171,172,5,60,0,0,172,173,5,61,0,0,173,36,1,0,0,0,174,175,5,62,0,0,175,176,5,61,0,0,176,38,1,0,0,0,177,178,5,61,0,0,178,179,5,61,0,0,179,40,1,0,0,0,180,181,5,33,0,0,181,182,5,61,0,0,182,42,1,0,0,0,183,184,5,42,0,0,184,185,5,61,0,0,185,44,1,0,0,0,186,187,5,47,0,0,187,188,5,61,0,0,188,46,1,0,0,0,189,190,5,37,0,0,190,191,5,61,0,0,191,48,1,0,0,0,192,193,5,43,0,0,193,194,5,61,0,0,194,50,1,0,0,0,195,196,5,45,0,0,196,197,5,61,0,0,197,52,1,0,0,0,198,199,5,61,0,0,199,200,5,62,0,0,200,54,1,0,0,0,201,202,5,58,0,0,202,203,5,61,0,0,203,56,1,0,0,0,204,205,5,116,0,0,205,206,5,114,0,0,206,207,5,117,0,0,207,214,5,101,0,0,208,209,5,102,0,0,209,210,5,97,0,0,210,211,5,108,0,0,211,212,5,115,0,0,212,214,5,101,0,0,213,204,1,0,0,0,213,208,1,0,0,0,214,58,1,0,0,0,215,216,3,123,61,0,216,60,1,0,0,0,217,218,5,46,0,0,218,220,3,123,61,0,219,221,3,131,65,0,220,219,1,0,0,0,220,221,1,0,0,0,221,234,1,0,0,0,222,231,3,123,61,0,223,228,5,46,0,0,224,226,3,123,61,0,225,227,3,131,65,0,226,225,1,0,0,0,226,227,1,0,0,0,227,229,1,0,0,0,228,224,1,0,0,0,228,229,1,0,0,0,229,232,1,0,0,0,230,232,3,131,65,0,231,223,1,0,0,0,231,230,1,0,0,0,232,234,1,0,0,0,233,217,1,0,0,0,233,222,1,0,0,0,234,62,1,0,0,0,235,236,5,98,0,0,236,237,5,114,0,0,237,238,5,101,0,0,238,239,5,97,0,0,239,240,5,107,0,0,240,64,1,0,0,0,241,242,5,97,0,0,242,243,5,110,0,0,243,244,5,100,0,0,244,66,1,0,0,0,245,246,5,101,0,0,246,247,5,120,0,0,247,248,5,112,0,0,248,249,5,111,0,0,249,250,5,114,0,0,250,251,5,116,0,0,251,68,1,0,0,0,252,253,5,102,0,0,253,254,5,111,0,0,254,255,5,114,0,0,255,70,1,0,0,0,256,257,5,118,0,0,257,258,5,97,0,0,258,259,5,114,0,0,259,72,1,0,0,0,260,261,5,99,0,0,261,262,5,111,0,0,262,263,5,110,0,0,263,264,5,116,0,0,264,265,5,105,0,0,265,266,5,110,0,0,266,267,5,117,0,0,267,268,5,101,0,0,268,74,1,0,0,0,269,270,5,118,0,0,270,271,5,97,0,0,271,272,5,114,0,0,272,273,5,105,0,0,273,274,5,112,0,0,274,76,1,0,0,0,275,276,5,115,0,0,276,277,5,119,0,0,277,278,5,105,0,0,278,279,5,116,0,0,279,280,5,99,0,0,280,281,5,104,0,0,281,78,1,0,0,0,282,283,5,119,0,0,283,284,5,104,0,0,284,285,5,105,0,0,285,286,5,108,0,0,286,287,5,101,0,0,287,80,1,0,0,0,288,289,5,105,0,0,289,290,5,102,0,0,290,82,1,0,0,0,291,292,5,105,0,0,292,293,5,110,0,0,293,84,1,0,0,0,294,295,5,111,0,0,295,296,5,114,0,0,296,86,1,0,0,0,297,298,5,110,0,0,298,299,5,111,0,0,299,300,5,116,0,0,300,88,1,0,0,0,301,302,5,109,0,0,302,303,5,101,0,0,303,304,5,116,0,0,304,305,5,104,0,0,305,306,5,111,0,0,306,307,5,100,0,0,307,90,1,0,0,0,308,309,5,101,0,0,309,310,5,108,0,0,310,311,5,115,0,0,311,312,5,101,0,0,312,92,1,0,0,0,313,314,5,116,0,0,314,315,5,111,0,0,315,94,1,0,0,0,316,317,5,98,0,0,317,318,5,121,0,0,318,96,1,0,0,0,319,320,5,116,0,0,320,321,5,121,0,0,321,322,5,112,0,0,322,323,5,101,0,0,323,98,1,0,0,0,324,325,5,105,0,0,325,326,5,109,0,0,326,327,5,112,0,0,327,328,5,111,0,0,328,329,5,114,0,0,329,330,5,116,0,0,330,100,1,0,0,0,331,332,5,97,0,0,332,333,5,115,0,0,333,102,1,0,0,0,334,335,5,101,0,0,335,336,5,110,0,0,336,337,5,117,0,0,337,338,5,109,0,0,338,104,1,0,0,0,339,340,5,109,0,0,340,341,5,97,0,0,341,342,5,112,0,0,342,106,1,0,0,0,343,344,5,35,0,0,344,345,3,125,62,0,345,346,3,125,62,0,346,347,3,125,62,0,347,348,3,125,62,0,348,349,3,125,62,0,349,350,3,125,62,0,350,362,1,0,0,0,351,352,5,35,0,0,352,353,3,125,62,0,353,354,3,125,62,0,354,355,3,125,62,0,355,356,3,125,62,0,356,357,3,125,62,0,357,358,3,125,62,0,358,359,3,125,62,0,359,360,3,125,62,0,360,362,1,0,0,0,361,343,1,0,0,0,361,351,1,0,0,0,362,108,1,0,0,0,363,364,3,119,59,0,364,110,1,0,0,0,365,369,7,0,0,0,366,368,7,1,0,0,367,366,1,0,0,0,368,371,1,0,0,0,369,367,1,0,0,0,369,370,1,0,0,0,370,112,1,0,0,0,371,369,1,0,0,0,372,373,3,127,63,0,373,374,1,0,0,0,374,375,6,56,4,0,375,114,1,0,0,0,376,377,3,129,64,0,377,378,1,0,0,0,378,379,6,57,5,0,379,116,1,0,0,0,380,381,4,58,0,0,381,393,3,127,63,0,382,384,5,13,0,0,383,382,1,0,0,0,383,384,1,0,0,0,384,385,1,0,0,0,385,388,5,10,0,0,386,388,2,12,13,0,387,383,1,0,0,0,387,386,1,0,0,0,388,390,1,0,0,0,389,391,3,127,63,0,390,389,1,0,0,0,390,391,1,0,0,0,391,393,1,0,0,0,392,380,1,0,0,0,392,387,1,0,0,0,393,394,1,0,0,0,394,395,6,58,6,0,395,118,1,0,0,0,396,402,5,39,0,0,397,401,8,2,0,0,398,399,5,92,0,0,399,401,5,39,0,0,400,397,1,0,0,0,400,398,1,0,0,0,401,404,1,0,0,0,402,400,1,0,0,0,402,403,1,0,0,0,403,405,1,0,0,0,404,402,1,0,0,0,405,417,5,39,0,0,406,412,5,34,0,0,407,411,8,3,0,0,408,409,5,92,0,0,409,411,5,34,0,0,410,407,1,0,0,0,410,408,1,0,0,0,411,414,1,0,0,0,412,410,1,0,0,0,412,413,1,0,0,0,413,415,1,0,0,0,414,412,1,0,0,0,415,417,5,34,0,0,416,396,1,0,0,0,416,406,1,0,0,0,417,120,1,0,0,0,418,419,7,4,0,0,419,122,1,0,0,0,420,422,3,121,60,0,421,420,1,0,0,0,422,423,1,0,0,0,423,421,1,0,0,0,423,424,1,0,0,0,424,124,1,0,0,0,425,426,7,5,0,0,426,126,1,0,0,0,427,429,7,6,0,0,428,427,1,0,0,0,429,430,1,0,0,0,430,428,1,0,0,0,430,431,1,0,0,0,431,128,1,0,0,0,432,433,5,47,0,0,433,434,5,47,0,0,434,438,1,0,0,0,435,437,8,7,0,0,436,435,1,0,0,0,437,440,1,0,0,0,438,436,1,0,0,0,438,439,1,0,0,0,439,130,1,0,0,0,440,438,1,0,0,0,441,443,7,8,0,0,442,444,7,9,0,0,443,442,1,0,0,0,443,444,1,0,0,0,444,445,1,0,0,0,445,446,3,123,61,0,446,132,1,0,0,0,22,0,213,220,226,228,231,233,361,369,383,387,390,392,400,402,410,412,416,423,430,438,443,7,1,1,0,1,2,1,1,3,2,1,4,3,0,1,0,0,2,0,1,58,4]),w(Re,"__ATN"),w(Re,"DecisionsToDFA",Re._ATN.decisionToState.map((e,n)=>new dp(e,n)));let xl=Re;var V=(t=>(t.BOOL="bool",t.INT="int",t.FLOAT="float",t.ARRAY="array",t.BOX="box",t.CHART_POINT="chart.point",t.COLOR="color",t.CONST="const",t.LABEL="label",t.LINE="line",t.LINEFILL="linefill",t.MAP="map",t.MATRIX="matrix",t.POLYLINE="polyline",t.SERIES="series",t.SIMPLE="simple",t.STRING="string",t.TABLE="table",t.UNDETERMINED="undetermined type",t.INPUT="input",t.NA="na",t.VOID="void",t.ENUM="enum",t))(V||{}),le=(t=>(t.FlowStmt="FlowStmt",t.DeclareAssign="DeclareAssign",t.VarBlockStmt="VarBlockStmt",t.VarSingle="VarSingle",t.VarMultiple="VarMultiple",t.ParenthesizedExpression="ParenthesizedExpression",t.AdditiveExpression="AdditiveExpression",t.RelationalExpression="RelationalExpression",t.EqualityExpression="EqualityExpression",t.TernaryExpression="TernaryExpression",t.UnaryExpression="UnaryExpression",t.NotExpression="NotExpression",t.MemberIndexExpression="MemberIndexExpression",t.MethodExpression="MethodExpression",t.LogicalAndExpression="LogicalAndExpression",t.LogicalOrExpression="LogicalOrExpression",t.MultiplicativeExpression="MultiplicativeExpression",t.Brackethesized="Brackethesized",t.IfStatement="IfStatement",t.ForToStatement="ForToStatement",t.ForInStatement="ForInStatement",t.SwitchStatement="SwitchStatement",t.CaseClause="CaseClause",t.DefaultCaluse="DefaultCaluse",t.WhileStatement="WhileStatement",t.ImportElement="ImportElement",t.Literal="Literal",t.ArrowFunction="ArrowFunction",t.ArrowMethod="ArrowMethod",t.TypeStatement="TypeStatement",t.Name="Name",t.AgainAssign="AgainAssign",t.EnumStatement="EnumStatement",t))(le||{}),Kt=(t=>(t.description="description",t.field="field",t.function="function",t.param="param",t.returns="returns",t.type="type",t.variable="variable",t.enum="enum",t))(Kt||{}),Ii=(t=>(t.library="library",t.indicator="indicator",t.strategy="strategy",t))(Ii||{});const pe={onlyInLoop:"'$text' is only allowed inside loops",invalidType:"Invalid argument 'expr$index' in 'operator SQBR' call",typeUseError:"Cannot specify a type form '$text' without also specifying the type.",notTypeKeyword:"'$text' is not a valid type keyword in variable declaration",undeclared:"Undeclared identifier '$name'",repeatVar:"'$name' is already defined",typeRepeatErr:"$keyword '$name' is already defined.",typeMismatch:"Cannot call '$operator' with argument '$index'. An argument of '$typeE' type was used but a '$typeR' is expected.",assignTypeMismatch:"Cannot assign a value of the `$typeE` type to the '$name' variable. The variable is declared with the `$typeR` type.",voidNotVar:"Void expression cannot be assigned to a variable",declareTypeErr:"Declared type '$type' is not compatible with assigned type '$valueType'",mapKeyValErr:"Cannot put <$typeA, $typeB> pairs into a map containing `$typeC` keys and `$typeD` values. The maps passed into the `$name()` function must have the same key types and value types.",inputSourceErr:"Invalid value for the '$name' parameter of the '$funcName' function. Possible values: [open, high, low, close, hl2, hlc3, ohlc4, hlcc4, volume].",buildInUseErr:"Cannot use '$name' as the default value of a type's field. The default value cannot be a function, variable or calculation.",argsLenErr:"Too many arguments passed into the `$name()` function call. Passed $lenA arguments but expected $lenB.",requiredParamErr:"No value assigned to the `$argName` parameter in $name()",argsSyntaxErr:"Syntax error after the argument for `$argName`. Arguments without their parameter name cannot be used after arguments with parameter names.",requestArgsErr:"Type $type cannot be used in $name '$argName' argument",mapKeyErr:"Incorrect `key` type `$type` in the variable. The `key` type must be one of the following: int, float, string, bool, color.",templateErr:"Incorrect number of arguments for the template: $countA expected, $countB passed.",templateNoSupportErr:"The '$name()' function does not support templates",ifOrSwitchTypeErr:"Return type of one of the '$keyword' blocks is not compatible with return type of other block(s) ($types)",argsNameErr:"The '$name' function does not have an argument with the name '$argName'",noFiledErr:"Object has no field $name",methodNotExistErr:"Could not find method or method reference '$methodName' for '$name'",tupleVarErr:"Syntax error: The quantities of tuple elements on each side of the assignment operator do not match. The right side has $indexA but the left side has $indexB.",tupleLeftVarErr:"Invalid assignment. Cannot assign a tuple to a variable '$name'.",tupleRightVarErr:"Cannot assign a variable to a tuple. The right side must be a function call or structure ('if', 'switch', 'for', 'while') returning a tuple with the same number of elements.",tempateTypeErr:"Syntax error: Only templates for arrays and matrices consist of a single type identifier enclosed in angle brackets.",qualifierErr:"'$name' is not a valid type qualifier. Possible values: 'const', 'simple', 'series'",notFindFuncErr:"Could not find function or function reference '$name'",naVarErr:"Value with NA type cannot be assigned to a variable that was defined without type keyword",notHistoryErr:"Variable '$name' doesn't have history values",defaultValueErr:"The default value cannot be a function, variable or calculation.",defaultValueTypeErr:"Default value of type $typeE can not be assigned to an argument of type $typeR",typeFieldErr:"In a type declaration, all fields without a default value must be explicitly typified.",unaryErr:"Syntax error at input '$sign'",funcArgAssignErr:"Function arguments cannot be mutable ('$name')",declaredErr:"A variable declared with the '$prefix' keyword cannot accept values of the '$type' form. Assign a '$prefix' value to this variable or remove the '$prefix' keyword from its declaration.",globalFuncErr:"Cannot use '$name' in local scope",onlyStatementErr:"Scripts must contain one declaration statement: `indicator()`, `strategy()` or `library()`, Your script has $count.",modifyGlobalVarErr:"Cannot modify global variable '$name' in function",inputDefvalErr:"Arguments of input function must be of constant type, or 'source' builtin variables.",objectIsNaErr:"Cannot access the '$name' $type of an na object. The object is 'na'.",buidinAssignErr:"Cannot assign a new value to the built-in variable '$name'.",buidinVarErr:"Cannot shadow the built-in variable `$name` because it has already been used as a built-in.",useNaErr:"Cannot use an `na` value of an unspecified type in the `$name` function.",libraryTitleErr:"Invalid argument 'title' in 'library' call. It cannot contain spaces, special characters or begin with a digit.",exportFuncArgErr:"All exported functions args should be typified",indiRunErr:"An indicator must contain at least one of the following: any `plot*()` function, `barcolor()`, `bgcolor()`, `hline()`, `alertcondition()`, or any drawing (line, label, box, table, polyline).",libraryExportErr:"A library must contain at least one exported function, method, or type.",strategyRunErr:"A strategy must contain at least one of the following: any `strategy.*()` function that creates orders, any `plot*()` function, `barcolor()`, `bgcolor()`, `hline()`, or any drawing (line, label, box, table, polyline).",exportUseErr:"Only libraries can contain exported $type.",funcRepeatErr:"The '$name' function has overloads with the same parameters. The type of parameters must be different in overloaded versions of functions.",importMultipleErr:"Cannot import a library more than once",importNotExitErr:"The user '$username' does not have a published library titled '$libraryName'",importNameRepeatErr:"More than one import uses the same alias: $name. Previous usage at line: $line",exportFuncHasInputErr:"The exported function '$func' depends on the '$name' input variable, which is not allowed.",libraryTitleIsKeywordErr:"Invalid argument 'title' in 'library' call. Token: '$name' can't be used as library title.",exportFuncUseGlobalVarErr:"Cannot use global variables in exported functions. Function: $func",loopRuntimeErr:"Loop takes too long to execute (> 500 ms)",paramsErr:"Invalid value '$value' for '$param' parameter of the '$func' function. Possible values: $targetVal",displayErr:"Invalid argument 'display' in '$func' call. Possible values: $values",exportFuncUseReqErr:"Cannot use `request.*()` call in exported function `$name()`",requestExprErr:"Type series $type cannot be used in $name 'expression' argument",argDefaultErr:"The default value assigned to a parameter must be either a literal value (e.g., `5`) or a built-in variable (e.g., `close`)",overloadFuncErr:"Cannot use global variables or any values qualified as 'input' in the local scopes of overloaded functions or methods. Remove any global variables or inputs from the scopes of all '$name()' overloads.",againAssignErr:"Unable to determine the object for the field assignment. Try putting the object into a separate variable before assigning values to its fields.",requestUserInLoopErr:"Cannot use `request.*()` call within loops or conditional structures.",enumVarNameErr:"Invalid enum name '$name': `bool`, `int`, `float`, `string`, and `color` are not allowed.",enumVarNameBuiltinErr:"Invalid object name: $name. Namespaces of built-ins cannot be used.",typeNameErr:"Invalid user-defined type name '$name': `bool`, `int`, `float`, `string`, and `color` are not allowed.",enumUseErr:"Cannot use the '$name' as a value. Use one of the enum's fields instead.",conditionalErr:"'$name' conditional expression must be of a bool type!",fortoErr:'The value of the "for" loop must be a number.',indicatorUseStrategyFuncErr:"You cannot use strategy $type ($name) in indicator script.",arrEmptyErr:"Array must not be empty",arrLengthDiffErr:"Arrays have different lengths",arrTypeErr:"数组类型错误,array.$name方法只能使用$type类型数组!",inputOptErr:"input's defval should be in options, but '$defval' is not in [$args]",mathRandomErr:"min must be less than max",matrixRehapeErr:"New matrix must be of same area as original matrix",strategyExitErr:"strategy.exit must have at least one of the following parameters: 'profit', 'limit', 'loss', 'stop' or one of the following pairs: 'trail_offset' and 'trail_price' / 'trail_points'. To close the position at market price, use 'strategy.close'",arrLenErr:"Invalid array length",mergeCellErr:"error: start_column > end_column or start_row > end_row",minOrMaxErr:"Input's `defval` value must be between `minval` and `maxval`",requestsNumErr:"Exceeded the maximum number of requests 40"},ar={repeatVar:"Shadowing variable '$name' which exists in parent scope. Did you want to use the ':=' operator instead of '=' ?",typeMismatch:"The `$index` parameter of the `$operator` function accepts a '$type' argument. To avoid potential unexpected results, pass a '$type' value or expression to this parameter.",moreSameArg:"More than one '$arg' arguments are supplied. Only the first one will be used.",localScopeGetHistory:"The variable '$name' is declared in local scope, which may not be executed at every update. So, obtaining its historical values may lead to unexpected results",localScopeWarning:"The function '$name' should be called on each calculation for consistency. It is recommended to extract the call from this scope",strategyCalcTickWarn:"Strategies without `calc_on_every_tick = true` only calculate on confirmed chart bars. In this case, `barstate.islast` may not initially return `true` on realtime bars, as the last bar is unconfirmed until it closes. If you need to check whether a bar is the latest before it closes, enable `calc_on_every_tick` in the `strategy()` function.",conditionWarning:"The `condition` parameter of the `$name` accepts a 'bool' argument. To avoid potential unexpected results, pass a 'bool' value or expression to this parameter.",lineWidthWarning:"Passing a value below 1 to `linewidth` will be replaced with 1 during compilation.",boolVarNumWarning:"The `$name` variable casts a numeric value to the 'bool' type. To avoid potential unexpected results, assign a 'bool' value to this variable."},Pi=[V.SERIES,V.SIMPLE,V.INPUT,V.CONST],lu=[V.INT,V.FLOAT,V.BOOL,V.COLOR,V.STRING],fu=["indicator","strategy","library"],Al=["plot","plotbar","plotchar","plotarrow","plotshape","plotcandle","hline","alertcondition","barcolor","bgcolor","fill"],$_=[...Al,"indicator","library","strategy","strategy.risk.max_drawdown","strategy.risk.allow_entry_in","strategy.risk.max_cons_loss_days","max_intraday_filled_orders","strategy.risk.max_intraday_loss","strategy.risk.max_position_size"],V_=[...Al,"table.new","label.new","line.new","box.new","polyline.new","linefill.new"],j_=["strategy.entry","strategy.order","strategy.exit","strategy.close","strategy.cancel","strategy.close_all","strategy.cancel_all"],Mp=["strategy","input","table","color","line","linefill","label","box"],Cl=["close","open","high","low","hl2","hlc3","hlcc4","ohlc4","volume"],H_=/^\/\/\s*@(description|field|function|param|returns|type|enum|variable)/,wn=["case","catch","default","delete","do","finally","function","instanceof","new","return","this","throw","try","typeof","void","with"],Lp=["session","ta","syminfo","timeframe","strategy","barstate","label","line","linefill","box","table","chart","earnings","polyline","math","adjustment","hline","position","size","plot","format","dayofweek","shape","location","scale","currency","barmerge","xloc","yloc","extend","display","text","font","order","alert","dividends","splits","color","input","str","request","ticker","array","matrix","runtime","log","map"];var hu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ol(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Bp={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(hu,function(){var n=1e3,r=6e4,a=36e5,c="millisecond",h="second",d="minute",v="hour",S="day",C="week",T="month",D="quarter",L="year",P="date",b="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,O={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(ge){var re=["th","st","nd","rd"],de=ge%100;return"["+ge+(re[(de-20)%10]||re[de]||re[0])+"]"}},R=function(ge,re,de){var fe=String(ge);return!fe||fe.length>=re?ge:""+Array(re+1-fe.length).join(de)+ge},k={s:R,z:function(ge){var re=-ge.utcOffset(),de=Math.abs(re),fe=Math.floor(de/60),Oe=de%60;return(re<=0?"+":"-")+R(fe,2,"0")+":"+R(Oe,2,"0")},m:function ge(re,de){if(re.date()<de.date())return-ge(de,re);var fe=12*(de.year()-re.year())+(de.month()-re.month()),Oe=re.clone().add(fe,T),Ie=de-Oe<0,ve=re.clone().add(fe+(Ie?-1:1),T);return+(-(fe+(de-Oe)/(Ie?Oe-ve:ve-Oe))||0)},a:function(ge){return ge<0?Math.ceil(ge)||0:Math.floor(ge)},p:function(ge){return{M:T,y:L,w:C,d:S,D:P,h:v,m:d,s:h,ms:c,Q:D}[ge]||String(ge||"").toLowerCase().replace(/s$/,"")},u:function(ge){return ge===void 0}},U="en",X={};X[U]=O;var J="$isDayjsObject",G=function(ge){return ge instanceof ee||!(!ge||!ge[J])},Y=function ge(re,de,fe){var Oe;if(!re)return U;if(typeof re=="string"){var Ie=re.toLowerCase();X[Ie]&&(Oe=Ie),de&&(X[Ie]=de,Oe=Ie);var ve=re.split("-");if(!Oe&&ve.length>1)return ge(ve[0])}else{var Ue=re.name;X[Ue]=re,Oe=Ue}return!fe&&Oe&&(U=Oe),Oe||!fe&&U},$=function(ge,re){if(G(ge))return ge.clone();var de=typeof re=="object"?re:{};return de.date=ge,de.args=arguments,new ee(de)},te=k;te.l=Y,te.i=G,te.w=function(ge,re){return $(ge,{locale:re.$L,utc:re.$u,x:re.$x,$offset:re.$offset})};var ee=function(){function ge(de){this.$L=Y(de.locale,null,!0),this.parse(de),this.$x=this.$x||de.x||{},this[J]=!0}var re=ge.prototype;return re.parse=function(de){this.$d=function(fe){var Oe=fe.date,Ie=fe.utc;if(Oe===null)return new Date(NaN);if(te.u(Oe))return new Date;if(Oe instanceof Date)return new Date(Oe);if(typeof Oe=="string"&&!/Z$/i.test(Oe)){var ve=Oe.match(y);if(ve){var Ue=ve[2]-1||0,Z=(ve[7]||"0").substring(0,3);return Ie?new Date(Date.UTC(ve[1],Ue,ve[3]||1,ve[4]||0,ve[5]||0,ve[6]||0,Z)):new Date(ve[1],Ue,ve[3]||1,ve[4]||0,ve[5]||0,ve[6]||0,Z)}}return new Date(Oe)}(de),this.init()},re.init=function(){var de=this.$d;this.$y=de.getFullYear(),this.$M=de.getMonth(),this.$D=de.getDate(),this.$W=de.getDay(),this.$H=de.getHours(),this.$m=de.getMinutes(),this.$s=de.getSeconds(),this.$ms=de.getMilliseconds()},re.$utils=function(){return te},re.isValid=function(){return this.$d.toString()!==b},re.isSame=function(de,fe){var Oe=$(de);return this.startOf(fe)<=Oe&&Oe<=this.endOf(fe)},re.isAfter=function(de,fe){return $(de)<this.startOf(fe)},re.isBefore=function(de,fe){return this.endOf(fe)<$(de)},re.$g=function(de,fe,Oe){return te.u(de)?this[fe]:this.set(Oe,de)},re.unix=function(){return Math.floor(this.valueOf()/1e3)},re.valueOf=function(){return this.$d.getTime()},re.startOf=function(de,fe){var Oe=this,Ie=!!te.u(fe)||fe,ve=te.p(de),Ue=function(Et,Lt){var gt=te.w(Oe.$u?Date.UTC(Oe.$y,Lt,Et):new Date(Oe.$y,Lt,Et),Oe);return Ie?gt:gt.endOf(S)},Z=function(Et,Lt){return te.w(Oe.toDate()[Et].apply(Oe.toDate("s"),(Ie?[0,0,0,0]:[23,59,59,999]).slice(Lt)),Oe)},ie=this.$W,ue=this.$M,xe=this.$D,be="set"+(this.$u?"UTC":"");switch(ve){case L:return Ie?Ue(1,0):Ue(31,11);case T:return Ie?Ue(1,ue):Ue(0,ue+1);case C:var xt=this.$locale().weekStart||0,Vt=(ie<xt?ie+7:ie)-xt;return Ue(Ie?xe-Vt:xe+(6-Vt),ue);case S:case P:return Z(be+"Hours",0);case v:return Z(be+"Minutes",1);case d:return Z(be+"Seconds",2);case h:return Z(be+"Milliseconds",3);default:return this.clone()}},re.endOf=function(de){return this.startOf(de,!1)},re.$set=function(de,fe){var Oe,Ie=te.p(de),ve="set"+(this.$u?"UTC":""),Ue=(Oe={},Oe[S]=ve+"Date",Oe[P]=ve+"Date",Oe[T]=ve+"Month",Oe[L]=ve+"FullYear",Oe[v]=ve+"Hours",Oe[d]=ve+"Minutes",Oe[h]=ve+"Seconds",Oe[c]=ve+"Milliseconds",Oe)[Ie],Z=Ie===S?this.$D+(fe-this.$W):fe;if(Ie===T||Ie===L){var ie=this.clone().set(P,1);ie.$d[Ue](Z),ie.init(),this.$d=ie.set(P,Math.min(this.$D,ie.daysInMonth())).$d}else Ue&&this.$d[Ue](Z);return this.init(),this},re.set=function(de,fe){return this.clone().$set(de,fe)},re.get=function(de){return this[te.p(de)]()},re.add=function(de,fe){var Oe,Ie=this;de=Number(de);var ve=te.p(fe),Ue=function(ue){var xe=$(Ie);return te.w(xe.date(xe.date()+Math.round(ue*de)),Ie)};if(ve===T)return this.set(T,this.$M+de);if(ve===L)return this.set(L,this.$y+de);if(ve===S)return Ue(1);if(ve===C)return Ue(7);var Z=(Oe={},Oe[d]=r,Oe[v]=a,Oe[h]=n,Oe)[ve]||1,ie=this.$d.getTime()+de*Z;return te.w(ie,this)},re.subtract=function(de,fe){return this.add(-1*de,fe)},re.format=function(de){var fe=this,Oe=this.$locale();if(!this.isValid())return Oe.invalidDate||b;var Ie=de||"YYYY-MM-DDTHH:mm:ssZ",ve=te.z(this),Ue=this.$H,Z=this.$m,ie=this.$M,ue=Oe.weekdays,xe=Oe.months,be=Oe.meridiem,xt=function(Lt,gt,Ot,Zt){return Lt&&(Lt[gt]||Lt(fe,Ie))||Ot[gt].slice(0,Zt)},Vt=function(Lt){return te.s(Ue%12||12,Lt,"0")},Et=be||function(Lt,gt,Ot){var Zt=Lt<12?"AM":"PM";return Ot?Zt.toLowerCase():Zt};return Ie.replace(g,function(Lt,gt){return gt||function(Ot){switch(Ot){case"YY":return String(fe.$y).slice(-2);case"YYYY":return te.s(fe.$y,4,"0");case"M":return ie+1;case"MM":return te.s(ie+1,2,"0");case"MMM":return xt(Oe.monthsShort,ie,xe,3);case"MMMM":return xt(xe,ie);case"D":return fe.$D;case"DD":return te.s(fe.$D,2,"0");case"d":return String(fe.$W);case"dd":return xt(Oe.weekdaysMin,fe.$W,ue,2);case"ddd":return xt(Oe.weekdaysShort,fe.$W,ue,3);case"dddd":return ue[fe.$W];case"H":return String(Ue);case"HH":return te.s(Ue,2,"0");case"h":return Vt(1);case"hh":return Vt(2);case"a":return Et(Ue,Z,!0);case"A":return Et(Ue,Z,!1);case"m":return String(Z);case"mm":return te.s(Z,2,"0");case"s":return String(fe.$s);case"ss":return te.s(fe.$s,2,"0");case"SSS":return te.s(fe.$ms,3,"0");case"Z":return ve}return null}(Lt)||ve.replace(":","")})},re.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},re.diff=function(de,fe,Oe){var Ie,ve=this,Ue=te.p(fe),Z=$(de),ie=(Z.utcOffset()-this.utcOffset())*r,ue=this-Z,xe=function(){return te.m(ve,Z)};switch(Ue){case L:Ie=xe()/12;break;case T:Ie=xe();break;case D:Ie=xe()/3;break;case C:Ie=(ue-ie)/6048e5;break;case S:Ie=(ue-ie)/864e5;break;case v:Ie=ue/a;break;case d:Ie=ue/r;break;case h:Ie=ue/n;break;default:Ie=ue}return Oe?Ie:te.a(Ie)},re.daysInMonth=function(){return this.endOf(T).$D},re.$locale=function(){return X[this.$L]},re.locale=function(de,fe){if(!de)return this.$L;var Oe=this.clone(),Ie=Y(de,fe,!0);return Ie&&(Oe.$L=Ie),Oe},re.clone=function(){return te.w(this.$d,this)},re.toDate=function(){return new Date(this.valueOf())},re.toJSON=function(){return this.isValid()?this.toISOString():null},re.toISOString=function(){return this.$d.toISOString()},re.toString=function(){return this.$d.toUTCString()},ge}(),_e=ee.prototype;return $.prototype=_e,[["$ms",c],["$s",h],["$m",d],["$H",v],["$W",S],["$M",T],["$y",L],["$D",P]].forEach(function(ge){_e[ge[1]]=function(re){return this.$g(re,ge[0],ge[1])}}),$.extend=function(ge,re){return ge.$i||(ge(re,ee,$),ge.$i=!0),$},$.locale=Y,$.isDayjs=G,$.unix=function(ge){return $(1e3*ge)},$.en=X[U],$.Ls=X,$.p={},$})})(Bp);var G_=Bp.exports,Up=Ol(G_),$p={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(hu,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(c,h,d){var v=h.prototype;d.utc=function(b){var y={date:b,utc:!0,args:arguments};return new h(y)},v.utc=function(b){var y=d(this.toDate(),{locale:this.$L,utc:!0});return b?y.add(this.utcOffset(),n):y},v.local=function(){return d(this.toDate(),{locale:this.$L,utc:!1})};var S=v.parse;v.parse=function(b){b.utc&&(this.$u=!0),this.$utils().u(b.$offset)||(this.$offset=b.$offset),S.call(this,b)};var C=v.init;v.init=function(){if(this.$u){var b=this.$d;this.$y=b.getUTCFullYear(),this.$M=b.getUTCMonth(),this.$D=b.getUTCDate(),this.$W=b.getUTCDay(),this.$H=b.getUTCHours(),this.$m=b.getUTCMinutes(),this.$s=b.getUTCSeconds(),this.$ms=b.getUTCMilliseconds()}else C.call(this)};var T=v.utcOffset;v.utcOffset=function(b,y){var g=this.$utils().u;if(g(b))return this.$u?0:g(this.$offset)?T.call(this):this.$offset;if(typeof b=="string"&&(b=function(U){U===void 0&&(U="");var X=U.match(r);if(!X)return null;var J=(""+X[0]).match(a)||["-",0,0],G=J[0],Y=60*+J[1]+ +J[2];return Y===0?0:G==="+"?Y:-Y}(b),b===null))return this;var O=Math.abs(b)<=16?60*b:b,R=this;if(y)return R.$offset=O,R.$u=b===0,R;if(b!==0){var k=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(R=this.local().add(O+k,n)).$offset=O,R.$x.$localOffset=k}else R=this.utc();return R};var D=v.format;v.format=function(b){var y=b||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return D.call(this,y)},v.valueOf=function(){var b=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*b},v.isUTC=function(){return!!this.$u},v.toISOString=function(){return this.toDate().toISOString()},v.toString=function(){return this.toDate().toUTCString()};var L=v.toDate;v.toDate=function(b){return b==="s"&&this.$offset?d(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():L.call(this)};var P=v.diff;v.diff=function(b,y,g){if(b&&this.$u===b.$u)return P.call(this,b,y,g);var O=this.local(),R=d(b).local();return P.call(O,R,y,g)}}})})($p);var K_=$p.exports,z_=Ol(K_),Vp={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(hu,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,c,h){var d,v=function(D,L,P){P===void 0&&(P={});var b=new Date(D),y=function(g,O){O===void 0&&(O={});var R=O.timeZoneName||"short",k=g+"|"+R,U=r[k];return U||(U=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:g,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:R}),r[k]=U),U}(L,P);return y.formatToParts(b)},S=function(D,L){for(var P=v(D,L),b=[],y=0;y<P.length;y+=1){var g=P[y],O=g.type,R=g.value,k=n[O];k>=0&&(b[k]=parseInt(R,10))}var U=b[3],X=U===24?0:U,J=b[0]+"-"+b[1]+"-"+b[2]+" "+X+":"+b[4]+":"+b[5]+":000",G=+D;return(h.utc(J).valueOf()-(G-=G%1e3))/6e4},C=c.prototype;C.tz=function(D,L){D===void 0&&(D=d);var P=this.utcOffset(),b=this.toDate(),y=b.toLocaleString("en-US",{timeZone:D}),g=Math.round((b-new Date(y))/1e3/60),O=h(y,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(b.getTimezoneOffset()/15)-g,!0);if(L){var R=O.utcOffset();O=O.add(P-R,"minute")}return O.$x.$timezone=D,O},C.offsetName=function(D){var L=this.$x.$timezone||h.tz.guess(),P=v(this.valueOf(),L,{timeZoneName:D}).find(function(b){return b.type.toLowerCase()==="timezonename"});return P&&P.value};var T=C.startOf;C.startOf=function(D,L){if(!this.$x||!this.$x.$timezone)return T.call(this,D,L);var P=h(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return T.call(P,D,L).tz(this.$x.$timezone,!0)},h.tz=function(D,L,P){var b=P&&L,y=P||L||d,g=S(+h(),y);if(typeof D!="string")return h(D).tz(y);var O=function(X,J,G){var Y=X-60*J*1e3,$=S(Y,G);if(J===$)return[Y,J];var te=S(Y-=60*($-J)*1e3,G);return $===te?[Y,$]:[X-60*Math.min($,te)*1e3,Math.max($,te)]}(h.utc(D,b).valueOf(),g,y),R=O[0],k=O[1],U=h(R).utcOffset(k);return U.$x.$timezone=y,U},h.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},h.tz.setDefault=function(D){d=D}}})})(Vp);var W_=Vp.exports,X_=Ol(W_);Up.extend(z_),Up.extend(X_);function ye(t,e){return t.replace(/\$(\w+)/g,(n,r)=>String(e[r])||n)}function pu(t){var e=encodeURI(t),n=btoa(e);return n}class q_ extends d_{constructor(){super(...arguments);w(this,"visitProgram");w(this,"visitGlobalStmt");w(this,"visitBlockStmt");w(this,"visitStmt");w(this,"visitSimpleStmt");w(this,"visitFlowStmt");w(this,"visitBlock");w(this,"visitBlockLine");w(this,"visitVariableDeclarationStmt");w(this,"visitDeclareAssign");w(this,"visitAgainAssign");w(this,"visitVarModifier");w(this,"visitBlockSequence");w(this,"visitExpressionSequence");w(this,"visitExpressionBlockSequence");w(this,"visitVarBlockStmt");w(this,"visitVarSingle");w(this,"visitVarMultiple");w(this,"visitBlockExpression");w(this,"visitParenthesizedExpression");w(this,"visitAdditiveExpression");w(this,"visitRelationalExpression");w(this,"visitTernaryExpression");w(this,"visitLogicalAndExpression");w(this,"visitNameExpression");w(this,"visitLiteralExpression");w(this,"visitLogicalOrExpression");w(this,"visitUnaryExpression");w(this,"visitNotExpression");w(this,"visitMemberIndexExpression");w(this,"visitMethodExpression");w(this,"visitEqualityExpression");w(this,"visitMultiplicativeExpression");w(this,"visitBrackethesized");w(this,"visitArguments");w(this,"visitArgument");w(this,"visitIfStatement");w(this,"visitForToStatement");w(this,"visitForInStatement");w(this,"visitSwitchStatement");w(this,"visitCaseClause");w(this,"visitDefaultCaluse");w(this,"visitWhileStatement");w(this,"visitImportStmt");w(this,"visitImportElement");w(this,"visitLiteral");w(this,"visitMethodStmt");w(this,"visitMethodElement");w(this,"visitMethodName");w(this,"visitArrowFunction");w(this,"visitArrowFunctionParameters");w(this,"visitFormalParameterList");w(this,"visitFormalParameterArg");w(this,"visitArrowMethod");w(this,"visitArrowMethodParameters");w(this,"visitTypeStatement");w(this,"visitTypeElement");w(this,"visitAssignmentOperator");w(this,"visitTypeMap");w(this,"visitTypeSeries");w(this,"visitTypeArray");w(this,"visitTypeGather");w(this,"visitIdentifier");w(this,"visitTypeName");w(this,"visitName");w(this,"visitEnumStatement");w(this,"visitEnumElement")}}class Y_ extends q_{constructor(n){super();w(this,"_buildinVariables");w(this,"_buildinTypes");w(this,"_buildinConstants");w(this,"_buildinMethods");w(this,"_buildinFunctions");this._buildinVariables=new Map,this._buildinConstants=new Map,this._buildinFunctions=new Map,this._buildinTypes=new Map,this._buildinMethods=new Map,this._buildinHandle(n)}_buildinHandle(n){for(const r in n){const a=new Map(Object.entries(n[r]));switch(r){case"constants":this._buildinConstants=a;break;case"functions":this._buildinFunctions=a;break;case"methods":this._buildinMethods=a;break;case"types":this._buildinTypes=a;break;case"variables":this._buildinVariables=a;break}}}_typeHandle(n=[],r){if(!n.length)return V.UNDETERMINED;if(n=n.filter(h=>!h.endsWith(V.NA)),!n.length)return`${V.SIMPLE} ${V.NA}`;let a=100,c="";for(const h of n){if(h===V.UNDETERMINED)return V.UNDETERMINED;h.startsWith(V.SERIES)?a=0:h.startsWith(V.SIMPLE)&&a>0?a=1:h.startsWith(V.INPUT)&&a>1?a=2:h.startsWith(V.CONST)&&a>2&&(a=3);const d=this._removePrefix(h);(d!==V.INT||!c)&&(c=d)}return a===100?c:`${Pi[a]} ${r||c}`}_returnTypesOtherHandle(n,r,a,c){if(!a.length||a[0].includes("<>")){const h=n==null?void 0:n.type;let d=h;if(!h||h===V.UNDETERMINED)return[V.UNDETERMINED];switch(r){case"series <type>":d=this._getArrayType(h),d||(d=this._removePrefix(h)),a=[this._typeAddSeries(d)];break;case"array<type>":case"matrix<type>":case"type[]":if(this._isMapType(h)){const v=this._getMapType(h)||[];c.includes("keys")?d=v[0]:d=v[1]}else d=this._getArrayType(h),d||(d=this._removePrefix(h));a=[this._typeReplace(r,d)];break;case"<matrix_type>":d=this._getArrayType(h),a=[this._typeAddSeries(d)];break;case"map<keyType, valueType>":a=[d];break;case"<value_type>":d=this._getMapType(h),a=[d[1]];break}}return a}_checkMethodThisType(n,r){if(!n||!n.length||n[0].includes("<>"))return!0;const a=r.replace("int","float");return n.some(c=>c===r||a===c||c.endsWith(r))}_priorityComparison(n,r){if(!n)return!1;if(this._isArrayType(n)||this._isMatrixType(n))return this._getArrayType(r)!==V.INT;{const a=this._getPrefix(n),c=this._getPrefix(r);return a===c?!!n.endsWith(V.INT):!(Pi.indexOf(a)<Pi.indexOf(c))}}_compareType(n,r){if(n===V.UNDETERMINED||r===V.UNDETERMINED)return!0;const a=[V.FLOAT,V.INT];if(this._isArrayType(n)||this._isMatrixType(n)){const c=this._getArrayType(n)||"",h=this._getArrayType(r)||"";return c===h||a.includes(c)&&a.includes(h)}else if(this._isMapType(n)){const c=this._getMapType(n)||[],h=this._getMapType(r)||[];return(c[0]===h[0]||a.includes(c[0])&&a.includes(h[0]))&&(c[1]===h[1]||a.includes(c[1])&&a.includes(h[1]))}else{const c=this._removePrefix(n),h=this._removePrefix(r);return c===V.NA||h===V.NA||c===h||a.includes(c)&&a.includes(h)}}_typeAddSeries(n){return this._buildinTypes.get(n)&&n!==V.CHART_POINT?`${V.SERIES} ${n}`:n}_typeAddConst(n){return lu.includes(n)?`${V.CONST} ${n}`:this._typeAddSeries(n)}_getOriginMethodName(n,r){let a="";return this._isArrayType(n)?a=`${V.ARRAY}.${r}`:this._isMatrixType(n)?a=`${V.MATRIX}.${r}`:this._isMapType(n)?a=`${V.MAP}.${r}`:a=`${this._removePrefix(n)}.${r}`,a}_returnedTypesParse(n){if(!n||!n.length)return[];const r=n[0];return/^\[.+\]$/.test(r)?r.replace(/[[\]]/g,"").split(",").map(a=>a.trim()):n}_removePrefix(n=""){return n.replace(/(series|simple|const|input)\s+([\w\d.]+)/,"$2")}_getPrefix(n){if(!n)return"";const r=n.replace(/(series|simple|const|input).+/,"$1");return Pi.includes(r)?r:""}_getArrayType(n){let r=/\w+<([\w\d.]+)>/.exec(n);return r||(r=/([\w\d.]+)\[\]/.exec(n)),r==null?void 0:r[1]}_getMapType(n){const r=/\w+<(\w+),\s*([\w\d.]+)>/.exec(n);return(r==null?void 0:r[1])&&(r==null?void 0:r[2])&&[r==null?void 0:r[1],r==null?void 0:r[2]]}_isMatrixType(n){return/^matrix<[\w\d.]+>$/.test(n)}_isArrayType(n){return/^array<[\w\d.]+>$/.test(n)||/^[\w\d.]+\[\]$/.test(n)}_isMapType(n){return/^map<\w+,\s*[\w\d.]+>$/.test(n)}_arrayTypeConvert(n){return!this._isArrayType(n)||!n.includes("<")?n:`${this._getArrayType(n)}[]`}_getMethodTypeName(n){return this._isArrayType(n)?V.ARRAY:this._isMapType(n)?V.MAP:this._isMatrixType(n)?V.MATRIX:this._removePrefix(n)}_typeReplace(n,r){return r===V.UNDETERMINED?r:(r=this._removePrefix(r),this._arrayTypeConvert(n.startsWith(V.SERIES)?n.replace("<type>",r):n.replace("type",r)))}}var Sn=(t=>(t[t.Hint=1]="Hint",t[t.Info=2]="Info",t[t.Warning=4]="Warning",t[t.Error=8]="Error",t))(Sn||{});class jp extends Y_{constructor(n,r,a){super(n);w(this,"_loopCount");w(this,"_errors");w(this,"_variables");w(this,"_functions");w(this,"_methods");w(this,"_types");w(this,"_enums");w(this,"_currentBlockVars");w(this,"_currentFuncParams");w(this,"_isNeedCalc");w(this,"_blockCount");w(this,"_isInFunc");w(this,"_currentExportFunc");w(this,"_onlyStatementsCount");w(this,"_blockRanges");w(this,"_overloadsFuncs");w(this,"_hasMemberIndex");w(this,"_isInLocalScop");w(this,"_comments");w(this,"_currentLine",0);w(this,"_hasDrawFunc",!1);w(this,"_hasCreateOrderFunc",!1);w(this,"_scriptType");w(this,"_exportFunctions");w(this,"_exportMethods");w(this,"_exportTypes");w(this,"_exportEnums");w(this,"_exportPositions");w(this,"_description","");w(this,"_endExport");w(this,"_importLibs");w(this,"_getImportLibraryFunc");w(this,"_isEndExpr");w(this,"_inputVarName");w(this,"_hasRequest");w(this,"_strategyFuncName");w(this,"_strategyVarName");w(this,"visitProgram",async n=>{const{children:r}=n;let a=0;const c=[];for(this._pushBlockRanges(n);a<r.length;a++){const h=r[a];h.ruleIndex===M.RULE_globalStmt&&c.push(await this.visit(h))}return this._onlyStatementsCount<=0?this._errors.push({startColumn:0,endColumn:0,startLineNumber:0,endLineNumber:0,type:Sn.Error,message:ye(pe.onlyStatementErr,{count:this._onlyStatementsCount})}):this._scriptType===Ii.indicator&&(this._strategyFuncName?this._errorHandle(ye(pe.indicatorUseStrategyFuncErr,{name:this._strategyFuncName.name,type:"functions"}),this._strategyFuncName.ctx):this._strategyVarName&&this._errorHandle(ye(pe.indicatorUseStrategyFuncErr,{name:this._strategyVarName.name,type:"variables"}),this._strategyVarName.ctx)),c});w(this,"visitGlobalStmt",async n=>{const{children:r}=n;if(r&&r.length){const a=r[0],c=await this.visit(a);return a.ruleIndex===M.RULE_methodStmt&&fu.includes(c.exprs[0].name)&&(this._onlyStatementsCount++,this._onlyStatementsCount>1?this._errorHandle(ye(pe.onlyStatementErr,{count:this._onlyStatementsCount}),a):this._scriptType=c.exprs[0].name),c}return null});w(this,"visitBlockStmt",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_variableDeclarationStmt:c.push(...this.visit(h));break;case M.RULE_varBlockStmt:c.push(this.visit(h));break;case M.RULE_blockExpression:c.push(this.visit(h));break}}return c});w(this,"visitStmt",n=>{const{children:r}=n;if(r&&r.length){const a=r[0];return this.visit(a)}return null});w(this,"visitSimpleStmt",n=>{const{children:r}=n;if(r&&r.length){const a=r[0];return this.visit(a)}return null});w(this,"visitFlowStmt",n=>{const{children:r}=n,{column:a,line:c,text:h}=r[0].symbol;if(this._currentLine=c,this._loopCount<=0){const d=a+1;this._errors.push({startColumn:d,endColumn:parseInt(d+h.length),startLineNumber:c,endLineNumber:c,message:ye(pe.onlyInLoop,{text:h})})}return{ruleType:le.FlowStmt,value:h}});w(this,"visitBlock",n=>{const{children:r}=n;if(r&&r.length){const a=r[0];return a.ruleIndex===M.RULE_simpleStmt?this._inBlock(a):this.visit(a)}return null});w(this,"visitBlockLine",n=>{const{children:r}=n;if(!r)return null;let a=0;const c=[];this._blockCount++,this._pushBlockRanges(n);const h=this._isEndExpr;for(;a<r.length;a++){const d=r[a];d.ruleIndex===M.RULE_stmt&&(this._isInFunc&&(this._isEndExpr=r.length-2===a&&h),c.push(this.visit(d)))}return this._blockCount--,this._blockRanges.pop(),this._currentBlockVars.splice(this._blockCount+1),c});w(this,"visitDeclareAssign",n=>{var h;const{children:r}=n;let a=0;const c={ruleType:le.DeclareAssign};for(;a<r.length;a++){const d=r[a];switch(d.ruleIndex){case M.RULE_varArrayDeclaration:c.nameList=this.visit(d),this._inputVarName=(h=c.nameList)==null?void 0:h.name;break;case M.RULE_singleExpression:c.value=this.visit(d),this._inputVarName=void 0;break}}return this._variablesHandle(c,n),c});w(this,"visitAgainAssign",n=>{const{children:r,start:a}=n;if(this._currentLine=a.line,r.length>=3){const c=this.visit(r[0]);this._verifyGloablVar(c,r[0]);const h=this.visit(r[2]),d=this.visit(r[1]);return c.type?this._againAssignHandle([c,h],[r[0],r[2]],d):null}return null});w(this,"visitVarModifier",n=>{const{children:r}=n;return r[0].symbol.text});w(this,"visitExpressionSequence",n=>{const{children:r,start:a}=n;let c=0;const h=[];for(this._currentLine=a.line;c<r.length;c++){const d=r[c];if(d.ruleIndex===M.RULE_singleExpression){const v=this.visit(d);v&&(v.ctx=d,h.push(v))}}return h});w(this,"visitExpressionBlockSequence",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_singleExpression:c.push(this.visit(h));break;case M.RULE_variableDeclarationList:c.push(this.visit(h));break;case M.RULE_blockExpression:c.push(this.visit(h));break;case M.RULE_varBlockStmt:c.push(this.visit(h));break}}return c});w(this,"visitBlockSequence",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_variableDeclarationList:c.push(this.visit(h));break;case M.RULE_singleExpression:c.push(this.visit(h));break}}return c});w(this,"visitVariableDeclarationStmt",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_variableDeclarationList:c.push(this.visit(h));break;case M.RULE_methodStmt:const d=this.visit(h);fu.includes(d.exprs[0].name)&&(this._onlyStatementsCount++,this._onlyStatementsCount>1?this._errorHandle(ye(pe.onlyStatementErr,{count:this._onlyStatementsCount}),h):this._scriptType=d.exprs[0].name),c.push(d);break}}return c});w(this,"visitVarBlockStmt",n=>{const{children:r}=n;let a=0;const c={ruleType:le.VarBlockStmt,ctx:n},h=[];for(;a<r.length;a++){const d=r[a];switch(d.ruleIndex){case M.RULE_varArrayDeclaration:c.nameList=this.visit(d);break;case M.RULE_assignmentOperator:c.operator=this.visit(d);break;case M.RULE_name:h.push(d),c.name=this.visit(d);break;case M.RULE_blockExpression:if(this._isNeedCalc=!0,c.value=this.visit(d),!c.value)break;h.push(d);const v=this._getBlockReturnTypes(c.value);v.length===1?c.value.type=v[0]:c.value.types=v,this._isNeedCalc=!1;break}}return c.name?this._againAssignHandle([c.name,c.value],h,c.operator):(this._variablesHandle(c,n),c)});w(this,"visitVarSingle",n=>{const{children:r,start:a}=n,c={ruleType:le.VarSingle};let h=0;const d=this._commentsParser(a.line,[Kt.variable]);c.desc=d==null?void 0:d[Kt.variable],this._currentLine=a.line;let v={lineNumber:0,column:0};for(;h<r.length;h++){const S=r[h];switch(S.ruleIndex){case M.RULE_varModifier:c.declare=this.visit(S);break;case M.RULE_typeGather:const C=this.visit(S);c.prefix=this._getPrefix(C),c.type=C&&this._typeAddConst(C);break;case M.RULE_identifier:const T=this.visit(S);v={lineNumber:S.start.line,column:S.start.column},this._repeatVarJudge(T,S,v),c.name=T,c.pos=v;break}}return c});w(this,"_commentsParser",(n,r,a=!1)=>{var S;const c=this._comments.filter(C=>C.line<n&&C.line>=this._currentLine),h={},d={line:0,key:"",secKey:""},v=[Kt.field,Kt.param];for(const C of c){const[T,D]=H_.exec(C.text)||[];if(D&&r.includes(D)){const L=C.text.replace(T,"").trim();if(Object.assign(d,{line:C.line,key:D}),v.includes(D)){const[P,...b]=L.split(" ");P&&(Object.assign(d,{secKey:P}),h[D]=Object.assign(h[D]||{},{[P]:b.join(" ").trim()}))}else h[D]=[L]}else if(a&&d.key){const L=C.text.replace("//","").trim();v.includes(d.key)?h[d.key][d.secKey]+=` ${L}`:(S=h[d.key])==null||S.push(L)}}return h});w(this,"visitVarMultiple",n=>{const{children:r,start:a}=n;let c=0;const h=[],d=[];for(this._currentLine=a.line;c<r.length;c++){const v=r[c];if(v.ruleIndex===M.RULE_identifier){const S=this.visit(v),C={lineNumber:v.start.line,column:v.start.column};this._repeatVarJudge(S,v,C,h),h.push(S),d.push(C)}}return{ruleType:le.VarMultiple,names:h,posList:d}});w(this,"visitBlockExpression",n=>{const{children:r,start:a}=n;if(this._currentLine=a.line,r&&r.length){const c=r[0];return this.visit(c)}return null});w(this,"visitParenthesizedExpression",n=>{const{children:r}=n,a=r[1],c=this.visit(a);return{ruleType:le.ParenthesizedExpression,type:c.type,ctx:n,exprs:c}});w(this,"visitAdditiveExpression",n=>{const{children:r}=n;let a=0,c="";const h=[];for(;a<r.length;a++){const v=r[a];v.ruleIndex===M.RULE_singleExpression?h.push(this.visit(v)):c=v.symbol.text}const d={ruleType:le.AdditiveExpression,operator:c,ctx:n,exprs:h};if(["+","-"].includes(c)){const v=[V.UNDETERMINED,V.INT,V.FLOAT];c==="+"&&v.push(V.STRING);const S=this._sameTypeJudge(h,[r[0],r[2]],c,v);d.type=this._typeHandle(S)}else{const v=this._calcTypeJudge(h[0],r[0],c),S=this._calcTypeJudge(h[1],r[2],c,1);d.type=this._typeHandle([v,S])}return d});w(this,"visitRelationalExpression",n=>{const{children:r}=n;let a=0,c="";const h=[];for(;a<r.length;a++){const S=r[a];S.ruleIndex===M.RULE_singleExpression?h.push(this.visit(S)):c=S.symbol.text}const d=this._calcTypeJudge(h[0],r[0],c),v=this._calcTypeJudge(h[1],r[2],c,1);return{ruleType:le.RelationalExpression,operator:c,ctx:n,type:this._typeHandle([d,v],V.BOOL),exprs:h}});w(this,"visitEqualityExpression",n=>{const{children:r}=n;let a=0,c="";const h=[];for(;a<r.length;a++){const v=r[a];v.ruleIndex===M.RULE_singleExpression?h.push(this.visit(v)):c=v.symbol.text}const d=this._sameTypeJudge(h,[r[0],r[2]],c,[]);return{ruleType:le.EqualityExpression,operator:c,ctx:n,type:this._typeHandle(d,V.BOOL),exprs:h}});w(this,"visitTernaryExpression",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const d=r[a];d.ruleIndex===M.RULE_singleExpression&&c.push(this.visit(d))}let h=V.UNDETERMINED;if(c.length>=3){this._boolTypeJudge(c[0],r[0],"?:");const d=this._sameTypeJudge(c.slice(1),[r[2],r[4]],"?:",[]),v=this._getPrefix(c[0].type);h=this._typeHandle(d),v&&this._getPrefix(h)&&(h=this._typeHandle([h,`${v} ${this._removePrefix(h)}`]))}return{ruleType:le.TernaryExpression,type:h,ctx:n,exprs:c}});w(this,"visitNameExpression",n=>{const{children:r}=n;if(r&&r.length){const a=r[0];return this.visit(a)}return null});w(this,"visitLiteralExpression",n=>{const{children:r}=n;if(r&&r.length){const a=r[0];return this.visit(a)}return null});w(this,"visitUnaryExpression",n=>{var S;const{children:r}=n,[a,c]=r,h=[this.visit(c)],d=a.symbol.text,v=this._calcTypeJudge(h[0],c,d);return((S=h[0])==null?void 0:S.ruleType)===le.UnaryExpression&&this._errors.push({message:ye(pe.unaryErr,{sign:d}),startColumn:a.symbol.column+1,startLineNumber:a.symbol.line,endColumn:a.symbol.column+2,endLineNumber:a.symbol.line}),{ruleType:le.UnaryExpression,operator:d,type:v,ctx:n,exprs:h}});w(this,"visitNotExpression",n=>{const{children:r}=n,a=r[1],c=[this.visit(a)],h=this._boolTypeJudge(c[0],a,"not");return{ruleType:le.NotExpression,ctx:n,type:this._typeHandle([h],V.BOOL),exprs:c}});w(this,"visitMemberIndexExpression",n=>{var h,d;const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const v=r[a];v.ruleIndex===M.RULE_singleExpression&&c.push(this.visit(v))}if(this._memberIndexVerify(c[0],n),this._hasMemberIndex=!0,((h=c[0])==null?void 0:h.ruleType)===le.MemberIndexExpression){const v=r[1];this._errors.push({message:ye(pe.unaryErr,{sign:"["}),startColumn:v.symbol.column+1,startLineNumber:v.symbol.line,endColumn:v.symbol.column+2,endLineNumber:v.symbol.line}),this._hasMemberIndex=!1}return{ruleType:le.MemberIndexExpression,type:(d=c[0])==null?void 0:d.type,ctx:n,isInFunc:this._isInFunc,exprs:c}});w(this,"visitMethodStmt",n=>{var C;const{children:r,start:a}=n;let c=0;const h=[],d=[],v=this._commentsParser(a.line,[Kt.description],!0);this._currentLine=a.line;let S;for(;c<r.length;c++){const T=r[c];T.ruleIndex===M.RULE_methodElement&&(h.push(this.visit(T)),d.push(T))}return((C=h[0])==null?void 0:C.name)===Ii.library&&v.description&&(this._description=v.description.join(`
|
12
12
|
`)),S=this._getMethodTypes(h,d)||[],this._inputFuncTitleVerify(h,n),{ruleType:le.MethodExpression,types:S.length>1||S.isBrackethesized||S.isUnknown?S:void 0,ctx:n,type:S.length===1?S[0]:void 0,exprs:h}});w(this,"visitMethodExpression",n=>{const{children:r}=n;if(r&&r.length){const a=r[0];return this.visit(a)}return null});w(this,"visitLogicalAndExpression",n=>{const{children:r}=n;let a=0,c="";const h=[];for(;a<r.length;a++){const S=r[a];S.ruleIndex===M.RULE_singleExpression?h.push(this.visit(S)):c=S.symbol.text}const d=this._boolTypeJudge(h[0],r[0],c),v=this._boolTypeJudge(h[1],r[2],c,1);return{ruleType:le.LogicalAndExpression,type:this._typeHandle([d,v],V.BOOL),operator:c,ctx:n,exprs:h}});w(this,"visitLogicalOrExpression",n=>{const{children:r}=n;let a=0,c="";const h=[];for(;a<r.length;a++){const S=r[a];S.ruleIndex===M.RULE_singleExpression?h.push(this.visit(S)):c=S.symbol.text}const d=this._boolTypeJudge(h[0],r[0],c),v=this._boolTypeJudge(h[1],r[2],c,1);return{ruleType:le.LogicalOrExpression,operator:c,ctx:n,type:this._typeHandle([d,v],V.BOOL),exprs:h}});w(this,"visitMultiplicativeExpression",n=>{const{children:r}=n;let a=0,c="";const h=[];for(;a<r.length;a++){const S=r[a];S.ruleIndex===M.RULE_singleExpression?h.push(this.visit(S)):c=S.symbol.text}const d=this._calcTypeJudge(h[0],r[0],c),v=this._calcTypeJudge(h[1],r[2],c,1);return{ruleType:le.MultiplicativeExpression,operator:c,ctx:n,type:this._typeHandle([d,v]),exprs:h}});w(this,"visitBrackethesized",n=>{const{children:r,start:a}=n,c=r[1];return this._currentLine=a.line,{ruleType:le.Brackethesized,ctx:n,exprs:this.visit(c)}});w(this,"visitArguments",n=>{const{children:r}=n;let a=0;const c={params:[]};let h="";for(;a<r.length;a++){const d=r[a];if(d.ruleIndex===M.RULE_argument){const v=this.visit(d),S=v.paramKey;S?(h=S,c[S]?this._errorHandle(ye(ar.moreSameArg,{arg:S}),n.parentCtx,Sn.Warning):(c[S]=v.param,c[S].ctx=d)):h?this._errorHandle(ye(pe.argsSyntaxErr,{argName:h}),d):(v.ctx=d,c.params.push(v))}}return c});w(this,"visitArgument",n=>{const{children:r}=n;return r.length===1?this.visit(r[0]):{paramKey:this.visit(r[0]),param:this.visit(r[2])}});w(this,"visitIfStatement",n=>{const{children:r}=n;let a=0;const c={ruleType:le.IfStatement,condition:[],block:[],ctx:n,typeList:[]};for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_singleExpression:const d=this.visit(h);if(!d)break;d.ctx=h,c.condition.push(d);break;case M.RULE_blockLine:const v=this._isInLocalScop;this._isInLocalScop=!0;const S=this.visit(h);c.typeList.push(this._getBlockReturnTypes(S)),c.block.push(S),this._isInLocalScop=v;break}}return this._verifyIf(c),c});w(this,"visitForToStatement",n=>{const{children:r}=n;let a=0;const c={ruleType:le.ForToStatement,numerical:[],ctx:n,block:[]};for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_varModifier:c.declare=this.visit(h);break;case M.RULE_typeGather:const d=this.visit(h);c.type=d&&this._typeAddSeries(d);break;case M.RULE_identifier:c.name=this.visit(h);break;case M.RULE_singleExpression:this._blockCount++,this._forToNameHandle(c,n);const v=this.visit(h);v&&(v.ctx=h,c.numerical.push(v)),this._blockCount--;break;case M.RULE_blockLine:this._loopCount++;const S=this._isInLocalScop;this._isInLocalScop=!0,c.block=this.visit(h),this._loopCount--,this._isInLocalScop=S,c.returnedTypes=this._getBlockReturnTypes(c.block);break}}return this._verifyForTo(c),c});w(this,"visitForInStatement",n=>{const{children:r}=n;let a=0;const c={ruleType:le.ForInStatement,ctx:n,names:[]};for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_identifier:const d=this.visit(h);c.names.push(d);break;case M.RULE_singleExpression:this._blockCount++,c.array=this.visit(h);const v=c.array.type;this._forInNameHandle(c,n),this._isArrayType(v)||this._isMatrixType(v)||v===V.UNDETERMINED||this._errorHandle(ye(pe.typeMismatch,{operator:"foreach",index:"id",typeE:v,typeR:"array<fun_arg>"}),h),this._blockCount--;break;case M.RULE_blockLine:this._loopCount++;const S=this._isInLocalScop;this._isInLocalScop=!0,c.block=this.visit(h),this._isInLocalScop=S,this._loopCount--,c.returnedTypes=this._getBlockReturnTypes(c.block);break}}return c});w(this,"visitSwitchStatement",n=>{const{children:r}=n;let a=0;const c={ruleType:le.SwitchStatement,condition:!0,ctx:n,cases:[],defaultCase:void 0};for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_singleExpression:if(c.condition=this.visit(h),!h.children)break;c.condition.ctx=h;break;case M.RULE_caseClause:c.cases.push(this.visit(h));break;case M.RULE_defaultCaluse:c.defaultCase=this.visit(h);break}}return this._verifySwitch(c),c});w(this,"visitCaseClause",n=>{const{children:r}=n,a={ruleType:le.CaseClause},c=this._isInLocalScop;return this._isInLocalScop=!0,a.condition=this.visit(r[0]),a.condition&&(a.condition.ctx=r[0],a.block=this.visit(r[2]),this._isInLocalScop=c,a.returnedTypes=this._getBlockReturnTypes(a.block)),a});w(this,"visitDefaultCaluse",n=>{const{children:r}=n,a={ruleType:le.DefaultCaluse},c=this._isInLocalScop;return this._isInLocalScop=!0,a.block=this.visit(r[1]),this._isInLocalScop=c,a.returnedTypes=this._getBlockReturnTypes(a.block),a});w(this,"visitWhileStatement",n=>{const{children:r}=n,a={ruleType:le.WhileStatement,ctx:n};if(a.condition=this.visit(r[1]),!a.condition)return a;a.condition.ctx=r[1],this._loopCount++;const c=this._isInLocalScop;return this._isInLocalScop=!0,a.block=this.visit(r[2]),this._isInLocalScop=c,this._loopCount--,a.returnedTypes=this._getBlockReturnTypes(a.block),this._verifyWhile(a),a});w(this,"visitImportStmt",async n=>{const{children:r,start:a}=n;let c=0;const h=[];for(this._currentLine=a.line;c<r.length;c++){const d=r[c];if(d.ruleIndex===M.RULE_importElement){const v=await this.visit(d);v&&h.push(v)}}return h});w(this,"visitImportElement",async n=>{const{children:r}=n;if(!r||!r.length)return;let a=0;const c=[],h={ruleType:le.ImportElement,ctx:n};for(;a<r.length;a++){const d=r[a];d.ruleIndex===M.RULE_identifier?c.push(this.visit(d)):d.symbol&&d.symbol.type===M.IntegerLiteral&&(h.libraryVersion=d.symbol.text)}return h.username=c[0],h.libraryName=c[1],h.name=c[2],await this._importHandle(h,n),h});w(this,"visitLiteral",n=>{const{children:r}=n,a=r[0],{type:c,text:h}=a.symbol,d={ruleType:le.Literal,ctx:n,type:"",value:h};switch(c){case M.ColorLiteral:d.type=V.COLOR;break;case M.BooleanLiteral:d.type=V.BOOL;break;case M.StringLiteral:if(d.type=V.STRING,h.includes(`
|
13
|
-
`)){const v=h.replace(/\s*(\n|\r)\s*/g," ");d.value=`\`${v.substring(1,v.length-1)}\``}break;case M.IntegerLiteral:d.type=V.INT;break;case M.DecimalLiteral:d.type=V.FLOAT;break}return d.type&&(d.type=`${V.CONST} ${d.type}`),d});w(this,"visitMethodElement",n=>{const{children:r}=n,[a,c]=r,[h,d,v]=this.visit(a),S=this.visit(c);return h.startsWith("request.")&&this._isInFunc&&(this._currentExportFunc&&this._errorHandle(ye(pe.exportFuncUseReqErr,{name:h}),n),this._hasRequest=!0),{name:h,type:d,args:S,expr:v}});w(this,"visitMethodName",n=>{const{children:r}=n,a=[],c=[];let h=0,d=null;for(;h<r.length;h++){const S=r[h],C=S.ruleIndex,T=S.symbol;switch(C){case M.RULE_identifier:a.push(this.visit(S));break;case M.RULE_singleExpression:d=this.visit(S);break;case M.RULE_typeName:const D=this.visit(S);c.push(D),this._typeCheck(D,M.RULE_typeName,S);break;default:T&&T.text==="."&&a.push(".")}}const v=a.join("");return V_.includes(v)?this._hasDrawFunc=!0:j_.includes(v)&&(this._hasCreateOrderFunc=!0),[v,c,d]});w(this,"visitArrowFunction",n=>{const{children:r,start:a,stop:c}=n,h={ruleType:le.ArrowFunction,returnedTypes:[]};let d=0,v={lineNumber:0,column:0};const S=this._commentsParser(a.line,[Kt.function,Kt.param,Kt.returns],!0);Object.assign(h,{desc:S[Kt.function],paramsDesc:S[Kt.param],returnsDesc:S[Kt.returns]}),this._currentLine=a.line;let C=null;for(;d<r.length;d++){const T=r[d],D=T.ruleIndex,L=T.symbol;switch(D){case M.RULE_identifier:v={lineNumber:T.start.line,column:T.start.column},h.name=this.visit(T);break;case M.RULE_arrowFunctionParameters:h.params=this.visit(T),h.isExport&&this._exportArgsTypeVerify(h.params),this._setFuncParams(h,{endColumn:c.column,endLineNumber:c.line-1,startColumn:a.column,startLineNumber:a.line}),C=T;break;case M.RULE_block:this._isInFunc=!0,h.isExport&&(this._currentExportFunc=h.name),this._hasMemberIndex=!1,this._hasRequest=!1,h.block=this.visit(T),h.hasMemberIndex=this._hasMemberIndex,h.returnedTypes=this._getBlockReturnTypes(h.block),this._isInFunc=!1,this._currentExportFunc="";break;default:L&&L.type===M.Export&&(h.isExport=!0,this._addExportPos(L,"functions"))}}return h.hasRequest=this._hasRequest,this._setFunc(h,v,C,c.line-1),this._hasRequest=!1,this._currentFuncParams.clear(),h});w(this,"visitArrowFunctionParameters",n=>{const{children:r}=n;let a=0,c=[];for(;a<r.length;a++){const h=r[a];h.ruleIndex===M.RULE_formalParameterList&&(c=this.visit(h))}return c});w(this,"visitFormalParameterList",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const h=r[a];h.ruleIndex===M.RULE_formalParameterArg&&c.push(this.visit(h))}return c});w(this,"visitFormalParameterArg",n=>{const{children:r}=n;let a=0;const c={};for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_typeGather:const d=this.visit(h);c.type=d&&this._typeAddSeries(d);break;case M.RULE_identifier:c.name=this.visit(h);break;case M.RULE_singleExpression:c.defaultValue=this.visit(h),delete c.defaultValue.ctx}}return c.ctx=n,this._verifyArgsDefaultValue(c,n),c.type=c.type||V.UNDETERMINED,c});w(this,"visitArrowMethod",n=>{const{children:r,start:a,stop:c}=n;let h=0;const d={ruleType:le.ArrowMethod,returnedTypes:[]};let v={lineNumber:0,column:0};const S=this._commentsParser(a.line,[Kt.function,Kt.param,Kt.returns],!0);Object.assign(d,{desc:S[Kt.function],paramsDesc:S[Kt.param],returnsDesc:S[Kt.returns]}),this._currentLine=a.line;let C=null;for(;h<r.length;h++){const T=r[h];switch(T.ruleIndex){case M.RULE_identifier:v={lineNumber:T.start.line,column:T.start.column},d.name=this.visit(T);break;case M.RULE_arrowMethodParameters:d.params=this.visit(T),d.isExport&&this._exportArgsTypeVerify(d.params),this._setFuncParams(d,{endColumn:c.column,endLineNumber:c.line-1,startColumn:a.column,startLineNumber:a.line}),C=T;break;case M.RULE_block:this._isInFunc=!0,d.isExport&&(this._currentExportFunc=d.name),this._hasMemberIndex=!1,this._hasRequest=!1,d.block=this.visit(T),d.hasMemberIndex=this._hasMemberIndex,d.returnedTypes=this._getBlockReturnTypes(d.block),this._isInFunc=!1,this._currentExportFunc="";break;default:T.symbol&&T.symbol.type===M.Export&&(d.isExport=!0,this._addExportPos(T.symbol,"methods"));break}}return d.hasRequest=this._hasRequest,this._setFunc(d,v,C,c.line-1),this._setMethod(d,v),this._hasRequest=!1,this._currentFuncParams.clear(),d});w(this,"visitArrowMethodParameters",n=>{const{children:r}=n;if(!r)return;let a=0;const c={};let h=[];for(;a<r.length;a++){const d=r[a];switch(d.ruleIndex){case M.RULE_typeGather:const v=this.visit(d);c.type=v&&this._typeAddSeries(v);break;case M.RULE_identifier:c.ctx=d,c.name=this.visit(d);break;case M.RULE_formalParameterList:h=this.visit(d);break}}return[c,...h]});w(this,"visitTypeStatement",n=>{const{children:r,start:a,stop:c}=n;let h=0;const d={ruleType:le.TypeStatement,fields:[]},v=this._commentsParser(a.line,[Kt.type,Kt.field]);Object.assign(d,{desc:v[Kt.type],fieldsDesc:v[Kt.field]}),this._currentLine=a.line;let S={lineNumber:0,column:0},C=null;for(;h<r.length;h++){const T=r[h];switch(T.ruleIndex){case M.RULE_identifier:S={lineNumber:T.start.line,column:T.start.column},C=T,d.name=this.visit(T),this._verifyTypeName(d.name,T);break;case M.RULE_typeElement:d.fields.push(this.visit(T));break;default:T.symbol&&T.symbol.type===M.Export&&(d.isExport=!0,this._addExportPos(T.symbol,"types"));break}}if(d.isExport){const T=c.line-1,{line:D=0}=this._endExport;T>D&&(this._endExport={line:T,name:d.name})}return this._setUserType(d,S,C),this._setNewFunc(d,S),this._setCopyFunc(d,S),this._setCopyMethod(d,S),d});w(this,"visitTypeElement",n=>{const{children:r,start:a}=n;let c=0;const h={};let d=null,v=null;for(this._currentLine=a.line;c<r.length;c++){const S=r[c];switch(S.ruleIndex){case M.RULE_typeGather:const C=this.visit(S);if(S.children[0].ruleIndex===M.RULE_typeSeries){const{column:T,line:D,text:L}=S.start,P=T+1;this._errors.push({startColumn:P,endColumn:parseInt(P+L.length),startLineNumber:D,endLineNumber:D,message:ye(this._buildinTypes.has(L)?pe.typeUseError:pe.notTypeKeyword,{text:L})}),h.type=V.UNDETERMINED}else h.type=C&&this._typeAddSeries(C);break;case M.RULE_identifier:h.name=this.visit(S),v=S;break;case M.RULE_singleExpression:d=S,h.value=this.visit(S);break;default:S.symbol&&S.symbol.type===M.Varip&&(h.isVarip=!0);break}}return this._typeElementVerify(h,d,v),h});w(this,"visitAssignmentOperator",n=>{const{children:r}=n;return r&&r[0].symbol.text});w(this,"visitTypeMap",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const h=r[a];if(h.ruleIndex===M.RULE_typeName){const d=this.visit(h);c.push(d),this._typeCheck(d,M.RULE_typeName,h)}}return`map<${c[0]},${c[1]}>`});w(this,"visitTypeSeries",n=>{const{children:r}=n,[a,c]=r,h=this.visit(a),d=this.visit(c);return this._typeCheck(h,M.RULE_typeSeries,a),this._typeCheck(d,M.RULE_typeName,c),`${h} ${d}`});w(this,"visitTypeArray",n=>{const{children:r}=n,a=r[0];let c=this.visit(a),h=c;if(r.length===3)c=V.ARRAY;else{this._typeCheck(c,M.RULE_typeArray,a);let d=1;for(;d<r.length;d++){const v=r[d];v.ruleIndex===M.RULE_typeName&&(h=this.visit(v),this._typeCheck(h,M.RULE_typeName,v))}}return this._arrayTypeConvert(`${c}<${h}>`)});w(this,"visitTypeGather",n=>{const{children:r}=n;if(r&&r.length){const a=r[0],c=this.visit(a);return a.ruleIndex===M.RULE_typeName&&this._typeCheck(c,M.RULE_typeName,a),c}return null});w(this,"visitIdentifier",n=>n.children&&n.children[0].symbol.text);w(this,"visitTypeName",n=>{const{children:r}=n;let a=0,c="";for(;a<r.length;a++){const h=r[a];h.ruleIndex===M.RULE_identifier?c=`${c}${this.visit(h)}`:c=`${c}.`}return c});w(this,"visitEnumStatement",n=>{const{children:r,start:a,stop:c}=n;let h=0;const d={ruleType:le.EnumStatement,fields:[]},v=this._commentsParser(a.line,[Kt.enum,Kt.field]);Object.assign(d,{desc:v[Kt.enum],fieldsDesc:v[Kt.field]}),this._currentLine=a.line;let S={lineNumber:0,column:0},C=null;for(;h<r.length;h++){const T=r[h];switch(T.ruleIndex){case M.RULE_identifier:S={lineNumber:T.start.line,column:T.start.column},C=T,d.name=this.visit(T),this._verifyEnumName(d.name,T);break;case M.RULE_enumElement:d.fields.push(this.visit(T));break;default:T.symbol&&T.symbol.type===M.Export&&(d.isExport=!0,this._addExportPos(T.symbol,"enums"));break}}if(d.isExport){const T=c.line-1,{line:D=0}=this._endExport;T>D&&(this._endExport={line:T,name:d.name})}return this._setUserEnum(d,S,C),d});w(this,"visitEnumElement",n=>{const{children:r,start:a}=n;let c=0;const h={};for(this._currentLine=a.line;c<r.length;c++){const d=r[c];switch(d.ruleIndex){case M.RULE_identifier:h.name=this.visit(d);break;default:d.symbol&&d.symbol.type===M.StringLiteral&&(h.value=d.symbol.text);break}}return h});w(this,"visitName",n=>{const{children:r}=n;let a=0,c=!1;const h=[];let d=null;for(;a<r.length;a++){const v=r[a];switch(v.ruleIndex){case M.RULE_identifier:h.push(this.visit(v));break;case M.RULE_singleExpression:d=this.visit(v);break;case M.RULE_methodElement:c=!0;const S=this.visit(v);S.ctx=v,h.push(S);break}}return this._nameHandle(c,h,d,n)});this._loopCount=0,this._errors=[],this._variables=new Map,this._functions=new Map,this._methods=new Map,this._currentFuncParams=new Map,this._types=new Map,this._enums=new Map,this._currentBlockVars=[new Map],this._blockCount=0,this._isInFunc=!1,this._isNeedCalc=!1,this._blockRanges=[],this._overloadsFuncs=[],this._hasMemberIndex=!1,this._isInLocalScop=!1,this._onlyStatementsCount=0,this._comments=r,this._exportFunctions=[],this._exportMethods=[],this._exportTypes=[],this._exportEnums=[],this._exportPositions=[],this._endExport={},this._importLibs=new Map,this._getImportLibraryFunc=a}get overloadsFuncs(){return this._overloadsFuncs}get errors(){return this._errors}get userEnums(){return this._enums}get userTypes(){return this._types}get userFunctions(){return this._functions}get userVariables(){return this._variables}get userMethods(){return this._methods}get hasUseDrawFunc(){return this._hasDrawFunc}get hasUseCreateOrderFunc(){return this._hasCreateOrderFunc}get scriptType(){return this._scriptType}get exportLibs(){return{functions:[...this._exportFunctions],methods:[...this._exportMethods],types:[...this._exportTypes],enums:[...this._exportEnums]}}get description(){return this._description}get exportPositions(){return this._exportPositions}get endExport(){return this._endExport}get imports(){return this._importLibs}_verifyGloablVar(n,r){const{name:a,varPos:c,isBuiltIn:h}=n;if(h&&this._errorHandle(ye(pe.buidinAssignErr,{name:a}),r),!c)return;const d=this._currentBlockVars[0].get(a);if(!d)return;const{column:v,lineNumber:S}=d.pos||{};this._isInFunc&&v===c.column&&S===c.lineNumber?this._errorHandle(ye(pe.modifyGlobalVarErr,{name:a}),r):d.hasAssigned=!0}_inputFuncTitleVerify(n,r){if(!(n!=null&&n.length)||n.length>1)return;const{name:a,args:c,isBuiltIn:h}=n[0];if(h&&!this._strategyFuncName&&a.startsWith(Ii.strategy))this._strategyFuncName={ctx:r,name:a};else if(!a.startsWith(V.INPUT))return;this._inputVarName&&!(c.params.some(d=>d.originName==="title")||c.title)&&(c.title={value:`"${this._inputVarName}"`,ruleType:le.Literal,type:`${V.CONST} ${V.STRING}`})}_verifyIf(n){const{condition:r}=n;if(r!=null&&r.length)for(const a of r){const{type:c,ctx:h}=a;if(c===V.UNDETERMINED)continue;const d=this._removePrefix(c);[V.INT,V.FLOAT].includes(d)?this._errorHandle(ye(ar.conditionWarning,{name:"if"}),h,Sn.Warning):d!==V.BOOL&&this._errorHandle(ye(pe.conditionalErr,{name:"if"}),h)}}_forToNameHandle(n,r){if(n.name&&n.numerical.length===1){this._pushBlockRanges(r);const a=n.numerical[0].type;this._variablesHandle({nameList:{name:n.name,isForVar:!0,type:n.type},value:{type:a||`${V.SERIES} ${V.INT}`}},r),this._blockRanges.pop()}}_verifyForTo(n){const{numerical:r}=n;if(r!=null&&r.length)for(const a of r){const{type:c,ctx:h}=a;if(c===V.UNDETERMINED)continue;const d=this._removePrefix(c);[V.INT,V.FLOAT].includes(d)||this._errorHandle(pe.fortoErr,h)}}_forInNameHandle(n,r){if(this._pushBlockRanges(r),n.names.length){let[a,c]=n.names;const h=n.array.type;c?this._variablesHandle({nameList:{name:a,isForVar:!0,type:`${V.SERIES} ${V.INT}`},value:{type:`${V.SERIES} ${V.INT}`}},r):c=a;const d=h===V.UNDETERMINED?h:this._isMatrixType(h)?`${this._getArrayType(h)}[]`:this._typeAddSeries(this._getArrayType(h));this._variablesHandle({nameList:{name:c,isForVar:!0,type:d},value:{type:d}},r)}this._blockRanges.pop()}_verifySwitch(n){var r;if(n.cases){const a=(r=n.condition)==null?void 0:r.type;if(a===V.UNDETERMINED)return;if(a&&this._types.has(a)){this._errorHandle(ye(pe.typeMismatch,{operator:"switch",index:"expr0",typeE:a,typeR:`${V.SIMPLE} ${V.STRING}`}),n.condition.ctx);return}for(const c of n.cases){const{condition:{type:h,ctx:d}}=c;if(h!==V.UNDETERMINED)if(this._types.has(h))this._errorHandle(ye(pe.typeMismatch,{operator:"case",index:"expr1",typeE:h,typeR:`${V.SIMPLE} ${V.STRING}`}),d);else if(a){if(!this._compareType(a,h)){const v=this._removePrefix(a),S=this._removePrefix(h);v===V.BOOL&&[V.INT,V.FLOAT].includes(S)?this._errorHandle(ye(ar.conditionWarning,{name:"switch"}),d,Sn.Warning):[V.INT,V.FLOAT].includes(v)&&S===V.BOOL?this._errorHandle(ye(ar.conditionWarning,{name:"switch"}),n.condition.ctx,Sn.Warning):this._errorHandle(ye(pe.typeMismatch,{operator:"case",index:"expr1",typeE:h,typeR:`${a}`}),d)}}else{const v=this._removePrefix(h);[V.INT,V.FLOAT].includes(v)?this._errorHandle(ye(ar.conditionWarning,{name:"switch"}),d,Sn.Warning):v!==V.BOOL&&this._errorHandle(ye(pe.conditionalErr,{name:"switch"}),d)}}}}_verifyWhile(n){const{condition:r}=n;if(r){const{type:a,ctx:c}=r;if(a===V.UNDETERMINED)return;const h=this._removePrefix(a);[V.INT,V.FLOAT].includes(h)?this._errorHandle(ye(ar.conditionWarning,{name:"while"}),c,Sn.Warning):h!==V.BOOL&&this._errorHandle(ye(pe.conditionalErr,{name:"while"}),c)}}async _importHandle(n,r){const{stop:a,start:c}=r,{username:h,libraryName:d,libraryVersion:v,name:S}=n,C=`${h}/${d}/${v}`;if(this._importLibs.has(C))return this._errorHandle(pe.importMultipleErr,r),n;for(const[L,P]of this._importLibs)if(P.name&&P.name===S||!P.name&&!S&&P.libraryName===d)return this._errorHandle(ye(pe.importNameRepeatErr,{name:S,line:P.startLine}),r),n;let T=S||d;const D=await this._getImportLibraryFunc({...n,libraryId:C,ctx:void 0,startLine:c.line,endLine:a.line,startColumn:c.column,endColumn:a.column+a.text.length+1});if(D){const{codeStr:L,description:P}=D;this._importLibs.set(C,{...n,libraryId:C,startLine:c.line,endLine:a.line,ctx:void 0,desc:P}),this._importDataHandle(D,T),wn.includes(T)&&(T=`$${T}`),n.code=L.replace("$name",T)}else this._errorHandle(ye(pe.importNotExitErr,{username:h,libraryName:d}),r)}_importDataHandle(n,r){const{functions:a,methods:c,types:h}=n;for(const d of a){const{name:v}=d,S=`${r}.${v}`,C=this._functions.get(S)||[];C.push({...this._importTypeUpdate(d,h,r),name:S,isUser:void 0,isImport:!0}),this._functions.set(S,C)}for(const d of c){const v=this._importTypeUpdate(d,h,r),S=v.originalName||v.name,C=this._methods.get(S)||[];C.push({...v,isImport:!0,isUser:void 0}),this._methods.set(S,C)}for(const d of h){const v=`${r}.${d.name}`,S=this._types.get(v)||[];S.push({...this._importTypeUpdate(d,h,r),name:v,isImport:!0}),this._types.set(v,S)}}_importTypeUpdate(n,r,a){var L;let{args:c,returnedTypes:h,thisType:d,fields:v,name:S,originalName:C}=n,T="";if(c&&c.length&&(c=c.map(P=>{const{allowedTypeIDs:b,displayType:y,name:g}=P,O=y&&this._replaceTypeName(y,r,a);return T=T?`${T}, ${O} ${g}`:`${O} ${g}`,{...P,allowedTypeIDs:b==null?void 0:b.map(R=>this._replaceTypeName(R,r,a)),displayType:O}})),h!=null&&h.length&&(h=[this._replaceTypeName(h[0],r,a)]),d!=null&&d.length){const P=this._replaceTypeName(d[0],r,a);P!==d[0]&&(C=`${a}.${C||S}`),d=[P]}v!=null&&v.length&&(v=v.map(P=>{const{type:b}=P;return{...P,type:b&&this._replaceTypeName(b,r,a)}}));const D={...n,args:c,returnedTypes:h,thisType:d,fields:v,originalName:C};return(L=D.syntax)!=null&&L.length&&(D.syntax=[`${C||`${a}.${S}`}(${T}) → ${(h==null?void 0:h[0])||"void"}`]),D}_replaceTypeName(n,r,a){const c=r.find(h=>n.includes(h.name));return c?n.replace(c.name,`${a}.${c.name}`):n}_verifyArgsDefaultValue(n,r){const{defaultValue:a,type:c}=n;if(!a)return;const{ruleType:h,isBuiltIn:d,type:v}=a,S=this._removePrefix(v);if(h!==le.Literal&&!d)delete n.defaultValue,this._errorHandle(pe.argDefaultErr,r);else if(c&&c!==V.UNDETERMINED&&v!==V.UNDETERMINED){const C=this._removePrefix(c);if(C===V.FLOAT&&S===V.INT)return;S!==C&&this._errorHandle(ye(pe.defaultValueTypeErr,{typeE:v,typeR:c}),r)}else c||(n.type=this._typeAddSeries(S===V.INT?V.FLOAT:S))}_exportArgsTypeVerify(n){for(const r of n)(r.type===V.UNDETERMINED||!r.type)&&this._errorHandle(pe.exportFuncArgErr,r.ctx)}_verifyTypeName(n,r){lu.includes(n)?this._errorHandle(ye(pe.typeNameErr,{name:n}),r):Lp.includes(n)&&this._errorHandle(ye(pe.enumVarNameBuiltinErr,{name:n}),r)}_addExportPos(n,r){const{line:a,column:c,text:h}=n;this._exportPositions.push({startLineNumber:a,startColumn:c,endLineNumber:a,endColumn:c+h.length+1,type:r})}_verifyEnumName(n,r){lu.includes(n)?this._errorHandle(ye(pe.enumVarNameErr,{name:n}),r):Lp.includes(n)&&this._errorHandle(ye(pe.enumVarNameBuiltinErr,{name:n}),r)}_nameHandle(n,r,a,c){var d,v;const h={ruleType:le.Name,hasMethod:n,exprs:r,expr:a};if(n){let S="";const C=[];for(const D of r)typeof D=="string"?S=S?`${S}.${D}`:D:(S&&(D.name=`${S}.${D.name}`),C.push(D),S="");h.exprs=[...C,S];const T=this._getMethodTypes(C,Array.from(C,()=>c));if(T&&T.length){const D=ye(pe.noFiledErr,{name:S});T.length>1&&this._errorHandle(D,c),h.type=((v=this._nameCheck(this._getOriginMethodName(T[0],S),c,D))==null?void 0:v.type)||V.UNDETERMINED}}else{let S=r.join(".");if(a&&a.type&&a.type===V.UNDETERMINED)h.type=V.UNDETERMINED,S=`expr0.${S}`;else{a&&a.type&&(S=`${this._getMethodTypeName(a.type)}.${S}`);const C=this._nameCheck(S,c)||{};(d=C.title)!=null&&d.startsWith("built-in")&&(h.isBuiltIn=!0,h.isConst=C.isConst,!this._strategyVarName&&S.startsWith(Ii.strategy)&&(this._strategyVarName={ctx:c,name:S})),h.enumName=C.enumName,h.varPos=C.pos,h.varScope=C.scope,h.declare=C.declare,h.type=(C==null?void 0:C.type)||V.UNDETERMINED,C!=null&&C.isArg&&(h.arg=C),h.scope=this._blockCount,C.isEnum?this._errorHandle(ye(pe.enumUseErr,{name:S}),c):this._isInFunc&&this._currentExportFunc&&(h.type.startsWith(V.INPUT)?this._errorHandle(ye(pe.exportFuncHasInputErr,{name:S,func:this._currentExportFunc}),c):C.scope===0&&C.hasAssigned&&this._errorHandle(ye(pe.exportFuncUseGlobalVarErr,{func:this._currentExportFunc}),c))}h.name=S}return h}_typeElementVerify(n,r,a){var v,S;const{type:c,value:h}=n;if(!h){c||this._errorHandle(pe.typeFieldErr,a);return}if(![le.Literal,le.UnaryExpression].includes(h.ruleType)&&!h.isBuiltIn){this._errorHandle(pe.defaultValueErr,r);return}else if(h.ruleType===le.UnaryExpression){const{exprs:C}=h;if(![le.Literal,le.UnaryExpression].includes((v=C[0])==null?void 0:v.ruleType)&&!((S=C[0])!=null&&S.isBuiltIn)){this._errorHandle(pe.defaultValueErr,r);return}}if(!c){const C=h.type,T=this._getPrefix(C);n.type=T?this._typeAddSeries(this._removePrefix(C)):C;return}(!this._compareType(c,h.type)||c.endsWith(V.INT)&&h.type.endsWith(V.FLOAT))&&this._errorHandle(ye(pe.defaultValueTypeErr,{typeE:h.type,typeR:c}),r)}_memberIndexVerify(n,r){if(n.ruleType===le.Name&&!n.hasMethod&&this._blockCount){const c=this._currentBlockVars[this._blockCount],h=c&&c.get(n.name);h&&(h.isForVar?this._errorHandle(ye(pe.notHistoryErr,{name:n.name}),r):!(this._blockCount===1&&this._isInFunc)&&this._errorHandle(ye(ar.localScopeGetHistory,{name:n.name}),r,Sn.Warning))}const a=n&&n.type;if(a){const c=this._removePrefix(a);!this._types.has(c)&&!this._buildinTypes.has(c)&&!this._isArrayType(c)&&!this._isMatrixType(c)&&!this._isMapType(c)&&c!==V.UNDETERMINED&&this._errorHandle(ye(pe.invalidType,{index:0}),r)}}_setFuncParams(n,r){var a;for(const c of n.params){const h=(a=this._types.get(c.type))==null?void 0:a[0];if(c.scope=this._blockCount+1,h&&h.fields)for(const d of h.fields){const v=`${c.name}.${d.name}`;this._currentFuncParams.set(v,{...d,originName:v,varScope:c.scope})}delete c.ctx,c.range=r,this._setVariablesMap(c,!0),this._currentFuncParams.set(c.name,c)}}_pushBlockRanges(n){!n||!n.start||!n.stop||this._blockRanges.push({startColumn:n.start.column,endColumn:n.stop.column,startLineNumber:n.start.line,endLineNumber:n.stop.line})}_setUserEnum(n,r,a){const{fields:c,name:h,desc:d,fieldsDesc:v}=n,S={members:c.map(C=>({name:C.name,value:C.value,enumName:h,isEnumMember:!0,desc:v==null?void 0:v[C.name],type:`${V.CONST} ${h}`})),name:h,desc:d,pos:r};if(this._enums.has(h)){this._errorHandle(ye(pe.typeRepeatErr,{name:h,keyword:Kt.enum}),a);return}else if(this._types.has(h)){this._errorHandle(ye(pe.typeRepeatErr,{name:h,keyword:Kt.type}),a);return}n.isExport&&this._exportEnums.push(S),this._enums.set(h,[{...S}]),this._addEnumToMap(h,h,r)}_setUserType(n,r,a){const{fields:c,name:h,desc:d,fieldsDesc:v}=n,S={fields:c.map(C=>({name:C.name,desc:v==null?void 0:v[C.name],type:C.type})),name:h,desc:d,pos:r};if(this._enums.has(h)){this._errorHandle(ye(pe.typeRepeatErr,{name:h,keyword:Kt.enum}),a);return}else if(this._types.has(h)){this._errorHandle(ye(pe.typeRepeatErr,{name:h,keyword:Kt.type}),a);return}n.isExport&&this._exportTypes.push(S),this._types.set(h,[{...S}]),this._addVarToMap(h,h,r,!1,!1)}_againAssignHandle(n,r,a){const c=a!==":="?a.replace("=",""):a,h=a!==":="?[V.UNDETERMINED,V.INT,V.FLOAT]:[];c==="+"&&h.push(V.STRING);const[d,v]=n;d.arg&&!d.name.includes(".")&&this._errorHandle(ye(pe.funcArgAssignErr,{name:d.name}),r[0]);const S=this._sameTypeJudge(n,r,c,h);let C=this._typeHandle(S);return this._updateUserVar(d.name,C,v.type),d.type=C,{ruleType:le.AgainAssign,name:d,operator:a,type:C,value:v}}_typeCheck(n,r,a){const c=[V.SERIES,V.SIMPLE,V.CONST];switch(r){case M.RULE_typeName:const h=this._buildinTypes.get(n);h&&![...c,V.ARRAY,V.MATRIX,V.MAP].includes(h[0].name)||this._types.get(n)||this._errorHandle(ye(pe.notTypeKeyword,{text:n}),a);break;case M.RULE_typeArray:[V.ARRAY,V.MATRIX].includes(n)||this._errorHandle(pe.tempateTypeErr,a);break;case M.RULE_typeSeries:c.includes(n)||this._errorHandle(ye(pe.qualifierErr,{name:n}),a);break}}_getBuildVar(n){const r=this._buildinVariables.get(n);if(r&&r[0])return r[0];const a=this._buildinConstants.get(n);return a&&a[0]?Object.assign(a[0],{isConst:!0}):this._specialTreatmentChartPoint(n)}_specialTreatmentChartPoint(n){var r,a;if(n.startsWith("chart.point")){const c=n.split("."),h=c.pop(),d=c.join(".");return(((a=(r=this._buildinTypes.get(d))==null?void 0:r[0])==null?void 0:a.fields)||[]).find(S=>S.name===h)}}_verifyName(n,r){var c,h;const a=this._getBuildVar(n);if(a)return a;if(n.includes(".")){const d=n.split("."),v=d.pop(),S=d.join(".");let C=this._blockCount;for(;C>=0;){if(!this._currentBlockVars[C]){C--;continue}const D=this._currentBlockVars[C].get(S);if(r&&this._judgeGatherValue(v||"",r,D==null?void 0:D.valueType,!0),(D==null?void 0:D.type)==="chart.point"){const P=(((h=(c=this._buildinTypes.get(D.type))==null?void 0:c[0])==null?void 0:h.fields)||[]).find(b=>b.name===v);if(P)return Object.assign(P,{pos:D.pos})}C--}const T=this._specialTreatmentChartPoint(n);if(T)return T}return this._getUserVar(n)}_judgeGatherValue(n,r,a,c){return a!==`${V.SIMPLE} ${V.NA}`?!0:(c&&this._errorHandle(ye(pe.objectIsNaErr,{name:n,type:"field"}),r),!1)}_nameCheck(n,r,a=ye(pe.undeclared,{name:n})){const c=this._verifyName(n,r);return c||this._errorHandle(a,r),c}_inBlock(n){this._blockCount++,this._pushBlockRanges(n);const r=this.visit(n);return this._blockCount--,this._blockRanges.pop(),this._currentBlockVars.splice(this._blockCount+1),r}_errorHandle(n,r,a=Sn.Error){this._errors.push({message:n,startColumn:r.start.column+1,startLineNumber:r.start.line,endColumn:r.start.column+2+r.stop.stop-r.start.start,endLineNumber:r.stop.line,type:a})}_boolTypeJudge(n,r,a,c=0){return this._typeJudge(n,r,a,V.BOOL,[V.UNDETERMINED,V.INT,V.FLOAT,V.BOOL],c)}_calcTypeJudge(n,r,a,c=0){return this._typeJudge(n,r,a,"int/float",[V.UNDETERMINED,V.INT,V.FLOAT],c)}_typeJudge(n,r,a,c,h,d=0){const v=n&&n.type;if(v){const S=this._removePrefix(v);if(!h.includes(S)&&S!==V.NA)return this._errorHandle(ye(pe.typeMismatch,{operator:`operator ${a}`,index:`expr${d}`,typeE:S,typeR:c}),r),V.UNDETERMINED;c===V.BOOL&&[V.INT,V.FLOAT].includes(S)&&this._errorHandle(ye(ar.typeMismatch,{operator:`operator ${a}`,index:`expr${d}`,type:V.BOOL}),r,Sn.Warning)}return v||V.UNDETERMINED}_sameTypeJudge(n,r,a,c){let h="";const d=[],v=["plot_display","plot_simple_display"];["+","-","+=","-="].includes(a)&&(c=c.concat(v));for(const[S,C]of n.entries()){let T=C&&C.type||V.UNDETERMINED;const D=this._removePrefix(T);if(!c.includes(D)&&c.length&&D!==V.NA){this._errorHandle(ye(pe.typeMismatch,{operator:`operator ${a}`,index:`expr${S}`,typeE:T,typeR:c.slice(1).join("/")}),r[S]),h=V.UNDETERMINED,d.push(h);continue}if(!h){h=D,d.push(T);continue}if(h===V.UNDETERMINED||D===V.UNDETERMINED)T=h=V.UNDETERMINED;else if(h!==D&&h!==V.NA&&D!==V.NA&&(![V.INT,V.FLOAT].includes(h)||![V.INT,V.FLOAT].includes(D)))if(a===":="){if(h===V.BOOL&&[V.INT,V.FLOAT].includes(D)){this._errorHandle(ye(ar.boolVarNumWarning,{name:n[0].name}),r[0],Sn.Warning),d.push(T);continue}this._errorHandle(ye(pe.assignTypeMismatch,{typeE:D,name:n[0].name,typeR:h}),r[0]),T=h=V.UNDETERMINED}else if(["==","!=","?:"].includes(a)&&[V.INT,V.FLOAT,V.BOOL].includes(h)&&[V.INT,V.FLOAT,V.BOOL].includes(D))this._errorHandle(ye(ar.typeMismatch,{operator:`operator ${a}`,index:`expr${S}`,type:h}),r[S],Sn.Warning),T=h=V.UNDETERMINED;else if(v.includes(h)&&v.includes(D)){if(h!==D){const L=this._getPrefix(T);d[S-1]=`${this._getPrefix(d[S-1])} ${v[0]}`,T=h=`${L} ${v[0]}`}}else this._errorHandle(ye(pe.typeMismatch,{operator:`operator ${a}`,index:`expr${S}`,typeE:D,typeR:h}),r[S]),T=h=V.UNDETERMINED;d.push(T)}return d}_getUserVar(n,r=!1){for(let a=this._blockCount;a>=0;a--){const c=this._currentBlockVars[a];if(a<=0){const h=this._currentFuncParams.get(n);if(h)return h.isArg=!0,h}if(c){const h=c.get(n);if(h)return h}}if(n.includes(".")&&!r){let a=!1,c=null;if(n.split(".").reduce((h,d)=>{let v=h?`${h}.${d}`:d;const S=this._getUserVar(v,!0);return S!=null&&S.type?S.type===V.UNDETERMINED?a=!0:(v=S.type,c=S):c=null,v},""),a)return{name:n,type:V.UNDETERMINED};if(c)return c}return null}_repeatVarJudge(n,r,a,c){this._getBuildVar(n)&&this._errorHandle(ye(pe.buidinVarErr,{name:n}),r);for(let d=0;d<=this._blockCount;d++){const v=this._currentBlockVars[d];if(v&&v.get(n)){if(this._blockCount===d)return this._errorHandle(ye(pe.repeatVar,{name:n}),r),!0;a.reName=`$_${n}__${this._blockCount}`,this._errorHandle(ye(ar.repeatVar,{name:n}),r,Sn.Warning)}}c!=null&&c.some(d=>d===n&&n!=="_")&&this._errorHandle(ye(pe.repeatVar,{name:n}),r)}_judgeVarBuildIn(n){for(let r=0;r<=this._blockCount;r++){const a=this._currentBlockVars[r];if(a&&a.get(n))return!0}return!1}_updateUserVar(n,r,a){for(let c=0;c<=this._blockCount;c++){const h=this._currentBlockVars[c];if(h){const d=h.get(n);if(d){d.type=r,d.valueType=a;return}}}}_variablesHandle(n,r){var h,d,v,S,C;if(!(n&&n.nameList))return;const a=n.nameList;if(a.name==="_")return;const c=n.value;if(a.ruleType===le.VarMultiple){a.types=[],this._checkVarMultiple(a.names,c,r);for(const[T,D]of a.names.entries()){if(D==="_")continue;const L=this._varTypeJudge("",((h=c==null?void 0:c.types)==null?void 0:h[T])||V.UNDETERMINED,D,r);a.types.push(L),this._addVarToMap(D,L,a.posList[T],!0)}}else{const T=(c==null?void 0:c.type)||((d=c==null?void 0:c.returnedTypes)==null?void 0:d[0]);((v=c==null?void 0:c.types)!=null&&v.isBrackethesized||(S=c==null?void 0:c.returnedTypes)!=null&&S.isBrackethesized||(C=c==null?void 0:c.types)!=null&&C.length)&&this._errorHandle(ye(pe.tupleLeftVarErr,{name:a.name}),r),!a.type&&T===`${V.SIMPLE} ${V.NA}`&&this._errorHandle(pe.naVarErr,r),a.prefix&&Pi.indexOf(a.prefix)>Pi.indexOf(this._getPrefix(T))&&this._errorHandle(ye(pe.declaredErr,{prefix:a.prefix,type:T}),r);const D=this._varTypeJudge(a.type,T||V.UNDETERMINED,a.name,r);a.type=D,this._addVarToMap(a.name,D,a.pos,!0,a.isForVar,a.declare,c==null?void 0:c.type,a.desc)}}_checkVarMultiple(n,r,a){var S,C,T,D;const c=n.length,h=((r==null?void 0:r.types)||(r==null?void 0:r.returnedTypes)||[]).length,d=((S=r==null?void 0:r.types)==null?void 0:S.isBrackethesized)||((C=r==null?void 0:r.returnedTypes)==null?void 0:C.isBrackethesized);(T=r==null?void 0:r.types)!=null&&T.isUnknown||(D=r==null?void 0:r.returnedTypes)!=null&&D.isUnknown||(h===1&&!d||!h?this._errorHandle(pe.tupleRightVarErr,a):c!==h&&this._errorHandle(ye(pe.tupleVarErr,{indexA:h,indexB:c}),a))}_addEnumToMap(n,r,a){var v;const c=this._currentBlockVars[this._blockCount]||new Map,h=(v=this._enums.get(n))==null?void 0:v[0];if(h&&h.members)for(const S of h.members)c.set(`${n}.${S.name}`,S);const d={name:n,isEnum:!0,type:`${V.CONST} ${r}`,pos:a};c.set(n,d),this._currentBlockVars[this._blockCount]=c}_addVarToMap(n,r,a,c=!0,h=!1,d,v,S){var L;const C=this._currentBlockVars[this._blockCount]||new Map,T=(L=this._types.get(r))==null?void 0:L[0];if(T&&T.fields)for(const P of T.fields)C.set(`${n}.${P.name}`,P);const D={name:n,type:r,pos:a,valueType:v,desc:S};c&&this._setVariablesMap(D),C.set(n,Object.assign(D,{isForVar:h,declare:d})),this._currentBlockVars[this._blockCount]=C}_setVariablesMap(n,r=!1){const a=this._blockRanges[this._blockCount];r||(n.range=a,n.scope=this._blockCount);const c=this._variables.get(n.name)||[];c.push(n),this._variables.set(n.name,c)}_varTypeJudge(n,r,a,c){if(r===V.VOID)return this._errorHandle(pe.voidNotVar,c),V.UNDETERMINED;if(n&&r!==V.UNDETERMINED){const h=this._removePrefix(n),d=this._removePrefix(r);return d!==h&&d!==V.NA&&!(h===V.FLOAT&&d===V.INT)?h===V.BOOL&&[V.FLOAT,V.INT].includes(d)?(this._errorHandle(ye(ar.boolVarNumWarning,{name:a}),c,Sn.Warning),n):(this._errorHandle(ye(pe.declareTypeErr,{type:n,valueType:r}),c),V.UNDETERMINED):this._typeHandle([n,r])}else if(r===V.UNDETERMINED)return V.UNDETERMINED;return n||r||V.UNDETERMINED}_getAllowTypes(n){const r=[];if(n===V.UNDETERMINED)return r;const a=this._getPrefix(n);if(a){const c=this._removePrefix(n);let h=-1;for(const[d,v]of Pi.entries())v===a&&(h=d),h>=0&&h<=d&&(c===V.FLOAT&&r.push(`${v} ${V.INT}`),r.push(`${v} ${c}`))}else n=this._arrayTypeConvert(n)||"",r.push(n),n.includes(V.FLOAT)&&r.push(n.replace(/float/,V.INT));return r}_setNewFunc(n,r){const a=`${n.name}.new`,c=[],h=[];for(const v of n.fields)c.push({name:v.name,required:!1,allowedTypeIDs:this._getAllowTypes(v.type),displayType:v.type}),h.push(`${v.type} ${v.name}`);const d={name:a,args:c,returnedTypes:[n.name],pos:r,syntax:[`${a}(${h.join(", ")}) → ${n.name}`]};n.isExport&&this._exportFunctions.push(d),this._functions.set(a,[{...d,isUser:!0}])}_setCopyFunc(n,r){const a=n.name,c=`${a}.copy`,h={name:c,args:[{name:"object",required:!0,allowedTypeIDs:[a],displayType:a}],returnedTypes:[a],pos:r,info:"The identifier of the object to be copied.",syntax:[`${c}(${a} object) → ${a}`]};n.isExport&&this._exportFunctions.push(h),this._functions.set(c,[{...h,isUser:!0}])}_setCopyMethod(n,r){const a=n.name,c=`${a}.copy`,h={name:c,originalName:c,args:[],returnedTypes:[a],thisType:[a],pos:r,syntax:[`${c}() → ${a}`]};n.isExport&&this._exportMethods.push(h),this._methods.set(c,[{...h,isUser:!0}])}_setFunc(n,r,a,c){const h=[],d=[],{desc:v,paramsDesc:S,returnsDesc:C,params:T,hasMemberIndex:D}=n;for(const O of T){const{type:R,name:k,defaultValue:U}=O;h.push({name:k,desc:S==null?void 0:S[k],required:!U,allowedTypeIDs:this._getAllowTypes(R),displayType:R}),d.push(`${R===V.UNDETERMINED?"":`${R} `}${k}`)}const{returnedTypes:L=[]}=n,P=n.name,b=L.length>1||L.isBrackethesized?`[${L.join(", ")}]`:L.toString(),y={name:P,desc:v,args:h,syntax:[`${P}(${d.join(", ")}) → ${b||"void"}`],hasMemberIndex:D,pos:r,isUser:!0,returnedTypes:L,returns:C,hasRequest:this._hasRequest};let g=this._functions.get(P);if(g){const O=g.length;y.index=O,n.index=O,this._verifyFuncRepeat(g,y,a),g.push(y),this._overloadsFuncs.push({name:P,index:O,line:r.lineNumber,startColumn:r.column+1,endColumn:r.column+P.length})}else g=[y];if(n.isExport){const{line:O=0}=this._endExport;c>O&&(this._endExport={line:c,name:P,index:y.index}),this._exportFunctions.push(y)}this._functions.set(P,g)}_setMethod(n,r){var R;const{name:a,returnedTypes:c,params:h,desc:d,paramsDesc:v,returnsDesc:S}=n,C=h[0].type,T=[],D=[];for(const k of h.slice(1)){const{type:U,name:X,defaultValue:J}=k;T.push({name:X,desc:v==null?void 0:v[X],required:!J,allowedTypeIDs:this._getAllowTypes(U),displayType:U}),D.push(`${U} ${X}`)}const L=c.length>1||c.isBrackethesized?`[${c.join(", ")}]`:c.toString(),P=this._getMethodTypeName(C),b=`${P}.${a}`;n.typeName=P;const y={name:a,args:T,desc:d,originalName:b,syntax:[`${a}(${D.join(", ")}) → ${L||"void"}`],returnedTypes:c,hasMemberIndex:n.hasMemberIndex,pos:r,thisType:[C],returns:S,hasRequest:this._hasRequest};let g=this._methods.get(b),O=this._functions.get(a);if(O){const k=O.filter(J=>!J.isImport).length,U=((R=g==null?void 0:g.filter(J=>!J.isImport))==null?void 0:R.length)||0;let X=k;k>U&&(X=k-1),y.index=X,n.index=X}g?g.push(y):g=[y],n.isExport&&this._exportMethods.push(y),this._methods.set(b,g)}_verifyFuncRepeat(n,r,a){const{args:c}=r;n.some(d=>{const{args:v}=d;return(v==null?void 0:v.length)!=(c==null?void 0:c.length)?!1:!(v!=null&&v.length)&&!(c!=null&&c.length)?!0:v==null?void 0:v.every((S,C)=>{var T;return S.displayType===((T=c==null?void 0:c[C])==null?void 0:T.displayType)})})&&this._errorHandle(ye(pe.funcRepeatErr,{name:r.name}),a)}_getMethodTypes(n,r){let a;for(const[c,h]of n.entries()){const{type:d,expr:v,args:S}=h;let{name:C}=h;const T=r[c];if(v){if(v.type===V.UNDETERMINED)return[V.UNDETERMINED];C=`${this._getMethodTypeName(v.type)}${C}`,S.params.unshift(v)}if(a&&a.length>=1)if(a.length===1){const D=a[0];if(D===V.UNDETERMINED)return[V.UNDETERMINED];const L=this._getOriginMethodName(D,C);C.includes(".")?a=this._getOtherNamesMethodType(L,a,T,S,h):a=this._expandMethodHandle(L,T,S,{type:D},D,h)}else this._errorHandle(ye(pe.noFiledErr,{name:C}),T);else{const[D,L]=this._tempFuncNameHandle(C,T,d);C=L;const P=this._buildinFunctions.get(D);if(P)this._globalFuncVerify(P[0],T),this._hasMemberIndexVerify(P[0],T,h),h.isBuiltIn=!0,a=this._getBuildInReturnTypes(P,S,C,T,void 0,d);else{const b=this._functions.get(C);if(b)if(b.length<=1){this._hasMemberIndexVerify(b[0],T,h),a=b[0].returnedTypes;const{hasErr:y}=this._checkArgs(S,b[0].args||[],C,T,a[0]);if(y)return[V.UNDETERMINED]}else{const y=this._overloadsFuncGetTypes(b,S,T,void 0,h);a=this._returnedTypesParse([y])}else a=this._getOtherNamesMethodType(C,a,T,S,h)}}h.returnTypes=a}return a===void 0&&this._errorHandle(ye(pe.notFindFuncErr,{name:n[0].name}),r[0]),a}_globalFuncVerify(n,r){this._blockCount!==0&&$_.includes(n.name)&&this._errorHandle(ye(pe.globalFuncErr,{name:n.name}),r)}_hasMemberIndexVerify(n,r,a){n.hasRequest&&(a.hasRequest=!0,this._hasRequest=!0),n.hasMemberIndex||n.name.startsWith("ta.")||n.name==="math.sum"?(this._hasMemberIndex=this._isInFunc,a.hasMemberIndex=!0,a.position=r.start.tokenIndex):n.name.startsWith("request.")&&this._isInLocalScop&&this._errorHandle(pe.requestUserInLoopErr,r)}_tempFuncNameHandle(n,r,a){let c=n;if(a&&a.length>=1){const h=["array.new","matrix.new"].includes(n),d=n==="map.new";if(a.length===1)if(h)c=`${n}<type>`,n=`${n}<${a[0]}>`;else return d?this._errorHandle(ye(pe.templateErr,{countA:2,countB:1}),r):this._errorHandle(ye(pe.templateNoSupportErr,{name:n}),r),[V.UNDETERMINED];else{if(!d)return h?this._errorHandle(ye(pe.templateErr,{countA:1,countB:2}),r):this._errorHandle(ye(pe.templateNoSupportErr,{name:n}),r),[V.UNDETERMINED];if(!lu.includes(a[0]))return this._errorHandle(ye(pe.mapKeyErr,{type:this._typeAddSeries(a[0])}),r),[V.UNDETERMINED];c=`${n}<type,type>`,n=`${n}<${a[0]},${a[1]}>`}}return[c,n]}_getOtherNamesMethodType(n,r,a,c,h){const d=n.split("."),v=d.length-1,S=d.slice(0,v).join("."),C=this._getUserVar(S);this._judgeGatherValue(d[v],a,C==null?void 0:C.valueType)||(h.name=`${S}?.${d[v]}`);const D=C==null?void 0:C.type;if(D){if(D===V.UNDETERMINED)return r=[V.UNDETERMINED],r.isUnknown=!0,r;const L=this._getOriginMethodName(D,d[v]);h.varScope=C.scope,r=this._expandMethodHandle(L,a,c,C,S,h)}else{let L="",P="",b="";for(const y of d.slice(0,v)){L?P=this._getOriginMethodName(L,y):P=P?`${P}.${y}`:y;const g=this._verifyName(P);if(g!=null&&g.type){if(L=g.type,b="",g.title.startsWith("built-in variable")){const O=this._getOriginMethodName(L,d[v]);r=this._expandMethodHandle(O,a,c,g,S,h),h.hasVarPrefix=!0}}else this._buildinTypes.get(P)?b=ye(pe.methodNotExistErr,{name:P,methodName:d[v]}):b=ye(pe.noFiledErr,{name:y})}b&&this._errorHandle(b,a)}return r}_expandMethodHandle(n,r,a,c,h,d){var C,T;let v;const S=this._buildinMethods.get(n);if(S)d.name=d.name.split(".").join("?.").replace("??","?"),v=this._getBuildInReturnTypes(S,a,n,r,c);else{const D=this._methods.get(n);if(D&&D.length)if(D.length<=1){const L=D[0],P=this._getMethodTypeName(((C=L.thisType)==null?void 0:C[0])||"");if(this._types.get(P))d.name=d.name.split(".").join("?.").replace("??","?");else{const g=this._functions.get(L.name);g&&(d.selfArg=(T=g[L.index||0].args)==null?void 0:T[0])}d.funcName=L.name,d.index=L.index,this._hasMemberIndexVerify(L,r,d),v=L.returnedTypes;const{hasErr:y}=this._checkArgs(a,L.args||[],n,r,(v==null?void 0:v[0])||"");if(y)return[V.UNDETERMINED]}else{const L=this._overloadsFuncGetTypes(D,a,r,c,d);v=this._returnedTypesParse([L])}else this._errorHandle(ye(pe.methodNotExistErr,{methodName:n.split(".").slice(-1)[0],name:h}),r)}return v}_getBuildInReturnTypes(n,r,a,c,h,d){var S;let v;if(n.length===1){const{returnedTypes:C,syntax:T,args:D=[],thisType:L}=n[0],P=T[0].split("→")[1].trim(),b=h||r.params[0]||((S=D[0])==null?void 0:S.name)&&r[D[0].name];b&&!this._checkMethodThisType(L,b.type)&&this._errorHandle(ye(pe.typeMismatch,{operator:a,index:b.name||"id",typeE:b.type,typeR:L[0]}),c);const{hasErr:y,types:g}=this._checkArgs(r,D,a,c,P,b);if(y)return[V.UNDETERMINED];if(v=g.length&&g||this._returnedTypesParse(C),v.length>1||v.isBrackethesized)return v;(d==null?void 0:d.length)===1?v=[this._typeReplace(P,d[0])]:(d==null?void 0:d.length)===2&&(v=[`${V.MAP}<${d[0]},${d[1]}>`]),v=this._returnTypesOtherHandle(b,P,v,a)}else{const C=this._overloadsFuncGetTypes(n,r,c,h);v=this._returnedTypesParse([C])}return v}_overloadsFuncGetTypes(n,r,a,c,h){var P,b,y;let d="",v=[],S=[],C=0,T=0;for(const[g,O]of n.entries()){const{args:R,returnedTypes:k,name:U,thisType:X}=O,J=c||r.params[0]||r[R[0].name],{errMsg:G,warnMsg:Y,matchCount:$}=this._overloadsCheckArgs(r,R,U,a,J);$>T&&(C=g,T=$),J&&!this._checkMethodThisType(X,J.type)&&G.unshift({msg:ye(pe.typeMismatch,{operator:U,index:J.name||"id",typeE:J.type,typeR:X[0]}),ctx:a}),g===0?(v=G,S=Y,!G.length&&(d=k[0])):G.length?((P=v[0])!=null&&P.isLenErr&&!((b=G[0])!=null&&b.isLenErr)||v.length>G.length)&&(v=G,S=Y,C=g):this._priorityComparison(d,k[0])||(k[0]===`${V.ARRAY}<>`?d=`${J.type}[]`:d=k[0],v=G,S=Y,C=g)}for(const g of v)this._errorHandle(g.msg,g.ctx);for(const g of S)this._errorHandle(g.msg,g.ctx,Sn.Warning);const D=a.children[0],L=n[0].name;if(D&&this._overloadsFuncs.push({name:L,index:C,line:D.start.line,startColumn:D.start.column+1,endColumn:D.start.column+L.length}),h){const g=n[C],{thisType:O,name:R,index:k}=g;if(this._hasMemberIndexVerify(g,a,h),h.index=k||C,O){const U=this._getMethodTypeName((O==null?void 0:O[0])||"");if(this._types.get(U))h.name=h.name.split(".").join("?.").replace("??","?");else{const J=this._functions.get(R);J&&(h.selfArg=(y=J[0].args)==null?void 0:y[0])}}}return this._funcArgsAddOriginName(r,n[C].args,L),d||V.UNDETERMINED}_funcArgsAddOriginName(n,r,a){const c=n.params||[];for(const[h,d]of r.entries())h<c.length&&(c[h].originName=d.name);if(a==="input"){const h=c[0]||n.defval;Object.assign(n,{inputType:{name:`'${h!=null&&h.isSourceType?"source":this._removePrefix(h==null?void 0:h.type)}'`}})}}_overloadsCheckArgs(n,r,a,c,h){const d={...n},v=d.params;delete d.params;const S=Object.keys(d).length+v.length,C=r.length,T=[],D=[];let L=0;S>C&&(r.some(b=>["arg0, arg1, ...","number0, number1, ..."].includes(b.name))||T.push({msg:ye(pe.argsLenErr,{name:a,lenA:S,lenB:C}),isLenErr:!0,ctx:c}));for(const[P,b]of r.entries()){let y=d[b.name];if(P<v.length&&(y&&T.push({msg:ye(ar.moreSameArg,{arg:b.name}),ctx:c}),y=v[P]),!y)b.required&&T.push({msg:ye(pe.requiredParamErr,{name:a,argName:b.name}),ctx:c});else{const g=y.type!==`${V.SIMPLE} na`?this._checkArg(y,b,a,h,y.ctx,!0,D):"";g?T.push({msg:g,ctx:y.ctx}):L++,delete d[b.name]}if(["arg0, arg1, ...","number0, number1, ..."].includes(b.name)&&v.length>P+1){const g=v.slice(P+1);let O=v[P];for(const R of g){O.type===`${V.SIMPLE} ${V.NA}`&&(O=R);const k=R.type!==`${V.SIMPLE} ${V.NA}`?this._checkArg(R,b,a,O,R.ctx,!0,D):"";k&&T.push({msg:k,ctx:R.ctx})}}}if(Object.keys(d).length)for(const P of Object.keys(d))T.push({msg:ye(pe.argsNameErr,{name:a,argName:P}),ctx:d[P].ctx});return{errMsg:T,warnMsg:D,matchCount:L}}_checkArgs(n,r,a,c,h,d){var P,b;const v={...n},S=v.params;delete v.params;const C=Object.keys(v).length+S.length,T=r.length;let D=!1,L=[];if(C>T&&!r.some(g=>["arg0, arg1, ...","number0, number1, ..."].includes(g.name)))return this._errorHandle(ye(pe.argsLenErr,{name:a,lenA:C,lenB:T}),c),D=!0,{hasErr:D,types:L};for(const[y,g]of r.entries()){let O=v[g.name];if(y<S.length&&(O&&this._errorHandle(ye(ar.moreSameArg,{arg:g.name}),c,Sn.Warning),O=S[y],O.originName=g.name),!O)g.required&&(this._errorHandle(ye(pe.requiredParamErr,{name:a,argName:g.name}),c),D=!0);else{const R=O.type!==`${V.SIMPLE} ${V.NA}`?this._checkArg(O,g,a,d,O.ctx):"";if(R)this._errorHandle(R,O.ctx),D=!0;else if(a.startsWith("request.")&&g.name==="expression")if(O.ruleType===le.Brackethesized)L=O.exprs.map(k=>this._typeReplace(h,k.type));else if((P=O.types||O.returnedTypes)!=null&&P.length)L=(O.types||O.returnedTypes).map(k=>this._typeReplace(h,k)),(b=O.types||O.returnedTypes)!=null&&b.isBrackethesized&&Object.assign(L,{isBrackethesized:!0});else{const k=this._typeReplace(h,O.type);L.push(k)}else if(a==="input.enum"&&g.name==="defval"){const k=this._removePrefix(O.type);L.push(`${V.INPUT} ${k}`)}delete v[g.name]}}if(Object.keys(v).length)for(const y of Object.keys(v))this._errorHandle(ye(pe.argsNameErr,{name:a,argName:y}),v[y].ctx),D=!0;return{hasErr:D,types:L}}_checkArg(n,r,a,c,h,d,v){var y,g;const{ruleType:S,exprs:C,name:T}=n;let D=n.type;S===le.Brackethesized&&(D=`[${C.map(O=>O.type).join(", ")}]`);const{allowedTypeIDs:L=[],displayType:P,name:b}=r;if(!(!D||D===V.UNDETERMINED||P===V.UNDETERMINED)){if(a==="input"&&b==="defval"&&!D.startsWith(V.CONST))if(Cl.includes(T))n.isSourceType=!0;else return pe.inputDefvalErr;if(!(this._checkMethodThisType(L,this._arrayTypeConvert(D))&&!(["input.source","input.enum"].includes(a)&&b==="defval"))){if(b==="condition"&&(P!=null&&P.endsWith(V.BOOL))){if(D.endsWith(V.INT)||D.endsWith(V.FLOAT)){const O=ye(ar.typeMismatch,{index:b,operator:a,type:V.BOOL});h&&(v?v.push({ctx:h,msg:O}):this._errorHandle(O,h,Sn.Warning));return}}else if(a==="str.tostring"&&b==="value"){const O=this._removePrefix(D);if(this._enums.get(O))return}switch(P){case"tuple of const string values: [val1, val2, ...]":return this._tupleToCheck(n,r,[`${V.CONST} ${V.STRING}`],a,D);case"tuple of const int/float values: [val1, val2, ...]":return this._tupleToCheck(n,r,[`${V.CONST} ${V.FLOAT}`,`${V.CONST} ${V.INT}`],a,D);case"tuple of const int values: [val1, val2, ...]":return this._tupleToCheck(n,r,[`${V.CONST} ${V.INT}`],a,D);case"open/high/low/close/hl2/hlc3/ohlc4/hlcc4":if(!T||!Cl.includes(T))return ye(pe.inputSourceErr,{name:b,funcName:a});if(this._judgeVarBuildIn(T))return ye(pe.buildInUseErr,{name:T});n.isSourceType=!0;break;case"<matrix_type>":case"<array_type>":const O=this._getArrayType(a)||"";if(!D.endsWith(O)&&!(D.endsWith(V.INT)&&O===V.FLOAT))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:this._typeAddSeries(O)});break;case"any matrix type":if(this._isMatrixType(D)){if(b==="id2"){const $=this._getArrayType(c==null?void 0:c.type);if(!$)return;const te=this._getArrayType(D)||"";if($!==te)return ye(pe.typeMismatch,{operator:a,index:b,typeE:te,typeR:$})}}else return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"matrix<fun_arg>"});break;case"any array type":if(this._isArrayType(D)){if(b==="id2"){const $=this._getArrayType(c==null?void 0:c.type);if(!$)return;const te=this._getArrayType(D)||"";if($!==te)return ye(pe.typeMismatch,{operator:a,index:b,typeE:te,typeR:$})}}else return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"array<fun_arg>"});break;case"series <type of the matrix's elements>":case"series <type of the array's elements>":const R=this._getArrayType(c==null?void 0:c.type)||"";if(!D.endsWith(R)&&!(D.endsWith(V.INT)&&R===V.FLOAT))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:this._typeAddSeries(R)});break;case"any map type":if(this._isMapType(D)){if(b==="id2"){const $=this._getMapType(c==null?void 0:c.type);if(!$)return;const te=this._getMapType(D)||[];if($[0]!==te[0]||$[1]!==te[1])return ye(pe.mapKeyValErr,{typeA:this._typeAddSeries(te[0]),typeB:this._typeAddSeries(te[1]),typeC:this._typeAddSeries($[0]),typeD:this._typeAddSeries($[1]),name:a})}}else return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"map<type, type>"});break;case"series <type of the map's elements>":const k=this._getMapType(c==null?void 0:c.type);if(!k)return;const U=b==="key"?0:1;if(!D.endsWith(k[U])&&!(D.endsWith(V.INT)&&k[U]===V.FLOAT))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:this._typeAddSeries(k[U])});break;case"<arg_expr_type>":if(S===le.Brackethesized)return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:P||""});break;case"<arg_type>":case"variable, function, object, array or matrix of series int/float/bool/string/color, or a tuple of these":const X=this._removePrefix(D);if([V.BOX,V.LABEL,V.LINE,V.LINEFILL,V.POLYLINE,V.TABLE].includes(X))return ye(pe.requestExprErr,{type:X,name:a});break;case"variable, object or function of series int/float/bool/string/color, or a tuple of these":if(S===le.Brackethesized){for(const $ of C)if(!L.includes($.type))return ye(pe.requestArgsErr,{name:a,argName:b,type:$.type})}break;case"const int/float/bool/string/color or source-type built-ins":if(Cl.includes(n.name)&&L[0].endsWith(this._removePrefix(D)))n.isSourceType=!0;else return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"const int/float/bool/string/color"});break;case"<arg..._type>":if(S===le.Brackethesized||this._isArrayType(D)||this._isMapType(D)||this._isMatrixType(D))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:`${V.SERIES} ${V.INT}`});if(D!==(c==null?void 0:c.type))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:c==null?void 0:c.type});break;case"simple enum":const J=this._removePrefix(D);if(!this._enums.has(J))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"const enum"});break;case"tuple of enum fields: [enumName.field1, enumName.field2, ...]":const G=c==null?void 0:c.enumName;if(G&&!((y=n.exprs)==null?void 0:y.every(te=>te.enumName===G)))return ye(pe.typeMismatch,{operator:a,index:b,typeE:`${n.exprs?`[${(g=n.exprs)==null?void 0:g.map(te=>te.type).join(", ")}]`:n.type}`,typeR:`[const ${G}...]`});break;default:const Y=this._removePrefix(n.type);if(n.arg&&n.arg.isArg&&!d){const $=L.find(te=>te.endsWith(Y));if($){n.type=$,n.arg.type=$;return}}if(L.length===1&&this._removePrefix(L[0])===Y){const $=this._getPrefix(n.type),te=this._getPrefix(L[0]);if(Pi.indexOf($)>=Pi.indexOf(te))return}if(P)return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:P})}}}}_tupleToCheck(n,r,a,c,h){var d,v;if(a.push(`${V.SIMPLE} ${V.NA}`),n.ruleType===le.Brackethesized){const S=[];let C=!1;for(const T of n.exprs)S.push(T.type),a.includes(T.type)||(C=!0);if(C)return ye(pe.typeMismatch,{operator:c,index:r.name,typeE:`[${S.join(", ")}]`,typeR:((d=r.allowedTypeIDs)==null?void 0:d[0])||""})}else return ye(pe.typeMismatch,{operator:c,index:r.name,typeE:h,typeR:((v=r.allowedTypeIDs)==null?void 0:v[0])||""})}_getBlockReturnTypes(n){var D,L;let r=n;if(Array.isArray(n)&&(r=n.slice(-1)[0],Array.isArray(r)&&(r=r.slice(-1)[0])),!r)return[V.UNDETERMINED];const{ruleType:a,type:c,types:h,returnedTypes:d,exprs:v,nameList:S,typeList:C,block:T}=r;if(h&&h.length)return h;if(d&&d.length)return d;if(c)return[c];switch(a){case le.Brackethesized:const P=v.map(J=>J.type);return P.isBrackethesized=!0,P;case le.VarBlockStmt:case le.DeclareAssign:return S?S.ruleType===le.VarMultiple?S.types:[S.type]:[((D=r.name)==null?void 0:D.type)||V.UNDETERMINED];case le.SwitchStatement:if(!this._isNeedCalc&&this._isInFunc&&this._isEndExpr===!1)return[V.UNDETERMINED];const b=[...r.cases];r.defaultCase&&b.push(r.defaultCase);let y=((L=b[0])==null?void 0:L.returnedTypes)||[],g=y.length<=1?y[0]:`[${y.join(", ")}]`,O=null;for(const J of b.slice(1)){const G=J.returnedTypes||[V.UNDETERMINED];g+=G.length<=1?`; ${G[0]}`:`; [${G.join(", ")}]`;const Y=Array.isArray(J.block)?J.block.slice(-1)[0]:J.block;if(G.length!==y.length)O=Y.ctx;else for(const[$,te]of y.entries())if(this._compareType(G[$],te))(G[$].includes(V.FLOAT)&&!te.includes(V.FLOAT)||y[$]===`${V.SIMPLE} ${V.NA}`||y[$]===V.UNDETERMINED)&&(y[$]=G[$]);else{O=Y.ctx;break}}return O&&(this._errorHandle(ye(pe.ifOrSwitchTypeErr,{keyword:"switch",types:g}),O),y=y.map(()=>V.UNDETERMINED)),r.returnedTypes=y,y;case le.IfStatement:if(!this._isNeedCalc&&!this._isInFunc)return[V.UNDETERMINED];if(!C.filter(J=>J&&J.length).length)return[V.UNDETERMINED];let R=C[0]||[],k=R.length<=1?R[0]:`[${R.join(", ")}]`,U=0,X=0;for(const J of C.slice(1))if(J)if(U++,k+=J.length<=1?`; ${J[0]}`:`; [${J.join(", ")}]`,J.length!==R.length)X=U;else for(const[G,Y]of R.entries())if(this._compareType(J[G],Y))(J[G].includes(V.FLOAT)&&!Y.includes(V.FLOAT)||R[G]===`${V.SIMPLE} ${V.NA}`)&&(R[G]=J[G]);else{X=U;break}if(X){const J=T[X].slice(-1)[0],G=Array.isArray(J)?J.slice(-1)[0]:J;this._errorHandle(ye(pe.ifOrSwitchTypeErr,{keyword:"if",types:k}),G.ctx),R=R.map(()=>V.UNDETERMINED)}return r.returnedTypes=R,R}return[V.UNDETERMINED]}}class J_{constructor(e){w(this,"_nameMap");w(this,"_prefixNameVar");w(this,"_prefixNameFunc");w(this,"_prefixNameConst");w(this,"_userTypes");w(this,"_isInFunc");w(this,"_currentFuncName");w(this,"_varlist");w(this,"_memberIndexList");w(this,"_blockCount");w(this,"_inputCount");w(this,"_count");w(this,"_isSwitch",!1);w(this,"_isInLoop",!1);w(this,"_codesCol");w(this,"_dependsObj");w(this,"_enums");w(this,"_preRunMembers");w(this,"_isInConditionalStmt",!1);w(this,"_preRunMembersFuncs");w(this,"_preRunMemberFuncsCount",0);w(this,"__count",0);w(this,"preParseCode","");this._nameMap=new Map,this._prefixNameVar=`${e}_var`,this._prefixNameFunc=`${e}_func`,this._prefixNameConst=`${e}_const`,this._userTypes=[],this._isInFunc=!1,this._varlist=[{}],this._memberIndexList=[{}],this._blockCount=0,this._inputCount=0,this._count=0,this._codesCol=[[]],this._dependsObj={},this._enums=new Map,this._preRunMembers=[],this._preRunMembersFuncs=[]}preParser(e){var r,a;const n=[];for(const c of e){if(!c)return;if(Array.isArray(c)){for(const h of c)if(n.push(this._parserStmt(h)),fu.includes((a=(r=h.exprs)==null?void 0:r[0])==null?void 0:a.name))return n.join(`;
|
13
|
+
`)){const v=h.replace(/\s*(\n|\r)\s*/g," ");d.value=`\`${v.substring(1,v.length-1)}\``}break;case M.IntegerLiteral:d.type=V.INT;break;case M.DecimalLiteral:d.type=V.FLOAT;break}return d.type&&(d.type=`${V.CONST} ${d.type}`),d});w(this,"visitMethodElement",n=>{const{children:r}=n,[a,c]=r,[h,d,v]=this.visit(a),S=this.visit(c);return h.startsWith("request.")&&this._isInFunc&&(this._currentExportFunc&&this._errorHandle(ye(pe.exportFuncUseReqErr,{name:h}),n),this._hasRequest=!0),{name:h,type:d,args:S,expr:v}});w(this,"visitMethodName",n=>{const{children:r}=n,a=[],c=[];let h=0,d=null;for(;h<r.length;h++){const S=r[h],C=S.ruleIndex,T=S.symbol;switch(C){case M.RULE_identifier:a.push(this.visit(S));break;case M.RULE_singleExpression:d=this.visit(S);break;case M.RULE_typeName:const D=this.visit(S);c.push(D),this._typeCheck(D,M.RULE_typeName,S);break;default:T&&T.text==="."&&a.push(".")}}const v=a.join("");return V_.includes(v)?this._hasDrawFunc=!0:j_.includes(v)&&(this._hasCreateOrderFunc=!0),[v,c,d]});w(this,"visitArrowFunction",n=>{const{children:r,start:a,stop:c}=n,h={ruleType:le.ArrowFunction,returnedTypes:[]};let d=0,v={lineNumber:0,column:0};const S=this._commentsParser(a.line,[Kt.function,Kt.param,Kt.returns],!0);Object.assign(h,{desc:S[Kt.function],paramsDesc:S[Kt.param],returnsDesc:S[Kt.returns]}),this._currentLine=a.line;let C=null;for(;d<r.length;d++){const T=r[d],D=T.ruleIndex,L=T.symbol;switch(D){case M.RULE_identifier:v={lineNumber:T.start.line,column:T.start.column},h.name=this.visit(T);break;case M.RULE_arrowFunctionParameters:h.params=this.visit(T),h.isExport&&this._exportArgsTypeVerify(h.params),this._setFuncParams(h,{endColumn:c.column,endLineNumber:c.line-1,startColumn:a.column,startLineNumber:a.line}),C=T;break;case M.RULE_block:this._isInFunc=!0,h.isExport&&(this._currentExportFunc=h.name),this._hasMemberIndex=!1,this._hasRequest=!1,h.block=this.visit(T),h.hasMemberIndex=this._hasMemberIndex,h.returnedTypes=this._getBlockReturnTypes(h.block),this._isInFunc=!1,this._currentExportFunc="";break;default:L&&L.type===M.Export&&(h.isExport=!0,this._addExportPos(L,"functions"))}}return h.hasRequest=this._hasRequest,this._setFunc(h,v,C,c.line-1),this._hasRequest=!1,this._currentFuncParams.clear(),h});w(this,"visitArrowFunctionParameters",n=>{const{children:r}=n;let a=0,c=[];for(;a<r.length;a++){const h=r[a];h.ruleIndex===M.RULE_formalParameterList&&(c=this.visit(h))}return c});w(this,"visitFormalParameterList",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const h=r[a];h.ruleIndex===M.RULE_formalParameterArg&&c.push(this.visit(h))}return c});w(this,"visitFormalParameterArg",n=>{const{children:r}=n;let a=0;const c={};for(;a<r.length;a++){const h=r[a];switch(h.ruleIndex){case M.RULE_typeGather:const d=this.visit(h);c.type=d&&this._typeAddSeries(d);break;case M.RULE_identifier:c.name=this.visit(h);break;case M.RULE_singleExpression:c.defaultValue=this.visit(h),delete c.defaultValue.ctx}}return c.ctx=n,this._verifyArgsDefaultValue(c,n),c.type=c.type||V.UNDETERMINED,c});w(this,"visitArrowMethod",n=>{const{children:r,start:a,stop:c}=n;let h=0;const d={ruleType:le.ArrowMethod,returnedTypes:[]};let v={lineNumber:0,column:0};const S=this._commentsParser(a.line,[Kt.function,Kt.param,Kt.returns],!0);Object.assign(d,{desc:S[Kt.function],paramsDesc:S[Kt.param],returnsDesc:S[Kt.returns]}),this._currentLine=a.line;let C=null;for(;h<r.length;h++){const T=r[h];switch(T.ruleIndex){case M.RULE_identifier:v={lineNumber:T.start.line,column:T.start.column},d.name=this.visit(T);break;case M.RULE_arrowMethodParameters:d.params=this.visit(T),d.isExport&&this._exportArgsTypeVerify(d.params),this._setFuncParams(d,{endColumn:c.column,endLineNumber:c.line-1,startColumn:a.column,startLineNumber:a.line}),C=T;break;case M.RULE_block:this._isInFunc=!0,d.isExport&&(this._currentExportFunc=d.name),this._hasMemberIndex=!1,this._hasRequest=!1,d.block=this.visit(T),d.hasMemberIndex=this._hasMemberIndex,d.returnedTypes=this._getBlockReturnTypes(d.block),this._isInFunc=!1,this._currentExportFunc="";break;default:T.symbol&&T.symbol.type===M.Export&&(d.isExport=!0,this._addExportPos(T.symbol,"methods"));break}}return d.hasRequest=this._hasRequest,this._setFunc(d,v,C,c.line-1),this._setMethod(d,v),this._hasRequest=!1,this._currentFuncParams.clear(),d});w(this,"visitArrowMethodParameters",n=>{const{children:r}=n;if(!r)return;let a=0;const c={};let h=[];for(;a<r.length;a++){const d=r[a];switch(d.ruleIndex){case M.RULE_typeGather:const v=this.visit(d);c.type=v&&this._typeAddSeries(v);break;case M.RULE_identifier:c.ctx=d,c.name=this.visit(d);break;case M.RULE_formalParameterList:h=this.visit(d);break}}return[c,...h]});w(this,"visitTypeStatement",n=>{const{children:r,start:a,stop:c}=n;let h=0;const d={ruleType:le.TypeStatement,fields:[]},v=this._commentsParser(a.line,[Kt.type,Kt.field]);Object.assign(d,{desc:v[Kt.type],fieldsDesc:v[Kt.field]}),this._currentLine=a.line;let S={lineNumber:0,column:0},C=null;for(;h<r.length;h++){const T=r[h];switch(T.ruleIndex){case M.RULE_identifier:S={lineNumber:T.start.line,column:T.start.column},C=T,d.name=this.visit(T),this._verifyTypeName(d.name,T);break;case M.RULE_typeElement:d.fields.push(this.visit(T));break;default:T.symbol&&T.symbol.type===M.Export&&(d.isExport=!0,this._addExportPos(T.symbol,"types"));break}}if(d.isExport){const T=c.line-1,{line:D=0}=this._endExport;T>D&&(this._endExport={line:T,name:d.name})}return this._setUserType(d,S,C),this._setNewFunc(d,S),this._setCopyFunc(d,S),this._setCopyMethod(d,S),d});w(this,"visitTypeElement",n=>{const{children:r,start:a}=n;let c=0;const h={};let d=null,v=null;for(this._currentLine=a.line;c<r.length;c++){const S=r[c];switch(S.ruleIndex){case M.RULE_typeGather:const C=this.visit(S);if(S.children[0].ruleIndex===M.RULE_typeSeries){const{column:T,line:D,text:L}=S.start,P=T+1;this._errors.push({startColumn:P,endColumn:parseInt(P+L.length),startLineNumber:D,endLineNumber:D,message:ye(this._buildinTypes.has(L)?pe.typeUseError:pe.notTypeKeyword,{text:L})}),h.type=V.UNDETERMINED}else h.type=C&&this._typeAddSeries(C);break;case M.RULE_identifier:h.name=this.visit(S),v=S;break;case M.RULE_singleExpression:d=S,h.value=this.visit(S);break;default:S.symbol&&S.symbol.type===M.Varip&&(h.isVarip=!0);break}}return this._typeElementVerify(h,d,v),h});w(this,"visitAssignmentOperator",n=>{const{children:r}=n;return r&&r[0].symbol.text});w(this,"visitTypeMap",n=>{const{children:r}=n;let a=0;const c=[];for(;a<r.length;a++){const h=r[a];if(h.ruleIndex===M.RULE_typeName){const d=this.visit(h);c.push(d),this._typeCheck(d,M.RULE_typeName,h)}}return`map<${c[0]},${c[1]}>`});w(this,"visitTypeSeries",n=>{const{children:r}=n,[a,c]=r,h=this.visit(a),d=this.visit(c);return this._typeCheck(h,M.RULE_typeSeries,a),this._typeCheck(d,M.RULE_typeName,c),`${h} ${d}`});w(this,"visitTypeArray",n=>{const{children:r}=n,a=r[0];let c=this.visit(a),h=c;if(r.length===3)c=V.ARRAY;else{this._typeCheck(c,M.RULE_typeArray,a);let d=1;for(;d<r.length;d++){const v=r[d];v.ruleIndex===M.RULE_typeName&&(h=this.visit(v),this._typeCheck(h,M.RULE_typeName,v))}}return this._arrayTypeConvert(`${c}<${h}>`)});w(this,"visitTypeGather",n=>{const{children:r}=n;if(r&&r.length){const a=r[0],c=this.visit(a);return a.ruleIndex===M.RULE_typeName&&this._typeCheck(c,M.RULE_typeName,a),c}return null});w(this,"visitIdentifier",n=>n.children&&n.children[0].symbol.text);w(this,"visitTypeName",n=>{const{children:r}=n;let a=0,c="";for(;a<r.length;a++){const h=r[a];h.ruleIndex===M.RULE_identifier?c=`${c}${this.visit(h)}`:c=`${c}.`}return c});w(this,"visitEnumStatement",n=>{const{children:r,start:a,stop:c}=n;let h=0;const d={ruleType:le.EnumStatement,fields:[]},v=this._commentsParser(a.line,[Kt.enum,Kt.field]);Object.assign(d,{desc:v[Kt.enum],fieldsDesc:v[Kt.field]}),this._currentLine=a.line;let S={lineNumber:0,column:0},C=null;for(;h<r.length;h++){const T=r[h];switch(T.ruleIndex){case M.RULE_identifier:S={lineNumber:T.start.line,column:T.start.column},C=T,d.name=this.visit(T),this._verifyEnumName(d.name,T);break;case M.RULE_enumElement:d.fields.push(this.visit(T));break;default:T.symbol&&T.symbol.type===M.Export&&(d.isExport=!0,this._addExportPos(T.symbol,"enums"));break}}if(d.isExport){const T=c.line-1,{line:D=0}=this._endExport;T>D&&(this._endExport={line:T,name:d.name})}return this._setUserEnum(d,S,C),d});w(this,"visitEnumElement",n=>{const{children:r,start:a}=n;let c=0;const h={};for(this._currentLine=a.line;c<r.length;c++){const d=r[c];switch(d.ruleIndex){case M.RULE_identifier:h.name=this.visit(d);break;default:d.symbol&&d.symbol.type===M.StringLiteral&&(h.value=d.symbol.text);break}}return h});w(this,"visitName",n=>{const{children:r}=n;let a=0,c=!1;const h=[];let d=null;for(;a<r.length;a++){const v=r[a];switch(v.ruleIndex){case M.RULE_identifier:h.push(this.visit(v));break;case M.RULE_singleExpression:d=this.visit(v);break;case M.RULE_methodElement:c=!0;const S=this.visit(v);S.ctx=v,h.push(S);break}}return this._nameHandle(c,h,d,n)});this._loopCount=0,this._errors=[],this._variables=new Map,this._functions=new Map,this._methods=new Map,this._currentFuncParams=new Map,this._types=new Map,this._enums=new Map,this._currentBlockVars=[new Map],this._blockCount=0,this._isInFunc=!1,this._isNeedCalc=!1,this._blockRanges=[],this._overloadsFuncs=[],this._hasMemberIndex=!1,this._isInLocalScop=!1,this._onlyStatementsCount=0,this._comments=r,this._exportFunctions=[],this._exportMethods=[],this._exportTypes=[],this._exportEnums=[],this._exportPositions=[],this._endExport={},this._importLibs=new Map,this._getImportLibraryFunc=a}get overloadsFuncs(){return this._overloadsFuncs}get errors(){return this._errors}get userEnums(){return this._enums}get userTypes(){return this._types}get userFunctions(){return this._functions}get userVariables(){return this._variables}get userMethods(){return this._methods}get hasUseDrawFunc(){return this._hasDrawFunc}get hasUseCreateOrderFunc(){return this._hasCreateOrderFunc}get scriptType(){return this._scriptType}get exportLibs(){return{functions:[...this._exportFunctions],methods:[...this._exportMethods],types:[...this._exportTypes],enums:[...this._exportEnums]}}get description(){return this._description}get exportPositions(){return this._exportPositions}get endExport(){return this._endExport}get imports(){return this._importLibs}_verifyGloablVar(n,r){const{name:a,varPos:c,isBuiltIn:h}=n;if(h&&this._errorHandle(ye(pe.buidinAssignErr,{name:a}),r),!c)return;const d=this._currentBlockVars[0].get(a);if(!d)return;const{column:v,lineNumber:S}=d.pos||{};this._isInFunc&&v===c.column&&S===c.lineNumber?this._errorHandle(ye(pe.modifyGlobalVarErr,{name:a}),r):d.hasAssigned=!0}_inputFuncTitleVerify(n,r){if(!(n!=null&&n.length)||n.length>1)return;const{name:a,args:c,isBuiltIn:h}=n[0];if(h&&!this._strategyFuncName&&a.startsWith(Ii.strategy))this._strategyFuncName={ctx:r,name:a};else if(!a.startsWith(V.INPUT))return;this._inputVarName&&!(c.params.some(d=>d.originName==="title")||c.title)&&(c.title={value:`"${this._inputVarName}"`,ruleType:le.Literal,type:`${V.CONST} ${V.STRING}`})}_verifyIf(n){const{condition:r}=n;if(r!=null&&r.length)for(const a of r){const{type:c,ctx:h}=a;if(c===V.UNDETERMINED)continue;const d=this._removePrefix(c);[V.INT,V.FLOAT].includes(d)?this._errorHandle(ye(ar.conditionWarning,{name:"if"}),h,Sn.Warning):d!==V.BOOL&&this._errorHandle(ye(pe.conditionalErr,{name:"if"}),h)}}_forToNameHandle(n,r){if(n.name&&n.numerical.length===1){this._pushBlockRanges(r);const a=n.numerical[0].type;this._variablesHandle({nameList:{name:n.name,isForVar:!0,type:n.type},value:{type:a||`${V.SERIES} ${V.INT}`}},r),this._blockRanges.pop()}}_verifyForTo(n){const{numerical:r}=n;if(r!=null&&r.length)for(const a of r){const{type:c,ctx:h}=a;if(c===V.UNDETERMINED)continue;const d=this._removePrefix(c);[V.INT,V.FLOAT].includes(d)||this._errorHandle(pe.fortoErr,h)}}_forInNameHandle(n,r){if(this._pushBlockRanges(r),n.names.length){let[a,c]=n.names;const h=n.array.type;c?this._variablesHandle({nameList:{name:a,isForVar:!0,type:`${V.SERIES} ${V.INT}`},value:{type:`${V.SERIES} ${V.INT}`}},r):c=a;const d=h===V.UNDETERMINED?h:this._isMatrixType(h)?`${this._getArrayType(h)}[]`:this._typeAddSeries(this._getArrayType(h));this._variablesHandle({nameList:{name:c,isForVar:!0,type:d},value:{type:d}},r)}this._blockRanges.pop()}_verifySwitch(n){var r;if(n.cases){const a=(r=n.condition)==null?void 0:r.type;if(a===V.UNDETERMINED)return;if(a&&this._types.has(a)){this._errorHandle(ye(pe.typeMismatch,{operator:"switch",index:"expr0",typeE:a,typeR:`${V.SIMPLE} ${V.STRING}`}),n.condition.ctx);return}for(const c of n.cases){const{condition:{type:h,ctx:d}}=c;if(h!==V.UNDETERMINED)if(this._types.has(h))this._errorHandle(ye(pe.typeMismatch,{operator:"case",index:"expr1",typeE:h,typeR:`${V.SIMPLE} ${V.STRING}`}),d);else if(a){if(!this._compareType(a,h)){const v=this._removePrefix(a),S=this._removePrefix(h);v===V.BOOL&&[V.INT,V.FLOAT].includes(S)?this._errorHandle(ye(ar.conditionWarning,{name:"switch"}),d,Sn.Warning):[V.INT,V.FLOAT].includes(v)&&S===V.BOOL?this._errorHandle(ye(ar.conditionWarning,{name:"switch"}),n.condition.ctx,Sn.Warning):this._errorHandle(ye(pe.typeMismatch,{operator:"case",index:"expr1",typeE:h,typeR:`${a}`}),d)}}else{const v=this._removePrefix(h);[V.INT,V.FLOAT].includes(v)?this._errorHandle(ye(ar.conditionWarning,{name:"switch"}),d,Sn.Warning):v!==V.BOOL&&this._errorHandle(ye(pe.conditionalErr,{name:"switch"}),d)}}}}_verifyWhile(n){const{condition:r}=n;if(r){const{type:a,ctx:c}=r;if(a===V.UNDETERMINED)return;const h=this._removePrefix(a);[V.INT,V.FLOAT].includes(h)?this._errorHandle(ye(ar.conditionWarning,{name:"while"}),c,Sn.Warning):h!==V.BOOL&&this._errorHandle(ye(pe.conditionalErr,{name:"while"}),c)}}async _importHandle(n,r){const{stop:a,start:c}=r,{username:h,libraryName:d,libraryVersion:v,name:S}=n,C=`${h}/${d}/${v}`;if(this._importLibs.has(C))return this._errorHandle(pe.importMultipleErr,r),n;for(const[L,P]of this._importLibs)if(P.name&&P.name===S||!P.name&&!S&&P.libraryName===d)return this._errorHandle(ye(pe.importNameRepeatErr,{name:S,line:P.startLine}),r),n;let T=S||d;const D=await this._getImportLibraryFunc({...n,libraryId:C,ctx:void 0,startLine:c.line,endLine:a.line,startColumn:c.column,endColumn:a.column+a.text.length+1});if(D){const{codeStr:L,description:P}=D;this._importLibs.set(C,{...n,libraryId:C,startLine:c.line,endLine:a.line,ctx:void 0,desc:P}),this._importDataHandle(D,T),wn.includes(T)&&(T=`$${T}`),n.code=L.replace("$name",T)}else this._errorHandle(ye(pe.importNotExitErr,{username:h,libraryName:d}),r)}_importDataHandle(n,r){const{functions:a,methods:c,types:h}=n;for(const d of a){const{name:v}=d,S=`${r}.${v}`,C=this._functions.get(S)||[];C.push({...this._importTypeUpdate(d,h,r),name:S,isUser:void 0,isImport:!0}),this._functions.set(S,C)}for(const d of c){const v=this._importTypeUpdate(d,h,r),S=v.originalName||v.name,C=this._methods.get(S)||[];C.push({...v,isImport:!0,isUser:void 0}),this._methods.set(S,C)}for(const d of h){const v=`${r}.${d.name}`,S=this._types.get(v)||[];S.push({...this._importTypeUpdate(d,h,r),name:v,isImport:!0}),this._types.set(v,S)}}_importTypeUpdate(n,r,a){var L;let{args:c,returnedTypes:h,thisType:d,fields:v,name:S,originalName:C}=n,T="";if(c&&c.length&&(c=c.map(P=>{const{allowedTypeIDs:b,displayType:y,name:g}=P,O=y&&this._replaceTypeName(y,r,a);return T=T?`${T}, ${O} ${g}`:`${O} ${g}`,{...P,allowedTypeIDs:b==null?void 0:b.map(R=>this._replaceTypeName(R,r,a)),displayType:O}})),h!=null&&h.length&&(h=[this._replaceTypeName(h[0],r,a)]),d!=null&&d.length){const P=this._replaceTypeName(d[0],r,a);P!==d[0]&&(C=`${a}.${C||S}`),d=[P]}v!=null&&v.length&&(v=v.map(P=>{const{type:b}=P;return{...P,type:b&&this._replaceTypeName(b,r,a)}}));const D={...n,args:c,returnedTypes:h,thisType:d,fields:v,originalName:C};return(L=D.syntax)!=null&&L.length&&(D.syntax=[`${C||`${a}.${S}`}(${T}) → ${(h==null?void 0:h[0])||"void"}`]),D}_replaceTypeName(n,r,a){const c=r.find(h=>n.includes(h.name));return c?n.replace(c.name,`${a}.${c.name}`):n}_verifyArgsDefaultValue(n,r){const{defaultValue:a,type:c}=n;if(!a)return;const{ruleType:h,isBuiltIn:d,type:v}=a,S=this._removePrefix(v);if(h!==le.Literal&&!d)delete n.defaultValue,this._errorHandle(pe.argDefaultErr,r);else if(c&&c!==V.UNDETERMINED&&v!==V.UNDETERMINED){const C=this._removePrefix(c);if(C===V.FLOAT&&S===V.INT)return;S!==C&&this._errorHandle(ye(pe.defaultValueTypeErr,{typeE:v,typeR:c}),r)}else c||(n.type=this._typeAddSeries(S===V.INT?V.FLOAT:S))}_exportArgsTypeVerify(n){for(const r of n)(r.type===V.UNDETERMINED||!r.type)&&this._errorHandle(pe.exportFuncArgErr,r.ctx)}_verifyTypeName(n,r){lu.includes(n)?this._errorHandle(ye(pe.typeNameErr,{name:n}),r):Lp.includes(n)&&this._errorHandle(ye(pe.enumVarNameBuiltinErr,{name:n}),r)}_addExportPos(n,r){const{line:a,column:c,text:h}=n;this._exportPositions.push({startLineNumber:a,startColumn:c,endLineNumber:a,endColumn:c+h.length+1,type:r})}_verifyEnumName(n,r){lu.includes(n)?this._errorHandle(ye(pe.enumVarNameErr,{name:n}),r):Lp.includes(n)&&this._errorHandle(ye(pe.enumVarNameBuiltinErr,{name:n}),r)}_nameHandle(n,r,a,c){var d,v;const h={ruleType:le.Name,hasMethod:n,exprs:r,expr:a};if(n){let S="";const C=[];for(const D of r)typeof D=="string"?S=S?`${S}.${D}`:D:(S&&(D.name=`${S}.${D.name}`),C.push(D),S="");h.exprs=[...C,S];const T=this._getMethodTypes(C,Array.from(C,()=>c));if(T&&T.length){const D=ye(pe.noFiledErr,{name:S});T.length>1&&this._errorHandle(D,c),h.type=((v=this._nameCheck(this._getOriginMethodName(T[0],S),c,D))==null?void 0:v.type)||V.UNDETERMINED}}else{let S=r.join(".");if(a&&a.type&&a.type===V.UNDETERMINED)h.type=V.UNDETERMINED,S=`expr0.${S}`;else{a&&a.type&&(S=`${this._getMethodTypeName(a.type)}.${S}`);const C=this._nameCheck(S,c)||{};(d=C.title)!=null&&d.startsWith("built-in")&&(h.isBuiltIn=!0,h.isConst=C.isConst,!this._strategyVarName&&S.startsWith(Ii.strategy)&&(this._strategyVarName={ctx:c,name:S})),h.enumName=C.enumName,h.varPos=C.pos,h.varScope=C.scope,h.declare=C.declare,h.type=(C==null?void 0:C.type)||V.UNDETERMINED,C!=null&&C.isArg&&(h.arg=C),h.scope=this._blockCount,C.isEnum?this._errorHandle(ye(pe.enumUseErr,{name:S}),c):this._isInFunc&&this._currentExportFunc&&(h.type.startsWith(V.INPUT)?this._errorHandle(ye(pe.exportFuncHasInputErr,{name:S,func:this._currentExportFunc}),c):C.scope===0&&C.hasAssigned&&this._errorHandle(ye(pe.exportFuncUseGlobalVarErr,{func:this._currentExportFunc}),c))}h.name=S}return h}_typeElementVerify(n,r,a){var v,S;const{type:c,value:h}=n;if(!h){c||this._errorHandle(pe.typeFieldErr,a);return}if(![le.Literal,le.UnaryExpression].includes(h.ruleType)&&!h.isBuiltIn){this._errorHandle(pe.defaultValueErr,r);return}else if(h.ruleType===le.UnaryExpression){const{exprs:C}=h;if(![le.Literal,le.UnaryExpression].includes((v=C[0])==null?void 0:v.ruleType)&&!((S=C[0])!=null&&S.isBuiltIn)){this._errorHandle(pe.defaultValueErr,r);return}}if(!c){const C=h.type,T=this._getPrefix(C);n.type=T?this._typeAddSeries(this._removePrefix(C)):C;return}(!this._compareType(c,h.type)||c.endsWith(V.INT)&&h.type.endsWith(V.FLOAT))&&this._errorHandle(ye(pe.defaultValueTypeErr,{typeE:h.type,typeR:c}),r)}_memberIndexVerify(n,r){if(n.ruleType===le.Name&&!n.hasMethod&&this._blockCount){const c=this._currentBlockVars[this._blockCount],h=c&&c.get(n.name);h&&(h.isForVar?this._errorHandle(ye(pe.notHistoryErr,{name:n.name}),r):!(this._blockCount===1&&this._isInFunc)&&this._errorHandle(ye(ar.localScopeGetHistory,{name:n.name}),r,Sn.Warning))}const a=n&&n.type;if(a){const c=this._removePrefix(a);!this._types.has(c)&&!this._buildinTypes.has(c)&&!this._isArrayType(c)&&!this._isMatrixType(c)&&!this._isMapType(c)&&c!==V.UNDETERMINED&&this._errorHandle(ye(pe.invalidType,{index:0}),r)}}_setFuncParams(n,r){var a;for(const c of n.params){const h=(a=this._types.get(c.type))==null?void 0:a[0];if(c.scope=this._blockCount+1,h&&h.fields)for(const d of h.fields){const v=`${c.name}.${d.name}`;this._currentFuncParams.set(v,{...d,originName:v,varScope:c.scope})}delete c.ctx,c.range=r,this._setVariablesMap(c,!0),this._currentFuncParams.set(c.name,c)}}_pushBlockRanges(n){!n||!n.start||!n.stop||this._blockRanges.push({startColumn:n.start.column,endColumn:n.stop.column,startLineNumber:n.start.line,endLineNumber:n.stop.line})}_setUserEnum(n,r,a){const{fields:c,name:h,desc:d,fieldsDesc:v}=n,S={members:c.map(C=>({name:C.name,value:C.value,enumName:h,isEnumMember:!0,desc:v==null?void 0:v[C.name],type:`${V.CONST} ${h}`})),name:h,desc:d,pos:r};if(this._enums.has(h)){this._errorHandle(ye(pe.typeRepeatErr,{name:h,keyword:Kt.enum}),a);return}else if(this._types.has(h)){this._errorHandle(ye(pe.typeRepeatErr,{name:h,keyword:Kt.type}),a);return}n.isExport&&this._exportEnums.push(S),this._enums.set(h,[{...S}]),this._addEnumToMap(h,h,r)}_setUserType(n,r,a){const{fields:c,name:h,desc:d,fieldsDesc:v}=n,S={fields:c.map(C=>({name:C.name,desc:v==null?void 0:v[C.name],type:C.type})),name:h,desc:d,pos:r};if(this._enums.has(h)){this._errorHandle(ye(pe.typeRepeatErr,{name:h,keyword:Kt.enum}),a);return}else if(this._types.has(h)){this._errorHandle(ye(pe.typeRepeatErr,{name:h,keyword:Kt.type}),a);return}n.isExport&&this._exportTypes.push(S),this._types.set(h,[{...S}]),this._addVarToMap(h,h,r,!1,!1)}_againAssignHandle(n,r,a){const c=a!==":="?a.replace("=",""):a,h=a!==":="?[V.UNDETERMINED,V.INT,V.FLOAT]:[];c==="+"&&h.push(V.STRING);const[d,v]=n;d.arg&&!d.name.includes(".")&&this._errorHandle(ye(pe.funcArgAssignErr,{name:d.name}),r[0]);const S=this._sameTypeJudge(n,r,c,h);let C=this._typeHandle(S);return this._updateUserVar(d.name,C,v.type),d.type=C,{ruleType:le.AgainAssign,name:d,operator:a,type:C,value:v}}_typeCheck(n,r,a){const c=[V.SERIES,V.SIMPLE,V.CONST];switch(r){case M.RULE_typeName:const h=this._buildinTypes.get(n);h&&![...c,V.ARRAY,V.MATRIX,V.MAP].includes(h[0].name)||this._types.get(n)||this._errorHandle(ye(pe.notTypeKeyword,{text:n}),a);break;case M.RULE_typeArray:[V.ARRAY,V.MATRIX].includes(n)||this._errorHandle(pe.tempateTypeErr,a);break;case M.RULE_typeSeries:c.includes(n)||this._errorHandle(ye(pe.qualifierErr,{name:n}),a);break}}_getBuildVar(n){const r=this._buildinVariables.get(n);if(r&&r[0])return r[0];const a=this._buildinConstants.get(n);return a&&a[0]?Object.assign(a[0],{isConst:!0}):this._specialTreatmentChartPoint(n)}_specialTreatmentChartPoint(n){var r,a;if(n.startsWith("chart.point")){const c=n.split("."),h=c.pop(),d=c.join(".");return(((a=(r=this._buildinTypes.get(d))==null?void 0:r[0])==null?void 0:a.fields)||[]).find(S=>S.name===h)}}_verifyName(n,r){var c,h;const a=this._getBuildVar(n);if(a)return a;if(n.includes(".")){const d=n.split("."),v=d.pop(),S=d.join(".");let C=this._blockCount;for(;C>=0;){if(!this._currentBlockVars[C]){C--;continue}const D=this._currentBlockVars[C].get(S);if(r&&this._judgeGatherValue(v||"",r,D==null?void 0:D.valueType,!0),(D==null?void 0:D.type)==="chart.point"){const P=(((h=(c=this._buildinTypes.get(D.type))==null?void 0:c[0])==null?void 0:h.fields)||[]).find(b=>b.name===v);if(P)return Object.assign(P,{pos:D.pos})}C--}const T=this._specialTreatmentChartPoint(n);if(T)return T}return this._getUserVar(n)}_judgeGatherValue(n,r,a,c){return a!==`${V.SIMPLE} ${V.NA}`?!0:(c&&this._errorHandle(ye(pe.objectIsNaErr,{name:n,type:"field"}),r),!1)}_nameCheck(n,r,a=ye(pe.undeclared,{name:n})){const c=this._verifyName(n,r);return c||this._errorHandle(a,r),c}_inBlock(n){this._blockCount++,this._pushBlockRanges(n);const r=this.visit(n);return this._blockCount--,this._blockRanges.pop(),this._currentBlockVars.splice(this._blockCount+1),r}_errorHandle(n,r,a=Sn.Error){this._errors.push({message:n,startColumn:r.start.column+1,startLineNumber:r.start.line,endColumn:r.start.column+2+r.stop.stop-r.start.start,endLineNumber:r.stop.line,type:a})}_boolTypeJudge(n,r,a,c=0){return this._typeJudge(n,r,a,V.BOOL,[V.UNDETERMINED,V.INT,V.FLOAT,V.BOOL],c)}_calcTypeJudge(n,r,a,c=0){return this._typeJudge(n,r,a,"int/float",[V.UNDETERMINED,V.INT,V.FLOAT],c)}_typeJudge(n,r,a,c,h,d=0){const v=n&&n.type;if(v){const S=this._removePrefix(v);if(!h.includes(S)&&S!==V.NA)return this._errorHandle(ye(pe.typeMismatch,{operator:`operator ${a}`,index:`expr${d}`,typeE:S,typeR:c}),r),V.UNDETERMINED;c===V.BOOL&&[V.INT,V.FLOAT].includes(S)&&this._errorHandle(ye(ar.typeMismatch,{operator:`operator ${a}`,index:`expr${d}`,type:V.BOOL}),r,Sn.Warning)}return v||V.UNDETERMINED}_sameTypeJudge(n,r,a,c){let h="";const d=[],v=["plot_display","plot_simple_display"];["+","-","+=","-="].includes(a)&&(c=c.concat(v));for(const[S,C]of n.entries()){let T=C&&C.type||V.UNDETERMINED;const D=this._removePrefix(T);if(!c.includes(D)&&c.length&&D!==V.NA){this._errorHandle(ye(pe.typeMismatch,{operator:`operator ${a}`,index:`expr${S}`,typeE:T,typeR:c.slice(1).join("/")}),r[S]),h=V.UNDETERMINED,d.push(h);continue}if(!h){h=D,d.push(T);continue}if(h===V.UNDETERMINED||D===V.UNDETERMINED)T=h=V.UNDETERMINED;else if(h!==D&&h!==V.NA&&D!==V.NA&&(![V.INT,V.FLOAT].includes(h)||![V.INT,V.FLOAT].includes(D)))if(a===":="){if(h===V.BOOL&&[V.INT,V.FLOAT].includes(D)){this._errorHandle(ye(ar.boolVarNumWarning,{name:n[0].name}),r[0],Sn.Warning),d.push(T);continue}this._errorHandle(ye(pe.assignTypeMismatch,{typeE:D,name:n[0].name,typeR:h}),r[0]),T=h=V.UNDETERMINED}else if(["==","!=","?:"].includes(a)&&[V.INT,V.FLOAT,V.BOOL].includes(h)&&[V.INT,V.FLOAT,V.BOOL].includes(D))this._errorHandle(ye(ar.typeMismatch,{operator:`operator ${a}`,index:`expr${S}`,type:h}),r[S],Sn.Warning),T=h=V.UNDETERMINED;else if(v.includes(h)&&v.includes(D)){if(h!==D){const L=this._getPrefix(T);d[S-1]=`${this._getPrefix(d[S-1])} ${v[0]}`,T=h=`${L} ${v[0]}`}}else this._errorHandle(ye(pe.typeMismatch,{operator:`operator ${a}`,index:`expr${S}`,typeE:D,typeR:h}),r[S]),T=h=V.UNDETERMINED;d.push(T)}return d}_getUserVar(n,r=!1){for(let a=this._blockCount;a>=0;a--){const c=this._currentBlockVars[a];if(a<=0){const h=this._currentFuncParams.get(n);if(h)return h.isArg=!0,h}if(c){const h=c.get(n);if(h)return h}}if(n.includes(".")&&!r){let a=!1,c=null;if(n.split(".").reduce((h,d)=>{let v=h?`${h}.${d}`:d;const S=this._getUserVar(v,!0);return S!=null&&S.type?S.type===V.UNDETERMINED?a=!0:(v=S.type,c=S):c=null,v},""),a)return{name:n,type:V.UNDETERMINED};if(c)return c}return null}_repeatVarJudge(n,r,a,c){this._getBuildVar(n)&&this._errorHandle(ye(pe.buidinVarErr,{name:n}),r);for(let d=0;d<=this._blockCount;d++){const v=this._currentBlockVars[d];if(v&&v.get(n)){if(this._blockCount===d)return this._errorHandle(ye(pe.repeatVar,{name:n}),r),!0;a.reName=`$_${n}__${this._blockCount}`,this._errorHandle(ye(ar.repeatVar,{name:n}),r,Sn.Warning)}}c!=null&&c.some(d=>d===n&&n!=="_")&&this._errorHandle(ye(pe.repeatVar,{name:n}),r)}_judgeVarBuildIn(n){for(let r=0;r<=this._blockCount;r++){const a=this._currentBlockVars[r];if(a&&a.get(n))return!0}return!1}_updateUserVar(n,r,a){for(let c=0;c<=this._blockCount;c++){const h=this._currentBlockVars[c];if(h){const d=h.get(n);if(d){d.type=r,d.valueType=a;return}}}}_variablesHandle(n,r){var h,d,v,S,C;if(!(n&&n.nameList))return;const a=n.nameList;if(a.name==="_")return;const c=n.value;if(a.ruleType===le.VarMultiple){a.types=[],this._checkVarMultiple(a.names,c,r);for(const[T,D]of a.names.entries()){if(D==="_")continue;const L=this._varTypeJudge("",((h=c==null?void 0:c.types)==null?void 0:h[T])||V.UNDETERMINED,D,r);a.types.push(L),this._addVarToMap(D,L,a.posList[T],!0)}}else{const T=(c==null?void 0:c.type)||((d=c==null?void 0:c.returnedTypes)==null?void 0:d[0]);((v=c==null?void 0:c.types)!=null&&v.isBrackethesized||(S=c==null?void 0:c.returnedTypes)!=null&&S.isBrackethesized||(C=c==null?void 0:c.types)!=null&&C.length)&&this._errorHandle(ye(pe.tupleLeftVarErr,{name:a.name}),r),!a.type&&T===`${V.SIMPLE} ${V.NA}`&&this._errorHandle(pe.naVarErr,r),a.prefix&&Pi.indexOf(a.prefix)>Pi.indexOf(this._getPrefix(T))&&this._errorHandle(ye(pe.declaredErr,{prefix:a.prefix,type:T}),r);const D=this._varTypeJudge(a.type,T||V.UNDETERMINED,a.name,r);a.type=D,this._addVarToMap(a.name,D,a.pos,!0,a.isForVar,a.declare,c==null?void 0:c.type,a.desc)}}_checkVarMultiple(n,r,a){var S,C,T,D;const c=n.length,h=((r==null?void 0:r.types)||(r==null?void 0:r.returnedTypes)||[]).length,d=((S=r==null?void 0:r.types)==null?void 0:S.isBrackethesized)||((C=r==null?void 0:r.returnedTypes)==null?void 0:C.isBrackethesized);(T=r==null?void 0:r.types)!=null&&T.isUnknown||(D=r==null?void 0:r.returnedTypes)!=null&&D.isUnknown||(h===1&&!d||!h?this._errorHandle(pe.tupleRightVarErr,a):c!==h&&this._errorHandle(ye(pe.tupleVarErr,{indexA:h,indexB:c}),a))}_addEnumToMap(n,r,a){var v;const c=this._currentBlockVars[this._blockCount]||new Map,h=(v=this._enums.get(n))==null?void 0:v[0];if(h&&h.members)for(const S of h.members)c.set(`${n}.${S.name}`,S);const d={name:n,isEnum:!0,type:`${V.CONST} ${r}`,pos:a};c.set(n,d),this._currentBlockVars[this._blockCount]=c}_addVarToMap(n,r,a,c=!0,h=!1,d,v,S){var L;const C=this._currentBlockVars[this._blockCount]||new Map,T=(L=this._types.get(r))==null?void 0:L[0];if(T&&T.fields)for(const P of T.fields)C.set(`${n}.${P.name}`,P);const D={name:n,type:r,pos:a,valueType:v,desc:S};c&&this._setVariablesMap(D),C.set(n,Object.assign(D,{isForVar:h,declare:d})),this._currentBlockVars[this._blockCount]=C}_setVariablesMap(n,r=!1){const a=this._blockRanges[this._blockCount];r||(n.range=a,n.scope=this._blockCount);const c=this._variables.get(n.name)||[];c.push(n),this._variables.set(n.name,c)}_varTypeJudge(n,r,a,c){if(r===V.VOID)return this._errorHandle(pe.voidNotVar,c),V.UNDETERMINED;if(n&&r!==V.UNDETERMINED){const h=this._removePrefix(n),d=this._removePrefix(r);return d!==h&&d!==V.NA&&!(h===V.FLOAT&&d===V.INT)?h===V.BOOL&&[V.FLOAT,V.INT].includes(d)?(this._errorHandle(ye(ar.boolVarNumWarning,{name:a}),c,Sn.Warning),n):(this._errorHandle(ye(pe.declareTypeErr,{type:n,valueType:r}),c),V.UNDETERMINED):this._typeHandle([n,r])}else if(r===V.UNDETERMINED)return V.UNDETERMINED;return n||r||V.UNDETERMINED}_getAllowTypes(n){const r=[];if(n===V.UNDETERMINED)return r;const a=this._getPrefix(n);if(a){const c=this._removePrefix(n);let h=-1;for(const[d,v]of Pi.entries())v===a&&(h=d),h>=0&&h<=d&&(c===V.FLOAT&&r.push(`${v} ${V.INT}`),r.push(`${v} ${c}`))}else n=this._arrayTypeConvert(n)||"",r.push(n),n.includes(V.FLOAT)&&r.push(n.replace(/float/,V.INT));return r}_setNewFunc(n,r){const a=`${n.name}.new`,c=[],h=[];for(const v of n.fields)c.push({name:v.name,required:!1,allowedTypeIDs:this._getAllowTypes(v.type),displayType:v.type}),h.push(`${v.type} ${v.name}`);const d={name:a,args:c,returnedTypes:[n.name],pos:r,syntax:[`${a}(${h.join(", ")}) → ${n.name}`]};n.isExport&&this._exportFunctions.push(d),this._functions.set(a,[{...d,isUser:!0}])}_setCopyFunc(n,r){const a=n.name,c=`${a}.copy`,h={name:c,args:[{name:"object",required:!0,allowedTypeIDs:[a],displayType:a}],returnedTypes:[a],pos:r,info:"The identifier of the object to be copied.",syntax:[`${c}(${a} object) → ${a}`]};n.isExport&&this._exportFunctions.push(h),this._functions.set(c,[{...h,isUser:!0}])}_setCopyMethod(n,r){const a=n.name,c=`${a}.copy`,h={name:c,originalName:c,args:[],returnedTypes:[a],thisType:[a],pos:r,syntax:[`${c}() → ${a}`]};n.isExport&&this._exportMethods.push(h),this._methods.set(c,[{...h,isUser:!0}])}_setFunc(n,r,a,c){const h=[],d=[],{desc:v,paramsDesc:S,returnsDesc:C,params:T,hasMemberIndex:D}=n;for(const O of T){const{type:R,name:k,defaultValue:U}=O;h.push({name:k,desc:S==null?void 0:S[k],required:!U,allowedTypeIDs:this._getAllowTypes(R),displayType:R}),d.push(`${R===V.UNDETERMINED?"":`${R} `}${k}`)}const{returnedTypes:L=[]}=n,P=n.name,b=L.length>1||L.isBrackethesized?`[${L.join(", ")}]`:L.toString(),y={name:P,desc:v,args:h,syntax:[`${P}(${d.join(", ")}) → ${b||"void"}`],hasMemberIndex:D,pos:r,isUser:!0,returnedTypes:L,returns:C,hasRequest:this._hasRequest};let g=this._functions.get(P);if(g){const O=g.length;y.index=O,n.index=O,this._verifyFuncRepeat(g,y,a),g.push(y),this._overloadsFuncs.push({name:P,index:O,line:r.lineNumber,startColumn:r.column+1,endColumn:r.column+P.length})}else g=[y];if(n.isExport){const{line:O=0}=this._endExport;c>O&&(this._endExport={line:c,name:P,index:y.index}),this._exportFunctions.push(y)}this._functions.set(P,g)}_setMethod(n,r){var R;const{name:a,returnedTypes:c,params:h,desc:d,paramsDesc:v,returnsDesc:S}=n,C=h[0].type,T=[],D=[];for(const k of h.slice(1)){const{type:U,name:X,defaultValue:J}=k;T.push({name:X,desc:v==null?void 0:v[X],required:!J,allowedTypeIDs:this._getAllowTypes(U),displayType:U}),D.push(`${U} ${X}`)}const L=c.length>1||c.isBrackethesized?`[${c.join(", ")}]`:c.toString(),P=this._getMethodTypeName(C),b=`${P}.${a}`;n.typeName=P;const y={name:a,args:T,desc:d,originalName:b,syntax:[`${a}(${D.join(", ")}) → ${L||"void"}`],returnedTypes:c,hasMemberIndex:n.hasMemberIndex,pos:r,thisType:[C],returns:S,hasRequest:this._hasRequest};let g=this._methods.get(b),O=this._functions.get(a);if(O){const k=O.filter(J=>!J.isImport).length,U=((R=g==null?void 0:g.filter(J=>!J.isImport))==null?void 0:R.length)||0;let X=k;k>U&&(X=k-1),y.index=X,n.index=X}g?g.push(y):g=[y],n.isExport&&this._exportMethods.push(y),this._methods.set(b,g)}_verifyFuncRepeat(n,r,a){const{args:c}=r;n.some(d=>{const{args:v}=d;return(v==null?void 0:v.length)!=(c==null?void 0:c.length)?!1:!(v!=null&&v.length)&&!(c!=null&&c.length)?!0:v==null?void 0:v.every((S,C)=>{var T;return S.displayType===((T=c==null?void 0:c[C])==null?void 0:T.displayType)})})&&this._errorHandle(ye(pe.funcRepeatErr,{name:r.name}),a)}_getMethodTypes(n,r){let a;for(const[c,h]of n.entries()){const{type:d,expr:v,args:S}=h;let{name:C}=h;const T=r[c];if(v){if(v.type===V.UNDETERMINED)return[V.UNDETERMINED];C=`${this._getMethodTypeName(v.type)}${C}`,S.params.unshift(v)}if(a&&a.length>=1)if(a.length===1){const D=a[0];if(D===V.UNDETERMINED)return[V.UNDETERMINED];const L=this._getOriginMethodName(D,C);C.includes(".")?a=this._getOtherNamesMethodType(L,a,T,S,h):a=this._expandMethodHandle(L,T,S,{type:D},D,h)}else this._errorHandle(ye(pe.noFiledErr,{name:C}),T);else{const[D,L]=this._tempFuncNameHandle(C,T,d);C=L;const P=this._buildinFunctions.get(D);if(P)this._globalFuncVerify(P[0],T),this._hasMemberIndexVerify(P[0],T,h),h.isBuiltIn=!0,a=this._getBuildInReturnTypes(P,S,C,T,void 0,d);else{const b=this._functions.get(C);if(b)if(b.length<=1){this._hasMemberIndexVerify(b[0],T,h),a=b[0].returnedTypes;const{hasErr:y}=this._checkArgs(S,b[0].args||[],C,T,a[0]);if(y)return[V.UNDETERMINED]}else{const y=this._overloadsFuncGetTypes(b,S,T,void 0,h);a=this._returnedTypesParse([y])}else a=this._getOtherNamesMethodType(C,a,T,S,h)}}h.returnTypes=a}return a===void 0&&this._errorHandle(ye(pe.notFindFuncErr,{name:n[0].name}),r[0]),a}_globalFuncVerify(n,r){this._blockCount!==0&&$_.includes(n.name)&&this._errorHandle(ye(pe.globalFuncErr,{name:n.name}),r)}_hasMemberIndexVerify(n,r,a){n.hasRequest&&(a.hasRequest=!0,this._hasRequest=!0),n.hasMemberIndex||n.name.startsWith("ta.")||n.name==="math.sum"?(this._hasMemberIndex=this._isInFunc,a.hasMemberIndex=!0,a.position=r.start.tokenIndex):n.name.startsWith("request.")&&this._isInLocalScop&&this._errorHandle(pe.requestUserInLoopErr,r)}_tempFuncNameHandle(n,r,a){let c=n;if(a&&a.length>=1){const h=["array.new","matrix.new"].includes(n),d=n==="map.new";if(a.length===1)if(h)c=`${n}<type>`,n=`${n}<${a[0]}>`;else return d?this._errorHandle(ye(pe.templateErr,{countA:2,countB:1}),r):this._errorHandle(ye(pe.templateNoSupportErr,{name:n}),r),[V.UNDETERMINED];else{if(!d)return h?this._errorHandle(ye(pe.templateErr,{countA:1,countB:2}),r):this._errorHandle(ye(pe.templateNoSupportErr,{name:n}),r),[V.UNDETERMINED];if(!lu.includes(a[0]))return this._errorHandle(ye(pe.mapKeyErr,{type:this._typeAddSeries(a[0])}),r),[V.UNDETERMINED];c=`${n}<type,type>`,n=`${n}<${a[0]},${a[1]}>`}}return[c,n]}_getOtherNamesMethodType(n,r,a,c,h){const d=n.split("."),v=d.length-1,S=d.slice(0,v).join("."),C=this._getUserVar(S);this._judgeGatherValue(d[v],a,C==null?void 0:C.valueType)||(h.name=`${S}?.${d[v]}`);const D=C==null?void 0:C.type;if(D){if(D===V.UNDETERMINED)return r=[V.UNDETERMINED],r.isUnknown=!0,r;const L=this._getOriginMethodName(D,d[v]);h.varScope=C.scope,r=this._expandMethodHandle(L,a,c,C,S,h)}else{let L="",P="",b="";for(const y of d.slice(0,v)){L?P=this._getOriginMethodName(L,y):P=P?`${P}.${y}`:y;const g=this._verifyName(P);if(g!=null&&g.type){if(L=g.type,b="",g.title.startsWith("built-in variable")){const O=this._getOriginMethodName(L,d[v]);r=this._expandMethodHandle(O,a,c,g,S,h),h.hasVarPrefix=!0}}else this._buildinTypes.get(P)?b=ye(pe.methodNotExistErr,{name:P,methodName:d[v]}):b=ye(pe.noFiledErr,{name:y})}b&&this._errorHandle(b,a)}return r}_expandMethodHandle(n,r,a,c,h,d){var C,T;let v;const S=this._buildinMethods.get(n);if(S)d.name=d.name.split(".").join("?.").replace("??","?"),v=this._getBuildInReturnTypes(S,a,n,r,c);else{const D=this._methods.get(n);if(D&&D.length)if(D.length<=1){const L=D[0],P=this._getMethodTypeName(((C=L.thisType)==null?void 0:C[0])||"");if(this._types.get(P))d.name=d.name.split(".").join("?.").replace("??","?");else{const g=this._functions.get(L.name);g&&(d.selfArg=(T=g[L.index||0].args)==null?void 0:T[0])}d.funcName=L.name,d.index=L.index,this._hasMemberIndexVerify(L,r,d),v=L.returnedTypes;const{hasErr:y}=this._checkArgs(a,L.args||[],n,r,(v==null?void 0:v[0])||"");if(y)return[V.UNDETERMINED]}else{const L=this._overloadsFuncGetTypes(D,a,r,c,d);v=this._returnedTypesParse([L])}else this._errorHandle(ye(pe.methodNotExistErr,{methodName:n.split(".").slice(-1)[0],name:h}),r)}return v}_getBuildInReturnTypes(n,r,a,c,h,d){var S;let v;if(n.length===1){const{returnedTypes:C,syntax:T,args:D=[],thisType:L}=n[0],P=T[0].split("→")[1].trim(),b=h||r.params[0]||((S=D[0])==null?void 0:S.name)&&r[D[0].name];b&&!this._checkMethodThisType(L,b.type)&&this._errorHandle(ye(pe.typeMismatch,{operator:a,index:b.name||"id",typeE:b.type,typeR:L[0]}),c);const{hasErr:y,types:g}=this._checkArgs(r,D,a,c,P,b);if(y)return[V.UNDETERMINED];if(v=g.length&&g||this._returnedTypesParse(C),v.length>1||v.isBrackethesized)return v;(d==null?void 0:d.length)===1?v=[this._typeReplace(P,d[0])]:(d==null?void 0:d.length)===2&&(v=[`${V.MAP}<${d[0]},${d[1]}>`]),v=this._returnTypesOtherHandle(b,P,v,a)}else{const C=this._overloadsFuncGetTypes(n,r,c,h);v=this._returnedTypesParse([C])}return v}_overloadsFuncGetTypes(n,r,a,c,h){var P,b,y;let d="",v=[],S=[],C=0,T=0;for(const[g,O]of n.entries()){const{args:R,returnedTypes:k,name:U,thisType:X}=O,J=c||r.params[0]||r[R[0].name],{errMsg:G,warnMsg:Y,matchCount:$}=this._overloadsCheckArgs(r,R,U,a,J);$>T&&(C=g,T=$),J&&!this._checkMethodThisType(X,J.type)&&G.unshift({msg:ye(pe.typeMismatch,{operator:U,index:J.name||"id",typeE:J.type,typeR:X[0]}),ctx:a}),g===0?(v=G,S=Y,!G.length&&(d=k[0])):G.length?((P=v[0])!=null&&P.isLenErr&&!((b=G[0])!=null&&b.isLenErr)||v.length>G.length)&&(v=G,S=Y,C=g):this._priorityComparison(d,k[0])||(k[0]===`${V.ARRAY}<>`?d=`${J.type}[]`:d=k[0],v=G,S=Y,C=g)}for(const g of v)this._errorHandle(g.msg,g.ctx);for(const g of S)this._errorHandle(g.msg,g.ctx,Sn.Warning);const D=a.children[0],L=n[0].name;if(D&&this._overloadsFuncs.push({name:L,index:C,line:D.start.line,startColumn:D.start.column+1,endColumn:D.start.column+L.length}),h){const g=n[C],{thisType:O,name:R,index:k}=g;if(this._hasMemberIndexVerify(g,a,h),h.index=k||C,O){const U=this._getMethodTypeName((O==null?void 0:O[0])||"");if(this._types.get(U))h.name=h.name.split(".").join("?.").replace("??","?");else{const J=this._functions.get(R);J&&(h.selfArg=(y=J[0].args)==null?void 0:y[0])}}}return this._funcArgsAddOriginName(r,n[C].args,L),d||V.UNDETERMINED}_funcArgsAddOriginName(n,r,a){const c=n.params||[];for(const[h,d]of r.entries())h<c.length&&(c[h].originName=d.name);if(a==="input"){const h=c[0]||n.defval;Object.assign(n,{inputType:{name:`'${h!=null&&h.isSourceType?"source":this._removePrefix(h==null?void 0:h.type)}'`}})}}_overloadsCheckArgs(n,r,a,c,h){const d={...n},v=d.params;delete d.params;const S=Object.keys(d).length+v.length,C=r.length,T=[],D=[];let L=0;S>C&&(r.some(b=>["arg0, arg1, ...","number0, number1, ..."].includes(b.name))||T.push({msg:ye(pe.argsLenErr,{name:a,lenA:S,lenB:C}),isLenErr:!0,ctx:c}));for(const[P,b]of r.entries()){let y=d[b.name];if(P<v.length&&(y&&T.push({msg:ye(ar.moreSameArg,{arg:b.name}),ctx:c}),y=v[P]),!y)b.required&&T.push({msg:ye(pe.requiredParamErr,{name:a,argName:b.name}),ctx:c});else{const g=y.type!==`${V.SIMPLE} na`?this._checkArg(y,b,a,h,y.ctx,!0,D):"";g?T.push({msg:g,ctx:y.ctx}):L++,delete d[b.name]}if(["arg0, arg1, ...","number0, number1, ..."].includes(b.name)&&v.length>P+1){const g=v.slice(P+1);let O=v[P];for(const R of g){O.type===`${V.SIMPLE} ${V.NA}`&&(O=R);const k=R.type!==`${V.SIMPLE} ${V.NA}`?this._checkArg(R,b,a,O,R.ctx,!0,D):"";k&&T.push({msg:k,ctx:R.ctx})}}}if(Object.keys(d).length)for(const P of Object.keys(d))T.push({msg:ye(pe.argsNameErr,{name:a,argName:P}),ctx:d[P].ctx});return{errMsg:T,warnMsg:D,matchCount:L}}_checkArgs(n,r,a,c,h,d){var P,b;const v={...n},S=v.params;delete v.params;const C=Object.keys(v).length+S.length,T=r.length;let D=!1,L=[];if(C>T&&!r.some(g=>["arg0, arg1, ...","number0, number1, ..."].includes(g.name)))return this._errorHandle(ye(pe.argsLenErr,{name:a,lenA:C,lenB:T}),c),D=!0,{hasErr:D,types:L};for(const[y,g]of r.entries()){let O=v[g.name];if(y<S.length&&(O&&this._errorHandle(ye(ar.moreSameArg,{arg:g.name}),c,Sn.Warning),O=S[y],O.originName=g.name),!O)g.required&&(this._errorHandle(ye(pe.requiredParamErr,{name:a,argName:g.name}),c),D=!0);else{const R=O.type!==`${V.SIMPLE} ${V.NA}`?this._checkArg(O,g,a,d,O.ctx):"";if(R)this._errorHandle(R,O.ctx),D=!0;else if(a.startsWith("request.")&&g.name==="expression")if(O.ruleType===le.Brackethesized)L=O.exprs.map(k=>this._typeReplace(h,k.type));else if((P=O.types||O.returnedTypes)!=null&&P.length)L=(O.types||O.returnedTypes).map(k=>this._typeReplace(h,k)),(b=O.types||O.returnedTypes)!=null&&b.isBrackethesized&&Object.assign(L,{isBrackethesized:!0});else{const k=this._typeReplace(h,O.type);L.push(k)}else if(a==="input.enum"&&g.name==="defval"){const k=this._removePrefix(O.type);L.push(`${V.INPUT} ${k}`)}delete v[g.name]}}if(Object.keys(v).length)for(const y of Object.keys(v))this._errorHandle(ye(pe.argsNameErr,{name:a,argName:y}),v[y].ctx),D=!0;return{hasErr:D,types:L}}_checkArg(n,r,a,c,h,d,v){var y,g;const{ruleType:S,exprs:C,name:T}=n;let D=n.type;S===le.Brackethesized&&(D=`[${C.map(O=>O.type).join(", ")}]`);const{allowedTypeIDs:L=[],displayType:P,name:b}=r;if(!(!D||D===V.UNDETERMINED||P===V.UNDETERMINED)){if(a==="input"&&b==="defval"&&!D.startsWith(V.CONST))if(Cl.includes(T))n.isSourceType=!0;else return pe.inputDefvalErr;if(!(this._checkMethodThisType(L,this._arrayTypeConvert(D))&&!(["input.source","input.enum"].includes(a)&&b==="defval"))){if(b==="condition"&&(P!=null&&P.endsWith(V.BOOL))){if(D.endsWith(V.INT)||D.endsWith(V.FLOAT)){const O=ye(ar.typeMismatch,{index:b,operator:a,type:V.BOOL});h&&(v?v.push({ctx:h,msg:O}):this._errorHandle(O,h,Sn.Warning));return}}else if(a==="str.tostring"&&b==="value"){const O=this._removePrefix(D);if(this._enums.get(O))return}switch(P){case"tuple of const string values: [val1, val2, ...]":return this._tupleToCheck(n,r,[`${V.CONST} ${V.STRING}`],a,D);case"tuple of const int/float values: [val1, val2, ...]":return this._tupleToCheck(n,r,[`${V.CONST} ${V.FLOAT}`,`${V.CONST} ${V.INT}`],a,D);case"tuple of const int values: [val1, val2, ...]":return this._tupleToCheck(n,r,[`${V.CONST} ${V.INT}`],a,D);case"open/high/low/close/hl2/hlc3/ohlc4/hlcc4":if(!T||!Cl.includes(T))return ye(pe.inputSourceErr,{name:b,funcName:a});if(this._judgeVarBuildIn(T))return ye(pe.buildInUseErr,{name:T});n.isSourceType=!0;break;case"<matrix_type>":case"<array_type>":const O=this._getArrayType(a)||"";if(!D.endsWith(O)&&!(D.endsWith(V.INT)&&O===V.FLOAT))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:this._typeAddSeries(O)});break;case"any matrix type":if(this._isMatrixType(D)){if(b==="id2"){const $=this._getArrayType(c==null?void 0:c.type);if(!$)return;const te=this._getArrayType(D)||"";if($!==te)return ye(pe.typeMismatch,{operator:a,index:b,typeE:te,typeR:$})}}else return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"matrix<fun_arg>"});break;case"any array type":if(this._isArrayType(D)){if(b==="id2"){const $=this._getArrayType(c==null?void 0:c.type);if(!$)return;const te=this._getArrayType(D)||"";if($!==te)return ye(pe.typeMismatch,{operator:a,index:b,typeE:te,typeR:$})}}else return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"array<fun_arg>"});break;case"series <type of the matrix's elements>":case"series <type of the array's elements>":const R=this._getArrayType(c==null?void 0:c.type)||"";if(!D.endsWith(R)&&!(D.endsWith(V.INT)&&R===V.FLOAT))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:this._typeAddSeries(R)});break;case"any map type":if(this._isMapType(D)){if(b==="id2"){const $=this._getMapType(c==null?void 0:c.type);if(!$)return;const te=this._getMapType(D)||[];if($[0]!==te[0]||$[1]!==te[1])return ye(pe.mapKeyValErr,{typeA:this._typeAddSeries(te[0]),typeB:this._typeAddSeries(te[1]),typeC:this._typeAddSeries($[0]),typeD:this._typeAddSeries($[1]),name:a})}}else return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"map<type, type>"});break;case"series <type of the map's elements>":const k=this._getMapType(c==null?void 0:c.type);if(!k)return;const U=b==="key"?0:1;if(!D.endsWith(k[U])&&!(D.endsWith(V.INT)&&k[U]===V.FLOAT))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:this._typeAddSeries(k[U])});break;case"<arg_expr_type>":if(S===le.Brackethesized)return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:P||""});break;case"<arg_type>":case"variable, function, object, array or matrix of series int/float/bool/string/color, or a tuple of these":const X=this._removePrefix(D);if([V.BOX,V.LABEL,V.LINE,V.LINEFILL,V.POLYLINE,V.TABLE].includes(X))return ye(pe.requestExprErr,{type:X,name:a});break;case"variable, object or function of series int/float/bool/string/color, or a tuple of these":if(S===le.Brackethesized){for(const $ of C)if(!L.includes($.type))return ye(pe.requestArgsErr,{name:a,argName:b,type:$.type})}break;case"const int/float/bool/string/color or source-type built-ins":if(Cl.includes(n.name)&&L[0].endsWith(this._removePrefix(D)))n.isSourceType=!0;else return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"const int/float/bool/string/color"});break;case"<arg..._type>":if(S===le.Brackethesized||this._isArrayType(D)||this._isMapType(D)||this._isMatrixType(D))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:`${V.SERIES} ${V.INT}`});if(D!==(c==null?void 0:c.type))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:c==null?void 0:c.type});break;case"simple enum":const J=this._removePrefix(D);if(!this._enums.has(J))return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:"const enum"});break;case"tuple of enum fields: [enumName.field1, enumName.field2, ...]":const G=c==null?void 0:c.enumName;if(G&&!((y=n.exprs)==null?void 0:y.every(te=>te.enumName===G)))return ye(pe.typeMismatch,{operator:a,index:b,typeE:`${n.exprs?`[${(g=n.exprs)==null?void 0:g.map(te=>te.type).join(", ")}]`:n.type}`,typeR:`[const ${G}...]`});break;default:const Y=this._removePrefix(n.type);if(n.arg&&n.arg.isArg&&!d){const $=L.find(te=>te.endsWith(Y));if($){n.type=$,n.arg.type=$;return}}if(L.length===1&&this._removePrefix(L[0])===Y){const $=this._getPrefix(n.type),te=this._getPrefix(L[0]);if(Pi.indexOf($)>=Pi.indexOf(te))return}if(P)return ye(pe.typeMismatch,{operator:a,index:b,typeE:D,typeR:P})}}}}_tupleToCheck(n,r,a,c,h){var d,v;if(a.push(`${V.SIMPLE} ${V.NA}`),n.ruleType===le.Brackethesized){const S=[];let C=!1;for(const T of n.exprs)S.push(T.type),a.includes(T.type)||(C=!0);if(C)return ye(pe.typeMismatch,{operator:c,index:r.name,typeE:`[${S.join(", ")}]`,typeR:((d=r.allowedTypeIDs)==null?void 0:d[0])||""})}else return ye(pe.typeMismatch,{operator:c,index:r.name,typeE:h,typeR:((v=r.allowedTypeIDs)==null?void 0:v[0])||""})}_getBlockReturnTypes(n){var D,L;let r=n;if(Array.isArray(n)&&(r=n.slice(-1)[0],Array.isArray(r)&&(r=r.slice(-1)[0])),!r)return[V.UNDETERMINED];const{ruleType:a,type:c,types:h,returnedTypes:d,exprs:v,nameList:S,typeList:C,block:T}=r;if(h&&h.length)return h;if(d&&d.length)return d;if(c)return[c];switch(a){case le.Brackethesized:const P=v.map(J=>J.type);return P.isBrackethesized=!0,P;case le.VarBlockStmt:case le.DeclareAssign:return S?S.ruleType===le.VarMultiple?S.types:[S.type]:[((D=r.name)==null?void 0:D.type)||V.UNDETERMINED];case le.SwitchStatement:if(!this._isNeedCalc&&this._isInFunc&&this._isEndExpr===!1)return[V.UNDETERMINED];const b=[...r.cases];r.defaultCase&&b.push(r.defaultCase);let y=((L=b[0])==null?void 0:L.returnedTypes)||[],g=y.length<=1?y[0]:`[${y.join(", ")}]`,O=null;for(const J of b.slice(1)){const G=J.returnedTypes||[V.UNDETERMINED];g+=G.length<=1?`; ${G[0]}`:`; [${G.join(", ")}]`;const Y=Array.isArray(J.block)?J.block.slice(-1)[0]:J.block;if(G.length!==y.length)O=Y.ctx;else for(const[$,te]of y.entries())if(this._compareType(G[$],te))(G[$].includes(V.FLOAT)&&!te.includes(V.FLOAT)||y[$]===`${V.SIMPLE} ${V.NA}`||y[$]===V.UNDETERMINED)&&(y[$]=G[$]);else{O=Y.ctx;break}}return O&&(this._errorHandle(ye(pe.ifOrSwitchTypeErr,{keyword:"switch",types:g}),O),y=y.map(()=>V.UNDETERMINED)),r.returnedTypes=y,y;case le.IfStatement:if(!this._isNeedCalc&&!this._isInFunc)return[V.UNDETERMINED];if(!C.filter(J=>J&&J.length).length)return[V.UNDETERMINED];let R=C[0]||[],k=R.length<=1?R[0]:`[${R.join(", ")}]`,U=0,X=0;for(const J of C.slice(1))if(J)if(U++,k+=J.length<=1?`; ${J[0]}`:`; [${J.join(", ")}]`,J.length!==R.length)X=U;else for(const[G,Y]of R.entries())if(this._compareType(J[G],Y))(J[G].includes(V.FLOAT)&&!Y.includes(V.FLOAT)||R[G]===`${V.SIMPLE} ${V.NA}`)&&(R[G]=J[G]);else{X=U;break}if(X){const J=T[X].slice(-1)[0],G=Array.isArray(J)?J.slice(-1)[0]:J;this._errorHandle(ye(pe.ifOrSwitchTypeErr,{keyword:"if",types:k}),G.ctx),R=R.map(()=>V.UNDETERMINED)}return r.returnedTypes=R,R}return[V.UNDETERMINED]}}class J_{constructor(e){w(this,"_nameMap");w(this,"_prefixNameVar");w(this,"_prefixNameFunc");w(this,"_prefixNameConst");w(this,"_userTypes");w(this,"_isInFunc");w(this,"_currentFuncName");w(this,"_varlist");w(this,"_memberIndexList");w(this,"_blockCount");w(this,"_inputCount");w(this,"_count");w(this,"_isSwitch",!1);w(this,"_isInLoop",!1);w(this,"_codesCol");w(this,"_dependsObj");w(this,"_enums");w(this,"_preRunMembers");w(this,"_isInConditionalStmt",!1);w(this,"_preRunMembersFuncs");w(this,"_preRunMemberFuncsCount",0);w(this,"__count",0);w(this,"preParseCode","");w(this,"_hasLeftVisibleBarTime",!1);w(this,"_hasRightVisibleBarTime",!1);this._nameMap=new Map,this._prefixNameVar=`${e}_var`,this._prefixNameFunc=`${e}_func`,this._prefixNameConst=`${e}_const`,this._userTypes=[],this._isInFunc=!1,this._varlist=[{}],this._memberIndexList=[{}],this._blockCount=0,this._inputCount=0,this._count=0,this._codesCol=[[]],this._dependsObj={},this._enums=new Map,this._preRunMembers=[],this._preRunMembersFuncs=[]}preParser(e){var r,a;const n=[];for(const c of e){if(!c)return;if(Array.isArray(c)){for(const h of c)if(n.push(this._parserStmt(h)),fu.includes((a=(r=h.exprs)==null?void 0:r[0])==null?void 0:a.name))return n.join(`;
|
14
14
|
`).replace(/;+/g,";")}else n.push(this._parserStmt(c))}return""}parser(e){var a,c;const n=[];for(const h of e){if(!h)return;if(Array.isArray(h))for(const d of h)n.push(this._parserStmt(d)),!this.preParseCode&&fu.includes((c=(a=d.exprs)==null?void 0:a[0])==null?void 0:c.name)&&(this.preParseCode=n.join(`;
|
15
|
-
`).replace(/;+/g,";"));else n.push(this._parserStmt(h))}const r=this._memberIndexList[this._blockCount]||{};return n.push(...Object.values(r)),n.join(`;
|
16
|
-
`).replace(/;+/g,";")}_parserStmt(e,n=!1){let r="";switch(e==null?void 0:e.ruleType){case le.DeclareAssign:r=this._parserDeclareAssign(e);break;case le.MethodExpression:r=`${this._parserMethodExpression(e)}`;break;case le.ArrowFunction:r=this._parserArrowFunction(e);break;case le.ArrowMethod:r=this._parserArrowMethod(e);break;case le.IfStatement:r=this._parserIfStatement(e,n);break;case le.WhileStatement:r=this._parserWhileStatement(e,n);break;case le.SwitchStatement:r=this._parserSwitchStatement(e,n);break;case le.ForInStatement:r=this._parserForInStatement(e,n);break;case le.ForToStatement:r=this._parserForToStatement(e,n);break;case le.AgainAssign:r=this._parserAgainAssign(e);break;case le.ImportElement:r=e.code||"";break;case le.TypeStatement:r=this._parserTypeStatement(e);break;case le.VarBlockStmt:r=this._parserVarBlockStmt(e);break;case le.FlowStmt:if(this._isSwitch&&e.value==="break"){if(this._isInLoop){r="$$isBreak = true;";break}r="";break}r=`${e.value};`;break;case le.Brackethesized:r=this._parserBrackethesized(e);break;case le.EnumStatement:r=this._parserEnumStatement(e);break;default:r=this._parserSingleExpression(e);break}let a="";const c=this._preRunMembersFuncs[this._blockCount];c!=null&&c.length&&(a=c.join(`;
|
15
|
+
`).replace(/;+/g,";"));else n.push(this._parserStmt(h))}const r=this._memberIndexList[this._blockCount]||{};return n.push(...Object.values(r)),{code:n.join(`;
|
16
|
+
`).replace(/;+/g,";"),hasLeftVisibleBarTime:this._hasLeftVisibleBarTime,hasRightVisibleBarTime:this._hasRightVisibleBarTime}}_parserStmt(e,n=!1){let r="";switch(e==null?void 0:e.ruleType){case le.DeclareAssign:r=this._parserDeclareAssign(e);break;case le.MethodExpression:r=`${this._parserMethodExpression(e)}`;break;case le.ArrowFunction:r=this._parserArrowFunction(e);break;case le.ArrowMethod:r=this._parserArrowMethod(e);break;case le.IfStatement:r=this._parserIfStatement(e,n);break;case le.WhileStatement:r=this._parserWhileStatement(e,n);break;case le.SwitchStatement:r=this._parserSwitchStatement(e,n);break;case le.ForInStatement:r=this._parserForInStatement(e,n);break;case le.ForToStatement:r=this._parserForToStatement(e,n);break;case le.AgainAssign:r=this._parserAgainAssign(e);break;case le.ImportElement:r=e.code||"";break;case le.TypeStatement:r=this._parserTypeStatement(e);break;case le.VarBlockStmt:r=this._parserVarBlockStmt(e);break;case le.FlowStmt:if(this._isSwitch&&e.value==="break"){if(this._isInLoop){r="$$isBreak = true;";break}r="";break}r=`${e.value};`;break;case le.Brackethesized:r=this._parserBrackethesized(e);break;case le.EnumStatement:r=this._parserEnumStatement(e);break;default:r=this._parserSingleExpression(e);break}let a="";const c=this._preRunMembersFuncs[this._blockCount];c!=null&&c.length&&(a=c.join(`;
|
17
17
|
`),this._preRunMembersFuncs[this._blockCount]=[]);const h=this._preRunMembers[this._blockCount];if(h!=null&&h.length&&(a=`${a}
|
18
18
|
${h.join(`;
|
19
19
|
`)}`,this._preRunMembers[this._blockCount]=[]),a){const d=this._codesCol[this._blockCount].pop(),v=r===(d==null?void 0:d.code);r=`${a}${n?`
|
@@ -116,7 +116,7 @@ ${this._prefixNameVar}.setVarValue("${v}", ${y}, ${v}, "${h}")`}n==="-="?L=`${v}
|
|
116
116
|
`}return this._isInFunc=!1,this._currentFuncName="",this._codesCol[this._blockCount].push({funcName:n,depends:this._getDepends(n),hasRequest:e.hasRequest,code:d}),d}_parserArrowFunction(e){let n=`$_${e.name}`;this._nameMap.set(e.name,n);const r=[...e.params];n=`${n}${e.index?`$${e.index}`:""}`,this._currentFuncName=n,this._dependsObj[n]=new Map;const a=e.hasRequest?", $paramsExpr":"",c=`const ${n} = (${this._parserParameters(r)}$posStr${a}) => {
|
117
117
|
${this._parserBlock(e.block,!0,!0)}
|
118
118
|
}`;return this._isInFunc=!1,this._currentFuncName="",this._codesCol[this._blockCount].push({funcName:n,depends:this._getDepends(n),hasRequest:e.hasRequest,code:c}),c}_parserParameters(e){return e.length?`{${e.map(n=>{const{name:r,defaultValue:a}=n;let c=r;if(a){const h=this._parserSingleExpression(a);c=`${c} = ${h}`}return c}).join(", ")}},`:""}_parserBlock(e,n=!1,r=!1){return r&&(this._isInFunc=!0),this._parserBlockLine(Array.isArray(e)?e:[e],n,r)}_addVarList(e){var r,a;const n=this._varlist[this._blockCount]||{};if(e.names){const c=e.posList;for(const[h,d]of e.names.entries()){const v=((r=c[h])==null?void 0:r.reName)||d;n[v]=c[h]}}else{const c=((a=e.pos)==null?void 0:a.reName)||e.name;n[c]=e.pos}this._varlist[this._blockCount]=n}_parserDeclareAssign(e){var S;const{nameList:n,value:r}=e,a=this._parserDeclareAssignNames(n);this._addVarList(n);const c={code:"",varNames:a.replace(/[\[\]]/g,"").split(", "),depends:[]},h=`$${a}_${this._blockCount}`;this._dependsObj[h]=new Map;const d=this._parserSingleExpression(r);let v=`let ${a} = ${d}`;if(n.declare){const C=`${n.pos.column}_${n.pos.lineNumber}`,T=this._isInFunc?`$posStr + "_${C}"`:`"${C}"`;v=`let ${a} = ${this._prefixNameVar}.verifyVarAndVarip("${a}", ${T}, "${n.declare}") ? ${this._prefixNameVar}.getVarValue("${a}", ${T}, "${n.declare}") : ${this._prefixNameVar}.setVarValue("${a}", ${T}, ${d}, "${n.declare}")`}return c.code=v,c.depends=this._getDepends(h),(S=this._codesCol[this._blockCount])==null||S.push(c),v}_parserDeclareAssignNames(e){var n,r;switch(e==null?void 0:e.ruleType){case"VarMultiple":const a=e.posList;return`[${e.names.map((c,h)=>{var d,v;return c==="_"?(this.__count++,`_$$${this.__count}`):(d=a[h])!=null&&d.reName?(v=a[h])==null?void 0:v.reName:wn.includes(c)?`$${c}`:c}).join(", ")}]`;case"VarSingle":return e.name==="_"?(this.__count++,`_$$${this.__count}`):(n=e.pos)!=null&&n.reName?(r=e.pos)==null?void 0:r.reName:wn.includes(e.name)?`$${e.name}`:e.name}return""}_parserSingleExpression(e){if(!e)return"";const{exprs:n,operator:r}=e;let a="",c=this._isInConditionalStmt;switch(e.ruleType){case le.MemberIndexExpression:return this._parserMemberIndexExpression(e);case le.MethodExpression:return this._parserMethodExpression(e);case le.UnaryExpression:return`${r}${this._parserSingleExpression(n[0])}`;case le.NotExpression:return`!${this._parserSingleExpression(n[0])}`;case le.AdditiveExpression:return this._parserAdditiveExpression(e);case le.MultiplicativeExpression:case le.RelationalExpression:case le.EqualityExpression:return`${this._parserSingleExpression(n[0])} ${r} ${this._parserSingleExpression(n[1])}`;case le.LogicalAndExpression:return this._isInConditionalStmt=!0,a=`${this._parserSingleExpression(n[0])} && ${this._parserSingleExpression(n[1])}`,this._isInConditionalStmt=c,a;case le.LogicalOrExpression:return this._isInConditionalStmt=!0,a=`${this._parserSingleExpression(n[0])} || ${this._parserSingleExpression(n[1])}`,this._isInConditionalStmt=c,a;case le.TernaryExpression:return a=`${this._parserSingleExpression(n[0])} ? ${this._parserSingleExpression(n[1])} : ${this._parserSingleExpression(n[2])}`,a;case le.Name:return this._parserName(e);case le.Literal:return this._parseLiteral(e);case le.ParenthesizedExpression:return`(${this._parserSingleExpression(e.exprs)})`;default:return e.name||""}}_parserAdditiveExpression(e){const{exprs:n,operator:r}=e,a=this._parserSingleExpression(n[0]),c=this._parserSingleExpression(n[1]);return r==="-"?`${this._prefixNameVar}.sub(${a}, ${c})`:`${this._prefixNameVar}.add(${a}, ${c})`}_parserMemberIndexExpression(e){var C;const{exprs:n,isInFunc:r,ctx:a}=e,c=n[0],h=this._parserSingleExpression(n[1]);let d=this._parserSingleExpression(c);const v=a.start.tokenIndex,S=r?"$posStr":v;if(c.ruleType===le.Name&&!c.hasMethod){let T=this._blockCount;const D=((C=c.varPos)==null?void 0:C.reName)||c.name;for(;T>=0;){const L=this._varlist[T]||{},P=L[D];if(P)return this._getUserVarMemberIndexs(P,D,T,h,r);if(c.isBuiltIn){const b=this._memberIndexList[0]||{};return b[D]=`${this._prefixNameVar}.setCacheData("${D}", ${d})`,`${this._prefixNameVar}.getCacheData("${D}", ${h}, ${d})`}if(D.includes(".")){const b=D.split(".")[0],y=L[b];if(y)return this._getUserVarMemberIndexs(y,D,T,h,r)}T--}return this._getOtherVarMemberIndexs(`${D}_${c.varScope||c.scope}`,D,c.varScope||c.scope,h,r)}else{const T=this._preRunMembers[this._blockCount]||[],D=`$$m${v}_${S}`;T.push(`const ${D} = ${d};
|
119
|
-
${this._prefixNameVar}.setCacheData("m${v}_" + ${S}, ${D})`),this._preRunMembers[this._blockCount]=T}return`${this._prefixNameVar}.getCacheData("m${v}_" + ${S}, ${h}, ${d})`}_getOtherVarMemberIndexs(e,n,r,a,c){const h=this._memberIndexList[r]||{};e=c&&r!==0?`"${e}_" + $posStr`:`"${e}"`;const d=`${this._prefixNameVar}.setCacheData(${e}, ${n})`;return h[e]=d,this._memberIndexList[r]=h,this._setDepend({name:n,scope:r,memberCode:d}),`${this._prefixNameVar}.getCacheData(${e}, ${a}, ${n})`}_getUserVarMemberIndexs(e,n,r,a,c){return this._getOtherVarMemberIndexs(`${n}_${e.lineNumber}_${e.column}`,n,r,a,c)}_parseLiteral(e){return e.type.endsWith(V.COLOR)?`"${this._colorToRgba(e.value)}"`:e.value}_colorToRgba(e){if(e.startsWith("#")){let n;const r=parseInt(e.substring(1,3),16),a=parseInt(e.substring(3,5),16),c=parseInt(e.substring(5,7),16),h=e.substring(7);return h?n=parseInt(h,16)/255:n=1,`rgba(${Math.round(r)}, ${Math.round(a)}, ${Math.round(c)}, ${n.toFixed(2)})`}return e}_parserName(e,n=!1){const{exprs:r,varScope:a,hasMethod:c,arg:h,varPos:d}=e,v=r.map(S=>{var L;if(typeof S=="string")return(d==null?void 0:d.reName)||S;const{column:C,line:T}=((L=S==null?void 0:S.ctx)==null?void 0:L.start)||{},D=`${T}_${C}`;return this._parserMethodElement(S,D)});if(e.expr&&v.unshift(`(${this._parserSingleExpression(e.expr)})`),e.isBuiltIn)v.join(".")==="strategy.opentrades"
|
119
|
+
${this._prefixNameVar}.setCacheData("m${v}_" + ${S}, ${D})`),this._preRunMembers[this._blockCount]=T}return`${this._prefixNameVar}.getCacheData("m${v}_" + ${S}, ${h}, ${d})`}_getOtherVarMemberIndexs(e,n,r,a,c){const h=this._memberIndexList[r]||{};e=c&&r!==0?`"${e}_" + $posStr`:`"${e}"`;const d=`${this._prefixNameVar}.setCacheData(${e}, ${n})`;return h[e]=d,this._memberIndexList[r]=h,this._setDepend({name:n,scope:r,memberCode:d}),`${this._prefixNameVar}.getCacheData(${e}, ${a}, ${n})`}_getUserVarMemberIndexs(e,n,r,a,c){return this._getOtherVarMemberIndexs(`${n}_${e.lineNumber}_${e.column}`,n,r,a,c)}_parseLiteral(e){return e.type.endsWith(V.COLOR)?`"${this._colorToRgba(e.value)}"`:e.value}_colorToRgba(e){if(e.startsWith("#")){let n;const r=parseInt(e.substring(1,3),16),a=parseInt(e.substring(3,5),16),c=parseInt(e.substring(5,7),16),h=e.substring(7);return h?n=parseInt(h,16)/255:n=1,`rgba(${Math.round(r)}, ${Math.round(a)}, ${Math.round(c)}, ${n.toFixed(2)})`}return e}_parserName(e,n=!1){const{exprs:r,varScope:a,hasMethod:c,arg:h,varPos:d}=e,v=r.map(S=>{var L;if(typeof S=="string")return(d==null?void 0:d.reName)||S;const{column:C,line:T}=((L=S==null?void 0:S.ctx)==null?void 0:L.start)||{},D=`${T}_${C}`;return this._parserMethodElement(S,D)});if(e.expr&&v.unshift(`(${this._parserSingleExpression(e.expr)})`),e.isBuiltIn){const S=v.join(".");S==="strategy.opentrades"?v.push("opentrades"):S==="chart.left_visible_bar_time"?this._hasLeftVisibleBarTime=!0:S==="chart.right_visible_bar_time"&&(this._hasRightVisibleBarTime=!0),v.unshift(e.isConst?this._prefixNameConst:this._prefixNameVar)}else if(wn.includes(v[0])&&(v[0]=`$${v[0]}`),!c){const S={name:v[0],scope:a||(h==null?void 0:h.varScope)||0,isAgainAssign:n,isArg:h==null?void 0:h.isArg,functionName:this._currentFuncName};this._setDepend(S)}return v.join(".")}_setDepend(e){const n=e.name;for(const r of Object.values(this._dependsObj)){const a=r.get(n)||{},c={...e,...a};r.set(n,c)}}_parserMethodExpression(e){const{exprs:n,ctx:r}=e,{column:a,line:c}=r.start,h=`${c}_${a}`;let d=this._isInFunc?`$posStr + "__${h}"`:`"${h}"`;d=this._isInLoop?`$$count${this._count} + ${d}`:d;let v=!1;const C=n.map(T=>(T.hasMemberIndex&&(v=!0),this._parserMethodElement(T,d))).join(".");if(this._isInConditionalStmt&&v){const T=`$$result_${this._preRunMemberFuncsCount}`;this._preRunMemberFuncsCount++;const D=this._preRunMembersFuncs[this._blockCount]||[];return D.push(`const ${T} = ${C}`),this._preRunMembersFuncs[this._blockCount]=D,T}return C}_parserMethodElement(e,n){let r="",a="";const c={...e.args};e.expr&&(r=`(${this._parserSingleExpression(e.expr)})`),r=r?`${r}.${e.name}`:this._nameMap.get(e.name)||e.name,e.hasVarPrefix&&(r=`${this._prefixNameVar}.${r}`);let h=!1;if(e.isBuiltIn){if(Mp.includes(r))r=`${r}.${r}`;else if(r==="max_bars_back"){const{name:v,varPos:S}=c.var||c.params[0];a=`var_name: "${S?`${v}_${S.lineNumber}_${S.column}`:v}"`}r.startsWith(V.INPUT)?(a=`index: ${this._inputCount}`,this._inputCount++):r.startsWith("request.")&&(h=!0),r=`${this._prefixNameFunc}.${r}`}else{const v=r.split(".");let S=v[0];wn.includes(S)&&(S=`$${S}`,r=v.join("."))}if(e.selfArg){const v=r.split("."),S=v.length;Object.assign(c,{[e.selfArg.name]:{name:v.slice(0,S-1).join(".")}}),r=v[S-1],r=this._nameMap.get(r)||r,this._setDepend({name:v[0],scope:e.varScope||0})}r=`${r}${e.index?`$${e.index}`:""}`;const d=this._parserArguments(c,a,n,h,e.hasRequest,r);if(!e.isBuiltIn){const v=r.split(".");if(v.length>1?this._setDepend({name:v[0],scope:e.varScope||0}):this._setDepend({name:r,scope:0,hasRequest:e.hasRequest,isFunc:!0}),e.funcName){const S=this._nameMap.get(e.funcName)||e.funcName;this._setDepend({name:S,originName:r,scope:0,hasRequest:e.hasRequest,isFunc:!0})}}return r+d}_parserArguments(e,n,r,a=!1,c=!1,h){const d=e.params||[];delete e.params;const v=[],S=[];let C=[],T;const D=(P,b)=>{c&&(this._dependsObj[r]=new Map),a&&b==="expression"&&(this._dependsObj[`$arg_${b}${r}`]=new Map);let y=P.ruleType===le.Brackethesized?this._parserBrackethesized(P):this._parserSingleExpression(P);if(b&&!["arg0, arg1, ...","number0, number1, ..."].includes(b)){P.isSourceType?v.push(`sourceTypeName: "${P.name}"`):b==="defval"&&h===`${this._prefixNameFunc}.input.enum`&&(T=this._enums.get(P.enumName));const g=this._requestParamsHandle(a,b,r,c,y,h);y=(g==null?void 0:g.code)||y,g!=null&&g.paramsExpr&&C.push(g==null?void 0:g.paramsExpr),v.push(`${b}: ${y}`)}else S.push(y)};for(const P of d)D(P,P.originName);for(const P of Object.keys(e))D(e[P],P);a&&this._isInFunc&&v.push("paramsExpr: $paramsExpr"),n&&v.push(n),T&&v.unshift(`options: [${T.join(", ")}]`);const L=C.length?`, [${this._isInFunc?"...$paramsExpr, ":""}${C.join(", ")}]`:"";return S.length?`({${v.join(", ")}}, [${S.join(", ")}], ${r}${L})`:v.length?`({${v.join(", ")}}, ${r}${L})`:`(${r}${L})`}_requestParamsHandle(e,n,r,a,c,h){const d=this._memberIndexList[0],v={};for(const S of Object.keys(d))S.includes("_")||(v[S]=d[S]);if(e&&n==="expression"){const S=this._getDepends(`$arg_${n}${r}`),C=this._getExpressionContext(S);return C.push({scope:1,depends:S.map(T=>(T.isArg&&(T.functionName=this._currentFuncName),T)),code:c,memberCodes:v}),{code:`'${pu(JSON.stringify(C))}'`}}else if(a){const S=this._getDepends(r),C=this._getExpressionContext(S);return C.push({scope:2,varNames:n,methodName:h,depends:S,dependSelf:S.some(T=>T.name===n),code:`${n} = ${c}`,memberCodes:v}),{paramsExpr:`'${pu(JSON.stringify(C))}'`}}}_getExpressionContext(e){const n=[],r=[];return this._getDependsCode(e,n,r),n}_getDependsCode(e,n,r){var a,c;for(const h of e)if(!h.isArg){const d=this._codesCol[h.scope||0],v=d.find(C=>{var T;return((T=C.varNames)==null?void 0:T.includes(h.name))||C.funcName===h.name});v&&(r.includes(v)||(r.push(v),v.depends.length&&this._getDependsCode(v.depends,n,r),n.push({scope:h.scope||0,code:v.code,depends:v.depends,funcName:v.funcName,varNames:(a=v.varNames)==null?void 0:a.join(", ")})));const S=d.filter(C=>C.depends.some(T=>T.name===h.name&&T.scope===h.scope&&T.isAgainAssign));for(const C of S)r.includes(C)||(r.push(C),C.depends.length&&this._getDependsCode(C.depends,n,r),n.push({scope:h.scope||0,code:C.code,depends:C.depends,funcName:C.funcName,varNames:(c=C.varNames)==null?void 0:c.join(", ")}))}}_parserBrackethesized(e){return`[${e.exprs.map(r=>this._parserSingleExpression(r)).join(", ")}]`}_functionalProcess(e){return`(function () {
|
120
120
|
let $$_result=undefined;
|
121
121
|
${e}
|
122
122
|
return $$_result
|
@@ -280,6 +280,6 @@ Input files:
|
|
280
280
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,`+x0(T)}else e.sourceMap.url&&(v.code+=`
|
281
281
|
//# sourceMappingURL=`+e.sourceMap.url)}return e.nameCache&&e.mangle&&(e.mangle.cache&&(e.nameCache.vars=Bd(e.mangle.cache)),e.mangle.properties&&e.mangle.properties.cache&&(e.nameCache.props=Bd(e.mangle.properties.cache))),S&&S.source_map&&S.source_map.destroy(),r&&(r.end=Date.now(),v.timings={parse:.001*(r.rename-r.parse),rename:.001*(r.compress-r.rename),compress:.001*(r.scope-r.compress),scope:.001*(r.mangle-r.scope),mangle:.001*(r.properties-r.mangle),properties:.001*(r.format-r.properties),format:.001*(r.end-r.format),total:.001*(r.end-r.start)}),v}async function Ud(t,e,n){const r=O0(t,e,n);let a,c;do c=r.next(await a),a=c.value;while(!c.done);return c.value}function $d(t){const e=new f_(t),n=new xl(e);n.removeErrorListeners();const r=new u_(n),a=new M(r);a._interp.predictionMode=y_.SLL,a.removeErrorListeners();const c=new w0;n.addErrorListener(c),a.addErrorListener(c),a.buildParseTrees=!0;const h=a.program(),d=r.tokens.filter(v=>v.channel===2);return{errors:c.errors,ast:h,comments:d}}async function D0(t,e,n,r){const{errors:a,ast:c,comments:h}=$d(t+`
|
282
282
|
|
283
|
-
`),d=new jp(r,h,n),v=await d.visit(c);let S=a.splice(0,1);S.length||(S=d.errors);let C="";const T=new J_("$");let D=e?"":T.preParser(v);if(e&&!S.some(
|
283
|
+
`),d=new jp(r,h,n),v=await d.visit(c);let S=a.splice(0,1);S.length||(S=d.errors);let C="";const T=new J_("$");let D=e?"":T.preParser(v);const L={};if(e&&!S.some(P=>P.type===Sn.Error)){const{code:P="",hasLeftVisibleBarTime:b,hasRightVisibleBarTime:y}=T.parser(v)||{};Object.assign(L,{hasLeftVisibleBarTime:b,hasRightVisibleBarTime:y}),D=T.preParseCode;try{C=(await Ud(P,{compress:!0,mangle:!0})).code||"";const O={message:pe.indiRunErr,type:Sn.Error,startColumn:0,startLineNumber:0,endColumn:0,endLineNumber:0};if(d.hasUseDrawFunc){if(d.scriptType===Ii.library)d.exportPositions.length||(O.message=pe.libraryExportErr,S.push(O));else if(d.exportPositions.length){const R=d.exportPositions.map(k=>{const{type:U,...X}=k;return{message:ye(pe.exportUseErr,{type:U}),type:Sn.Error,...X}});S.push(...R)}}else switch(d.scriptType){case Ii.indicator:S.push(O);break;case Ii.strategy:d.hasUseCreateOrderFunc||(O.message=pe.strategyRunErr,S.push(O));break}}catch(g){S.push({message:(g==null?void 0:g.message)||"minify error",type:Sn.Error,startColumn:0,startLineNumber:0,endColumn:0,endLineNumber:0})}}return{errors:S,functions:Object.fromEntries(d.userFunctions),variables:Object.fromEntries(d.userVariables),types:Object.fromEntries(d.userTypes),methods:Object.fromEntries(d.userMethods),overloadsFuncs:d.overloadsFuncs,imports:Object.fromEntries(d.imports),enums:Object.fromEntries(d.userEnums),codeStr:C,preParserCode:D,config:L}}async function k0(t,e,n,r){const{ast:a,comments:c}=$d(t+`
|
284
284
|
|
285
285
|
`),h=new jp(r,c,n),d=await h.visit(a),{name:v,index:S}=h.endExport,C=d.findIndex(b=>b.name===v&&b.index===S),T=d.slice(0,C+1),L=new Z_("$",e).parser(T)||"",P=await Ud(L,{compress:!0,mangle:!0});return{...h.exportLibs,description:h.description,codeStr:P.code||""}}class w0 extends c_{constructor(){super(...arguments);w(this,"errors",[])}syntaxError(n,r,a,c,h){this.errors.push({message:`syntax error: ${h.replace(/expecting.+/,"")}`,type:Sn.Error,startColumn:c,startLineNumber:a,endColumn:c,endLineNumber:a})}}kl({parseTcc:D0,parseLibraryCode:k0})})();
|