168 lines
138 KiB
JavaScript
168 lines
138 KiB
JavaScript
var $r="11.1.2";var Af=typeof global=="object"&&global&&global.Object===Object&&global,Kr=Af;var If=typeof self=="object"&&self&&self.Object===Object&&self,Rf=Kr||If||Function("return this")(),Z=Rf;var yf=Z.Symbol,ne=yf;var ri=Object.prototype,Sf=ri.hasOwnProperty,Of=ri.toString,Er=ne?ne.toStringTag:void 0;function Nf(t){var e=Sf.call(t,Er),r=t[Er];try{t[Er]=void 0;var n=!0}catch{}var o=Of.call(t);return n&&(e?t[Er]=r:delete t[Er]),o}var ni=Nf;var _f=Object.prototype,Cf=_f.toString;function vf(t){return Cf.call(t)}var oi=vf;var Lf="[object Null]",bf="[object Undefined]",ii=ne?ne.toStringTag:void 0;function kf(t){return t==null?t===void 0?bf:Lf:ii&&ii in Object(t)?ni(t):oi(t)}var pe=kf;function Pf(t){return t!=null&&typeof t=="object"}var V=Pf;var Mf="[object Symbol]";function wf(t){return typeof t=="symbol"||V(t)&&pe(t)==Mf}var tt=wf;function Ff(t,e){for(var r=-1,n=t==null?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}var Me=Ff;var Uf=Array.isArray,I=Uf;var Df=1/0,ai=ne?ne.prototype:void 0,si=ai?ai.toString:void 0;function li(t){if(typeof t=="string")return t;if(I(t))return Me(t,li)+"";if(tt(t))return si?si.call(t):"";var e=t+"";return e=="0"&&1/t==-Df?"-0":e}var fi=li;var Bf=/\s/;function Gf(t){for(var e=t.length;e--&&Bf.test(t.charAt(e)););return e}var ci=Gf;var Wf=/^\s+/;function jf(t){return t&&t.slice(0,ci(t)+1).replace(Wf,"")}var ui=jf;function $f(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var W=$f;var pi=NaN,Kf=/^[-+]0x[0-9a-f]+$/i,Hf=/^0b[01]+$/i,zf=/^0o[0-7]+$/i,Vf=parseInt;function Xf(t){if(typeof t=="number")return t;if(tt(t))return pi;if(W(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=W(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=ui(t);var r=Hf.test(t);return r||zf.test(t)?Vf(t.slice(2),r?2:8):Kf.test(t)?pi:+t}var hi=Xf;var di=1/0,Yf=17976931348623157e292;function qf(t){if(!t)return t===0?t:0;if(t=hi(t),t===di||t===-di){var e=t<0?-1:1;return e*Yf}return t===t?t:0}var mi=qf;function Zf(t){var e=mi(t),r=e%1;return e===e?r?e-r:e:0}var we=Zf;function Jf(t){return t}var Ce=Jf;var Qf="[object AsyncFunction]",ec="[object Function]",tc="[object GeneratorFunction]",rc="[object Proxy]";function nc(t){if(!W(t))return!1;var e=pe(t);return e==ec||e==tc||e==Qf||e==rc}var he=nc;var oc=Z["__core-js_shared__"],Hr=oc;var gi=(function(){var t=/[^.]+$/.exec(Hr&&Hr.keys&&Hr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();function ic(t){return!!gi&&gi in t}var xi=ic;var ac=Function.prototype,sc=ac.toString;function lc(t){if(t!=null){try{return sc.call(t)}catch{}try{return t+""}catch{}}return""}var He=lc;var fc=/[\\^$.*+?()[\]{}|]/g,cc=/^\[object .+?Constructor\]$/,uc=Function.prototype,pc=Object.prototype,hc=uc.toString,dc=pc.hasOwnProperty,mc=RegExp("^"+hc.call(dc).replace(fc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gc(t){if(!W(t)||xi(t))return!1;var e=he(t)?mc:cc;return e.test(He(t))}var Ti=gc;function xc(t,e){return t?.[e]}var Ei=xc;function Tc(t,e){var r=Ei(t,e);return Ti(r)?r:void 0}var xe=Tc;var Ec=xe(Z,"WeakMap"),zr=Ec;var Ai=Object.create,Ac=(function(){function t(){}return function(e){if(!W(e))return{};if(Ai)return Ai(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}})(),Ii=Ac;function Ic(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 Ri=Ic;function Rc(){}var $=Rc;function yc(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var yi=yc;var Sc=800,Oc=16,Nc=Date.now;function _c(t){var e=0,r=0;return function(){var n=Nc(),o=Oc-(n-r);if(r=n,o>0){if(++e>=Sc)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var Si=_c;function Cc(t){return function(){return t}}var Oi=Cc;var vc=(function(){try{var t=xe(Object,"defineProperty");return t({},"",{}),t}catch{}})(),bt=vc;var Lc=bt?function(t,e){return bt(t,"toString",{configurable:!0,enumerable:!1,value:Oi(e),writable:!0})}:Ce,Ni=Lc;var bc=Si(Ni),_i=bc;function kc(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Vr=kc;function Pc(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}var Xr=Pc;function Mc(t){return t!==t}var Ci=Mc;function wc(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}var vi=wc;function Fc(t,e,r){return e===e?vi(t,e,r):Xr(t,Ci,r)}var kt=Fc;function Uc(t,e){var r=t==null?0:t.length;return!!r&&kt(t,e,0)>-1}var Yr=Uc;var Dc=9007199254740991,Bc=/^(?:0|[1-9]\d*)$/;function Gc(t,e){var r=typeof t;return e=e??Dc,!!e&&(r=="number"||r!="symbol"&&Bc.test(t))&&t>-1&&t%1==0&&t<e}var rt=Gc;function Wc(t,e,r){e=="__proto__"&&bt?bt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Pt=Wc;function jc(t,e){return t===e||t!==t&&e!==e}var Fe=jc;var $c=Object.prototype,Kc=$c.hasOwnProperty;function Hc(t,e,r){var n=t[e];(!(Kc.call(t,e)&&Fe(n,r))||r===void 0&&!(e in t))&&Pt(t,e,r)}var nt=Hc;function zc(t,e,r,n){var o=!r;r||(r={});for(var i=-1,a=e.length;++i<a;){var s=e[i],l=n?n(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),o?Pt(r,s,l):nt(r,s,l)}return r}var Ue=zc;var Li=Math.max;function Vc(t,e,r){return e=Li(e===void 0?t.length-1:e,0),function(){for(var n=arguments,o=-1,i=Li(n.length-e,0),a=Array(i);++o<i;)a[o]=n[e+o];o=-1;for(var s=Array(e+1);++o<e;)s[o]=n[o];return s[e]=r(a),Ri(t,this,s)}}var bi=Vc;function Xc(t,e){return _i(bi(t,e,Ce),t+"")}var Mt=Xc;var Yc=9007199254740991;function qc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Yc}var wt=qc;function Zc(t){return t!=null&&wt(t.length)&&!he(t)}var J=Zc;function Jc(t,e,r){if(!W(r))return!1;var n=typeof e;return(n=="number"?J(r)&&rt(e,r.length):n=="string"&&e in r)?Fe(r[e],t):!1}var ot=Jc;function Qc(t){return Mt(function(e,r){var n=-1,o=r.length,i=o>1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(o--,i):void 0,a&&ot(r[0],r[1],a)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var s=r[n];s&&t(e,s,n,i)}return e})}var ki=Qc;var eu=Object.prototype;function tu(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||eu;return t===r}var De=tu;function ru(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var Pi=ru;var nu="[object Arguments]";function ou(t){return V(t)&&pe(t)==nu}var lo=ou;var Mi=Object.prototype,iu=Mi.hasOwnProperty,au=Mi.propertyIsEnumerable,su=lo((function(){return arguments})())?lo:function(t){return V(t)&&iu.call(t,"callee")&&!au.call(t,"callee")},it=su;function lu(){return!1}var wi=lu;var Di=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Fi=Di&&typeof module=="object"&&module&&!module.nodeType&&module,fu=Fi&&Fi.exports===Di,Ui=fu?Z.Buffer:void 0,cu=Ui?Ui.isBuffer:void 0,uu=cu||wi,ze=uu;var pu="[object Arguments]",hu="[object Array]",du="[object Boolean]",mu="[object Date]",gu="[object Error]",xu="[object Function]",Tu="[object Map]",Eu="[object Number]",Au="[object Object]",Iu="[object RegExp]",Ru="[object Set]",yu="[object String]",Su="[object WeakMap]",Ou="[object ArrayBuffer]",Nu="[object DataView]",_u="[object Float32Array]",Cu="[object Float64Array]",vu="[object Int8Array]",Lu="[object Int16Array]",bu="[object Int32Array]",ku="[object Uint8Array]",Pu="[object Uint8ClampedArray]",Mu="[object Uint16Array]",wu="[object Uint32Array]",F={};F[_u]=F[Cu]=F[vu]=F[Lu]=F[bu]=F[ku]=F[Pu]=F[Mu]=F[wu]=!0;F[pu]=F[hu]=F[Ou]=F[du]=F[Nu]=F[mu]=F[gu]=F[xu]=F[Tu]=F[Eu]=F[Au]=F[Iu]=F[Ru]=F[yu]=F[Su]=!1;function Fu(t){return V(t)&&wt(t.length)&&!!F[pe(t)]}var Bi=Fu;function Uu(t){return function(e){return t(e)}}var Be=Uu;var Gi=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ar=Gi&&typeof module=="object"&&module&&!module.nodeType&&module,Du=Ar&&Ar.exports===Gi,fo=Du&&Kr.process,Bu=(function(){try{var t=Ar&&Ar.require&&Ar.require("util").types;return t||fo&&fo.binding&&fo.binding("util")}catch{}})(),Se=Bu;var Wi=Se&&Se.isTypedArray,Gu=Wi?Be(Wi):Bi,Ft=Gu;var Wu=Object.prototype,ju=Wu.hasOwnProperty;function $u(t,e){var r=I(t),n=!r&&it(t),o=!r&&!n&&ze(t),i=!r&&!n&&!o&&Ft(t),a=r||n||o||i,s=a?Pi(t.length,String):[],l=s.length;for(var f in t)(e||ju.call(t,f))&&!(a&&(f=="length"||o&&(f=="offset"||f=="parent")||i&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||rt(f,l)))&&s.push(f);return s}var qr=$u;function Ku(t,e){return function(r){return t(e(r))}}var Zr=Ku;var Hu=Zr(Object.keys,Object),ji=Hu;var zu=Object.prototype,Vu=zu.hasOwnProperty;function Xu(t){if(!De(t))return ji(t);var e=[];for(var r in Object(t))Vu.call(t,r)&&r!="constructor"&&e.push(r);return e}var Jr=Xu;function Yu(t){return J(t)?qr(t):Jr(t)}var P=Yu;var qu=Object.prototype,Zu=qu.hasOwnProperty,Ju=ki(function(t,e){if(De(e)||J(e)){Ue(e,P(e),t);return}for(var r in e)Zu.call(e,r)&&nt(t,r,e[r])}),ee=Ju;function Qu(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var $i=Qu;var ep=Object.prototype,tp=ep.hasOwnProperty;function rp(t){if(!W(t))return $i(t);var e=De(t),r=[];for(var n in t)n=="constructor"&&(e||!tp.call(t,n))||r.push(n);return r}var Ki=rp;function np(t){return J(t)?qr(t,!0):Ki(t)}var at=np;var op=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ip=/^\w*$/;function ap(t,e){if(I(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||tt(t)?!0:ip.test(t)||!op.test(t)||e!=null&&t in Object(e)}var Ut=ap;var sp=xe(Object,"create"),Ve=sp;function lp(){this.__data__=Ve?Ve(null):{},this.size=0}var Hi=lp;function fp(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var zi=fp;var cp="__lodash_hash_undefined__",up=Object.prototype,pp=up.hasOwnProperty;function hp(t){var e=this.__data__;if(Ve){var r=e[t];return r===cp?void 0:r}return pp.call(e,t)?e[t]:void 0}var Vi=hp;var dp=Object.prototype,mp=dp.hasOwnProperty;function gp(t){var e=this.__data__;return Ve?e[t]!==void 0:mp.call(e,t)}var Xi=gp;var xp="__lodash_hash_undefined__";function Tp(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Ve&&e===void 0?xp:e,this}var Yi=Tp;function Dt(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])}}Dt.prototype.clear=Hi;Dt.prototype.delete=zi;Dt.prototype.get=Vi;Dt.prototype.has=Xi;Dt.prototype.set=Yi;var co=Dt;function Ep(){this.__data__=[],this.size=0}var qi=Ep;function Ap(t,e){for(var r=t.length;r--;)if(Fe(t[r][0],e))return r;return-1}var st=Ap;var Ip=Array.prototype,Rp=Ip.splice;function yp(t){var e=this.__data__,r=st(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Rp.call(e,r,1),--this.size,!0}var Zi=yp;function Sp(t){var e=this.__data__,r=st(e,t);return r<0?void 0:e[r][1]}var Ji=Sp;function Op(t){return st(this.__data__,t)>-1}var Qi=Op;function Np(t,e){var r=this.__data__,n=st(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var ea=Np;function Bt(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])}}Bt.prototype.clear=qi;Bt.prototype.delete=Zi;Bt.prototype.get=Ji;Bt.prototype.has=Qi;Bt.prototype.set=ea;var lt=Bt;var _p=xe(Z,"Map"),ft=_p;function Cp(){this.size=0,this.__data__={hash:new co,map:new(ft||lt),string:new co}}var ta=Cp;function vp(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ra=vp;function Lp(t,e){var r=t.__data__;return ra(e)?r[typeof e=="string"?"string":"hash"]:r.map}var ct=Lp;function bp(t){var e=ct(this,t).delete(t);return this.size-=e?1:0,e}var na=bp;function kp(t){return ct(this,t).get(t)}var oa=kp;function Pp(t){return ct(this,t).has(t)}var ia=Pp;function Mp(t,e){var r=ct(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var aa=Mp;function Gt(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])}}Gt.prototype.clear=ta;Gt.prototype.delete=na;Gt.prototype.get=oa;Gt.prototype.has=ia;Gt.prototype.set=aa;var It=Gt;var wp="Expected a function";function uo(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(wp);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(uo.Cache||It),r}uo.Cache=It;var sa=uo;var Fp=500;function Up(t){var e=sa(t,function(n){return r.size===Fp&&r.clear(),n}),r=e.cache;return e}var la=Up;var Dp=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Bp=/\\(\\)?/g,Gp=la(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Dp,function(r,n,o,i){e.push(o?i.replace(Bp,"$1"):n||r)}),e}),fa=Gp;function Wp(t){return t==null?"":fi(t)}var Qr=Wp;function jp(t,e){return I(t)?t:Ut(t,e)?[t]:fa(Qr(t))}var ut=jp;var $p=1/0;function Kp(t){if(typeof t=="string"||tt(t))return t;var e=t+"";return e=="0"&&1/t==-$p?"-0":e}var Ge=Kp;function Hp(t,e){e=ut(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Ge(e[r++])];return r&&r==n?t:void 0}var Wt=Hp;function zp(t,e,r){var n=t==null?void 0:Wt(t,e);return n===void 0?r:n}var ca=zp;function Vp(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}var jt=Vp;var ua=ne?ne.isConcatSpreadable:void 0;function Xp(t){return I(t)||it(t)||!!(ua&&t&&t[ua])}var pa=Xp;function ha(t,e,r,n,o){var i=-1,a=t.length;for(r||(r=pa),o||(o=[]);++i<a;){var s=t[i];e>0&&r(s)?e>1?ha(s,e-1,r,n,o):jt(o,s):n||(o[o.length]=s)}return o}var $t=ha;function Yp(t){var e=t==null?0:t.length;return e?$t(t,1):[]}var j=Yp;var qp=Zr(Object.getPrototypeOf,Object),en=qp;function Zp(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),r=r>o?o:r,r<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i}var Kt=Zp;function Jp(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:Kt(t,e,r)}var da=Jp;var Qp="\\ud800-\\udfff",eh="\\u0300-\\u036f",th="\\ufe20-\\ufe2f",rh="\\u20d0-\\u20ff",nh=eh+th+rh,oh="\\ufe0e\\ufe0f",ih="\\u200d",ah=RegExp("["+ih+Qp+nh+oh+"]");function sh(t){return ah.test(t)}var tn=sh;function lh(t){return t.split("")}var ma=lh;var ga="\\ud800-\\udfff",fh="\\u0300-\\u036f",ch="\\ufe20-\\ufe2f",uh="\\u20d0-\\u20ff",ph=fh+ch+uh,hh="\\ufe0e\\ufe0f",dh="["+ga+"]",po="["+ph+"]",ho="\\ud83c[\\udffb-\\udfff]",mh="(?:"+po+"|"+ho+")",xa="[^"+ga+"]",Ta="(?:\\ud83c[\\udde6-\\uddff]){2}",Ea="[\\ud800-\\udbff][\\udc00-\\udfff]",gh="\\u200d",Aa=mh+"?",Ia="["+hh+"]?",xh="(?:"+gh+"(?:"+[xa,Ta,Ea].join("|")+")"+Ia+Aa+")*",Th=Ia+Aa+xh,Eh="(?:"+[xa+po+"?",po,Ta,Ea,dh].join("|")+")",Ah=RegExp(ho+"(?="+ho+")|"+Eh+Th,"g");function Ih(t){return t.match(Ah)||[]}var Ra=Ih;function Rh(t){return tn(t)?Ra(t):ma(t)}var ya=Rh;function yh(t){return function(e){e=Qr(e);var r=tn(e)?ya(e):void 0,n=r?r[0]:e.charAt(0),o=r?da(r,1).join(""):e.slice(1);return n[t]()+o}}var Sa=yh;var Sh=Sa("toUpperCase"),rn=Sh;function Oh(t,e,r,n){var o=-1,i=t==null?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}var Oa=Oh;function Nh(){this.__data__=new lt,this.size=0}var Na=Nh;function _h(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var _a=_h;function Ch(t){return this.__data__.get(t)}var Ca=Ch;function vh(t){return this.__data__.has(t)}var va=vh;var Lh=200;function bh(t,e){var r=this.__data__;if(r instanceof lt){var n=r.__data__;if(!ft||n.length<Lh-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new It(n)}return r.set(t,e),this.size=r.size,this}var La=bh;function Ht(t){var e=this.__data__=new lt(t);this.size=e.size}Ht.prototype.clear=Na;Ht.prototype.delete=_a;Ht.prototype.get=Ca;Ht.prototype.has=va;Ht.prototype.set=La;var pt=Ht;function kh(t,e){return t&&Ue(e,P(e),t)}var ba=kh;function Ph(t,e){return t&&Ue(e,at(e),t)}var ka=Ph;var Fa=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pa=Fa&&typeof module=="object"&&module&&!module.nodeType&&module,Mh=Pa&&Pa.exports===Fa,Ma=Mh?Z.Buffer:void 0,wa=Ma?Ma.allocUnsafe:void 0;function wh(t,e){if(e)return t.slice();var r=t.length,n=wa?wa(r):new t.constructor(r);return t.copy(n),n}var Ua=wh;function Fh(t,e){for(var r=-1,n=t==null?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i}var zt=Fh;function Uh(){return[]}var nn=Uh;var Dh=Object.prototype,Bh=Dh.propertyIsEnumerable,Da=Object.getOwnPropertySymbols,Gh=Da?function(t){return t==null?[]:(t=Object(t),zt(Da(t),function(e){return Bh.call(t,e)}))}:nn,Vt=Gh;function Wh(t,e){return Ue(t,Vt(t),e)}var Ba=Wh;var jh=Object.getOwnPropertySymbols,$h=jh?function(t){for(var e=[];t;)jt(e,Vt(t)),t=en(t);return e}:nn,on=$h;function Kh(t,e){return Ue(t,on(t),e)}var Ga=Kh;function Hh(t,e,r){var n=e(t);return I(t)?n:jt(n,r(t))}var an=Hh;function zh(t){return an(t,P,Vt)}var Ir=zh;function Vh(t){return an(t,at,on)}var sn=Vh;var Xh=xe(Z,"DataView"),ln=Xh;var Yh=xe(Z,"Promise"),fn=Yh;var qh=xe(Z,"Set"),ht=qh;var Wa="[object Map]",Zh="[object Object]",ja="[object Promise]",$a="[object Set]",Ka="[object WeakMap]",Ha="[object DataView]",Jh=He(ln),Qh=He(ft),ed=He(fn),td=He(ht),rd=He(zr),Rt=pe;(ln&&Rt(new ln(new ArrayBuffer(1)))!=Ha||ft&&Rt(new ft)!=Wa||fn&&Rt(fn.resolve())!=ja||ht&&Rt(new ht)!=$a||zr&&Rt(new zr)!=Ka)&&(Rt=function(t){var e=pe(t),r=e==Zh?t.constructor:void 0,n=r?He(r):"";if(n)switch(n){case Jh:return Ha;case Qh:return Wa;case ed:return ja;case td:return $a;case rd:return Ka}return e});var ve=Rt;var nd=Object.prototype,od=nd.hasOwnProperty;function id(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&od.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var za=id;var ad=Z.Uint8Array,Xt=ad;function sd(t){var e=new t.constructor(t.byteLength);return new Xt(e).set(new Xt(t)),e}var Yt=sd;function ld(t,e){var r=e?Yt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var Va=ld;var fd=/\w*$/;function cd(t){var e=new t.constructor(t.source,fd.exec(t));return e.lastIndex=t.lastIndex,e}var Xa=cd;var Ya=ne?ne.prototype:void 0,qa=Ya?Ya.valueOf:void 0;function ud(t){return qa?Object(qa.call(t)):{}}var Za=ud;function pd(t,e){var r=e?Yt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Ja=pd;var hd="[object Boolean]",dd="[object Date]",md="[object Map]",gd="[object Number]",xd="[object RegExp]",Td="[object Set]",Ed="[object String]",Ad="[object Symbol]",Id="[object ArrayBuffer]",Rd="[object DataView]",yd="[object Float32Array]",Sd="[object Float64Array]",Od="[object Int8Array]",Nd="[object Int16Array]",_d="[object Int32Array]",Cd="[object Uint8Array]",vd="[object Uint8ClampedArray]",Ld="[object Uint16Array]",bd="[object Uint32Array]";function kd(t,e,r){var n=t.constructor;switch(e){case Id:return Yt(t);case hd:case dd:return new n(+t);case Rd:return Va(t,r);case yd:case Sd:case Od:case Nd:case _d:case Cd:case vd:case Ld:case bd:return Ja(t,r);case md:return new n;case gd:case Ed:return new n(t);case xd:return Xa(t);case Td:return new n;case Ad:return Za(t)}}var Qa=kd;function Pd(t){return typeof t.constructor=="function"&&!De(t)?Ii(en(t)):{}}var es=Pd;var Md="[object Map]";function wd(t){return V(t)&&ve(t)==Md}var ts=wd;var rs=Se&&Se.isMap,Fd=rs?Be(rs):ts,ns=Fd;var Ud="[object Set]";function Dd(t){return V(t)&&ve(t)==Ud}var os=Dd;var is=Se&&Se.isSet,Bd=is?Be(is):os,as=Bd;var Gd=1,Wd=2,jd=4,ss="[object Arguments]",$d="[object Array]",Kd="[object Boolean]",Hd="[object Date]",zd="[object Error]",ls="[object Function]",Vd="[object GeneratorFunction]",Xd="[object Map]",Yd="[object Number]",fs="[object Object]",qd="[object RegExp]",Zd="[object Set]",Jd="[object String]",Qd="[object Symbol]",em="[object WeakMap]",tm="[object ArrayBuffer]",rm="[object DataView]",nm="[object Float32Array]",om="[object Float64Array]",im="[object Int8Array]",am="[object Int16Array]",sm="[object Int32Array]",lm="[object Uint8Array]",fm="[object Uint8ClampedArray]",cm="[object Uint16Array]",um="[object Uint32Array]",M={};M[ss]=M[$d]=M[tm]=M[rm]=M[Kd]=M[Hd]=M[nm]=M[om]=M[im]=M[am]=M[sm]=M[Xd]=M[Yd]=M[fs]=M[qd]=M[Zd]=M[Jd]=M[Qd]=M[lm]=M[fm]=M[cm]=M[um]=!0;M[zd]=M[ls]=M[em]=!1;function cn(t,e,r,n,o,i){var a,s=e&Gd,l=e&Wd,f=e&jd;if(r&&(a=o?r(t,n,o,i):r(t)),a!==void 0)return a;if(!W(t))return t;var u=I(t);if(u){if(a=za(t),!s)return yi(t,a)}else{var c=ve(t),p=c==ls||c==Vd;if(ze(t))return Ua(t,s);if(c==fs||c==ss||p&&!o){if(a=l||p?{}:es(t),!s)return l?Ga(t,ka(a,t)):Ba(t,ba(a,t))}else{if(!M[c])return o?t:{};a=Qa(t,c,s)}}i||(i=new pt);var T=i.get(t);if(T)return T;i.set(t,a),as(t)?t.forEach(function(O){a.add(cn(O,e,r,O,t,i))}):ns(t)&&t.forEach(function(O,m){a.set(m,cn(O,e,r,m,t,i))});var R=f?l?sn:Ir:l?at:P,y=u?void 0:R(t);return Vr(y||t,function(O,m){y&&(m=O,O=t[m]),nt(a,m,cn(O,e,r,m,t,i))}),a}var cs=cn;var pm=4;function hm(t){return cs(t,pm)}var L=hm;function dm(t){for(var e=-1,r=t==null?0:t.length,n=0,o=[];++e<r;){var i=t[e];i&&(o[n++]=i)}return o}var We=dm;var mm="__lodash_hash_undefined__";function gm(t){return this.__data__.set(t,mm),this}var us=gm;function xm(t){return this.__data__.has(t)}var ps=xm;function un(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new It;++e<r;)this.add(t[e])}un.prototype.add=un.prototype.push=us;un.prototype.has=ps;var qt=un;function Tm(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 pn=Tm;function Em(t,e){return t.has(e)}var Zt=Em;var Am=1,Im=2;function Rm(t,e,r,n,o,i){var a=r&Am,s=t.length,l=e.length;if(s!=l&&!(a&&l>s))return!1;var f=i.get(t),u=i.get(e);if(f&&u)return f==e&&u==t;var c=-1,p=!0,T=r&Im?new qt:void 0;for(i.set(t,e),i.set(e,t);++c<s;){var R=t[c],y=e[c];if(n)var O=a?n(y,R,c,e,t,i):n(R,y,c,t,e,i);if(O!==void 0){if(O)continue;p=!1;break}if(T){if(!pn(e,function(m,g){if(!Zt(T,g)&&(R===m||o(R,m,r,n,i)))return T.push(g)})){p=!1;break}}else if(!(R===y||o(R,y,r,n,i))){p=!1;break}}return i.delete(t),i.delete(e),p}var hn=Rm;function ym(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}var hs=ym;function Sm(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Jt=Sm;var Om=1,Nm=2,_m="[object Boolean]",Cm="[object Date]",vm="[object Error]",Lm="[object Map]",bm="[object Number]",km="[object RegExp]",Pm="[object Set]",Mm="[object String]",wm="[object Symbol]",Fm="[object ArrayBuffer]",Um="[object DataView]",ds=ne?ne.prototype:void 0,mo=ds?ds.valueOf:void 0;function Dm(t,e,r,n,o,i,a){switch(r){case Um:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Fm:return!(t.byteLength!=e.byteLength||!i(new Xt(t),new Xt(e)));case _m:case Cm:case bm:return Fe(+t,+e);case vm:return t.name==e.name&&t.message==e.message;case km:case Mm:return t==e+"";case Lm:var s=hs;case Pm:var l=n&Om;if(s||(s=Jt),t.size!=e.size&&!l)return!1;var f=a.get(t);if(f)return f==e;n|=Nm,a.set(t,e);var u=hn(s(t),s(e),n,o,i,a);return a.delete(t),u;case wm:if(mo)return mo.call(t)==mo.call(e)}return!1}var ms=Dm;var Bm=1,Gm=Object.prototype,Wm=Gm.hasOwnProperty;function jm(t,e,r,n,o,i){var a=r&Bm,s=Ir(t),l=s.length,f=Ir(e),u=f.length;if(l!=u&&!a)return!1;for(var c=l;c--;){var p=s[c];if(!(a?p in e:Wm.call(e,p)))return!1}var T=i.get(t),R=i.get(e);if(T&&R)return T==e&&R==t;var y=!0;i.set(t,e),i.set(e,t);for(var O=a;++c<l;){p=s[c];var m=t[p],g=e[p];if(n)var d=a?n(g,m,p,e,t,i):n(m,g,p,t,e,i);if(!(d===void 0?m===g||o(m,g,r,n,i):d)){y=!1;break}O||(O=p=="constructor")}if(y&&!O){var E=t.constructor,k=e.constructor;E!=k&&"constructor"in t&&"constructor"in e&&!(typeof E=="function"&&E instanceof E&&typeof k=="function"&&k instanceof k)&&(y=!1)}return i.delete(t),i.delete(e),y}var gs=jm;var $m=1,xs="[object Arguments]",Ts="[object Array]",dn="[object Object]",Km=Object.prototype,Es=Km.hasOwnProperty;function Hm(t,e,r,n,o,i){var a=I(t),s=I(e),l=a?Ts:ve(t),f=s?Ts:ve(e);l=l==xs?dn:l,f=f==xs?dn:f;var u=l==dn,c=f==dn,p=l==f;if(p&&ze(t)){if(!ze(e))return!1;a=!0,u=!1}if(p&&!u)return i||(i=new pt),a||Ft(t)?hn(t,e,r,n,o,i):ms(t,e,l,r,n,o,i);if(!(r&$m)){var T=u&&Es.call(t,"__wrapped__"),R=c&&Es.call(e,"__wrapped__");if(T||R){var y=T?t.value():t,O=R?e.value():e;return i||(i=new pt),o(y,O,r,n,i)}}return p?(i||(i=new pt),gs(t,e,r,n,o,i)):!1}var As=Hm;function Is(t,e,r,n,o){return t===e?!0:t==null||e==null||!V(t)&&!V(e)?t!==t&&e!==e:As(t,e,r,n,Is,o)}var mn=Is;var zm=1,Vm=2;function Xm(t,e,r,n){var o=r.length,i=o,a=!n;if(t==null)return!i;for(t=Object(t);o--;){var s=r[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<i;){s=r[o];var l=s[0],f=t[l],u=s[1];if(a&&s[2]){if(f===void 0&&!(l in t))return!1}else{var c=new pt;if(n)var p=n(f,u,l,t,e,c);if(!(p===void 0?mn(u,f,zm|Vm,n,c):p))return!1}}return!0}var Rs=Xm;function Ym(t){return t===t&&!W(t)}var gn=Ym;function qm(t){for(var e=P(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,gn(o)]}return e}var ys=qm;function Zm(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var xn=Zm;function Jm(t){var e=ys(t);return e.length==1&&e[0][2]?xn(e[0][0],e[0][1]):function(r){return r===t||Rs(r,t,e)}}var Ss=Jm;function Qm(t,e){return t!=null&&e in Object(t)}var Os=Qm;function eg(t,e,r){e=ut(e,t);for(var n=-1,o=e.length,i=!1;++n<o;){var a=Ge(e[n]);if(!(i=t!=null&&r(t,a)))break;t=t[a]}return i||++n!=o?i:(o=t==null?0:t.length,!!o&&wt(o)&&rt(a,o)&&(I(t)||it(t)))}var Tn=eg;function tg(t,e){return t!=null&&Tn(t,e,Os)}var Ns=tg;var rg=1,ng=2;function og(t,e){return Ut(t)&&gn(e)?xn(Ge(t),e):function(r){var n=ca(r,t);return n===void 0&&n===e?Ns(r,t):mn(e,n,rg|ng)}}var _s=og;function ig(t){return function(e){return e?.[t]}}var Cs=ig;function ag(t){return function(e){return Wt(e,t)}}var vs=ag;function sg(t){return Ut(t)?Cs(Ge(t)):vs(t)}var Ls=sg;function lg(t){return typeof t=="function"?t:t==null?Ce:typeof t=="object"?I(t)?_s(t[0],t[1]):Ss(t):Ls(t)}var Q=lg;function fg(t,e,r,n){for(var o=-1,i=t==null?0:t.length;++o<i;){var a=t[o];e(n,a,r(a),t)}return n}var bs=fg;function cg(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),s=a.length;s--;){var l=a[t?s:++o];if(r(i[l],l,i)===!1)break}return e}}var ks=cg;var ug=ks(),Ps=ug;function pg(t,e){return t&&Ps(t,e,P)}var Ms=pg;function hg(t,e){return function(r,n){if(r==null)return r;if(!J(r))return t(r,n);for(var o=r.length,i=e?o:-1,a=Object(r);(e?i--:++i<o)&&n(a[i],i,a)!==!1;);return r}}var ws=hg;var dg=ws(Ms),Te=dg;function mg(t,e,r,n){return Te(t,function(o,i,a){e(n,o,r(o),a)}),n}var Fs=mg;function gg(t,e){return function(r,n){var o=I(r)?bs:Fs,i=e?e():{};return o(r,t,Q(n,2),i)}}var Us=gg;var Ds=Object.prototype,xg=Ds.hasOwnProperty,Tg=Mt(function(t,e){t=Object(t);var r=-1,n=e.length,o=n>2?e[2]:void 0;for(o&&ot(e[0],e[1],o)&&(n=1);++r<n;)for(var i=e[r],a=at(i),s=-1,l=a.length;++s<l;){var f=a[s],u=t[f];(u===void 0||Fe(u,Ds[f])&&!xg.call(t,f))&&(t[f]=i[f])}return t}),Qt=Tg;function Eg(t){return V(t)&&J(t)}var go=Eg;function Ag(t,e,r){for(var n=-1,o=t==null?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}var En=Ag;var Ig=200;function Rg(t,e,r,n){var o=-1,i=Yr,a=!0,s=t.length,l=[],f=e.length;if(!s)return l;r&&(e=Me(e,Be(r))),n?(i=En,a=!1):e.length>=Ig&&(i=Zt,a=!1,e=new qt(e));e:for(;++o<s;){var u=t[o],c=r==null?u:r(u);if(u=n||u!==0?u:0,a&&c===c){for(var p=f;p--;)if(e[p]===c)continue e;l.push(u)}else i(e,c,n)||l.push(u)}return l}var Bs=Rg;var yg=Mt(function(t,e){return go(t)?Bs(t,$t(e,1,go,!0)):[]}),dt=yg;function Sg(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var Le=Sg;function Og(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:we(e),Kt(t,e<0?0:e,n)):[]}var X=Og;function Ng(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:we(e),e=n-e,Kt(t,0,e<0?0:e)):[]}var Xe=Ng;function _g(t){return typeof t=="function"?t:Ce}var Gs=_g;function Cg(t,e){var r=I(t)?Vr:Te;return r(t,Gs(e))}var x=Cg;function vg(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 Ws=vg;function Lg(t,e){var r=!0;return Te(t,function(n,o,i){return r=!!e(n,o,i),r}),r}var js=Lg;function bg(t,e,r){var n=I(t)?Ws:js;return r&&ot(t,e,r)&&(e=void 0),n(t,Q(e,3))}var ae=bg;function kg(t,e){var r=[];return Te(t,function(n,o,i){e(n,o,i)&&r.push(n)}),r}var An=kg;function Pg(t,e){var r=I(t)?zt:An;return r(t,Q(e,3))}var se=Pg;function Mg(t){return function(e,r,n){var o=Object(e);if(!J(e)){var i=Q(r,3);e=P(e),r=function(s){return i(o[s],s,o)}}var a=t(e,r,n);return a>-1?o[i?e[a]:a]:void 0}}var $s=Mg;var wg=Math.max;function Fg(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var o=r==null?0:we(r);return o<0&&(o=wg(n+o,0)),Xr(t,Q(e,3),o)}var Ks=Fg;var Ug=$s(Ks),je=Ug;function Dg(t){return t&&t.length?t[0]:void 0}var oe=Dg;function Bg(t,e){var r=-1,n=J(t)?Array(t.length):[];return Te(t,function(o,i,a){n[++r]=e(o,i,a)}),n}var Hs=Bg;function Gg(t,e){var r=I(t)?Me:Hs;return r(t,Q(e,3))}var h=Gg;function Wg(t,e){return $t(h(t,e),1)}var de=Wg;var jg=Object.prototype,$g=jg.hasOwnProperty,Kg=Us(function(t,e,r){$g.call(t,r)?t[r].push(e):Pt(t,r,[e])}),Rr=Kg;var Hg=Object.prototype,zg=Hg.hasOwnProperty;function Vg(t,e){return t!=null&&zg.call(t,e)}var zs=Vg;function Xg(t,e){return t!=null&&Tn(t,e,zs)}var A=Xg;var Yg="[object String]";function qg(t){return typeof t=="string"||!I(t)&&V(t)&&pe(t)==Yg}var te=qg;function Zg(t,e){return Me(e,function(r){return t[r]})}var Vs=Zg;function Jg(t){return t==null?[]:Vs(t,P(t))}var C=Jg;var Qg=Math.max;function ex(t,e,r,n){t=J(t)?t:C(t),r=r&&!n?we(r):0;var o=t.length;return r<0&&(r=Qg(o+r,0)),te(t)?r<=o&&t.indexOf(e,r)>-1:!!o&&kt(t,e,r)>-1}var D=ex;var tx=Math.max;function rx(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var o=r==null?0:we(r);return o<0&&(o=tx(n+o,0)),kt(t,e,o)}var In=rx;var nx="[object Map]",ox="[object Set]",ix=Object.prototype,ax=ix.hasOwnProperty;function sx(t){if(t==null)return!0;if(J(t)&&(I(t)||typeof t=="string"||typeof t.splice=="function"||ze(t)||Ft(t)||it(t)))return!t.length;var e=ve(t);if(e==nx||e==ox)return!t.size;if(De(t))return!Jr(t).length;for(var r in t)if(ax.call(t,r))return!1;return!0}var N=sx;var lx="[object RegExp]";function fx(t){return V(t)&&pe(t)==lx}var Xs=fx;var Ys=Se&&Se.isRegExp,cx=Ys?Be(Ys):Xs,Oe=cx;function ux(t){return t===void 0}var le=ux;var px="Expected a function";function hx(t){if(typeof t!="function")throw new TypeError(px);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 qs=hx;function dx(t,e,r,n){if(!W(t))return t;e=ut(e,t);for(var o=-1,i=e.length,a=i-1,s=t;s!=null&&++o<i;){var l=Ge(e[o]),f=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(o!=a){var u=s[l];f=n?n(u,l,s):void 0,f===void 0&&(f=W(u)?u:rt(e[o+1])?[]:{})}nt(s,l,f),s=s[l]}return t}var Zs=dx;function mx(t,e,r){for(var n=-1,o=e.length,i={};++n<o;){var a=e[n],s=Wt(t,a);r(s,a)&&Zs(i,ut(a,t),s)}return i}var Js=mx;function gx(t,e){if(t==null)return{};var r=Me(sn(t),function(n){return[n]});return e=Q(e),Js(t,r,function(n,o){return e(n,o[0])})}var Ee=gx;function xx(t,e,r,n,o){return o(t,function(i,a,s){r=n?(n=!1,i):e(r,i,a,s)}),r}var Qs=xx;function Tx(t,e,r){var n=I(t)?Oa:Qs,o=arguments.length<3;return n(t,Q(e,4),r,o,Te)}var K=Tx;function Ex(t,e){var r=I(t)?zt:An;return r(t,qs(Q(e,3)))}var mt=Ex;function Ax(t,e){var r;return Te(t,function(n,o,i){return r=e(n,o,i),!r}),!!r}var el=Ax;function Ix(t,e,r){var n=I(t)?pn:el;return r&&ot(t,e,r)&&(e=void 0),n(t,Q(e,3))}var yt=Ix;var Rx=1/0,yx=ht&&1/Jt(new ht([,-0]))[1]==Rx?function(t){return new ht(t)}:$,tl=yx;var Sx=200;function Ox(t,e,r){var n=-1,o=Yr,i=t.length,a=!0,s=[],l=s;if(r)a=!1,o=En;else if(i>=Sx){var f=e?null:tl(t);if(f)return Jt(f);a=!1,o=Zt,l=new qt}else l=e?[]:s;e:for(;++n<i;){var u=t[n],c=e?e(u):u;if(u=r||u!==0?u:0,a&&c===c){for(var p=l.length;p--;)if(l[p]===c)continue e;e&&l.push(c),s.push(u)}else o(l,c,r)||(l!==s&&l.push(c),s.push(u))}return s}var rl=Ox;function Nx(t){return t&&t.length?rl(t):[]}var gt=Nx;function er(t){console&&console.error&&console.error(`Error: ${t}`)}function yr(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Sr(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function Or(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function _x(t){return Cx(t)?t.LABEL:t.name}function Cx(t){return te(t.LABEL)&&t.LABEL!==""}var Ie=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)})}},b=class extends Ie{constructor(e){super([]),this.idx=1,ee(this,Ee(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},me=class extends Ie{constructor(e){super(e.definition),this.orgText="",ee(this,Ee(e,r=>r!==void 0))}},w=class extends Ie{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,ee(this,Ee(e,r=>r!==void 0))}},U=class extends Ie{constructor(e){super(e.definition),this.idx=1,ee(this,Ee(e,r=>r!==void 0))}},Y=class extends Ie{constructor(e){super(e.definition),this.idx=1,ee(this,Ee(e,r=>r!==void 0))}},q=class extends Ie{constructor(e){super(e.definition),this.idx=1,ee(this,Ee(e,r=>r!==void 0))}},v=class extends Ie{constructor(e){super(e.definition),this.idx=1,ee(this,Ee(e,r=>r!==void 0))}},H=class extends Ie{constructor(e){super(e.definition),this.idx=1,ee(this,Ee(e,r=>r!==void 0))}},z=class extends Ie{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,ee(this,Ee(e,r=>r!==void 0))}},_=class{constructor(e){this.idx=1,ee(this,Ee(e,r=>r!==void 0))}accept(e){e.visit(this)}};function Rn(t){return h(t,tr)}function tr(t){function e(r){return h(r,tr)}if(t instanceof b){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return te(t.label)&&(r.label=t.label),r}else{if(t instanceof w)return{type:"Alternative",definition:e(t.definition)};if(t instanceof U)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Y)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof q)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:tr(new _({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof H)return{type:"RepetitionWithSeparator",idx:t.idx,separator:tr(new _({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof v)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof z)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof _){let r={type:"Terminal",name:t.terminalType.name,label:_x(t.terminalType),idx:t.idx};te(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=Oe(n)?n.source:n),r}else{if(t instanceof me)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var fe=class{visit(e){let r=e;switch(r.constructor){case b:return this.visitNonTerminal(r);case w:return this.visitAlternative(r);case U:return this.visitOption(r);case Y:return this.visitRepetitionMandatory(r);case q:return this.visitRepetitionMandatoryWithSeparator(r);case H:return this.visitRepetitionWithSeparator(r);case v:return this.visitRepetition(r);case z:return this.visitAlternation(r);case _:return this.visitTerminal(r);case me: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 xo(t){return t instanceof w||t instanceof U||t instanceof v||t instanceof Y||t instanceof q||t instanceof H||t instanceof _||t instanceof me}function St(t,e=[]){return t instanceof U||t instanceof v||t instanceof H?!0:t instanceof z?yt(t.definition,n=>St(n,e)):t instanceof b&&D(e,t)?!1:t instanceof Ie?(t instanceof b&&e.push(t),ae(t.definition,n=>St(n,e))):!1}function To(t){return t instanceof z}function Ae(t){if(t instanceof b)return"SUBRULE";if(t instanceof U)return"OPTION";if(t instanceof z)return"OR";if(t instanceof Y)return"AT_LEAST_ONE";if(t instanceof q)return"AT_LEAST_ONE_SEP";if(t instanceof H)return"MANY_SEP";if(t instanceof v)return"MANY";if(t instanceof _)return"CONSUME";throw Error("non exhaustive match")}var Ye=class{walk(e,r=[]){x(e.definition,(n,o)=>{let i=X(e.definition,o+1);if(n instanceof b)this.walkProdRef(n,i,r);else if(n instanceof _)this.walkTerminal(n,i,r);else if(n instanceof w)this.walkFlat(n,i,r);else if(n instanceof U)this.walkOption(n,i,r);else if(n instanceof Y)this.walkAtLeastOne(n,i,r);else if(n instanceof q)this.walkAtLeastOneSep(n,i,r);else if(n instanceof H)this.walkManySep(n,i,r);else if(n instanceof v)this.walkMany(n,i,r);else if(n instanceof z)this.walkOr(n,i,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let o=r.concat(n);this.walk(e,o)}walkOption(e,r,n){let o=r.concat(n);this.walk(e,o)}walkAtLeastOne(e,r,n){let o=[new U({definition:e.definition})].concat(r,n);this.walk(e,o)}walkAtLeastOneSep(e,r,n){let o=nl(e,r,n);this.walk(e,o)}walkMany(e,r,n){let o=[new U({definition:e.definition})].concat(r,n);this.walk(e,o)}walkManySep(e,r,n){let o=nl(e,r,n);this.walk(e,o)}walkOr(e,r,n){let o=r.concat(n);x(e.definition,i=>{let a=new w({definition:[i]});this.walk(a,o)})}};function nl(t,e,r){return[new U({definition:[new _({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function Ot(t){if(t instanceof b)return Ot(t.referencedRule);if(t instanceof _)return bx(t);if(xo(t))return vx(t);if(To(t))return Lx(t);throw Error("non exhaustive match")}function vx(t){let e=[],r=t.definition,n=0,o=r.length>n,i,a=!0;for(;o&&a;)i=r[n],a=St(i),e=e.concat(Ot(i)),n=n+1,o=r.length>n;return gt(e)}function Lx(t){let e=h(t.definition,r=>Ot(r));return gt(j(e))}function bx(t){return[t.terminalType]}var yn="_~IN~_";var Eo=class extends Ye{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 o=kx(e.referencedRule,e.idx)+this.topProd.name,i=r.concat(n),a=new w({definition:i}),s=Ot(a);this.follows[o]=s}};function ol(t){let e={};return x(t,r=>{let n=new Eo(r).startWalking();ee(e,n)}),e}function kx(t,e){return t.name+e+yn}function S(t){return t.charCodeAt(0)}function Sn(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function rr(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Nt(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function Nr(){throw Error("Internal Error - Should never get here!")}function Ao(t){return t.type==="Character"}var _r=[];for(let t=S("0");t<=S("9");t++)_r.push(t);var Cr=[S("_")].concat(_r);for(let t=S("a");t<=S("z");t++)Cr.push(t);for(let t=S("A");t<=S("Z");t++)Cr.push(t);var Io=[S(" "),S("\f"),S(`
|
|
`),S("\r"),S(" "),S("\v"),S(" "),S("\xA0"),S("\u1680"),S("\u2000"),S("\u2001"),S("\u2002"),S("\u2003"),S("\u2004"),S("\u2005"),S("\u2006"),S("\u2007"),S("\u2008"),S("\u2009"),S("\u200A"),S("\u2028"),S("\u2029"),S("\u202F"),S("\u205F"),S("\u3000"),S("\uFEFF")];var Px=/[0-9a-fA-F]/,On=/[0-9]/,Mx=/[1-9]/,vr=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":rr(n,"global");break;case"i":rr(n,"ignoreCase");break;case"m":rr(n,"multiLine");break;case"u":rr(n,"unicode");break;case"y":rr(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;case"<":{switch(this.popChar()){case"=":r="Lookbehind";break;case"!":r="NegativeLookbehind"}break}}Nt(r);let n=this.disjunction();return this.consumeChar(")"),{type:r,value:n,loc:this.loc(e)}}return Nr()}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 o=this.integerIncludingZero();switch(this.popChar()){case"}":r={atLeast:o,atMost:o};break;case",":let i;this.isDigit()?(i=this.integerIncludingZero(),r={atLeast:o,atMost:i}):r={atLeast:o,atMost:1/0},this.consumeChar("}");break}if(e===!0&&r===void 0)return;Nt(r);break}if(!(e===!0&&r===void 0)&&Nt(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()),Nt(e)?(e.loc=this.loc(r),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):Nr()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[S(`
|
|
`),S("\r"),S("\u2028"),S("\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=_r;break;case"D":e=_r,r=!0;break;case"s":e=Io;break;case"S":e=Io,r=!0;break;case"w":e=Cr;break;case"W":e=Cr,r=!0;break}return Nt(e)?{type:"Set",value:e,complement:r}:Nr()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=S("\f");break;case"n":e=S(`
|
|
`);break;case"r":e=S("\r");break;case"t":e=S(" ");break;case"v":e=S("\v");break}return Nt(e)?{type:"Character",value:e}:Nr()}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:S("\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:S(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:let e=this.popChar();return{type:"Character",value:S(e)}}}characterClass(){let e=[],r=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),r=!0);this.isClassAtom();){let n=this.classAtom(),o=n.type==="Character";if(Ao(n)&&this.isRangeDash()){this.consumeChar("-");let i=this.classAtom(),a=i.type==="Character";if(Ao(i)){if(i.value<n.value)throw Error("Range out of order in character class");e.push({from:n.value,to:i.value})}else Sn(n.value,e),e.push(S("-")),Sn(i.value,e)}else Sn(n.value,e)}return this.consumeChar("]"),{type:"Set",complement:r,value:e}}classAtom(){switch(this.peekChar()){case"]":case`
|
|
`:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:S("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let e=!0;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),e=!1):this.groupIdx++;let r=this.disjunction();this.consumeChar(")");let n={type:"Group",capturing:e,value:r};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(Mx.test(e)===!1)throw Error("Expecting a positive integer");for(;On.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(On.test(e)===!1)throw Error("Expecting an integer");for(;On.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
|
|
`:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:S(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return On.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case`
|
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!"||this.peekChar(2)==="<"&&(this.peekChar(3)==="="||this.peekChar(3)==="!"));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
|
|
`:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let r="";for(let o=0;o<e;o++){let i=this.popChar();if(Px.test(i)===!1)throw Error("Expecting a HexDecimal digits");r+=i}return{type:"Character",value:parseInt(r,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error("Expected: '"+e+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}};var xt=class{visitChildren(e){for(let r in e){let n=e[r];e.hasOwnProperty(r)&&(n.type!==void 0?this.visit(n):Array.isArray(n)&&n.forEach(o=>{this.visit(o)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Lookbehind":this.visitLookbehind(e);break;case"NegativeLookbehind":this.visitNegativeLookbehind(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}};var Nn={},wx=new vr;function nr(t){let e=t.toString();if(Nn.hasOwnProperty(e))return Nn[e];{let r=wx.pattern(e);return Nn[e]=r,r}}function il(){Nn={}}var sl="Complement Sets are not supported for first char optimization",Lr=`Unable to use "first char" lexer optimizations:
|
|
`;function ll(t,e=!1){try{let r=nr(t);return Ro(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===sl)e&&yr(`${Lr} Unable to optimize: < ${t.toString()} >
|
|
Complement Sets cannot be automatically optimized.
|
|
This will disable the lexer's first char optimizations.
|
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n="";e&&(n=`
|
|
This will disable the lexer's first char optimizations.
|
|
See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),er(`${Lr}
|
|
Failed parsing: < ${t.toString()} >
|
|
Using the @chevrotain/regexp-to-ast library
|
|
Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Ro(t,e,r){switch(t.type){case"Disjunction":for(let o=0;o<t.value.length;o++)Ro(t.value[o],e,r);break;case"Alternative":let n=t.value;for(let o=0;o<n.length;o++){let i=n[o];switch(i.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}let a=i;switch(a.type){case"Character":_n(a.value,e,r);break;case"Set":if(a.complement===!0)throw Error(sl);x(a.value,l=>{if(typeof l=="number")_n(l,e,r);else{let f=l;if(r===!0)for(let u=f.from;u<=f.to;u++)_n(u,e,r);else{for(let u=f.from;u<=f.to&&u<or;u++)_n(u,e,r);if(f.to>=or){let u=f.from>=or?f.from:or,c=f.to,p=$e(u),T=$e(c);for(let R=p;R<=T;R++)e[R]=R}}}});break;case"Group":Ro(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"&&yo(a)===!1||a.type!=="Group"&&s===!1)break}break;default:throw Error("non exhaustive match!")}return C(e)}function _n(t,e,r){let n=$e(t);e[n]=n,r===!0&&Fx(t,e)}function Fx(t,e){let r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){let o=$e(n.charCodeAt(0));e[o]=o}else{let o=r.toLowerCase();if(o!==r){let i=$e(o.charCodeAt(0));e[i]=i}}}function al(t,e){return je(t.value,r=>{if(typeof r=="number")return D(e,r);{let n=r;return je(e,o=>n.from<=o&&o<=n.to)!==void 0}})}function yo(t){let e=t.quantifier;return e&&e.atLeast===0?!0:t.value?I(t.value)?ae(t.value,yo):yo(t.value):!1}var So=class extends xt{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;case"Lookbehind":this.visitLookbehind(e);return;case"NegativeLookbehind":this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){D(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?al(e,this.targetCharCodes)===void 0&&(this.found=!0):al(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Cn(t,e){if(e instanceof RegExp){let r=nr(e),n=new So(t);return n.visit(r),n.found}else return je(e,r=>D(t,r.charCodeAt(0)))!==void 0}var _t="PATTERN",ir="defaultMode",vn="modes";function cl(t,e){e=Qt(e,{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
|
|
`],tracer:(g,d)=>d()});let r=e.tracer;r("initCharCodeToOptimizedIndexMap",()=>{tT()});let n;r("Reject Lexer.NA",()=>{n=mt(t,g=>g[_t]===ie.NA)});let o=!1,i;r("Transform Patterns",()=>{o=!1,i=h(n,g=>{let d=g[_t];if(Oe(d)){let E=d.source;return E.length===1&&E!=="^"&&E!=="$"&&E!=="."&&!d.ignoreCase?E:E.length===2&&E[0]==="\\"&&!D(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],E[1])?E[1]:fl(d)}else{if(he(d))return o=!0,{exec:d};if(typeof d=="object")return o=!0,d;if(typeof d=="string"){if(d.length===1)return d;{let E=d.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),k=new RegExp(E);return fl(k)}}else throw Error("non exhaustive match")}})});let a,s,l,f,u;r("misc mapping",()=>{a=h(n,g=>g.tokenTypeIdx),s=h(n,g=>{let d=g.GROUP;if(d!==ie.SKIPPED){if(te(d))return d;if(le(d))return!1;throw Error("non exhaustive match")}}),l=h(n,g=>{let d=g.LONGER_ALT;if(d)return I(d)?h(d,k=>In(n,k)):[In(n,d)]}),f=h(n,g=>g.PUSH_MODE),u=h(n,g=>A(g,"POP_MODE"))});let c;r("Line Terminator Handling",()=>{let g=Tl(e.lineTerminatorCharacters);c=h(n,d=>!1),e.positionTracking!=="onlyOffset"&&(c=h(n,d=>A(d,"LINE_BREAKS")?!!d.LINE_BREAKS:xl(d,g)===!1&&Cn(g,d.PATTERN)))});let p,T,R,y;r("Misc Mapping #2",()=>{p=h(n,ml),T=h(i,Qx),R=K(n,(g,d)=>{let E=d.GROUP;return te(E)&&E!==ie.SKIPPED&&(g[E]=[]),g},{}),y=h(i,(g,d)=>({pattern:i[d],longerAlt:l[d],canLineTerminator:c[d],isCustom:p[d],short:T[d],group:s[d],push:f[d],pop:u[d],tokenTypeIdx:a[d],tokenType:n[d]}))});let O=!0,m=[];return e.safeMode||r("First Char Optimization",()=>{m=K(n,(g,d,E)=>{if(typeof d.PATTERN=="string"){let k=d.PATTERN.charCodeAt(0),Ne=$e(k);Oo(g,Ne,y[E])}else if(I(d.START_CHARS_HINT)){let k;x(d.START_CHARS_HINT,Ne=>{let Je=typeof Ne=="string"?Ne.charCodeAt(0):Ne,Et=$e(Je);k!==Et&&(k=Et,Oo(g,Et,y[E]))})}else if(Oe(d.PATTERN))if(d.PATTERN.unicode)O=!1,e.ensureOptimizations&&er(`${Lr} Unable to analyze < ${d.PATTERN.toString()} > pattern.
|
|
The regexp unicode flag is not currently supported by the regexp-to-ast library.
|
|
This will disable the lexer's first char optimizations.
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let k=ll(d.PATTERN,e.ensureOptimizations);N(k)&&(O=!1),x(k,Ne=>{Oo(g,Ne,y[E])})}else e.ensureOptimizations&&er(`${Lr} TokenType: <${d.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
|
|
This will disable the lexer's first char optimizations.
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),O=!1;return g},[])}),{emptyGroups:R,patternIdxToConfig:y,charCodeToPatternIdxToConfig:m,hasCustom:o,canBeOptimized:O}}function ul(t,e){let r=[],n=Dx(t);r=r.concat(n.errors);let o=Bx(n.valid),i=o.valid;return r=r.concat(o.errors),r=r.concat(Ux(i)),r=r.concat(Vx(i)),r=r.concat(Xx(i,e)),r=r.concat(Yx(i)),r}function Ux(t){let e=[],r=se(t,n=>Oe(n[_t]));return e=e.concat(Wx(r)),e=e.concat(Kx(r)),e=e.concat(Hx(r)),e=e.concat(zx(r)),e=e.concat(jx(r)),e}function Dx(t){let e=se(t,o=>!A(o,_t)),r=h(e,o=>({message:"Token Type: ->"+o.name+"<- missing static 'PATTERN' property",type:B.MISSING_PATTERN,tokenTypes:[o]})),n=dt(t,e);return{errors:r,valid:n}}function Bx(t){let e=se(t,o=>{let i=o[_t];return!Oe(i)&&!he(i)&&!A(i,"exec")&&!te(i)}),r=h(e,o=>({message:"Token Type: ->"+o.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:B.INVALID_PATTERN,tokenTypes:[o]})),n=dt(t,e);return{errors:r,valid:n}}var Gx=/[^\\][$]/;function Wx(t){class e extends xt{constructor(){super(...arguments),this.found=!1}visitEndAnchor(i){this.found=!0}}let r=se(t,o=>{let i=o.PATTERN;try{let a=nr(i),s=new e;return s.visit(a),s.found}catch{return Gx.test(i.source)}});return h(r,o=>({message:`Unexpected RegExp Anchor Error:
|
|
Token Type: ->`+o.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
|
|
See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:B.EOI_ANCHOR_FOUND,tokenTypes:[o]}))}function jx(t){let e=se(t,n=>n.PATTERN.test(""));return h(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' must not match an empty string",type:B.EMPTY_MATCH_PATTERN,tokenTypes:[n]}))}var $x=/[^\\[][\^]|^\^/;function Kx(t){class e extends xt{constructor(){super(...arguments),this.found=!1}visitStartAnchor(i){this.found=!0}}let r=se(t,o=>{let i=o.PATTERN;try{let a=nr(i),s=new e;return s.visit(a),s.found}catch{return $x.test(i.source)}});return h(r,o=>({message:`Unexpected RegExp Anchor Error:
|
|
Token Type: ->`+o.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:B.SOI_ANCHOR_FOUND,tokenTypes:[o]}))}function Hx(t){let e=se(t,n=>{let o=n[_t];return o instanceof RegExp&&(o.multiline||o.global)});return h(e,n=>({message:"Token Type: ->"+n.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:B.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[n]}))}function zx(t){let e=[],r=h(t,i=>K(t,(a,s)=>(i.PATTERN.source===s.PATTERN.source&&!D(e,s)&&s.PATTERN!==ie.NA&&(e.push(s),a.push(s)),a),[]));r=We(r);let n=se(r,i=>i.length>1);return h(n,i=>{let a=h(i,l=>l.name);return{message:`The same RegExp pattern ->${oe(i).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:B.DUPLICATE_PATTERNS_FOUND,tokenTypes:i}})}function Vx(t){let e=se(t,n=>{if(!A(n,"GROUP"))return!1;let o=n.GROUP;return o!==ie.SKIPPED&&o!==ie.NA&&!te(o)});return h(e,n=>({message:"Token Type: ->"+n.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:B.INVALID_GROUP_TYPE_FOUND,tokenTypes:[n]}))}function Xx(t,e){let r=se(t,o=>o.PUSH_MODE!==void 0&&!D(e,o.PUSH_MODE));return h(r,o=>({message:`Token Type: ->${o.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${o.PUSH_MODE}<-which does not exist`,type:B.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[o]}))}function Yx(t){let e=[],r=K(t,(n,o,i)=>{let a=o.PATTERN;return a===ie.NA||(te(a)?n.push({str:a,idx:i,tokenType:o}):Oe(a)&&Zx(a)&&n.push({str:a.source,idx:i,tokenType:o})),n},[]);return x(t,(n,o)=>{x(r,({str:i,idx:a,tokenType:s})=>{if(o<a&&qx(i,n.PATTERN)){let l=`Token: ->${s.name}<- can never be matched.
|
|
Because it appears AFTER the Token Type ->${n.name}<-in the lexer's definition.
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:B.UNREACHABLE_PATTERN,tokenTypes:[n,s]})}})}),e}function qx(t,e){if(Oe(e)){if(Jx(e))return!1;let r=e.exec(t);return r!==null&&r.index===0}else{if(he(e))return e(t,0,[],{});if(A(e,"exec"))return e.exec(t,0,[],{});if(typeof e=="string")return e===t;throw Error("non exhaustive match")}}function Zx(t){return je([".","\\","[","]","|","^","$","(",")","?","*","+","{"],r=>t.source.indexOf(r)!==-1)===void 0}function Jx(t){return/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source)}function fl(t){let e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function pl(t,e,r){let n=[];return A(t,ir)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+ir+`> property in its definition
|
|
`,type:B.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),A(t,vn)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+vn+`> property in its definition
|
|
`,type:B.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),A(t,vn)&&A(t,ir)&&!A(t.modes,t.defaultMode)&&n.push({message:`A MultiMode Lexer cannot be initialized with a ${ir}: <${t.defaultMode}>which does not exist
|
|
`,type:B.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),A(t,vn)&&x(t.modes,(o,i)=>{x(o,(a,s)=>{if(le(a))n.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${s}>
|
|
`,type:B.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(A(a,"LONGER_ALT")){let l=I(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];x(l,f=>{!le(f)&&!D(o,f)&&n.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${f.name}> on token <${a.name}> outside of mode <${i}>
|
|
`,type:B.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),n}function hl(t,e,r){let n=[],o=!1,i=We(j(C(t.modes))),a=mt(i,l=>l[_t]===ie.NA),s=Tl(r);return e&&x(a,l=>{let f=xl(l,s);if(f!==!1){let c={message:eT(l,f),type:f.issue,tokenType:l};n.push(c)}else A(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(o=!0):Cn(s,l.PATTERN)&&(o=!0)}),e&&!o&&n.push({message:`Warning: No LINE_BREAKS Found.
|
|
This Lexer has been defined to track line and column information,
|
|
But none of the Token Types can be identified as matching a line terminator.
|
|
See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
|
|
for details.`,type:B.NO_LINE_BREAKS_FLAGS}),n}function dl(t){let e={},r=P(t);return x(r,n=>{let o=t[n];if(I(o))e[n]=[];else throw Error("non exhaustive match")}),e}function ml(t){let e=t.PATTERN;if(Oe(e))return!1;if(he(e))return!0;if(A(e,"exec"))return!0;if(te(e))return!1;throw Error("non exhaustive match")}function Qx(t){return te(t)&&t.length===1?t.charCodeAt(0):!1}var gl={test:function(t){let e=t.length;for(let r=this.lastIndex;r<e;r++){let n=t.charCodeAt(r);if(n===10)return this.lastIndex=r+1,!0;if(n===13)return t.charCodeAt(r+1)===10?this.lastIndex=r+2:this.lastIndex=r+1,!0}return!1},lastIndex:0};function xl(t,e){if(A(t,"LINE_BREAKS"))return!1;if(Oe(t.PATTERN)){try{Cn(e,t.PATTERN)}catch(r){return{issue:B.IDENTIFY_TERMINATOR,errMsg:r.message}}return!1}else{if(te(t.PATTERN))return!1;if(ml(t))return{issue:B.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}}function eT(t,e){if(e.issue===B.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
|
|
The problem is in the <${t.name}> Token Type
|
|
Root cause: ${e.errMsg}.
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===B.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
|
|
The problem is in the <${t.name}> Token Type
|
|
For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function Tl(t){return h(t,r=>te(r)?r.charCodeAt(0):r)}function Oo(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}var or=256,Ln=[];function $e(t){return t<or?t:Ln[t]}function tT(){if(N(Ln)){Ln=new Array(65536);for(let t=0;t<65536;t++)Ln[t]=t>255?255+~~(t/255):t}}function qe(t,e){let r=t.tokenTypeIdx;return r===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[r]===!0}function ar(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}var El=1,Il={};function Ze(t){let e=rT(t);nT(e),iT(e),oT(e),x(e,r=>{r.isParent=r.categoryMatches.length>0})}function rT(t){let e=L(t),r=t,n=!0;for(;n;){r=We(j(h(r,i=>i.CATEGORIES)));let o=dt(r,e);e=e.concat(o),N(o)?n=!1:r=o}return e}function nT(t){x(t,e=>{No(e)||(Il[El]=e,e.tokenTypeIdx=El++),Al(e)&&!I(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Al(e)||(e.CATEGORIES=[]),aT(e)||(e.categoryMatches=[]),sT(e)||(e.categoryMatchesMap={})})}function oT(t){x(t,e=>{e.categoryMatches=[],x(e.categoryMatchesMap,(r,n)=>{e.categoryMatches.push(Il[n].tokenTypeIdx)})})}function iT(t){x(t,e=>{Rl([],e)})}function Rl(t,e){x(t,r=>{e.categoryMatchesMap[r.tokenTypeIdx]=!0}),x(e.CATEGORIES,r=>{let n=t.concat(e);D(n,r)||Rl(n,r)})}function No(t){return A(t,"tokenTypeIdx")}function Al(t){return A(t,"CATEGORIES")}function aT(t){return A(t,"categoryMatches")}function sT(t){return A(t,"categoryMatchesMap")}function yl(t){return A(t,"tokenTypeIdx")}var _o={buildUnableToPopLexerModeMessage(t){return`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(t,e,r,n,o,i){return`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${r} characters.`}};var B;(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"})(B||(B={}));var br={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
|
|
`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:_o,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(br);var ie=class{constructor(e,r=br){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=(o,i)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;let a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${a}--> <${o}>`);let{time:s,value:l}=Sr(i),f=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&f(`${a}<-- <${o}> time: ${s}ms`),this.traceInitIndent--,l}else return i()},typeof r=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
|
|
a boolean 2nd argument is no longer supported`);this.config=ee({},br,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 o,i=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===br.lineTerminatorsPattern)this.config.lineTerminatorsPattern=gl;else if(this.config.lineTerminatorCharacters===br.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
|
|
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),I(e)?o={modes:{defaultMode:L(e)},defaultMode:ir}:(i=!1,o=L(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(pl(o,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(hl(o,this.trackStartLines,this.config.lineTerminatorCharacters))})),o.modes=o.modes?o.modes:{},x(o.modes,(s,l)=>{o.modes[l]=mt(s,f=>le(f))});let a=P(o.modes);if(x(o.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(ul(s,a))}),N(this.lexerDefinitionErrors)){Ze(s);let f;this.TRACE_INIT("analyzeTokenTypes",()=>{f=cl(s,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:r.positionTracking,ensureOptimizations:r.ensureOptimizations,safeMode:r.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=f.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=f.charCodeToPatternIdxToConfig,this.emptyGroups=ee({},this.emptyGroups,f.emptyGroups),this.hasCustom=f.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=f.canBeOptimized}})}),this.defaultMode=o.defaultMode,!N(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){let l=h(this.lexerDefinitionErrors,f=>f.message).join(`-----------------------
|
|
`);throw new Error(`Errors detected in definition of Lexer:
|
|
`+l)}x(this.lexerDefinitionWarning,s=>{yr(s.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(i&&(this.handleModes=$),this.trackStartLines===!1&&(this.computeNewColumn=Ce),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=$),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{let s=K(this.canModeBeOptimized,(l,f,u)=>(f===!1&&l.push(u),l),[]);if(r.ensureOptimizations&&!N(s))throw Error(`Lexer Modes: < ${s.join(", ")} > cannot be optimized.
|
|
Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
|
|
Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{il()}),this.TRACE_INIT("toFastProperties",()=>{Or(this)})})}tokenize(e,r=this.defaultMode){if(!N(this.lexerDefinitionErrors)){let o=h(this.lexerDefinitionErrors,i=>i.message).join(`-----------------------
|
|
`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
|
|
`+o)}return this.tokenizeInternal(e,r)}tokenizeInternal(e,r){let n,o,i,a,s,l,f,u,c,p,T,R,y,O,m,g=e,d=g.length,E=0,k=0,Ne=this.hasCustom?0:Math.floor(e.length/10),Je=new Array(Ne),Et=[],dr=this.trackStartLines?1:void 0,Pe=this.trackStartLines?1:void 0,mr=dl(this.emptyGroups),Tf=this.trackStartLines,io=this.config.lineTerminatorsPattern,jr=0,Qe=[],gr=[],xr=[],Jo=[];Object.freeze(Jo);let Tr=!1,Ef=ge=>{if(xr.length===1&&ge.tokenType.PUSH_MODE===void 0){let Re=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ge);Et.push({offset:ge.startOffset,line:ge.startLine,column:ge.startColumn,length:ge.image.length,message:Re})}else{xr.pop();let Re=Le(xr);Qe=this.patternIdxToConfig[Re],gr=this.charCodeToPatternIdxToConfig[Re],jr=Qe.length;let ao=this.canModeBeOptimized[Re]&&this.config.safeMode===!1;gr&&ao?Tr=!0:Tr=!1}};function Qo(ge){xr.push(ge),gr=this.charCodeToPatternIdxToConfig[ge],Qe=this.patternIdxToConfig[ge],jr=Qe.length,jr=Qe.length;let Re=this.canModeBeOptimized[ge]&&this.config.safeMode===!1;gr&&Re?Tr=!0:Tr=!1}Qo.call(this,r);let _e,ei=this.config.recoveryEnabled;for(;E<d;){l=null,c=-1;let ge=g.charCodeAt(E),Re;if(Tr){let ue=$e(ge),ye=gr[ue];Re=ye!==void 0?ye:Jo}else Re=Qe;let ao=Re.length;for(n=0;n<ao;n++){_e=Re[n];let ue=_e.pattern;f=null;let ye=_e.short;if(ye!==!1?ge===ye&&(c=1,l=ue):_e.isCustom===!0?(m=ue.exec(g,E,Je,mr),m!==null?(l=m[0],c=l.length,m.payload!==void 0&&(f=m.payload)):l=null):(ue.lastIndex=E,c=this.matchLength(ue,e,E)),c!==-1){if(s=_e.longerAlt,s!==void 0){l=e.substring(E,E+c);let et=s.length;for(i=0;i<et;i++){let Ke=Qe[s[i]],At=Ke.pattern;if(u=null,Ke.isCustom===!0?(m=At.exec(g,E,Je,mr),m!==null?(a=m[0],m.payload!==void 0&&(u=m.payload)):a=null):(At.lastIndex=E,a=this.match(At,e,E)),a&&a.length>l.length){l=a,c=a.length,f=u,_e=Ke;break}}}break}}if(c!==-1){if(p=_e.group,p!==void 0&&(l=l!==null?l:e.substring(E,E+c),T=_e.tokenTypeIdx,R=this.createTokenInstance(l,E,T,_e.tokenType,dr,Pe,c),this.handlePayload(R,f),p===!1?k=this.addToken(Je,k,R):mr[p].push(R)),Tf===!0&&_e.canLineTerminator===!0){let ue=0,ye,et;io.lastIndex=0;do l=l!==null?l:e.substring(E,E+c),ye=io.test(l),ye===!0&&(et=io.lastIndex-1,ue++);while(ye===!0);ue!==0?(dr=dr+ue,Pe=c-et,this.updateTokenEndLineColumnLocation(R,p,et,ue,dr,Pe,c)):Pe=this.computeNewColumn(Pe,c)}else Pe=this.computeNewColumn(Pe,c);E=E+c,this.handleModes(_e,Ef,Qo,R)}else{let ue=E,ye=dr,et=Pe,Ke=ei===!1;for(;Ke===!1&&E<d;)for(E++,o=0;o<jr;o++){let At=Qe[o],so=At.pattern,ti=At.short;if(ti!==!1?g.charCodeAt(E)===ti&&(Ke=!0):At.isCustom===!0?Ke=so.exec(g,E,Je,mr)!==null:(so.lastIndex=E,Ke=so.exec(e)!==null),Ke===!0)break}if(y=E-ue,Pe=this.computeNewColumn(Pe,y),O=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(g,ue,y,ye,et,Le(xr)),Et.push({offset:ue,line:ye,column:et,length:y,message:O}),ei===!1)break}}return this.hasCustom||(Je.length=k),{tokens:Je,groups:mr,errors:Et}}handleModes(e,r,n,o){if(e.pop===!0){let i=e.push;r(o),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,r,n,o,i,a,s){let l,f;r!==void 0&&(l=n===s-1,f=l?-1:0,o===1&&l===!0||(e.endLine=i+f,e.endColumn=a-1+-f))}computeNewColumn(e,r){return e+r}createOffsetOnlyToken(e,r,n,o){return{image:e,startOffset:r,tokenTypeIdx:n,tokenType:o}}createStartOnlyToken(e,r,n,o,i,a){return{image:e,startOffset:r,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:o}}createFullToken(e,r,n,o,i,a,s){return{image:e,startOffset:r,endOffset:r+s-1,startLine:i,endLine:i,startColumn:a,endColumn:a+s-1,tokenTypeIdx:n,tokenType:o}}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)}match(e,r,n){return e.test(r)===!0?r.substring(n,e.lastIndex):null}matchLength(e,r,n){return e.test(r)===!0?e.lastIndex-n:-1}};ie.SKIPPED="This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.";ie.NA=/NOT_APPLICABLE/;function Ct(t){return Co(t)?t.LABEL:t.name}function lT(t){return t.name}function Co(t){return te(t.LABEL)&&t.LABEL!==""}var fT="parent",Sl="categories",Ol="label",Nl="group",_l="push_mode",Cl="pop_mode",vl="longer_alt",Ll="line_breaks",bl="start_chars_hint";function bn(t){return cT(t)}function cT(t){let e=t.pattern,r={};if(r.name=t.name,le(e)||(r.PATTERN=e),A(t,fT))throw`The parent property is no longer supported.
|
|
See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return A(t,Sl)&&(r.CATEGORIES=t[Sl]),Ze([r]),A(t,Ol)&&(r.LABEL=t[Ol]),A(t,Nl)&&(r.GROUP=t[Nl]),A(t,Cl)&&(r.POP_MODE=t[Cl]),A(t,_l)&&(r.PUSH_MODE=t[_l]),A(t,vl)&&(r.LONGER_ALT=t[vl]),A(t,Ll)&&(r.LINE_BREAKS=t[Ll]),A(t,bl)&&(r.START_CHARS_HINT=t[bl]),r}var be=bn({name:"EOF",pattern:ie.NA});Ze([be]);function vt(t,e,r,n,o,i,a,s){return{image:e,startOffset:r,endOffset:n,startLine:o,endLine:i,startColumn:a,endColumn:s,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}function vo(t,e){return qe(t,e)}var kn={buildMismatchTokenMessage({expected:t,actual:e,previous:r,ruleName:n}){return`Expecting ${Co(t)?`--> ${Ct(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:o}){let i="Expecting: ",s=`
|
|
but found: '`+oe(e).image+"'";if(n)return i+n+s;{let l=K(t,(p,T)=>p.concat(T),[]),f=h(l,p=>`[${h(p,T=>Ct(T)).join(", ")}]`),c=`one of these possible Token sequences:
|
|
${h(f,(p,T)=>` ${T+1}. ${p}`).join(`
|
|
`)}`;return i+c+s}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:r,ruleName:n}){let o="Expecting: ",a=`
|
|
but found: '`+oe(e).image+"'";if(r)return o+r+a;{let l=`expecting at least one iteration which starts with one of these possible Token sequences::
|
|
<${h(t,f=>`[${h(f,u=>Ct(u)).join(",")}]`).join(" ,")}>`;return o+l+a}}};Object.freeze(kn);var kl={buildRuleNotFoundError(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
|
|
inside top level rule: ->`+t.name+"<-"}},ke={buildDuplicateFoundError(t,e){function r(u){return u instanceof _?u.terminalType.name:u instanceof b?u.nonTerminalName:""}let n=t.name,o=oe(e),i=o.idx,a=Ae(o),s=r(o),l=i>0,f=`->${a}${l?i:""}<- ${s?`with argument: ->${s}<-`:""}
|
|
appears more than once (${e.length} times) in the top level rule: ->${n}<-.
|
|
For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
|
|
`;return f=f.replace(/[ \t]+/g," "),f=f.replace(/\s\s+/g,`
|
|
`),f},buildNamespaceConflictError(t){return`Namespace conflict found in grammar.
|
|
The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
|
|
To resolve this make sure each Terminal and Non-Terminal names are unique
|
|
This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
|
|
and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(t){let e=h(t.prefixPath,o=>Ct(o)).join(", "),r=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
|
|
in <OR${r}> inside <${t.topLevelRule.name}> Rule,
|
|
<${e}> may appears as a prefix path in all these alternatives.
|
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
|
|
For Further details.`},buildAlternationAmbiguityError(t){let e=t.alternation.idx===0?"":t.alternation.idx,r=t.prefixPath.length===0,n=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${e}> inside <${t.topLevelRule.name}> Rule,
|
|
`;if(r)n+=`These alternatives are all empty (match no tokens), making them indistinguishable.
|
|
Only the last alternative may be empty.
|
|
`;else{let o=h(t.prefixPath,i=>Ct(i)).join(", ");n+=`<${o}> may appears as a prefix path in all these alternatives.
|
|
`}return n+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
|
|
For Further details.`,n},buildEmptyRepetitionError(t){let e=Ae(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
|
|
This could lead to an infinite loop.`},buildTokenNameError(t){return"deprecated"},buildEmptyAlternationError(t){return`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(t){return`An Alternation cannot have more than 256 alternatives:
|
|
<OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
|
|
has ${t.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(t){let e=t.topLevelRule.name,r=h(t.leftRecursionPath,i=>i.name),n=`${e} --> ${r.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar.
|
|
rule: <${e}> can be invoked from itself (directly or indirectly)
|
|
without consuming any Tokens. The grammar path that causes this is:
|
|
${n}
|
|
To fix this refactor your grammar to remove the left recursion.
|
|
see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(t){return"deprecated"},buildDuplicateRuleNameError(t){let e;return t.topLevelRule instanceof me?e=t.topLevelRule.name:e=t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};function Pl(t,e){let r=new Lo(t,e);return r.resolveRefs(),r.errors}var Lo=class extends fe{constructor(e,r){super(),this.nameToTopRule=e,this.errMsgProvider=r,this.errors=[]}resolveRefs(){x(C(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:re.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}};var bo=class extends Ye{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=L(this.path.ruleStack).reverse(),this.occurrenceStack=L(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 o=r.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,o)}}updateExpectedNext(){N(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},Pn=class extends bo{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 o=r.concat(n),i=new w({definition:o});this.possibleTokTypes=Ot(i),this.found=!0}}},sr=class extends Ye{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}},Mn=class extends sr{walkMany(e,r,n){if(e.idx===this.occurrence){let o=oe(r.concat(n));this.result.isEndOfRule=o===void 0,o instanceof _&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else super.walkMany(e,r,n)}},kr=class extends sr{walkManySep(e,r,n){if(e.idx===this.occurrence){let o=oe(r.concat(n));this.result.isEndOfRule=o===void 0,o instanceof _&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else super.walkManySep(e,r,n)}},wn=class extends sr{walkAtLeastOne(e,r,n){if(e.idx===this.occurrence){let o=oe(r.concat(n));this.result.isEndOfRule=o===void 0,o instanceof _&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else super.walkAtLeastOne(e,r,n)}},Pr=class extends sr{walkAtLeastOneSep(e,r,n){if(e.idx===this.occurrence){let o=oe(r.concat(n));this.result.isEndOfRule=o===void 0,o instanceof _&&(this.result.token=o.terminalType,this.result.occurrence=o.idx)}else super.walkAtLeastOneSep(e,r,n)}};function Fn(t,e,r=[]){r=L(r);let n=[],o=0;function i(s){return s.concat(X(t,o+1))}function a(s){let l=Fn(i(s),e,r);return n.concat(l)}for(;r.length<e&&o<t.length;){let s=t[o];if(s instanceof w)return a(s.definition);if(s instanceof b)return a(s.definition);if(s instanceof U)n=a(s.definition);else if(s instanceof Y){let l=s.definition.concat([new v({definition:s.definition})]);return a(l)}else if(s instanceof q){let l=[new w({definition:s.definition}),new v({definition:[new _({terminalType:s.separator})].concat(s.definition)})];return a(l)}else if(s instanceof H){let l=s.definition.concat([new v({definition:[new _({terminalType:s.separator})].concat(s.definition)})]);n=a(l)}else if(s instanceof v){let l=s.definition.concat([new v({definition:s.definition})]);n=a(l)}else{if(s instanceof z)return x(s.definition,l=>{N(l.definition)===!1&&(n=a(l.definition))}),n;if(s instanceof _)r.push(s.terminalType);else throw Error("non exhaustive match")}o++}return n.push({partialPath:r,suffixDef:X(t,o)}),n}function Un(t,e,r,n){let o="EXIT_NONE_TERMINAL",i=[o],a="EXIT_ALTERNATIVE",s=!1,l=e.length,f=l-n-1,u=[],c=[];for(c.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!N(c);){let p=c.pop();if(p===a){s&&Le(c).idx<=f&&c.pop();continue}let T=p.def,R=p.idx,y=p.ruleStack,O=p.occurrenceStack;if(N(T))continue;let m=T[0];if(m===o){let g={idx:R,def:X(T),ruleStack:Xe(y),occurrenceStack:Xe(O)};c.push(g)}else if(m instanceof _)if(R<l-1){let g=R+1,d=e[g];if(r(d,m.terminalType)){let E={idx:g,def:X(T),ruleStack:y,occurrenceStack:O};c.push(E)}}else if(R===l-1)u.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:y,occurrenceStack:O}),s=!0;else throw Error("non exhaustive match");else if(m instanceof b){let g=L(y);g.push(m.nonTerminalName);let d=L(O);d.push(m.idx);let E={idx:R,def:m.definition.concat(i,X(T)),ruleStack:g,occurrenceStack:d};c.push(E)}else if(m instanceof U){let g={idx:R,def:X(T),ruleStack:y,occurrenceStack:O};c.push(g),c.push(a);let d={idx:R,def:m.definition.concat(X(T)),ruleStack:y,occurrenceStack:O};c.push(d)}else if(m instanceof Y){let g=new v({definition:m.definition,idx:m.idx}),d=m.definition.concat([g],X(T)),E={idx:R,def:d,ruleStack:y,occurrenceStack:O};c.push(E)}else if(m instanceof q){let g=new _({terminalType:m.separator}),d=new v({definition:[g].concat(m.definition),idx:m.idx}),E=m.definition.concat([d],X(T)),k={idx:R,def:E,ruleStack:y,occurrenceStack:O};c.push(k)}else if(m instanceof H){let g={idx:R,def:X(T),ruleStack:y,occurrenceStack:O};c.push(g),c.push(a);let d=new _({terminalType:m.separator}),E=new v({definition:[d].concat(m.definition),idx:m.idx}),k=m.definition.concat([E],X(T)),Ne={idx:R,def:k,ruleStack:y,occurrenceStack:O};c.push(Ne)}else if(m instanceof v){let g={idx:R,def:X(T),ruleStack:y,occurrenceStack:O};c.push(g),c.push(a);let d=new v({definition:m.definition,idx:m.idx}),E=m.definition.concat([d],X(T)),k={idx:R,def:E,ruleStack:y,occurrenceStack:O};c.push(k)}else if(m instanceof z)for(let g=m.definition.length-1;g>=0;g--){let d=m.definition[g],E={idx:R,def:d.definition.concat(X(T)),ruleStack:y,occurrenceStack:O};c.push(E),c.push(a)}else if(m instanceof w)c.push({idx:R,def:m.definition.concat(X(T)),ruleStack:y,occurrenceStack:O});else if(m instanceof me)c.push(uT(m,R,y,O));else throw Error("non exhaustive match")}return u}function uT(t,e,r,n){let o=L(r);o.push(t.name);let i=L(n);return i.push(1),{idx:e,def:t.definition,ruleStack:o,occurrenceStack:i}}var G;(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"})(G||(G={}));function Mr(t){if(t instanceof U||t==="Option")return G.OPTION;if(t instanceof v||t==="Repetition")return G.REPETITION;if(t instanceof Y||t==="RepetitionMandatory")return G.REPETITION_MANDATORY;if(t instanceof q||t==="RepetitionMandatoryWithSeparator")return G.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof H||t==="RepetitionWithSeparator")return G.REPETITION_WITH_SEPARATOR;if(t instanceof z||t==="Alternation")return G.ALTERNATION;throw Error("non exhaustive match")}function pT(t){let{occurrence:e,rule:r,prodType:n,maxLookahead:o}=t,i=Mr(n);return i===G.ALTERNATION?lr(e,r,o):fr(e,r,i,o)}function wl(t,e,r,n,o,i){let a=lr(t,e,r),s=Wl(a)?ar:qe;return i(a,n,s,o)}function Fl(t,e,r,n,o,i){let a=fr(t,e,o,r),s=Wl(a)?ar:qe;return i(a[0],s,n)}function Ul(t,e,r,n){let o=t.length,i=ae(t,a=>ae(a,s=>s.length===1));if(e)return function(a){let s=h(a,l=>l.GATE);for(let l=0;l<o;l++){let f=t[l],u=f.length,c=s[l];if(!(c!==void 0&&c.call(this)===!1))e:for(let p=0;p<u;p++){let T=f[p],R=T.length;for(let y=0;y<R;y++){let O=this.LA(y+1);if(r(O,T[y])===!1)continue e}return l}}};if(i&&!n){let a=h(t,l=>j(l)),s=K(a,(l,f,u)=>(x(f,c=>{A(l,c.tokenTypeIdx)||(l[c.tokenTypeIdx]=u),x(c.categoryMatches,p=>{A(l,p)||(l[p]=u)})}),l),{});return function(){let l=this.LA(1);return s[l.tokenTypeIdx]}}else return function(){for(let a=0;a<o;a++){let s=t[a],l=s.length;e:for(let f=0;f<l;f++){let u=s[f],c=u.length;for(let p=0;p<c;p++){let T=this.LA(p+1);if(r(T,u[p])===!1)continue e}return a}}}}function Dl(t,e,r){let n=ae(t,i=>i.length===1),o=t.length;if(n&&!r){let i=j(t);if(i.length===1&&N(i[0].categoryMatches)){let s=i[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}else{let a=K(i,(s,l,f)=>(s[l.tokenTypeIdx]=!0,x(l.categoryMatches,u=>{s[u]=!0}),s),[]);return function(){let s=this.LA(1);return a[s.tokenTypeIdx]===!0}}}else return function(){e:for(let i=0;i<o;i++){let a=t[i],s=a.length;for(let l=0;l<s;l++){let f=this.LA(l+1);if(e(f,a[l])===!1)continue e}return!0}return!1}}var Po=class extends Ye{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,o){return e.idx===this.targetOccurrence&&this.targetProdType===r?(this.restDef=n.concat(o),!0):!1}walkOption(e,r,n){this.checkIsTarget(e,G.OPTION,r,n)||super.walkOption(e,r,n)}walkAtLeastOne(e,r,n){this.checkIsTarget(e,G.REPETITION_MANDATORY,r,n)||super.walkOption(e,r,n)}walkAtLeastOneSep(e,r,n){this.checkIsTarget(e,G.REPETITION_MANDATORY_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}walkMany(e,r,n){this.checkIsTarget(e,G.REPETITION,r,n)||super.walkOption(e,r,n)}walkManySep(e,r,n){this.checkIsTarget(e,G.REPETITION_WITH_SEPARATOR,r,n)||super.walkOption(e,r,n)}},Dn=class extends fe{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,G.OPTION)}visitRepetition(e){this.checkIsTarget(e,G.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,G.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,G.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,G.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,G.ALTERNATION)}};function Ml(t){let e=new Array(t);for(let r=0;r<t;r++)e[r]=[];return e}function ko(t){let e=[""];for(let r=0;r<t.length;r++){let n=t[r],o=[];for(let i=0;i<e.length;i++){let a=e[i];o.push(a+"_"+n.tokenTypeIdx);for(let s=0;s<n.categoryMatches.length;s++){let l="_"+n.categoryMatches[s];o.push(a+l)}}e=o}return e}function hT(t,e,r){for(let n=0;n<t.length;n++){if(n===r)continue;let o=t[n];for(let i=0;i<e.length;i++){let a=e[i];if(o[a]===!0)return!1}}return!0}function Bl(t,e){let r=h(t,a=>Fn([a],1)),n=Ml(r.length),o=h(r,a=>{let s={};return x(a,l=>{let f=ko(l.partialPath);x(f,u=>{s[u]=!0})}),s}),i=r;for(let a=1;a<=e;a++){let s=i;i=Ml(s.length);for(let l=0;l<s.length;l++){let f=s[l];for(let u=0;u<f.length;u++){let c=f[u].partialPath,p=f[u].suffixDef,T=ko(c);if(hT(o,T,l)||N(p)||c.length===e){let y=n[l];if(Bn(y,c)===!1){y.push(c);for(let O=0;O<T.length;O++){let m=T[O];o[l][m]=!0}}}else{let y=Fn(p,a+1,c);i[l]=i[l].concat(y),x(y,O=>{let m=ko(O.partialPath);x(m,g=>{o[l][g]=!0})})}}}}return n}function lr(t,e,r,n){let o=new Dn(t,G.ALTERNATION,n);return e.accept(o),Bl(o.result,r)}function fr(t,e,r,n){let o=new Dn(t,r);e.accept(o);let i=o.result,s=new Po(e,t,r).startWalking(),l=new w({definition:i}),f=new w({definition:s});return Bl([l,f],n)}function Bn(t,e){e:for(let r=0;r<t.length;r++){let n=t[r];if(n.length===e.length){for(let o=0;o<n.length;o++){let i=e[o],a=n[o];if((i===a||a.categoryMatchesMap[i.tokenTypeIdx]!==void 0)===!1)continue e}return!0}}return!1}function Gl(t,e){return t.length<e.length&&ae(t,(r,n)=>{let o=e[n];return r===o||o.categoryMatchesMap[r.tokenTypeIdx]})}function Wl(t){return ae(t,e=>ae(e,r=>ae(r,n=>N(n.categoryMatches))))}function jl(t){let e=t.lookaheadStrategy.validate({rules:t.rules,tokenTypes:t.tokenTypes,grammarName:t.grammarName});return h(e,r=>Object.assign({type:re.CUSTOM_LOOKAHEAD_VALIDATION},r))}function $l(t,e,r,n){let o=de(t,l=>dT(l,r)),i=AT(t,e,r),a=de(t,l=>xT(l,r)),s=de(t,l=>gT(l,t,n,r));return o.concat(i,a,s)}function dT(t,e){let r=new Mo;t.accept(r);let n=r.allProductions,o=Rr(n,mT),i=Ee(o,s=>s.length>1);return h(C(i),s=>{let l=oe(s),f=e.buildDuplicateFoundError(t,s),u=Ae(l),c={message:f,type:re.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:u,occurrence:l.idx},p=Kl(l);return p&&(c.parameter=p),c})}function mT(t){return`${Ae(t)}_#_${t.idx}_#_${Kl(t)}`}function Kl(t){return t instanceof _?t.terminalType.name:t instanceof b?t.nonTerminalName:""}var Mo=class extends fe{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 gT(t,e,r,n){let o=[];if(K(e,(a,s)=>s.name===t.name?a+1:a,0)>1){let a=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});o.push({message:a,type:re.DUPLICATE_RULE_NAME,ruleName:t.name})}return o}function Hl(t,e,r){let n=[],o;return D(e,t)||(o=`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:o,type:re.INVALID_RULE_OVERRIDE,ruleName:t})),n}function Fo(t,e,r,n=[]){let o=[],i=Gn(e.definition);if(N(i))return[];{let a=t.name;D(i,t)&&o.push({message:r.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:re.LEFT_RECURSION,ruleName:a});let l=dt(i,n.concat([t])),f=de(l,u=>{let c=L(n);return c.push(u),Fo(t,u,r,c)});return o.concat(f)}}function Gn(t){let e=[];if(N(t))return e;let r=oe(t);if(r instanceof b)e.push(r.referencedRule);else if(r instanceof w||r instanceof U||r instanceof Y||r instanceof q||r instanceof H||r instanceof v)e=e.concat(Gn(r.definition));else if(r instanceof z)e=j(h(r.definition,i=>Gn(i.definition)));else if(!(r instanceof _))throw Error("non exhaustive match");let n=St(r),o=t.length>1;if(n&&o){let i=X(t);return e.concat(Gn(i))}else return e}var wr=class extends fe{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function zl(t,e){let r=new wr;t.accept(r);let n=r.alternations;return de(n,i=>{let a=Xe(i.definition);return de(a,(s,l)=>{let f=Un([s],[],qe,1);return N(f)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:i,emptyChoiceIdx:l}),type:re.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:i.idx,alternative:l+1}]:[]})})}function Vl(t,e,r){let n=new wr;t.accept(n);let o=n.alternations;return o=mt(o,a=>a.ignoreAmbiguities===!0),de(o,a=>{let s=a.idx,l=a.maxLookahead||e,f=lr(s,t,l,a),u=TT(f,a,t,r),c=ET(f,a,t,r);return u.concat(c)})}var wo=class extends fe{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 xT(t,e){let r=new wr;t.accept(r);let n=r.alternations;return de(n,i=>i.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:i}),type:re.TOO_MANY_ALTS,ruleName:t.name,occurrence:i.idx}]:[])}function Xl(t,e,r){let n=[];return x(t,o=>{let i=new wo;o.accept(i);let a=i.allProductions;x(a,s=>{let l=Mr(s),f=s.maxLookahead||e,u=s.idx,p=fr(u,o,l,f)[0];if(N(j(p))){let T=r.buildEmptyRepetitionError({topLevelRule:o,repetition:s});n.push({message:T,type:re.NO_NON_EMPTY_LOOKAHEAD,ruleName:o.name})}})}),n}function TT(t,e,r,n){let o=[],i=K(t,(s,l,f)=>(e.definition[f].ignoreAmbiguities===!0||x(l,u=>{let c=[f];x(t,(p,T)=>{f!==T&&Bn(p,u)&&e.definition[T].ignoreAmbiguities!==!0&&c.push(T)}),c.length>1&&!Bn(o,u)&&(o.push(u),s.push({alts:c,path:u}))}),s),[]);return h(i,s=>{let l=h(s.alts,u=>u+1);return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:l,prefixPath:s.path}),type:re.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:s.alts}})}function ET(t,e,r,n){let o=K(t,(a,s,l)=>{let f=h(s,u=>({idx:l,path:u}));return a.concat(f)},[]);return We(de(o,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];let l=a.idx,f=a.path,u=se(o,p=>e.definition[p.idx].ignoreAmbiguities!==!0&&p.idx<l&&Gl(p.path,f));return h(u,p=>{let T=[p.idx+1,l+1],R=e.idx===0?"":e.idx;return{message:n.buildAlternationPrefixAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:T,prefixPath:p.path}),type:re.AMBIGUOUS_PREFIX_ALTS,ruleName:r.name,occurrence:R,alternatives:T}})}))}function AT(t,e,r){let n=[],o=h(e,i=>i.name);return x(t,i=>{let a=i.name;if(D(o,a)){let s=r.buildNamespaceConflictError(i);n.push({message:s,type:re.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),n}function Yl(t){let e=Qt(t,{errMsgProvider:kl}),r={};return x(t.rules,n=>{r[n.name]=n}),Pl(r,e.errMsgProvider)}function ql(t){return t=Qt(t,{errMsgProvider:ke}),$l(t.rules,t.tokenTypes,t.errMsgProvider,t.grammarName)}var Zl="MismatchedTokenException",Jl="NoViableAltException",Ql="EarlyExitException",ef="NotAllInputParsedException",tf=[Zl,Jl,Ql,ef];Object.freeze(tf);function Tt(t){return D(tf,t.name)}var cr=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)}},Lt=class extends cr{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Zl}},Fr=class extends cr{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Jl}},Ur=class extends cr{constructor(e,r){super(e,r),this.name=ef}},Dr=class extends cr{constructor(e,r,n){super(e,r),this.previousToken=n,this.name=Ql}};var Uo={},Bo="InRuleRecoveryException",Do=class extends Error{constructor(e){super(e),this.name=Bo}},Wn=class{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=A(e,"recoveryEnabled")?e.recoveryEnabled:ce.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=IT)}getTokenToInsert(e){let r=vt(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return r.isInsertedInRecovery=!0,r}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,r,n,o){let i=this.findReSyncTokenType(),a=this.exportLexerState(),s=[],l=!1,f=this.LA(1),u=this.LA(1),c=()=>{let p=this.LA(0),T=this.errorMessageProvider.buildMismatchTokenMessage({expected:o,actual:f,previous:p,ruleName:this.getCurrRuleFullName()}),R=new Lt(T,f,this.LA(0));R.resyncedTokens=Xe(s),this.SAVE_ERROR(R)};for(;!l;)if(this.tokenMatcher(u,o)){c();return}else if(n.call(this)){c(),e.apply(this,r);return}else this.tokenMatcher(u,i)?l=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,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 Do("sad sad panda")}canPerformInRuleRecovery(e,r){return this.canRecoverWithSingleTokenInsertion(e,r)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,r){if(!this.canTokenTypeBeInsertedInRecovery(e)||N(r))return!1;let n=this.LA(1);return je(r,i=>this.tokenMatcher(n,i))!==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 D(n,e)}findReSyncTokenType(){let e=this.flattenFollowSet(),r=this.LA(1),n=2;for(;;){let o=je(e,i=>vo(r,i));if(o!==void 0)return o;r=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return Uo;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 h(e,(n,o)=>o===0?Uo:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:r[o],inRule:this.shortRuleNameToFullName(e[o-1])})}flattenFollowSet(){let e=h(this.buildFullFollowKeyStack(),r=>this.getFollowSetFromFollowKey(r));return j(e)}getFollowSetFromFollowKey(e){if(e===Uo)return[be];let r=e.ruleName+e.idxInCallingRule+yn+e.inRule;return this.resyncFollows[r]}addToResyncTokens(e,r){return this.tokenMatcher(e,be)||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 Xe(r)}attemptInRepetitionRecovery(e,r,n,o,i,a,s){}getCurrentGrammarPath(e,r){let n=this.getHumanReadableRuleStack(),o=L(this.RULE_OCCURRENCE_STACK);return{ruleStack:n,occurrenceStack:o,lastTok:e,lastTokOccurrence:r}}getHumanReadableRuleStack(){return h(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}};function IT(t,e,r,n,o,i,a){let s=this.getKeyForAutomaticLookahead(n,o),l=this.firstAfterRepMap[s];if(l===void 0){let p=this.getCurrRuleFullName(),T=this.getGAstProductions()[p];l=new i(T,o).startWalking(),this.firstAfterRepMap[s]=l}let f=l.token,u=l.occurrence,c=l.isEndOfRule;this.RULE_STACK.length===1&&c&&f===void 0&&(f=be,u=1),!(f===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(f,u,a)&&this.tryInRepetitionRecovery(t,e,r,f)}function jn(t,e,r){return r|e|t}var Br=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(N(r)){let n=this.validateEmptyOrAlternatives(e.rules),o=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...r,...n,...o,...i]}return r}validateNoLeftRecursion(e){return de(e,r=>Fo(r,r,ke))}validateEmptyOrAlternatives(e){return de(e,r=>zl(r,ke))}validateAmbiguousAlternationAlternatives(e,r){return de(e,n=>Vl(n,r,ke))}validateSomeNonEmptyLookaheadPath(e,r){return Xl(e,r,ke)}buildLookaheadForAlternation(e){return wl(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Ul)}buildLookaheadForOptional(e){return Fl(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Mr(e.prodType),Dl)}};var Kn=class{initLooksAhead(e){this.dynamicTokensEnabled=A(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:ce.dynamicTokensEnabled,this.maxLookahead=A(e,"maxLookahead")?e.maxLookahead:ce.maxLookahead,this.lookaheadStrategy=A(e,"lookaheadStrategy")?e.lookaheadStrategy:new Br({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){x(e,r=>{this.TRACE_INIT(`${r.name} Rule Lookahead`,()=>{let{alternation:n,repetition:o,option:i,repetitionMandatory:a,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:l}=RT(r);x(n,f=>{let u=f.idx===0?"":f.idx;this.TRACE_INIT(`${Ae(f)}${u}`,()=>{let c=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:f.idx,rule:r,maxLookahead:f.maxLookahead||this.maxLookahead,hasPredicates:f.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),p=jn(this.fullRuleNameToShort[r.name],256,f.idx);this.setLaFuncCache(p,c)})}),x(o,f=>{this.computeLookaheadFunc(r,f.idx,768,"Repetition",f.maxLookahead,Ae(f))}),x(i,f=>{this.computeLookaheadFunc(r,f.idx,512,"Option",f.maxLookahead,Ae(f))}),x(a,f=>{this.computeLookaheadFunc(r,f.idx,1024,"RepetitionMandatory",f.maxLookahead,Ae(f))}),x(s,f=>{this.computeLookaheadFunc(r,f.idx,1536,"RepetitionMandatoryWithSeparator",f.maxLookahead,Ae(f))}),x(l,f=>{this.computeLookaheadFunc(r,f.idx,1280,"RepetitionWithSeparator",f.maxLookahead,Ae(f))})})})}computeLookaheadFunc(e,r,n,o,i,a){this.TRACE_INIT(`${a}${r===0?"":r}`,()=>{let s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:r,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:o}),l=jn(this.fullRuleNameToShort[e.name],n,r);this.setLaFuncCache(l,s)})}getKeyForAutomaticLookahead(e,r){let n=this.getLastExplicitRuleShortName();return jn(n,e,r)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,r){this.lookAheadFuncsCache.set(e,r)}},Go=class extends fe{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)}},$n=new Go;function RT(t){$n.reset(),t.accept($n);let e=$n.dslMethods;return $n.reset(),e}function $o(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function Ko(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 rf(t,e,r){t.children[r]===void 0?t.children[r]=[e]:t.children[r].push(e)}function nf(t,e,r){t.children[e]===void 0?t.children[e]=[r]:t.children[e].push(r)}var yT="name";function Ho(t,e){Object.defineProperty(t,yT,{enumerable:!1,configurable:!0,writable:!1,value:e})}function ST(t,e){let r=P(t),n=r.length;for(let o=0;o<n;o++){let i=r[o],a=t[i],s=a.length;for(let l=0;l<s;l++){let f=a[l];f.tokenTypeIdx===void 0&&this[f.name](f.children,e)}}}function of(t,e){let r=function(){};Ho(r,t+"BaseSemantics");let n={visit:function(o,i){if(I(o)&&(o=o[0]),!le(o))return this[o.name](o.children,i)},validateVisitor:function(){let o=OT(this,e);if(!N(o)){let i=h(o,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
|
|
${i.join(`
|
|
|
|
`).replace(/\n/g,`
|
|
`)}`)}}};return r.prototype=n,r.prototype.constructor=r,r._RULE_NAMES=e,r}function af(t,e,r){let n=function(){};Ho(n,t+"BaseSemanticsWithDefaults");let o=Object.create(r.prototype);return x(e,i=>{o[i]=ST}),n.prototype=o,n.prototype.constructor=n,n}var zo;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(zo||(zo={}));function OT(t,e){return NT(t,e)}function NT(t,e){let r=se(e,o=>he(t[o])===!1),n=h(r,o=>({msg:`Missing visitor method: <${o}> on ${t.constructor.name} CST Visitor.`,type:zo.MISSING_METHOD,methodName:o}));return We(n)}var Xn=class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=A(e,"nodeLocationTracking")?e.nodeLocationTracking:ce.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=$,this.cstFinallyStateUpdate=$,this.cstPostTerminal=$,this.cstPostNonTerminal=$,this.cstPostRule=$;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Ko,this.setNodeLocationFromNode=Ko,this.cstPostRule=$,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=$,this.setNodeLocationFromNode=$,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=$o,this.setNodeLocationFromNode=$o,this.cstPostRule=$,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=$,this.setNodeLocationFromNode=$,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=$,this.setNodeLocationFromNode=$,this.cstPostRule=$,this.setInitialNodeLocation=$;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];rf(n,r,e),this.setNodeLocationFromToken(n.location,r)}cstPostNonTerminal(e,r){let n=this.CST_STACK[this.CST_STACK.length-1];nf(n,r,e),this.setNodeLocationFromNode(n.location,e.location)}getBaseCstVisitorConstructor(){if(le(this.baseCstVisitorConstructor)){let e=of(this.className,P(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(le(this.baseCstVisitorWithDefaultsConstructor)){let e=af(this.className,P(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 Yn=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)):ur}LA(e){let r=this.currIdx+e;return r<0||this.tokVectorLength<=r?ur: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 qn=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=pr){if(D(this.definedRulesNames,e)){let a={message:ke.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:re.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);let o=this.defineRule(e,r,n);return this[e]=o,o}OVERRIDE_RULE(e,r,n=pr){let o=Hl(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(o);let i=this.defineRule(e,r,n);return this[e]=i,i}BACKTRACK(e,r){return function(){this.isBackTrackingStack.push(1);let n=this.saveRecogState();try{return e.apply(this,r),!0}catch(o){if(Tt(o))return!1;throw o}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Rn(C(this.gastProductionsCache))}};var Zn=class{initRecognizerEngine(e,r){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=ar,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},A(r,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
|
|
For Further details.`);if(I(e)){if(N(e))throw Error(`A Token Vocabulary cannot be empty.
|
|
Note that the first argument for the parser constructor
|
|
is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
|
|
For Further details.`)}if(I(e))this.tokensMap=K(e,(i,a)=>(i[a.name]=a,i),{});else if(A(e,"modes")&&ae(j(C(e.modes)),yl)){let i=j(C(e.modes)),a=gt(i);this.tokensMap=K(a,(s,l)=>(s[l.name]=l,s),{})}else if(W(e))this.tokensMap=L(e);else throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=be;let n=A(e,"modes")?j(C(e.modes)):C(e),o=ae(n,i=>N(i.categoryMatches));this.tokenMatcher=o?ar:qe,Ze(C(this.tokensMap))}defineRule(e,r,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'
|
|
Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let o=A(n,"resyncEnabled")?n.resyncEnabled:pr.resyncEnabled,i=A(n,"recoveryValueFunc")?n.recoveryValueFunc:pr.recoveryValueFunc,a=this.ruleShortNameIdx<<12;this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a;let s;return this.outputCst===!0?s=function(...u){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),r.apply(this,u);let c=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(c),c}catch(c){return this.invokeRuleCatch(c,o,i)}finally{this.ruleFinallyStateUpdate()}}:s=function(...u){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),r.apply(this,u)}catch(c){return this.invokeRuleCatch(c,o,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(s,{ruleName:e,originalGrammarAction:r})}invokeRuleCatch(e,r,n){let o=this.RULE_STACK.length===1,i=r&&!this.isBackTracking()&&this.recoveryEnabled;if(Tt(e)){let a=e;if(i){let s=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(s))if(a.resyncedTokens=this.reSyncTo(s),this.outputCst){let l=this.CST_STACK[this.CST_STACK.length-1];return l.recoveredNode=!0,l}else return n(e);else{if(this.outputCst){let l=this.CST_STACK[this.CST_STACK.length-1];l.recoveredNode=!0,a.partialCstResult=l}throw a}}else{if(o)return this.moveToTerminatedState(),n(e);throw a}}else throw e}optionInternal(e,r){let n=this.getKeyForAutomaticLookahead(512,r);return this.optionInternalLogic(e,r,n)}optionInternalLogic(e,r,n){let o=this.getLaFuncFromCache(n),i;if(typeof e!="function"){i=e.DEF;let a=e.GATE;if(a!==void 0){let s=o;o=()=>a.call(this)&&s.call(this)}}else i=e;if(o.call(this)===!0)return i.call(this)}atLeastOneInternal(e,r){let n=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,r,n)}atLeastOneInternalLogic(e,r,n){let o=this.getLaFuncFromCache(n),i;if(typeof r!="function"){i=r.DEF;let a=r.GATE;if(a!==void 0){let s=o;o=()=>a.call(this)&&s.call(this)}}else i=r;if(o.call(this)===!0){let a=this.doSingleRepetition(i);for(;o.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i)}else throw this.raiseEarlyExitException(e,G.REPETITION_MANDATORY,r.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,r],o,1024,e,wn)}atLeastOneSepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,r,n)}atLeastOneSepFirstInternalLogic(e,r,n){let o=r.DEF,i=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){o.call(this);let s=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,s,o,Pr],s,1536,e,Pr)}else throw this.raiseEarlyExitException(e,G.REPETITION_MANDATORY_WITH_SEPARATOR,r.ERR_MSG)}manyInternal(e,r){let n=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,r,n)}manyInternalLogic(e,r,n){let o=this.getLaFuncFromCache(n),i;if(typeof r!="function"){i=r.DEF;let s=r.GATE;if(s!==void 0){let l=o;o=()=>s.call(this)&&l.call(this)}}else i=r;let a=!0;for(;o.call(this)===!0&&a===!0;)a=this.doSingleRepetition(i);this.attemptInRepetitionRecovery(this.manyInternal,[e,r],o,768,e,Mn,a)}manySepFirstInternal(e,r){let n=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,r,n)}manySepFirstInternalLogic(e,r,n){let o=r.DEF,i=r.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){o.call(this);let s=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,s,o,kr],s,1280,e,kr)}}repetitionSepSecondInternal(e,r,n,o,i){for(;n();)this.CONSUME(r),o.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,r,n,o,i],n,1536,e,i)}doSingleRepetition(e){let r=this.getLexerPosition();return e.call(this),this.getLexerPosition()>r}orInternal(e,r){let n=this.getKeyForAutomaticLookahead(256,r),o=I(e)?e:e.DEF,a=this.getLaFuncFromCache(n).call(this,o);if(a!==void 0)return o[a].ALT.call(this);this.raiseNoAltException(r,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){let e=this.LA(1),r=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Ur(r,e))}}subruleInternal(e,r,n){let o;try{let i=n!==void 0?n.ARGS:void 0;return this.subruleIdx=r,o=e.apply(this,i),this.cstPostNonTerminal(o,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),o}catch(i){throw this.subruleInternalError(i,n,e.ruleName)}}subruleInternalError(e,r,n){throw Tt(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,r!==void 0&&r.LABEL!==void 0?r.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,r,n){let o;try{let i=this.LA(1);this.tokenMatcher(i,e)===!0?(this.consumeToken(),o=i):this.consumeInternalError(e,i,n)}catch(i){o=this.consumeInternalRecovery(e,r,i)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,o),o}consumeInternalError(e,r,n){let o,i=this.LA(0);throw n!==void 0&&n.ERR_MSG?o=n.ERR_MSG:o=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:r,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Lt(o,r,i))}consumeInternalRecovery(e,r,n){if(this.recoveryEnabled&&n.name==="MismatchedTokenException"&&!this.isBackTracking()){let o=this.getFollowsForInRuleRecovery(e,r);try{return this.tryInRuleRecovery(e,o)}catch(i){throw i.name===Bo?n:i}}else throw n}saveRecogState(){let e=this.errors,r=L(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:r,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,r,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(r)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),be)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}};var Jn=class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=A(e,"errorMessageProvider")?e.errorMessageProvider:ce.errorMessageProvider}SAVE_ERROR(e){if(Tt(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:L(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return L(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,r,n){let o=this.getCurrRuleFullName(),i=this.getGAstProductions()[o],s=fr(e,i,r,this.maxLookahead)[0],l=[];for(let u=1;u<=this.maxLookahead;u++)l.push(this.LA(u));let f=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:s,actual:l,previous:this.LA(0),customUserDescription:n,ruleName:o});throw this.SAVE_ERROR(new Dr(f,this.LA(1),this.LA(0)))}raiseNoAltException(e,r){let n=this.getCurrRuleFullName(),o=this.getGAstProductions()[n],i=lr(e,o,this.maxLookahead),a=[];for(let f=1;f<=this.maxLookahead;f++)a.push(this.LA(f));let s=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:i,actual:a,previous:s,customUserDescription:r,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Fr(l,this.LA(1),s))}};var Qn=class{initContentAssist(){}computeContentAssist(e,r){let n=this.gastProductionsCache[e];if(le(n))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return Un([n],r,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let r=oe(e.ruleStack),o=this.getGAstProductions()[r];return new Pn(o,e).startWalking()}};var ro={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ro);var sf=!0,lf=Math.pow(2,8)-1,cf=bn({name:"RECORDING_PHASE_TOKEN",pattern:ie.NA});Ze([cf]);var uf=vt(cf,`This IToken indicates the Parser is in Recording Phase
|
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(uf);var CT={name:`This CSTNode indicates the Parser is in Recording Phase
|
|
See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},eo=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,o){return this.consumeInternalRecord(n,e,o)},this[`SUBRULE${r}`]=function(n,o){return this.subruleInternalRecord(n,e,o)},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 ur}topLevelRuleRecord(e,r){try{let n=new me({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+`
|
|
This error was thrown during the "grammar recording phase" For more info see:
|
|
https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(e,r){return Wr.call(this,U,e,r)}atLeastOneInternalRecord(e,r){Wr.call(this,Y,r,e)}atLeastOneSepFirstInternalRecord(e,r){Wr.call(this,q,r,e,sf)}manyInternalRecord(e,r){Wr.call(this,v,r,e)}manySepFirstInternalRecord(e,r){Wr.call(this,H,r,e,sf)}orInternalRecord(e,r){return vT.call(this,e,r)}subruleInternalRecord(e,r,n){if(to(r),!e||A(e,"ruleName")===!1){let s=new Error(`<SUBRULE${ff(r)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>
|
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}let o=Le(this.recordingProdStack),i=e.ruleName,a=new b({idx:r,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return o.definition.push(a),this.outputCst?CT:ro}consumeInternalRecord(e,r,n){if(to(r),!No(e)){let a=new Error(`<CONSUME${ff(r)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>
|
|
inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}let o=Le(this.recordingProdStack),i=new _({idx:r,terminalType:e,label:n?.LABEL});return o.definition.push(i),uf}};function Wr(t,e,r,n=!1){to(r);let o=Le(this.recordingProdStack),i=he(e)?e:e.DEF,a=new t({definition:[],idx:r});return n&&(a.separator=e.SEP),A(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),i.call(this),o.definition.push(a),this.recordingProdStack.pop(),ro}function vT(t,e){to(e);let r=Le(this.recordingProdStack),n=I(t)===!1,o=n===!1?t:t.DEF,i=new z({definition:[],idx:e,ignoreAmbiguities:n&&t.IGNORE_AMBIGUITIES===!0});A(t,"MAX_LOOKAHEAD")&&(i.maxLookahead=t.MAX_LOOKAHEAD);let a=yt(o,s=>he(s.GATE));return i.hasPredicates=a,r.definition.push(i),x(o,s=>{let l=new w({definition:[]});i.definition.push(l),A(s,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=s.IGNORE_AMBIGUITIES:A(s,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),s.ALT.call(this),this.recordingProdStack.pop()}),ro}function ff(t){return t===0?"":`${t}`}function to(t){if(t<0||t>lf){let e=new Error(`Invalid DSL Method idx value: <${t}>
|
|
Idx value must be a none negative value smaller than ${lf+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}var no=class{initPerformanceTracer(e){if(A(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:o,value:i}=Sr(r),a=o>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${o}ms`),this.traceInitIndent--,i}else return r()}};function pf(t,e){e.forEach(r=>{let n=r.prototype;Object.getOwnPropertyNames(n).forEach(o=>{if(o==="constructor")return;let i=Object.getOwnPropertyDescriptor(n,o);i&&(i.get||i.set)?Object.defineProperty(t.prototype,o,i):t.prototype[o]=r.prototype[o]})})}var ur=vt(be,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(ur);var ce=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:kn,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),pr=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0}),re;(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"})(re||(re={}));function LT(t=void 0){return function(){return t}}var hr=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",()=>{Or(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),x(this.definedRulesNames,o=>{let a=this[o].originalGrammarAction,s;this.TRACE_INIT(`${o} Rule`,()=>{s=this.topLevelRuleRecord(o,a)}),this.gastProductionsCache[o]=s})}finally{this.disableRecording()}});let n=[];if(this.TRACE_INIT("Grammar Resolving",()=>{n=Yl({rules:C(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(n)}),this.TRACE_INIT("Grammar Validations",()=>{if(N(n)&&this.skipValidations===!1){let o=ql({rules:C(this.gastProductionsCache),tokenTypes:C(this.tokensMap),errMsgProvider:ke,grammarName:r}),i=jl({lookaheadStrategy:this.lookaheadStrategy,rules:C(this.gastProductionsCache),tokenTypes:C(this.tokensMap),grammarName:r});this.definitionErrors=this.definitionErrors.concat(o,i)}}),N(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{let o=ol(C(this.gastProductionsCache));this.resyncFollows=o}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var o,i;(i=(o=this.lookaheadStrategy).initialize)===null||i===void 0||i.call(o,{rules:C(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(C(this.gastProductionsCache))})),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!N(this.definitionErrors))throw e=h(this.definitionErrors,o=>o.message),new Error(`Parser Definition Errors detected:
|
|
${e.join(`
|
|
-------------------------------
|
|
`)}`)})}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),A(r,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
|
|
Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
|
|
See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
|
|
For further details.`);this.skipValidations=A(r,"skipValidations")?r.skipValidations:ce.skipValidations}};hr.DEFER_DEFINITION_ERRORS_HANDLING=!1;pf(hr,[Wn,Kn,Xn,Yn,Zn,qn,Jn,Qn,eo,no]);var Xo=class extends hr{constructor(e,r=ce){let n=L(r);n.outputCst=!0,super(e,n)}},Yo=class extends hr{constructor(e,r=ce){let n=L(r);n.outputCst=!1,super(e,n)}};function hf(t){let e=new qo,r=C(t);return h(r,n=>e.visitRule(n))}var qo=class extends fe{visitRule(e){let r=this.visitEach(e.definition),n=Rr(r,i=>i.propertyName),o=h(n,(i,a)=>{let s=!yt(i,f=>!f.canBeNull),l=i[0].type;return i.length>1&&(l=h(i,f=>f.type)),{name:a,type:l,optional:s}});return{name:e.name,properties:o}}visitAlternative(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})}visitOption(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})}visitRepetition(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})}visitRepetitionMandatory(e){return this.visitEach(e.definition)}visitRepetitionMandatoryWithSeparator(e){return this.visitEach(e.definition).concat({propertyName:e.separator.name,canBeNull:!0,type:oo(e.separator)})}visitRepetitionWithSeparator(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0}).concat({propertyName:e.separator.name,canBeNull:!0,type:oo(e.separator)})}visitAlternation(e){return this.visitEachAndOverrideWith(e.definition,{canBeNull:!0})}visitTerminal(e){return[{propertyName:e.label||e.terminalType.name,canBeNull:!1,type:oo(e)}]}visitNonTerminal(e){return[{propertyName:e.label||e.nonTerminalName,canBeNull:!1,type:oo(e)}]}visitEachAndOverrideWith(e,r){return h(this.visitEach(e),n=>ee({},n,r))}visitEach(e){return j(h(e,r=>this.visit(r)))}};function oo(t){return t instanceof b?{kind:"rule",name:t.referencedRule.name}:{kind:"token"}}function mf(t,e){let r=[];return r=r.concat('import type { CstNode, ICstVisitor, IToken } from "chevrotain";'),r=r.concat(j(h(t,n=>bT(n)))),e.includeVisitorInterface&&(r=r.concat(wT(e.visitorInterfaceName,t))),r.join(`
|
|
|
|
`)+`
|
|
`}function bT(t){let e=kT(t),r=PT(t);return[e,r]}function kT(t){let e=gf(t.name),r=Zo(t.name);return`export interface ${e} extends CstNode {
|
|
name: "${t.name}";
|
|
children: ${r};
|
|
}`}function PT(t){return`export type ${Zo(t.name)} = {
|
|
${h(t.properties,r=>MT(r)).join(`
|
|
`)}
|
|
};`}function MT(t){let e=UT(t.type);return`${t.name}${t.optional?"?":""}: ${e}[];`}function wT(t,e){return`export interface ${t}<IN, OUT> extends ICstVisitor<IN, OUT> {
|
|
${h(e,r=>FT(r)).join(`
|
|
`)}
|
|
}`}function FT(t){let e=Zo(t.name);return`${t.name}(children: ${e}, param?: IN): OUT;`}function UT(t){if(I(t)){let e=gt(h(t,n=>df(n)));return"("+K(e,(n,o)=>n+" | "+o)+")"}else return df(t)}function df(t){return t.kind==="token"?"IToken":gf(t.name)}function gf(t){return rn(t)+"CstNode"}function Zo(t){return rn(t)+"CstChildren"}var DT={includeVisitorInterface:!0,visitorInterfaceName:"ICstNodeVisitor"};function BT(t,e){let r=Object.assign(Object.assign({},DT),e),n=hf(t);return mf(n,r)}function GT(t,{resourceBase:e=`https://unpkg.com/chevrotain@${$r}/diagrams/`,css:r=`https://unpkg.com/chevrotain@${$r}/diagrams/diagrams.css`}={}){let n=`
|
|
<!-- This is a generated file -->
|
|
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
body {
|
|
background-color: hsl(30, 20%, 95%)
|
|
}
|
|
</style>
|
|
|
|
`,o=`
|
|
<link rel='stylesheet' href='${r}'>
|
|
`,i=`
|
|
<script src='${e}vendor/railroad-diagrams.js'><\/script>
|
|
<script src='${e}src/diagrams_builder.js'><\/script>
|
|
<script src='${e}src/diagrams_behavior.js'><\/script>
|
|
<script src='${e}src/main.js'><\/script>
|
|
`,a=`
|
|
<div id="diagrams" align="center"></div>
|
|
`,s=`
|
|
<script>
|
|
window.serializedGrammar = ${JSON.stringify(t,null," ")};
|
|
<\/script>
|
|
`;return n+o+i+a+s+`
|
|
<script>
|
|
var diagramsDiv = document.getElementById("diagrams");
|
|
main.drawDiagramsFromSerializedGrammar(serializedGrammar, diagramsDiv);
|
|
<\/script>
|
|
`}function Dw(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API.
|
|
It performs no action other than printing this message.
|
|
Please avoid using it as it will be completely removed in the future`)}var xf=class{constructor(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead.
|
|
See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}};export{z as Alternation,w as Alternative,Xo as CstParser,LT as EMPTY_ALT,be as EOF,Dr as EarlyExitException,Yo as EmbeddedActionsParser,fe as GAstVisitor,Br as LLkLookaheadStrategy,ie as Lexer,B as LexerDefinitionErrorType,Lt as MismatchedTokenException,Fr as NoViableAltException,b as NonTerminal,Ur as NotAllInputParsedException,U as Option,xf as Parser,re as ParserDefinitionErrorType,v as Repetition,Y as RepetitionMandatory,q as RepetitionMandatoryWithSeparator,H as RepetitionWithSeparator,me as Rule,_ as Terminal,$r as VERSION,Dw as clearCache,GT as createSyntaxDiagramsCode,bn as createToken,vt as createTokenInstance,_o as defaultLexerErrorProvider,kn as defaultParserErrorProvider,BT as generateCstDts,pT as getLookaheadPaths,Tt as isRecognitionException,Rn as serializeGrammar,tr as serializeProduction,Ct as tokenLabel,vo as tokenMatcher,lT as tokenName};
|
|
/*! Bundled license information:
|
|
|
|
lodash-es/lodash.js:
|
|
(**
|
|
* @license
|
|
* Lodash (Custom Build) <https://lodash.com/>
|
|
* Build: `lodash modularize exports="es" -o ./`
|
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
* Released under MIT license <https://lodash.com/license>
|
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
*)
|
|
*/
|
|
//# sourceMappingURL=chevrotain.min.mjs.map
|