@jetstreamapp/soql-parser-js 6.2.4 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/index.js +14 -14
- package/dist/cli/index.js +14 -14
- package/dist/esm/index.mjs +14 -14
- package/dist/lwc/index.js +8 -0
- package/dist/types/parser/lexer.d.ts +1 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var ep=Object.create;var Ps=Object.defineProperty;var tp=Object.getOwnPropertyDescriptor;var rp=Object.getOwnPropertyNames;var np=Object.getPrototypeOf,ip=Object.prototype.hasOwnProperty;var op=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ap=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rp(e))!ip.call(t,i)&&i!==r&&Ps(t,i,{get:()=>e[i],enumerable:!(n=tp(e,i))||n.enumerable});return t};var sp=(t,e,r)=>(r=t!=null?ep(np(t)):{},ap(e||!t||!t.__esModule?Ps(r,"default",{value:t,enumerable:!0}):r,t));var Qf=op((oo,Xf)=>{var
|
|
1
|
+
"use strict";var ep=Object.create;var Ps=Object.defineProperty;var tp=Object.getOwnPropertyDescriptor;var rp=Object.getOwnPropertyNames;var np=Object.getPrototypeOf,ip=Object.prototype.hasOwnProperty;var op=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ap=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rp(e))!ip.call(t,i)&&i!==r&&Ps(t,i,{get:()=>e[i],enumerable:!(n=tp(e,i))||n.enumerable});return t};var sp=(t,e,r)=>(r=t!=null?ep(np(t)):{},ap(e||!t||!t.__esModule?Ps(r,"default",{value:t,enumerable:!0}):r,t));var Qf=op((oo,Xf)=>{var my=require("events").EventEmitter,Ls=require("child_process").spawn,no=require("path"),gy=no.dirname,Hf=no.basename,Kf=require("fs");require("util").inherits(P,my);oo=Xf.exports=new P;oo.Command=P;oo.Option=Mr;function Mr(t,e){this.flags=t,this.required=t.indexOf("<")>=0,this.optional=t.indexOf("[")>=0,this.bool=t.indexOf("-no-")===-1,t=t.split(/[ ,|]+/),t.length>1&&!/^[[<]/.test(t[1])&&(this.short=t.shift()),this.long=t.shift(),this.description=e||""}Mr.prototype.name=function(){return this.long.replace("--","").replace("no-","")};Mr.prototype.attributeName=function(){return Ey(this.name())};Mr.prototype.is=function(t){return this.short===t||this.long===t};function P(t){this.commands=[],this.options=[],this._execs={},this._allowUnknownOption=!1,this._args=[],this._name=t||""}P.prototype.command=function(t,e,r){typeof e=="object"&&e!==null&&(r=e,e=null),r=r||{};var n=t.split(/ +/),i=new P(n.shift());return e&&(i.description(e),this.executables=!0,this._execs[i._name]=!0,r.isDefault&&(this.defaultExecutable=i._name)),i._noHelp=!!r.noHelp,this.commands.push(i),i.parseExpectedArgs(n),i.parent=this,e?this:i};P.prototype.arguments=function(t){return this.parseExpectedArgs(t.split(/ +/))};P.prototype.addImplicitHelpCommand=function(){this.command("help [cmd]","display help for [cmd]")};P.prototype.parseExpectedArgs=function(t){if(t.length){var e=this;return t.forEach(function(r){var n={required:!1,name:"",variadic:!1};switch(r[0]){case"<":n.required=!0,n.name=r.slice(1,-1);break;case"[":n.name=r.slice(1,-1);break}n.name.length>3&&n.name.slice(-3)==="..."&&(n.variadic=!0,n.name=n.name.slice(0,-3)),n.name&&e._args.push(n)}),this}};P.prototype.action=function(t){var e=this,r=function(o,a){o=o||[],a=a||[];var s=e.parseOptions(a);Yf(e,s.unknown),s.unknown.length>0&&e.unknownOption(s.unknown[0]),s.args.length&&(o=s.args.concat(o)),e._args.forEach(function(l,c){l.required&&o[c]==null?e.missingArgument(l.name):l.variadic&&(c!==e._args.length-1&&e.variadicArgNotLast(l.name),o[c]=o.splice(c))}),e._args.length?o[e._args.length]=e:o.push(e),t.apply(e,o)},n=this.parent||this,i=n===this?"*":this._name;return n.on("command:"+i,r),this._alias&&n.on("command:"+this._alias,r),this};P.prototype.option=function(t,e,r,n){var i=this,o=new Mr(t,e),a=o.name(),s=o.attributeName();if(typeof r!="function")if(r instanceof RegExp){var l=r;r=function(c,p){var h=l.exec(c);return h?h[0]:p}}else n=r,r=null;return(!o.bool||o.optional||o.required)&&(o.bool||(n=!0),n!==void 0&&(i[s]=n,o.defaultValue=n)),this.options.push(o),this.on("option:"+a,function(c){c!==null&&r&&(c=r(c,i[s]===void 0?n:i[s])),typeof i[s]=="boolean"||typeof i[s]>"u"?c==null?i[s]=o.bool?n||!0:!1:i[s]=c:c!==null&&(i[s]=c)}),this};P.prototype.allowUnknownOption=function(t){return this._allowUnknownOption=arguments.length===0||t,this};P.prototype.parse=function(t){this.executables&&this.addImplicitHelpCommand(),this.rawArgs=t,this._name=this._name||Hf(t[1],".js"),this.executables&&t.length<3&&!this.defaultExecutable&&t.push("--help");var e=this.parseOptions(this.normalize(t.slice(2))),r=this.args=e.args,n=this.parseArgs(this.args,e.unknown),i=n.args[0],o=null;return i&&(o=this.commands.filter(function(a){return a.alias()===i})[0]),this._execs[i]===!0?this.executeSubCommand(t,r,e.unknown):o?(r[0]=o._name,this.executeSubCommand(t,r,e.unknown)):this.defaultExecutable?(r.unshift(this.defaultExecutable),this.executeSubCommand(t,r,e.unknown)):n};P.prototype.executeSubCommand=function(t,e,r){e=e.concat(r),e.length||this.help(),e[0]==="help"&&e.length===1&&this.help(),e[0]==="help"&&(e[0]=e[1],e[1]="--help");var n=t[1],i=Hf(n,no.extname(n))+"-"+e[0],o,a=Kf.realpathSync(n);o=gy(a);var s=no.join(o,i),l=!1;Os(s+".js")?(i=s+".js",l=!0):Os(s+".ts")?(i=s+".ts",l=!0):Os(s)&&(i=s),e=e.slice(1);var c;process.platform!=="win32"?l?(e.unshift(i),e=(process.execArgv||[]).concat(e),c=Ls(process.argv[0],e,{stdio:"inherit",customFds:[0,1,2]})):c=Ls(i,e,{stdio:"inherit",customFds:[0,1,2]}):(e.unshift(i),c=Ls(process.execPath,e,{stdio:"inherit"}));var p=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];p.forEach(function(h){process.on(h,function(){c.killed===!1&&c.exitCode===null&&c.kill(h)})}),c.on("close",process.exit.bind(process)),c.on("error",function(h){h.code==="ENOENT"?console.error("error: %s(1) does not exist, try --help",i):h.code==="EACCES"&&console.error("error: %s(1) not executable. try chmod or run with root",i),process.exit(1)}),this.runningCommand=c};P.prototype.normalize=function(t){for(var e=[],r,n,i,o=0,a=t.length;o<a;++o)if(r=t[o],o>0&&(n=this.optionFor(t[o-1])),r==="--"){e=e.concat(t.slice(o));break}else n&&n.required?e.push(r):r.length>1&&r[0]==="-"&&r[1]!=="-"?r.slice(1).split("").forEach(function(s){e.push("-"+s)}):/^--/.test(r)&&~(i=r.indexOf("="))?e.push(r.slice(0,i),r.slice(i+1)):e.push(r);return e};P.prototype.parseArgs=function(t,e){var r;return t.length?(r=t[0],this.listeners("command:"+r).length?this.emit("command:"+t.shift(),t,e):this.emit("command:*",t)):(Yf(this,e),e.length>0&&this.unknownOption(e[0]),this.commands.length===0&&this._args.filter(function(n){return n.required}).length===0&&this.emit("command:*")),this};P.prototype.optionFor=function(t){for(var e=0,r=this.options.length;e<r;++e)if(this.options[e].is(t))return this.options[e]};P.prototype.parseOptions=function(t){for(var e=[],r=t.length,n,i,o,a=[],s=0;s<r;++s){if(o=t[s],n){e.push(o);continue}if(o==="--"){n=!0;continue}if(i=this.optionFor(o),i){if(i.required){if(o=t[++s],o==null)return this.optionMissingArgument(i);this.emit("option:"+i.name(),o)}else i.optional?(o=t[s+1],o==null||o[0]==="-"&&o!=="-"?o=null:++s,this.emit("option:"+i.name(),o)):this.emit("option:"+i.name());continue}if(o.length>1&&o[0]==="-"){a.push(o),s+1<t.length&&t[s+1][0]!=="-"&&a.push(t[++s]);continue}e.push(o)}return{args:e,unknown:a}};P.prototype.opts=function(){for(var t={},e=this.options.length,r=0;r<e;r++){var n=this.options[r].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t};P.prototype.missingArgument=function(t){console.error("error: missing required argument `%s'",t),process.exit(1)};P.prototype.optionMissingArgument=function(t,e){e?console.error("error: option `%s' argument missing, got `%s'",t.flags,e):console.error("error: option `%s' argument missing",t.flags),process.exit(1)};P.prototype.unknownOption=function(t){this._allowUnknownOption||(console.error("error: unknown option `%s'",t),process.exit(1))};P.prototype.variadicArgNotLast=function(t){console.error("error: variadic arguments must be last `%s'",t),process.exit(1)};P.prototype.version=function(t,e){if(arguments.length===0)return this._version;this._version=t,e=e||"-V, --version";var r=new Mr(e,"output the version number");return this._versionOptionName=r.long.substr(2)||"version",this.options.push(r),this.on("option:"+this._versionOptionName,function(){process.stdout.write(t+`
|
|
2
2
|
`),process.exit(0)}),this};P.prototype.description=function(t,e){return arguments.length===0?this._description:(this._description=t,this._argsDescription=e,this)};P.prototype.alias=function(t){var e=this;if(this.commands.length!==0&&(e=this.commands[this.commands.length-1]),arguments.length===0)return e._alias;if(t===e._name)throw new Error("Command alias can't be the same as its name");return e._alias=t,this};P.prototype.usage=function(t){var e=this._args.map(function(n){return qf(n)}),r="[options]"+(this.commands.length?" [command]":"")+(this._args.length?" "+e.join(" "):"");return arguments.length===0?this._usage||r:(this._usage=t,this)};P.prototype.name=function(t){return arguments.length===0?this._name:(this._name=t,this)};P.prototype.prepareCommands=function(){return this.commands.filter(function(t){return!t._noHelp}).map(function(t){var e=t._args.map(function(r){return qf(r)}).join(" ");return[t._name+(t._alias?"|"+t._alias:"")+(t.options.length?" [options]":"")+(e?" "+e:""),t._description]})};P.prototype.largestCommandLength=function(){var t=this.prepareCommands();return t.reduce(function(e,r){return Math.max(e,r[0].length)},0)};P.prototype.largestOptionLength=function(){var t=[].slice.call(this.options);return t.push({flags:"-h, --help"}),t.reduce(function(e,r){return Math.max(e,r.flags.length)},0)};P.prototype.largestArgLength=function(){return this._args.reduce(function(t,e){return Math.max(t,e.name.length)},0)};P.prototype.padWidth=function(){var t=this.largestOptionLength();return this._argsDescription&&this._args.length&&this.largestArgLength()>t&&(t=this.largestArgLength()),this.commands&&this.commands.length&&this.largestCommandLength()>t&&(t=this.largestCommandLength()),t};P.prototype.optionHelp=function(){var t=this.padWidth();return this.options.map(function(e){return io(e.flags,t)+" "+e.description+(e.bool&&e.defaultValue!==void 0?" (default: "+JSON.stringify(e.defaultValue)+")":"")}).concat([io("-h, --help",t)+" output usage information"]).join(`
|
|
3
3
|
`)};P.prototype.commandHelp=function(){if(!this.commands.length)return"";var t=this.prepareCommands(),e=this.padWidth();return["Commands:",t.map(function(r){var n=r[1]?" "+r[1]:"";return(n?io(r[0],e):r[0])+n}).join(`
|
|
4
4
|
`).replace(/^/gm," "),""].join(`
|
|
5
5
|
`)};P.prototype.helpInformation=function(){var t=[];if(this._description){t=[this._description,""];var e=this._argsDescription;if(e&&this._args.length){var r=this.padWidth();t.push("Arguments:"),t.push(""),this._args.forEach(function(l){t.push(" "+io(l.name,r)+" "+e[l.name])}),t.push("")}}var n=this._name;this._alias&&(n=n+"|"+this._alias);var i=["Usage: "+n+" "+this.usage(),""],o=[],a=this.commandHelp();a&&(o=[a]);var s=["Options:",""+this.optionHelp().replace(/^/gm," "),""];return i.concat(t).concat(s).concat(o).join(`
|
|
6
|
-
`)};P.prototype.outputHelp=function(t){t||(t=function(e){return e}),process.stdout.write(t(this.helpInformation())),this.emit("--help")};P.prototype.help=function(t){this.outputHelp(t),process.exit()};function gy(t){return t.split("-").reduce(function(e,r){return e+r[0].toUpperCase()+r.slice(1)})}function io(t,e){var r=Math.max(0,e-t.length);return t+Array(r+1).join(" ")}function Yf(t,e){e=e||[];for(var r=0;r<e.length;r++)(e[r]==="--help"||e[r]==="-h")&&(t.outputHelp(),process.exit(0))}function qf(t){var e=t.name+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}function Os(t){try{if(Kf.statSync(t).isFile())return!0}catch{return!1}}});function Qt(t){return t=Array.isArray(t)?t[0]:t,t.image&&!0}function Fs(t,e){return e}function Pe(t){return typeof t=="string"}function At(t){return Number.isFinite(t)}function ve(t){return t==null}function Bt(t,e,r){return ve(t)?"":`${r||""}${t}${e||""}`}function Ms(t,e=!1){return Array.isArray(t)?t.length>0?`(${t.join(", ")})`:e?"()":"":e?`(${t||""})`:t||""}function Us(t,e,r=""){return At(t)&&t>0?new Array(t).fill(e).join(r):""}function co(t){return t&&!ve(t.alias)}function Dr(t){return Pe(t.relationshipName)}function fo(t){return!!t&&!!t.operator&&!!t.right}function po(t){return!!t&&!!t.operator&&!!t.right}function ho(t){return t&&!ve(t.fn)&&Pe(t.operator)&&!ve(t.value)}function Gr(t){return t&&At(t.openParen)&&ve(t.operator)&&ve(t.field)&&ve(t.fn)&&ve(t.closeParen)}function mo(t){return t&&Pe(t.field)&&Pe(t.operator)&&!ve(t.valueQuery)&&ve(t.value)}function go(t){return t&&!ve(t.field)}function Eo(t){return t&&!ve(t.field)}function lp(t){return["IN","NOT IN","INCLUDES","EXCLUDES"].includes(t)}function ks(t,e,r){if(ve(e))return t;if(r&&e!=="APEX_BIND_VARIABLE"&&lp(r)&&!Array.isArray(t)&&(t=[t],e=Array.isArray(e)?e:[e]),Array.isArray(e)&&Array.isArray(t))return t.map((n,i)=>up(n,e?.[i]));switch(Array.isArray(e)&&(e=e[0]),e){case"STRING":return Array.isArray(t)?t.filter(Boolean).map(n=>Pe(n)&&n.startsWith("'")?n:`'${n??""}'`):(t=String(t??""),Pe(t)&&t.startsWith("'")?t:`'${t??""}'`);case"APEX_BIND_VARIABLE":return`:${t}`;default:return t}}function up(t,e){switch(e){case"STRING":return Pe(t)&&t.startsWith("'")?t:`'${t??""}'`;default:return t}}var fp=typeof global=="object"&&global&&global.Object===Object&&global,Cn=fp;var pp=typeof self=="object"&&self&&self.Object===Object&&self,hp=Cn||pp||Function("return this")(),ie=hp;var dp=ie.Symbol,fe=dp;var ws=Object.prototype,mp=ws.hasOwnProperty,gp=ws.toString,Wr=fe?fe.toStringTag:void 0;function Ep(t){var e=mp.call(t,Wr),r=t[Wr];try{t[Wr]=void 0;var n=!0}catch{}var i=gp.call(t);return n&&(e?t[Wr]=r:delete t[Wr]),i}var Bs=Ep;var xp=Object.prototype,Ap=xp.toString;function Tp(t){return Ap.call(t)}var Ds=Tp;var Sp="[object Null]",yp="[object Undefined]",Gs=fe?fe.toStringTag:void 0;function Cp(t){return t==null?t===void 0?yp:Sp:Gs&&Gs in Object(t)?Bs(t):Ds(t)}var xe=Cp;function Lp(t){return t!=null&&typeof t=="object"}var ee=Lp;var Op="[object Symbol]";function Np(t){return typeof t=="symbol"||ee(t)&&xe(t)==Op}var Tt=Np;function Rp(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Ye=Rp;var _p=Array.isArray,y=_p;var Ip=1/0,Ws=fe?fe.prototype:void 0,$s=Ws?Ws.toString:void 0;function Vs(t){if(typeof t=="string")return t;if(y(t))return Ye(t,Vs)+"";if(Tt(t))return $s?$s.call(t):"";var e=t+"";return e=="0"&&1/t==-Ip?"-0":e}var js=Vs;var bp=/\s/;function vp(t){for(var e=t.length;e--&&bp.test(t.charAt(e)););return e}var Hs=vp;var Pp=/^\s+/;function Fp(t){return t&&t.slice(0,Hs(t)+1).replace(Pp,"")}var Ks=Fp;function Mp(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Y=Mp;var Ys=NaN,Up=/^[-+]0x[0-9a-f]+$/i,kp=/^0b[01]+$/i,wp=/^0o[0-7]+$/i,Bp=parseInt;function Dp(t){if(typeof t=="number")return t;if(Tt(t))return Ys;if(Y(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Y(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Ks(t);var r=kp.test(t);return r||wp.test(t)?Bp(t.slice(2),r?2:8):Up.test(t)?Ys:+t}var qs=Dp;var Xs=1/0,Gp=17976931348623157e292;function Wp(t){if(!t)return t===0?t:0;if(t=qs(t),t===Xs||t===-Xs){var e=t<0?-1:1;return e*Gp}return t===t?t:0}var Qs=Wp;function $p(t){var e=Qs(t),r=e%1;return e===e?r?e-r:e:0}var qe=$p;function Vp(t){return t}var we=Vp;var jp="[object AsyncFunction]",Hp="[object Function]",Kp="[object GeneratorFunction]",Yp="[object Proxy]";function qp(t){if(!Y(t))return!1;var e=xe(t);return e==Hp||e==Kp||e==jp||e==Yp}var Ae=qp;var Xp=ie["__core-js_shared__"],Ln=Xp;var zs=function(){var t=/[^.]+$/.exec(Ln&&Ln.keys&&Ln.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Qp(t){return!!zs&&zs in t}var Zs=Qp;var zp=Function.prototype,Zp=zp.toString;function Jp(t){if(t!=null){try{return Zp.call(t)}catch{}try{return t+""}catch{}}return""}var ut=Jp;var eh=/[\\^$.*+?()[\]{}|]/g,th=/^\[object .+?Constructor\]$/,rh=Function.prototype,nh=Object.prototype,ih=rh.toString,oh=nh.hasOwnProperty,ah=RegExp("^"+ih.call(oh).replace(eh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function sh(t){if(!Y(t)||Zs(t))return!1;var e=Ae(t)?ah:th;return e.test(ut(t))}var Js=sh;function lh(t,e){return t?.[e]}var el=lh;function uh(t,e){var r=el(t,e);return Js(r)?r:void 0}var Oe=uh;var ch=Oe(ie,"WeakMap"),On=ch;var tl=Object.create,fh=function(){function t(){}return function(e){if(!Y(e))return{};if(tl)return tl(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),rl=fh;function ph(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var nl=ph;function hh(){}var q=hh;function dh(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var il=dh;var mh=800,gh=16,Eh=Date.now;function xh(t){var e=0,r=0;return function(){var n=Eh(),i=gh-(n-r);if(r=n,i>0){if(++e>=mh)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ol=xh;function Ah(t){return function(){return t}}var al=Ah;var Th=function(){try{var t=Oe(Object,"defineProperty");return t({},"",{}),t}catch{}}(),zt=Th;var Sh=zt?function(t,e){return zt(t,"toString",{configurable:!0,enumerable:!1,value:al(e),writable:!0})}:we,sl=Sh;var yh=ol(sl),ll=yh;function Ch(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Nn=Ch;function Lh(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var Rn=Lh;function Oh(t){return t!==t}var ul=Oh;function Nh(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var cl=Nh;function Rh(t,e,r){return e===e?cl(t,e,r):Rn(t,ul,r)}var Zt=Rh;function _h(t,e){var r=t==null?0:t.length;return!!r&&Zt(t,e,0)>-1}var _n=_h;var Ih=9007199254740991,bh=/^(?:0|[1-9]\d*)$/;function vh(t,e){var r=typeof t;return e=e??Ih,!!e&&(r=="number"||r!="symbol"&&bh.test(t))&&t>-1&&t%1==0&&t<e}var St=vh;function Ph(t,e,r){e=="__proto__"&&zt?zt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Jt=Ph;function Fh(t,e){return t===e||t!==t&&e!==e}var Xe=Fh;var Mh=Object.prototype,Uh=Mh.hasOwnProperty;function kh(t,e,r){var n=t[e];(!(Uh.call(t,e)&&Xe(n,r))||r===void 0&&!(e in t))&&Jt(t,e,r)}var yt=kh;function wh(t,e,r,n){var i=!r;r||(r={});for(var o=-1,a=e.length;++o<a;){var s=e[o],l=n?n(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),i?Jt(r,s,l):yt(r,s,l)}return r}var Qe=wh;var fl=Math.max;function Bh(t,e,r){return e=fl(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=fl(n.length-e,0),a=Array(o);++i<o;)a[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=r(a),nl(t,this,s)}}var pl=Bh;function Dh(t,e){return ll(pl(t,e,we),t+"")}var er=Dh;var Gh=9007199254740991;function Wh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Gh}var tr=Wh;function $h(t){return t!=null&&tr(t.length)&&!Ae(t)}var oe=$h;function Vh(t,e,r){if(!Y(r))return!1;var n=typeof e;return(n=="number"?oe(r)&&St(e,r.length):n=="string"&&e in r)?Xe(r[e],t):!1}var Ct=Vh;function jh(t){return er(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,a&&Ct(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var s=r[n];s&&t(e,s,n,o)}return e})}var hl=jh;var Hh=Object.prototype;function Kh(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Hh;return t===r}var ze=Kh;function Yh(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var dl=Yh;var qh="[object Arguments]";function Xh(t){return ee(t)&&xe(t)==qh}var xo=Xh;var ml=Object.prototype,Qh=ml.hasOwnProperty,zh=ml.propertyIsEnumerable,Zh=xo(function(){return arguments}())?xo:function(t){return ee(t)&&Qh.call(t,"callee")&&!zh.call(t,"callee")},Lt=Zh;function Jh(){return!1}var gl=Jh;var Al=typeof exports=="object"&&exports&&!exports.nodeType&&exports,El=Al&&typeof module=="object"&&module&&!module.nodeType&&module,ed=El&&El.exports===Al,xl=ed?ie.Buffer:void 0,td=xl?xl.isBuffer:void 0,rd=td||gl,ct=rd;var nd="[object Arguments]",id="[object Array]",od="[object Boolean]",ad="[object Date]",sd="[object Error]",ld="[object Function]",ud="[object Map]",cd="[object Number]",fd="[object Object]",pd="[object RegExp]",hd="[object Set]",dd="[object String]",md="[object WeakMap]",gd="[object ArrayBuffer]",Ed="[object DataView]",xd="[object Float32Array]",Ad="[object Float64Array]",Td="[object Int8Array]",Sd="[object Int16Array]",yd="[object Int32Array]",Cd="[object Uint8Array]",Ld="[object Uint8ClampedArray]",Od="[object Uint16Array]",Nd="[object Uint32Array]",V={};V[xd]=V[Ad]=V[Td]=V[Sd]=V[yd]=V[Cd]=V[Ld]=V[Od]=V[Nd]=!0;V[nd]=V[id]=V[gd]=V[od]=V[Ed]=V[ad]=V[sd]=V[ld]=V[ud]=V[cd]=V[fd]=V[pd]=V[hd]=V[dd]=V[md]=!1;function Rd(t){return ee(t)&&tr(t.length)&&!!V[xe(t)]}var Tl=Rd;function _d(t){return function(e){return t(e)}}var Ze=_d;var Sl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$r=Sl&&typeof module=="object"&&module&&!module.nodeType&&module,Id=$r&&$r.exports===Sl,Ao=Id&&Cn.process,bd=function(){try{var t=$r&&$r.require&&$r.require("util").types;return t||Ao&&Ao.binding&&Ao.binding("util")}catch{}}(),Be=bd;var yl=Be&&Be.isTypedArray,vd=yl?Ze(yl):Tl,rr=vd;var Pd=Object.prototype,Fd=Pd.hasOwnProperty;function Md(t,e){var r=y(t),n=!r&&Lt(t),i=!r&&!n&&ct(t),o=!r&&!n&&!i&&rr(t),a=r||n||i||o,s=a?dl(t.length,String):[],l=s.length;for(var c in t)(e||Fd.call(t,c))&&!(a&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||St(c,l)))&&s.push(c);return s}var In=Md;function Ud(t,e){return function(r){return t(e(r))}}var bn=Ud;var kd=bn(Object.keys,Object),Cl=kd;var wd=Object.prototype,Bd=wd.hasOwnProperty;function Dd(t){if(!ze(t))return Cl(t);var e=[];for(var r in Object(t))Bd.call(t,r)&&r!="constructor"&&e.push(r);return e}var vn=Dd;function Gd(t){return oe(t)?In(t):vn(t)}var w=Gd;var Wd=Object.prototype,$d=Wd.hasOwnProperty,Vd=hl(function(t,e){if(ze(e)||oe(e)){Qe(e,w(e),t);return}for(var r in e)$d.call(e,r)&&yt(t,r,e[r])}),he=Vd;function jd(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ll=jd;var Hd=Object.prototype,Kd=Hd.hasOwnProperty;function Yd(t){if(!Y(t))return Ll(t);var e=ze(t),r=[];for(var n in t)n=="constructor"&&(e||!Kd.call(t,n))||r.push(n);return r}var Ol=Yd;function qd(t){return oe(t)?In(t,!0):Ol(t)}var Ot=qd;var Xd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Qd=/^\w*$/;function zd(t,e){if(y(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Tt(t)?!0:Qd.test(t)||!Xd.test(t)||e!=null&&t in Object(e)}var nr=zd;var Zd=Oe(Object,"create"),ft=Zd;function Jd(){this.__data__=ft?ft(null):{},this.size=0}var Nl=Jd;function em(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Rl=em;var tm="__lodash_hash_undefined__",rm=Object.prototype,nm=rm.hasOwnProperty;function im(t){var e=this.__data__;if(ft){var r=e[t];return r===tm?void 0:r}return nm.call(e,t)?e[t]:void 0}var _l=im;var om=Object.prototype,am=om.hasOwnProperty;function sm(t){var e=this.__data__;return ft?e[t]!==void 0:am.call(e,t)}var Il=sm;var lm="__lodash_hash_undefined__";function um(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ft&&e===void 0?lm:e,this}var bl=um;function ir(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ir.prototype.clear=Nl;ir.prototype.delete=Rl;ir.prototype.get=_l;ir.prototype.has=Il;ir.prototype.set=bl;var To=ir;function cm(){this.__data__=[],this.size=0}var vl=cm;function fm(t,e){for(var r=t.length;r--;)if(Xe(t[r][0],e))return r;return-1}var Nt=fm;var pm=Array.prototype,hm=pm.splice;function dm(t){var e=this.__data__,r=Nt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():hm.call(e,r,1),--this.size,!0}var Pl=dm;function mm(t){var e=this.__data__,r=Nt(e,t);return r<0?void 0:e[r][1]}var Fl=mm;function gm(t){return Nt(this.__data__,t)>-1}var Ml=gm;function Em(t,e){var r=this.__data__,n=Nt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Ul=Em;function or(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}or.prototype.clear=vl;or.prototype.delete=Pl;or.prototype.get=Fl;or.prototype.has=Ml;or.prototype.set=Ul;var Rt=or;var xm=Oe(ie,"Map"),_t=xm;function Am(){this.size=0,this.__data__={hash:new To,map:new(_t||Rt),string:new To}}var kl=Am;function Tm(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var wl=Tm;function Sm(t,e){var r=t.__data__;return wl(e)?r[typeof e=="string"?"string":"hash"]:r.map}var It=Sm;function ym(t){var e=It(this,t).delete(t);return this.size-=e?1:0,e}var Bl=ym;function Cm(t){return It(this,t).get(t)}var Dl=Cm;function Lm(t){return It(this,t).has(t)}var Gl=Lm;function Om(t,e){var r=It(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Wl=Om;function ar(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ar.prototype.clear=kl;ar.prototype.delete=Bl;ar.prototype.get=Dl;ar.prototype.has=Gl;ar.prototype.set=Wl;var Dt=ar;var Nm="Expected a function";function So(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Nm);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=t.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(So.Cache||Dt),r}So.Cache=Dt;var $l=So;var Rm=500;function _m(t){var e=$l(t,function(n){return r.size===Rm&&r.clear(),n}),r=e.cache;return e}var Vl=_m;var Im=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bm=/\\(\\)?/g,vm=Vl(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Im,function(r,n,i,o){e.push(i?o.replace(bm,"$1"):n||r)}),e}),jl=vm;function Pm(t){return t==null?"":js(t)}var Hl=Pm;function Fm(t,e){return y(t)?t:nr(t,e)?[t]:jl(Hl(t))}var bt=Fm;var Mm=1/0;function Um(t){if(typeof t=="string"||Tt(t))return t;var e=t+"";return e=="0"&&1/t==-Mm?"-0":e}var Je=Um;function km(t,e){e=bt(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Je(e[r++])];return r&&r==n?t:void 0}var sr=km;function wm(t,e,r){var n=t==null?void 0:sr(t,e);return n===void 0?r:n}var Kl=wm;function Bm(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var lr=Bm;var Yl=fe?fe.isConcatSpreadable:void 0;function Dm(t){return y(t)||Lt(t)||!!(Yl&&t&&t[Yl])}var ql=Dm;function Xl(t,e,r,n,i){var o=-1,a=t.length;for(r||(r=ql),i||(i=[]);++o<a;){var s=t[o];e>0&&r(s)?e>1?Xl(s,e-1,r,n,i):lr(i,s):n||(i[i.length]=s)}return i}var ur=Xl;function Gm(t){var e=t==null?0:t.length;return e?ur(t,1):[]}var le=Gm;var Wm=bn(Object.getPrototypeOf,Object),Pn=Wm;function $m(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var Fn=$m;function Vm(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var Ql=Vm;function jm(){this.__data__=new Rt,this.size=0}var zl=jm;function Hm(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Zl=Hm;function Km(t){return this.__data__.get(t)}var Jl=Km;function Ym(t){return this.__data__.has(t)}var eu=Ym;var qm=200;function Xm(t,e){var r=this.__data__;if(r instanceof Rt){var n=r.__data__;if(!_t||n.length<qm-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Dt(n)}return r.set(t,e),this.size=r.size,this}var tu=Xm;function cr(t){var e=this.__data__=new Rt(t);this.size=e.size}cr.prototype.clear=zl;cr.prototype.delete=Zl;cr.prototype.get=Jl;cr.prototype.has=eu;cr.prototype.set=tu;var vt=cr;function Qm(t,e){return t&&Qe(e,w(e),t)}var ru=Qm;function zm(t,e){return t&&Qe(e,Ot(e),t)}var nu=zm;var su=typeof exports=="object"&&exports&&!exports.nodeType&&exports,iu=su&&typeof module=="object"&&module&&!module.nodeType&&module,Zm=iu&&iu.exports===su,ou=Zm?ie.Buffer:void 0,au=ou?ou.allocUnsafe:void 0;function Jm(t,e){if(e)return t.slice();var r=t.length,n=au?au(r):new t.constructor(r);return t.copy(n),n}var lu=Jm;function eg(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var a=t[r];e(a,r,t)&&(o[i++]=a)}return o}var fr=eg;function tg(){return[]}var Mn=tg;var rg=Object.prototype,ng=rg.propertyIsEnumerable,uu=Object.getOwnPropertySymbols,ig=uu?function(t){return t==null?[]:(t=Object(t),fr(uu(t),function(e){return ng.call(t,e)}))}:Mn,pr=ig;function og(t,e){return Qe(t,pr(t),e)}var cu=og;var ag=Object.getOwnPropertySymbols,sg=ag?function(t){for(var e=[];t;)lr(e,pr(t)),t=Pn(t);return e}:Mn,Un=sg;function lg(t,e){return Qe(t,Un(t),e)}var fu=lg;function ug(t,e,r){var n=e(t);return y(t)?n:lr(n,r(t))}var kn=ug;function cg(t){return kn(t,w,pr)}var Vr=cg;function fg(t){return kn(t,Ot,Un)}var wn=fg;var pg=Oe(ie,"DataView"),Bn=pg;var hg=Oe(ie,"Promise"),Dn=hg;var dg=Oe(ie,"Set"),Pt=dg;var pu="[object Map]",mg="[object Object]",hu="[object Promise]",du="[object Set]",mu="[object WeakMap]",gu="[object DataView]",gg=ut(Bn),Eg=ut(_t),xg=ut(Dn),Ag=ut(Pt),Tg=ut(On),Gt=xe;(Bn&&Gt(new Bn(new ArrayBuffer(1)))!=gu||_t&&Gt(new _t)!=pu||Dn&&Gt(Dn.resolve())!=hu||Pt&&Gt(new Pt)!=du||On&&Gt(new On)!=mu)&&(Gt=function(t){var e=xe(t),r=e==mg?t.constructor:void 0,n=r?ut(r):"";if(n)switch(n){case gg:return gu;case Eg:return pu;case xg:return hu;case Ag:return du;case Tg:return mu}return e});var $e=Gt;var Sg=Object.prototype,yg=Sg.hasOwnProperty;function Cg(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&yg.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Eu=Cg;var Lg=ie.Uint8Array,hr=Lg;function Og(t){var e=new t.constructor(t.byteLength);return new hr(e).set(new hr(t)),e}var dr=Og;function Ng(t,e){var r=e?dr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var xu=Ng;var Rg=/\w*$/;function _g(t){var e=new t.constructor(t.source,Rg.exec(t));return e.lastIndex=t.lastIndex,e}var Au=_g;var Tu=fe?fe.prototype:void 0,Su=Tu?Tu.valueOf:void 0;function Ig(t){return Su?Object(Su.call(t)):{}}var yu=Ig;function bg(t,e){var r=e?dr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Cu=bg;var vg="[object Boolean]",Pg="[object Date]",Fg="[object Map]",Mg="[object Number]",Ug="[object RegExp]",kg="[object Set]",wg="[object String]",Bg="[object Symbol]",Dg="[object ArrayBuffer]",Gg="[object DataView]",Wg="[object Float32Array]",$g="[object Float64Array]",Vg="[object Int8Array]",jg="[object Int16Array]",Hg="[object Int32Array]",Kg="[object Uint8Array]",Yg="[object Uint8ClampedArray]",qg="[object Uint16Array]",Xg="[object Uint32Array]";function Qg(t,e,r){var n=t.constructor;switch(e){case Dg:return dr(t);case vg:case Pg:return new n(+t);case Gg:return xu(t,r);case Wg:case $g:case Vg:case jg:case Hg:case Kg:case Yg:case qg:case Xg:return Cu(t,r);case Fg:return new n;case Mg:case wg:return new n(t);case Ug:return Au(t);case kg:return new n;case Bg:return yu(t)}}var Lu=Qg;function zg(t){return typeof t.constructor=="function"&&!ze(t)?rl(Pn(t)):{}}var Ou=zg;var Zg="[object Map]";function Jg(t){return ee(t)&&$e(t)==Zg}var Nu=Jg;var Ru=Be&&Be.isMap,eE=Ru?Ze(Ru):Nu,_u=eE;var tE="[object Set]";function rE(t){return ee(t)&&$e(t)==tE}var Iu=rE;var bu=Be&&Be.isSet,nE=bu?Ze(bu):Iu,vu=nE;var iE=1,oE=2,aE=4,Pu="[object Arguments]",sE="[object Array]",lE="[object Boolean]",uE="[object Date]",cE="[object Error]",Fu="[object Function]",fE="[object GeneratorFunction]",pE="[object Map]",hE="[object Number]",Mu="[object Object]",dE="[object RegExp]",mE="[object Set]",gE="[object String]",EE="[object Symbol]",xE="[object WeakMap]",AE="[object ArrayBuffer]",TE="[object DataView]",SE="[object Float32Array]",yE="[object Float64Array]",CE="[object Int8Array]",LE="[object Int16Array]",OE="[object Int32Array]",NE="[object Uint8Array]",RE="[object Uint8ClampedArray]",_E="[object Uint16Array]",IE="[object Uint32Array]",B={};B[Pu]=B[sE]=B[AE]=B[TE]=B[lE]=B[uE]=B[SE]=B[yE]=B[CE]=B[LE]=B[OE]=B[pE]=B[hE]=B[Mu]=B[dE]=B[mE]=B[gE]=B[EE]=B[NE]=B[RE]=B[_E]=B[IE]=!0;B[cE]=B[Fu]=B[xE]=!1;function Gn(t,e,r,n,i,o){var a,s=e&iE,l=e&oE,c=e&aE;if(r&&(a=i?r(t,n,i,o):r(t)),a!==void 0)return a;if(!Y(t))return t;var p=y(t);if(p){if(a=Eu(t),!s)return il(t,a)}else{var h=$e(t),d=h==Fu||h==fE;if(ct(t))return lu(t,s);if(h==Mu||h==Pu||d&&!i){if(a=l||d?{}:Ou(t),!s)return l?fu(t,nu(a,t)):cu(t,ru(a,t))}else{if(!B[h])return i?t:{};a=Lu(t,h,s)}}o||(o=new vt);var A=o.get(t);if(A)return A;o.set(t,a),vu(t)?t.forEach(function(N){a.add(Gn(N,e,r,N,t,o))}):_u(t)&&t.forEach(function(N,S){a.set(S,Gn(N,e,r,S,t,o))});var C=c?l?wn:Vr:l?Ot:w,L=p?void 0:C(t);return Nn(L||t,function(N,S){L&&(S=N,N=t[S]),yt(a,S,Gn(N,e,r,S,t,o))}),a}var Uu=Gn;var bE=4;function vE(t){return Uu(t,bE)}var D=vE;function PE(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var et=PE;var FE="__lodash_hash_undefined__";function ME(t){return this.__data__.set(t,FE),this}var ku=ME;function UE(t){return this.__data__.has(t)}var wu=UE;function Wn(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Dt;++e<r;)this.add(t[e])}Wn.prototype.add=Wn.prototype.push=ku;Wn.prototype.has=wu;var mr=Wn;function kE(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var $n=kE;function wE(t,e){return t.has(e)}var gr=wE;var BE=1,DE=2;function GE(t,e,r,n,i,o){var a=r&BE,s=t.length,l=e.length;if(s!=l&&!(a&&l>s))return!1;var c=o.get(t),p=o.get(e);if(c&&p)return c==e&&p==t;var h=-1,d=!0,A=r&DE?new mr:void 0;for(o.set(t,e),o.set(e,t);++h<s;){var C=t[h],L=e[h];if(n)var N=a?n(L,C,h,e,t,o):n(C,L,h,t,e,o);if(N!==void 0){if(N)continue;d=!1;break}if(A){if(!$n(e,function(S,E){if(!gr(A,E)&&(C===S||i(C,S,r,n,o)))return A.push(E)})){d=!1;break}}else if(!(C===L||i(C,L,r,n,o))){d=!1;break}}return o.delete(t),o.delete(e),d}var Vn=GE;function WE(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Bu=WE;function $E(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Er=$E;var VE=1,jE=2,HE="[object Boolean]",KE="[object Date]",YE="[object Error]",qE="[object Map]",XE="[object Number]",QE="[object RegExp]",zE="[object Set]",ZE="[object String]",JE="[object Symbol]",ex="[object ArrayBuffer]",tx="[object DataView]",Du=fe?fe.prototype:void 0,yo=Du?Du.valueOf:void 0;function rx(t,e,r,n,i,o,a){switch(r){case tx:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ex:return!(t.byteLength!=e.byteLength||!o(new hr(t),new hr(e)));case HE:case KE:case XE:return Xe(+t,+e);case YE:return t.name==e.name&&t.message==e.message;case QE:case ZE:return t==e+"";case qE:var s=Bu;case zE:var l=n&VE;if(s||(s=Er),t.size!=e.size&&!l)return!1;var c=a.get(t);if(c)return c==e;n|=jE,a.set(t,e);var p=Vn(s(t),s(e),n,i,o,a);return a.delete(t),p;case JE:if(yo)return yo.call(t)==yo.call(e)}return!1}var Gu=rx;var nx=1,ix=Object.prototype,ox=ix.hasOwnProperty;function ax(t,e,r,n,i,o){var a=r&nx,s=Vr(t),l=s.length,c=Vr(e),p=c.length;if(l!=p&&!a)return!1;for(var h=l;h--;){var d=s[h];if(!(a?d in e:ox.call(e,d)))return!1}var A=o.get(t),C=o.get(e);if(A&&C)return A==e&&C==t;var L=!0;o.set(t,e),o.set(e,t);for(var N=a;++h<l;){d=s[h];var S=t[d],E=e[d];if(n)var m=a?n(E,S,d,e,t,o):n(S,E,d,t,e,o);if(!(m===void 0?S===E||i(S,E,r,n,o):m)){L=!1;break}N||(N=d=="constructor")}if(L&&!N){var _=t.constructor,I=e.constructor;_!=I&&"constructor"in t&&"constructor"in e&&!(typeof _=="function"&&_ instanceof _&&typeof I=="function"&&I instanceof I)&&(L=!1)}return o.delete(t),o.delete(e),L}var Wu=ax;var sx=1,$u="[object Arguments]",Vu="[object Array]",jn="[object Object]",lx=Object.prototype,ju=lx.hasOwnProperty;function ux(t,e,r,n,i,o){var a=y(t),s=y(e),l=a?Vu:$e(t),c=s?Vu:$e(e);l=l==$u?jn:l,c=c==$u?jn:c;var p=l==jn,h=c==jn,d=l==c;if(d&&ct(t)){if(!ct(e))return!1;a=!0,p=!1}if(d&&!p)return o||(o=new vt),a||rr(t)?Vn(t,e,r,n,i,o):Gu(t,e,l,r,n,i,o);if(!(r&sx)){var A=p&&ju.call(t,"__wrapped__"),C=h&&ju.call(e,"__wrapped__");if(A||C){var L=A?t.value():t,N=C?e.value():e;return o||(o=new vt),i(L,N,r,n,o)}}return d?(o||(o=new vt),Wu(t,e,r,n,i,o)):!1}var Hu=ux;function Ku(t,e,r,n,i){return t===e?!0:t==null||e==null||!ee(t)&&!ee(e)?t!==t&&e!==e:Hu(t,e,r,n,Ku,i)}var Hn=Ku;var cx=1,fx=2;function px(t,e,r,n){var i=r.length,o=i,a=!n;if(t==null)return!o;for(t=Object(t);i--;){var s=r[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){s=r[i];var l=s[0],c=t[l],p=s[1];if(a&&s[2]){if(c===void 0&&!(l in t))return!1}else{var h=new vt;if(n)var d=n(c,p,l,t,e,h);if(!(d===void 0?Hn(p,c,cx|fx,n,h):d))return!1}}return!0}var Yu=px;function hx(t){return t===t&&!Y(t)}var Kn=hx;function dx(t){for(var e=w(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Kn(i)]}return e}var qu=dx;function mx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Yn=mx;function gx(t){var e=qu(t);return e.length==1&&e[0][2]?Yn(e[0][0],e[0][1]):function(r){return r===t||Yu(r,t,e)}}var Xu=gx;function Ex(t,e){return t!=null&&e in Object(t)}var Qu=Ex;function xx(t,e,r){e=bt(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var a=Je(e[n]);if(!(o=t!=null&&r(t,a)))break;t=t[a]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&tr(i)&&St(a,i)&&(y(t)||Lt(t)))}var qn=xx;function Ax(t,e){return t!=null&&qn(t,e,Qu)}var zu=Ax;var Tx=1,Sx=2;function yx(t,e){return nr(t)&&Kn(e)?Yn(Je(t),e):function(r){var n=Kl(r,t);return n===void 0&&n===e?zu(r,t):Hn(e,n,Tx|Sx)}}var Zu=yx;function Cx(t){return function(e){return e?.[t]}}var Ju=Cx;function Lx(t){return function(e){return sr(e,t)}}var ec=Lx;function Ox(t){return nr(t)?Ju(Je(t)):ec(t)}var tc=Ox;function Nx(t){return typeof t=="function"?t:t==null?we:typeof t=="object"?y(t)?Zu(t[0],t[1]):Xu(t):tc(t)}var ae=Nx;function Rx(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var a=t[i];e(n,a,r(a),t)}return n}var rc=Rx;function _x(t){return function(e,r,n){for(var i=-1,o=Object(e),a=n(e),s=a.length;s--;){var l=a[t?s:++i];if(r(o[l],l,o)===!1)break}return e}}var nc=_x;var Ix=nc(),ic=Ix;function bx(t,e){return t&&ic(t,e,w)}var oc=bx;function vx(t,e){return function(r,n){if(r==null)return r;if(!oe(r))return t(r,n);for(var i=r.length,o=e?i:-1,a=Object(r);(e?o--:++o<i)&&n(a[o],o,a)!==!1;);return r}}var ac=vx;var Px=ac(oc),Ne=Px;function Fx(t,e,r,n){return Ne(t,function(i,o,a){e(n,i,r(i),a)}),n}var sc=Fx;function Mx(t,e){return function(r,n){var i=y(r)?rc:sc,o=e?e():{};return i(r,t,ae(n,2),o)}}var lc=Mx;var uc=Object.prototype,Ux=uc.hasOwnProperty,kx=er(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&Ct(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],a=Ot(o),s=-1,l=a.length;++s<l;){var c=a[s],p=t[c];(p===void 0||Xe(p,uc[c])&&!Ux.call(t,c))&&(t[c]=o[c])}return t}),xr=kx;function wx(t){return ee(t)&&oe(t)}var Co=wx;function Bx(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var Xn=Bx;var Dx=200;function Gx(t,e,r,n){var i=-1,o=_n,a=!0,s=t.length,l=[],c=e.length;if(!s)return l;r&&(e=Ye(e,Ze(r))),n?(o=Xn,a=!1):e.length>=Dx&&(o=gr,a=!1,e=new mr(e));e:for(;++i<s;){var p=t[i],h=r==null?p:r(p);if(p=n||p!==0?p:0,a&&h===h){for(var d=c;d--;)if(e[d]===h)continue e;l.push(p)}else o(e,h,n)||l.push(p)}return l}var cc=Gx;var Wx=er(function(t,e){return Co(t)?cc(t,ur(e,1,Co,!0)):[]}),Ft=Wx;function $x(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var tt=$x;function Vx(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:qe(e),Fn(t,e<0?0:e,n)):[]}var te=Vx;function jx(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:qe(e),e=n-e,Fn(t,0,e<0?0:e)):[]}var pt=jx;function Hx(t){return typeof t=="function"?t:we}var fc=Hx;function Kx(t,e){var r=y(t)?Nn:Ne;return r(t,fc(e))}var x=Kx;function Yx(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var pc=Yx;function qx(t,e){var r=!0;return Ne(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var hc=qx;function Xx(t,e,r){var n=y(t)?pc:hc;return r&&Ct(t,e,r)&&(e=void 0),n(t,ae(e,3))}var me=Xx;function Qx(t,e){var r=[];return Ne(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var Qn=Qx;function zx(t,e){var r=y(t)?fr:Qn;return r(t,ae(e,3))}var ge=zx;function Zx(t){return function(e,r,n){var i=Object(e);if(!oe(e)){var o=ae(r,3);e=w(e),r=function(s){return o(i[s],s,i)}}var a=t(e,r,n);return a>-1?i[o?e[a]:a]:void 0}}var dc=Zx;var Jx=Math.max;function eA(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:qe(r);return i<0&&(i=Jx(n+i,0)),Rn(t,ae(e,3),i)}var mc=eA;var tA=dc(mc),rt=tA;function rA(t){return t&&t.length?t[0]:void 0}var pe=rA;function nA(t,e){var r=-1,n=oe(t)?Array(t.length):[];return Ne(t,function(i,o,a){n[++r]=e(i,o,a)}),n}var gc=nA;function iA(t,e){var r=y(t)?Ye:gc;return r(t,ae(e,3))}var g=iA;function oA(t,e){return ur(g(t,e),1)}var Te=oA;var aA=Object.prototype,sA=aA.hasOwnProperty,lA=lc(function(t,e,r){sA.call(t,r)?t[r].push(e):Jt(t,r,[e])}),Lo=lA;var uA=Object.prototype,cA=uA.hasOwnProperty;function fA(t,e){return t!=null&&cA.call(t,e)}var Ec=fA;function pA(t,e){return t!=null&&qn(t,e,Ec)}var T=pA;var hA="[object String]";function dA(t){return typeof t=="string"||!y(t)&&ee(t)&&xe(t)==hA}var ue=dA;function mA(t,e){return Ye(e,function(r){return t[r]})}var xc=mA;function gA(t){return t==null?[]:xc(t,w(t))}var U=gA;var EA=Math.max;function xA(t,e,r,n){t=oe(t)?t:U(t),r=r&&!n?qe(r):0;var i=t.length;return r<0&&(r=EA(i+r,0)),ue(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Zt(t,e,r)>-1}var H=xA;var AA=Math.max;function TA(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:qe(r);return i<0&&(i=AA(n+i,0)),Zt(t,e,i)}var zn=TA;var SA="[object Map]",yA="[object Set]",CA=Object.prototype,LA=CA.hasOwnProperty;function OA(t){if(t==null)return!0;if(oe(t)&&(y(t)||typeof t=="string"||typeof t.splice=="function"||ct(t)||rr(t)||Lt(t)))return!t.length;var e=$e(t);if(e==SA||e==yA)return!t.size;if(ze(t))return!vn(t).length;for(var r in t)if(LA.call(t,r))return!1;return!0}var v=OA;var NA="[object RegExp]";function RA(t){return ee(t)&&xe(t)==NA}var Ac=RA;var Tc=Be&&Be.isRegExp,_A=Tc?Ze(Tc):Ac,De=_A;function IA(t){return t===void 0}var Ee=IA;var bA="Expected a function";function vA(t){if(typeof t!="function")throw new TypeError(bA);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var Sc=vA;function PA(t,e,r,n){if(!Y(t))return t;e=bt(e,t);for(var i=-1,o=e.length,a=o-1,s=t;s!=null&&++i<o;){var l=Je(e[i]),c=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=a){var p=s[l];c=n?n(p,l,s):void 0,c===void 0&&(c=Y(p)?p:St(e[i+1])?[]:{})}yt(s,l,c),s=s[l]}return t}var yc=PA;function FA(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var a=e[n],s=sr(t,a);r(s,a)&&yc(o,bt(a,t),s)}return o}var Cc=FA;function MA(t,e){if(t==null)return{};var r=Ye(wn(t),function(n){return[n]});return e=ae(e),Cc(t,r,function(n,i){return e(n,i[0])})}var Re=MA;function UA(t,e,r,n,i){return i(t,function(o,a,s){r=n?(n=!1,o):e(r,o,a,s)}),r}var Lc=UA;function kA(t,e,r){var n=y(t)?Ql:Lc,i=arguments.length<3;return n(t,ae(e,4),r,i,Ne)}var se=kA;function wA(t,e){var r=y(t)?fr:Qn;return r(t,Sc(ae(e,3)))}var Mt=wA;function BA(t,e){var r;return Ne(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var Oc=BA;function DA(t,e,r){var n=y(t)?$n:Oc;return r&&Ct(t,e,r)&&(e=void 0),n(t,ae(e,3))}var jr=DA;var GA=1/0,WA=Pt&&1/Er(new Pt([,-0]))[1]==GA?function(t){return new Pt(t)}:q,Nc=WA;var $A=200;function VA(t,e,r){var n=-1,i=_n,o=t.length,a=!0,s=[],l=s;if(r)a=!1,i=Xn;else if(o>=$A){var c=e?null:Nc(t);if(c)return Er(c);a=!1,i=gr,l=new mr}else l=e?[]:s;e:for(;++n<o;){var p=t[n],h=e?e(p):p;if(p=r||p!==0?p:0,a&&h===h){for(var d=l.length;d--;)if(l[d]===h)continue e;e&&l.push(h),s.push(p)}else i(l,h,r)||(l!==s&&l.push(h),s.push(p))}return s}var Rc=VA;function jA(t){return t&&t.length?Rc(t):[]}var Ar=jA;function Tr(t){console&&console.error&&console.error(`Error: ${t}`)}function Hr(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Kr(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function Yr(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function HA(t){return KA(t)?t.LABEL:t.name}function KA(t){return ue(t.LABEL)&&t.LABEL!==""}var Fe=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),x(this.definition,r=>{r.accept(e)})}},G=class extends Fe{constructor(e){super([]),this.idx=1,he(this,Re(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},Se=class extends Fe{constructor(e){super(e.definition),this.orgText="",he(this,Re(e,r=>r!==void 0))}},W=class extends Fe{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,he(this,Re(e,r=>r!==void 0))}},j=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},re=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},ne=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},M=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},Z=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},J=class extends Fe{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,he(this,Re(e,r=>r!==void 0))}},F=class{constructor(e){this.idx=1,he(this,Re(e,r=>r!==void 0))}accept(e){e.visit(this)}};function Zn(t){return g(t,Sr)}function Sr(t){function e(r){return g(r,Sr)}if(t instanceof G){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ue(t.label)&&(r.label=t.label),r}else{if(t instanceof W)return{type:"Alternative",definition:e(t.definition)};if(t instanceof j)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof re)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof ne)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Sr(new F({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Z)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Sr(new F({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof M)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof J)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof F){let r={type:"Terminal",name:t.terminalType.name,label:HA(t.terminalType),idx:t.idx};ue(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=De(n)?n.source:n),r}else{if(t instanceof Se)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var ye=class{visit(e){let r=e;switch(r.constructor){case G:return this.visitNonTerminal(r);case W:return this.visitAlternative(r);case j:return this.visitOption(r);case re:return this.visitRepetitionMandatory(r);case ne:return this.visitRepetitionMandatoryWithSeparator(r);case Z:return this.visitRepetitionWithSeparator(r);case M:return this.visitRepetition(r);case J:return this.visitAlternation(r);case F:return this.visitTerminal(r);case Se:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Oo(t){return t instanceof W||t instanceof j||t instanceof M||t instanceof re||t instanceof ne||t instanceof Z||t instanceof F||t instanceof Se}function Wt(t,e=[]){return t instanceof j||t instanceof M||t instanceof Z?!0:t instanceof J?jr(t.definition,n=>Wt(n,e)):t instanceof G&&H(e,t)?!1:t instanceof Fe?(t instanceof G&&e.push(t),me(t.definition,n=>Wt(n,e))):!1}function No(t){return t instanceof J}function _e(t){if(t instanceof G)return"SUBRULE";if(t instanceof j)return"OPTION";if(t instanceof J)return"OR";if(t instanceof re)return"AT_LEAST_ONE";if(t instanceof ne)return"AT_LEAST_ONE_SEP";if(t instanceof Z)return"MANY_SEP";if(t instanceof M)return"MANY";if(t instanceof F)return"CONSUME";throw Error("non exhaustive match")}var ht=class{walk(e,r=[]){x(e.definition,(n,i)=>{let o=te(e.definition,i+1);if(n instanceof G)this.walkProdRef(n,o,r);else if(n instanceof F)this.walkTerminal(n,o,r);else if(n instanceof W)this.walkFlat(n,o,r);else if(n instanceof j)this.walkOption(n,o,r);else if(n instanceof re)this.walkAtLeastOne(n,o,r);else if(n instanceof ne)this.walkAtLeastOneSep(n,o,r);else if(n instanceof Z)this.walkManySep(n,o,r);else if(n instanceof M)this.walkMany(n,o,r);else if(n instanceof J)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new j({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=_c(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new j({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=_c(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);x(e.definition,o=>{let a=new W({definition:[o]});this.walk(a,i)})}};function _c(t,e,r){return[new j({definition:[new F({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function $t(t){if(t instanceof G)return $t(t.referencedRule);if(t instanceof F)return XA(t);if(Oo(t))return YA(t);if(No(t))return qA(t);throw Error("non exhaustive match")}function YA(t){let e=[],r=t.definition,n=0,i=r.length>n,o,a=!0;for(;i&&a;)o=r[n],a=Wt(o),e=e.concat($t(o)),n=n+1,i=r.length>n;return Ar(e)}function qA(t){let e=g(t.definition,r=>$t(r));return Ar(le(e))}function XA(t){return[t.terminalType]}var Jn="_~IN~_";var Ro=class extends ht{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=QA(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),a=new W({definition:o}),s=$t(a);this.follows[i]=s}};function Ic(t){let e={};return x(t,r=>{let n=new Ro(r).startWalking();he(e,n)}),e}function QA(t,e){return t.name+e+Jn}function O(t){return t.charCodeAt(0)}function ei(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function yr(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Vt(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function qr(){throw Error("Internal Error - Should never get here!")}function _o(t){return t.type==="Character"}var Xr=[];for(let t=O("0");t<=O("9");t++)Xr.push(t);var Qr=[O("_")].concat(Xr);for(let t=O("a");t<=O("z");t++)Qr.push(t);for(let t=O("A");t<=O("Z");t++)Qr.push(t);var Io=[O(" "),O("\f"),O(`
|
|
6
|
+
`)};P.prototype.outputHelp=function(t){t||(t=function(e){return e}),process.stdout.write(t(this.helpInformation())),this.emit("--help")};P.prototype.help=function(t){this.outputHelp(t),process.exit()};function Ey(t){return t.split("-").reduce(function(e,r){return e+r[0].toUpperCase()+r.slice(1)})}function io(t,e){var r=Math.max(0,e-t.length);return t+Array(r+1).join(" ")}function Yf(t,e){e=e||[];for(var r=0;r<e.length;r++)(e[r]==="--help"||e[r]==="-h")&&(t.outputHelp(),process.exit(0))}function qf(t){var e=t.name+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}function Os(t){try{if(Kf.statSync(t).isFile())return!0}catch{return!1}}});function Qt(t){return t=Array.isArray(t)?t[0]:t,t.image&&!0}function Fs(t,e){return e}function Pe(t){return typeof t=="string"}function At(t){return Number.isFinite(t)}function ve(t){return t==null}function Bt(t,e,r){return ve(t)?"":`${r||""}${t}${e||""}`}function Ms(t,e=!1){return Array.isArray(t)?t.length>0?`(${t.join(", ")})`:e?"()":"":e?`(${t||""})`:t||""}function Us(t,e,r=""){return At(t)&&t>0?new Array(t).fill(e).join(r):""}function co(t){return t&&!ve(t.alias)}function Dr(t){return Pe(t.relationshipName)}function fo(t){return!!t&&!!t.operator&&!!t.right}function po(t){return!!t&&!!t.operator&&!!t.right}function ho(t){return t&&!ve(t.fn)&&Pe(t.operator)&&!ve(t.value)}function Gr(t){return t&&At(t.openParen)&&ve(t.operator)&&ve(t.field)&&ve(t.fn)&&ve(t.closeParen)}function mo(t){return t&&Pe(t.field)&&Pe(t.operator)&&!ve(t.valueQuery)&&ve(t.value)}function go(t){return t&&!ve(t.field)}function Eo(t){return t&&!ve(t.field)}function lp(t){return["IN","NOT IN","INCLUDES","EXCLUDES"].includes(t)}function ks(t,e,r){if(ve(e))return t;if(r&&e!=="APEX_BIND_VARIABLE"&&lp(r)&&!Array.isArray(t)&&(t=[t],e=Array.isArray(e)?e:[e]),Array.isArray(e)&&Array.isArray(t))return t.map((n,i)=>up(n,e?.[i]));switch(Array.isArray(e)&&(e=e[0]),e){case"STRING":return Array.isArray(t)?t.filter(Boolean).map(n=>Pe(n)&&n.startsWith("'")?n:`'${n??""}'`):(t=String(t??""),Pe(t)&&t.startsWith("'")?t:`'${t??""}'`);case"APEX_BIND_VARIABLE":return`:${t}`;default:return t}}function up(t,e){switch(e){case"STRING":return Pe(t)&&t.startsWith("'")?t:`'${t??""}'`;default:return t}}var fp=typeof global=="object"&&global&&global.Object===Object&&global,Cn=fp;var pp=typeof self=="object"&&self&&self.Object===Object&&self,hp=Cn||pp||Function("return this")(),ie=hp;var dp=ie.Symbol,fe=dp;var ws=Object.prototype,mp=ws.hasOwnProperty,gp=ws.toString,Wr=fe?fe.toStringTag:void 0;function Ep(t){var e=mp.call(t,Wr),r=t[Wr];try{t[Wr]=void 0;var n=!0}catch{}var i=gp.call(t);return n&&(e?t[Wr]=r:delete t[Wr]),i}var Bs=Ep;var xp=Object.prototype,Ap=xp.toString;function Tp(t){return Ap.call(t)}var Ds=Tp;var Sp="[object Null]",yp="[object Undefined]",Gs=fe?fe.toStringTag:void 0;function Cp(t){return t==null?t===void 0?yp:Sp:Gs&&Gs in Object(t)?Bs(t):Ds(t)}var xe=Cp;function Lp(t){return t!=null&&typeof t=="object"}var ee=Lp;var Op="[object Symbol]";function Np(t){return typeof t=="symbol"||ee(t)&&xe(t)==Op}var Tt=Np;function Rp(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var qe=Rp;var _p=Array.isArray,y=_p;var Ip=1/0,Ws=fe?fe.prototype:void 0,$s=Ws?Ws.toString:void 0;function Vs(t){if(typeof t=="string")return t;if(y(t))return qe(t,Vs)+"";if(Tt(t))return $s?$s.call(t):"";var e=t+"";return e=="0"&&1/t==-Ip?"-0":e}var js=Vs;var bp=/\s/;function vp(t){for(var e=t.length;e--&&bp.test(t.charAt(e)););return e}var Hs=vp;var Pp=/^\s+/;function Fp(t){return t&&t.slice(0,Hs(t)+1).replace(Pp,"")}var Ks=Fp;function Mp(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Y=Mp;var Ys=NaN,Up=/^[-+]0x[0-9a-f]+$/i,kp=/^0b[01]+$/i,wp=/^0o[0-7]+$/i,Bp=parseInt;function Dp(t){if(typeof t=="number")return t;if(Tt(t))return Ys;if(Y(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Y(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Ks(t);var r=kp.test(t);return r||wp.test(t)?Bp(t.slice(2),r?2:8):Up.test(t)?Ys:+t}var qs=Dp;var Xs=1/0,Gp=17976931348623157e292;function Wp(t){if(!t)return t===0?t:0;if(t=qs(t),t===Xs||t===-Xs){var e=t<0?-1:1;return e*Gp}return t===t?t:0}var Qs=Wp;function $p(t){var e=Qs(t),r=e%1;return e===e?r?e-r:e:0}var Xe=$p;function Vp(t){return t}var we=Vp;var jp="[object AsyncFunction]",Hp="[object Function]",Kp="[object GeneratorFunction]",Yp="[object Proxy]";function qp(t){if(!Y(t))return!1;var e=xe(t);return e==Hp||e==Kp||e==jp||e==Yp}var Ae=qp;var Xp=ie["__core-js_shared__"],Ln=Xp;var zs=function(){var t=/[^.]+$/.exec(Ln&&Ln.keys&&Ln.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Qp(t){return!!zs&&zs in t}var Zs=Qp;var zp=Function.prototype,Zp=zp.toString;function Jp(t){if(t!=null){try{return Zp.call(t)}catch{}try{return t+""}catch{}}return""}var ut=Jp;var eh=/[\\^$.*+?()[\]{}|]/g,th=/^\[object .+?Constructor\]$/,rh=Function.prototype,nh=Object.prototype,ih=rh.toString,oh=nh.hasOwnProperty,ah=RegExp("^"+ih.call(oh).replace(eh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function sh(t){if(!Y(t)||Zs(t))return!1;var e=Ae(t)?ah:th;return e.test(ut(t))}var Js=sh;function lh(t,e){return t?.[e]}var el=lh;function uh(t,e){var r=el(t,e);return Js(r)?r:void 0}var Oe=uh;var ch=Oe(ie,"WeakMap"),On=ch;var tl=Object.create,fh=function(){function t(){}return function(e){if(!Y(e))return{};if(tl)return tl(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),rl=fh;function ph(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var nl=ph;function hh(){}var q=hh;function dh(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var il=dh;var mh=800,gh=16,Eh=Date.now;function xh(t){var e=0,r=0;return function(){var n=Eh(),i=gh-(n-r);if(r=n,i>0){if(++e>=mh)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ol=xh;function Ah(t){return function(){return t}}var al=Ah;var Th=function(){try{var t=Oe(Object,"defineProperty");return t({},"",{}),t}catch{}}(),zt=Th;var Sh=zt?function(t,e){return zt(t,"toString",{configurable:!0,enumerable:!1,value:al(e),writable:!0})}:we,sl=Sh;var yh=ol(sl),ll=yh;function Ch(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Nn=Ch;function Lh(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var Rn=Lh;function Oh(t){return t!==t}var ul=Oh;function Nh(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var cl=Nh;function Rh(t,e,r){return e===e?cl(t,e,r):Rn(t,ul,r)}var Zt=Rh;function _h(t,e){var r=t==null?0:t.length;return!!r&&Zt(t,e,0)>-1}var _n=_h;var Ih=9007199254740991,bh=/^(?:0|[1-9]\d*)$/;function vh(t,e){var r=typeof t;return e=e??Ih,!!e&&(r=="number"||r!="symbol"&&bh.test(t))&&t>-1&&t%1==0&&t<e}var St=vh;function Ph(t,e,r){e=="__proto__"&&zt?zt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Jt=Ph;function Fh(t,e){return t===e||t!==t&&e!==e}var Qe=Fh;var Mh=Object.prototype,Uh=Mh.hasOwnProperty;function kh(t,e,r){var n=t[e];(!(Uh.call(t,e)&&Qe(n,r))||r===void 0&&!(e in t))&&Jt(t,e,r)}var yt=kh;function wh(t,e,r,n){var i=!r;r||(r={});for(var o=-1,a=e.length;++o<a;){var s=e[o],l=n?n(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),i?Jt(r,s,l):yt(r,s,l)}return r}var ze=wh;var fl=Math.max;function Bh(t,e,r){return e=fl(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=fl(n.length-e,0),a=Array(o);++i<o;)a[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=r(a),nl(t,this,s)}}var pl=Bh;function Dh(t,e){return ll(pl(t,e,we),t+"")}var er=Dh;var Gh=9007199254740991;function Wh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Gh}var tr=Wh;function $h(t){return t!=null&&tr(t.length)&&!Ae(t)}var oe=$h;function Vh(t,e,r){if(!Y(r))return!1;var n=typeof e;return(n=="number"?oe(r)&&St(e,r.length):n=="string"&&e in r)?Qe(r[e],t):!1}var Ct=Vh;function jh(t){return er(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,a&&Ct(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var s=r[n];s&&t(e,s,n,o)}return e})}var hl=jh;var Hh=Object.prototype;function Kh(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Hh;return t===r}var Ze=Kh;function Yh(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var dl=Yh;var qh="[object Arguments]";function Xh(t){return ee(t)&&xe(t)==qh}var xo=Xh;var ml=Object.prototype,Qh=ml.hasOwnProperty,zh=ml.propertyIsEnumerable,Zh=xo(function(){return arguments}())?xo:function(t){return ee(t)&&Qh.call(t,"callee")&&!zh.call(t,"callee")},Lt=Zh;function Jh(){return!1}var gl=Jh;var Al=typeof exports=="object"&&exports&&!exports.nodeType&&exports,El=Al&&typeof module=="object"&&module&&!module.nodeType&&module,ed=El&&El.exports===Al,xl=ed?ie.Buffer:void 0,td=xl?xl.isBuffer:void 0,rd=td||gl,ct=rd;var nd="[object Arguments]",id="[object Array]",od="[object Boolean]",ad="[object Date]",sd="[object Error]",ld="[object Function]",ud="[object Map]",cd="[object Number]",fd="[object Object]",pd="[object RegExp]",hd="[object Set]",dd="[object String]",md="[object WeakMap]",gd="[object ArrayBuffer]",Ed="[object DataView]",xd="[object Float32Array]",Ad="[object Float64Array]",Td="[object Int8Array]",Sd="[object Int16Array]",yd="[object Int32Array]",Cd="[object Uint8Array]",Ld="[object Uint8ClampedArray]",Od="[object Uint16Array]",Nd="[object Uint32Array]",V={};V[xd]=V[Ad]=V[Td]=V[Sd]=V[yd]=V[Cd]=V[Ld]=V[Od]=V[Nd]=!0;V[nd]=V[id]=V[gd]=V[od]=V[Ed]=V[ad]=V[sd]=V[ld]=V[ud]=V[cd]=V[fd]=V[pd]=V[hd]=V[dd]=V[md]=!1;function Rd(t){return ee(t)&&tr(t.length)&&!!V[xe(t)]}var Tl=Rd;function _d(t){return function(e){return t(e)}}var Je=_d;var Sl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$r=Sl&&typeof module=="object"&&module&&!module.nodeType&&module,Id=$r&&$r.exports===Sl,Ao=Id&&Cn.process,bd=function(){try{var t=$r&&$r.require&&$r.require("util").types;return t||Ao&&Ao.binding&&Ao.binding("util")}catch{}}(),Be=bd;var yl=Be&&Be.isTypedArray,vd=yl?Je(yl):Tl,rr=vd;var Pd=Object.prototype,Fd=Pd.hasOwnProperty;function Md(t,e){var r=y(t),n=!r&&Lt(t),i=!r&&!n&&ct(t),o=!r&&!n&&!i&&rr(t),a=r||n||i||o,s=a?dl(t.length,String):[],l=s.length;for(var c in t)(e||Fd.call(t,c))&&!(a&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||St(c,l)))&&s.push(c);return s}var In=Md;function Ud(t,e){return function(r){return t(e(r))}}var bn=Ud;var kd=bn(Object.keys,Object),Cl=kd;var wd=Object.prototype,Bd=wd.hasOwnProperty;function Dd(t){if(!Ze(t))return Cl(t);var e=[];for(var r in Object(t))Bd.call(t,r)&&r!="constructor"&&e.push(r);return e}var vn=Dd;function Gd(t){return oe(t)?In(t):vn(t)}var w=Gd;var Wd=Object.prototype,$d=Wd.hasOwnProperty,Vd=hl(function(t,e){if(Ze(e)||oe(e)){ze(e,w(e),t);return}for(var r in e)$d.call(e,r)&&yt(t,r,e[r])}),he=Vd;function jd(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ll=jd;var Hd=Object.prototype,Kd=Hd.hasOwnProperty;function Yd(t){if(!Y(t))return Ll(t);var e=Ze(t),r=[];for(var n in t)n=="constructor"&&(e||!Kd.call(t,n))||r.push(n);return r}var Ol=Yd;function qd(t){return oe(t)?In(t,!0):Ol(t)}var Ot=qd;var Xd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Qd=/^\w*$/;function zd(t,e){if(y(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Tt(t)?!0:Qd.test(t)||!Xd.test(t)||e!=null&&t in Object(e)}var nr=zd;var Zd=Oe(Object,"create"),ft=Zd;function Jd(){this.__data__=ft?ft(null):{},this.size=0}var Nl=Jd;function em(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Rl=em;var tm="__lodash_hash_undefined__",rm=Object.prototype,nm=rm.hasOwnProperty;function im(t){var e=this.__data__;if(ft){var r=e[t];return r===tm?void 0:r}return nm.call(e,t)?e[t]:void 0}var _l=im;var om=Object.prototype,am=om.hasOwnProperty;function sm(t){var e=this.__data__;return ft?e[t]!==void 0:am.call(e,t)}var Il=sm;var lm="__lodash_hash_undefined__";function um(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ft&&e===void 0?lm:e,this}var bl=um;function ir(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ir.prototype.clear=Nl;ir.prototype.delete=Rl;ir.prototype.get=_l;ir.prototype.has=Il;ir.prototype.set=bl;var To=ir;function cm(){this.__data__=[],this.size=0}var vl=cm;function fm(t,e){for(var r=t.length;r--;)if(Qe(t[r][0],e))return r;return-1}var Nt=fm;var pm=Array.prototype,hm=pm.splice;function dm(t){var e=this.__data__,r=Nt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():hm.call(e,r,1),--this.size,!0}var Pl=dm;function mm(t){var e=this.__data__,r=Nt(e,t);return r<0?void 0:e[r][1]}var Fl=mm;function gm(t){return Nt(this.__data__,t)>-1}var Ml=gm;function Em(t,e){var r=this.__data__,n=Nt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Ul=Em;function or(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}or.prototype.clear=vl;or.prototype.delete=Pl;or.prototype.get=Fl;or.prototype.has=Ml;or.prototype.set=Ul;var Rt=or;var xm=Oe(ie,"Map"),_t=xm;function Am(){this.size=0,this.__data__={hash:new To,map:new(_t||Rt),string:new To}}var kl=Am;function Tm(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var wl=Tm;function Sm(t,e){var r=t.__data__;return wl(e)?r[typeof e=="string"?"string":"hash"]:r.map}var It=Sm;function ym(t){var e=It(this,t).delete(t);return this.size-=e?1:0,e}var Bl=ym;function Cm(t){return It(this,t).get(t)}var Dl=Cm;function Lm(t){return It(this,t).has(t)}var Gl=Lm;function Om(t,e){var r=It(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Wl=Om;function ar(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ar.prototype.clear=kl;ar.prototype.delete=Bl;ar.prototype.get=Dl;ar.prototype.has=Gl;ar.prototype.set=Wl;var Dt=ar;var Nm="Expected a function";function So(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Nm);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=t.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(So.Cache||Dt),r}So.Cache=Dt;var $l=So;var Rm=500;function _m(t){var e=$l(t,function(n){return r.size===Rm&&r.clear(),n}),r=e.cache;return e}var Vl=_m;var Im=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bm=/\\(\\)?/g,vm=Vl(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Im,function(r,n,i,o){e.push(i?o.replace(bm,"$1"):n||r)}),e}),jl=vm;function Pm(t){return t==null?"":js(t)}var Hl=Pm;function Fm(t,e){return y(t)?t:nr(t,e)?[t]:jl(Hl(t))}var bt=Fm;var Mm=1/0;function Um(t){if(typeof t=="string"||Tt(t))return t;var e=t+"";return e=="0"&&1/t==-Mm?"-0":e}var et=Um;function km(t,e){e=bt(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[et(e[r++])];return r&&r==n?t:void 0}var sr=km;function wm(t,e,r){var n=t==null?void 0:sr(t,e);return n===void 0?r:n}var Kl=wm;function Bm(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var lr=Bm;var Yl=fe?fe.isConcatSpreadable:void 0;function Dm(t){return y(t)||Lt(t)||!!(Yl&&t&&t[Yl])}var ql=Dm;function Xl(t,e,r,n,i){var o=-1,a=t.length;for(r||(r=ql),i||(i=[]);++o<a;){var s=t[o];e>0&&r(s)?e>1?Xl(s,e-1,r,n,i):lr(i,s):n||(i[i.length]=s)}return i}var ur=Xl;function Gm(t){var e=t==null?0:t.length;return e?ur(t,1):[]}var le=Gm;var Wm=bn(Object.getPrototypeOf,Object),Pn=Wm;function $m(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var Fn=$m;function Vm(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var Ql=Vm;function jm(){this.__data__=new Rt,this.size=0}var zl=jm;function Hm(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Zl=Hm;function Km(t){return this.__data__.get(t)}var Jl=Km;function Ym(t){return this.__data__.has(t)}var eu=Ym;var qm=200;function Xm(t,e){var r=this.__data__;if(r instanceof Rt){var n=r.__data__;if(!_t||n.length<qm-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Dt(n)}return r.set(t,e),this.size=r.size,this}var tu=Xm;function cr(t){var e=this.__data__=new Rt(t);this.size=e.size}cr.prototype.clear=zl;cr.prototype.delete=Zl;cr.prototype.get=Jl;cr.prototype.has=eu;cr.prototype.set=tu;var vt=cr;function Qm(t,e){return t&&ze(e,w(e),t)}var ru=Qm;function zm(t,e){return t&&ze(e,Ot(e),t)}var nu=zm;var su=typeof exports=="object"&&exports&&!exports.nodeType&&exports,iu=su&&typeof module=="object"&&module&&!module.nodeType&&module,Zm=iu&&iu.exports===su,ou=Zm?ie.Buffer:void 0,au=ou?ou.allocUnsafe:void 0;function Jm(t,e){if(e)return t.slice();var r=t.length,n=au?au(r):new t.constructor(r);return t.copy(n),n}var lu=Jm;function eg(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var a=t[r];e(a,r,t)&&(o[i++]=a)}return o}var fr=eg;function tg(){return[]}var Mn=tg;var rg=Object.prototype,ng=rg.propertyIsEnumerable,uu=Object.getOwnPropertySymbols,ig=uu?function(t){return t==null?[]:(t=Object(t),fr(uu(t),function(e){return ng.call(t,e)}))}:Mn,pr=ig;function og(t,e){return ze(t,pr(t),e)}var cu=og;var ag=Object.getOwnPropertySymbols,sg=ag?function(t){for(var e=[];t;)lr(e,pr(t)),t=Pn(t);return e}:Mn,Un=sg;function lg(t,e){return ze(t,Un(t),e)}var fu=lg;function ug(t,e,r){var n=e(t);return y(t)?n:lr(n,r(t))}var kn=ug;function cg(t){return kn(t,w,pr)}var Vr=cg;function fg(t){return kn(t,Ot,Un)}var wn=fg;var pg=Oe(ie,"DataView"),Bn=pg;var hg=Oe(ie,"Promise"),Dn=hg;var dg=Oe(ie,"Set"),Pt=dg;var pu="[object Map]",mg="[object Object]",hu="[object Promise]",du="[object Set]",mu="[object WeakMap]",gu="[object DataView]",gg=ut(Bn),Eg=ut(_t),xg=ut(Dn),Ag=ut(Pt),Tg=ut(On),Gt=xe;(Bn&&Gt(new Bn(new ArrayBuffer(1)))!=gu||_t&&Gt(new _t)!=pu||Dn&&Gt(Dn.resolve())!=hu||Pt&&Gt(new Pt)!=du||On&&Gt(new On)!=mu)&&(Gt=function(t){var e=xe(t),r=e==mg?t.constructor:void 0,n=r?ut(r):"";if(n)switch(n){case gg:return gu;case Eg:return pu;case xg:return hu;case Ag:return du;case Tg:return mu}return e});var $e=Gt;var Sg=Object.prototype,yg=Sg.hasOwnProperty;function Cg(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&yg.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Eu=Cg;var Lg=ie.Uint8Array,hr=Lg;function Og(t){var e=new t.constructor(t.byteLength);return new hr(e).set(new hr(t)),e}var dr=Og;function Ng(t,e){var r=e?dr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var xu=Ng;var Rg=/\w*$/;function _g(t){var e=new t.constructor(t.source,Rg.exec(t));return e.lastIndex=t.lastIndex,e}var Au=_g;var Tu=fe?fe.prototype:void 0,Su=Tu?Tu.valueOf:void 0;function Ig(t){return Su?Object(Su.call(t)):{}}var yu=Ig;function bg(t,e){var r=e?dr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Cu=bg;var vg="[object Boolean]",Pg="[object Date]",Fg="[object Map]",Mg="[object Number]",Ug="[object RegExp]",kg="[object Set]",wg="[object String]",Bg="[object Symbol]",Dg="[object ArrayBuffer]",Gg="[object DataView]",Wg="[object Float32Array]",$g="[object Float64Array]",Vg="[object Int8Array]",jg="[object Int16Array]",Hg="[object Int32Array]",Kg="[object Uint8Array]",Yg="[object Uint8ClampedArray]",qg="[object Uint16Array]",Xg="[object Uint32Array]";function Qg(t,e,r){var n=t.constructor;switch(e){case Dg:return dr(t);case vg:case Pg:return new n(+t);case Gg:return xu(t,r);case Wg:case $g:case Vg:case jg:case Hg:case Kg:case Yg:case qg:case Xg:return Cu(t,r);case Fg:return new n;case Mg:case wg:return new n(t);case Ug:return Au(t);case kg:return new n;case Bg:return yu(t)}}var Lu=Qg;function zg(t){return typeof t.constructor=="function"&&!Ze(t)?rl(Pn(t)):{}}var Ou=zg;var Zg="[object Map]";function Jg(t){return ee(t)&&$e(t)==Zg}var Nu=Jg;var Ru=Be&&Be.isMap,eE=Ru?Je(Ru):Nu,_u=eE;var tE="[object Set]";function rE(t){return ee(t)&&$e(t)==tE}var Iu=rE;var bu=Be&&Be.isSet,nE=bu?Je(bu):Iu,vu=nE;var iE=1,oE=2,aE=4,Pu="[object Arguments]",sE="[object Array]",lE="[object Boolean]",uE="[object Date]",cE="[object Error]",Fu="[object Function]",fE="[object GeneratorFunction]",pE="[object Map]",hE="[object Number]",Mu="[object Object]",dE="[object RegExp]",mE="[object Set]",gE="[object String]",EE="[object Symbol]",xE="[object WeakMap]",AE="[object ArrayBuffer]",TE="[object DataView]",SE="[object Float32Array]",yE="[object Float64Array]",CE="[object Int8Array]",LE="[object Int16Array]",OE="[object Int32Array]",NE="[object Uint8Array]",RE="[object Uint8ClampedArray]",_E="[object Uint16Array]",IE="[object Uint32Array]",B={};B[Pu]=B[sE]=B[AE]=B[TE]=B[lE]=B[uE]=B[SE]=B[yE]=B[CE]=B[LE]=B[OE]=B[pE]=B[hE]=B[Mu]=B[dE]=B[mE]=B[gE]=B[EE]=B[NE]=B[RE]=B[_E]=B[IE]=!0;B[cE]=B[Fu]=B[xE]=!1;function Gn(t,e,r,n,i,o){var a,s=e&iE,l=e&oE,c=e&aE;if(r&&(a=i?r(t,n,i,o):r(t)),a!==void 0)return a;if(!Y(t))return t;var p=y(t);if(p){if(a=Eu(t),!s)return il(t,a)}else{var h=$e(t),d=h==Fu||h==fE;if(ct(t))return lu(t,s);if(h==Mu||h==Pu||d&&!i){if(a=l||d?{}:Ou(t),!s)return l?fu(t,nu(a,t)):cu(t,ru(a,t))}else{if(!B[h])return i?t:{};a=Lu(t,h,s)}}o||(o=new vt);var A=o.get(t);if(A)return A;o.set(t,a),vu(t)?t.forEach(function(N){a.add(Gn(N,e,r,N,t,o))}):_u(t)&&t.forEach(function(N,S){a.set(S,Gn(N,e,r,S,t,o))});var C=c?l?wn:Vr:l?Ot:w,L=p?void 0:C(t);return Nn(L||t,function(N,S){L&&(S=N,N=t[S]),yt(a,S,Gn(N,e,r,S,t,o))}),a}var Uu=Gn;var bE=4;function vE(t){return Uu(t,bE)}var D=vE;function PE(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var tt=PE;var FE="__lodash_hash_undefined__";function ME(t){return this.__data__.set(t,FE),this}var ku=ME;function UE(t){return this.__data__.has(t)}var wu=UE;function Wn(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Dt;++e<r;)this.add(t[e])}Wn.prototype.add=Wn.prototype.push=ku;Wn.prototype.has=wu;var mr=Wn;function kE(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var $n=kE;function wE(t,e){return t.has(e)}var gr=wE;var BE=1,DE=2;function GE(t,e,r,n,i,o){var a=r&BE,s=t.length,l=e.length;if(s!=l&&!(a&&l>s))return!1;var c=o.get(t),p=o.get(e);if(c&&p)return c==e&&p==t;var h=-1,d=!0,A=r&DE?new mr:void 0;for(o.set(t,e),o.set(e,t);++h<s;){var C=t[h],L=e[h];if(n)var N=a?n(L,C,h,e,t,o):n(C,L,h,t,e,o);if(N!==void 0){if(N)continue;d=!1;break}if(A){if(!$n(e,function(S,E){if(!gr(A,E)&&(C===S||i(C,S,r,n,o)))return A.push(E)})){d=!1;break}}else if(!(C===L||i(C,L,r,n,o))){d=!1;break}}return o.delete(t),o.delete(e),d}var Vn=GE;function WE(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Bu=WE;function $E(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Er=$E;var VE=1,jE=2,HE="[object Boolean]",KE="[object Date]",YE="[object Error]",qE="[object Map]",XE="[object Number]",QE="[object RegExp]",zE="[object Set]",ZE="[object String]",JE="[object Symbol]",ex="[object ArrayBuffer]",tx="[object DataView]",Du=fe?fe.prototype:void 0,yo=Du?Du.valueOf:void 0;function rx(t,e,r,n,i,o,a){switch(r){case tx:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ex:return!(t.byteLength!=e.byteLength||!o(new hr(t),new hr(e)));case HE:case KE:case XE:return Qe(+t,+e);case YE:return t.name==e.name&&t.message==e.message;case QE:case ZE:return t==e+"";case qE:var s=Bu;case zE:var l=n&VE;if(s||(s=Er),t.size!=e.size&&!l)return!1;var c=a.get(t);if(c)return c==e;n|=jE,a.set(t,e);var p=Vn(s(t),s(e),n,i,o,a);return a.delete(t),p;case JE:if(yo)return yo.call(t)==yo.call(e)}return!1}var Gu=rx;var nx=1,ix=Object.prototype,ox=ix.hasOwnProperty;function ax(t,e,r,n,i,o){var a=r&nx,s=Vr(t),l=s.length,c=Vr(e),p=c.length;if(l!=p&&!a)return!1;for(var h=l;h--;){var d=s[h];if(!(a?d in e:ox.call(e,d)))return!1}var A=o.get(t),C=o.get(e);if(A&&C)return A==e&&C==t;var L=!0;o.set(t,e),o.set(e,t);for(var N=a;++h<l;){d=s[h];var S=t[d],E=e[d];if(n)var m=a?n(E,S,d,e,t,o):n(S,E,d,t,e,o);if(!(m===void 0?S===E||i(S,E,r,n,o):m)){L=!1;break}N||(N=d=="constructor")}if(L&&!N){var _=t.constructor,I=e.constructor;_!=I&&"constructor"in t&&"constructor"in e&&!(typeof _=="function"&&_ instanceof _&&typeof I=="function"&&I instanceof I)&&(L=!1)}return o.delete(t),o.delete(e),L}var Wu=ax;var sx=1,$u="[object Arguments]",Vu="[object Array]",jn="[object Object]",lx=Object.prototype,ju=lx.hasOwnProperty;function ux(t,e,r,n,i,o){var a=y(t),s=y(e),l=a?Vu:$e(t),c=s?Vu:$e(e);l=l==$u?jn:l,c=c==$u?jn:c;var p=l==jn,h=c==jn,d=l==c;if(d&&ct(t)){if(!ct(e))return!1;a=!0,p=!1}if(d&&!p)return o||(o=new vt),a||rr(t)?Vn(t,e,r,n,i,o):Gu(t,e,l,r,n,i,o);if(!(r&sx)){var A=p&&ju.call(t,"__wrapped__"),C=h&&ju.call(e,"__wrapped__");if(A||C){var L=A?t.value():t,N=C?e.value():e;return o||(o=new vt),i(L,N,r,n,o)}}return d?(o||(o=new vt),Wu(t,e,r,n,i,o)):!1}var Hu=ux;function Ku(t,e,r,n,i){return t===e?!0:t==null||e==null||!ee(t)&&!ee(e)?t!==t&&e!==e:Hu(t,e,r,n,Ku,i)}var Hn=Ku;var cx=1,fx=2;function px(t,e,r,n){var i=r.length,o=i,a=!n;if(t==null)return!o;for(t=Object(t);i--;){var s=r[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){s=r[i];var l=s[0],c=t[l],p=s[1];if(a&&s[2]){if(c===void 0&&!(l in t))return!1}else{var h=new vt;if(n)var d=n(c,p,l,t,e,h);if(!(d===void 0?Hn(p,c,cx|fx,n,h):d))return!1}}return!0}var Yu=px;function hx(t){return t===t&&!Y(t)}var Kn=hx;function dx(t){for(var e=w(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Kn(i)]}return e}var qu=dx;function mx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Yn=mx;function gx(t){var e=qu(t);return e.length==1&&e[0][2]?Yn(e[0][0],e[0][1]):function(r){return r===t||Yu(r,t,e)}}var Xu=gx;function Ex(t,e){return t!=null&&e in Object(t)}var Qu=Ex;function xx(t,e,r){e=bt(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var a=et(e[n]);if(!(o=t!=null&&r(t,a)))break;t=t[a]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&tr(i)&&St(a,i)&&(y(t)||Lt(t)))}var qn=xx;function Ax(t,e){return t!=null&&qn(t,e,Qu)}var zu=Ax;var Tx=1,Sx=2;function yx(t,e){return nr(t)&&Kn(e)?Yn(et(t),e):function(r){var n=Kl(r,t);return n===void 0&&n===e?zu(r,t):Hn(e,n,Tx|Sx)}}var Zu=yx;function Cx(t){return function(e){return e?.[t]}}var Ju=Cx;function Lx(t){return function(e){return sr(e,t)}}var ec=Lx;function Ox(t){return nr(t)?Ju(et(t)):ec(t)}var tc=Ox;function Nx(t){return typeof t=="function"?t:t==null?we:typeof t=="object"?y(t)?Zu(t[0],t[1]):Xu(t):tc(t)}var ae=Nx;function Rx(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var a=t[i];e(n,a,r(a),t)}return n}var rc=Rx;function _x(t){return function(e,r,n){for(var i=-1,o=Object(e),a=n(e),s=a.length;s--;){var l=a[t?s:++i];if(r(o[l],l,o)===!1)break}return e}}var nc=_x;var Ix=nc(),ic=Ix;function bx(t,e){return t&&ic(t,e,w)}var oc=bx;function vx(t,e){return function(r,n){if(r==null)return r;if(!oe(r))return t(r,n);for(var i=r.length,o=e?i:-1,a=Object(r);(e?o--:++o<i)&&n(a[o],o,a)!==!1;);return r}}var ac=vx;var Px=ac(oc),Ne=Px;function Fx(t,e,r,n){return Ne(t,function(i,o,a){e(n,i,r(i),a)}),n}var sc=Fx;function Mx(t,e){return function(r,n){var i=y(r)?rc:sc,o=e?e():{};return i(r,t,ae(n,2),o)}}var lc=Mx;var uc=Object.prototype,Ux=uc.hasOwnProperty,kx=er(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&Ct(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],a=Ot(o),s=-1,l=a.length;++s<l;){var c=a[s],p=t[c];(p===void 0||Qe(p,uc[c])&&!Ux.call(t,c))&&(t[c]=o[c])}return t}),xr=kx;function wx(t){return ee(t)&&oe(t)}var Co=wx;function Bx(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var Xn=Bx;var Dx=200;function Gx(t,e,r,n){var i=-1,o=_n,a=!0,s=t.length,l=[],c=e.length;if(!s)return l;r&&(e=qe(e,Je(r))),n?(o=Xn,a=!1):e.length>=Dx&&(o=gr,a=!1,e=new mr(e));e:for(;++i<s;){var p=t[i],h=r==null?p:r(p);if(p=n||p!==0?p:0,a&&h===h){for(var d=c;d--;)if(e[d]===h)continue e;l.push(p)}else o(e,h,n)||l.push(p)}return l}var cc=Gx;var Wx=er(function(t,e){return Co(t)?cc(t,ur(e,1,Co,!0)):[]}),Ft=Wx;function $x(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var rt=$x;function Vx(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Xe(e),Fn(t,e<0?0:e,n)):[]}var te=Vx;function jx(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:Xe(e),e=n-e,Fn(t,0,e<0?0:e)):[]}var pt=jx;function Hx(t){return typeof t=="function"?t:we}var fc=Hx;function Kx(t,e){var r=y(t)?Nn:Ne;return r(t,fc(e))}var x=Kx;function Yx(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var pc=Yx;function qx(t,e){var r=!0;return Ne(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var hc=qx;function Xx(t,e,r){var n=y(t)?pc:hc;return r&&Ct(t,e,r)&&(e=void 0),n(t,ae(e,3))}var me=Xx;function Qx(t,e){var r=[];return Ne(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var Qn=Qx;function zx(t,e){var r=y(t)?fr:Qn;return r(t,ae(e,3))}var ge=zx;function Zx(t){return function(e,r,n){var i=Object(e);if(!oe(e)){var o=ae(r,3);e=w(e),r=function(s){return o(i[s],s,i)}}var a=t(e,r,n);return a>-1?i[o?e[a]:a]:void 0}}var dc=Zx;var Jx=Math.max;function eA(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Xe(r);return i<0&&(i=Jx(n+i,0)),Rn(t,ae(e,3),i)}var mc=eA;var tA=dc(mc),nt=tA;function rA(t){return t&&t.length?t[0]:void 0}var pe=rA;function nA(t,e){var r=-1,n=oe(t)?Array(t.length):[];return Ne(t,function(i,o,a){n[++r]=e(i,o,a)}),n}var gc=nA;function iA(t,e){var r=y(t)?qe:gc;return r(t,ae(e,3))}var g=iA;function oA(t,e){return ur(g(t,e),1)}var Te=oA;var aA=Object.prototype,sA=aA.hasOwnProperty,lA=lc(function(t,e,r){sA.call(t,r)?t[r].push(e):Jt(t,r,[e])}),Lo=lA;var uA=Object.prototype,cA=uA.hasOwnProperty;function fA(t,e){return t!=null&&cA.call(t,e)}var Ec=fA;function pA(t,e){return t!=null&&qn(t,e,Ec)}var T=pA;var hA="[object String]";function dA(t){return typeof t=="string"||!y(t)&&ee(t)&&xe(t)==hA}var ue=dA;function mA(t,e){return qe(e,function(r){return t[r]})}var xc=mA;function gA(t){return t==null?[]:xc(t,w(t))}var U=gA;var EA=Math.max;function xA(t,e,r,n){t=oe(t)?t:U(t),r=r&&!n?Xe(r):0;var i=t.length;return r<0&&(r=EA(i+r,0)),ue(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Zt(t,e,r)>-1}var H=xA;var AA=Math.max;function TA(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:Xe(r);return i<0&&(i=AA(n+i,0)),Zt(t,e,i)}var zn=TA;var SA="[object Map]",yA="[object Set]",CA=Object.prototype,LA=CA.hasOwnProperty;function OA(t){if(t==null)return!0;if(oe(t)&&(y(t)||typeof t=="string"||typeof t.splice=="function"||ct(t)||rr(t)||Lt(t)))return!t.length;var e=$e(t);if(e==SA||e==yA)return!t.size;if(Ze(t))return!vn(t).length;for(var r in t)if(LA.call(t,r))return!1;return!0}var v=OA;var NA="[object RegExp]";function RA(t){return ee(t)&&xe(t)==NA}var Ac=RA;var Tc=Be&&Be.isRegExp,_A=Tc?Je(Tc):Ac,De=_A;function IA(t){return t===void 0}var Ee=IA;var bA="Expected a function";function vA(t){if(typeof t!="function")throw new TypeError(bA);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var Sc=vA;function PA(t,e,r,n){if(!Y(t))return t;e=bt(e,t);for(var i=-1,o=e.length,a=o-1,s=t;s!=null&&++i<o;){var l=et(e[i]),c=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=a){var p=s[l];c=n?n(p,l,s):void 0,c===void 0&&(c=Y(p)?p:St(e[i+1])?[]:{})}yt(s,l,c),s=s[l]}return t}var yc=PA;function FA(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var a=e[n],s=sr(t,a);r(s,a)&&yc(o,bt(a,t),s)}return o}var Cc=FA;function MA(t,e){if(t==null)return{};var r=qe(wn(t),function(n){return[n]});return e=ae(e),Cc(t,r,function(n,i){return e(n,i[0])})}var Re=MA;function UA(t,e,r,n,i){return i(t,function(o,a,s){r=n?(n=!1,o):e(r,o,a,s)}),r}var Lc=UA;function kA(t,e,r){var n=y(t)?Ql:Lc,i=arguments.length<3;return n(t,ae(e,4),r,i,Ne)}var se=kA;function wA(t,e){var r=y(t)?fr:Qn;return r(t,Sc(ae(e,3)))}var Mt=wA;function BA(t,e){var r;return Ne(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var Oc=BA;function DA(t,e,r){var n=y(t)?$n:Oc;return r&&Ct(t,e,r)&&(e=void 0),n(t,ae(e,3))}var jr=DA;var GA=1/0,WA=Pt&&1/Er(new Pt([,-0]))[1]==GA?function(t){return new Pt(t)}:q,Nc=WA;var $A=200;function VA(t,e,r){var n=-1,i=_n,o=t.length,a=!0,s=[],l=s;if(r)a=!1,i=Xn;else if(o>=$A){var c=e?null:Nc(t);if(c)return Er(c);a=!1,i=gr,l=new mr}else l=e?[]:s;e:for(;++n<o;){var p=t[n],h=e?e(p):p;if(p=r||p!==0?p:0,a&&h===h){for(var d=l.length;d--;)if(l[d]===h)continue e;e&&l.push(h),s.push(p)}else i(l,h,r)||(l!==s&&l.push(h),s.push(p))}return s}var Rc=VA;function jA(t){return t&&t.length?Rc(t):[]}var Ar=jA;function Tr(t){console&&console.error&&console.error(`Error: ${t}`)}function Hr(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Kr(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function Yr(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function HA(t){return KA(t)?t.LABEL:t.name}function KA(t){return ue(t.LABEL)&&t.LABEL!==""}var Fe=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),x(this.definition,r=>{r.accept(e)})}},G=class extends Fe{constructor(e){super([]),this.idx=1,he(this,Re(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},Se=class extends Fe{constructor(e){super(e.definition),this.orgText="",he(this,Re(e,r=>r!==void 0))}},W=class extends Fe{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,he(this,Re(e,r=>r!==void 0))}},j=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},re=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},ne=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},M=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},Z=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},J=class extends Fe{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,he(this,Re(e,r=>r!==void 0))}},F=class{constructor(e){this.idx=1,he(this,Re(e,r=>r!==void 0))}accept(e){e.visit(this)}};function Zn(t){return g(t,Sr)}function Sr(t){function e(r){return g(r,Sr)}if(t instanceof G){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ue(t.label)&&(r.label=t.label),r}else{if(t instanceof W)return{type:"Alternative",definition:e(t.definition)};if(t instanceof j)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof re)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof ne)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Sr(new F({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Z)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Sr(new F({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof M)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof J)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof F){let r={type:"Terminal",name:t.terminalType.name,label:HA(t.terminalType),idx:t.idx};ue(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=De(n)?n.source:n),r}else{if(t instanceof Se)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var ye=class{visit(e){let r=e;switch(r.constructor){case G:return this.visitNonTerminal(r);case W:return this.visitAlternative(r);case j:return this.visitOption(r);case re:return this.visitRepetitionMandatory(r);case ne:return this.visitRepetitionMandatoryWithSeparator(r);case Z:return this.visitRepetitionWithSeparator(r);case M:return this.visitRepetition(r);case J:return this.visitAlternation(r);case F:return this.visitTerminal(r);case Se:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Oo(t){return t instanceof W||t instanceof j||t instanceof M||t instanceof re||t instanceof ne||t instanceof Z||t instanceof F||t instanceof Se}function Wt(t,e=[]){return t instanceof j||t instanceof M||t instanceof Z?!0:t instanceof J?jr(t.definition,n=>Wt(n,e)):t instanceof G&&H(e,t)?!1:t instanceof Fe?(t instanceof G&&e.push(t),me(t.definition,n=>Wt(n,e))):!1}function No(t){return t instanceof J}function _e(t){if(t instanceof G)return"SUBRULE";if(t instanceof j)return"OPTION";if(t instanceof J)return"OR";if(t instanceof re)return"AT_LEAST_ONE";if(t instanceof ne)return"AT_LEAST_ONE_SEP";if(t instanceof Z)return"MANY_SEP";if(t instanceof M)return"MANY";if(t instanceof F)return"CONSUME";throw Error("non exhaustive match")}var ht=class{walk(e,r=[]){x(e.definition,(n,i)=>{let o=te(e.definition,i+1);if(n instanceof G)this.walkProdRef(n,o,r);else if(n instanceof F)this.walkTerminal(n,o,r);else if(n instanceof W)this.walkFlat(n,o,r);else if(n instanceof j)this.walkOption(n,o,r);else if(n instanceof re)this.walkAtLeastOne(n,o,r);else if(n instanceof ne)this.walkAtLeastOneSep(n,o,r);else if(n instanceof Z)this.walkManySep(n,o,r);else if(n instanceof M)this.walkMany(n,o,r);else if(n instanceof J)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new j({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=_c(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new j({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=_c(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);x(e.definition,o=>{let a=new W({definition:[o]});this.walk(a,i)})}};function _c(t,e,r){return[new j({definition:[new F({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function $t(t){if(t instanceof G)return $t(t.referencedRule);if(t instanceof F)return XA(t);if(Oo(t))return YA(t);if(No(t))return qA(t);throw Error("non exhaustive match")}function YA(t){let e=[],r=t.definition,n=0,i=r.length>n,o,a=!0;for(;i&&a;)o=r[n],a=Wt(o),e=e.concat($t(o)),n=n+1,i=r.length>n;return Ar(e)}function qA(t){let e=g(t.definition,r=>$t(r));return Ar(le(e))}function XA(t){return[t.terminalType]}var Jn="_~IN~_";var Ro=class extends ht{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=QA(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),a=new W({definition:o}),s=$t(a);this.follows[i]=s}};function Ic(t){let e={};return x(t,r=>{let n=new Ro(r).startWalking();he(e,n)}),e}function QA(t,e){return t.name+e+Jn}function O(t){return t.charCodeAt(0)}function ei(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function yr(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Vt(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function qr(){throw Error("Internal Error - Should never get here!")}function _o(t){return t.type==="Character"}var Xr=[];for(let t=O("0");t<=O("9");t++)Xr.push(t);var Qr=[O("_")].concat(Xr);for(let t=O("a");t<=O("z");t++)Qr.push(t);for(let t=O("A");t<=O("Z");t++)Qr.push(t);var Io=[O(" "),O("\f"),O(`
|
|
7
7
|
`),O("\r"),O(" "),O("\v"),O(" "),O("\xA0"),O("\u1680"),O("\u2000"),O("\u2001"),O("\u2002"),O("\u2003"),O("\u2004"),O("\u2005"),O("\u2006"),O("\u2007"),O("\u2008"),O("\u2009"),O("\u200A"),O("\u2028"),O("\u2029"),O("\u202F"),O("\u205F"),O("\u3000"),O("\uFEFF")];var zA=/[0-9a-fA-F]/,ti=/[0-9]/,ZA=/[1-9]/,zr=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");let r=this.disjunction();this.consumeChar("/");let n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":yr(n,"global");break;case"i":yr(n,"ignoreCase");break;case"m":yr(n,"multiLine");break;case"u":yr(n,"unicode");break;case"y":yr(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:r,loc:this.loc(0)}}disjunction(){let e=[],r=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(r)}}alternative(){let e=[],r=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(r)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let r;switch(this.popChar()){case"=":r="Lookahead";break;case"!":r="NegativeLookahead";break}Vt(r);let n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return qr()}quantifier(e=!1){let r,n=this.idx;switch(this.popChar()){case"*":r={atLeast:0,atMost:1/0};break;case"+":r={atLeast:1,atMost:1/0};break;case"?":r={atLeast:0,atMost:1};break;case"{":let i=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:i,atMost:i};break;case",":let o;this.isDigit()?(o=this.integerIncludingZero(),r={atLeast:i,atMost:o}):r={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;Vt(r);break}if(!(e===!0&&r===void 0)&&Vt(r))return this.peekChar(0)==="?"?(this.consumeChar("?"),r.greedy=!1):r.greedy=!0,r.type="Quantifier",r.loc=this.loc(n),r}atom(){let e,r=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Vt(e)?(e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):qr()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[O(`
|
|
8
8
|
`),O("\r"),O("\u2028"),O("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,r=!1;switch(this.popChar()){case"d":e=Xr;break;case"D":e=Xr,r=!0;break;case"s":e=Io;break;case"S":e=Io,r=!0;break;case"w":e=Qr;break;case"W":e=Qr,r=!0;break}return Vt(e)?{type:"Set",value:e,complement:r}:qr()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=O("\f");break;case"n":e=O(`
|
|
9
9
|
`);break;case"r":e=O("\r");break;case"t":e=O(" ");break;case"v":e=O("\v");break}return Vt(e)?{type:"Character",value:e}:qr()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:O("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){let e=this.popChar();return{type:"Character",value:O(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Tr(`${Zr}
|
|
21
21
|
Failed parsing: < ${t.toString()} >
|
|
22
22
|
Using the @chevrotain/regexp-to-ast library
|
|
23
|
-
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function bo(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)bo(t.value[i],e,r);break;case"Alternative":let n=t.value;for(let i=0;i<n.length;i++){let o=n[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let a=o;switch(a.type){case"Character":ni(a.value,e,r);break;case"Set":if(a.complement===!0)throw Error(Pc);x(a.value,l=>{if(typeof l=="number")ni(l,e,r);else{let c=l;if(r===!0)for(let p=c.from;p<=c.to;p++)ni(p,e,r);else{for(let p=c.from;p<=c.to&&p<Lr;p++)ni(p,e,r);if(c.to>=Lr){let p=c.from>=Lr?c.from:Lr,h=c.to,d=
|
|
24
|
-
`],tracer:(E,m)=>m()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{xT()});let n;r("Reject Lexer.NA",()=>{n=Mt(t,E=>E[jt]===b.NA)});let i=!1,o;r("Transform Patterns",()=>{i=!1,o=g(n,E=>{let m=E[jt];if(De(m)){let _=m.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!m.ignoreCase?_:_.length===2&&_[0]==="\\"&&!H(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:e.useSticky?Uc(m):Mc(m)}else{if(Ae(m))return i=!0,{exec:m};if(typeof m=="object")return i=!0,m;if(typeof m=="string"){if(m.length===1)return m;{let _=m.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),I=new RegExp(_);return e.useSticky?Uc(I):Mc(I)}}else throw Error("non exhaustive match")}})});let a,s,l,c,p;r("misc mapping",()=>{a=g(n,E=>E.tokenTypeIdx),s=g(n,E=>{let m=E.GROUP;if(m!==b.SKIPPED){if(ue(m))return m;if(Ee(m))return!1;throw Error("non exhaustive match")}}),l=g(n,E=>{let m=E.LONGER_ALT;if(m)return y(m)?g(m,I=>zn(n,I)):[zn(n,m)]}),c=g(n,E=>E.PUSH_MODE),p=g(n,E=>T(E,"POP_MODE"))});let h;r("Line Terminator Handling",()=>{let E=jc(e.lineTerminatorCharacters);h=g(n,m=>!1),e.positionTracking!=="onlyOffset"&&(h=g(n,m=>T(m,"LINE_BREAKS")?!!m.LINE_BREAKS:Vc(m,E)===!1&&ii(E,m.PATTERN)))});let d,A,C,L;r("Misc Mapping #2",()=>{d=g(n,Wc),A=g(o,gT),C=se(n,(E,m)=>{let _=m.GROUP;return ue(_)&&_!==b.SKIPPED&&(E[_]=[]),E},{}),L=g(o,(E,m)=>({pattern:o[m],longerAlt:l[m],canLineTerminator:h[m],isCustom:d[m],short:A[m],group:s[m],push:c[m],pop:p[m],tokenTypeIdx:a[m],tokenType:n[m]}))});let N=!0,S=[];return e.safeMode||r("First Char Optimization",()=>{S=se(n,(E,m,_)=>{if(typeof m.PATTERN=="string"){let I=m.PATTERN.charCodeAt(0),Ie=
|
|
23
|
+
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function bo(t,e,r){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)bo(t.value[i],e,r);break;case"Alternative":let n=t.value;for(let i=0;i<n.length;i++){let o=n[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let a=o;switch(a.type){case"Character":ni(a.value,e,r);break;case"Set":if(a.complement===!0)throw Error(Pc);x(a.value,l=>{if(typeof l=="number")ni(l,e,r);else{let c=l;if(r===!0)for(let p=c.from;p<=c.to;p++)ni(p,e,r);else{for(let p=c.from;p<=c.to&&p<Lr;p++)ni(p,e,r);if(c.to>=Lr){let p=c.from>=Lr?c.from:Lr,h=c.to,d=it(p),A=it(h);for(let C=d;C<=A;C++)e[C]=C}}}});break;case"Group":bo(a.value,e,r);break;default:throw Error("Non Exhaustive Match")}let s=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&vo(a)===!1||a.type!=="Group"&&s===!1)break}break;default:throw Error("non exhaustive match!")}return U(e)}function ni(t,e,r){let n=it(t);e[n]=n,r===!0&&eT(t,e)}function eT(t,e){let r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){let i=it(n.charCodeAt(0));e[i]=i}else{let i=r.toLowerCase();if(i!==r){let o=it(i.charCodeAt(0));e[o]=o}}}function vc(t,e){return nt(t.value,r=>{if(typeof r=="number")return H(e,r);{let n=r;return nt(e,i=>n.from<=i&&i<=n.to)!==void 0}})}function vo(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?y(t.value)?me(t.value,vo):vo(t.value):!1}var Po=class extends Ut{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){H(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?vc(e,this.targetCharCodes)===void 0&&(this.found=!0):vc(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function ii(t,e){if(e instanceof RegExp){let r=Cr(e),n=new Po(t);return n.visit(r),n.found}else return nt(e,r=>H(t,r.charCodeAt(0)))!==void 0}var jt="PATTERN",Or="defaultMode",oi="modes",Mo=typeof new RegExp("(?:)").sticky=="boolean";function kc(t,e){e=xr(e,{useSticky:Mo,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
24
|
+
`],tracer:(E,m)=>m()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{xT()});let n;r("Reject Lexer.NA",()=>{n=Mt(t,E=>E[jt]===b.NA)});let i=!1,o;r("Transform Patterns",()=>{i=!1,o=g(n,E=>{let m=E[jt];if(De(m)){let _=m.source;return _.length===1&&_!=="^"&&_!=="$"&&_!=="."&&!m.ignoreCase?_:_.length===2&&_[0]==="\\"&&!H(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],_[1])?_[1]:e.useSticky?Uc(m):Mc(m)}else{if(Ae(m))return i=!0,{exec:m};if(typeof m=="object")return i=!0,m;if(typeof m=="string"){if(m.length===1)return m;{let _=m.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),I=new RegExp(_);return e.useSticky?Uc(I):Mc(I)}}else throw Error("non exhaustive match")}})});let a,s,l,c,p;r("misc mapping",()=>{a=g(n,E=>E.tokenTypeIdx),s=g(n,E=>{let m=E.GROUP;if(m!==b.SKIPPED){if(ue(m))return m;if(Ee(m))return!1;throw Error("non exhaustive match")}}),l=g(n,E=>{let m=E.LONGER_ALT;if(m)return y(m)?g(m,I=>zn(n,I)):[zn(n,m)]}),c=g(n,E=>E.PUSH_MODE),p=g(n,E=>T(E,"POP_MODE"))});let h;r("Line Terminator Handling",()=>{let E=jc(e.lineTerminatorCharacters);h=g(n,m=>!1),e.positionTracking!=="onlyOffset"&&(h=g(n,m=>T(m,"LINE_BREAKS")?!!m.LINE_BREAKS:Vc(m,E)===!1&&ii(E,m.PATTERN)))});let d,A,C,L;r("Misc Mapping #2",()=>{d=g(n,Wc),A=g(o,gT),C=se(n,(E,m)=>{let _=m.GROUP;return ue(_)&&_!==b.SKIPPED&&(E[_]=[]),E},{}),L=g(o,(E,m)=>({pattern:o[m],longerAlt:l[m],canLineTerminator:h[m],isCustom:d[m],short:A[m],group:s[m],push:c[m],pop:p[m],tokenTypeIdx:a[m],tokenType:n[m]}))});let N=!0,S=[];return e.safeMode||r("First Char Optimization",()=>{S=se(n,(E,m,_)=>{if(typeof m.PATTERN=="string"){let I=m.PATTERN.charCodeAt(0),Ie=it(I);Fo(E,Ie,L[_])}else if(y(m.START_CHARS_HINT)){let I;x(m.START_CHARS_HINT,Ie=>{let ao=typeof Ie=="string"?Ie.charCodeAt(0):Ie,Ye=it(ao);I!==Ye&&(I=Ye,Fo(E,Ye,L[_]))})}else if(De(m.PATTERN))if(m.PATTERN.unicode)N=!1,e.ensureOptimizations&&Tr(`${Zr} Unable to analyze < ${m.PATTERN.toString()} > pattern.
|
|
25
25
|
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
26
26
|
This will disable the lexer's first char optimizations.
|
|
27
27
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let I=Fc(m.PATTERN,e.ensureOptimizations);v(I)&&(N=!1),x(I,Ie=>{Fo(E,Ie,L[_])})}else e.ensureOptimizations&&Tr(`${Zr} TokenType: <${m.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
31
31
|
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:K.EOI_ANCHOR_FOUND,tokenTypes:[i]}))}function aT(t){let e=ge(t,n=>n.PATTERN.test(""));return g(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:K.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var sT=/[^\\[][\^]|^\^/;function lT(t){class e extends Ut{constructor(){super(...arguments),this.found=!1}visitStartAnchor(o){this.found=!0}}let r=ge(t,i=>{let o=i.PATTERN;try{let a=Cr(o),s=new e;return s.visit(a),s.found}catch{return sT.test(o.source)}});return g(r,i=>({message:`Unexpected RegExp Anchor Error:
|
|
32
32
|
Token Type: ->`+i.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
33
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:K.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function uT(t){let e=ge(t,n=>{let i=n[jt];return i instanceof RegExp&&(i.multiline||i.global)});return g(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:K.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function cT(t){let e=[],r=g(t,o=>se(t,(a,s)=>(o.PATTERN.source===s.PATTERN.source&&!H(e,s)&&s.PATTERN!==b.NA&&(e.push(s),a.push(s)),a),[]));r=
|
|
33
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:K.SOI_ANCHOR_FOUND,tokenTypes:[i]}))}function uT(t){let e=ge(t,n=>{let i=n[jt];return i instanceof RegExp&&(i.multiline||i.global)});return g(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:K.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function cT(t){let e=[],r=g(t,o=>se(t,(a,s)=>(o.PATTERN.source===s.PATTERN.source&&!H(e,s)&&s.PATTERN!==b.NA&&(e.push(s),a.push(s)),a),[]));r=tt(r);let n=ge(r,o=>o.length>1);return g(n,o=>{let a=g(o,l=>l.name);return{message:`The same RegExp pattern ->${pe(o).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:K.DUPLICATE_PATTERNS_FOUND,tokenTypes:o}})}function fT(t){let e=ge(t,n=>{if(!T(n,"GROUP"))return!1;let i=n.GROUP;return i!==b.SKIPPED&&i!==b.NA&&!ue(i)});return g(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:K.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function pT(t,e){let r=ge(t,i=>i.PUSH_MODE!==void 0&&!H(e,i.PUSH_MODE));return g(r,i=>({message:`Token Type: ->${i.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${i.PUSH_MODE}<-which does not exist`,type:K.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[i]}))}function hT(t){let e=[],r=se(t,(n,i,o)=>{let a=i.PATTERN;return a===b.NA||(ue(a)?n.push({str:a,idx:o,tokenType:i}):De(a)&&mT(a)&&n.push({str:a.source,idx:o,tokenType:i})),n},[]);return x(t,(n,i)=>{x(r,({str:o,idx:a,tokenType:s})=>{if(i<a&&dT(o,n.PATTERN)){let l=`Token: ->${s.name}<- can never be matched.
|
|
34
34
|
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
|
|
35
|
-
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:K.UNREACHABLE_PATTERN,tokenTypes:[n,s]})}})}),e}function dT(t,e){if(De(e)){let r=e.exec(t);return r!==null&&r.index===0}else{if(Ae(e))return e(t,0,[],{});if(T(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function mT(t){return
|
|
35
|
+
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:K.UNREACHABLE_PATTERN,tokenTypes:[n,s]})}})}),e}function dT(t,e){if(De(e)){let r=e.exec(t);return r!==null&&r.index===0}else{if(Ae(e))return e(t,0,[],{});if(T(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function mT(t){return nt([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}function Mc(t){let e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function Uc(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function Bc(t,e,r){let n=[];return T(t,Or)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+Or+`> property in its definition
|
|
36
36
|
`,type:K.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),T(t,oi)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+oi+`> property in its definition
|
|
37
37
|
`,type:K.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),T(t,oi)&&T(t,Or)&&!T(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${Or}: <${t.defaultMode}>which does not exist
|
|
38
38
|
`,type:K.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),T(t,oi)&&x(t.modes,(i,o)=>{x(i,(a,s)=>{if(Ee(a))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${o}> at index: <${s}>
|
|
39
39
|
`,type:K.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(T(a,"LONGER_ALT")){let l=y(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];x(l,c=>{!Ee(c)&&!H(i,c)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${a.name}> outside of mode <${o}>
|
|
40
|
-
`,type:K.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function Dc(t,e,r){let n=[],i=!1,o=
|
|
40
|
+
`,type:K.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function Dc(t,e,r){let n=[],i=!1,o=tt(le(U(t.modes))),a=Mt(o,l=>l[jt]===b.NA),s=jc(r);return e&&x(a,l=>{let c=Vc(l,s);if(c!==!1){let h={message:ET(l,c),type:c.issue,tokenType:l};n.push(h)}else T(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(i=!0):ii(s,l.PATTERN)&&(i=!0)}),e&&!i&&n.push({message:`Warning: No LINE_BREAKS Found.
|
|
41
41
|
This Lexer has been defined to track line and column information,
|
|
42
42
|
But none of the Token Types can be identified as matching a line terminator.
|
|
43
43
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
@@ -46,7 +46,7 @@ See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.
|
|
|
46
46
|
Root cause: ${e.errMsg}.
|
|
47
47
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===K.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
48
48
|
The problem is in the <${t.name}> Token Type
|
|
49
|
-
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function jc(t){return g(t,r=>ue(r)?r.charCodeAt(0):r)}function Fo(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}var Lr=256,ai=[];function
|
|
49
|
+
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function jc(t){return g(t,r=>ue(r)?r.charCodeAt(0):r)}function Fo(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}var Lr=256,ai=[];function it(t){return t<Lr?t:ai[t]}function xT(){if(v(ai)){ai=new Array(65536);for(let t=0;t<65536;t++)ai[t]=t>255?255+~~(t/255):t}}function dt(t,e){let r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function Nr(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var Hc=1,Yc={};function mt(t){let e=AT(t);TT(e),yT(e),ST(e),x(e,r=>{r.isParent=r.categoryMatches.length>0})}function AT(t){let e=D(t),r=t,n=!0;for(;n;){r=tt(le(g(r,o=>o.CATEGORIES)));let i=Ft(r,e);e=e.concat(i),v(i)?n=!1:r=i}return e}function TT(t){x(t,e=>{Uo(e)||(Yc[Hc]=e,e.tokenTypeIdx=Hc++),Kc(e)&&!y(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Kc(e)||(e.CATEGORIES=[]),CT(e)||(e.categoryMatches=[]),LT(e)||(e.categoryMatchesMap={})})}function ST(t){x(t,e=>{e.categoryMatches=[],x(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(Yc[n].tokenTypeIdx)})})}function yT(t){x(t,e=>{qc([],e)})}function qc(t,e){x(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),x(e.CATEGORIES,r=>{let n=t.concat(e);H(n,r)||qc(n,r)})}function Uo(t){return T(t,"tokenTypeIdx")}function Kc(t){return T(t,"CATEGORIES")}function CT(t){return T(t,"categoryMatches")}function LT(t){return T(t,"categoryMatchesMap")}function Xc(t){return T(t,"tokenTypeIdx")}var ko={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}};var K;(function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",t[t.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",t[t.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",t[t.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",t[t.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",t[t.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",t[t.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",t[t.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",t[t.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",t[t.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",t[t.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",t[t.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",t[t.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(K||(K={}));var Jr={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
50
50
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:ko,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Jr);var b=class{constructor(e,r=Jr){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${i}>`);let{time:s,value:l}=Kr(o),c=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&c(`${a}<-- <${i}> time: ${s}ms`),this.traceInitIndent--,l}else return o()},typeof r=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
51
51
|
a boolean 2nd argument is no longer supported`);this.config=he({},Jr,r);let n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,o=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Jr.lineTerminatorsPattern)this.config.lineTerminatorsPattern=$c;else if(this.config.lineTerminatorCharacters===Jr.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
52
52
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(r.safeMode&&r.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),y(e)?i={modes:{defaultMode:D(e)},defaultMode:Or}:(o=!1,i=D(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Bc(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Dc(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},x(i.modes,(s,l)=>{i.modes[l]=Mt(s,c=>Ee(c))});let a=w(i.modes);if(x(i.modes,(s,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(wc(s,a))}),v(this.lexerDefinitionErrors)){mt(s);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=kc(s,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=c.charCodeToPatternIdxToConfig,this.emptyGroups=he({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=c.canBeOptimized}})}),this.defaultMode=i.defaultMode,!v(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let l=g(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
|
|
@@ -55,7 +55,7 @@ a boolean 2nd argument is no longer supported`);this.config=he({},Jr,r);let n=th
|
|
|
55
55
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
56
56
|
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{bc()}),this.TRACE_INIT("toFastProperties",()=>{Yr(this)})})}tokenize(e,r=this.defaultMode){if(!v(this.lexerDefinitionErrors)){let i=g(this.lexerDefinitionErrors,o=>o.message).join(`-----------------------
|
|
57
57
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
58
|
-
`+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,o,a,s,l,c,p,h,d,A,C,L,N,S,E,m=e,_=m.length,I=0,Ie=0,ao=this.hasCustom?0:Math.floor(e.length/10),
|
|
58
|
+
`+i)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,i,o,a,s,l,c,p,h,d,A,C,L,N,S,E,m=e,_=m.length,I=0,Ie=0,ao=this.hasCustom?0:Math.floor(e.length/10),Ye=new Array(ao),so=[],Ur=this.trackStartLines?1:void 0,gt=this.trackStartLines?1:void 0,kr=Gc(this.emptyGroups),Zf=this.trackStartLines,lo=this.config.lineTerminatorsPattern,Sn=0,Et=[],wr=[],yn=[],Ns=[];Object.freeze(Ns);let Br;function Rs(){return Et}function _s(de){let ke=it(de),Xt=wr[ke];return Xt===void 0?Ns:Xt}let Jf=de=>{if(yn.length===1&&de.tokenType.PUSH_MODE===void 0){let ke=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(de);so.push({offset:de.startOffset,line:de.startLine,column:de.startColumn,length:de.image.length,message:ke})}else{yn.pop();let ke=rt(yn);Et=this.patternIdxToConfig[ke],wr=this.charCodeToPatternIdxToConfig[ke],Sn=Et.length;let Xt=this.canModeBeOptimized[ke]&&this.config.safeMode===!1;wr&&Xt?Br=_s:Br=Rs}};function Is(de){yn.push(de),wr=this.charCodeToPatternIdxToConfig[de],Et=this.patternIdxToConfig[de],Sn=Et.length,Sn=Et.length;let ke=this.canModeBeOptimized[de]&&this.config.safeMode===!1;wr&&ke?Br=_s:Br=Rs}Is.call(this,r);let We,bs=this.config.recoveryEnabled;for(;I<_;){l=null;let de=m.charCodeAt(I),ke=Br(de),Xt=ke.length;for(n=0;n<Xt;n++){We=ke[n];let be=We.pattern;c=null;let st=We.short;if(st!==!1?de===st&&(l=be):We.isCustom===!0?(E=be.exec(m,I,Ye,kr),E!==null?(l=E[0],E.payload!==void 0&&(c=E.payload)):l=null):(this.updateLastIndex(be,I),l=this.match(be,e,I)),l!==null){if(s=We.longerAlt,s!==void 0){let xt=s.length;for(o=0;o<xt;o++){let lt=Et[s[o]],wt=lt.pattern;if(p=null,lt.isCustom===!0?(E=wt.exec(m,I,Ye,kr),E!==null?(a=E[0],E.payload!==void 0&&(p=E.payload)):a=null):(this.updateLastIndex(wt,I),a=this.match(wt,e,I)),a&&a.length>l.length){l=a,c=p,We=lt;break}}}break}}if(l!==null){if(h=l.length,d=We.group,d!==void 0&&(A=We.tokenTypeIdx,C=this.createTokenInstance(l,I,A,We.tokenType,Ur,gt,h),this.handlePayload(C,c),d===!1?Ie=this.addToken(Ye,Ie,C):kr[d].push(C)),e=this.chopInput(e,h),I=I+h,gt=this.computeNewColumn(gt,h),Zf===!0&&We.canLineTerminator===!0){let be=0,st,xt;lo.lastIndex=0;do st=lo.test(l),st===!0&&(xt=lo.lastIndex-1,be++);while(st===!0);be!==0&&(Ur=Ur+be,gt=h-xt,this.updateTokenEndLineColumnLocation(C,d,xt,be,Ur,gt,h))}this.handleModes(We,Jf,Is,C)}else{let be=I,st=Ur,xt=gt,lt=bs===!1;for(;lt===!1&&I<_;)for(e=this.chopInput(e,1),I++,i=0;i<Sn;i++){let wt=Et[i],uo=wt.pattern,vs=wt.short;if(vs!==!1?m.charCodeAt(I)===vs&&(lt=!0):wt.isCustom===!0?lt=uo.exec(m,I,Ye,kr)!==null:(this.updateLastIndex(uo,I),lt=uo.exec(e)!==null),lt===!0)break}if(L=I-be,gt=this.computeNewColumn(gt,L),S=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(m,be,L,st,xt),so.push({offset:be,line:st,column:xt,length:L,message:S}),bs===!1)break}}return this.hasCustom||(Ye.length=Ie),{tokens:Ye,groups:kr,errors:so}}handleModes(e,r,n,i){if(e.pop===!0){let o=e.push;r(i),o!==void 0&&n.call(this,o)}else e.push!==void 0&&n.call(this,e.push)}chopInput(e,r){return e.substring(r)}updateLastIndex(e,r){e.lastIndex=r}updateTokenEndLineColumnLocation(e,r,n,i,o,a,s){let l,c;r!==void 0&&(l=n===s-1,c=l?-1:0,i===1&&l===!0||(e.endLine=o+c,e.endColumn=a-1+-c))}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,n,i){return{image:e,startOffset:r,tokenTypeIdx:n,tokenType:i}}createStartOnlyToken(e,r,n,i,o,a){return{image:e,startOffset:r,startLine:o,startColumn:a,tokenTypeIdx:n,tokenType:i}}createFullToken(e,r,n,i,o,a,s){return{image:e,startOffset:r,endOffset:r+s-1,startLine:o,endLine:o,startColumn:a,endColumn:a+s-1,tokenTypeIdx:n,tokenType:i}}addTokenUsingPush(e,r,n){return e.push(n),r}addTokenUsingMemberAccess(e,r,n){return e[r]=n,r++,r}handlePayloadNoCustom(e,r){}handlePayloadWithCustom(e,r){r!==null&&(e.payload=r)}matchWithTest(e,r,n){return e.test(r)===!0?r.substring(n,e.lastIndex):null}matchWithExec(e,r){let n=e.exec(r);return n!==null?n[0]:null}};b.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";b.NA=/NOT_APPLICABLE/;function Ht(t){return wo(t)?t.LABEL:t.name}function wo(t){return ue(t.LABEL)&&t.LABEL!==""}var OT="parent",Qc="categories",zc="label",Zc="group",Jc="push_mode",ef="pop_mode",tf="longer_alt",rf="line_breaks",nf="start_chars_hint";function f(t){return NT(t)}function NT(t){let e=t.pattern,r={};if(r.name=t.name,Ee(e)||(r.PATTERN=e),T(t,OT))throw`The parent property is no longer supported.
|
|
59
59
|
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return T(t,Qc)&&(r.CATEGORIES=t[Qc]),mt([r]),T(t,zc)&&(r.LABEL=t[zc]),T(t,Zc)&&(r.GROUP=t[Zc]),T(t,ef)&&(r.POP_MODE=t[ef]),T(t,Jc)&&(r.PUSH_MODE=t[Jc]),T(t,tf)&&(r.LONGER_ALT=t[tf]),T(t,rf)&&(r.LINE_BREAKS=t[rf]),T(t,nf)&&(r.START_CHARS_HINT=t[nf]),r}var Ve=f({name:"EOF",pattern:b.NA});mt([Ve]);function Kt(t,e,r,n,i,o,a,s){return{image:e,startOffset:r,endOffset:n,startLine:i,endLine:o,startColumn:a,endColumn:s,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function Bo(t,e){return dt(t,e)}var si={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${wo(t)?`--> ${Ht(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:t,ruleName:e}){return"Redundant input, expecting EOF but found: "+t.image},buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:r,customUserDescription:n,ruleName:i}){let o="Expecting: ",s=`
|
|
60
60
|
but found: '`+pe(e).image+"'";if(n)return o+n+s;{let l=se(t,(d,A)=>d.concat(A),[]),c=g(l,d=>`[${g(d,A=>Ht(A)).join(", ")}]`),h=`one of these possible Token sequences:
|
|
61
61
|
${g(c,(d,A)=>` ${A+1}. ${d}`).join(`
|
|
@@ -86,11 +86,11 @@ rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
|
86
86
|
without consuming any Tokens. The grammar path that causes this is:
|
|
87
87
|
${n}
|
|
88
88
|
To fix this refactor your grammar to remove the left recursion.
|
|
89
|
-
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Se?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function af(t,e){let r=new Do(t,e);return r.resolveRefs(),r.errors}var Do=class extends ye{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){x(U(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:ce.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var Go=class extends ht{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=D(this.path.ruleStack).reverse(),this.occurrenceStack=D(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){v(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},li=class extends Go{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=r.concat(n),o=new W({definition:i});this.possibleTokTypes=$t(o),this.found=!0}}},Rr=class extends ht{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},ui=class extends Rr{walkMany(e,r,n){if(e.idx===this.occurrence){let i=pe(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},en=class extends Rr{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=pe(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},ci=class extends Rr{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=pe(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},tn=class extends Rr{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=pe(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}};function fi(t,e,r=[]){r=D(r);let n=[],i=0;function o(s){return s.concat(te(t,i+1))}function a(s){let l=fi(o(s),e,r);return n.concat(l)}for(;r.length<e&&i<t.length;){let s=t[i];if(s instanceof W)return a(s.definition);if(s instanceof G)return a(s.definition);if(s instanceof j)n=a(s.definition);else if(s instanceof re){let l=s.definition.concat([new M({definition:s.definition})]);return a(l)}else if(s instanceof ne){let l=[new W({definition:s.definition}),new M({definition:[new F({terminalType:s.separator})].concat(s.definition)})];return a(l)}else if(s instanceof Z){let l=s.definition.concat([new M({definition:[new F({terminalType:s.separator})].concat(s.definition)})]);n=a(l)}else if(s instanceof M){let l=s.definition.concat([new M({definition:s.definition})]);n=a(l)}else{if(s instanceof J)return x(s.definition,l=>{v(l.definition)===!1&&(n=a(l.definition))}),n;if(s instanceof F)r.push(s.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:te(t,i)}),n}function pi(t,e,r,n){let i="EXIT_NONE_TERMINAL",o=[i],a="EXIT_ALTERNATIVE",s=!1,l=e.length,c=l-n-1,p=[],h=[];for(h.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!v(h);){let d=h.pop();if(d===a){s&&tt(h).idx<=c&&h.pop();continue}let A=d.def,C=d.idx,L=d.ruleStack,N=d.occurrenceStack;if(v(A))continue;let S=A[0];if(S===i){let E={idx:C,def:te(A),ruleStack:pt(L),occurrenceStack:pt(N)};h.push(E)}else if(S instanceof F)if(C<l-1){let E=C+1,m=e[E];if(r(m,S.terminalType)){let _={idx:E,def:te(A),ruleStack:L,occurrenceStack:N};h.push(_)}}else if(C===l-1)p.push({nextTokenType:S.terminalType,nextTokenOccurrence:S.idx,ruleStack:L,occurrenceStack:N}),s=!0;else throw Error("non exhaustive match");else if(S instanceof G){let E=D(L);E.push(S.nonTerminalName);let m=D(N);m.push(S.idx);let _={idx:C,def:S.definition.concat(o,te(A)),ruleStack:E,occurrenceStack:m};h.push(_)}else if(S instanceof j){let E={idx:C,def:te(A),ruleStack:L,occurrenceStack:N};h.push(E),h.push(a);let m={idx:C,def:S.definition.concat(te(A)),ruleStack:L,occurrenceStack:N};h.push(m)}else if(S instanceof re){let E=new M({definition:S.definition,idx:S.idx}),m=S.definition.concat([E],te(A)),_={idx:C,def:m,ruleStack:L,occurrenceStack:N};h.push(_)}else if(S instanceof ne){let E=new F({terminalType:S.separator}),m=new M({definition:[E].concat(S.definition),idx:S.idx}),_=S.definition.concat([m],te(A)),I={idx:C,def:_,ruleStack:L,occurrenceStack:N};h.push(I)}else if(S instanceof Z){let E={idx:C,def:te(A),ruleStack:L,occurrenceStack:N};h.push(E),h.push(a);let m=new F({terminalType:S.separator}),_=new M({definition:[m].concat(S.definition),idx:S.idx}),I=S.definition.concat([_],te(A)),Ie={idx:C,def:I,ruleStack:L,occurrenceStack:N};h.push(Ie)}else if(S instanceof M){let E={idx:C,def:te(A),ruleStack:L,occurrenceStack:N};h.push(E),h.push(a);let m=new M({definition:S.definition,idx:S.idx}),_=S.definition.concat([m],te(A)),I={idx:C,def:_,ruleStack:L,occurrenceStack:N};h.push(I)}else if(S instanceof J)for(let E=S.definition.length-1;E>=0;E--){let m=S.definition[E],_={idx:C,def:m.definition.concat(te(A)),ruleStack:L,occurrenceStack:N};h.push(_),h.push(a)}else if(S instanceof W)h.push({idx:C,def:S.definition.concat(te(A)),ruleStack:L,occurrenceStack:N});else if(S instanceof Se)h.push(RT(S,C,L,N));else throw Error("non exhaustive match")}return p}function RT(t,e,r,n){let i=D(r);i.push(t.name);let o=D(n);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var X;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(X||(X={}));function di(t){if(t instanceof j||t==="Option")return X.OPTION;if(t instanceof M||t==="Repetition")return X.REPETITION;if(t instanceof re||t==="RepetitionMandatory")return X.REPETITION_MANDATORY;if(t instanceof ne||t==="RepetitionMandatoryWithSeparator")return X.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof Z||t==="RepetitionWithSeparator")return X.REPETITION_WITH_SEPARATOR;if(t instanceof J||t==="Alternation")return X.ALTERNATION;throw Error("non exhaustive match")}function lf(t,e,r,n,i,o){let a=rn(t,e,r),s=df(a)?Nr:dt;return o(a,n,s,i)}function uf(t,e,r,n,i,o){let a=nn(t,e,i,r),s=df(a)?Nr:dt;return o(a[0],s,n)}function cf(t,e,r,n){let i=t.length,o=me(t,a=>me(a,s=>s.length===1));if(e)return function(a){let s=g(a,l=>l.GATE);for(let l=0;l<i;l++){let c=t[l],p=c.length,h=s[l];if(!(h!==void 0&&h.call(this)===!1))e:for(let d=0;d<p;d++){let A=c[d],C=A.length;for(let L=0;L<C;L++){let N=this.LA(L+1);if(r(N,A[L])===!1)continue e}return l}}};if(o&&!n){let a=g(t,l=>le(l)),s=se(a,(l,c,p)=>(x(c,h=>{T(l,h.tokenTypeIdx)||(l[h.tokenTypeIdx]=p),x(h.categoryMatches,d=>{T(l,d)||(l[d]=p)})}),l),{});return function(){let l=this.LA(1);return s[l.tokenTypeIdx]}}else return function(){for(let a=0;a<i;a++){let s=t[a],l=s.length;e:for(let c=0;c<l;c++){let p=s[c],h=p.length;for(let d=0;d<h;d++){let A=this.LA(d+1);if(r(A,p[d])===!1)continue e}return a}}}}function ff(t,e,r){let n=me(t,o=>o.length===1),i=t.length;if(n&&!r){let o=le(t);if(o.length===1&&v(o[0].categoryMatches)){let s=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}else{let a=se(o,(s,l,c)=>(s[l.tokenTypeIdx]=!0,x(l.categoryMatches,p=>{s[p]=!0}),s),[]);return function(){let s=this.LA(1);return a[s.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let a=t[o],s=a.length;for(let l=0;l<s;l++){let c=this.LA(l+1);if(e(c,a[l])===!1)continue e}return!0}return!1}}var $o=class extends ht{constructor(e,r,n){super(),this.topProd=e,this.targetOccurrence=r,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===r?(this.restDef=n.concat(i),!0):!1}walkOption(e,r,n){this.checkIsTarget(e,X.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,X.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,X.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,X.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,X.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},hi=class extends ye{constructor(e,r,n){super(),this.targetOccurrence=e,this.targetProdType=r,this.targetRef=n,this.result=[]}checkIsTarget(e,r){e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,X.OPTION)}visitRepetition(e){this.checkIsTarget(e,X.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,X.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,X.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,X.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,X.ALTERNATION)}};function sf(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function Wo(t){let e=[""];for(let r=0;r<t.length;r++){let n=t[r],i=[];for(let o=0;o<e.length;o++){let a=e[o];i.push(a+"_"+n.tokenTypeIdx);for(let s=0;s<n.categoryMatches.length;s++){let l="_"+n.categoryMatches[s];i.push(a+l)}}e=i}return e}function _T(t,e,r){for(let n=0;n<t.length;n++){if(n===r)continue;let i=t[n];for(let o=0;o<e.length;o++){let a=e[o];if(i[a]===!0)return!1}}return!0}function pf(t,e){let r=g(t,a=>fi([a],1)),n=sf(r.length),i=g(r,a=>{let s={};return x(a,l=>{let c=Wo(l.partialPath);x(c,p=>{s[p]=!0})}),s}),o=r;for(let a=1;a<=e;a++){let s=o;o=sf(s.length);for(let l=0;l<s.length;l++){let c=s[l];for(let p=0;p<c.length;p++){let h=c[p].partialPath,d=c[p].suffixDef,A=Wo(h);if(_T(i,A,l)||v(d)||h.length===e){let L=n[l];if(mi(L,h)===!1){L.push(h);for(let N=0;N<A.length;N++){let S=A[N];i[l][S]=!0}}}else{let L=fi(d,a+1,h);o[l]=o[l].concat(L),x(L,N=>{let S=Wo(N.partialPath);x(S,E=>{i[l][E]=!0})})}}}}return n}function rn(t,e,r,n){let i=new hi(t,X.ALTERNATION,n);return e.accept(i),pf(i.result,r)}function nn(t,e,r,n){let i=new hi(t,r);e.accept(i);let o=i.result,s=new $o(e,t,r).startWalking(),l=new W({definition:o}),c=new W({definition:s});return pf([l,c],n)}function mi(t,e){e:for(let r=0;r<t.length;r++){let n=t[r];if(n.length===e.length){for(let i=0;i<n.length;i++){let o=e[i],a=n[i];if((o===a||a.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function hf(t,e){return t.length<e.length&&me(t,(r,n)=>{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function df(t){return me(t,e=>me(e,r=>me(r,n=>v(n.categoryMatches))))}function mf(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return g(e,r=>Object.assign({type:ce.CUSTOM_LOOKAHEAD_VALIDATION},r))}function gf(t,e,r,n){let i=Te(t,l=>IT(l,r)),o=UT(t,e,r),a=Te(t,l=>PT(l,r)),s=Te(t,l=>vT(l,t,n,r));return i.concat(o,a,s)}function IT(t,e){let r=new Vo;t.accept(r);let n=r.allProductions,i=Lo(n,bT),o=Re(i,s=>s.length>1);return g(U(o),s=>{let l=pe(s),c=e.buildDuplicateFoundError(t,s),p=_e(l),h={message:c,type:ce.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:p,occurrence:l.idx},d=Ef(l);return d&&(h.parameter=d),h})}function bT(t){return`${_e(t)}_#_${t.idx}_#_${Ef(t)}`}function Ef(t){return t instanceof F?t.terminalType.name:t instanceof G?t.nonTerminalName:""}var Vo=class extends ye{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function vT(t,e,r,n){let i=[];if(se(e,(a,s)=>s.name===t.name?a+1:a,0)>1){let a=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:a,type:ce.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function xf(t,e,r){let n=[],i;return H(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:ce.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Ho(t,e,r,n=[]){let i=[],o=gi(e.definition);if(v(o))return[];{let a=t.name;H(o,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:ce.LEFT_RECURSION,ruleName:a});let l=Ft(o,n.concat([t])),c=Te(l,p=>{let h=D(n);return h.push(p),Ho(t,p,r,h)});return i.concat(c)}}function gi(t){let e=[];if(v(t))return e;let r=pe(t);if(r instanceof G)e.push(r.referencedRule);else if(r instanceof W||r instanceof j||r instanceof re||r instanceof ne||r instanceof Z||r instanceof M)e=e.concat(gi(r.definition));else if(r instanceof J)e=le(g(r.definition,o=>gi(o.definition)));else if(!(r instanceof F))throw Error("non exhaustive match");let n=Wt(r),i=t.length>1;if(n&&i){let o=te(t);return e.concat(gi(o))}else return e}var on=class extends ye{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Af(t,e){let r=new on;t.accept(r);let n=r.alternations;return Te(n,o=>{let a=pt(o.definition);return Te(a,(s,l)=>{let c=pi([s],[],dt,1);return v(c)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:o,emptyChoiceIdx:l}),type:ce.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:o.idx,alternative:l+1}]:[]})})}function Tf(t,e,r){let n=new on;t.accept(n);let i=n.alternations;return i=Mt(i,a=>a.ignoreAmbiguities===!0),Te(i,a=>{let s=a.idx,l=a.maxLookahead||e,c=rn(s,t,l,a),p=FT(c,a,t,r),h=MT(c,a,t,r);return p.concat(h)})}var jo=class extends ye{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function PT(t,e){let r=new on;t.accept(r);let n=r.alternations;return Te(n,o=>o.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:o}),type:ce.TOO_MANY_ALTS,ruleName:t.name,occurrence:o.idx}]:[])}function Sf(t,e,r){let n=[];return x(t,i=>{let o=new jo;i.accept(o);let a=o.allProductions;x(a,s=>{let l=di(s),c=s.maxLookahead||e,p=s.idx,d=nn(p,i,l,c)[0];if(v(le(d))){let A=r.buildEmptyRepetitionError({topLevelRule:i,repetition:s});n.push({message:A,type:ce.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function FT(t,e,r,n){let i=[],o=se(t,(s,l,c)=>(e.definition[c].ignoreAmbiguities===!0||x(l,p=>{let h=[c];x(t,(d,A)=>{c!==A&&mi(d,p)&&e.definition[A].ignoreAmbiguities!==!0&&h.push(A)}),h.length>1&&!mi(i,p)&&(i.push(p),s.push({alts:h,path:p}))}),s),[]);return g(o,s=>{let l=g(s.alts,p=>p+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:l,prefixPath:s.path}),type:ce.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:s.alts}})}function MT(t,e,r,n){let i=se(t,(a,s,l)=>{let c=g(s,p=>({idx:l,path:p}));return a.concat(c)},[]);return et(Te(i,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];let l=a.idx,c=a.path,p=ge(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<l&&hf(d.path,c));return g(p,d=>{let A=[d.idx+1,l+1],C=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:A,prefixPath:d.path}),type:ce.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:C,alternatives:A}})}))}function UT(t,e,r){let n=[],i=g(e,o=>o.name);return x(t,o=>{let a=o.name;if(H(i,a)){let s=r.buildNamespaceConflictError(o);n.push({message:s,type:ce.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),n}function yf(t){let e=xr(t,{errMsgProvider:of}),r={};return x(t.rules,n=>{r[n.name]=n}),af(r,e.errMsgProvider)}function Cf(t){return t=xr(t,{errMsgProvider:je}),gf(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var Lf="MismatchedTokenException",Of="NoViableAltException",Nf="EarlyExitException",Rf="NotAllInputParsedException",_f=[Lf,Of,Nf,Rf];Object.freeze(_f);function kt(t){return H(_f,t.name)}var _r=class extends Error{constructor(e,r){super(e),this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Yt=class extends _r{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Lf}},an=class extends _r{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Of}},sn=class extends _r{constructor(e,r){super(e,r),this.name=Rf}},ln=class extends _r{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Nf}};var Ko={},qo="InRuleRecoveryException",Yo=class extends Error{constructor(e){super(e),this.name=qo}},Ei=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=T(e,"recoveryEnabled")?e.recoveryEnabled:Ce.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=kT)}getTokenToInsert(e){let r=Kt(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,i){let o=this.findReSyncTokenType(),a=this.exportLexerState(),s=[],l=!1,c=this.LA(1),p=this.LA(1),h=()=>{let d=this.LA(0),A=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:c,previous:d,ruleName:this.getCurrRuleFullName()}),C=new Yt(A,c,this.LA(0));C.resyncedTokens=pt(s),this.SAVE_ERROR(C)};for(;!l;)if(this.tokenMatcher(p,i)){h();return}else if(n.call(this)){h(),e.apply(this,r);return}else this.tokenMatcher(p,o)?l=!0:(p=this.SKIP_TOKEN(),this.addToResyncTokens(p,s));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,r,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))}getFollowsForInRuleRecovery(e,r){let n=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Yo("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||v(r))return!1;let n=this.LA(1);return rt(r,o=>this.tokenMatcher(n,o))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(r);return H(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=rt(e,o=>Bo(r,o));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Ko;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return g(e,(n,i)=>i===0?Ko:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=g(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return le(e)}getFollowSetFromFollowKey(e){if(e===Ko)return[Ve];let r=e.ruleName+e.idxInCallingRule+Jn+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,Ve)||r.push(e),r}reSyncTo(e){let r=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,r);return pt(r)}attemptInRepetitionRecovery(e,r,n,i,o,a,s){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=D(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return g(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function kT(t,e,r,n,i,o,a){let s=this.getKeyForAutomaticLookahead(n,i),l=this.firstAfterRepMap[s];if(l===void 0){let d=this.getCurrRuleFullName(),A=this.getGAstProductions()[d];l=new o(A,i).startWalking(),this.firstAfterRepMap[s]=l}let c=l.token,p=l.occurrence,h=l.isEndOfRule;this.RULE_STACK.length===1&&h&&c===void 0&&(c=Ve,p=1),!(c===void 0||p===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,p,a)&&this.tryInRepetitionRecovery(t,e,r,c)}function xi(t,e,r){return r|e|t}var un=class{constructor(e){var r;this.maxLookahead=(r=e?.maxLookahead)!==null&&r!==void 0?r:Ce.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(v(r)){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...n,...i,...o]}return r}validateNoLeftRecursion(e){return Te(e,r=>Ho(r,r,je))}validateEmptyOrAlternatives(e){return Te(e,r=>Af(r,je))}validateAmbiguousAlternationAlternatives(e,r){return Te(e,n=>Tf(n,r,je))}validateSomeNonEmptyLookaheadPath(e,r){return Sf(e,r,je)}buildLookaheadForAlternation(e){return lf(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,cf)}buildLookaheadForOptional(e){return uf(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,di(e.prodType),ff)}};var Ti=class{initLooksAhead(e){this.dynamicTokensEnabled=T(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Ce.dynamicTokensEnabled,this.maxLookahead=T(e,"maxLookahead")?e.maxLookahead:Ce.maxLookahead,this.lookaheadStrategy=T(e,"lookaheadStrategy")?e.lookaheadStrategy:new un({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){x(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:o,repetitionMandatory:a,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:l}=wT(r);x(n,c=>{let p=c.idx===0?"":c.idx;this.TRACE_INIT(`${_e(c)}${p}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:r,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=xi(this.fullRuleNameToShort[r.name],256,c.idx);this.setLaFuncCache(d,h)})}),x(i,c=>{this.computeLookaheadFunc(r,c.idx,768,"Repetition",c.maxLookahead,_e(c))}),x(o,c=>{this.computeLookaheadFunc(r,c.idx,512,"Option",c.maxLookahead,_e(c))}),x(a,c=>{this.computeLookaheadFunc(r,c.idx,1024,"RepetitionMandatory",c.maxLookahead,_e(c))}),x(s,c=>{this.computeLookaheadFunc(r,c.idx,1536,"RepetitionMandatoryWithSeparator",c.maxLookahead,_e(c))}),x(l,c=>{this.computeLookaheadFunc(r,c.idx,1280,"RepetitionWithSeparator",c.maxLookahead,_e(c))})})})}computeLookaheadFunc(e,r,n,i,o,a){this.TRACE_INIT(`${a}${r===0?"":r}`,()=>{let s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),l=xi(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(l,s)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return xi(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Xo=class extends ye{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},Ai=new Xo;function wT(t){Ai.reset(),t.accept(Ai);let e=Ai.dslMethods;return Ai.reset(),e}function Zo(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function Jo(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function If(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function bf(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var BT="name";function ea(t,e){Object.defineProperty(t,BT,{enumerable:!1,configurable:!0,writable:!1,value:e})}function DT(t,e){let r=w(t),n=r.length;for(let i=0;i<n;i++){let o=r[i],a=t[o],s=a.length;for(let l=0;l<s;l++){let c=a[l];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}}function vf(t,e){let r=function(){};ea(r,t+"BaseSemantics");let n={visit:function(i,o){if(y(i)&&(i=i[0]),!Ee(i))return this[i.name](i.children,o)},validateVisitor:function(){let i=GT(this,e);if(!v(i)){let o=g(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
89
|
+
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof Se?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function af(t,e){let r=new Do(t,e);return r.resolveRefs(),r.errors}var Do=class extends ye{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){x(U(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let r=this.nameToTopRule[e.nonTerminalName];if(r)e.referencedRule=r;else{let n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:n,type:ce.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var Go=class extends ht{constructor(e,r){super(),this.topProd=e,this.path=r,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=D(this.path.ruleStack).reverse(),this.occurrenceStack=D(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,r=[]){this.found||super.walk(e,r)}walkProdRef(e,r,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let i=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){v(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},li=class extends Go{constructor(e,r){super(e,r),this.path=r,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,r,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let i=r.concat(n),o=new W({definition:i});this.possibleTokTypes=$t(o),this.found=!0}}},Rr=class extends ht{constructor(e,r){super(),this.topRule=e,this.occurrence=r,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},ui=class extends Rr{walkMany(e,r,n){if(e.idx===this.occurrence){let i=pe(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,r,n)}},en=class extends Rr{walkManySep(e,r,n){if(e.idx===this.occurrence){let i=pe(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,r,n)}},ci=class extends Rr{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let i=pe(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,r,n)}},tn=class extends Rr{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let i=pe(r.concat(n));this.result.isEndOfRule=i===void 0,i instanceof F&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,r,n)}};function fi(t,e,r=[]){r=D(r);let n=[],i=0;function o(s){return s.concat(te(t,i+1))}function a(s){let l=fi(o(s),e,r);return n.concat(l)}for(;r.length<e&&i<t.length;){let s=t[i];if(s instanceof W)return a(s.definition);if(s instanceof G)return a(s.definition);if(s instanceof j)n=a(s.definition);else if(s instanceof re){let l=s.definition.concat([new M({definition:s.definition})]);return a(l)}else if(s instanceof ne){let l=[new W({definition:s.definition}),new M({definition:[new F({terminalType:s.separator})].concat(s.definition)})];return a(l)}else if(s instanceof Z){let l=s.definition.concat([new M({definition:[new F({terminalType:s.separator})].concat(s.definition)})]);n=a(l)}else if(s instanceof M){let l=s.definition.concat([new M({definition:s.definition})]);n=a(l)}else{if(s instanceof J)return x(s.definition,l=>{v(l.definition)===!1&&(n=a(l.definition))}),n;if(s instanceof F)r.push(s.terminalType);else throw Error("non exhaustive match")}i++}return n.push({partialPath:r,suffixDef:te(t,i)}),n}function pi(t,e,r,n){let i="EXIT_NONE_TERMINAL",o=[i],a="EXIT_ALTERNATIVE",s=!1,l=e.length,c=l-n-1,p=[],h=[];for(h.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!v(h);){let d=h.pop();if(d===a){s&&rt(h).idx<=c&&h.pop();continue}let A=d.def,C=d.idx,L=d.ruleStack,N=d.occurrenceStack;if(v(A))continue;let S=A[0];if(S===i){let E={idx:C,def:te(A),ruleStack:pt(L),occurrenceStack:pt(N)};h.push(E)}else if(S instanceof F)if(C<l-1){let E=C+1,m=e[E];if(r(m,S.terminalType)){let _={idx:E,def:te(A),ruleStack:L,occurrenceStack:N};h.push(_)}}else if(C===l-1)p.push({nextTokenType:S.terminalType,nextTokenOccurrence:S.idx,ruleStack:L,occurrenceStack:N}),s=!0;else throw Error("non exhaustive match");else if(S instanceof G){let E=D(L);E.push(S.nonTerminalName);let m=D(N);m.push(S.idx);let _={idx:C,def:S.definition.concat(o,te(A)),ruleStack:E,occurrenceStack:m};h.push(_)}else if(S instanceof j){let E={idx:C,def:te(A),ruleStack:L,occurrenceStack:N};h.push(E),h.push(a);let m={idx:C,def:S.definition.concat(te(A)),ruleStack:L,occurrenceStack:N};h.push(m)}else if(S instanceof re){let E=new M({definition:S.definition,idx:S.idx}),m=S.definition.concat([E],te(A)),_={idx:C,def:m,ruleStack:L,occurrenceStack:N};h.push(_)}else if(S instanceof ne){let E=new F({terminalType:S.separator}),m=new M({definition:[E].concat(S.definition),idx:S.idx}),_=S.definition.concat([m],te(A)),I={idx:C,def:_,ruleStack:L,occurrenceStack:N};h.push(I)}else if(S instanceof Z){let E={idx:C,def:te(A),ruleStack:L,occurrenceStack:N};h.push(E),h.push(a);let m=new F({terminalType:S.separator}),_=new M({definition:[m].concat(S.definition),idx:S.idx}),I=S.definition.concat([_],te(A)),Ie={idx:C,def:I,ruleStack:L,occurrenceStack:N};h.push(Ie)}else if(S instanceof M){let E={idx:C,def:te(A),ruleStack:L,occurrenceStack:N};h.push(E),h.push(a);let m=new M({definition:S.definition,idx:S.idx}),_=S.definition.concat([m],te(A)),I={idx:C,def:_,ruleStack:L,occurrenceStack:N};h.push(I)}else if(S instanceof J)for(let E=S.definition.length-1;E>=0;E--){let m=S.definition[E],_={idx:C,def:m.definition.concat(te(A)),ruleStack:L,occurrenceStack:N};h.push(_),h.push(a)}else if(S instanceof W)h.push({idx:C,def:S.definition.concat(te(A)),ruleStack:L,occurrenceStack:N});else if(S instanceof Se)h.push(RT(S,C,L,N));else throw Error("non exhaustive match")}return p}function RT(t,e,r,n){let i=D(r);i.push(t.name);let o=D(n);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var X;(function(t){t[t.OPTION=0]="OPTION",t[t.REPETITION=1]="REPETITION",t[t.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",t[t.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",t[t.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",t[t.ALTERNATION=5]="ALTERNATION"})(X||(X={}));function di(t){if(t instanceof j||t==="Option")return X.OPTION;if(t instanceof M||t==="Repetition")return X.REPETITION;if(t instanceof re||t==="RepetitionMandatory")return X.REPETITION_MANDATORY;if(t instanceof ne||t==="RepetitionMandatoryWithSeparator")return X.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof Z||t==="RepetitionWithSeparator")return X.REPETITION_WITH_SEPARATOR;if(t instanceof J||t==="Alternation")return X.ALTERNATION;throw Error("non exhaustive match")}function lf(t,e,r,n,i,o){let a=rn(t,e,r),s=df(a)?Nr:dt;return o(a,n,s,i)}function uf(t,e,r,n,i,o){let a=nn(t,e,i,r),s=df(a)?Nr:dt;return o(a[0],s,n)}function cf(t,e,r,n){let i=t.length,o=me(t,a=>me(a,s=>s.length===1));if(e)return function(a){let s=g(a,l=>l.GATE);for(let l=0;l<i;l++){let c=t[l],p=c.length,h=s[l];if(!(h!==void 0&&h.call(this)===!1))e:for(let d=0;d<p;d++){let A=c[d],C=A.length;for(let L=0;L<C;L++){let N=this.LA(L+1);if(r(N,A[L])===!1)continue e}return l}}};if(o&&!n){let a=g(t,l=>le(l)),s=se(a,(l,c,p)=>(x(c,h=>{T(l,h.tokenTypeIdx)||(l[h.tokenTypeIdx]=p),x(h.categoryMatches,d=>{T(l,d)||(l[d]=p)})}),l),{});return function(){let l=this.LA(1);return s[l.tokenTypeIdx]}}else return function(){for(let a=0;a<i;a++){let s=t[a],l=s.length;e:for(let c=0;c<l;c++){let p=s[c],h=p.length;for(let d=0;d<h;d++){let A=this.LA(d+1);if(r(A,p[d])===!1)continue e}return a}}}}function ff(t,e,r){let n=me(t,o=>o.length===1),i=t.length;if(n&&!r){let o=le(t);if(o.length===1&&v(o[0].categoryMatches)){let s=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}else{let a=se(o,(s,l,c)=>(s[l.tokenTypeIdx]=!0,x(l.categoryMatches,p=>{s[p]=!0}),s),[]);return function(){let s=this.LA(1);return a[s.tokenTypeIdx]===!0}}}else return function(){e:for(let o=0;o<i;o++){let a=t[o],s=a.length;for(let l=0;l<s;l++){let c=this.LA(l+1);if(e(c,a[l])===!1)continue e}return!0}return!1}}var $o=class extends ht{constructor(e,r,n){super(),this.topProd=e,this.targetOccurrence=r,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,r,n,i){return e.idx===this.targetOccurrence&&this.targetProdType===r?(this.restDef=n.concat(i),!0):!1}walkOption(e,r,n){this.checkIsTarget(e,X.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,X.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,X.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,X.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,X.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},hi=class extends ye{constructor(e,r,n){super(),this.targetOccurrence=e,this.targetProdType=r,this.targetRef=n,this.result=[]}checkIsTarget(e,r){e.idx===this.targetOccurrence&&this.targetProdType===r&&(this.targetRef===void 0||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,X.OPTION)}visitRepetition(e){this.checkIsTarget(e,X.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,X.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,X.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,X.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,X.ALTERNATION)}};function sf(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function Wo(t){let e=[""];for(let r=0;r<t.length;r++){let n=t[r],i=[];for(let o=0;o<e.length;o++){let a=e[o];i.push(a+"_"+n.tokenTypeIdx);for(let s=0;s<n.categoryMatches.length;s++){let l="_"+n.categoryMatches[s];i.push(a+l)}}e=i}return e}function _T(t,e,r){for(let n=0;n<t.length;n++){if(n===r)continue;let i=t[n];for(let o=0;o<e.length;o++){let a=e[o];if(i[a]===!0)return!1}}return!0}function pf(t,e){let r=g(t,a=>fi([a],1)),n=sf(r.length),i=g(r,a=>{let s={};return x(a,l=>{let c=Wo(l.partialPath);x(c,p=>{s[p]=!0})}),s}),o=r;for(let a=1;a<=e;a++){let s=o;o=sf(s.length);for(let l=0;l<s.length;l++){let c=s[l];for(let p=0;p<c.length;p++){let h=c[p].partialPath,d=c[p].suffixDef,A=Wo(h);if(_T(i,A,l)||v(d)||h.length===e){let L=n[l];if(mi(L,h)===!1){L.push(h);for(let N=0;N<A.length;N++){let S=A[N];i[l][S]=!0}}}else{let L=fi(d,a+1,h);o[l]=o[l].concat(L),x(L,N=>{let S=Wo(N.partialPath);x(S,E=>{i[l][E]=!0})})}}}}return n}function rn(t,e,r,n){let i=new hi(t,X.ALTERNATION,n);return e.accept(i),pf(i.result,r)}function nn(t,e,r,n){let i=new hi(t,r);e.accept(i);let o=i.result,s=new $o(e,t,r).startWalking(),l=new W({definition:o}),c=new W({definition:s});return pf([l,c],n)}function mi(t,e){e:for(let r=0;r<t.length;r++){let n=t[r];if(n.length===e.length){for(let i=0;i<n.length;i++){let o=e[i],a=n[i];if((o===a||a.categoryMatchesMap[o.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function hf(t,e){return t.length<e.length&&me(t,(r,n)=>{let i=e[n];return r===i||i.categoryMatchesMap[r.tokenTypeIdx]})}function df(t){return me(t,e=>me(e,r=>me(r,n=>v(n.categoryMatches))))}function mf(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return g(e,r=>Object.assign({type:ce.CUSTOM_LOOKAHEAD_VALIDATION},r))}function gf(t,e,r,n){let i=Te(t,l=>IT(l,r)),o=UT(t,e,r),a=Te(t,l=>PT(l,r)),s=Te(t,l=>vT(l,t,n,r));return i.concat(o,a,s)}function IT(t,e){let r=new Vo;t.accept(r);let n=r.allProductions,i=Lo(n,bT),o=Re(i,s=>s.length>1);return g(U(o),s=>{let l=pe(s),c=e.buildDuplicateFoundError(t,s),p=_e(l),h={message:c,type:ce.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:p,occurrence:l.idx},d=Ef(l);return d&&(h.parameter=d),h})}function bT(t){return`${_e(t)}_#_${t.idx}_#_${Ef(t)}`}function Ef(t){return t instanceof F?t.terminalType.name:t instanceof G?t.nonTerminalName:""}var Vo=class extends ye{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}};function vT(t,e,r,n){let i=[];if(se(e,(a,s)=>s.name===t.name?a+1:a,0)>1){let a=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});i.push({message:a,type:ce.DUPLICATE_RULE_NAME,ruleName:t.name})}return i}function xf(t,e,r){let n=[],i;return H(e,t)||(i=`Invalid rule override, rule: ->${t}<- cannot be overridden in the grammar: ->${r}<-as it is not defined in any of the super grammars `,n.push({message:i,type:ce.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Ho(t,e,r,n=[]){let i=[],o=gi(e.definition);if(v(o))return[];{let a=t.name;H(o,t)&&i.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:ce.LEFT_RECURSION,ruleName:a});let l=Ft(o,n.concat([t])),c=Te(l,p=>{let h=D(n);return h.push(p),Ho(t,p,r,h)});return i.concat(c)}}function gi(t){let e=[];if(v(t))return e;let r=pe(t);if(r instanceof G)e.push(r.referencedRule);else if(r instanceof W||r instanceof j||r instanceof re||r instanceof ne||r instanceof Z||r instanceof M)e=e.concat(gi(r.definition));else if(r instanceof J)e=le(g(r.definition,o=>gi(o.definition)));else if(!(r instanceof F))throw Error("non exhaustive match");let n=Wt(r),i=t.length>1;if(n&&i){let o=te(t);return e.concat(gi(o))}else return e}var on=class extends ye{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Af(t,e){let r=new on;t.accept(r);let n=r.alternations;return Te(n,o=>{let a=pt(o.definition);return Te(a,(s,l)=>{let c=pi([s],[],dt,1);return v(c)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:o,emptyChoiceIdx:l}),type:ce.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:o.idx,alternative:l+1}]:[]})})}function Tf(t,e,r){let n=new on;t.accept(n);let i=n.alternations;return i=Mt(i,a=>a.ignoreAmbiguities===!0),Te(i,a=>{let s=a.idx,l=a.maxLookahead||e,c=rn(s,t,l,a),p=FT(c,a,t,r),h=MT(c,a,t,r);return p.concat(h)})}var jo=class extends ye{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}};function PT(t,e){let r=new on;t.accept(r);let n=r.alternations;return Te(n,o=>o.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:o}),type:ce.TOO_MANY_ALTS,ruleName:t.name,occurrence:o.idx}]:[])}function Sf(t,e,r){let n=[];return x(t,i=>{let o=new jo;i.accept(o);let a=o.allProductions;x(a,s=>{let l=di(s),c=s.maxLookahead||e,p=s.idx,d=nn(p,i,l,c)[0];if(v(le(d))){let A=r.buildEmptyRepetitionError({topLevelRule:i,repetition:s});n.push({message:A,type:ce.NO_NON_EMPTY_LOOKAHEAD,ruleName:i.name})}})}),n}function FT(t,e,r,n){let i=[],o=se(t,(s,l,c)=>(e.definition[c].ignoreAmbiguities===!0||x(l,p=>{let h=[c];x(t,(d,A)=>{c!==A&&mi(d,p)&&e.definition[A].ignoreAmbiguities!==!0&&h.push(A)}),h.length>1&&!mi(i,p)&&(i.push(p),s.push({alts:h,path:p}))}),s),[]);return g(o,s=>{let l=g(s.alts,p=>p+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:l,prefixPath:s.path}),type:ce.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:s.alts}})}function MT(t,e,r,n){let i=se(t,(a,s,l)=>{let c=g(s,p=>({idx:l,path:p}));return a.concat(c)},[]);return tt(Te(i,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];let l=a.idx,c=a.path,p=ge(i,d=>e.definition[d.idx].ignoreAmbiguities!==!0&&d.idx<l&&hf(d.path,c));return g(p,d=>{let A=[d.idx+1,l+1],C=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:A,prefixPath:d.path}),type:ce.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:C,alternatives:A}})}))}function UT(t,e,r){let n=[],i=g(e,o=>o.name);return x(t,o=>{let a=o.name;if(H(i,a)){let s=r.buildNamespaceConflictError(o);n.push({message:s,type:ce.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),n}function yf(t){let e=xr(t,{errMsgProvider:of}),r={};return x(t.rules,n=>{r[n.name]=n}),af(r,e.errMsgProvider)}function Cf(t){return t=xr(t,{errMsgProvider:je}),gf(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var Lf="MismatchedTokenException",Of="NoViableAltException",Nf="EarlyExitException",Rf="NotAllInputParsedException",_f=[Lf,Of,Nf,Rf];Object.freeze(_f);function kt(t){return H(_f,t.name)}var _r=class extends Error{constructor(e,r){super(e),this.token=r,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},Yt=class extends _r{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Lf}},an=class extends _r{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Of}},sn=class extends _r{constructor(e,r){super(e,r),this.name=Rf}},ln=class extends _r{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Nf}};var Ko={},qo="InRuleRecoveryException",Yo=class extends Error{constructor(e){super(e),this.name=qo}},Ei=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=T(e,"recoveryEnabled")?e.recoveryEnabled:Ce.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=kT)}getTokenToInsert(e){let r=Kt(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,i){let o=this.findReSyncTokenType(),a=this.exportLexerState(),s=[],l=!1,c=this.LA(1),p=this.LA(1),h=()=>{let d=this.LA(0),A=this.errorMessageProvider.buildMismatchTokenMessage({expected:i,actual:c,previous:d,ruleName:this.getCurrRuleFullName()}),C=new Yt(A,c,this.LA(0));C.resyncedTokens=pt(s),this.SAVE_ERROR(C)};for(;!l;)if(this.tokenMatcher(p,i)){h();return}else if(n.call(this)){h(),e.apply(this,r);return}else this.tokenMatcher(p,o)?l=!0:(p=this.SKIP_TOKEN(),this.addToResyncTokens(p,s));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,r,n){return!(n===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,r)))}getFollowsForInRuleRecovery(e,r){let n=this.getCurrentGrammarPath(e,r);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,r){if(this.canRecoverWithSingleTokenInsertion(e,r))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Yo("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||v(r))return!1;let n=this.LA(1);return nt(r,o=>this.tokenMatcher(n,o))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){let r=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(r);return H(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let i=nt(e,o=>Bo(r,o));if(i!==void 0)return i;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Ko;let e=this.getLastExplicitRuleShortName(),r=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:r,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,r=this.RULE_OCCURRENCE_STACK;return g(e,(n,i)=>i===0?Ko:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[i],inRule:this.shortRuleNameToFullName(e[i-1])})}flattenFollowSet(){let e=g(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return le(e)}getFollowSetFromFollowKey(e){if(e===Ko)return[Ve];let r=e.ruleName+e.idxInCallingRule+Jn+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,Ve)||r.push(e),r}reSyncTo(e){let r=[],n=this.LA(1);for(;this.tokenMatcher(n,e)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,r);return pt(r)}attemptInRepetitionRecovery(e,r,n,i,o,a,s){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),i=D(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:i,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return g(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function kT(t,e,r,n,i,o,a){let s=this.getKeyForAutomaticLookahead(n,i),l=this.firstAfterRepMap[s];if(l===void 0){let d=this.getCurrRuleFullName(),A=this.getGAstProductions()[d];l=new o(A,i).startWalking(),this.firstAfterRepMap[s]=l}let c=l.token,p=l.occurrence,h=l.isEndOfRule;this.RULE_STACK.length===1&&h&&c===void 0&&(c=Ve,p=1),!(c===void 0||p===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,p,a)&&this.tryInRepetitionRecovery(t,e,r,c)}function xi(t,e,r){return r|e|t}var un=class{constructor(e){var r;this.maxLookahead=(r=e?.maxLookahead)!==null&&r!==void 0?r:Ce.maxLookahead}validate(e){let r=this.validateNoLeftRecursion(e.rules);if(v(r)){let n=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...n,...i,...o]}return r}validateNoLeftRecursion(e){return Te(e,r=>Ho(r,r,je))}validateEmptyOrAlternatives(e){return Te(e,r=>Af(r,je))}validateAmbiguousAlternationAlternatives(e,r){return Te(e,n=>Tf(n,r,je))}validateSomeNonEmptyLookaheadPath(e,r){return Sf(e,r,je)}buildLookaheadForAlternation(e){return lf(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,cf)}buildLookaheadForOptional(e){return uf(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,di(e.prodType),ff)}};var Ti=class{initLooksAhead(e){this.dynamicTokensEnabled=T(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Ce.dynamicTokensEnabled,this.maxLookahead=T(e,"maxLookahead")?e.maxLookahead:Ce.maxLookahead,this.lookaheadStrategy=T(e,"lookaheadStrategy")?e.lookaheadStrategy:new un({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){x(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:i,option:o,repetitionMandatory:a,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:l}=wT(r);x(n,c=>{let p=c.idx===0?"":c.idx;this.TRACE_INIT(`${_e(c)}${p}`,()=>{let h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:r,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),d=xi(this.fullRuleNameToShort[r.name],256,c.idx);this.setLaFuncCache(d,h)})}),x(i,c=>{this.computeLookaheadFunc(r,c.idx,768,"Repetition",c.maxLookahead,_e(c))}),x(o,c=>{this.computeLookaheadFunc(r,c.idx,512,"Option",c.maxLookahead,_e(c))}),x(a,c=>{this.computeLookaheadFunc(r,c.idx,1024,"RepetitionMandatory",c.maxLookahead,_e(c))}),x(s,c=>{this.computeLookaheadFunc(r,c.idx,1536,"RepetitionMandatoryWithSeparator",c.maxLookahead,_e(c))}),x(l,c=>{this.computeLookaheadFunc(r,c.idx,1280,"RepetitionWithSeparator",c.maxLookahead,_e(c))})})})}computeLookaheadFunc(e,r,n,i,o,a){this.TRACE_INIT(`${a}${r===0?"":r}`,()=>{let s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:o||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:i}),l=xi(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(l,s)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return xi(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Xo=class extends ye{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}},Ai=new Xo;function wT(t){Ai.reset(),t.accept(Ai);let e=Ai.dslMethods;return Ai.reset(),e}function Zo(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function Jo(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function If(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function bf(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var BT="name";function ea(t,e){Object.defineProperty(t,BT,{enumerable:!1,configurable:!0,writable:!1,value:e})}function DT(t,e){let r=w(t),n=r.length;for(let i=0;i<n;i++){let o=r[i],a=t[o],s=a.length;for(let l=0;l<s;l++){let c=a[l];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}}function vf(t,e){let r=function(){};ea(r,t+"BaseSemantics");let n={visit:function(i,o){if(y(i)&&(i=i[0]),!Ee(i))return this[i.name](i.children,o)},validateVisitor:function(){let i=GT(this,e);if(!v(i)){let o=g(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
90
90
|
${o.join(`
|
|
91
91
|
|
|
92
92
|
`).replace(/\n/g,`
|
|
93
|
-
`)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function Pf(t,e,r){let n=function(){};ea(n,t+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return x(e,o=>{i[o]=DT}),n.prototype=i,n.prototype.constructor=n,n}var ta;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(ta||(ta={}));function GT(t,e){return WT(t,e)}function WT(t,e){let r=ge(e,i=>Ae(t[i])===!1),n=g(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:ta.MISSING_METHOD,methodName:i}));return
|
|
93
|
+
`)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function Pf(t,e,r){let n=function(){};ea(n,t+"BaseSemanticsWithDefaults");let i=Object.create(r.prototype);return x(e,o=>{i[o]=DT}),n.prototype=i,n.prototype.constructor=n,n}var ta;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(ta||(ta={}));function GT(t,e){return WT(t,e)}function WT(t,e){let r=ge(e,i=>Ae(t[i])===!1),n=g(r,i=>({msg:`Missing visitor method: <${i}> on ${t.constructor.name} CST Visitor.`,type:ta.MISSING_METHOD,methodName:i}));return tt(n)}var Li=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=T(e,"nodeLocationTracking")?e.nodeLocationTracking:Ce.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=q,this.cstFinallyStateUpdate=q,this.cstPostTerminal=q,this.cstPostNonTerminal=q,this.cstPostRule=q;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Jo,this.setNodeLocationFromNode=Jo,this.cstPostRule=q,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Zo,this.setNodeLocationFromNode=Zo,this.cstPostRule=q,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=q,this.setNodeLocationFromNode=q,this.cstPostRule=q,this.setInitialNodeLocation=q;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){let r=this.LA(1);e.location={startOffset:r.startOffset,startLine:r.startLine,startColumn:r.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let r={name:e,children:Object.create(null)};this.setInitialNodeLocation(r),this.CST_STACK.push(r)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?(n.endOffset=r.endOffset,n.endLine=r.endLine,n.endColumn=r.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(e){let r=this.LA(0),n=e.location;n.startOffset<=r.startOffset?n.endOffset=r.endOffset:n.startOffset=NaN}cstPostTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];If(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];bf(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(Ee(this.baseCstVisitorConstructor)){let e=vf(this.className,w(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Ee(this.baseCstVisitorWithDefaultsConstructor)){let e=Pf(this.className,w(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){let e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){let e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}};var Oi=class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):Ir}LA(e){let r=this.currIdx+e;return r<0||this.tokVectorLength<=r?Ir:this.tokVector[r]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}};var Ni=class{ACTION(e){return e.call(this)}consume(e,r,n){return this.consumeInternal(r,e,n)}subrule(e,r,n){return this.subruleInternal(r,e,n)}option(e,r){return this.optionInternal(r,e)}or(e,r){return this.orInternal(r,e)}many(e,r){return this.manyInternal(e,r)}atLeastOne(e,r){return this.atLeastOneInternal(e,r)}CONSUME(e,r){return this.consumeInternal(e,0,r)}CONSUME1(e,r){return this.consumeInternal(e,1,r)}CONSUME2(e,r){return this.consumeInternal(e,2,r)}CONSUME3(e,r){return this.consumeInternal(e,3,r)}CONSUME4(e,r){return this.consumeInternal(e,4,r)}CONSUME5(e,r){return this.consumeInternal(e,5,r)}CONSUME6(e,r){return this.consumeInternal(e,6,r)}CONSUME7(e,r){return this.consumeInternal(e,7,r)}CONSUME8(e,r){return this.consumeInternal(e,8,r)}CONSUME9(e,r){return this.consumeInternal(e,9,r)}SUBRULE(e,r){return this.subruleInternal(e,0,r)}SUBRULE1(e,r){return this.subruleInternal(e,1,r)}SUBRULE2(e,r){return this.subruleInternal(e,2,r)}SUBRULE3(e,r){return this.subruleInternal(e,3,r)}SUBRULE4(e,r){return this.subruleInternal(e,4,r)}SUBRULE5(e,r){return this.subruleInternal(e,5,r)}SUBRULE6(e,r){return this.subruleInternal(e,6,r)}SUBRULE7(e,r){return this.subruleInternal(e,7,r)}SUBRULE8(e,r){return this.subruleInternal(e,8,r)}SUBRULE9(e,r){return this.subruleInternal(e,9,r)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,r,n=br){if(H(this.definedRulesNames,e)){let a={message:je.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:ce.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);let i=this.defineRule(e,r,n);return this[e]=i,i}OVERRIDE_RULE(e,r,n=br){let i=xf(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(i);let o=this.defineRule(e,r,n);return this[e]=o,o}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,r),!0}catch(i){if(kt(i))return!1;throw i}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Zn(U(this.gastProductionsCache))}};var Ri=class{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Nr,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},T(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
94
94
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
95
95
|
For Further details.`);if(y(e)){if(v(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
96
96
|
Note that the first argument for the parser constructor
|
|
@@ -102,15 +102,15 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis
|
|
|
102
102
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},bi=class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){let r=e>0?e:"";this[`CONSUME${r}`]=function(n,i){return this.consumeInternalRecord(n,e,i)},this[`SUBRULE${r}`]=function(n,i){return this.subruleInternalRecord(n,e,i)},this[`OPTION${r}`]=function(n){return this.optionInternalRecord(n,e)},this[`OR${r}`]=function(n){return this.orInternalRecord(n,e)},this[`MANY${r}`]=function(n){this.manyInternalRecord(e,n)},this[`MANY_SEP${r}`]=function(n){this.manySepFirstInternalRecord(e,n)},this[`AT_LEAST_ONE${r}`]=function(n){this.atLeastOneInternalRecord(e,n)},this[`AT_LEAST_ONE_SEP${r}`]=function(n){this.atLeastOneSepFirstInternalRecord(e,n)}}this.consume=function(e,r,n){return this.consumeInternalRecord(r,e,n)},this.subrule=function(e,r,n){return this.subruleInternalRecord(r,e,n)},this.option=function(e,r){return this.optionInternalRecord(r,e)},this.or=function(e,r){return this.orInternalRecord(r,e)},this.many=function(e,r){this.manyInternalRecord(e,r)},this.atLeastOne=function(e,r){this.atLeastOneInternalRecord(e,r)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{let e=this;for(let r=0;r<10;r++){let n=r>0?r:"";delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,r){return()=>!0}LA_RECORD(e){return Ir}topLevelRuleRecord(e,r){try{let n=new Se({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),r.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
|
|
103
103
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
104
104
|
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return fn.call(this,j,e,r)}atLeastOneInternalRecord(e,r){fn.call(this,re,r,e)}atLeastOneSepFirstInternalRecord(e,r){fn.call(this,ne,r,e,Ff)}manyInternalRecord(e,r){fn.call(this,M,r,e)}manySepFirstInternalRecord(e,r){fn.call(this,Z,r,e,Ff)}orInternalRecord(e,r){return jT.call(this,e,r)}subruleInternalRecord(e,r,n){if(vi(r),!e||T(e,"ruleName")===!1){let s=new Error(`<SUBRULE${Uf(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
105
|
-
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=
|
|
106
|
-
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=
|
|
105
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let i=rt(this.recordingProdStack),o=e.ruleName,a=new G({idx:r,nonTerminalName:o,label:n?.LABEL,referencedRule:void 0});return i.definition.push(a),this.outputCst?VT:Pi}consumeInternalRecord(e,r,n){if(vi(r),!Uo(e)){let a=new Error(`<CONSUME${Uf(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
106
|
+
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let i=rt(this.recordingProdStack),o=new F({idx:r,terminalType:e,label:n?.LABEL});return i.definition.push(o),wf}};function fn(t,e,r,n=!1){vi(r);let i=rt(this.recordingProdStack),o=Ae(e)?e:e.DEF,a=new t({definition:[],idx:r});return n&&(a.separator=e.SEP),T(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),o.call(this),i.definition.push(a),this.recordingProdStack.pop(),Pi}function jT(t,e){vi(e);let r=rt(this.recordingProdStack),n=y(t)===!1,i=n===!1?t:t.DEF,o=new J({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});T(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD);let a=jr(i,s=>Ae(s.GATE));return o.hasPredicates=a,r.definition.push(o),x(i,s=>{let l=new W({definition:[]});o.definition.push(l),T(s,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=s.IGNORE_AMBIGUITIES:T(s,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),s.ALT.call(this),this.recordingProdStack.pop()}),Pi}function Uf(t){return t===0?"":`${t}`}function vi(t){if(t<0||t>Mf){let e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
107
107
|
Idx value must be a none negative value smaller than ${Mf+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var Fi=class{initPerformanceTracer(e){if(T(e,"traceInitPerf")){let r=e.traceInitPerf,n=typeof r=="number";this.traceInitMaxIdent=n?r:1/0,this.traceInitPerf=n?r>0:r}else this.traceInitMaxIdent=0,this.traceInitPerf=Ce.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,r){if(this.traceInitPerf===!0){this.traceInitIndent++;let n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${e}>`);let{time:i,value:o}=Kr(r),a=i>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${i}ms`),this.traceInitIndent--,o}else return r()}};function Bf(t,e){e.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(i=>{if(i==="constructor")return;let o=Object.getOwnPropertyDescriptor(n,i);o&&(o.get||o.set)?Object.defineProperty(t.prototype,i,o):t.prototype[i]=r.prototype[i]})})}var Ir=Kt(Ve,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(Ir);var Ce=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:si,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),br=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),ce;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(ce||(ce={}));var pn=class t{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;let r=this.className;this.TRACE_INIT("toFastProps",()=>{Yr(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),x(this.definedRulesNames,i=>{let a=this[i].originalGrammarAction,s;this.TRACE_INIT(`${i} Rule`,()=>{s=this.topLevelRuleRecord(i,a)}),this.gastProductionsCache[i]=s})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=yf({rules:U(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(v(n)&&this.skipValidations===!1){let i=Cf({rules:U(this.gastProductionsCache),tokenTypes:U(this.tokensMap),errMsgProvider:je,grammarName:r}),o=mf({lookaheadStrategy:this.lookaheadStrategy,rules:U(this.gastProductionsCache),tokenTypes:U(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(i,o)}}),v(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let i=Ic(U(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,o;(o=(i=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(i,{rules:U(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(U(this.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!v(this.definitionErrors))throw e=g(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
|
|
108
108
|
${e.join(`
|
|
109
109
|
-------------------------------
|
|
110
110
|
`)}`)})}constructor(e,r){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(r),n.initLexerAdapter(),n.initLooksAhead(r),n.initRecognizerEngine(e,r),n.initRecoverable(r),n.initTreeBuilder(r),n.initContentAssist(),n.initGastRecorder(r),n.initPerformanceTracer(r),T(r,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
111
111
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
112
112
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
113
|
-
For further details.`);this.skipValidations=T(r,"skipValidations")?r.skipValidations:Ce.skipValidations}};pn.DEFER_DEFINITION_ERRORS_HANDLING=!1;Bf(pn,[Ei,Ti,Li,Oi,Ri,Ni,_i,Ii,bi,Fi]);var hn=class extends pn{constructor(e,r=Ce){let n=D(r);n.outputCst=!0,super(e,n)}};var k=f({name:"KeywordReserved",pattern:b.NA}),R=f({name:"Keyword",pattern:b.NA}),Me=f({name:"DateFunction",pattern:b.NA}),vr=f({name:"AggregateFunction",pattern:b.NA}),Gf=f({name:"LocationFunction",pattern:b.NA}),KT=f({name:"FieldsFunction",pattern:b.NA}),dn=f({name:"FieldsFunctionParamIdentifier",pattern:b.NA}),mn=f({name:"OtherFunction",pattern:b.NA}),$=f({name:"DateLiteral",pattern:b.NA}),Q=f({name:"DateLiteralNotIdentifier",pattern:b.NA}),z=f({name:"DateNLiteral",pattern:b.NA}),Pr=f({name:"RelationalOperator",pattern:b.NA}),He=f({name:"SymbolIdentifier",pattern:b.NA}),gn=f({name:"DateIdentifier",pattern:b.NA}),it=f({name:"NumberIdentifier",pattern:b.NA}),Mi=f({name:"DecimalNumberIdentifier",pattern:b.NA}),Wf=f({name:"IntegerNumberIdentifier",pattern:b.NA}),YT=f({name:"IdentifierNotKeyword",pattern:b.NA}),ot=f({name:"UsingScopeEnumeration",pattern:b.NA}),$f=f({name:"RParenMismatch",pattern:b.NA}),Df=/[a-zA-Z][a-zA-Z0-9_.]*/y;function qT(t,e){Df.lastIndex=e;let r=Df.exec(t);return r&&r[0].includes("..")?null:r}var u=f({name:"Identifier",pattern:qT,line_breaks:!1,categories:[YT],start_chars_hint:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]}),En=f({name:"StringIdentifier",line_breaks:!0,pattern:/(')(?:(?=(\\?))\2.)*?\1/}),XT=f({name:"WhiteSpace",pattern:/\s+/,group:b.SKIPPED}),Ui=f({name:"AND",pattern:/AND/i,longer_alt:u,categories:[R,k]}),QT=f({name:"AS",pattern:/AS/i,longer_alt:u,categories:[R,k]}),ki=f({name:"DESC",pattern:/DESC/i,longer_alt:u,categories:[R,k]}),wi=f({name:"ASC",pattern:/ASC/i,longer_alt:u,categories:[R,k]}),na=f({name:"ORDER_BY",pattern:/ORDER BY/i,longer_alt:u}),ia=f({name:"CUBE",pattern:/CUBE/i,longer_alt:u,categories:[R,k]}),oa=f({name:"ELSE",pattern:/ELSE/i,longer_alt:u,categories:[R,k]}),aa=f({name:"EXCLUDES",pattern:/EXCLUDES/i,longer_alt:u,categories:[R,k]}),Bi=f({name:"FALSE",pattern:/FALSE/i,longer_alt:u,categories:[R,k]}),Di=f({name:"FIRST",pattern:/FIRST/i,longer_alt:u,categories:[R,k]}),sa=f({name:"FROM",pattern:/FROM/i,longer_alt:u,categories:[R,k]}),la=f({name:"GROUP_BY",pattern:/GROUP BY/i,longer_alt:u}),ua=f({name:"HAVING",pattern:/HAVING/i,longer_alt:u,categories:[R,k]}),Gi=f({name:"IN",pattern:/IN/i,longer_alt:u,categories:[R,k]}),ca=f({name:"INCLUDES",pattern:/INCLUDES/i,longer_alt:u,categories:[R,k]}),Wi=f({name:"LAST",pattern:/LAST/i,longer_alt:u,categories:[R,k]}),fa=f({name:"LIKE",pattern:/LIKE/i,longer_alt:u,categories:[R,k]}),pa=f({name:"LIMIT",pattern:/LIMIT/i,longer_alt:u,categories:[R,k]}),$i=f({name:"NOT",pattern:/NOT/i,longer_alt:u,categories:[R,k]}),Vi=f({name:"NULL",pattern:/NULL/i,longer_alt:u,categories:[R,k]}),ji=f({name:"NULLS",pattern:/NULLS/i,longer_alt:u,categories:[R,k]}),ha=f({name:"OR",pattern:/OR/i,longer_alt:u,categories:[R,k]}),da=f({name:"ROLLUP",pattern:/ROLLUP/i,longer_alt:u,categories:[R,k]}),ma=f({name:"SELECT",pattern:/SELECT/i,longer_alt:u,categories:[R,k]}),Hi=f({name:"TRUE",pattern:/TRUE/i,longer_alt:u,categories:[R,k]}),ga=f({name:"USING",pattern:/USING/i,longer_alt:u,categories:[R,k]}),Ea=f({name:"WHERE",pattern:/WHERE/i,longer_alt:u,categories:[R,k]}),xa=f({name:"WITH",pattern:/WITH/i,longer_alt:u,categories:[R,k]}),Aa=f({name:"FOR",pattern:/FOR/i,longer_alt:u,categories:[R,k]}),Ki=f({name:"UPDATE",pattern:/UPDATE/i,longer_alt:u,categories:[R,k]}),Ta=f({name:"ABOVE",pattern:/ABOVE/i,longer_alt:u,categories:[R,u]}),Sa=f({name:"ABOVE_OR_BELOW",pattern:/ABOVE_OR_BELOW/i,longer_alt:u,categories:[R,u]}),ya=f({name:"new",pattern:/new/i,longer_alt:u,categories:[R,u]}),Ca=f({name:"AT",pattern:/AT/i,longer_alt:u,categories:[R,u]}),La=f({name:"BELOW",pattern:/BELOW/i,longer_alt:u,categories:[R,u]}),Oa=f({name:"DATA_CATEGORY",pattern:/DATA CATEGORY/i,longer_alt:u,categories:[R]}),Na=f({name:"END",pattern:/END/i,longer_alt:u,categories:[R,u]}),Yi=f({name:"OFFSET",pattern:/OFFSET/i,longer_alt:u,categories:[R,u]}),Ra=f({name:"REFERENCE",pattern:/REFERENCE/i,longer_alt:u,categories:[R,u]}),_a=f({name:"SCOPE",pattern:/SCOPE/i,longer_alt:u,categories:[R,u]}),Ia=f({name:"TRACKING",pattern:/TRACKING/i,longer_alt:u,categories:[R,u]}),ba=f({name:"THEN",pattern:/THEN/i,longer_alt:u,categories:[R,u]}),va=f({name:"TYPEOF",pattern:/TYPEOF/i,longer_alt:u,categories:[R,u]}),Pa=f({name:"VIEW",pattern:/VIEW/i,longer_alt:u,categories:[R,u]}),Fa=f({name:"VIEWSTAT",pattern:/VIEWSTAT/i,longer_alt:u,categories:[R,u]}),Ma=f({name:"WHEN",pattern:/WHEN/i,longer_alt:u,categories:[R,u]}),Ua=f({name:"SECURITY_ENFORCED",pattern:/SECURITY_ENFORCED/i,longer_alt:u,categories:[R,u]}),ka=f({name:"SYSTEM_MODE",pattern:/SYSTEM_MODE/i,longer_alt:u,categories:[R,u]}),wa=f({name:"USER_MODE",pattern:/USER_MODE/i,longer_alt:u,categories:[R,u]}),Ba=f({name:"CALENDAR_MONTH",pattern:/CALENDAR_MONTH/i,longer_alt:u,categories:[Me,u]}),Da=f({name:"CALENDAR_QUARTER",pattern:/CALENDAR_QUARTER/i,longer_alt:u,categories:[Me,u]}),Ga=f({name:"CALENDAR_YEAR",pattern:/CALENDAR_YEAR/i,longer_alt:u,categories:[Me,u]}),Wa=f({name:"DAY_IN_MONTH",pattern:/DAY_IN_MONTH/i,longer_alt:u,categories:[Me,u]}),$a=f({name:"DAY_IN_WEEK",pattern:/DAY_IN_WEEK/i,longer_alt:u,categories:[Me,u]}),Va=f({name:"DAY_IN_YEAR",pattern:/DAY_IN_YEAR/i,longer_alt:u,categories:[Me,u]}),ja=f({name:"DAY_ONLY",pattern:/DAY_ONLY/i,longer_alt:u,categories:[Me,u]}),Ha=f({name:"FISCAL_MONTH",pattern:/FISCAL_MONTH/i,longer_alt:u,categories:[Me,u]}),Ka=f({name:"FISCAL_QUARTER",pattern:/FISCAL_QUARTER/i,longer_alt:u,categories:[Me,u]}),Ya=f({name:"FISCAL_YEAR",pattern:/FISCAL_YEAR/i,longer_alt:u,categories:[Me,u]}),qa=f({name:"HOUR_IN_DAY",pattern:/HOUR_IN_DAY/i,longer_alt:u,categories:[Me,u]}),Xa=f({name:"WEEK_IN_MONTH",pattern:/WEEK_IN_MONTH/i,longer_alt:u,categories:[Me,u]}),Qa=f({name:"WEEK_IN_YEAR",pattern:/WEEK_IN_YEAR/i,longer_alt:u,categories:[Me,u]}),za=f({name:"AVG",pattern:/AVG/i,longer_alt:u,categories:[vr,u]}),Za=f({name:"COUNT",pattern:/COUNT/i,longer_alt:u,categories:[vr,u]}),Ja=f({name:"COUNT_DISTINCT",pattern:/COUNT_DISTINCT/i,longer_alt:u,categories:[vr,u]}),es=f({name:"MIN",pattern:/MIN/i,longer_alt:u,categories:[vr,u]}),ts=f({name:"MAX",pattern:/MAX/i,longer_alt:u,categories:[vr,u]}),rs=f({name:"SUM",pattern:/SUM/i,longer_alt:u,categories:[vr,u]}),ns=f({name:"DISTANCE",pattern:/DISTANCE/i,longer_alt:u,categories:[Gf,u]}),is=f({name:"GEOLOCATION",pattern:/GEOLOCATION/i,longer_alt:u,categories:[Gf,u]}),os=f({name:"FIELDS",pattern:/FIELDS/i,longer_alt:u,categories:[KT,u]}),as=f({name:"FORMAT",pattern:/FORMAT/i,longer_alt:u,categories:[mn,u]}),ss=f({name:"toLabel",pattern:/TOLABEL/i,longer_alt:u,categories:[mn,u]}),ls=f({name:"convertTimezone",pattern:/CONVERTTIMEZONE/i,longer_alt:u,categories:[mn,u]}),us=f({name:"convertCurrency",pattern:/CONVERTCURRENCY/i,longer_alt:u,categories:[mn,u]}),qi=f({name:"GROUPING",pattern:/GROUPING/i,longer_alt:u,categories:[mn,u]}),zT=f({name:"ALL",pattern:/ALL/i,longer_alt:u,categories:[dn,u]}),ZT=f({name:"CUSTOM",pattern:/CUSTOM/i,longer_alt:u,categories:[dn,u]}),JT=f({name:"STANDARD",pattern:/STANDARD/i,longer_alt:u,categories:[dn,u]}),eS=f({name:"YESTERDAY",pattern:/YESTERDAY/i,longer_alt:u,categories:[$,u,Q]}),tS=f({name:"TODAY",pattern:/TODAY/i,longer_alt:u,categories:[$,u,Q]}),rS=f({name:"TOMORROW",pattern:/TOMORROW/i,longer_alt:u,categories:[$,u,Q]}),nS=f({name:"LAST_WEEK",pattern:/LAST_WEEK/i,longer_alt:u,categories:[$,u,Q]}),iS=f({name:"THIS_WEEK",pattern:/THIS_WEEK/i,longer_alt:u,categories:[$,u,Q]}),oS=f({name:"NEXT_WEEK",pattern:/NEXT_WEEK/i,longer_alt:u,categories:[$,u,Q]}),aS=f({name:"LAST_MONTH",pattern:/LAST_MONTH/i,longer_alt:u,categories:[$,u,Q]}),sS=f({name:"THIS_MONTH",pattern:/THIS_MONTH/i,longer_alt:u,categories:[$,u,Q]}),lS=f({name:"NEXT_MONTH",pattern:/NEXT_MONTH/i,longer_alt:u,categories:[$,u,Q]}),uS=f({name:"LAST_90_DAYS",pattern:/LAST_90_DAYS/i,longer_alt:u,categories:[$,u,Q]}),cS=f({name:"NEXT_90_DAYS",pattern:/NEXT_90_DAYS/i,longer_alt:u,categories:[$,u,Q]}),fS=f({name:"THIS_QUARTER",pattern:/THIS_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),pS=f({name:"LAST_QUARTER",pattern:/LAST_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),hS=f({name:"NEXT_QUARTER",pattern:/NEXT_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),dS=f({name:"THIS_YEAR",pattern:/THIS_YEAR/i,longer_alt:u,categories:[$,u,Q]}),mS=f({name:"LAST_YEAR",pattern:/LAST_YEAR/i,longer_alt:u,categories:[$,u,Q]}),gS=f({name:"NEXT_YEAR",pattern:/NEXT_YEAR/i,longer_alt:u,categories:[$,u,Q]}),ES=f({name:"THIS_FISCAL_QUARTER",pattern:/THIS_FISCAL_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),xS=f({name:"LAST_FISCAL_QUARTER",pattern:/LAST_FISCAL_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),AS=f({name:"NEXT_FISCAL_QUARTER",pattern:/NEXT_FISCAL_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),TS=f({name:"THIS_FISCAL_YEAR",pattern:/THIS_FISCAL_YEAR/i,longer_alt:u,categories:[$,u,Q]}),SS=f({name:"LAST_FISCAL_YEAR",pattern:/LAST_FISCAL_YEAR/i,longer_alt:u,categories:[$,u,Q]}),yS=f({name:"NEXT_FISCAL_YEAR",pattern:/NEXT_FISCAL_YEAR/i,longer_alt:u,categories:[$,u,Q]}),CS=f({name:"NEXT_N_DAYS",pattern:/NEXT_N_DAYS/i,longer_alt:u,categories:[z,u]}),LS=f({name:"LAST_N_DAYS",pattern:/LAST_N_DAYS/i,longer_alt:u,categories:[z,u]}),OS=f({name:"N_DAYS_AGO",pattern:/N_DAYS_AGO/i,longer_alt:u,categories:[z,u]}),NS=f({name:"NEXT_N_WEEKS",pattern:/NEXT_N_WEEKS/i,longer_alt:u,categories:[z,u]}),RS=f({name:"LAST_N_WEEKS",pattern:/LAST_N_WEEKS/i,longer_alt:u,categories:[z,u]}),_S=f({name:"N_WEEKS_AGO",pattern:/N_WEEKS_AGO/i,longer_alt:u,categories:[z,u]}),IS=f({name:"NEXT_N_MONTHS",pattern:/NEXT_N_MONTHS/i,longer_alt:u,categories:[z,u]}),bS=f({name:"LAST_N_MONTHS",pattern:/LAST_N_MONTHS/i,longer_alt:u,categories:[z,u]}),vS=f({name:"N_MONTHS_AGO",pattern:/N_MONTHS_AGO/i,longer_alt:u,categories:[z,u]}),PS=f({name:"NEXT_N_QUARTERS",pattern:/NEXT_N_QUARTERS/i,longer_alt:u,categories:[z,u]}),FS=f({name:"LAST_N_QUARTERS",pattern:/LAST_N_QUARTERS/i,longer_alt:u,categories:[z,u]}),MS=f({name:"N_QUARTERS_AGO",pattern:/N_QUARTERS_AGO/i,longer_alt:u,categories:[z,u]}),US=f({name:"NEXT_N_YEARS",pattern:/NEXT_N_YEARS/i,longer_alt:u,categories:[z,u]}),kS=f({name:"LAST_N_YEARS",pattern:/LAST_N_YEARS/i,longer_alt:u,categories:[z,u]}),wS=f({name:"N_YEARS_AGO",pattern:/N_YEARS_AGO/i,longer_alt:u,categories:[z,u]}),BS=f({name:"NEXT_N_FISCAL_QUARTERS",pattern:/NEXT_N_FISCAL_QUARTERS/i,longer_alt:u,categories:[z,u]}),DS=f({name:"LAST_N_FISCAL_QUARTERS",pattern:/LAST_N_FISCAL_QUARTERS/i,longer_alt:u,categories:[z,u]}),GS=f({name:"N_FISCAL_QUARTERS_AGO",pattern:/N_FISCAL_QUARTERS_AGO/i,longer_alt:u,categories:[z,u]}),WS=f({name:"NEXT_N_FISCAL_YEARS",pattern:/NEXT_N_FISCAL_YEARS/i,longer_alt:u,categories:[z,u]}),$S=f({name:"LAST_N_FISCAL_YEARS",pattern:/LAST_N_FISCAL_YEARS/i,longer_alt:u,categories:[z,u]}),VS=f({name:"N_FISCAL_YEARS_AGO",pattern:/N_FISCAL_YEARS_AGO/i,longer_alt:u,categories:[z,u]}),cs=f({name:"EQUAL",pattern:"=",categories:[Pr]}),fs=f({name:"NOT_EQUAL",pattern:/!=|<>/,categories:[Pr]}),Xi=f({name:"LESS_THAN",pattern:"<",categories:[Pr]}),ps=f({name:"LESS_THAN_OR_EQUAL",pattern:"<=",categories:[Pr]}),Qi=f({name:"GREATER_THAN",pattern:">",categories:[Pr]}),hs=f({name:"GREATER_THAN_OR_EQUAL",pattern:">=",categories:[Pr]}),zi=f({name:"DECIMAL",pattern:".",categories:[He]}),Zi=f({name:"COLON",pattern:":",categories:[He]}),jS=f({name:"SEMICOLON",pattern:";",categories:[He]}),Le=f({name:"COMMA",pattern:",",categories:[He]}),HS=f({name:"ASTERISK",pattern:"*",categories:[He]}),Ue=f({name:"L_PAREN",pattern:"(",categories:[He]}),Ge=f({name:"R_PAREN",pattern:")",categories:[He]}),ds=f({name:"L_SQUARE_BRACKET",pattern:"[",categories:[He]}),ms=f({name:"R_SQUARE_BRACKET",pattern:"]",categories:[He]}),KS=f({name:"PLUS",pattern:"+",categories:[He]}),YS=f({name:"MINUS",pattern:"-",categories:[He]}),qS=f({name:"DATETIME",pattern:/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(\Z|\.[0-9]+Z|\+[0-9]{2}:[0-9]{2}|\-[0-9]{2}:[0-9]{2}|\+[0-9]{4}|\-[0-9]{4})/i,categories:[gn]}),XS=f({name:"DATE",pattern:/[0-9]{4}-[0-9]{2}-[0-9]{2}/,categories:[gn]}),Ji=f({name:"CURRENCY_PREFIXED_DECIMAL",pattern:/[a-zA-Z]{3}[0-9]+\.\d+/,longer_alt:u,categories:[Mi]}),QS=f({name:"SIGNED_DECIMAL",pattern:/(\-|\+)[0-9]*\.\d+/,categories:[it,Mi]}),zS=f({name:"UNSIGNED_DECIMAL",pattern:/[0-9]*\.\d+/,categories:[it,Mi]}),eo=f({name:"CURRENCY_PREFIXED_INTEGER",pattern:/[a-zA-Z]{3}-?[0-9]+/,longer_alt:u,categories:[Mi,u]}),gs=f({name:"SIGNED_INTEGER",pattern:/(\-|\+)[0-9]+/,categories:[it,Wf]}),xn=f({name:"GEOLOCATION_UNIT",pattern:/'(mi|km)'/i,longer_alt:u,categories:[u]}),qt=f({name:"UNSIGNED_INTEGER",pattern:/0|[1-9]\d*/,categories:[it,Wf]}),ZS=f({name:"Delegated",pattern:/DELEGATED/i,longer_alt:u,categories:[ot,u],start_chars_hint:["D","d"]}),JS=f({name:"Everything",pattern:/EVERYTHING/i,longer_alt:u,categories:[ot,u],start_chars_hint:["E","e"]}),ey=f({name:"MineAndMyGroups",pattern:/MINEANDMYGROUPS/i,longer_alt:u,categories:[ot,u],start_chars_hint:["M","m"]}),ty=f({name:"Mine",pattern:/MINE/i,longer_alt:u,categories:[ot,u],start_chars_hint:["M","m"]}),ry=f({name:"MyTerritory",pattern:/MY_TERRITORY/i,longer_alt:u,categories:[ot,u],start_chars_hint:["M","m"]}),ny=f({name:"MyTeamTerritory",pattern:/MY_TEAM_TERRITORY/i,longer_alt:u,categories:[ot,u],start_chars_hint:["M","m"]}),iy=f({name:"Team",pattern:/TEAM/i,longer_alt:u,categories:[ot,u],start_chars_hint:["T","t"]}),oy=f({name:"AllPrivate",pattern:/ALLPRIVATE/i,longer_alt:u,categories:[ot,u],start_chars_hint:["A","a"]}),Es=[XT,Ui,wi,QT,na,ia,ki,oa,aa,Bi,Di,sa,qi,la,ua,ca,fa,pa,ji,Vi,da,ma,Hi,ga,Ea,xa,Ki,ZS,JS,ey,ty,ry,ny,iy,oy,Sa,Ta,ya,Ca,La,Oa,Na,Yi,Ra,_a,Ia,ba,va,Fa,Pa,Ma,Ua,ka,wa,Ba,Da,Ga,Wa,$a,Va,ja,Ha,Ka,Ya,qa,Xa,Qa,za,Ja,Za,es,ts,rs,ns,is,os,as,ss,ls,us,eS,tS,rS,nS,iS,oS,aS,sS,lS,uS,cS,fS,pS,hS,dS,mS,gS,ES,xS,AS,TS,SS,yS,CS,LS,OS,NS,RS,_S,IS,bS,vS,PS,FS,MS,US,kS,wS,BS,DS,GS,WS,$S,VS,xn,zT,ZT,JT,Gi,Aa,ha,Wi,$i,Ji,eo,En,u,qS,XS,QS,zS,qt,gs,cs,fs,ps,Xi,hs,Qi,zi,Zi,jS,Le,HS,Ue,Ge,ds,ms,KS,YS],ay=new b(Es,{ensureOptimizations:!0,skipValidations:!1});function Vf(t){return ay.tokenize(t)}var xs=class extends Error{constructor(e){super(`${e.message} (${e.line}:${e.column})`),this.name="LexingError"}},to=class extends Error{constructor(e){super(e.message),this.name=e.name}},Fr=class extends hn{constructor({ignoreParseErrors:r}={ignoreParseErrors:!1}){super(Es,{skipValidations:!1,recoveryEnabled:!!r});this.$_dateFunctionOr=void 0;this.$_aggregateFunction=void 0;this.$_otherFunction=void 0;this.$_atomicExpression=void 0;this.$_apexBindVariableExpression=void 0;this.$_arrayExpression=void 0;this.$_relationalOperator=void 0;this.$_selectClause=void 0;this.$_selectClauseFunctionIdentifier=void 0;this.$_withDataCategoryArr=void 0;this.allowApexBindVariables=!1;this.ignoreParseErrors=!1;this.selectStatement=this.RULE("selectStatement",()=>{this.SUBRULE(this.selectClause),this.SUBRULE(this.fromClause),this.SUBRULE(this.clauseStatements)});this.selectStatementPartial=this.RULE("selectStatementPartial",()=>{this.OPTION(()=>{this.SUBRULE(this.selectClause)}),this.OPTION1(()=>{this.SUBRULE(this.fromClause)}),this.SUBRULE(this.clauseStatements)});this.clauseStatements=this.RULE("clauseStatements",()=>{this.OPTION(()=>{this.SUBRULE(this.usingScopeClause)}),this.OPTION1(()=>{this.SUBRULE(this.whereClause)}),this.OPTION2(()=>{this.MANY({DEF:()=>{this.SUBRULE(this.withClause)}})}),this.OPTION3(()=>{this.SUBRULE(this.groupByClause),this.OPTION4(()=>{this.SUBRULE(this.havingClause)})}),this.OPTION5(()=>{this.SUBRULE(this.orderByClause)}),this.OPTION6(()=>{this.SUBRULE(this.limitClause)}),this.OPTION7(()=>{this.SUBRULE(this.offsetClause)}),this.OPTION8(()=>{this.SUBRULE(this.forViewOrReference)}),this.OPTION9(()=>{this.SUBRULE(this.updateTrackingViewstat)})});this.selectClause=this.RULE("selectClause",()=>{this.CONSUME(ma),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.OR(this.$_selectClause||(this.$_selectClause=[{ALT:()=>this.SUBRULE(this.selectClauseFunctionIdentifier,{LABEL:"field"})},{ALT:()=>this.SUBRULE(this.selectClauseSubqueryIdentifier,{LABEL:"field"})},{ALT:()=>this.SUBRULE(this.selectClauseTypeOf,{LABEL:"field"})},{ALT:()=>this.SUBRULE(this.selectClauseIdentifier,{LABEL:"field"})}]))}})},{resyncEnabled:!1});this.selectClauseFunctionIdentifier=this.RULE("selectClauseFunctionIdentifier",()=>{this.OR(this.$_selectClauseFunctionIdentifier||(this.$_selectClauseFunctionIdentifier=[{ALT:()=>this.SUBRULE(this.dateFunction,{LABEL:"fn"})},{ALT:()=>this.SUBRULE(this.aggregateFunction,{LABEL:"fn"})},{ALT:()=>this.SUBRULE(this.locationFunction,{LABEL:"fn"})},{ALT:()=>this.SUBRULE(this.fieldsFunction,{LABEL:"fn"})},{ALT:()=>this.SUBRULE(this.otherFunction,{LABEL:"fn"})}])),this.OPTION(()=>this.CONSUME(u,{LABEL:"alias"}))},{resyncEnabled:!1});this.selectClauseSubqueryIdentifier=this.RULE("selectClauseSubqueryIdentifier",()=>{this.CONSUME(Ue),this.SUBRULE(this.selectStatement),this.CONSUME(Ge)},{resyncEnabled:!1});this.selectClauseTypeOf=this.RULE("selectClauseTypeOf",()=>{this.CONSUME(va),this.CONSUME(u,{LABEL:"typeOfField"}),this.AT_LEAST_ONE({DEF:()=>{this.SUBRULE(this.selectClauseTypeOfThen)}}),this.OPTION(()=>{this.SUBRULE(this.selectClauseTypeOfElse)}),this.CONSUME(Na)},{resyncEnabled:!1});this.selectClauseIdentifier=this.RULE("selectClauseIdentifier",()=>{this.CONSUME(u,{LABEL:"field"}),this.OPTION(()=>this.CONSUME1(u,{LABEL:"alias"}))},{resyncEnabled:!1});this.selectClauseTypeOfThen=this.RULE("selectClauseTypeOfThen",()=>{this.CONSUME(Ma),this.CONSUME(u,{LABEL:"typeOfField"}),this.CONSUME(ba),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.CONSUME1(u,{LABEL:"field"})}})},{resyncEnabled:!1});this.selectClauseTypeOfElse=this.RULE("selectClauseTypeOfElse",()=>{this.CONSUME(oa),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.CONSUME(u,{LABEL:"field"})}})},{resyncEnabled:!1});this.fromClause=this.RULE("fromClause",()=>{this.CONSUME(sa),this.CONSUME(u),this.OPTION({GATE:()=>!(this.LA(1).tokenType===Yi&&this.LA(2).tokenType===qt),DEF:()=>this.CONSUME1(u,{LABEL:"alias"})})},{resyncEnabled:!1});this.usingScopeClause=this.RULE("usingScopeClause",()=>{this.CONSUME(ga),this.CONSUME(_a),this.CONSUME(ot)});this.whereClause=this.RULE("whereClause",()=>{this.CONSUME(Ea);let r=this.getParenCount();this.AT_LEAST_ONE({DEF:()=>{this.SUBRULE(this.conditionExpression,{ARGS:[r,!0,!0]})}}),this.$_checkBalancedParens(r)});this.whereClauseSubqueryIdentifier=this.RULE("whereClauseSubqueryIdentifier",()=>{this.CONSUME(Ue),this.SUBRULE(this.selectStatement),this.CONSUME(Ge)});this.conditionExpression=this.RULE("conditionExpression",(r,n,i)=>{r=this.getParenCount(r),this.OPTION(()=>{this.OR([{ALT:()=>this.CONSUME(Ui,{LABEL:"logicalOperator"})},{ALT:()=>this.CONSUME(ha,{LABEL:"logicalOperator"})}])}),this.MANY({MAX_LOOKAHEAD:10,DEF:()=>this.SUBRULE(this.expressionPartWithNegation,{ARGS:[r],LABEL:"expressionNegation"})}),this.OR1({MAX_LOOKAHEAD:10,DEF:[{ALT:()=>this.SUBRULE(this.expression,{ARGS:[r,!1,n,i]})}]})});this.withClause=this.RULE("withClause",()=>{this.CONSUME(xa),this.OR([{ALT:()=>this.CONSUME(Ua,{LABEL:"withSecurityEnforced"})},{ALT:()=>this.CONSUME(wa,{LABEL:"withAccessLevel"})},{ALT:()=>this.CONSUME(ka,{LABEL:"withAccessLevel"})},{ALT:()=>this.SUBRULE(this.withDataCategory)}])});this.withDataCategory=this.RULE("withDataCategory",()=>{this.CONSUME(Oa),this.AT_LEAST_ONE_SEP({SEP:Ui,DEF:()=>{this.SUBRULE(this.withDataCategoryArr)}})});this.withDataCategoryArr=this.RULE("withDataCategoryArr",()=>{this.CONSUME(u,{LABEL:"dataCategoryGroupName"}),this.OR(this.$_withDataCategoryArr||(this.$_withDataCategoryArr=[{ALT:()=>this.CONSUME(Ca,{LABEL:"filteringSelector"})},{ALT:()=>this.CONSUME(Ta,{LABEL:"filteringSelector"})},{ALT:()=>this.CONSUME(La,{LABEL:"filteringSelector"})},{ALT:()=>this.CONSUME(Sa,{LABEL:"filteringSelector"})}])),this.OPTION(()=>{this.CONSUME1(Ue)}),this.AT_LEAST_ONE_SEP1({SEP:Le,DEF:()=>{this.CONSUME1(u,{LABEL:"dataCategoryName"})}}),this.OPTION1(()=>{this.CONSUME2(Ge)})});this.groupByClause=this.RULE("groupByClause",()=>{this.CONSUME(la),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.OR([{ALT:()=>this.SUBRULE(this.cubeFunction,{LABEL:"groupBy"})},{ALT:()=>this.SUBRULE(this.rollupFunction,{LABEL:"groupBy"})},{ALT:()=>this.SUBRULE(this.dateFunction,{LABEL:"groupBy"})},{ALT:()=>this.CONSUME(u,{LABEL:"groupBy"})}])}})});this.havingClause=this.RULE("havingClause",()=>{this.CONSUME(ua);let r=this.getParenCount();this.AT_LEAST_ONE({DEF:()=>{this.SUBRULE(this.conditionExpression,{ARGS:[r,!0,!1]})}}),this.$_checkBalancedParens(r)});this.orderByClause=this.RULE("orderByClause",()=>{this.CONSUME(na),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.OR([{ALT:()=>this.SUBRULE(this.orderByGroupingFunctionExpression,{LABEL:"orderByExpressionOrFn"})},{ALT:()=>this.SUBRULE(this.orderBySpecialFunctionExpression,{LABEL:"orderByExpressionOrFn"})},{ALT:()=>this.SUBRULE(this.orderByExpression,{LABEL:"orderByExpressionOrFn"})}])}})});this.orderByExpression=this.RULE("orderByExpression",()=>{this.CONSUME(u),this.OPTION(()=>{this.OR([{ALT:()=>this.CONSUME(wi,{LABEL:"order"})},{ALT:()=>this.CONSUME(ki,{LABEL:"order"})}])}),this.OPTION1(()=>{this.CONSUME(ji),this.OR1([{ALT:()=>this.CONSUME(Di,{LABEL:"nulls"})},{ALT:()=>this.CONSUME(Wi,{LABEL:"nulls"})}])})});this.orderByGroupingFunctionExpression=this.RULE("orderByGroupingFunctionExpression",()=>{this.CONSUME(qi,{LABEL:"fn"}),this.SUBRULE(this.functionExpression)});this.orderBySpecialFunctionExpression=this.RULE("orderBySpecialFunctionExpression",()=>{this.OR([{ALT:()=>this.SUBRULE(this.aggregateFunction)},{ALT:()=>this.SUBRULE(this.dateFunction)},{ALT:()=>this.SUBRULE(this.locationFunction)}]),this.OPTION(()=>{this.OR1([{ALT:()=>this.CONSUME(wi,{LABEL:"order"})},{ALT:()=>this.CONSUME(ki,{LABEL:"order"})}])}),this.OPTION1(()=>{this.CONSUME(ji),this.OR2([{ALT:()=>this.CONSUME(Di,{LABEL:"nulls"})},{ALT:()=>this.CONSUME(Wi,{LABEL:"nulls"})}])})});this.limitClause=this.RULE("limitClause",()=>{this.CONSUME(pa),this.CONSUME(qt,{LABEL:"value"})});this.offsetClause=this.RULE("offsetClause",()=>{this.CONSUME(Yi),this.CONSUME(qt,{LABEL:"value"})});this.dateFunction=this.RULE("dateFunction",()=>{this.OR(this.$_dateFunctionOr||(this.$_dateFunctionOr=[{ALT:()=>this.CONSUME(Ba,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Da,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ga,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Wa,{LABEL:"fn"})},{ALT:()=>this.CONSUME($a,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Va,{LABEL:"fn"})},{ALT:()=>this.CONSUME(ja,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ha,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ka,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ya,{LABEL:"fn"})},{ALT:()=>this.CONSUME(qa,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Xa,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Qa,{LABEL:"fn"})}])),this.SUBRULE(this.functionExpression)});this.aggregateFunction=this.RULE("aggregateFunction",()=>{this.OR(this.$_aggregateFunction||(this.$_aggregateFunction=[{ALT:()=>this.CONSUME(za,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Za,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ja,{LABEL:"fn"})},{ALT:()=>this.CONSUME(es,{LABEL:"fn"})},{ALT:()=>this.CONSUME(ts,{LABEL:"fn"})},{ALT:()=>this.CONSUME(rs,{LABEL:"fn"})}])),this.SUBRULE(this.functionExpression,{ARGS:[!0]})});this.fieldsFunction=this.RULE("fieldsFunction",()=>{this.CONSUME(os,{LABEL:"fn"}),this.CONSUME(Ue),this.CONSUME(dn,{LABEL:"params"}),this.CONSUME(Ge)});this.otherFunction=this.RULE("otherFunction",()=>{this.OR(this.$_otherFunction||(this.$_otherFunction=[{ALT:()=>this.CONSUME(as,{LABEL:"fn"})},{ALT:()=>this.CONSUME(ss,{LABEL:"fn"})},{ALT:()=>this.CONSUME(ls,{LABEL:"fn"})},{ALT:()=>this.CONSUME(us,{LABEL:"fn"})},{ALT:()=>this.CONSUME(qi,{LABEL:"fn"})}])),this.SUBRULE(this.functionExpression)});this.cubeFunction=this.RULE("cubeFunction",()=>{this.CONSUME(ia,{LABEL:"fn"}),this.SUBRULE(this.functionExpression)});this.rollupFunction=this.RULE("rollupFunction",()=>{this.CONSUME(da,{LABEL:"fn"}),this.SUBRULE(this.functionExpression)});this.functionExpression=this.RULE("functionExpression",r=>{this.CONSUME(Ue),this.MANY_SEP({SEP:Le,DEF:()=>{this.OR([{GATE:()=>!r,ALT:()=>this.SUBRULE(this.aggregateFunction,{LABEL:"params"})},{ALT:()=>this.SUBRULE(this.otherFunction,{LABEL:"params"})},{ALT:()=>this.CONSUME(En,{LABEL:"params"})},{ALT:()=>this.CONSUME(it,{LABEL:"params"})},{ALT:()=>this.CONSUME(u,{LABEL:"params"})}])}}),this.CONSUME(Ge)});this.locationFunction=this.RULE("locationFunction",()=>{this.CONSUME(ns),this.CONSUME(Ue),this.CONSUME(u,{LABEL:"location1"}),this.CONSUME(Le),this.OR([{ALT:()=>this.SUBRULE(this.geolocationFunction,{LABEL:"location2"})},{ALT:()=>this.CONSUME1(u,{LABEL:"location2"})}]),this.CONSUME1(Le),this.CONSUME(xn,{LABEL:"unit"}),this.CONSUME(Ge)});this.geolocationFunction=this.RULE("geolocationFunction",()=>{this.CONSUME(is),this.CONSUME(Ue),this.CONSUME(it,{LABEL:"latitude"}),this.CONSUME(Le),this.CONSUME1(it,{LABEL:"longitude"}),this.CONSUME(Ge)});this.expressionPartWithNegation=this.RULE("expressionPartWithNegation",r=>{let n=0;this.MANY(()=>{this.CONSUME(Ue),n++}),this.CONSUME($i,{LABEL:"expressionNegation"}),r&&n&&(r.left+=n)});this.expression=this.RULE("expression",(r,n,i,o)=>{this.OPTION1(()=>{this.MANY1(()=>{this.CONSUME(Ue),r&&r.left++})}),this.OR1([{GATE:()=>!!i,ALT:()=>this.SUBRULE(this.aggregateFunction,{LABEL:"lhs"})},{GATE:()=>!!o,ALT:()=>this.SUBRULE(this.locationFunction,{LABEL:"lhs"})},{ALT:()=>this.SUBRULE(this.dateFunction,{LABEL:"lhs"})},{ALT:()=>this.SUBRULE(this.otherFunction,{LABEL:"lhs"})},{ALT:()=>this.CONSUME(u,{LABEL:"lhs"})}]),this.OR2([{ALT:()=>this.SUBRULE(this.expressionWithRelationalOperator,{LABEL:"operator"})},{ALT:()=>this.SUBRULE(this.expressionWithSetOperator,{LABEL:"operator",ARGS:[n]})}]),this.OPTION3(()=>{this.MANY2({GATE:()=>r?r.left>r.right:!0,DEF:()=>{this.CONSUME(Ge),r&&r.right++}})})});this.expressionWithRelationalOperator=this.RULE("expressionWithRelationalOperator",()=>{this.SUBRULE(this.relationalOperator),this.SUBRULE(this.atomicExpression,{LABEL:"rhs"})});this.expressionWithSetOperator=this.RULE("expressionWithSetOperator",r=>{this.SUBRULE(this.setOperator),this.SUBRULE2(this.atomicExpression,{LABEL:"rhs",ARGS:[!0,r]})});this.atomicExpression=this.RULE("atomicExpression",(r,n)=>{this.OR(this.$_atomicExpression||(this.$_atomicExpression=[{GATE:()=>this.allowApexBindVariables,ALT:()=>this.SUBRULE(this.apexBindVariableExpression)},{GATE:()=>r,ALT:()=>this.SUBRULE(this.arrayExpression)},{GATE:()=>r&&n,ALT:()=>this.SUBRULE(this.whereClauseSubqueryIdentifier)},{GATE:()=>!r,ALT:()=>this.CONSUME(gn)},{GATE:()=>!r,ALT:()=>this.CONSUME(Ji,{LABEL:"CurrencyPrefixedDecimal"})},{GATE:()=>!r,ALT:()=>this.CONSUME(eo,{LABEL:"CurrencyPrefixedInteger"})},{GATE:()=>!r,ALT:()=>this.CONSUME(it)},{GATE:()=>!r,ALT:()=>this.CONSUME(Vi)},{GATE:()=>!r,ALT:()=>this.SUBRULE(this.booleanValue)},{GATE:()=>!r,ALT:()=>this.CONSUME($)},{GATE:()=>!r,ALT:()=>this.SUBRULE(this.dateNLiteral)},{GATE:()=>!r,ALT:()=>this.CONSUME(xn,{LABEL:"StringIdentifier"})},{GATE:()=>!r,ALT:()=>this.CONSUME(En)}]))});this.apexBindVariableExpression=this.RULE("apexBindVariableExpression",()=>{this.CONSUME(Zi),this.OPTION(()=>{this.SUBRULE(this.apexBindVariableNewInstantiation,{LABEL:"apex"}),this.OPTION1(()=>{this.CONSUME(zi)})}),this.MANY_SEP({SEP:zi,DEF:()=>{this.OR(this.$_apexBindVariableExpression||(this.$_apexBindVariableExpression=[{ALT:()=>this.SUBRULE(this.apexBindVariableFunctionCall,{LABEL:"apex"})},{ALT:()=>this.SUBRULE(this.apexBindVariableIdentifier,{LABEL:"apex"})}]))}})});this.apexBindVariableIdentifier=this.RULE("apexBindVariableIdentifier",()=>{this.CONSUME(u),this.OPTION(()=>this.SUBRULE(this.apexBindVariableFunctionArrayAccessor))});this.apexBindVariableNewInstantiation=this.RULE("apexBindVariableNewInstantiation",()=>{this.CONSUME(ya,{LABEL:"new"}),this.CONSUME(u,{LABEL:"function"}),this.OPTION(()=>{this.SUBRULE(this.apexBindVariableGeneric)}),this.SUBRULE(this.apexBindVariableFunctionParams),this.OPTION1(()=>this.SUBRULE(this.apexBindVariableFunctionArrayAccessor))});this.apexBindVariableFunctionCall=this.RULE("apexBindVariableFunctionCall",()=>{this.CONSUME(u,{LABEL:"function"}),this.SUBRULE(this.apexBindVariableFunctionParams),this.OPTION(()=>this.SUBRULE(this.apexBindVariableFunctionArrayAccessor))});this.apexBindVariableGeneric=this.RULE("apexBindVariableGeneric",()=>{this.CONSUME(Xi),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.CONSUME(u,{LABEL:"parameter"})}}),this.CONSUME(Qi)});this.apexBindVariableFunctionParams=this.RULE("apexBindVariableFunctionParams",()=>{this.CONSUME(Ue),this.MANY_SEP({SEP:Le,DEF:()=>{this.CONSUME(u,{LABEL:"parameter"})}}),this.CONSUME(Ge)});this.apexBindVariableFunctionArrayAccessor=this.RULE("apexBindVariableFunctionArrayAccessor",()=>{this.CONSUME(ds),this.OR([{ALT:()=>this.CONSUME(qt,{LABEL:"value"})},{ALT:()=>this.CONSUME(u,{LABEL:"value"})}]),this.CONSUME(ms)});this.arrayExpression=this.RULE("arrayExpression",()=>{this.CONSUME(Ue),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.OR(this.$_arrayExpression||(this.$_arrayExpression=[{ALT:()=>this.CONSUME(Ji,{LABEL:"value"})},{ALT:()=>this.CONSUME(eo,{LABEL:"value"})},{ALT:()=>this.CONSUME(it,{LABEL:"value"})},{ALT:()=>this.CONSUME(gn,{LABEL:"value"})},{ALT:()=>this.CONSUME(Vi,{LABEL:"value"})},{ALT:()=>this.CONSUME(Hi,{LABEL:"value"})},{ALT:()=>this.CONSUME(Bi,{LABEL:"value"})},{ALT:()=>this.CONSUME($,{LABEL:"value"})},{ALT:()=>this.SUBRULE(this.dateNLiteral,{LABEL:"value"})},{ALT:()=>this.CONSUME(xn,{LABEL:"value"})},{ALT:()=>this.CONSUME(En,{LABEL:"value"})}]))}}),this.CONSUME(Ge)});this.relationalOperator=this.RULE("relationalOperator",()=>{this.OR(this.$_relationalOperator||(this.$_relationalOperator=[{ALT:()=>this.CONSUME(cs,{LABEL:"operator"})},{ALT:()=>this.CONSUME(fs,{LABEL:"operator"})},{ALT:()=>this.CONSUME(Qi,{LABEL:"operator"})},{ALT:()=>this.CONSUME(hs,{LABEL:"operator"})},{ALT:()=>this.CONSUME(Xi,{LABEL:"operator"})},{ALT:()=>this.CONSUME(ps,{LABEL:"operator"})},{ALT:()=>this.CONSUME(fa,{LABEL:"operator"})}]))});this.setOperator=this.RULE("setOperator",()=>{this.OR([{ALT:()=>this.CONSUME(Gi,{LABEL:"operator"})},{ALT:()=>this.SUBRULE(this.notInOperator,{LABEL:"notIn"})},{ALT:()=>this.CONSUME(ca,{LABEL:"operator"})},{ALT:()=>this.CONSUME(aa,{LABEL:"operator"})}])});this.notInOperator=this.RULE("notInOperator",()=>{this.CONSUME($i,{LABEL:"operator"}),this.CONSUME(Gi,{LABEL:"operator"})});this.booleanValue=this.RULE("booleanValue",()=>{this.OR([{ALT:()=>this.CONSUME(Hi,{LABEL:"boolean"})},{ALT:()=>this.CONSUME(Bi,{LABEL:"boolean"})}])});this.dateNLiteral=this.RULE("dateNLiteral",()=>{this.CONSUME(z,{LABEL:"dateNLiteral"}),this.CONSUME(Zi),this.OR1([{ALT:()=>this.CONSUME(qt,{LABEL:"variable"})},{ALT:()=>this.CONSUME(gs,{LABEL:"variable"})}])});this.forViewOrReference=this.RULE("forViewOrReference",()=>{this.CONSUME(Aa),this.OR([{ALT:()=>this.CONSUME(Pa,{LABEL:"value"})},{ALT:()=>this.CONSUME(Ra,{LABEL:"value"})},{ALT:()=>this.CONSUME(Ki,{LABEL:"value"})}])});this.updateTrackingViewstat=this.RULE("updateTrackingViewstat",()=>{this.CONSUME(Ki),this.OR([{ALT:()=>this.CONSUME(Ia,{LABEL:"value"})},{ALT:()=>this.CONSUME(Fa,{LABEL:"value"})}])});this.ignoreParseErrors=!!r,this.performSelfAnalysis()}$_checkBalancedParens(r){!this.RECORDING_PHASE&&r&&r.left-r.right!==0&&this.CONSUME($f,{ERR_MSG:"Expecting a token type of --> RParen <-- but found --> '' <--"})}getParenCount(r){return r||{right:0,left:0}}},at=new Fr;function As(t,e){let{allowApexBindVariables:r,logErrors:n,ignoreParseErrors:i,allowPartialQuery:o}=e||{allowApexBindVariables:!1,logErrors:!1,ignoreParseErrors:!1},a=Vf(t);if(a.errors.length>0)throw n&&(console.log("Lexing Errors:"),console.log(a.errors)),new xs(a.errors[0]);at.ignoreParseErrors!==i&&(at=new Fr({ignoreParseErrors:i})),at.input=a.tokens,at.allowApexBindVariables=r||!1;let s;if(o?s=at.selectStatementPartial():s=at.selectStatement(),at.errors.length>0&&(n&&(console.log("Parsing Errors:"),console.log(at.errors)),!i))throw new to(at.errors[0]);return{cst:s,parseErrors:at.errors.map(l=>new to(l))}}var ly=new Fr,uy=ly.getBaseCstVisitorConstructor(),cy=["TRUE","FALSE"],fy=["YESTERDAY","TODAY","TOMORROW","LAST_WEEK","THIS_WEEK","NEXT_WEEK","LAST_MONTH","THIS_MONTH","NEXT_MONTH","LAST_90_DAYS","NEXT_90_DAYS","THIS_QUARTER","LAST_QUARTER","NEXT_QUARTER","THIS_YEAR","LAST_YEAR","NEXT_YEAR","THIS_FISCAL_QUARTER","LAST_FISCAL_QUARTER","NEXT_FISCAL_QUARTER","THIS_FISCAL_YEAR","LAST_FISCAL_YEAR","NEXT_FISCAL_YEAR"],py=["NEXT_N_DAYS","LAST_N_DAYS","N_DAYS_AGO","NEXT_N_WEEKS","LAST_N_WEEKS","N_WEEKS_AGO","NEXT_N_MONTHS","LAST_N_MONTHS","N_MONTHS_AGO","NEXT_N_QUARTERS","LAST_N_QUARTERS","N_QUARTERS_AGO","NEXT_N_YEARS","LAST_N_YEARS","N_YEARS_AGO","NEXT_N_FISCAL_QUARTERS","LAST_N_FISCAL_QUARTERS","N_FISCAL_QUARTERS_AGO","NEXT_N_FISCAL_YEARS","LAST_N_FISCAL_YEARS","N_FISCAL_YEARS_AGO"],Ts=class extends uy{constructor(){super();this.helpers={$_getFieldFunction:(r,n=!1,i=!0)=>{let o=r.functionExpression?r.functionExpression.map(s=>this.visit(s,{includeType:i})).flat():[],a={};return i&&(a.type="FieldFunctionExpression"),a.functionName=r.fn[0].tokenType.name,a.parameters=o,i&&n&&(a.isAggregateFn=n),a.rawValue=`${r.fn[0].image}(${o.map(s=>typeof s=="string"?s:s.rawValue).join(", ")})`,a},$_getLiteralTypeFromTokenType:r=>r==="REAL_NUMBER"?"DECIMAL":r==="CURRENCY_PREFIXED_DECIMAL"?"DECIMAL_WITH_CURRENCY_PREFIX":r==="CURRENCY_PREFIXED_INTEGER"?"INTEGER_WITH_CURRENCY_PREFIX":r==="SIGNED_DECIMAL"||r==="UNSIGNED_DECIMAL"?"DECIMAL":r==="UNSIGNED_INTEGER"||r==="SIGNED_INTEGER"?"INTEGER":r==="DATETIME"?"DATETIME":r==="DATE"?"DATE":r==="NULL"?"NULL":r==="StringIdentifier"||r==="Identifier"?"STRING":cy.includes(r)?"BOOLEAN":fy.includes(r)?"DATE_LITERAL":py.includes(r)?"DATE_N_LITERAL":"STRING",$_parseSelect(r,n){let{isSubquery:i}=n||{isSubquery:!1},o={};if(r.selectClause&&(o.fields=this.visit(r.selectClause)),r.fromClause)if(Fs(o,i)){let{sObject:a,alias:s,sObjectPrefix:l}=this.visit(r.fromClause);o.relationshipName=a,s&&(o.sObjectAlias=s),l&&(o.sObjectPrefix=l)}else{let{sObject:a,alias:s}=this.visit(r.fromClause);o.sObject=a,s&&(o.sObjectAlias=s)}return Array.isArray(o.fields)&&o.sObjectAlias&&o.fields.forEach(a=>{a.relationships&&a.relationships[0]===o.sObjectAlias&&(a.relationships=a.relationships.slice(1),a.objectPrefix=o.sObjectAlias),a.relationships&&a.relationships.length===0&&(delete a.relationships,a.type="Field")}),o={...o,...this.visit(r.clauseStatements)},o}};this.validateVisitor()}selectStatement(r,n){return this.helpers.$_parseSelect.bind(this)(r,n)}selectStatementPartial(r,n){return this.helpers.$_parseSelect.bind(this)(r,n)}clauseStatements(r){let n={};return r.usingScopeClause&&!r.usingScopeClause[0].recoveredNode&&(n.usingScope=this.visit(r.usingScopeClause)),r.whereClause&&!r.whereClause[0].recoveredNode&&(n.where=this.visit(r.whereClause)),r.withClause&&r.withClause.filter(i=>!i.recoveredNode).forEach(i=>{let{withSecurityEnforced:o,withAccessLevel:a,withDataCategory:s}=this.visit(i);o&&(n.withSecurityEnforced=o),a&&(n.withAccessLevel=a),s&&(n.withDataCategory=s)}),r.groupByClause&&!r.groupByClause[0].recoveredNode&&(n.groupBy=this.visit(r.groupByClause)),r.havingClause&&!r.havingClause[0].recoveredNode&&(n.having=this.visit(r.havingClause)),r.orderByClause&&!r.orderByClause[0].recoveredNode&&(n.orderBy=this.visit(r.orderByClause)),r.limitClause&&!r.limitClause[0].recoveredNode&&(n.limit=Number(this.visit(r.limitClause))),r.offsetClause&&!r.offsetClause[0].recoveredNode&&(n.offset=Number(this.visit(r.offsetClause))),r.forViewOrReference&&!r.forViewOrReference[0].recoveredNode&&(n.for=this.visit(r.forViewOrReference)),r.updateTrackingViewstat&&!r.updateTrackingViewstat[0].recoveredNode&&(n.update=this.visit(r.updateTrackingViewstat)),n}selectClause(r){return r.field?r.field.map(n=>{if(Qt(n)){let i=n.image,o;if(!i.includes("."))o={type:"Field",field:i};else{let a=i.split(".");o={type:"FieldRelationship",field:a[a.length-1],relationships:a.slice(0,a.length-1),rawValue:i}}return o}else return this.visit(n)}):[]}selectClauseFunctionIdentifier(r){let n={...this.visit(r.fn)};return r.alias&&(n.alias=r.alias[0].image),n}selectClauseSubqueryIdentifier(r){return{type:"FieldSubquery",subquery:this.visit(r.selectStatement,{isSubquery:!0})}}selectClauseTypeOf(r){let n=r.selectClauseTypeOfThen.map(i=>this.visit(i));return r.selectClauseTypeOfElse&&n.push(this.visit(r.selectClauseTypeOfElse)),{type:"FieldTypeof",field:r.typeOfField[0].image,conditions:n}}selectClauseIdentifier(r){let n=r.field[0],i=r.alias?r.alias[0].image:void 0,o=n.image,a;if(!o.includes("."))a={type:"Field",field:o};else{let s=o.split(".");a={type:"FieldRelationship",field:s[s.length-1],relationships:s.slice(0,s.length-1),rawValue:o}}return i&&(a.alias=i),a}selectClauseTypeOfThen(r){return{type:"WHEN",objectType:r.typeOfField[0].image,fieldList:r.field.map(n=>n.image)}}selectClauseTypeOfElse(r){return{type:"ELSE",fieldList:r.field.map(n=>n.image)}}fromClause(r){let n=r.Identifier[0].image,i;if(n.includes(".")){let o=n.split(".");i={sObjectPrefix:o.slice(0,o.length-1),sObject:o[o.length-1]}}else i={sObject:n};return r.alias&&r.alias[0]&&(i.alias=r.alias[0].image),i}usingScopeClause(r){return r.UsingScopeEnumeration[0].image}whereClauseSubqueryIdentifier(r){return this.visit(r.selectStatement,{isSubquery:!1})}whereClause(r){return r.conditionExpression.reduce((i,o)=>{let a;i.expressionTree?(a=this.visit(o,{prevExpression:i.prevExpression}),i.prevExpression.right=a):(a=this.visit(o),i.expressionTree=a);let s=a.right,l=a.right;for(;fo(l);)s=l,l=l.right;return i.prevExpression=l||a,i},{prevExpression:void 0,expressionTree:void 0}).expressionTree}conditionExpression(r,n){n=n||{},n.prevExpression&&r.logicalOperator&&(n.prevExpression.operator=r.logicalOperator[0].tokenType.name);let i={},o=i;if(Array.isArray(r.expressionNegation))if(r.expressionNegation.length===1)i=this.visit(r.expressionNegation),o=i.right;else{i=this.visit(r.expressionNegation[0]);let a=i;r.expressionNegation.slice(1).forEach(s=>{a.right=this.visit(s),o=a.right.right})}return o.left=this.visit(r.expression),i}withClause(r){return r.withSecurityEnforced?{withSecurityEnforced:!0}:r.withAccessLevel?{withAccessLevel:r.withAccessLevel[0].image}:{withDataCategory:{conditions:this.visit(r.withDataCategory)}}}withDataCategory(r){return r.withDataCategoryArr.map(n=>this.visit(n))}withDataCategoryArr(r){return{groupName:r.dataCategoryGroupName[0].image,selector:r.filteringSelector[0].image,parameters:r.dataCategoryName.map(n=>n.image)}}groupByClause(r){return r.groupBy.map(n=>Qt(n)?{field:n.image}:{fn:this.visit(n,{includeType:!1})})}havingClause(r){return r.conditionExpression.reduce((i,o)=>(i.expressionTree?(i.prevExpression.right=this.visit(o,{prevExpression:i.prevExpression}),i.prevExpression=i.prevExpression.right):(i.expressionTree=this.visit(o),i.prevExpression=i.expressionTree),i),{prevExpression:void 0,expressionTree:void 0}).expressionTree}orderByClause(r){return r.orderByExpressionOrFn.map(n=>this.visit(n))}orderByExpression(r){let n={field:r.Identifier[0].image};return r.order&&r.order[0]&&(n.order=r.order[0].tokenType.name),r.nulls&&r.nulls[0]&&(n.nulls=r.nulls[0].tokenType.name),n}orderByGroupingFunctionExpression(r){let n={fn:this.helpers.$_getFieldFunction(r,!1,!1)};return r.order&&r.order[0]&&(n.order=r.order[0].tokenType.name),r.nulls&&r.nulls[0]&&(n.nulls=r.nulls[0].tokenType.name),n}orderBySpecialFunctionExpression(r){let n={};return r.aggregateFunction?n.fn=this.visit(r.aggregateFunction,{includeType:!1}):r.dateFunction?n.fn=this.visit(r.dateFunction,{includeType:!1}):r.locationFunction&&(n.fn=this.visit(r.locationFunction,{includeType:!1})),r.order&&r.order[0]&&(n.order=r.order[0].tokenType.name),r.nulls&&r.nulls[0]&&(n.nulls=r.nulls[0].tokenType.name),n}limitClause(r){return r.value[0].image}offsetClause(r){return r.value[0].image}dateFunction(r,n={includeType:!0}){return this.helpers.$_getFieldFunction(r,!0,n.includeType)}aggregateFunction(r,n={includeType:!0}){return this.helpers.$_getFieldFunction(r,!0,n.includeType)}fieldsFunction(r,n={includeType:!0}){let i={};return n.includeType&&(i.type="FieldFunctionExpression"),i={...i,functionName:"FIELDS",parameters:[r.params[0].image]},i.rawValue=`FIELDS(${i.parameters[0]})`,i}otherFunction(r,n={includeType:!0}){return this.helpers.$_getFieldFunction(r,!1,n.includeType)}cubeFunction(r){return this.helpers.$_getFieldFunction(r,!1,!1)}rollupFunction(r){return this.helpers.$_getFieldFunction(r,!1,!1)}locationFunction(r,n={includeType:!0}){let i={};return n.includeType&&(i.type="FieldFunctionExpression"),i={...i,functionName:"DISTANCE",parameters:[r.location1[0].image,Qt(r.location2)?r.location2[0].image:this.visit(r.location2,n),r.unit[0].image]},n.includeType&&(i.isAggregateFn=!0),i.rawValue=`DISTANCE(${i.parameters[0]}, ${Pe(i.parameters[1])?i.parameters[1]:i.parameters[1].rawValue}, ${i.parameters[2]})`,i}geolocationFunction(r,n={includeType:!0}){let i={};return n.includeType&&(i.type="FieldFunctionExpression"),i={...i,functionName:"GEOLOCATION",parameters:[r.latitude[0].image,r.longitude[0].image],rawValue:`GEOLOCATION(${r.latitude[0].image}, ${r.longitude[0].image})`},i}functionExpression(r,n={includeType:!0}){return r.params?r.params.map(i=>i.image?i.image:this.visit(i,n)):[]}expression(r){let{value:n,literalType:i,dateLiteralVariable:o,operator:a}=this.visit(r.operator,{returnLiteralType:!0}),s={};return Qt(r.lhs)?s.field=r.lhs[0].image:s.fn=this.visit(r.lhs,{includeType:!1}),s.operator=a,s.literalType=i,i==="SUBQUERY"?s.valueQuery=n:s.value=n,o&&(s.dateLiteralVariable=o),r.L_PAREN&&(s.openParen=r.L_PAREN.length),r.R_PAREN&&(s.closeParen=r.R_PAREN.length),s}expressionPartWithNegation(r){return{left:r.L_PAREN?{openParen:r.L_PAREN.length}:null,operator:"NOT",right:{left:{}}}}expressionWithRelationalOperator(r){return r.relationalOperator?{operator:this.visit(r.relationalOperator),...this.visit(r.rhs,{returnLiteralType:!0})}:{operator:this.visit(r.setOperator),...this.visit(r.rhs,{returnLiteralType:!0})}}expressionWithSetOperator(r){return r.relationalOperator?{operator:this.visit(r.relationalOperator),...this.visit(r.rhs,{returnLiteralType:!0})}:{operator:this.visit(r.setOperator),...this.visit(r.rhs,{returnLiteralType:!0})}}atomicExpression(r,n){n=n||{};let i,o,a;if(r.apexBindVariableExpression)i=this.visit(r.apexBindVariableExpression),o="APEX_BIND_VARIABLE";else if(r.NumberIdentifier)i=r.NumberIdentifier[0].image,o=this.helpers.$_getLiteralTypeFromTokenType(r.NumberIdentifier[0].tokenType.name);else if(r.UnsignedInteger)i=r.UnsignedInteger[0].image,o="INTEGER";else if(r.SignedInteger)i=r.SignedInteger[0].image,o="INTEGER";else if(r.RealNumber)i=r.RealNumber[0].image,o="DECIMAL";else if(r.DateIdentifier)i=r.DateIdentifier[0].image,o=this.helpers.$_getLiteralTypeFromTokenType(r.DateIdentifier[0].tokenType.name);else if(r.CurrencyPrefixedInteger)i=r.CurrencyPrefixedInteger[0].image,o="INTEGER_WITH_CURRENCY_PREFIX";else if(r.CurrencyPrefixedDecimal)i=r.CurrencyPrefixedDecimal[0].image,o="DECIMAL_WITH_CURRENCY_PREFIX";else if(r.DateTime)i=r.DateTime[0].image,o="DATETIME";else if(r.date)i=r.DateToken[0].image,o="DATE";else if(r.NULL)i="NULL",o="NULL";else if(r.StringIdentifier)i=r.StringIdentifier[0].image,o="STRING";else if(r.Identifier)i=r.Identifier[0].image,o="STRING";else if(r.booleanValue)i=this.visit(r.booleanValue),o="BOOLEAN";else if(r.DateLiteral)i=r.DateLiteral[0].image,o="DATE_LITERAL";else if(r.dateNLiteral){let s=this.visit(r.dateNLiteral);i=s.value,a=s.variable,o="DATE_N_LITERAL"}else if(r.arrayExpression){let s=this.visit(r.arrayExpression);i=s.map(p=>p.value);let l=s.map(p=>p.variable||null),c=l.some(p=>p!==null);new Set(s.map(p=>p.type)).size===1?o=this.helpers.$_getLiteralTypeFromTokenType(s[0].type):o=s.map(p=>this.helpers.$_getLiteralTypeFromTokenType(p.type)),c&&(a=l),o=o||"STRING"}else r.whereClauseSubqueryIdentifier&&(i=this.visit(r.whereClauseSubqueryIdentifier),o="SUBQUERY");return n.returnLiteralType?{value:i,literalType:o,dateLiteralVariable:a}:i}apexBindVariableExpression(r){return r.apex.map(n=>this.visit(n)).join(".")}apexBindVariableIdentifier(r){let n=r.Identifier[0].image;return r.apexBindVariableFunctionArrayAccessor&&(n+=this.visit(r.apexBindVariableFunctionArrayAccessor[0])),n}apexBindVariableNewInstantiation(r){let n=`new ${r.function[0].image}`;return r.apexBindVariableGeneric&&(n+=this.visit(r.apexBindVariableGeneric[0])),n+=this.visit(r.apexBindVariableFunctionParams[0]),r.apexBindVariableFunctionArrayAccessor&&(n+=this.visit(r.apexBindVariableFunctionArrayAccessor[0])),n}apexBindVariableFunctionCall(r){let n=`${r.function[0].image}${this.visit(r.apexBindVariableFunctionParams[0])}`;return r.apexBindVariableFunctionArrayAccessor&&(n+=this.visit(r.apexBindVariableFunctionArrayAccessor[0])),n}apexBindVariableGeneric(r){return`<${r.parameter.map(n=>n.image).join(", ")}>`}apexBindVariableFunctionParams(r){return`(${(Array.isArray(r.parameter)?r.parameter:[]).map(i=>i.image).join(", ")})`}apexBindVariableFunctionArrayAccessor(r){return`[${r.value[0].image}]`}arrayExpression(r){return r.value.map(n=>Qt(n)?{type:n.tokenType.name,value:n.image}:this.visit(n,{includeType:!0}))}relationalOperator(r){return r.operator[0].image}setOperator(r){if(Array.isArray(r.operator))return r.operator[0].tokenType.name.replace("_"," ");if(Array.isArray(r.notIn))return this.visit(r.notIn)}notInOperator(r){return"NOT IN"}booleanValue(r){return r.boolean[0].tokenType.name}dateNLiteral(r,n){let i={value:`${r.dateNLiteral[0].image}:${r.variable[0].image}`,variable:Number(r.variable[0].image)};return n&&n.includeType&&(i.type=r.dateNLiteral[0].tokenType.name),i}forViewOrReference(r){return r.value[0].tokenType.name}updateTrackingViewstat(r){return r.value[0].tokenType.name}},hy=new Ts;function An(t,e){let{cst:r}=As(t,e);return hy.visit(r)}function Ss(t,e){try{let{parseErrors:r}=As(t,e);return r.length===0}catch{return!1}}var ro=class{constructor(e,r){this.currIndent=1;this.enabled=e,this.options={numIndent:r.numIndent??1,fieldMaxLineLength:r.fieldMaxLineLength??60,fieldSubqueryParensOnOwnLine:r.fieldSubqueryParensOnOwnLine??!0,whereClauseOperatorsIndented:!0,newLineAfterKeywords:r.newLineAfterKeywords??!1,logging:r.logging??!1},this.options.newLineAfterKeywords&&(this.options.fieldSubqueryParensOnOwnLine=!0)}log(e){this.options.logging&&console.log(e)}getIndent(e=0){return this.repeatChar((this.currIndent+e)*(this.options.numIndent||1)," ")}repeatChar(e,r){return new Array(e).fill(r).join("")}setSubquery(e){this.currIndent=e?this.currIndent+=1:this.currIndent-=1}stepCurrIndex(e){this.currIndent+=e}formatFields(e){function r(n){e.fields[n-1]&&(e.fields[n-1].suffix=e.fields[n-1].suffix.trim())}if(e.fields.forEach((n,i)=>{n.suffix=e.fields.length-1===i?"":", "}),this.enabled){let n=0,i=!1;e.fields.forEach((o,a)=>{o.isSubquery?(r(a),o.prefix=`
|
|
113
|
+
For further details.`);this.skipValidations=T(r,"skipValidations")?r.skipValidations:Ce.skipValidations}};pn.DEFER_DEFINITION_ERRORS_HANDLING=!1;Bf(pn,[Ei,Ti,Li,Oi,Ri,Ni,_i,Ii,bi,Fi]);var hn=class extends pn{constructor(e,r=Ce){let n=D(r);n.outputCst=!0,super(e,n)}};var k=f({name:"KeywordReserved",pattern:b.NA}),R=f({name:"Keyword",pattern:b.NA}),Me=f({name:"DateFunction",pattern:b.NA}),vr=f({name:"AggregateFunction",pattern:b.NA}),Gf=f({name:"LocationFunction",pattern:b.NA}),KT=f({name:"FieldsFunction",pattern:b.NA}),dn=f({name:"FieldsFunctionParamIdentifier",pattern:b.NA}),mn=f({name:"OtherFunction",pattern:b.NA}),$=f({name:"DateLiteral",pattern:b.NA}),Q=f({name:"DateLiteralNotIdentifier",pattern:b.NA}),z=f({name:"DateNLiteral",pattern:b.NA}),Pr=f({name:"RelationalOperator",pattern:b.NA}),He=f({name:"SymbolIdentifier",pattern:b.NA}),gn=f({name:"DateIdentifier",pattern:b.NA}),ot=f({name:"NumberIdentifier",pattern:b.NA}),Mi=f({name:"DecimalNumberIdentifier",pattern:b.NA}),Wf=f({name:"IntegerNumberIdentifier",pattern:b.NA}),YT=f({name:"IdentifierNotKeyword",pattern:b.NA}),Ke=f({name:"UsingScopeEnumeration",pattern:b.NA}),$f=f({name:"RParenMismatch",pattern:b.NA}),Df=/[a-zA-Z][a-zA-Z0-9_.]*/y;function qT(t,e){Df.lastIndex=e;let r=Df.exec(t);return r&&r[0].includes("..")?null:r}var u=f({name:"Identifier",pattern:qT,line_breaks:!1,categories:[YT],start_chars_hint:["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]}),En=f({name:"StringIdentifier",line_breaks:!0,pattern:/(')(?:(?=(\\?))\2.)*?\1/}),XT=f({name:"WhiteSpace",pattern:/\s+/,group:b.SKIPPED}),Ui=f({name:"AND",pattern:/AND/i,longer_alt:u,categories:[R,k]}),QT=f({name:"AS",pattern:/AS/i,longer_alt:u,categories:[R,k]}),ki=f({name:"DESC",pattern:/DESC/i,longer_alt:u,categories:[R,k]}),wi=f({name:"ASC",pattern:/ASC/i,longer_alt:u,categories:[R,k]}),na=f({name:"ORDER_BY",pattern:/ORDER BY/i,longer_alt:u}),ia=f({name:"CUBE",pattern:/CUBE/i,longer_alt:u,categories:[R,k]}),oa=f({name:"ELSE",pattern:/ELSE/i,longer_alt:u,categories:[R,k]}),aa=f({name:"EXCLUDES",pattern:/EXCLUDES/i,longer_alt:u,categories:[R,k]}),Bi=f({name:"FALSE",pattern:/FALSE/i,longer_alt:u,categories:[R,k]}),Di=f({name:"FIRST",pattern:/FIRST/i,longer_alt:u,categories:[R,k]}),sa=f({name:"FROM",pattern:/FROM/i,longer_alt:u,categories:[R,k]}),la=f({name:"GROUP_BY",pattern:/GROUP BY/i,longer_alt:u}),ua=f({name:"HAVING",pattern:/HAVING/i,longer_alt:u,categories:[R,k]}),Gi=f({name:"IN",pattern:/IN/i,longer_alt:u,categories:[R,k]}),ca=f({name:"INCLUDES",pattern:/INCLUDES/i,longer_alt:u,categories:[R,k]}),Wi=f({name:"LAST",pattern:/LAST/i,longer_alt:u,categories:[R,k]}),fa=f({name:"LIKE",pattern:/LIKE/i,longer_alt:u,categories:[R,k]}),pa=f({name:"LIMIT",pattern:/LIMIT/i,longer_alt:u,categories:[R,k]}),$i=f({name:"NOT",pattern:/NOT/i,longer_alt:u,categories:[R,k]}),Vi=f({name:"NULL",pattern:/NULL/i,longer_alt:u,categories:[R,k]}),ji=f({name:"NULLS",pattern:/NULLS/i,longer_alt:u,categories:[R,k]}),ha=f({name:"OR",pattern:/OR/i,longer_alt:u,categories:[R,k]}),da=f({name:"ROLLUP",pattern:/ROLLUP/i,longer_alt:u,categories:[R,k]}),ma=f({name:"SELECT",pattern:/SELECT/i,longer_alt:u,categories:[R,k]}),Hi=f({name:"TRUE",pattern:/TRUE/i,longer_alt:u,categories:[R,k]}),ga=f({name:"USING",pattern:/USING/i,longer_alt:u,categories:[R,k]}),Ea=f({name:"WHERE",pattern:/WHERE/i,longer_alt:u,categories:[R,k]}),xa=f({name:"WITH",pattern:/WITH/i,longer_alt:u,categories:[R,k]}),Aa=f({name:"FOR",pattern:/FOR/i,longer_alt:u,categories:[R,k]}),Ki=f({name:"UPDATE",pattern:/UPDATE/i,longer_alt:u,categories:[R,k]}),Ta=f({name:"ABOVE",pattern:/ABOVE/i,longer_alt:u,categories:[R,u]}),Sa=f({name:"ABOVE_OR_BELOW",pattern:/ABOVE_OR_BELOW/i,longer_alt:u,categories:[R,u]}),ya=f({name:"new",pattern:/new/i,longer_alt:u,categories:[R,u]}),Ca=f({name:"AT",pattern:/AT/i,longer_alt:u,categories:[R,u]}),La=f({name:"BELOW",pattern:/BELOW/i,longer_alt:u,categories:[R,u]}),Oa=f({name:"DATA_CATEGORY",pattern:/DATA CATEGORY/i,longer_alt:u,categories:[R]}),Na=f({name:"END",pattern:/END/i,longer_alt:u,categories:[R,u]}),Yi=f({name:"OFFSET",pattern:/OFFSET/i,longer_alt:u,categories:[R,u]}),Ra=f({name:"REFERENCE",pattern:/REFERENCE/i,longer_alt:u,categories:[R,u]}),_a=f({name:"SCOPE",pattern:/SCOPE/i,longer_alt:u,categories:[R,u]}),Ia=f({name:"TRACKING",pattern:/TRACKING/i,longer_alt:u,categories:[R,u]}),ba=f({name:"THEN",pattern:/THEN/i,longer_alt:u,categories:[R,u]}),va=f({name:"TYPEOF",pattern:/TYPEOF/i,longer_alt:u,categories:[R,u]}),Pa=f({name:"VIEW",pattern:/VIEW/i,longer_alt:u,categories:[R,u]}),Fa=f({name:"VIEWSTAT",pattern:/VIEWSTAT/i,longer_alt:u,categories:[R,u]}),Ma=f({name:"WHEN",pattern:/WHEN/i,longer_alt:u,categories:[R,u]}),Ua=f({name:"SECURITY_ENFORCED",pattern:/SECURITY_ENFORCED/i,longer_alt:u,categories:[R,u]}),ka=f({name:"SYSTEM_MODE",pattern:/SYSTEM_MODE/i,longer_alt:u,categories:[R,u]}),wa=f({name:"USER_MODE",pattern:/USER_MODE/i,longer_alt:u,categories:[R,u]}),Ba=f({name:"CALENDAR_MONTH",pattern:/CALENDAR_MONTH/i,longer_alt:u,categories:[Me,u]}),Da=f({name:"CALENDAR_QUARTER",pattern:/CALENDAR_QUARTER/i,longer_alt:u,categories:[Me,u]}),Ga=f({name:"CALENDAR_YEAR",pattern:/CALENDAR_YEAR/i,longer_alt:u,categories:[Me,u]}),Wa=f({name:"DAY_IN_MONTH",pattern:/DAY_IN_MONTH/i,longer_alt:u,categories:[Me,u]}),$a=f({name:"DAY_IN_WEEK",pattern:/DAY_IN_WEEK/i,longer_alt:u,categories:[Me,u]}),Va=f({name:"DAY_IN_YEAR",pattern:/DAY_IN_YEAR/i,longer_alt:u,categories:[Me,u]}),ja=f({name:"DAY_ONLY",pattern:/DAY_ONLY/i,longer_alt:u,categories:[Me,u]}),Ha=f({name:"FISCAL_MONTH",pattern:/FISCAL_MONTH/i,longer_alt:u,categories:[Me,u]}),Ka=f({name:"FISCAL_QUARTER",pattern:/FISCAL_QUARTER/i,longer_alt:u,categories:[Me,u]}),Ya=f({name:"FISCAL_YEAR",pattern:/FISCAL_YEAR/i,longer_alt:u,categories:[Me,u]}),qa=f({name:"HOUR_IN_DAY",pattern:/HOUR_IN_DAY/i,longer_alt:u,categories:[Me,u]}),Xa=f({name:"WEEK_IN_MONTH",pattern:/WEEK_IN_MONTH/i,longer_alt:u,categories:[Me,u]}),Qa=f({name:"WEEK_IN_YEAR",pattern:/WEEK_IN_YEAR/i,longer_alt:u,categories:[Me,u]}),za=f({name:"AVG",pattern:/AVG/i,longer_alt:u,categories:[vr,u]}),Za=f({name:"COUNT",pattern:/COUNT/i,longer_alt:u,categories:[vr,u]}),Ja=f({name:"COUNT_DISTINCT",pattern:/COUNT_DISTINCT/i,longer_alt:u,categories:[vr,u]}),es=f({name:"MIN",pattern:/MIN/i,longer_alt:u,categories:[vr,u]}),ts=f({name:"MAX",pattern:/MAX/i,longer_alt:u,categories:[vr,u]}),rs=f({name:"SUM",pattern:/SUM/i,longer_alt:u,categories:[vr,u]}),ns=f({name:"DISTANCE",pattern:/DISTANCE/i,longer_alt:u,categories:[Gf,u]}),is=f({name:"GEOLOCATION",pattern:/GEOLOCATION/i,longer_alt:u,categories:[Gf,u]}),os=f({name:"FIELDS",pattern:/FIELDS/i,longer_alt:u,categories:[KT,u]}),as=f({name:"FORMAT",pattern:/FORMAT/i,longer_alt:u,categories:[mn,u]}),ss=f({name:"toLabel",pattern:/TOLABEL/i,longer_alt:u,categories:[mn,u]}),ls=f({name:"convertTimezone",pattern:/CONVERTTIMEZONE/i,longer_alt:u,categories:[mn,u]}),us=f({name:"convertCurrency",pattern:/CONVERTCURRENCY/i,longer_alt:u,categories:[mn,u]}),qi=f({name:"GROUPING",pattern:/GROUPING/i,longer_alt:u,categories:[mn,u]}),zT=f({name:"ALL",pattern:/ALL/i,longer_alt:u,categories:[dn,u]}),ZT=f({name:"CUSTOM",pattern:/CUSTOM/i,longer_alt:u,categories:[dn,u]}),JT=f({name:"STANDARD",pattern:/STANDARD/i,longer_alt:u,categories:[dn,u]}),eS=f({name:"YESTERDAY",pattern:/YESTERDAY/i,longer_alt:u,categories:[$,u,Q]}),tS=f({name:"TODAY",pattern:/TODAY/i,longer_alt:u,categories:[$,u,Q]}),rS=f({name:"TOMORROW",pattern:/TOMORROW/i,longer_alt:u,categories:[$,u,Q]}),nS=f({name:"LAST_WEEK",pattern:/LAST_WEEK/i,longer_alt:u,categories:[$,u,Q]}),iS=f({name:"THIS_WEEK",pattern:/THIS_WEEK/i,longer_alt:u,categories:[$,u,Q]}),oS=f({name:"NEXT_WEEK",pattern:/NEXT_WEEK/i,longer_alt:u,categories:[$,u,Q]}),aS=f({name:"LAST_MONTH",pattern:/LAST_MONTH/i,longer_alt:u,categories:[$,u,Q]}),sS=f({name:"THIS_MONTH",pattern:/THIS_MONTH/i,longer_alt:u,categories:[$,u,Q]}),lS=f({name:"NEXT_MONTH",pattern:/NEXT_MONTH/i,longer_alt:u,categories:[$,u,Q]}),uS=f({name:"LAST_90_DAYS",pattern:/LAST_90_DAYS/i,longer_alt:u,categories:[$,u,Q]}),cS=f({name:"NEXT_90_DAYS",pattern:/NEXT_90_DAYS/i,longer_alt:u,categories:[$,u,Q]}),fS=f({name:"THIS_QUARTER",pattern:/THIS_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),pS=f({name:"LAST_QUARTER",pattern:/LAST_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),hS=f({name:"NEXT_QUARTER",pattern:/NEXT_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),dS=f({name:"THIS_YEAR",pattern:/THIS_YEAR/i,longer_alt:u,categories:[$,u,Q]}),mS=f({name:"LAST_YEAR",pattern:/LAST_YEAR/i,longer_alt:u,categories:[$,u,Q]}),gS=f({name:"NEXT_YEAR",pattern:/NEXT_YEAR/i,longer_alt:u,categories:[$,u,Q]}),ES=f({name:"THIS_FISCAL_QUARTER",pattern:/THIS_FISCAL_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),xS=f({name:"LAST_FISCAL_QUARTER",pattern:/LAST_FISCAL_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),AS=f({name:"NEXT_FISCAL_QUARTER",pattern:/NEXT_FISCAL_QUARTER/i,longer_alt:u,categories:[$,u,Q]}),TS=f({name:"THIS_FISCAL_YEAR",pattern:/THIS_FISCAL_YEAR/i,longer_alt:u,categories:[$,u,Q]}),SS=f({name:"LAST_FISCAL_YEAR",pattern:/LAST_FISCAL_YEAR/i,longer_alt:u,categories:[$,u,Q]}),yS=f({name:"NEXT_FISCAL_YEAR",pattern:/NEXT_FISCAL_YEAR/i,longer_alt:u,categories:[$,u,Q]}),CS=f({name:"NEXT_N_DAYS",pattern:/NEXT_N_DAYS/i,longer_alt:u,categories:[z,u]}),LS=f({name:"LAST_N_DAYS",pattern:/LAST_N_DAYS/i,longer_alt:u,categories:[z,u]}),OS=f({name:"N_DAYS_AGO",pattern:/N_DAYS_AGO/i,longer_alt:u,categories:[z,u]}),NS=f({name:"NEXT_N_WEEKS",pattern:/NEXT_N_WEEKS/i,longer_alt:u,categories:[z,u]}),RS=f({name:"LAST_N_WEEKS",pattern:/LAST_N_WEEKS/i,longer_alt:u,categories:[z,u]}),_S=f({name:"N_WEEKS_AGO",pattern:/N_WEEKS_AGO/i,longer_alt:u,categories:[z,u]}),IS=f({name:"NEXT_N_MONTHS",pattern:/NEXT_N_MONTHS/i,longer_alt:u,categories:[z,u]}),bS=f({name:"LAST_N_MONTHS",pattern:/LAST_N_MONTHS/i,longer_alt:u,categories:[z,u]}),vS=f({name:"N_MONTHS_AGO",pattern:/N_MONTHS_AGO/i,longer_alt:u,categories:[z,u]}),PS=f({name:"NEXT_N_QUARTERS",pattern:/NEXT_N_QUARTERS/i,longer_alt:u,categories:[z,u]}),FS=f({name:"LAST_N_QUARTERS",pattern:/LAST_N_QUARTERS/i,longer_alt:u,categories:[z,u]}),MS=f({name:"N_QUARTERS_AGO",pattern:/N_QUARTERS_AGO/i,longer_alt:u,categories:[z,u]}),US=f({name:"NEXT_N_YEARS",pattern:/NEXT_N_YEARS/i,longer_alt:u,categories:[z,u]}),kS=f({name:"LAST_N_YEARS",pattern:/LAST_N_YEARS/i,longer_alt:u,categories:[z,u]}),wS=f({name:"N_YEARS_AGO",pattern:/N_YEARS_AGO/i,longer_alt:u,categories:[z,u]}),BS=f({name:"NEXT_N_FISCAL_QUARTERS",pattern:/NEXT_N_FISCAL_QUARTERS/i,longer_alt:u,categories:[z,u]}),DS=f({name:"LAST_N_FISCAL_QUARTERS",pattern:/LAST_N_FISCAL_QUARTERS/i,longer_alt:u,categories:[z,u]}),GS=f({name:"N_FISCAL_QUARTERS_AGO",pattern:/N_FISCAL_QUARTERS_AGO/i,longer_alt:u,categories:[z,u]}),WS=f({name:"NEXT_N_FISCAL_YEARS",pattern:/NEXT_N_FISCAL_YEARS/i,longer_alt:u,categories:[z,u]}),$S=f({name:"LAST_N_FISCAL_YEARS",pattern:/LAST_N_FISCAL_YEARS/i,longer_alt:u,categories:[z,u]}),VS=f({name:"N_FISCAL_YEARS_AGO",pattern:/N_FISCAL_YEARS_AGO/i,longer_alt:u,categories:[z,u]}),cs=f({name:"EQUAL",pattern:"=",categories:[Pr]}),fs=f({name:"NOT_EQUAL",pattern:/!=|<>/,categories:[Pr]}),Xi=f({name:"LESS_THAN",pattern:"<",categories:[Pr]}),ps=f({name:"LESS_THAN_OR_EQUAL",pattern:"<=",categories:[Pr]}),Qi=f({name:"GREATER_THAN",pattern:">",categories:[Pr]}),hs=f({name:"GREATER_THAN_OR_EQUAL",pattern:">=",categories:[Pr]}),zi=f({name:"DECIMAL",pattern:".",categories:[He]}),Zi=f({name:"COLON",pattern:":",categories:[He]}),jS=f({name:"SEMICOLON",pattern:";",categories:[He]}),Le=f({name:"COMMA",pattern:",",categories:[He]}),HS=f({name:"ASTERISK",pattern:"*",categories:[He]}),Ue=f({name:"L_PAREN",pattern:"(",categories:[He]}),Ge=f({name:"R_PAREN",pattern:")",categories:[He]}),ds=f({name:"L_SQUARE_BRACKET",pattern:"[",categories:[He]}),ms=f({name:"R_SQUARE_BRACKET",pattern:"]",categories:[He]}),KS=f({name:"PLUS",pattern:"+",categories:[He]}),YS=f({name:"MINUS",pattern:"-",categories:[He]}),qS=f({name:"DATETIME",pattern:/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(\Z|\.[0-9]+Z|\+[0-9]{2}:[0-9]{2}|\-[0-9]{2}:[0-9]{2}|\+[0-9]{4}|\-[0-9]{4})/i,categories:[gn]}),XS=f({name:"DATE",pattern:/[0-9]{4}-[0-9]{2}-[0-9]{2}/,categories:[gn]}),Ji=f({name:"CURRENCY_PREFIXED_DECIMAL",pattern:/[a-zA-Z]{3}[0-9]+\.\d+/,longer_alt:u,categories:[Mi]}),QS=f({name:"SIGNED_DECIMAL",pattern:/(\-|\+)[0-9]*\.\d+/,categories:[ot,Mi]}),zS=f({name:"UNSIGNED_DECIMAL",pattern:/[0-9]*\.\d+/,categories:[ot,Mi]}),eo=f({name:"CURRENCY_PREFIXED_INTEGER",pattern:/[a-zA-Z]{3}-?[0-9]+/,longer_alt:u,categories:[Mi,u]}),gs=f({name:"SIGNED_INTEGER",pattern:/(\-|\+)[0-9]+/,categories:[ot,Wf]}),xn=f({name:"GEOLOCATION_UNIT",pattern:/'(mi|km)'/i,longer_alt:u,categories:[u]}),qt=f({name:"UNSIGNED_INTEGER",pattern:/0|[1-9]\d*/,categories:[ot,Wf]}),ZS=f({name:"Delegated",pattern:/DELEGATED/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["D","d"]}),JS=f({name:"Everything",pattern:/EVERYTHING/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["E","e"]}),ey=f({name:"MineAndMyGroups",pattern:/MINEANDMYGROUPS/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["M","m"]}),ty=f({name:"Mine",pattern:/MINE/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["M","m"]}),ry=f({name:"MyTerritory",pattern:/MY_TERRITORY/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["M","m"]}),ny=f({name:"MyTeamTerritory",pattern:/MY_TEAM_TERRITORY/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["M","m"]}),iy=f({name:"Team",pattern:/TEAM/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["T","t"]}),oy=f({name:"AllPrivate",pattern:/ALLPRIVATE/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["A","a"]}),ay=f({name:"Mru",pattern:/MRU/i,longer_alt:u,categories:[Ke,u],start_chars_hint:["M","m"]}),Es=[XT,Ui,wi,QT,na,ia,ki,oa,aa,Bi,Di,sa,qi,la,ua,ca,fa,pa,ji,Vi,da,ma,Hi,ga,Ea,xa,Ki,ZS,JS,ey,ty,ay,ry,ny,iy,oy,Sa,Ta,ya,Ca,La,Oa,Na,Yi,Ra,_a,Ia,ba,va,Fa,Pa,Ma,Ua,ka,wa,Ba,Da,Ga,Wa,$a,Va,ja,Ha,Ka,Ya,qa,Xa,Qa,za,Ja,Za,es,ts,rs,ns,is,os,as,ss,ls,us,eS,tS,rS,nS,iS,oS,aS,sS,lS,uS,cS,fS,pS,hS,dS,mS,gS,ES,xS,AS,TS,SS,yS,CS,LS,OS,NS,RS,_S,IS,bS,vS,PS,FS,MS,US,kS,wS,BS,DS,GS,WS,$S,VS,xn,zT,ZT,JT,Gi,Aa,ha,Wi,$i,Ji,eo,En,u,qS,XS,QS,zS,qt,gs,cs,fs,ps,Xi,hs,Qi,zi,Zi,jS,Le,HS,Ue,Ge,ds,ms,KS,YS],sy=new b(Es,{ensureOptimizations:!0,skipValidations:!1});function Vf(t){return sy.tokenize(t)}var xs=class extends Error{constructor(e){super(`${e.message} (${e.line}:${e.column})`),this.name="LexingError"}},to=class extends Error{constructor(e){super(e.message),this.name=e.name}},Fr=class extends hn{constructor({ignoreParseErrors:r}={ignoreParseErrors:!1}){super(Es,{skipValidations:!1,recoveryEnabled:!!r});this.$_dateFunctionOr=void 0;this.$_aggregateFunction=void 0;this.$_otherFunction=void 0;this.$_atomicExpression=void 0;this.$_apexBindVariableExpression=void 0;this.$_arrayExpression=void 0;this.$_relationalOperator=void 0;this.$_selectClause=void 0;this.$_selectClauseFunctionIdentifier=void 0;this.$_withDataCategoryArr=void 0;this.allowApexBindVariables=!1;this.ignoreParseErrors=!1;this.selectStatement=this.RULE("selectStatement",()=>{this.SUBRULE(this.selectClause),this.SUBRULE(this.fromClause),this.SUBRULE(this.clauseStatements)});this.selectStatementPartial=this.RULE("selectStatementPartial",()=>{this.OPTION(()=>{this.SUBRULE(this.selectClause)}),this.OPTION1(()=>{this.SUBRULE(this.fromClause)}),this.SUBRULE(this.clauseStatements)});this.clauseStatements=this.RULE("clauseStatements",()=>{this.OPTION(()=>{this.SUBRULE(this.usingScopeClause)}),this.OPTION1(()=>{this.SUBRULE(this.whereClause)}),this.OPTION2(()=>{this.MANY({DEF:()=>{this.SUBRULE(this.withClause)}})}),this.OPTION3(()=>{this.SUBRULE(this.groupByClause),this.OPTION4(()=>{this.SUBRULE(this.havingClause)})}),this.OPTION5(()=>{this.SUBRULE(this.orderByClause)}),this.OPTION6(()=>{this.SUBRULE(this.limitClause)}),this.OPTION7(()=>{this.SUBRULE(this.offsetClause)}),this.OPTION8(()=>{this.SUBRULE(this.forViewOrReference)}),this.OPTION9(()=>{this.SUBRULE(this.updateTrackingViewstat)})});this.selectClause=this.RULE("selectClause",()=>{this.CONSUME(ma),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.OR(this.$_selectClause||(this.$_selectClause=[{ALT:()=>this.SUBRULE(this.selectClauseFunctionIdentifier,{LABEL:"field"})},{ALT:()=>this.SUBRULE(this.selectClauseSubqueryIdentifier,{LABEL:"field"})},{ALT:()=>this.SUBRULE(this.selectClauseTypeOf,{LABEL:"field"})},{ALT:()=>this.SUBRULE(this.selectClauseIdentifier,{LABEL:"field"})}]))}})},{resyncEnabled:!1});this.selectClauseFunctionIdentifier=this.RULE("selectClauseFunctionIdentifier",()=>{this.OR(this.$_selectClauseFunctionIdentifier||(this.$_selectClauseFunctionIdentifier=[{ALT:()=>this.SUBRULE(this.dateFunction,{LABEL:"fn"})},{ALT:()=>this.SUBRULE(this.aggregateFunction,{LABEL:"fn"})},{ALT:()=>this.SUBRULE(this.locationFunction,{LABEL:"fn"})},{ALT:()=>this.SUBRULE(this.fieldsFunction,{LABEL:"fn"})},{ALT:()=>this.SUBRULE(this.otherFunction,{LABEL:"fn"})}])),this.OPTION(()=>this.CONSUME(u,{LABEL:"alias"}))},{resyncEnabled:!1});this.selectClauseSubqueryIdentifier=this.RULE("selectClauseSubqueryIdentifier",()=>{this.CONSUME(Ue),this.SUBRULE(this.selectStatement),this.CONSUME(Ge)},{resyncEnabled:!1});this.selectClauseTypeOf=this.RULE("selectClauseTypeOf",()=>{this.CONSUME(va),this.CONSUME(u,{LABEL:"typeOfField"}),this.AT_LEAST_ONE({DEF:()=>{this.SUBRULE(this.selectClauseTypeOfThen)}}),this.OPTION(()=>{this.SUBRULE(this.selectClauseTypeOfElse)}),this.CONSUME(Na)},{resyncEnabled:!1});this.selectClauseIdentifier=this.RULE("selectClauseIdentifier",()=>{this.CONSUME(u,{LABEL:"field"}),this.OPTION(()=>this.CONSUME1(u,{LABEL:"alias"}))},{resyncEnabled:!1});this.selectClauseTypeOfThen=this.RULE("selectClauseTypeOfThen",()=>{this.CONSUME(Ma),this.CONSUME(u,{LABEL:"typeOfField"}),this.CONSUME(ba),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.CONSUME1(u,{LABEL:"field"})}})},{resyncEnabled:!1});this.selectClauseTypeOfElse=this.RULE("selectClauseTypeOfElse",()=>{this.CONSUME(oa),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.CONSUME(u,{LABEL:"field"})}})},{resyncEnabled:!1});this.fromClause=this.RULE("fromClause",()=>{this.CONSUME(sa),this.CONSUME(u),this.OPTION({GATE:()=>!(this.LA(1).tokenType===Yi&&this.LA(2).tokenType===qt),DEF:()=>this.CONSUME1(u,{LABEL:"alias"})})},{resyncEnabled:!1});this.usingScopeClause=this.RULE("usingScopeClause",()=>{this.CONSUME(ga),this.CONSUME(_a),this.CONSUME(Ke)});this.whereClause=this.RULE("whereClause",()=>{this.CONSUME(Ea);let r=this.getParenCount();this.AT_LEAST_ONE({DEF:()=>{this.SUBRULE(this.conditionExpression,{ARGS:[r,!0,!0]})}}),this.$_checkBalancedParens(r)});this.whereClauseSubqueryIdentifier=this.RULE("whereClauseSubqueryIdentifier",()=>{this.CONSUME(Ue),this.SUBRULE(this.selectStatement),this.CONSUME(Ge)});this.conditionExpression=this.RULE("conditionExpression",(r,n,i)=>{r=this.getParenCount(r),this.OPTION(()=>{this.OR([{ALT:()=>this.CONSUME(Ui,{LABEL:"logicalOperator"})},{ALT:()=>this.CONSUME(ha,{LABEL:"logicalOperator"})}])}),this.MANY({MAX_LOOKAHEAD:10,DEF:()=>this.SUBRULE(this.expressionPartWithNegation,{ARGS:[r],LABEL:"expressionNegation"})}),this.OR1({MAX_LOOKAHEAD:10,DEF:[{ALT:()=>this.SUBRULE(this.expression,{ARGS:[r,!1,n,i]})}]})});this.withClause=this.RULE("withClause",()=>{this.CONSUME(xa),this.OR([{ALT:()=>this.CONSUME(Ua,{LABEL:"withSecurityEnforced"})},{ALT:()=>this.CONSUME(wa,{LABEL:"withAccessLevel"})},{ALT:()=>this.CONSUME(ka,{LABEL:"withAccessLevel"})},{ALT:()=>this.SUBRULE(this.withDataCategory)}])});this.withDataCategory=this.RULE("withDataCategory",()=>{this.CONSUME(Oa),this.AT_LEAST_ONE_SEP({SEP:Ui,DEF:()=>{this.SUBRULE(this.withDataCategoryArr)}})});this.withDataCategoryArr=this.RULE("withDataCategoryArr",()=>{this.CONSUME(u,{LABEL:"dataCategoryGroupName"}),this.OR(this.$_withDataCategoryArr||(this.$_withDataCategoryArr=[{ALT:()=>this.CONSUME(Ca,{LABEL:"filteringSelector"})},{ALT:()=>this.CONSUME(Ta,{LABEL:"filteringSelector"})},{ALT:()=>this.CONSUME(La,{LABEL:"filteringSelector"})},{ALT:()=>this.CONSUME(Sa,{LABEL:"filteringSelector"})}])),this.OPTION(()=>{this.CONSUME1(Ue)}),this.AT_LEAST_ONE_SEP1({SEP:Le,DEF:()=>{this.CONSUME1(u,{LABEL:"dataCategoryName"})}}),this.OPTION1(()=>{this.CONSUME2(Ge)})});this.groupByClause=this.RULE("groupByClause",()=>{this.CONSUME(la),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.OR([{ALT:()=>this.SUBRULE(this.cubeFunction,{LABEL:"groupBy"})},{ALT:()=>this.SUBRULE(this.rollupFunction,{LABEL:"groupBy"})},{ALT:()=>this.SUBRULE(this.dateFunction,{LABEL:"groupBy"})},{ALT:()=>this.CONSUME(u,{LABEL:"groupBy"})}])}})});this.havingClause=this.RULE("havingClause",()=>{this.CONSUME(ua);let r=this.getParenCount();this.AT_LEAST_ONE({DEF:()=>{this.SUBRULE(this.conditionExpression,{ARGS:[r,!0,!1]})}}),this.$_checkBalancedParens(r)});this.orderByClause=this.RULE("orderByClause",()=>{this.CONSUME(na),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.OR([{ALT:()=>this.SUBRULE(this.orderByGroupingFunctionExpression,{LABEL:"orderByExpressionOrFn"})},{ALT:()=>this.SUBRULE(this.orderBySpecialFunctionExpression,{LABEL:"orderByExpressionOrFn"})},{ALT:()=>this.SUBRULE(this.orderByExpression,{LABEL:"orderByExpressionOrFn"})}])}})});this.orderByExpression=this.RULE("orderByExpression",()=>{this.CONSUME(u),this.OPTION(()=>{this.OR([{ALT:()=>this.CONSUME(wi,{LABEL:"order"})},{ALT:()=>this.CONSUME(ki,{LABEL:"order"})}])}),this.OPTION1(()=>{this.CONSUME(ji),this.OR1([{ALT:()=>this.CONSUME(Di,{LABEL:"nulls"})},{ALT:()=>this.CONSUME(Wi,{LABEL:"nulls"})}])})});this.orderByGroupingFunctionExpression=this.RULE("orderByGroupingFunctionExpression",()=>{this.CONSUME(qi,{LABEL:"fn"}),this.SUBRULE(this.functionExpression)});this.orderBySpecialFunctionExpression=this.RULE("orderBySpecialFunctionExpression",()=>{this.OR([{ALT:()=>this.SUBRULE(this.aggregateFunction)},{ALT:()=>this.SUBRULE(this.dateFunction)},{ALT:()=>this.SUBRULE(this.locationFunction)}]),this.OPTION(()=>{this.OR1([{ALT:()=>this.CONSUME(wi,{LABEL:"order"})},{ALT:()=>this.CONSUME(ki,{LABEL:"order"})}])}),this.OPTION1(()=>{this.CONSUME(ji),this.OR2([{ALT:()=>this.CONSUME(Di,{LABEL:"nulls"})},{ALT:()=>this.CONSUME(Wi,{LABEL:"nulls"})}])})});this.limitClause=this.RULE("limitClause",()=>{this.CONSUME(pa),this.CONSUME(qt,{LABEL:"value"})});this.offsetClause=this.RULE("offsetClause",()=>{this.CONSUME(Yi),this.CONSUME(qt,{LABEL:"value"})});this.dateFunction=this.RULE("dateFunction",()=>{this.OR(this.$_dateFunctionOr||(this.$_dateFunctionOr=[{ALT:()=>this.CONSUME(Ba,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Da,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ga,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Wa,{LABEL:"fn"})},{ALT:()=>this.CONSUME($a,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Va,{LABEL:"fn"})},{ALT:()=>this.CONSUME(ja,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ha,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ka,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ya,{LABEL:"fn"})},{ALT:()=>this.CONSUME(qa,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Xa,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Qa,{LABEL:"fn"})}])),this.SUBRULE(this.functionExpression)});this.aggregateFunction=this.RULE("aggregateFunction",()=>{this.OR(this.$_aggregateFunction||(this.$_aggregateFunction=[{ALT:()=>this.CONSUME(za,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Za,{LABEL:"fn"})},{ALT:()=>this.CONSUME(Ja,{LABEL:"fn"})},{ALT:()=>this.CONSUME(es,{LABEL:"fn"})},{ALT:()=>this.CONSUME(ts,{LABEL:"fn"})},{ALT:()=>this.CONSUME(rs,{LABEL:"fn"})}])),this.SUBRULE(this.functionExpression,{ARGS:[!0]})});this.fieldsFunction=this.RULE("fieldsFunction",()=>{this.CONSUME(os,{LABEL:"fn"}),this.CONSUME(Ue),this.CONSUME(dn,{LABEL:"params"}),this.CONSUME(Ge)});this.otherFunction=this.RULE("otherFunction",()=>{this.OR(this.$_otherFunction||(this.$_otherFunction=[{ALT:()=>this.CONSUME(as,{LABEL:"fn"})},{ALT:()=>this.CONSUME(ss,{LABEL:"fn"})},{ALT:()=>this.CONSUME(ls,{LABEL:"fn"})},{ALT:()=>this.CONSUME(us,{LABEL:"fn"})},{ALT:()=>this.CONSUME(qi,{LABEL:"fn"})}])),this.SUBRULE(this.functionExpression)});this.cubeFunction=this.RULE("cubeFunction",()=>{this.CONSUME(ia,{LABEL:"fn"}),this.SUBRULE(this.functionExpression)});this.rollupFunction=this.RULE("rollupFunction",()=>{this.CONSUME(da,{LABEL:"fn"}),this.SUBRULE(this.functionExpression)});this.functionExpression=this.RULE("functionExpression",r=>{this.CONSUME(Ue),this.MANY_SEP({SEP:Le,DEF:()=>{this.OR([{GATE:()=>!r,ALT:()=>this.SUBRULE(this.aggregateFunction,{LABEL:"params"})},{ALT:()=>this.SUBRULE(this.otherFunction,{LABEL:"params"})},{ALT:()=>this.CONSUME(En,{LABEL:"params"})},{ALT:()=>this.CONSUME(ot,{LABEL:"params"})},{ALT:()=>this.CONSUME(u,{LABEL:"params"})}])}}),this.CONSUME(Ge)});this.locationFunction=this.RULE("locationFunction",()=>{this.CONSUME(ns),this.CONSUME(Ue),this.CONSUME(u,{LABEL:"location1"}),this.CONSUME(Le),this.OR([{ALT:()=>this.SUBRULE(this.geolocationFunction,{LABEL:"location2"})},{ALT:()=>this.CONSUME1(u,{LABEL:"location2"})}]),this.CONSUME1(Le),this.CONSUME(xn,{LABEL:"unit"}),this.CONSUME(Ge)});this.geolocationFunction=this.RULE("geolocationFunction",()=>{this.CONSUME(is),this.CONSUME(Ue),this.CONSUME(ot,{LABEL:"latitude"}),this.CONSUME(Le),this.CONSUME1(ot,{LABEL:"longitude"}),this.CONSUME(Ge)});this.expressionPartWithNegation=this.RULE("expressionPartWithNegation",r=>{let n=0;this.MANY(()=>{this.CONSUME(Ue),n++}),this.CONSUME($i,{LABEL:"expressionNegation"}),r&&n&&(r.left+=n)});this.expression=this.RULE("expression",(r,n,i,o)=>{this.OPTION1(()=>{this.MANY1(()=>{this.CONSUME(Ue),r&&r.left++})}),this.OR1([{GATE:()=>!!i,ALT:()=>this.SUBRULE(this.aggregateFunction,{LABEL:"lhs"})},{GATE:()=>!!o,ALT:()=>this.SUBRULE(this.locationFunction,{LABEL:"lhs"})},{ALT:()=>this.SUBRULE(this.dateFunction,{LABEL:"lhs"})},{ALT:()=>this.SUBRULE(this.otherFunction,{LABEL:"lhs"})},{ALT:()=>this.CONSUME(u,{LABEL:"lhs"})}]),this.OR2([{ALT:()=>this.SUBRULE(this.expressionWithRelationalOperator,{LABEL:"operator"})},{ALT:()=>this.SUBRULE(this.expressionWithSetOperator,{LABEL:"operator",ARGS:[n]})}]),this.OPTION3(()=>{this.MANY2({GATE:()=>r?r.left>r.right:!0,DEF:()=>{this.CONSUME(Ge),r&&r.right++}})})});this.expressionWithRelationalOperator=this.RULE("expressionWithRelationalOperator",()=>{this.SUBRULE(this.relationalOperator),this.SUBRULE(this.atomicExpression,{LABEL:"rhs"})});this.expressionWithSetOperator=this.RULE("expressionWithSetOperator",r=>{this.SUBRULE(this.setOperator),this.SUBRULE2(this.atomicExpression,{LABEL:"rhs",ARGS:[!0,r]})});this.atomicExpression=this.RULE("atomicExpression",(r,n)=>{this.OR(this.$_atomicExpression||(this.$_atomicExpression=[{GATE:()=>this.allowApexBindVariables,ALT:()=>this.SUBRULE(this.apexBindVariableExpression)},{GATE:()=>r,ALT:()=>this.SUBRULE(this.arrayExpression)},{GATE:()=>r&&n,ALT:()=>this.SUBRULE(this.whereClauseSubqueryIdentifier)},{GATE:()=>!r,ALT:()=>this.CONSUME(gn)},{GATE:()=>!r,ALT:()=>this.CONSUME(Ji,{LABEL:"CurrencyPrefixedDecimal"})},{GATE:()=>!r,ALT:()=>this.CONSUME(eo,{LABEL:"CurrencyPrefixedInteger"})},{GATE:()=>!r,ALT:()=>this.CONSUME(ot)},{GATE:()=>!r,ALT:()=>this.CONSUME(Vi)},{GATE:()=>!r,ALT:()=>this.SUBRULE(this.booleanValue)},{GATE:()=>!r,ALT:()=>this.CONSUME($)},{GATE:()=>!r,ALT:()=>this.SUBRULE(this.dateNLiteral)},{GATE:()=>!r,ALT:()=>this.CONSUME(xn,{LABEL:"StringIdentifier"})},{GATE:()=>!r,ALT:()=>this.CONSUME(En)}]))});this.apexBindVariableExpression=this.RULE("apexBindVariableExpression",()=>{this.CONSUME(Zi),this.OPTION(()=>{this.SUBRULE(this.apexBindVariableNewInstantiation,{LABEL:"apex"}),this.OPTION1(()=>{this.CONSUME(zi)})}),this.MANY_SEP({SEP:zi,DEF:()=>{this.OR(this.$_apexBindVariableExpression||(this.$_apexBindVariableExpression=[{ALT:()=>this.SUBRULE(this.apexBindVariableFunctionCall,{LABEL:"apex"})},{ALT:()=>this.SUBRULE(this.apexBindVariableIdentifier,{LABEL:"apex"})}]))}})});this.apexBindVariableIdentifier=this.RULE("apexBindVariableIdentifier",()=>{this.CONSUME(u),this.OPTION(()=>this.SUBRULE(this.apexBindVariableFunctionArrayAccessor))});this.apexBindVariableNewInstantiation=this.RULE("apexBindVariableNewInstantiation",()=>{this.CONSUME(ya,{LABEL:"new"}),this.CONSUME(u,{LABEL:"function"}),this.OPTION(()=>{this.SUBRULE(this.apexBindVariableGeneric)}),this.SUBRULE(this.apexBindVariableFunctionParams),this.OPTION1(()=>this.SUBRULE(this.apexBindVariableFunctionArrayAccessor))});this.apexBindVariableFunctionCall=this.RULE("apexBindVariableFunctionCall",()=>{this.CONSUME(u,{LABEL:"function"}),this.SUBRULE(this.apexBindVariableFunctionParams),this.OPTION(()=>this.SUBRULE(this.apexBindVariableFunctionArrayAccessor))});this.apexBindVariableGeneric=this.RULE("apexBindVariableGeneric",()=>{this.CONSUME(Xi),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.CONSUME(u,{LABEL:"parameter"})}}),this.CONSUME(Qi)});this.apexBindVariableFunctionParams=this.RULE("apexBindVariableFunctionParams",()=>{this.CONSUME(Ue),this.MANY_SEP({SEP:Le,DEF:()=>{this.CONSUME(u,{LABEL:"parameter"})}}),this.CONSUME(Ge)});this.apexBindVariableFunctionArrayAccessor=this.RULE("apexBindVariableFunctionArrayAccessor",()=>{this.CONSUME(ds),this.OR([{ALT:()=>this.CONSUME(qt,{LABEL:"value"})},{ALT:()=>this.CONSUME(u,{LABEL:"value"})}]),this.CONSUME(ms)});this.arrayExpression=this.RULE("arrayExpression",()=>{this.CONSUME(Ue),this.AT_LEAST_ONE_SEP({SEP:Le,DEF:()=>{this.OR(this.$_arrayExpression||(this.$_arrayExpression=[{ALT:()=>this.CONSUME(Ji,{LABEL:"value"})},{ALT:()=>this.CONSUME(eo,{LABEL:"value"})},{ALT:()=>this.CONSUME(ot,{LABEL:"value"})},{ALT:()=>this.CONSUME(gn,{LABEL:"value"})},{ALT:()=>this.CONSUME(Vi,{LABEL:"value"})},{ALT:()=>this.CONSUME(Hi,{LABEL:"value"})},{ALT:()=>this.CONSUME(Bi,{LABEL:"value"})},{ALT:()=>this.CONSUME($,{LABEL:"value"})},{ALT:()=>this.SUBRULE(this.dateNLiteral,{LABEL:"value"})},{ALT:()=>this.CONSUME(xn,{LABEL:"value"})},{ALT:()=>this.CONSUME(En,{LABEL:"value"})}]))}}),this.CONSUME(Ge)});this.relationalOperator=this.RULE("relationalOperator",()=>{this.OR(this.$_relationalOperator||(this.$_relationalOperator=[{ALT:()=>this.CONSUME(cs,{LABEL:"operator"})},{ALT:()=>this.CONSUME(fs,{LABEL:"operator"})},{ALT:()=>this.CONSUME(Qi,{LABEL:"operator"})},{ALT:()=>this.CONSUME(hs,{LABEL:"operator"})},{ALT:()=>this.CONSUME(Xi,{LABEL:"operator"})},{ALT:()=>this.CONSUME(ps,{LABEL:"operator"})},{ALT:()=>this.CONSUME(fa,{LABEL:"operator"})}]))});this.setOperator=this.RULE("setOperator",()=>{this.OR([{ALT:()=>this.CONSUME(Gi,{LABEL:"operator"})},{ALT:()=>this.SUBRULE(this.notInOperator,{LABEL:"notIn"})},{ALT:()=>this.CONSUME(ca,{LABEL:"operator"})},{ALT:()=>this.CONSUME(aa,{LABEL:"operator"})}])});this.notInOperator=this.RULE("notInOperator",()=>{this.CONSUME($i,{LABEL:"operator"}),this.CONSUME(Gi,{LABEL:"operator"})});this.booleanValue=this.RULE("booleanValue",()=>{this.OR([{ALT:()=>this.CONSUME(Hi,{LABEL:"boolean"})},{ALT:()=>this.CONSUME(Bi,{LABEL:"boolean"})}])});this.dateNLiteral=this.RULE("dateNLiteral",()=>{this.CONSUME(z,{LABEL:"dateNLiteral"}),this.CONSUME(Zi),this.OR1([{ALT:()=>this.CONSUME(qt,{LABEL:"variable"})},{ALT:()=>this.CONSUME(gs,{LABEL:"variable"})}])});this.forViewOrReference=this.RULE("forViewOrReference",()=>{this.CONSUME(Aa),this.OR([{ALT:()=>this.CONSUME(Pa,{LABEL:"value"})},{ALT:()=>this.CONSUME(Ra,{LABEL:"value"})},{ALT:()=>this.CONSUME(Ki,{LABEL:"value"})}])});this.updateTrackingViewstat=this.RULE("updateTrackingViewstat",()=>{this.CONSUME(Ki),this.OR([{ALT:()=>this.CONSUME(Ia,{LABEL:"value"})},{ALT:()=>this.CONSUME(Fa,{LABEL:"value"})}])});this.ignoreParseErrors=!!r,this.performSelfAnalysis()}$_checkBalancedParens(r){!this.RECORDING_PHASE&&r&&r.left-r.right!==0&&this.CONSUME($f,{ERR_MSG:"Expecting a token type of --> RParen <-- but found --> '' <--"})}getParenCount(r){return r||{right:0,left:0}}},at=new Fr;function As(t,e){let{allowApexBindVariables:r,logErrors:n,ignoreParseErrors:i,allowPartialQuery:o}=e||{allowApexBindVariables:!1,logErrors:!1,ignoreParseErrors:!1},a=Vf(t);if(a.errors.length>0)throw n&&(console.log("Lexing Errors:"),console.log(a.errors)),new xs(a.errors[0]);at.ignoreParseErrors!==i&&(at=new Fr({ignoreParseErrors:i})),at.input=a.tokens,at.allowApexBindVariables=r||!1;let s;if(o?s=at.selectStatementPartial():s=at.selectStatement(),at.errors.length>0&&(n&&(console.log("Parsing Errors:"),console.log(at.errors)),!i))throw new to(at.errors[0]);return{cst:s,parseErrors:at.errors.map(l=>new to(l))}}var uy=new Fr,cy=uy.getBaseCstVisitorConstructor(),fy=["TRUE","FALSE"],py=["YESTERDAY","TODAY","TOMORROW","LAST_WEEK","THIS_WEEK","NEXT_WEEK","LAST_MONTH","THIS_MONTH","NEXT_MONTH","LAST_90_DAYS","NEXT_90_DAYS","THIS_QUARTER","LAST_QUARTER","NEXT_QUARTER","THIS_YEAR","LAST_YEAR","NEXT_YEAR","THIS_FISCAL_QUARTER","LAST_FISCAL_QUARTER","NEXT_FISCAL_QUARTER","THIS_FISCAL_YEAR","LAST_FISCAL_YEAR","NEXT_FISCAL_YEAR"],hy=["NEXT_N_DAYS","LAST_N_DAYS","N_DAYS_AGO","NEXT_N_WEEKS","LAST_N_WEEKS","N_WEEKS_AGO","NEXT_N_MONTHS","LAST_N_MONTHS","N_MONTHS_AGO","NEXT_N_QUARTERS","LAST_N_QUARTERS","N_QUARTERS_AGO","NEXT_N_YEARS","LAST_N_YEARS","N_YEARS_AGO","NEXT_N_FISCAL_QUARTERS","LAST_N_FISCAL_QUARTERS","N_FISCAL_QUARTERS_AGO","NEXT_N_FISCAL_YEARS","LAST_N_FISCAL_YEARS","N_FISCAL_YEARS_AGO"],Ts=class extends cy{constructor(){super();this.helpers={$_getFieldFunction:(r,n=!1,i=!0)=>{let o=r.functionExpression?r.functionExpression.map(s=>this.visit(s,{includeType:i})).flat():[],a={};return i&&(a.type="FieldFunctionExpression"),a.functionName=r.fn[0].tokenType.name,a.parameters=o,i&&n&&(a.isAggregateFn=n),a.rawValue=`${r.fn[0].image}(${o.map(s=>typeof s=="string"?s:s.rawValue).join(", ")})`,a},$_getLiteralTypeFromTokenType:r=>r==="REAL_NUMBER"?"DECIMAL":r==="CURRENCY_PREFIXED_DECIMAL"?"DECIMAL_WITH_CURRENCY_PREFIX":r==="CURRENCY_PREFIXED_INTEGER"?"INTEGER_WITH_CURRENCY_PREFIX":r==="SIGNED_DECIMAL"||r==="UNSIGNED_DECIMAL"?"DECIMAL":r==="UNSIGNED_INTEGER"||r==="SIGNED_INTEGER"?"INTEGER":r==="DATETIME"?"DATETIME":r==="DATE"?"DATE":r==="NULL"?"NULL":r==="StringIdentifier"||r==="Identifier"?"STRING":fy.includes(r)?"BOOLEAN":py.includes(r)?"DATE_LITERAL":hy.includes(r)?"DATE_N_LITERAL":"STRING",$_parseSelect(r,n){let{isSubquery:i}=n||{isSubquery:!1},o={};if(r.selectClause&&(o.fields=this.visit(r.selectClause)),r.fromClause)if(Fs(o,i)){let{sObject:a,alias:s,sObjectPrefix:l}=this.visit(r.fromClause);o.relationshipName=a,s&&(o.sObjectAlias=s),l&&(o.sObjectPrefix=l)}else{let{sObject:a,alias:s}=this.visit(r.fromClause);o.sObject=a,s&&(o.sObjectAlias=s)}return Array.isArray(o.fields)&&o.sObjectAlias&&o.fields.forEach(a=>{a.relationships&&a.relationships[0]===o.sObjectAlias&&(a.relationships=a.relationships.slice(1),a.objectPrefix=o.sObjectAlias),a.relationships&&a.relationships.length===0&&(delete a.relationships,a.type="Field")}),o={...o,...this.visit(r.clauseStatements)},o}};this.validateVisitor()}selectStatement(r,n){return this.helpers.$_parseSelect.bind(this)(r,n)}selectStatementPartial(r,n){return this.helpers.$_parseSelect.bind(this)(r,n)}clauseStatements(r){let n={};return r.usingScopeClause&&!r.usingScopeClause[0].recoveredNode&&(n.usingScope=this.visit(r.usingScopeClause)),r.whereClause&&!r.whereClause[0].recoveredNode&&(n.where=this.visit(r.whereClause)),r.withClause&&r.withClause.filter(i=>!i.recoveredNode).forEach(i=>{let{withSecurityEnforced:o,withAccessLevel:a,withDataCategory:s}=this.visit(i);o&&(n.withSecurityEnforced=o),a&&(n.withAccessLevel=a),s&&(n.withDataCategory=s)}),r.groupByClause&&!r.groupByClause[0].recoveredNode&&(n.groupBy=this.visit(r.groupByClause)),r.havingClause&&!r.havingClause[0].recoveredNode&&(n.having=this.visit(r.havingClause)),r.orderByClause&&!r.orderByClause[0].recoveredNode&&(n.orderBy=this.visit(r.orderByClause)),r.limitClause&&!r.limitClause[0].recoveredNode&&(n.limit=Number(this.visit(r.limitClause))),r.offsetClause&&!r.offsetClause[0].recoveredNode&&(n.offset=Number(this.visit(r.offsetClause))),r.forViewOrReference&&!r.forViewOrReference[0].recoveredNode&&(n.for=this.visit(r.forViewOrReference)),r.updateTrackingViewstat&&!r.updateTrackingViewstat[0].recoveredNode&&(n.update=this.visit(r.updateTrackingViewstat)),n}selectClause(r){return r.field?r.field.map(n=>{if(Qt(n)){let i=n.image,o;if(!i.includes("."))o={type:"Field",field:i};else{let a=i.split(".");o={type:"FieldRelationship",field:a[a.length-1],relationships:a.slice(0,a.length-1),rawValue:i}}return o}else return this.visit(n)}):[]}selectClauseFunctionIdentifier(r){let n={...this.visit(r.fn)};return r.alias&&(n.alias=r.alias[0].image),n}selectClauseSubqueryIdentifier(r){return{type:"FieldSubquery",subquery:this.visit(r.selectStatement,{isSubquery:!0})}}selectClauseTypeOf(r){let n=r.selectClauseTypeOfThen.map(i=>this.visit(i));return r.selectClauseTypeOfElse&&n.push(this.visit(r.selectClauseTypeOfElse)),{type:"FieldTypeof",field:r.typeOfField[0].image,conditions:n}}selectClauseIdentifier(r){let n=r.field[0],i=r.alias?r.alias[0].image:void 0,o=n.image,a;if(!o.includes("."))a={type:"Field",field:o};else{let s=o.split(".");a={type:"FieldRelationship",field:s[s.length-1],relationships:s.slice(0,s.length-1),rawValue:o}}return i&&(a.alias=i),a}selectClauseTypeOfThen(r){return{type:"WHEN",objectType:r.typeOfField[0].image,fieldList:r.field.map(n=>n.image)}}selectClauseTypeOfElse(r){return{type:"ELSE",fieldList:r.field.map(n=>n.image)}}fromClause(r){let n=r.Identifier[0].image,i;if(n.includes(".")){let o=n.split(".");i={sObjectPrefix:o.slice(0,o.length-1),sObject:o[o.length-1]}}else i={sObject:n};return r.alias&&r.alias[0]&&(i.alias=r.alias[0].image),i}usingScopeClause(r){return r.UsingScopeEnumeration[0].image}whereClauseSubqueryIdentifier(r){return this.visit(r.selectStatement,{isSubquery:!1})}whereClause(r){return r.conditionExpression.reduce((i,o)=>{let a;i.expressionTree?(a=this.visit(o,{prevExpression:i.prevExpression}),i.prevExpression.right=a):(a=this.visit(o),i.expressionTree=a);let s=a.right,l=a.right;for(;fo(l);)s=l,l=l.right;return i.prevExpression=l||a,i},{prevExpression:void 0,expressionTree:void 0}).expressionTree}conditionExpression(r,n){n=n||{},n.prevExpression&&r.logicalOperator&&(n.prevExpression.operator=r.logicalOperator[0].tokenType.name);let i={},o=i;if(Array.isArray(r.expressionNegation))if(r.expressionNegation.length===1)i=this.visit(r.expressionNegation),o=i.right;else{i=this.visit(r.expressionNegation[0]);let a=i;r.expressionNegation.slice(1).forEach(s=>{a.right=this.visit(s),o=a.right.right})}return o.left=this.visit(r.expression),i}withClause(r){return r.withSecurityEnforced?{withSecurityEnforced:!0}:r.withAccessLevel?{withAccessLevel:r.withAccessLevel[0].image}:{withDataCategory:{conditions:this.visit(r.withDataCategory)}}}withDataCategory(r){return r.withDataCategoryArr.map(n=>this.visit(n))}withDataCategoryArr(r){return{groupName:r.dataCategoryGroupName[0].image,selector:r.filteringSelector[0].image,parameters:r.dataCategoryName.map(n=>n.image)}}groupByClause(r){return r.groupBy.map(n=>Qt(n)?{field:n.image}:{fn:this.visit(n,{includeType:!1})})}havingClause(r){return r.conditionExpression.reduce((i,o)=>(i.expressionTree?(i.prevExpression.right=this.visit(o,{prevExpression:i.prevExpression}),i.prevExpression=i.prevExpression.right):(i.expressionTree=this.visit(o),i.prevExpression=i.expressionTree),i),{prevExpression:void 0,expressionTree:void 0}).expressionTree}orderByClause(r){return r.orderByExpressionOrFn.map(n=>this.visit(n))}orderByExpression(r){let n={field:r.Identifier[0].image};return r.order&&r.order[0]&&(n.order=r.order[0].tokenType.name),r.nulls&&r.nulls[0]&&(n.nulls=r.nulls[0].tokenType.name),n}orderByGroupingFunctionExpression(r){let n={fn:this.helpers.$_getFieldFunction(r,!1,!1)};return r.order&&r.order[0]&&(n.order=r.order[0].tokenType.name),r.nulls&&r.nulls[0]&&(n.nulls=r.nulls[0].tokenType.name),n}orderBySpecialFunctionExpression(r){let n={};return r.aggregateFunction?n.fn=this.visit(r.aggregateFunction,{includeType:!1}):r.dateFunction?n.fn=this.visit(r.dateFunction,{includeType:!1}):r.locationFunction&&(n.fn=this.visit(r.locationFunction,{includeType:!1})),r.order&&r.order[0]&&(n.order=r.order[0].tokenType.name),r.nulls&&r.nulls[0]&&(n.nulls=r.nulls[0].tokenType.name),n}limitClause(r){return r.value[0].image}offsetClause(r){return r.value[0].image}dateFunction(r,n={includeType:!0}){return this.helpers.$_getFieldFunction(r,!0,n.includeType)}aggregateFunction(r,n={includeType:!0}){return this.helpers.$_getFieldFunction(r,!0,n.includeType)}fieldsFunction(r,n={includeType:!0}){let i={};return n.includeType&&(i.type="FieldFunctionExpression"),i={...i,functionName:"FIELDS",parameters:[r.params[0].image]},i.rawValue=`FIELDS(${i.parameters[0]})`,i}otherFunction(r,n={includeType:!0}){return this.helpers.$_getFieldFunction(r,!1,n.includeType)}cubeFunction(r){return this.helpers.$_getFieldFunction(r,!1,!1)}rollupFunction(r){return this.helpers.$_getFieldFunction(r,!1,!1)}locationFunction(r,n={includeType:!0}){let i={};return n.includeType&&(i.type="FieldFunctionExpression"),i={...i,functionName:"DISTANCE",parameters:[r.location1[0].image,Qt(r.location2)?r.location2[0].image:this.visit(r.location2,n),r.unit[0].image]},n.includeType&&(i.isAggregateFn=!0),i.rawValue=`DISTANCE(${i.parameters[0]}, ${Pe(i.parameters[1])?i.parameters[1]:i.parameters[1].rawValue}, ${i.parameters[2]})`,i}geolocationFunction(r,n={includeType:!0}){let i={};return n.includeType&&(i.type="FieldFunctionExpression"),i={...i,functionName:"GEOLOCATION",parameters:[r.latitude[0].image,r.longitude[0].image],rawValue:`GEOLOCATION(${r.latitude[0].image}, ${r.longitude[0].image})`},i}functionExpression(r,n={includeType:!0}){return r.params?r.params.map(i=>i.image?i.image:this.visit(i,n)):[]}expression(r){let{value:n,literalType:i,dateLiteralVariable:o,operator:a}=this.visit(r.operator,{returnLiteralType:!0}),s={};return Qt(r.lhs)?s.field=r.lhs[0].image:s.fn=this.visit(r.lhs,{includeType:!1}),s.operator=a,s.literalType=i,i==="SUBQUERY"?s.valueQuery=n:s.value=n,o&&(s.dateLiteralVariable=o),r.L_PAREN&&(s.openParen=r.L_PAREN.length),r.R_PAREN&&(s.closeParen=r.R_PAREN.length),s}expressionPartWithNegation(r){return{left:r.L_PAREN?{openParen:r.L_PAREN.length}:null,operator:"NOT",right:{left:{}}}}expressionWithRelationalOperator(r){return r.relationalOperator?{operator:this.visit(r.relationalOperator),...this.visit(r.rhs,{returnLiteralType:!0})}:{operator:this.visit(r.setOperator),...this.visit(r.rhs,{returnLiteralType:!0})}}expressionWithSetOperator(r){return r.relationalOperator?{operator:this.visit(r.relationalOperator),...this.visit(r.rhs,{returnLiteralType:!0})}:{operator:this.visit(r.setOperator),...this.visit(r.rhs,{returnLiteralType:!0})}}atomicExpression(r,n){n=n||{};let i,o,a;if(r.apexBindVariableExpression)i=this.visit(r.apexBindVariableExpression),o="APEX_BIND_VARIABLE";else if(r.NumberIdentifier)i=r.NumberIdentifier[0].image,o=this.helpers.$_getLiteralTypeFromTokenType(r.NumberIdentifier[0].tokenType.name);else if(r.UnsignedInteger)i=r.UnsignedInteger[0].image,o="INTEGER";else if(r.SignedInteger)i=r.SignedInteger[0].image,o="INTEGER";else if(r.RealNumber)i=r.RealNumber[0].image,o="DECIMAL";else if(r.DateIdentifier)i=r.DateIdentifier[0].image,o=this.helpers.$_getLiteralTypeFromTokenType(r.DateIdentifier[0].tokenType.name);else if(r.CurrencyPrefixedInteger)i=r.CurrencyPrefixedInteger[0].image,o="INTEGER_WITH_CURRENCY_PREFIX";else if(r.CurrencyPrefixedDecimal)i=r.CurrencyPrefixedDecimal[0].image,o="DECIMAL_WITH_CURRENCY_PREFIX";else if(r.DateTime)i=r.DateTime[0].image,o="DATETIME";else if(r.date)i=r.DateToken[0].image,o="DATE";else if(r.NULL)i="NULL",o="NULL";else if(r.StringIdentifier)i=r.StringIdentifier[0].image,o="STRING";else if(r.Identifier)i=r.Identifier[0].image,o="STRING";else if(r.booleanValue)i=this.visit(r.booleanValue),o="BOOLEAN";else if(r.DateLiteral)i=r.DateLiteral[0].image,o="DATE_LITERAL";else if(r.dateNLiteral){let s=this.visit(r.dateNLiteral);i=s.value,a=s.variable,o="DATE_N_LITERAL"}else if(r.arrayExpression){let s=this.visit(r.arrayExpression);i=s.map(p=>p.value);let l=s.map(p=>p.variable||null),c=l.some(p=>p!==null);new Set(s.map(p=>p.type)).size===1?o=this.helpers.$_getLiteralTypeFromTokenType(s[0].type):o=s.map(p=>this.helpers.$_getLiteralTypeFromTokenType(p.type)),c&&(a=l),o=o||"STRING"}else r.whereClauseSubqueryIdentifier&&(i=this.visit(r.whereClauseSubqueryIdentifier),o="SUBQUERY");return n.returnLiteralType?{value:i,literalType:o,dateLiteralVariable:a}:i}apexBindVariableExpression(r){return r.apex.map(n=>this.visit(n)).join(".")}apexBindVariableIdentifier(r){let n=r.Identifier[0].image;return r.apexBindVariableFunctionArrayAccessor&&(n+=this.visit(r.apexBindVariableFunctionArrayAccessor[0])),n}apexBindVariableNewInstantiation(r){let n=`new ${r.function[0].image}`;return r.apexBindVariableGeneric&&(n+=this.visit(r.apexBindVariableGeneric[0])),n+=this.visit(r.apexBindVariableFunctionParams[0]),r.apexBindVariableFunctionArrayAccessor&&(n+=this.visit(r.apexBindVariableFunctionArrayAccessor[0])),n}apexBindVariableFunctionCall(r){let n=`${r.function[0].image}${this.visit(r.apexBindVariableFunctionParams[0])}`;return r.apexBindVariableFunctionArrayAccessor&&(n+=this.visit(r.apexBindVariableFunctionArrayAccessor[0])),n}apexBindVariableGeneric(r){return`<${r.parameter.map(n=>n.image).join(", ")}>`}apexBindVariableFunctionParams(r){return`(${(Array.isArray(r.parameter)?r.parameter:[]).map(i=>i.image).join(", ")})`}apexBindVariableFunctionArrayAccessor(r){return`[${r.value[0].image}]`}arrayExpression(r){return r.value.map(n=>Qt(n)?{type:n.tokenType.name,value:n.image}:this.visit(n,{includeType:!0}))}relationalOperator(r){return r.operator[0].image}setOperator(r){if(Array.isArray(r.operator))return r.operator[0].tokenType.name.replace("_"," ");if(Array.isArray(r.notIn))return this.visit(r.notIn)}notInOperator(r){return"NOT IN"}booleanValue(r){return r.boolean[0].tokenType.name}dateNLiteral(r,n){let i={value:`${r.dateNLiteral[0].image}:${r.variable[0].image}`,variable:Number(r.variable[0].image)};return n&&n.includeType&&(i.type=r.dateNLiteral[0].tokenType.name),i}forViewOrReference(r){return r.value[0].tokenType.name}updateTrackingViewstat(r){return r.value[0].tokenType.name}},dy=new Ts;function An(t,e){let{cst:r}=As(t,e);return dy.visit(r)}function Ss(t,e){try{let{parseErrors:r}=As(t,e);return r.length===0}catch{return!1}}var ro=class{constructor(e,r){this.currIndent=1;this.enabled=e,this.options={numIndent:r.numIndent??1,fieldMaxLineLength:r.fieldMaxLineLength??60,fieldSubqueryParensOnOwnLine:r.fieldSubqueryParensOnOwnLine??!0,whereClauseOperatorsIndented:!0,newLineAfterKeywords:r.newLineAfterKeywords??!1,logging:r.logging??!1},this.options.newLineAfterKeywords&&(this.options.fieldSubqueryParensOnOwnLine=!0)}log(e){this.options.logging&&console.log(e)}getIndent(e=0){return this.repeatChar((this.currIndent+e)*(this.options.numIndent||1)," ")}repeatChar(e,r){return new Array(e).fill(r).join("")}setSubquery(e){this.currIndent=e?this.currIndent+=1:this.currIndent-=1}stepCurrIndex(e){this.currIndent+=e}formatFields(e){function r(n){e.fields[n-1]&&(e.fields[n-1].suffix=e.fields[n-1].suffix.trim())}if(e.fields.forEach((n,i)=>{n.suffix=e.fields.length-1===i?"":", "}),this.enabled){let n=0,i=!1;e.fields.forEach((o,a)=>{o.isSubquery?(r(a),o.prefix=`
|
|
114
114
|
${this.getIndent()}`,o.suffix=e.fields.length-1===a?"":", ",n=0,i=!0):Array.isArray(o.typeOfClause)?(r(a),o.prefix=`
|
|
115
115
|
${this.getIndent()}`,i=!0):At(this.options.fieldMaxLineLength)&&(n+=o.text.length+o.suffix.length,(n>this.options.fieldMaxLineLength||i)&&(r(a),(!this.options.newLineAfterKeywords||a>0)&&(o.prefix+=`
|
|
116
116
|
${this.getIndent()}`),n=0,i=!1)),this.log(o)})}}formatTyeOfField(e,r){return this.enabled&&this.options.newLineAfterKeywords?r.map((n,i)=>i===0?n:i===r.length-1?`${this.getIndent()}${n}`:`${this.getIndent()} ${n}`).join(`
|