1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[12744],{12744:(e,t,i)=>{i.d(t,{diagram:()=>lZ});var s,n,r,a,o,l,c,h,u,d,p,f,m,T,g,E,y,A,S=i(67595),L=i(44909),O=i(80671);i(25527),i(73256),i(47727),i(38871),i(97986),i(15548);var R=i(37883);i(11773);var b=i(48305),N=i(52892),v=i(77980),k=i(64145),I=i(78923);let C=function(e,t){for(var i=-1,s=null==e?0:e.length;++i<s&&!1!==t(e[i],i,e););return e},_=function(e,t,i){for(var s=-1,n=Object(e),r=i(e),a=r.length;a--;){var o=r[++s];if(!1===t(n[o],o,n))break}return e},x=function(e,t){for(var i=-1,s=Array(e);++i<e;)s[i]=t(i);return s};var U="object"==typeof global&&global&&global.Object===Object&&global,w="object"==typeof self&&self&&self.Object===Object&&self,M=U||w||Function("return this")(),P=M.Symbol,D=Object.prototype,$=D.hasOwnProperty,F=D.toString,B=P?P.toStringTag:void 0;let K=function(e){var t=$.call(e,B),i=e[B];try{e[B]=void 0;var s=!0}catch(e){}var n=F.call(e);return s&&(t?e[B]=i:delete e[B]),n};var j=Object.prototype.toString,G=P?P.toStringTag:void 0;let W=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":G&&G in Object(e)?K(e):j.call(e)},z=function(e){return null!=e&&"object"==typeof e},V=function(e){return z(e)&&"[object Arguments]"==W(e)};var H=Object.prototype,Y=H.hasOwnProperty,X=H.propertyIsEnumerable,J=V(function(){return arguments}())?V:function(e){return z(e)&&Y.call(e,"callee")&&!X.call(e,"callee")},q=Array.isArray,Z="object"==typeof exports&&exports&&!exports.nodeType&&exports,Q=Z&&"object"==typeof module&&module&&!module.nodeType&&module,ee=Q&&Q.exports===Z?M.Buffer:void 0;let et=(ee?ee.isBuffer:void 0)||function(){return!1};var ei=/^(?:0|[1-9]\d*)$/;let es=function(e,t){var i=typeof e;return!!(t=null==t?0x1fffffffffffff:t)&&("number"==i||"symbol"!=i&&ei.test(e))&&e>-1&&e%1==0&&e<t},en=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff};var er={};er["[object Float32Array]"]=er["[object Float64Array]"]=er["[object Int8Array]"]=er["[object Int16Array]"]=er["[object Int32Array]"]=er["[object Uint8Array]"]=er["[object Uint8ClampedArray]"]=er["[object Uint16Array]"]=er["[object Uint32Array]"]=!0,er["[object Arguments]"]=er["[object Array]"]=er["[object ArrayBuffer]"]=er["[object Boolean]"]=er["[object DataView]"]=er["[object Date]"]=er["[object Error]"]=er["[object Function]"]=er["[object Map]"]=er["[object Number]"]=er["[object Object]"]=er["[object RegExp]"]=er["[object Set]"]=er["[object String]"]=er["[object WeakMap]"]=!1;let ea=function(e){return function(t){return e(t)}};var eo="object"==typeof exports&&exports&&!exports.nodeType&&exports,el=eo&&"object"==typeof module&&module&&!module.nodeType&&module,ec=el&&el.exports===eo&&U.process,eh=function(){try{var e=el&&el.require&&el.require("util").types;if(e)return e;return ec&&ec.binding&&ec.binding("util")}catch(e){}}(),eu=eh&&eh.isTypedArray,ed=eu?ea(eu):function(e){return z(e)&&en(e.length)&&!!er[W(e)]},ep=Object.prototype.hasOwnProperty;let ef=function(e,t){var i=q(e),s=!i&&J(e),n=!i&&!s&&et(e),r=!i&&!s&&!n&&ed(e),a=i||s||n||r,o=a?x(e.length,String):[],l=o.length;for(var c in e)(t||ep.call(e,c))&&!(a&&("length"==c||n&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||es(c,l)))&&o.push(c);return o};var em=Object.prototype;let eT=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||em)},eg=function(e,t){return function(i){return e(t(i))}};var eE=eg(Object.keys,Object),ey=Object.prototype.hasOwnProperty;let eA=function(e){if(!eT(e))return eE(e);var t=[];for(var i in Object(e))ey.call(e,i)&&"constructor"!=i&&t.push(i);return t},eS=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},eL=function(e){if(!eS(e))return!1;var t=W(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},eO=function(e){return null!=e&&en(e.length)&&!eL(e)},eR=function(e){return eO(e)?ef(e):eA(e)};var eb=(s=function(e,t){return e&&_(e,t,eR)},function(e,t){if(null==e)return e;if(!eO(e))return s(e,t);for(var i=e.length,n=-1,r=Object(e);++n<i&&!1!==t(r[n],n,r););return e});let eN=function(e){return e},ev=function(e,t){return(q(e)?C:eb)(e,"function"==typeof t?t:eN)},ek=function(e,t){for(var i=-1,s=null==e?0:e.length,n=Array(s);++i<s;)n[i]=t(e[i],i,e);return n},eI=function(e){return null==e?[]:ek(eR(e),function(t){return e[t]})};var eC=M["__core-js_shared__"],e_=(n=/[^.]+$/.exec(eC&&eC.keys&&eC.keys.IE_PROTO||""))?"Symbol(sr
1c)_1."+n:"",ex=Function.prototype.toString;let eU=function(e){if(null!=e){try{return ex.call(e)}catch(e){}try{return e+""}catch(e){}}return""};var ew=/^\[object .+?Constructor\]$/,eM=Object.prototype,eP=Function.prototype.toString,eD=eM.hasOwnProperty,e$=RegExp("^"+eP.call(eD).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let eF=function(e){return!!eS(e)&&(!e_||!(e_ in e))&&(eL(e)?e$:ew).test(eU(e))},eB=function(e,t){var i=null==e?void 0:e[t];return eF(i)?i:void 0};var eK=eB(M,"DataView"),ej=eB(M,"Map"),eG=eB(M,"Promise"),eW=eB(M,"Set"),ez=eB(M,"WeakMap"),eV="[object Map]",eH="[object Promise]",eY="[object Set]",eX="[object WeakMap]",eJ="[object DataView]",eq=eU(eK),eZ=eU(ej),eQ=eU(eG),e0=eU(eW),e1=eU(ez),e2=W;(eK&&e2(new eK(new ArrayBuffer(1)))!=eJ||ej&&e2(new ej)!=eV||eG&&e2(eG.resolve())!=eH||eW&&e2(new eW)!=eY||ez&&e2(new ez)!=eX)&&(e2=function(e){var t=W(e),i="[object Object]"==t?e.constructor:void 0,s=i?eU(i):"";if(s)switch(s){case eq:return eJ;case eZ:return eV;case eQ:return eH;case e0:return eY;case e1:return eX}return t});let e3=e2;var e6=Object.prototype.hasOwnProperty;let e5=function(e){if(null==e)return!0;if(eO(e)&&(q(e)||"string"==typeof e||"function"==typeof e.splice||et(e)||ed(e)||J(e)))return!e.length;var t=e3(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(eT(e))return!eA(e).length;for(var i in e)if(e6.call(e,i))return!1;return!0},e4=function(e,t){return e===t||e!=e&&t!=t},e8=function(e,t){for(var i=e.length;i--;)if(e4(e[i][0],t))return i;return -1};var e9=Array.prototype.splice;function e7(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}e7.prototype.clear=function(){this.__data__=[],this.size=0},e7.prototype.delete=function(e){var t=this.__data__,i=e8(t,e);return!(i<0)&&(i==t.length-1?t.pop():e9.call(t,i,1),--this.size,!0)},e7.prototype.get=function(e){var t=this.__data__,i=e8(t,e);return i<0?void 0:t[i][1]},e7.prototype.has=function(e){return e8(this.__data__,e)>-1},e7.prototype.set=function(e,t){var i=this.__data__,s=e8(i,e);return s<0?(++this.size,i.push([e,t])):i[s][1]=t,this};var te=eB(Object,"create"),tt=Object.prototype.hasOwnProperty,ti=Object.prototype.hasOwnProperty;function ts(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}ts.prototype.clear=function(){this.__data__=te?te(null):{},this.size=0},ts.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t},ts.prototype.get=function(e){var t=this.__data__;if(te){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return tt.call(t,e)?t[e]:void 0},ts.prototype.has=function(e){var t=this.__data__;return te?void 0!==t[e]:ti.call(t,e)},ts.prototype.set=function(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=te&&void 0===t?"__lodash_hash_undefined__":t,this};let tn=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},tr=function(e,t){var i=e.__data__;return tn(t)?i["string"==typeof t?"string":"hash"]:i.map};function ta(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function to(e){var t=this.__data__=new e7(e);this.size=t.size}function tl(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new ta;++t<i;)this.add(e[t])}ta.prototype.clear=function(){this.size=0,this.__data__={hash:new ts,map:new(ej||e7),string:new ts}},ta.prototype.delete=function(e){var t=tr(this,e).delete(e);return this.size-=!!t,t},ta.prototype.get=function(e){return tr(this,e).get(e)},ta.prototype.has=function(e){return tr(this,e).has(e)},ta.prototype.set=function(e,t){var i=tr(this,e),s=i.size;return i.set(e,t),this.size+=+(i.size!=s),this},to.prototype.clear=function(){this.__data__=new e7,this.size=0},to.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},to.prototype.get=function(e){return this.__data__.get(e)},to.prototype.has=function(e){return this.__data__.has(e)},to.prototype.set=function(e,t){var i=this.__data__;if(i instanceof e7){var s=i.__data__;if(!ej||s.length<199)return s.push([e,t]),this.size=++i.size,this;i=this.__data__=new ta(s)}return i.set(e,t),this.size=i.size,this},tl.prototype.add=tl.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},tl.prototype.has=function(e){return this.__data__.has(e)};let tc=function(e,t){for(var i=-1,s=null==e?0:e.length;++i<s;)if(t(e[i],i,e))return!0;return!1},th=function(e,t){return e.has(t)},tu=function(e,t,i,s,n,r){var a=1&i,o=e.length,l=t.length;if(o!=l&&!(a&&l>o))return!1;var c=r.get(e),h=r.get(t);if(c&&h)return c==t&&h==e;var u=-1,d=!0,p=2&i?new tl:void 0;for(r.set(e,t),r.set(t,e);++u<o;){var f=e[u],m=t[u];if(s)var T=a?s(m,f,u,t,e,r):s(f,m,u,e,t,r);if(void 0!==T){if(T)continue;d=!1;break}
1if(p){if(!tc(t,function(e,t){if(!th(p,t)&&(f===e||n(f,e,i,s,r)))return p.push(t)})){d=!1;break}}else if(!(f===m||n(f,m,i,s,r))){d=!1;break}}return r.delete(e),r.delete(t),d};var td=M.Uint8Array;let tp=function(e){var t=-1,i=Array(e.size);return e.forEach(function(e,s){i[++t]=[s,e]}),i},tf=function(e){var t=-1,i=Array(e.size);return e.forEach(function(e){i[++t]=e}),i};var tm=P?P.prototype:void 0,tT=tm?tm.valueOf:void 0;let tg=function(e,t,i,s,n,r,a){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":if(e.byteLength!=t.byteLength||!r(new td(e),new td(t)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return e4(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var o=tp;case"[object Set]":var l=1&s;if(o||(o=tf),e.size!=t.size&&!l)break;var c=a.get(e);if(c)return c==t;s|=2,a.set(e,t);var h=tu(o(e),o(t),s,n,r,a);return a.delete(e),h;case"[object Symbol]":if(tT)return tT.call(e)==tT.call(t)}return!1},tE=function(e,t){for(var i=-1,s=t.length,n=e.length;++i<s;)e[n+i]=t[i];return e},ty=function(e,t,i){var s=t(e);return q(e)?s:tE(s,i(e))},tA=function(e,t){for(var i=-1,s=null==e?0:e.length,n=0,r=[];++i<s;){var a=e[i];t(a,i,e)&&(r[n++]=a)}return r},tS=function(){return[]};var tL=Object.prototype.propertyIsEnumerable,tO=Object.getOwnPropertySymbols,tR=tO?function(e){return null==e?[]:tA(tO(e=Object(e)),function(t){return tL.call(e,t)})}:tS;let tb=function(e){return ty(e,eR,tR)};var tN=Object.prototype.hasOwnProperty;let tv=function(e,t,i,s,n,r){var a=1&i,o=tb(e),l=o.length;if(l!=tb(t).length&&!a)return!1;for(var c=l;c--;){var h=o[c];if(!(a?h in t:tN.call(t,h)))return!1}var u=r.get(e),d=r.get(t);if(u&&d)return u==t&&d==e;var p=!0;r.set(e,t),r.set(t,e);for(var f=a;++c<l;){var m=e[h=o[c]],T=t[h];if(s)var g=a?s(T,m,h,t,e,r):s(m,T,h,e,t,r);if(!(void 0===g?m===T||n(m,T,i,s,r):g)){p=!1;break}f||(f="constructor"==h)}if(p&&!f){var E=e.constructor,y=t.constructor;E!=y&&"constructor"in e&&"constructor"in t&&!("function"==typeof E&&E instanceof E&&"function"==typeof y&&y instanceof y)&&(p=!1)}return r.delete(e),r.delete(t),p};var tk="[object Arguments]",tI="[object Array]",tC="[object Object]",t_=Object.prototype.hasOwnProperty;let tx=function(e,t,i,s,n,r){var a=q(e),o=q(t),l=a?tI:e3(e),c=o?tI:e3(t);l=l==tk?tC:l,c=c==tk?tC:c;var h=l==tC,u=c==tC,d=l==c;if(d&&et(e)){if(!et(t))return!1;a=!0,h=!1}if(d&&!h)return r||(r=new to),a||ed(e)?tu(e,t,i,s,n,r):tg(e,t,l,i,s,n,r);if(!(1&i)){var p=h&&t_.call(e,"__wrapped__"),f=u&&t_.call(t,"__wrapped__");
1if(p||f){var m=p?e.value():e,T=f?t.value():t;return r||(r=new to),n(m,T,i,s,r)}}return!!d&&(r||(r=new to),tv(e,t,i,s,n,r))},tU=function e(t,i,s,n,r){return t===i||(null!=t&&null!=i&&(z(t)||z(i))?tx(t,i,s,n,e,r):t!=t&&i!=i)},tw=function(e,t,i,s){var n=i.length,r=n,a=!s;if(null==e)return!r;for(e=Object(e);n--;){var o=i[n];if(a&&o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++n<r;){var l=(o=i[n])[0],c=e[l],h=o[1];if(a&&o[2]){if(void 0===c&&!(l in e))return!1}else{var u=new to;if(s)var d=s(c,h,l,e,t,u);if(!(void 0===d?tU(h,c,3,s,u):d))return!1}}return!0},tM=function(e){return e==e&&!eS(e)},tP=function(e){for(var t=eR(e),i=t.length;i--;){var s=t[i],n=e[s];t[i]=[s,n,tM(n)]}return t},tD=function(e,t){return function(i){return null!=i&&i[e]===t&&(void 0!==t||e in Object(i))}},t$=function(e){var t=tP(e);return 1==t.length&&t[0][2]?tD(t[0][0],t[0][1]):function(i){return i===e||tw(i,e,t)}},tF=function(e){return"symbol"==typeof e||z(e)&&"[object Symbol]"==W(e)};var tB=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tK=/^\w*$/;let tj=function(e,t){if(q(e))return!1;var i=typeof e;return!!("number"==i||"symbol"==i||"boolean"==i||null==e||tF(e))||tK.test(e)||!tB.test(e)||null!=t&&e in Object(t)};function tG(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var i=function(){var s=arguments,n=t?t.apply(this,s):s[0],r=i.cache;if(r.has(n))return r.get(n);var a=e.apply(this,s);return i.cache=r.set(n,a)||r,a};return i.cache=new(tG.Cache||ta),i}tG.Cache=ta;var tW=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tz=/\\(\\)?/g,tV=(a=(r=tG(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(tW,function(e,i,s,n){t.push(s?n.replace(tz,"$1"):i||e)}),t},function(e){return 500===a.size&&a.clear(),e})).cache,r),tH=1/0,tY=P?P.prototype:void 0,tX=tY?tY.toString:void 0;let tJ=function e(t){if("string"==typeof t)return t;if(q(t))return ek(t,e)+"";if(tF(t))return tX?tX.call(t):"";var i=t+"";return"0"==i&&1/t==-tH?"-0":i},tq=function(e,t){return q(e)?e:tj(e,t)?[e]:tV(null==e?"":tJ(e))};var tZ=1/0;let tQ=function(e){if("string"==typeof e||tF(e))return e;var t=e+"";return"0"==t&&1/e==-tZ?"-0":t},t0=function(e,t){t=tq(t,e);for(var i=0,s=t.length;null!=e&&i<s;)e=e[tQ(t[i++])];return i&&i==s?e:void 0},t1=function(e,t,i){var s=null==e?void 0:t0(e,t);return void 0===s?i:s},t2=function(e,t){return null!=e&&t in Object(e)},t3=function(e,t,i){t=tq(t,e);for(var s=-1,n=t.length,r=!1;++s<n;){var a=tQ(t[s]);if(!(r=null!=e&&i(e,a)))break;e=e[a]}return r||++s!=n?r:!!(n=null==e?0:e.length)&&en(n)&&es(a,n)&&(q(e)||J(e))},t6=function(e){var t;return tj(e)?(t=tQ(e),function(e){return null==e?void 0:e[t]}):function(t){return t0(t,e)}},t5=function(e){if("function"==typeof e)return e;if(null==e)return eN;if("object"==typeof e){var t,i;return q(e)?(t=e[0],i=e[1],tj(t)&&tM(i)?tD(tQ(t),i):function(e){var s=t1(e,t);return void 0===s&&s===i?null!=e&&t3(e,t,t2):tU(i,s,3)}):t$(e)}return t6(e)},t4=function(e,t){var i=-1,s=eO(e)?Array(e.length):[];return eb(e,function(e,n,r){s[++i]=t(e,n,r)}),s},t8=function(e,t){return(q(e)?ek:t4)(e,t5(t))};var t9=Object.prototype.hasOwnProperty;let t7=function(e,t){return null!=e&&t9.call(e,t)},ie=function(e,t){return null!=e&&t3(e,t,t7)};var it=function(){try{var e=eB(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();let ii=function(e,t,i){"__proto__"==t&&it?it(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i};var is=Object.prototype.hasOwnProperty;let ir=function(e,t,i){var s=e[t];is.call(e,t)&&e4(s,i)&&(void 0!==i||t in e)||ii(e,t,i)},ia=function(e,t,i,s){var n=!i;i||(i={});for(var r=-1,a=t.length;++r<a;){var o=t[r],l=s?s(i[o],e[o],o,i,e):void 0;void 0===l&&(l=e[o]),n?ii(i,o,l):ir(i,o,l)}return i},io=function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t};var il=Object.prototype.hasOwnProperty;let ic=function(e){if(!eS(e))return io(e);var t=eT(e),i=[];for(var s in e)"constructor"==s&&(t||!il.call(e,s))||i.push(s);return i},ih=function(e){return eO(e)?ef(e,!0):ic(e)};var iu="object"==typeof exports&&exports&&!exports.nodeType&&exports,id=iu&&"object"==typeof module&&module&&!module.nodeType&&module,ip=id&&id.exports===iu?M.Buffer:void 0,im=ip?ip.allocUnsafe:void 0;let iT=function(e,t){if(t)return e.slice();var i=e.length,s=im?im(i):new e.constructor(i);return e.copy(s),s},ig=function(e,t){var i=-1,s=e.length;for(t||(t=Array(s));++i<s;)t[i]=e[i];return t};var iE=eg(Object.getPrototypeOf,Object),iy=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)tE(t,tR(e)),e=iE(e);return t}:tS;let iA=function(e){return ty(e,ih,iy)};var iS=Object.prototype.hasOwnProperty;let iL=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&iS.call(e,"index")&&(i.index=e.index,i.input=e.input),i},iO=function(e){var t=new e.constructor(e.byteLength);return new td(t).set(new td(e)),t},iR=function(e,t){var i=t?iO(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)};var ib=/\w*$/;let iN=function(e){var t=new e.constructor(e.source,ib.exec(e));return t.lastIndex=e.lastIndex,t};var iv=P?P.prototype:void 0,ik=iv?iv.valueOf:void 0;let iI=function(e,t){var i=t?iO(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)},iC=function(e,t,i){var s=e.constructor;switch(t){case"[object ArrayBuffer]":return iO(e);case"[object Boolean]":case"[object Date]":return new s(+e);case"[object DataView]":return iR(e,i);
1case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return iI(e,i);case"[object Map]":case"[object Set]":return new s;case"[object Number]":case"[object String]":return new s(e);case"[object RegExp]":return iN(e);case"[object Symbol]":return ik?Object(ik.call(e)):{}}};var i_=Object.create,ix=function(){function e(){}return function(t){if(!eS(t))return{};if(i_)return i_(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}(),iU=eh&&eh.isMap,iw=iU?ea(iU):function(e){return z(e)&&"[object Map]"==e3(e)},iM=eh&&eh.isSet,iP=iM?ea(iM):function(e){return z(e)&&"[object Set]"==e3(e)},iD="[object Arguments]",i$="[object Function]",iF="[object Object]",iB={};iB[iD]=iB["[object Array]"]=iB["[object ArrayBuffer]"]=iB["[object DataView]"]=iB["[object Boolean]"]=iB["[object Date]"]=iB["[object Float32Array]"]=iB["[object Float64Array]"]=iB["[object Int8Array]"]=iB["[object Int16Array]"]=iB["[object Int32Array]"]=iB["[object Map]"]=iB["[object Number]"]=iB[iF]=iB["[object RegExp]"]=iB["[object Set]"]=iB["[object String]"]=iB["[object Symbol]"]=iB["[object Uint8Array]"]=iB["[object Uint8ClampedArray]"]=iB["[object Uint16Array]"]=iB["[object Uint32Array]"]=!0,iB["[object Error]"]=iB[i$]=iB["[object WeakMap]"]=!1;let iK=function e(t,i,s,n,r,a){var o,l=1&i,c=2&i,h=4&i;if(s&&(o=r?s(t,n,r,a):s(t)),void 0!==o)return o;if(!eS(t))return t;var u=q(t);if(u){if(o=iL(t),!l)return ig(t,o)}else{var d,p,f,m,T,g=e3(t),E=g==i$||"[object GeneratorFunction]"==g;if(et(t))return iT(t,l);if(g==iF||g==iD||E&&!r){if(o=c||E||"function"!=typeof(d=t).constructor||eT(d)?{}:ix(iE(d)),!l)return c?(f=(p=o)&&ia(t,ih(t),p),ia(t,iy(t),f)):(T=(m=o)&&ia(t,eR(t),m),ia(t,tR(t),T))}else{if(!iB[g])return r?t:{};o=iC(t,g,l)}}a||(a=new to);var y=a.get(t);if(y)return y;a.set(t,o),iP(t)?t.forEach(function(n){o.add(e(n,i,s,n,t,a))}):iw(t)&&t.forEach(function(n,r){o.set(r,e(n,i,s,r,t,a))});var A=h?c?iA:tb:c?ih:eR,S=u?void 0:A(t);return C(S||t,function(n,r){S&&(n=t[r=n]),ir(o,r,e(n,i,s,r,t,a))}),o},ij=function(e){return iK(e,4)};function iG(e){function t(){}t.prototype=e;let i=new t;function s(){return typeof i.bar}return s(),s(),e}let iW=function(e,t,i){var s=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(i=i>n?n:i)<0&&(i+=n),n=t>i?0:i-t>>>0,t>>>=0;for(var r=Array(n);++s<n;)r[s]=e[s+t];return r};var iz=/\s/;let iV=function(e){for(var t=e.length;t--&&iz.test(e.charAt(t)););return t};var iH=/^\s+/,iY=0/0,iX=/^[-+]0x[0-9a-f]+$/i,iJ=/^0b[01]+$/i,iq=/^0o[0-7]+$/i,iZ=parseInt;let iQ=function(e){if("number"==typeof e)return e;if(tF(e))return iY;if(eS(e)){var t,i="function"==typeof e.valueOf?e.valueOf():e;e=eS(i)?i+"":i}if("string"!=typeof e)return 0===e?e:+e;e=(t=e)?t.slice(0,iV(t)+1).replace(iH,""):t;var s=iJ.test(e);return s||iq.test(e)?iZ(e.slice(2),s?2:8):iX.test(e)?iY:+e};var i0=1/0;let i1=function(e){var t,i=(t=e)?(t=iQ(t))===i0||t===-i0?(t<0?-1:1)*17976931348623157e292:t==t?t:0:0===t?t:0,s=i%1;return i==i?s?i-s:i:0},i2=function(e,t,i){var s=null==e?0:e.length;return s?iW(e,(t=i||void 0===t?1:i1(t))<0?0:t,s):[]},i3=function(e){return"string"==typeof e||!q(e)&&z(e)&&"[object String]"==W(e)},i6=function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)};var i5=Math.max,i4=Date.now,i8=(o=it?function(e,t){return it(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:eN,l=0,c=0,function(){var e=i4(),t=16-(e-c);if(c=e,t>0){if(++l>=800)return arguments[0]}else l=0;return o.apply(void 0,arguments)});let i9=function(e,t){var i;return i8((i=i5(void 0===(i=t)?e.length-1:i,0),function(){for(var t=arguments,s=-1,n=i5(t.length-i,0),r=Array(n);++s<n;)r[s]=t[i+s];s=-1;for(var a=Array(i+1);++s<i;)a[s]=t[s];return a[i]=eN(r),i6(e,this,a)}),e+"")},i7=function(e,t,i){if(!eS(i))return!1;var s=typeof t;return("number"==s?!!(eO(i)&&es(t,i.length)):"string"==s&&t in i)&&e4(i[t],e)};var se=Object.prototype.hasOwnProperty,st=(h=function(e,t){if(eT(t)||eO(t))return void ia(t,eR(t),e);for(var i in t)se.call(t,i)&&ir(e,i,t[i])},i9(function(e,t){var i=-1,s=t.length,n=s>1?t[s-1]:void 0,r=s>2?t[2]:void 0;for(n=h.length>3&&"function"==typeof n?(s--,n):void 0,r&&i7(t[0],t[1],r)&&(n=s<3?void 0:n,s=1),e=Object(e);++i<s;){var a=t[i];a&&h(e,a)}return e}));let si=function(e,t,i,s){if(!eS(e))return e;t=tq(t,e);for(var n=-1,r=t.length,a=r-1,o=e;null!=o&&++n<r;){var l=tQ(t[n]),c=i;
1if("__proto__"===l||"constructor"===l||"prototype"===l)break;if(n!=a){var h=o[l];void 0===(c=s?s(h,l,o):void 0)&&(c=eS(h)?h:es(t[n+1])?[]:{})}ir(o,l,c),o=o[l]}return e},ss=function(e,t,i){for(var s=-1,n=t.length,r={};++s<n;){var a=t[s],o=t0(e,a);i(o,a)&&si(r,tq(a,e),o)}return r},sn=function(e,t){if(null==e)return{};var i=ek(iA(e),function(e){return[e]});return t=t5(t),ss(e,i,function(e,i){return t(e,i[0])})};var sr=eh&&eh.isRegExp,sa=sr?ea(sr):function(e){return z(e)&&"[object RegExp]"==W(e)};class so{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),ev(this.definition,t=>{t.accept(e)})}}class sl extends so{constructor(e){super([]),this.idx=1,st(this,sn(e,e=>void 0!==e))}set definition(e){}get definition(){return void 0!==this.referencedRule?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class sc extends so{constructor(e){super(e.definition),this.orgText="",st(this,sn(e,e=>void 0!==e))}}class sh extends so{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,st(this,sn(e,e=>void 0!==e))}}class su extends so{constructor(e){super(e.definition),this.idx=1,st(this,sn(e,e=>void 0!==e))}}class sd extends so{constructor(e){super(e.definition),this.idx=1,st(this,sn(e,e=>void 0!==e))}}class sp extends so{constructor(e){super(e.definition),this.idx=1,st(this,sn(e,e=>void 0!==e))}}class sf extends so{constructor(e){super(e.definition),this.idx=1,st(this,sn(e,e=>void 0!==e))}}class sm extends so{constructor(e){super(e.definition),this.idx=1,st(this,sn(e,e=>void 0!==e))}}class sT extends so{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,st(this,sn(e,e=>void 0!==e))}}class sg{constructor(e){this.idx=1,st(this,sn(e,e=>void 0!==e))}accept(e){e.visit(this)}}class sE{visit(e){switch(e.constructor){case sl:return this.visitNonTerminal(e);case sh:return this.visitAlternative(e);case su:return this.visitOption(e);case sd:return this.visitRepetitionMandatory(e);case sp:return this.visitRepetitionMandatoryWithSeparator(e);case sm:return this.visitRepetitionWithSeparator(e);case sf:return this.visitRepetition(e);case sT:return this.visitAlternation(e);case sg:return this.visitTerminal(e);case sc:return this.visitRule(e);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){}}let sy=function(e,t){var i;return eb(e,function(e,s,n){return!(i=t(e,s,n))}),!!i},sA=function(e,t,i){var s=q(e)?tc:sy;return i&&i7(e,t,i)&&(t=void 0),s(e,t5(t))},sS=function(e,t,i,s){for(var n=e.length,r=i+(s?1:-1);s?r--:++r<n;)if(t(e[r],r,e))return r;return -1},sL=function(e){return e!=e},sO=function(e,t,i){for(var s=i-1,n=e.length;++s<n;)if(e[s]===t)return s;return -1},sR=function(e,t,i){return t==t?sO(e,t,i):sS(e,sL,i)};var sb=Math.max;let sN=function(e,t,i,s){e=eO(e)?e:eI(e),i=i&&!s?i1(i):0;var n=e.length;return i<0&&(i=sb(n+i,0)),i3(e)?i<=n&&e.indexOf(t,i)>-1:!!n&&sR(e,t,i)>-1},sv=function(e,t){for(var i=-1,s=null==e?0:e.length;++i<s;)if(!t(e[i],i,e))return!1;return!0},sk=function(e,t){var i=!0;return eb(e,function(e,s,n){return i=!!t(e,s,n)}),i},sI=function(e,t,i){var s=q(e)?sv:sk;return i&&i7(e,t,i)&&(t=void 0),s(e,t5(t))};function sC(e,t=[]){return e instanceof su||e instanceof sf||e instanceof sm||(e instanceof sT?sA(e.definition,e=>sC(e,t)):!(e instanceof sl&&sN(t,e))&&e instanceof so&&(e instanceof sl&&t.push(e),sI(e.definition,e=>sC(e,t))))}function s_(e){if(e instanceof sl)return"SUBRULE";if(e instanceof su)return"OPTION";if(e instanceof sT)return"OR";if(e instanceof sd)return"AT_LEAST_ONE";if(e instanceof sp)return"AT_LEAST_ONE_SEP";else if(e instanceof sm)return"MANY_SEP";else if(e instanceof sf)return"MANY";else if(e instanceof sg)return"CONSUME";else throw Error("non exhaustive match")}class sx{walk(e,t=[]){ev(e.definition,(i,s)=>{let n=i2(e.definition,s+1);if(i instanceof sl)this.walkProdRef(i,n,t);else if(i instanceof sg)this.walkTerminal(i,n,t);else if(i instanceof sh)this.walkFlat(i,n,t);else if(i instanceof su)this.walkOption(i,n,t);else if(i instanceof sd)this.walkAtLeastOne(i,n,t);else if(i instanceof sp)this.walkAtLeastOneSep(i,n,t);else if(i instanceof sm)this.walkManySep(i,n,t);else if(i instanceof sf)this.walkMany(i,n,t);else if(i instanceof sT)this.walkOr(i,n,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,i){}walkProdRef(e,t,i){}walkFlat(e,t,i){let s=t.concat(i);this.walk(e,s)}walkOption(e,t,i){let s=t.concat(i);this.walk(e,s)}walkAtLeastOne(e,t,i){let s=[new su({definition:e.definition})].concat(t,i);this.walk(e,s)}walkAtLeastOneSep(e,t,i){let s=sU(e,t,i);this.walk(e,s)}walkMany(e,t,i){let s=[new su({definition:e.definition})].concat(t,i);this.walk(e,s)}walkManySep(e,t,i){let s=sU(e,t,i);this.walk(e,s)}walkOr(e,t,i){let s=t.concat(i);ev(e.definition,e=>{let t=new sh({definition:[e]});this.walk(t,s)})}}function sU(e,t,i){return[new su({definition:[new sg({terminalType:e.separator})].concat(e.definition)})].concat(t,i)}let sw=function(e,t){return!!(null==e?0:e.length)&&sR(e,t,0)>-1},sM=function(e,t,i){for(var s=-1,n=null==e?0:e.length;++s<n;)if(i(t,e[s]))return!0;return!1},sP=function(){};
1var sD=eW&&1/tf(new eW([,-0]))[1]==1/0?function(e){return new eW(e)}:sP;let s$=function(e,t,i){var s=-1,n=sw,r=e.length,a=!0,o=[],l=o;if(i)a=!1,n=sM;else if(r>=200){var c=t?null:sD(e);if(c)return tf(c);a=!1,n=th,l=new tl}else l=t?[]:o;e:for(;++s<r;){var h=e[s],u=t?t(h):h;if(h=i||0!==h?h:0,a&&u==u){for(var d=l.length;d--;)if(l[d]===u)continue e;t&&l.push(u),o.push(h)}else n(l,u,i)||(l!==o&&l.push(u),o.push(h))}return o},sF=function(e){return e&&e.length?s$(e):[]};var sB=P?P.isConcatSpreadable:void 0;let sK=function(e){return q(e)||J(e)||!!(sB&&e&&e[sB])},sj=function e(t,i,s,n,r){var a=-1,o=t.length;for(s||(s=sK),r||(r=[]);++a<o;){var l=t[a];i>0&&s(l)?i>1?e(l,i-1,s,n,r):tE(r,l):n||(r[r.length]=l)}return r},sG=function(e){return(null==e?0:e.length)?sj(e,1):[]};function sW(e){if(e instanceof sl)return sW(e.referencedRule);if(e instanceof sg)return[e.terminalType];if(e instanceof sh||e instanceof su||e instanceof sf||e instanceof sd||e instanceof sp||e instanceof sm||e instanceof sg||e instanceof sc)return function(e){let t,i=[],s=e.definition,n=0,r=s.length>n,a=!0;for(;r&&a;)a=sC(t=s[n]),i=i.concat(sW(t)),n+=1,r=s.length>n;return sF(i)}(e);if(e instanceof sT)return sF(sG(t8(e.definition,e=>sW(e))));throw Error("non exhaustive match")}let sz="_~IN~_";class sV extends sx{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,i){}walkProdRef(e,t,i){var s,n;let r=(s=e.referencedRule,n=e.idx,s.name+n+sz+this.topProd.name),a=sW(new sh({definition:t.concat(i)}));this.follows[r]=a}}let sH=function(e){return void 0===e};function sY(e){return e.charCodeAt(0)}function sX(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function sJ(e,t){if(!0===e[t])throw"duplicate flag "+t;e[t],e[t]=!0}function sq(e){if(void 0===e)throw Error("Internal Error - Should never get here!");return!0}function sZ(){throw Error("Internal Error - Should never get here!")}function sQ(e){return"Character"===e.type}let s0=[];for(let e=sY("0");e<=sY("9");e++)s0.push(e);let s1=[sY("_")].concat(s0);for(let e=sY("a");e<=sY("z");e++)s1.push(e);for(let e=sY("A");e<=sY("Z");e++)s1.push(e);let s2=[sY(" "),sY("\f"),sY("\n"),sY("\r"),sY(" "),sY("\v"),sY(" "),sY("\xa0"),sY("á"),sY("â"),sY("â"),sY("â"),sY("â"),sY("â"),sY("â
"),sY("â"),sY("â"),sY("â"),sY("â"),sY("â"),sY("\u2028"),sY("\u2029"),sY("â¯"),sY("â"),sY("ã"),sY("\uFEFF")],s3=/[0-9a-fA-F]/,s6=/[0-9]/,s5=/[1-9]/;class s4{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 t=this.disjunction();this.consumeChar("/");let i={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":sJ(i,"global");break;case"i":sJ(i,"ignoreCase");break;case"m":sJ(i,"multiLine");break;case"u":sJ(i,"unicode");break;case"y":sJ(i,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:i,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}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"(":let t;switch(this.consumeChar("?"),this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}}sq(t);let i=this.disjunction();return this.consumeChar(")"),{type:t,value:i,loc:this.loc(e)}}return sZ()}quantifier(e=!1){let t,i=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":let s=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:s,atMost:s};break;case",":t=this.isDigit()?{atLeast:s,atMost:this.integerIncludingZero()}:{atLeast:s,atMost:1/0},this.consumeChar("}")}if(!0===e&&void 0===t)return;sq(t)}if((!0!==e||void 0!==t)&&sq(t))return"?"===this.peekChar(0)?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(i),t}atom(){let e,t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group()}return(void 0===e&&this.isPatternCharacter()&&(e=this.patternCharacter()),sq(e))?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):sZ()}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[sY("\n"),sY("\r"),sY("\u2028"),sY("\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();
vendor: 5,344 bytes, line 1
1case"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,t=!1;switch(this.popChar()){case"d":e=s0;break;case"D":e=s0,t=!0;break;case"s":e=s2;break;case"S":e=s2,t=!0;break;case"w":e=s1;break;case"W":e=s1,t=!0}return sq(e)?{type:"Set",value:e,complement:t}:sZ()}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=sY("\f");break;case"n":e=sY("\n");break;case"r":e=sY("\r");break;case"t":e=sY(" ");break;case"v":e=sY("\v")}return sq(e)?{type:"Character",value:e}:sZ()}controlLetterEscapeAtom(){this.consumeChar("c");let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:sY("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:sY(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:sY(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,sQ(t)&&this.isRangeDash()){this.consumeChar("-");let i=this.classAtom();if(i.type,sQ(i)){if(i.value<t.value)throw Error("Range out of order in character class");e.push({from:t.value,to:i.value})}else sX(t.value,e),e.push(sY("-")),sX(i.value,e)}else sX(t.value,e)}return this.consumeChar("]"),{type:"Set",complement:t,value:e}}classAtom(){switch(this.peekChar()){case"]":case"\n":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:sY("\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 t=this.disjunction();this.consumeChar(")");let i={type:"Group",capturing:e,value:t};return e&&(i.idx=this.groupIdx),i}positiveInteger(){let e=this.popChar();if(!1===s5.test(e))throw Error("Expecting a positive integer");for(;s6.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===s6.test(e))throw Error("Expecting an integer");for(;s6.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case"\n":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:sY(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 s6.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case"]":case"\n":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 void 0!==this.quantifier(!0)}catch(e){return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case"\n":case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(e){let t="";for(let i=0;i<e;i++){let e=this.popChar();if(!1===s3.test(e))throw Error("Expecting a HexDecimal digits");t+=e}return{type:"Character",value:parseInt(t,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(void 0!==e&&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}}}class s8{visitChildren(e){for(let t in e){let i=e[t];e.hasOwnProperty(t)&&(void 0!==i.type?this.visit(i):Array.isArray(i)&&i.forEac
1h(e=>{this.visit(e)},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)}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 s9=Object.prototype,s7=s9.hasOwnProperty,ne=i9(function(e,t){e=Object(e);var i=-1,s=t.length,n=s>2?t[2]:void 0;for(n&&i7(t[0],t[1],n)&&(s=1);++i<s;)for(var r=t[i],a=ih(r),o=-1,l=a.length;++o<l;){var c=a[o],h=e[c];(void 0===h||e4(h,s9[c])&&!s7.call(e,c))&&(e[c]=r[c])}return e});let nt=function(e,t){var i=[];return eb(e,function(e,s,n){t(e,s,n)&&i.push(e)}),i},ni=function(e){if("function"!=typeof e)throw TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}},ns=function(e,t){return(q(e)?tA:nt)(e,ni(t5(t)))};var nn=Math.max;let nr=function(e,t,i){var s=null==e?0:e.length;if(!s)return -1;var n=null==i?0:i1(i);return n<0&&(n=nn(s+n,0)),sR(e,t,n)},na=function(e,t,i,s){var n=-1,r=null==e?0:e.length;for(s&&r&&(i=e[++n]);++n<r;)i=t(i,e[n],n,e);return i},no=function(e,t,i,s,n){return n(e,function(e,n,r){i=s?(s=!1,e):t(i,e,n,r)}),i},nl=function(e,t,i){var s=q(e)?na:no,n=arguments.length<3;return s(e,t5(t),i,n,eb)},nc=function(e,t){return(q(e)?tA:nt)(e,t5(t))},nh=function(e,t,i,s){var n=-1,r=sw,a=!0,o=e.length,l=[],c=t.length;if(!o)return l;i&&(t=ek(t,ea(i))),s?(r=sM,a=!1):t.length>=200&&(r=th,a=!1,t=new tl(t));e:for(;++n<o;){var h=e[n],u=null==i?h:i(h);if(h=s||0!==h?h:0,a&&u==u){for(var d=c;d--;
1)if(t[d]===u)continue e;l.push(h)}else r(t,u,s)||l.push(h)}return l},nu=function(e){return z(e)&&eO(e)};var nd=i9(function(e,t){return nu(e)?nh(e,sj(t,1,nu,!0)):[]});let np=function(e){for(var t=-1,i=null==e?0:e.length,s=0,n=[];++t<i;){var r=e[t];r&&(n[s++]=r)}return n},nf=function(e){return e&&e.length?e[0]:void 0};var nm=Math.max,nT=(u=function(e,t,i){var s=null==e?0:e.length;if(!s)return -1;var n=null==i?0:i1(i);return n<0&&(n=nm(s+n,0)),sS(e,t5(t),n)},function(e,t,i){var s=Object(e);if(!eO(e)){var n=t5(t);e=eR(e),t=function(e){return n(s[e],e,s)}}var r=u(e,t,i);return r>-1?s[n?e[r]:r]:void 0});function ng(e){console&&console.error&&console.error(`Error: ${e}`)}function nE(e){console&&console.warn&&console.warn(`Warning: ${e}`)}let ny={},nA=new s4;function nS(e){let t=e.toString();if(ny.hasOwnProperty(t))return ny[t];{let e=nA.pattern(t);return ny[t]=e,e}}let nL="Complement Sets are not supported for first char optimization",nO='Unable to use "first char" lexer optimizations:\n';function nR(e,t,i){let s=nK(e);t[s]=s,!0===i&&function(e,t){let i=String.fromCharCode(e),s=i.toUpperCase();if(s!==i){let e=nK(s.charCodeAt(0));t[e]=e}else{let e=i.toLowerCase();if(e!==i){let i=nK(e.charCodeAt(0));t[i]=i}}}(e,t)}function nb(e,t){return nT(e.value,e=>"number"==typeof e?sN(t,e):void 0!==nT(t,t=>e.from<=t&&t<=e.to))}class nN extends s8{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){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){sN(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?void 0===nb(e,this.targetCharCodes)&&(this.found=!0):void 0!==nb(e,this.targetCharCodes)&&(this.found=!0)}}function nv(e,t){if(!(t instanceof RegExp))return void 0!==nT(t,t=>sN(e,t.charCodeAt(0)));{let i=nS(t),s=new nN(e);return s.visit(i),s.found}}let nk="PATTERN",nI="defaultMode",nC="modes",n_=/[^\\][$]/,nx=/[^\\[][\^]|^\^/;function nU(e){let t=e.ignoreCase?"iy":"y";return RegExp(`${e.source}`,t)}function nw(e){let t=e.PATTERN;if(sa(t))return!1;if(eL(t))return!0;if(ie(t,"exec"))return!0;if(i3(t))return!1;throw Error("non exhaustive match")}function nM(e){return!!i3(e)&&1===e.length&&e.charCodeAt(0)}let nP={test:function(e){let t=e.length;for(let i=this.lastIndex;i<t;i++){let t=e.charCodeAt(i);if(10===t)return this.lastIndex=i+1,!0;if(13===t)return 10===e.charCodeAt(i+1)?this.lastIndex=i+2:this.lastIndex=i+1,!0}return!1},lastIndex:0};function nD(e,t){if(ie(e,"LINE_BREAKS"))return!1;if(sa(e.PATTERN)){try{nv(t,e.PATTERN)}catch(e){return{issue:g.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(i3(e.PATTERN))return!1;if(nw(e))return{issue:g.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function n$(e){return t8(e,e=>i3(e)?e.charCodeAt(0):e)}function nF(e,t,i){void 0===e[t]?e[t]=[i]:e[t].push(i)}let nB=[];function nK(e){return e<256?e:nB[e]}let nj=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};function nG(e){let t=new Date().getTime(),i=e();return{time:new Date().getTime()-t,value:i}}function nW(e,t){let i=e.tokenTypeIdx;return i===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[i]}function nz(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}let nV=1,nH={};function nY(e){let t=function(e){let t=ij(e),i=e,s=!0;for(;s;){let e=nd(i=np(sG(t8(i,e=>e.CATEGORIES))),t);t=t.concat(e),e5(e)?s=!1:i=e}return t}(e);ev(t,e=>{nX(e)||(nH[nV]=e,e.tokenTypeIdx=nV++),nJ(e)&&!q(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),nJ(e)||(e.CATEGORIES=[]),ie(e,"categoryMatches")||(e.categoryMatches=[]),ie(e,"categoryMatchesMap")||(e.categoryMatchesMap={})}),ev(t,e=>{!function e(t,i){ev(t,e=>{i.categoryMatchesMap[e.tokenTypeIdx]=!0}),ev(i.CATEGORIES,s=>{let n=t.concat(i);sN(n,s)||e(n,s)})}([],e)}),ev(t,e=>{e.categoryMatches=[],ev(e.categoryMatchesMap,(t,i)=>{e.categoryMatches.push(nH[i].tokenTypeIdx)})}),ev(t,e=>{e.isParent=e.categoryMatches.length>0})}function nX(e){return ie(e,"tokenTypeIdx")}function nJ(e){return ie(e,"CATEGORIES")}function nq(e){return ie(e,"tokenTypeIdx")}(d=g||(g={}))[d.MISSING_PATTERN=0]="MISSING_PATTERN",d[d.INVALID_PATTERN=1]="INVALID_PATTERN",d[d.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",d[d.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",d[d.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",d[d.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",d[d.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",d[d.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",d[d.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",d[d.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",d[d.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",d[d.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",d[d.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",d[d.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",d[d.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",d[d.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",d[d.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",d[d.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";let nZ={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:{buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}
1<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,i,s,n,r)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${i} characters.`},traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(nZ);class nQ{constructor(e,t=nZ){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=(e,t)=>{if(!0!==this.traceInitPerf)return t();{this.traceInitIndent++;let i=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${i}--> <${e}>`);let{time:s,value:n}=nG(t),r=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&r(`${i}<-- <${e}> time: ${s}ms`),this.traceInitIndent--,n}},"boolean"==typeof t)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=st({},nZ,t);const i=this.config.traceInitPerf;!0===i?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof i&&(this.traceInitMaxIdent=i,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===nZ.lineTerminatorsPattern)this.config.lineTerminatorsPattern=nP;else if(this.config.lineTerminatorCharacters===nZ.lineTerminatorCharacters)throw Error("Error: Missing <lineTerminatorCharacters> property on the Lexer config.\n For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(t.safeMode&&t.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),q(e)?i={modes:{defaultMode:ij(e)},defaultMode:nI}:(s=!1,i=ij(e))}),!1===this.config.skipValidations&&(this.TRACE_INIT("performRuntimeChecks",()=>{var e;let t;this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat((e=i,this.trackStartLines,this.config.lineTerminatorCharacters,t=[],ie(e,nI)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+nI+"> property in its definition\n",type:g.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),ie(e,nC)||t.push({message:"A MultiMode Lexer cannot be initialized without a <"+nC+"> property in its definition\n",type:g.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),ie(e,nC)&&ie(e,nI)&&!ie(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${nI}: <${e.defaultMode}>which does not exist 2`,type:g.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),ie(e,nC)&&ev(e.modes,(e,i)=>{ev(e,(s,n)=>{sH(s)?t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${i}> at index: <${n}> 3`,type:g.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):ie(s,"LONGER_ALT")&&ev(q(s.LONGER_ALT)?s.LONGER_ALT:[s.LONGER_ALT],n=>{sH(n)||sN(e,n)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${n.name}> on token <${s.name}> outside of mode <${i}> 4`,type:g.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),t))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{var e,t,s;let n,r,a,o;this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat((e=i,t=this.trackStartLines,s=this.config.lineTerminatorCharacters,n=[],r=!1,a=ns(np(sG(eI(e.modes))),e=>e[nk]===nQ.NA),o=n$(s),t&&ev(a,e=>{let t=nD(e,o);if(!1!==t){let i={message:function(e,t){if(t.issue===g.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern. 5 The problem is in the <${e.name}> Token Type 6 Root cause: ${t.errMsg}. 7 For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===g.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option. 8 The problem is in the <${e.name}> Token Type 9 For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(e,t),type:t.issue,tokenType:e};n.push(i)}else ie(e,"LINE_BREAKS")?!0===e.LINE_BREAKS&&(r=!0):nv(o,e.PATTERN)&&(r=!0)}),t&&!r&&n.push({message:"Warning: No LINE_BREAKS Found.\n This Lexer has been defined to track line and column information,\n But none of the Token Types can be identified as matching a line terminator.\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n for details.",type:g.NO_LINE_BREAKS_FLAGS}),n))})),i.modes=i.modes?i.modes:{},ev(i.modes,(e,t)=>{i.modes[t]=ns(e,e=>sH(e))});let n=eR(i.modes);if(ev(i.modes,(e,i)=>{this.TRACE_INIT(`Mode: <${i}> processing`,()=>{if(this.modes.push(i),!1===this.config.skipValidations&&this.TRACE_INIT("validatePatterns",()=>{var t,i,s,r,a,o;let l,c,h,u,d,p,f,m,T,E,y,A;this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat((l=[],c={errors:t8(d=nc(t=e,e=>!ie(e,nk)),e=>({message:"Token Type: ->"+e.name+"<- missing static 'PATTERN' property",type:g.MISSING_PATTERN,tokenTypes:[e]})),valid:nd(t,d)},l=l.concat(c.errors),u=(h={errors:t8(p=nc(i=c.valid,e=>{let t=e[nk];return!sa(t)&&!eL(t)&&!ie(t,"exec")&&!i3(t)}),e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:g.INVALID_PATTERN,tokenTypes:[e]})),valid:nd(i,p)}).valid,l=(l=(l=(l=(l=l.concat(h.errors)).concat((f=[],m=nc(u,e=>sa(e[nk])),(f=(f=(f=(f=f.concat(function(e){class t extends s8{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return t8(nc(e,e=>{let i=e.PATTERN;try{let e=nS(i),s=new t;return s.visit(e),s.found}catch(e){return n_.test(i.source)}}),e=>({message:"Unexpected RegExp Anchor Error:\n Token Type: ->"+e.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",type:g.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}(m))).concat(function(e){class t extends s8{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return t8(nc(e,e=>{let i=e.PATTERN;try{let e=nS(i),s=new t;return s.visit(e),s.found}catch(e){return nx.test(i.source)}}),e=>({message:"Unexpected RegExp Anchor Error:\n Token Type: ->"+e.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.",type:g.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}(m))).concat(t8(nc(m,e=>{let t=e[nk];return t instanceof RegExp&&(t.multiline||t.global)}),e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:g.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]})))).concat((T=[],E=t8(s=m,e=>nl(s,(t,i)=>(e.PATTERN.source!==i.PATTERN.source||sN(T,i)||i.PATTERN===nQ.NA||(T.push(i),t.push(i)),t),[])),t8(nc(E=np(E),e=>e.length>1),e=>{let t=t8(e,e=>e.name),i=nf(e).PATTERN;return{message:`The same RegExp pattern ->${i}<-has been used in all of the following Token Types: ${t.join(", ")} <-`,type:g.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})))).concat(t8(nc(m,e=>e.PATTERN.test("")),e=>({message:"Token Type: ->"+e.name+"<- static 'PATTERN' must not match an empty string",type:g.EMPTY_MATCH_PATTERN,tokenTypes:[e]})))))).concat(t8(nc(u,e=>{if(!ie(e,"GROUP"))return!1;let t=e.GROUP;return t!==nQ.SKIPPED&&t!==nQ.NA&&!i3(t)}),e=>({message:"Token Type: ->"+e.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:g.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]})))).concat((r=u,a=n,t8(nc(r,e=>void 0!==e.PUSH_MODE&&!sN(a,e.PUSH_MODE)),e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:g.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))))).concat((y=[],A=nl(o=u,(e,t,i)=>{var s;let n=t.PATTERN;return n===nQ.NA||(i3(n)?e.push({str:n,idx:i,tokenType:t}):sa(n)&&(s=n,void 0===nT([".","\\","[","]","|","^","$","(",")","?","*","+","{"],e=>-1!==s.source.indexOf(e)))&&e.push({str:n.source,idx:i,tokenType:t})),e},[]),ev(o,(e,t)=>{ev(A,({str:i,idx:s,tokenType:n})=>{if(t<s&&function(e,t){if(sa(t)){var i;if(i=t,/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(i.source))return!1;let s=t.exec(e);return null!==s&&0===s.index}if(eL(t))return t(e,0,[],{});if(ie(t,"exec"))return t.exec(e,0,[],{});if("string"==typeof t)return t===e;throw Error("non exhaustive match")}(i,e.PATTERN)){let t=`Token: ->${n.name}<- can never be matched. 10Because it appears AFTER the Token Type ->${e.name}<-in the lexer's definition. 11See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;y.push({message:t,type:g.UNREACHABLE_PATTERN,tokenTypes:[e,n]})}})}),y))))}),e5(this.lexerDefinitionErrors)){let s;nY(e),this.TRACE_INIT("analyzeTokenTypes",()=>{var i;let n,r,a,o,l,c,h,u,d,p,f,m,T,g,E,y;(T=(i=ne(i={lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT},{debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:(e,t)=>t()})).tracer)("initCharCodeToOptimizedIndexMap",()=>{if(e5(nB)){nB=Array(65536);for(let e=0;e<65536;e++)nB[e]=e>255?255+~~(e/255):e}}),T("Reject Lexer.NA",()=>{n=ns(e,e=>e[nk]===nQ.NA)}),g=!1,T("Transform Patterns",()=>{g=!1,r=t8(n,e=>{let t=e[nk];if(sa(t)){let e=t.source;return 1!==e.length||"^"===e||"$"===e||"."===e||t.ignoreCase?2!==e.length||"\\"!==e[0]||sN(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],e[1])?nU(t):e[1]:e}if(eL(t))return g=!0,{exec:t};
11if("object"==typeof t)return g=!0,t;if("string"==typeof t)if(1===t.length)return t;else return nU(new RegExp(t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")));throw Error("non exhaustive match")})}),T("misc mapping",()=>{a=t8(n,e=>e.tokenTypeIdx),o=t8(n,e=>{let t=e.GROUP;if(t!==nQ.SKIPPED){if(i3(t))return t;if(sH(t))return!1;throw Error("non exhaustive match")}}),l=t8(n,e=>{let t=e.LONGER_ALT;if(t)return q(t)?t8(t,e=>nr(n,e)):[nr(n,t)]}),c=t8(n,e=>e.PUSH_MODE),h=t8(n,e=>ie(e,"POP_MODE"))}),T("Line Terminator Handling",()=>{let e=n$(i.lineTerminatorCharacters);u=t8(n,e=>!1),"onlyOffset"!==i.positionTracking&&(u=t8(n,t=>ie(t,"LINE_BREAKS")?!!t.LINE_BREAKS:!1===nD(t,e)&&nv(e,t.PATTERN)))}),T("Misc Mapping #2",()=>{d=t8(n,nw),p=t8(r,nM),f=nl(n,(e,t)=>{let i=t.GROUP;return i3(i)&&i!==nQ.SKIPPED&&(e[i]=[]),e},{}),m=t8(r,(e,t)=>({pattern:r[t],longerAlt:l[t],canLineTerminator:u[t],isCustom:d[t],short:p[t],group:o[t],push:c[t],pop:h[t],tokenTypeIdx:a[t],tokenType:n[t]}))}),E=!0,y=[],i.safeMode||T("First Char Optimization",()=>{y=nl(n,(e,t,s)=>{if("string"==typeof t.PATTERN)nF(e,nK(t.PATTERN.charCodeAt(0)),m[s]);else if(q(t.START_CHARS_HINT)){let i;ev(t.START_CHARS_HINT,t=>{let n=nK("string"==typeof t?t.charCodeAt(0):t);i!==n&&(i=n,nF(e,n,m[s]))})}else if(sa(t.PATTERN))if(t.PATTERN.unicode)E=!1,i.ensureOptimizations&&ng(`${nO} Unable to analyze < ${t.PATTERN.toString()} > pattern. 12 The regexp unicode flag is not currently supported by the regexp-to-ast library. 13 This will disable the lexer's first char optimizations. 14 For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let n=function(e,t=!1){try{let t=nS(e);return function e(t,i,s){switch(t.type){case"Disjunction":for(let n=0;n<t.value.length;n++)e(t.value[n],i,s);break;case"Alternative":let n=t.value;for(let t=0;t<n.length;t++){let r=n[t];switch(r.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"Lookbehind":case"NegativeLookbehind":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}switch(r.type){case"Character":nR(r.value,i,s);break;case"Set":if(!0===r.complement)throw Error(nL);ev(r.value,e=>{if("number"==typeof e)nR(e,i,s);else if(!0===s)for(let t=e.from;t<=e.to;t++)nR(t,i,s);else{for(let t=e.from;t<=e.to&&t<256;t++)nR(t,i,s);if(e.to>=256){let t=e.from>=256?e.from:256,s=e.to,n=nK(t),r=nK(s);for(let e=n;e<=r;e++)i[e]=e}}});break;case"Group":e(r.value,i,s);break;default:throw Error("Non Exhaustive Match")}let a=void 0!==r.quantifier&&0===r.quantifier.atLeast;if("Group"===r.type&&!1===function e(t){let i=t.quantifier;return!!i&&0===i.atLeast||!!t.value&&(q(t.value)?sI(t.value,e):e(t.value))}(r)||"Group"!==r.type&&!1===a)break}break;default:throw Error("non exhaustive match!")}return eI(i)}(t.value,{},t.flags.ignoreCase)}catch(i){if(i.message===nL)t&&nE(`${nO} Unable to optimize: < ${e.toString()} > 15 Complement Sets cannot be automatically optimized. 16 This will disable the lexer's first char optimizations. 17 See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let i="";t&&(i="\n This will disable the lexer's first char optimizations.\n See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),ng(`${nO} 18 Failed parsing: < ${e.toString()} > 19 Using the @chevrotain/regexp-to-ast library 20 Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+i)}}return[]}(t.PATTERN,i.ensureOptimizations);e5(n)&&(E=!1),ev(n,t=>{nF(e,t,m[s])})}else i.ensureOptimizations&&ng(`${nO} TokenType: <${t.name}> is using a custom token pattern without providing <start_chars_hint> parameter. 21 This will disable the lexer's first char optimizations. 22 For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),E=!1;return e},[])}),s={emptyGroups:f,patternIdxToConfig:m,charCodeToPatternIdxToConfig:y,hasCustom:g,canBeOptimized:E}}),this.patternIdxToConfig[i]=s.patternIdxToConfig,this.charCodeToPatternIdxToConfig[i]=s.charCodeToPatternIdxToConfig,this.emptyGroups=st({},this.emptyGroups,s.emptyGroups),this.hasCustom=s.hasCustom||this.hasCustom,this.canModeBeOptimized[i]=s.canBeOptimized}})}),this.defaultMode=i.defaultMode,!e5(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling)throw Error("Errors detected in definition of Lexer:\n"+t8(this.lexerDefinitionErrors,e=>e.message).join("-----------------------\n"));ev(this.lexerDefinitionWarning,e=>{nE(e.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(s&&(this.handleModes=sP),!1===this.trackStartLines&&(this.computeNewColumn=eN),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=sP),/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 e=nl(this.canModeBeOptimized,(e,t,i)=>(!1===t&&e.push(i),e),[]);if(t.ensureOptimizations&&!e5(e))throw Error(`Lexer Modes: < ${e.join(", ")} > cannot be optimized. 23 Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. 24 Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{ny={}}),this.TRACE_INIT("toFastProperties",()=>{iG(this)})})}tokenize(e,t=this.defaultMode){if(!e5(this.lexerDefinitionErrors))throw Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+t8(this.lexerDefinitionErrors,e=>e.message).join("-----------------------\n"));return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){var i;let s,n,r,a,o,l,c,h,u,d,p,f,m,T,g,E,y,A=e.length,S=0,L=0,O=Array(this.hasCustom?0:Math.floor(e.length/10)),R=[],b=this.trackStartLines?1:void 0,N=this.trackStartLines?1:void 0,v=(i=this.emptyGroups,y={},ev(eR(i),e=>{if(q(i[e]))y[e]=[];else throw Error("non exhaustive match")}),y),k=this.trackStartLines,I=this.config.lineTerminatorsPattern,C=0,_=[],x=[],U=[],w=[];Object.freeze(w);let M=!1,P=e=>{if(1===U.length&&void 0===e.tokenType.PUSH_MODE){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);R.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{U.pop();let e=nj(U);_=this.patternIdxToConfig[e],x=this.charCodeToPatternIdxToConfig[e],C=_.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;M=!!x&&!!t}};function D(e){U.push(e),x=this.charCodeToPatternIdxToConfig[e],C=(_=this.patternIdxToConfig[e]).length,C=_.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;M=!!x&&!!t}D.call(this,t);let $=this.config.recoveryEnabled;for(;S<A;){let t;l=null,u=-1;let i=e.charCodeAt(S);if(M){let e=x[nK(i)];t=void 0!==e?e:w}else t=_;let y=t.length;for(s=0;s<y;s++){let n=(E=t[s]).pattern;c=null;let d=E.short;
24if(!1!==d?i===d&&(u=1,l=n):!0===E.isCustom?null!==(g=n.exec(e,S,O,v))?(u=(l=g[0]).length,void 0!==g.payload&&(c=g.payload)):l=null:(n.lastIndex=S,u=this.matchLength(n,e,S)),-1!==u){if(void 0!==(o=E.longerAlt)){l=e.substring(S,S+u);let t=o.length;for(r=0;r<t;r++){let t=_[o[r]],i=t.pattern;if(h=null,!0===t.isCustom?null!==(g=i.exec(e,S,O,v))?(a=g[0],void 0!==g.payload&&(h=g.payload)):a=null:(i.lastIndex=S,a=this.match(i,e,S)),a&&a.length>l.length){l=a,u=a.length,c=h,E=t;break}}}break}}if(-1!==u){if(void 0!==(d=E.group)&&(l=null!==l?l:e.substring(S,S+u),p=E.tokenTypeIdx,f=this.createTokenInstance(l,S,p,E.tokenType,b,N,u),this.handlePayload(f,c),!1===d?L=this.addToken(O,L,f):v[d].push(f)),!0===k&&!0===E.canLineTerminator){let t,i,s=0;I.lastIndex=0;do l=null!==l?l:e.substring(S,S+u),!0===(t=I.test(l))&&(i=I.lastIndex-1,s++);while(!0===t);0!==s?(b+=s,N=u-i,this.updateTokenEndLineColumnLocation(f,d,i,s,b,N,u)):N=this.computeNewColumn(N,u)}else N=this.computeNewColumn(N,u);S+=u,this.handleModes(E,P,D,f)}else{let t=S,i=b,s=N,r=!1===$;for(;!1===r&&S<A;)for(S++,n=0;n<C;n++){let t=_[n],i=t.pattern,s=t.short;if(!1!==s?e.charCodeAt(S)===s&&(r=!0):!0===t.isCustom?r=null!==i.exec(e,S,O,v):(i.lastIndex=S,r=null!==i.exec(e)),!0===r)break}if(m=S-t,N=this.computeNewColumn(N,m),T=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(e,t,m,i,s,nj(U)),R.push({offset:t,line:i,column:s,length:m,message:T}),!1===$)break}}return this.hasCustom||(O.length=L),{tokens:O,groups:v,errors:R}}handleModes(e,t,i,s){if(!0===e.pop){let n=e.push;t(s),void 0!==n&&i.call(this,n)}else void 0!==e.push&&i.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,i,s,n,r,a){let o,l;void 0!==t&&(l=(o=i===a-1)?-1:0,(1!==s||!0!==o)&&(e.endLine=n+l,e.endColumn=r-1+-l))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,i,s){return{image:e,startOffset:t,tokenTypeIdx:i,tokenType:s}}createStartOnlyToken(e,t,i,s,n,r){return{image:e,startOffset:t,startLine:n,startColumn:r,tokenTypeIdx:i,tokenType:s}}createFullToken(e,t,i,s,n,r,a){return{image:e,startOffset:t,endOffset:t+a-1,startLine:n,endLine:n,startColumn:r,endColumn:r+a-1,tokenTypeIdx:i,tokenType:s}}addTokenUsingPush(e,t,i){return e.push(i),t}addTokenUsingMemberAccess(e,t,i){return e[t]=i,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){null!==t&&(e.payload=t)}match(e,t,i){return!0===e.test(t)?t.substring(i,e.lastIndex):null}matchLength(e,t,i){return!0===e.test(t)?e.lastIndex-i:-1}}function n0(e){return n1(e)?e.LABEL:e.name}function n1(e){return i3(e.LABEL)&&""!==e.LABEL}nQ.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.",nQ.NA=/NOT_APPLICABLE/;let n2="categories",n3="label",n6="group",n5="push_mode",n4="pop_mode",n8="longer_alt",n9="line_breaks",n7="start_chars_hint";function re(e){let t=e.pattern,i={};if(i.name=e.name,sH(t)||(i.PATTERN=t),ie(e,"parent"))throw"The parent property is no longer supported.\nSee: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.";return ie(e,n2)&&(i.CATEGORIES=e[n2]),nY([i]),ie(e,n3)&&(i.LABEL=e[n3]),ie(e,n6)&&(i.GROUP=e[n6]),ie(e,n4)&&(i.POP_MODE=e[n4]),ie(e,n5)&&(i.PUSH_MODE=e[n5]),ie(e,n8)&&(i.LONGER_ALT=e[n8]),ie(e,n9)&&(i.LINE_BREAKS=e[n9]),ie(e,n7)&&(i.START_CHARS_HINT=e[n7]),i}let rt=re({name:"EOF",pattern:nQ.NA});function ri(e,t,i,s,n,r,a,o){return{image:t,startOffset:i,endOffset:s,startLine:n,endLine:r,startColumn:a,endColumn:o,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}nY([rt]);let rs={buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:s}){let n=n1(e)?`--> ${n0(e)} <--`:`token of type --> ${e.name} <--`;return`Expecting ${n} but found --> '${t.image}' <--`},buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>"Redundant input, expecting EOF but found: "+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:i,customUserDescription:s,ruleName:n}){let r="Expecting: ",a="\nbut found: '"+nf(t).image+"'";if(s)return r+s+a;{let t=t8(nl(e,(e,t)=>e.concat(t),[]),e=>`[${t8(e,e=>n0(e)).join(", ")}]`),i=t8(t,(e,t)=>` ${t+1}. ${e}`);return r+`one of these possible Token sequences: 25${i.join("\n")}`+a}},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:i,ruleName:s}){let n="Expecting: ",r="\nbut found: '"+nf(t).image+"'";if(i)return n+i+r;{let t=t8(e,e=>`[${t8(e,e=>n0(e)).join(",")}]`);return n+`expecting at least one iteration which starts with one of these possible Token sequences:: 26 <${t.join(" ,")}>`+r}}};Object.freeze(rs);let rn={buildRuleNotFoundError:(e,t)=>
26"Invalid grammar, reference to a rule which is not defined: ->"+t.nonTerminalName+"<-\ninside top level rule: ->"+e.name+"<-"},rr={buildDuplicateFoundError(e,t){let i=e.name,s=nf(t),n=s.idx,r=s_(s),a=s instanceof sg?s.terminalType.name:s instanceof sl?s.nonTerminalName:"",o=`->${r}${n>0?n:""}<- ${a?`with argument: ->${a}<-`:""} 27 appears more than once (${t.length} times) in the top level rule: ->${i}<-. 28 For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES 29 `;return(o=o.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:e=>`Namespace conflict found in grammar. 30The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>. 31To resolve this make sure each Terminal and Non-Terminal names are unique 32This is easy to accomplish by using the convention that Terminal names start with an uppercase letter 33and Non-Terminal names start with a lower case letter.`,buildAlternationPrefixAmbiguityError(e){let t=t8(e.prefixPath,e=>n0(e)).join(", "),i=0===e.alternation.idx?"":e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(" ,")}> due to common lookahead prefix 34in <OR${i}> inside <${e.topLevelRule.name}> Rule, 35<${t}> may appears as a prefix path in all these alternatives. 36See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX 37For Further details.`},buildAlternationAmbiguityError(e){let t=0===e.alternation.idx?"":e.alternation.idx,i=0===e.prefixPath.length,s=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(" ,")}> in <OR${t}> inside <${e.topLevelRule.name}> Rule, 38`;if(i)s+=`These alternatives are all empty (match no tokens), making them indistinguishable. 39Only the last alternative may be empty. 40`;else{let t=t8(e.prefixPath,e=>n0(e)).join(", ");s+=`<${t}> may appears as a prefix path in all these alternatives. 41`}return s+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES 42For Further details.`},buildEmptyRepetitionError(e){let t=s_(e.repetition);return 0!==e.repetition.idx&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens. 43This could lead to an infinite loop.`},buildTokenNameError:e=>"deprecated",buildEmptyAlternationError:e=>`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule. 44Only the last alternative may be an empty alternative.`,buildTooManyAlternativesError:e=>`An Alternation cannot have more than 256 alternatives: 45<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule. 46 has ${e.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(e){let t=e.topLevelRule.name,i=t8(e.leftRecursionPath,e=>e.name),s=`${t} --> ${i.concat([t]).join(" --\x3e ")}`;return`Left Recursion found in grammar. 47rule: <${t}> can be invoked from itself (directly or indirectly) 48without consuming any Tokens. The grammar path that causes this is: 49 ${s} 50 To fix this refactor your grammar to remove the left recursion. 51see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>"deprecated",buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof sc?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}};class ra extends sE{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){ev(eI(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:A.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}let ro=function(e,t){return sj(t8(e,t),1)},rl=function(e,t,i,s){for(var n=-1,r=null==e?0:e.length;++n<r;){var a=e[n];t(s,a,i(a),e)}return s},rc=function(e,t,i,s){return eb(e,function(e,n,r){t(s,e,i(e),r)}),s};var rh=Object.prototype.hasOwnProperty,ru=(p=function(e,t,i){rh.call(e,i)?e[i].push(t):ii(e,i,[t])},function(e,t){return(q(e)?rl:rc)(e,p,t5(t),{})});let rd=function(e,t,i){var s=null==e?0:e.length;return s?iW(e,0,(t=s-(t=i||void 0===t?1:i1(t)))<0?0:t):[]};class rp extends sx{constructor(e,t){super(),this.topProd=e,this.path=t,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=ij(this.path.ruleStack).reverse(),this.occurrenceStack=ij(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,i){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let s=t.concat(i);this.updateExpectedNext(),this.walk(e.referencedRule,s)}}updateExpectedNext(){e5(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class rf extends rp{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,i){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new sh({definition:t.concat(i)});this.possibleTokTypes=sW(e),this.found=!0}}}class rm extends sx{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class rT extends rm{walkMany(e,t,i){if(e.idx===this.occurrence){let e=nf(t.concat(i));this.result.isEndOfRule=void 0===e,e instanceof sg&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,i)}}class rg extends rm{walkManySep(e,t,i){if(e.idx===this.occurrence){let e=nf(t.concat(i));this.result.isEndOfRule=void 0===e,e instanceof sg&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,i)}}class rE extends rm{walkAtLeastOne(e,t,i){if(e.idx===this.occurrence){let e=nf(t.concat(i));this.result.isEndOfRule=void 0===e,e instanceof sg&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,i)}}class ry extends rm{walkAtLeastOneSep(e,t,i){if(e.idx===this.occurrence){let e=nf(t.concat(i));this.result.isEndOfRule=void 0===e,e instanceof sg&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,i)}}function rA(e,t,i=[]){i=ij(i);let s=[],n=0;function r(r){let a=rA(r.concat(i2(e,n+1)),t,i);return s.concat(a)}for(;i.length<t&&n<e.length;){let t=e[n];if(t instanceof sh)return r(t.definition);if(t instanceof sl)return r(t.definition);if(t instanceof su)s=r(t.definition);else if(t instanceof sd)return r(t.definition.concat([new sf({definition:t.definition})]));else if(t instanceof sp)return r([new sh({definition:t.definition}),new sf({definition:[new sg({terminalType:t.separator})].concat(t.definition)})]);else if(t instanceof sm)s=r(t.definition.concat([new sf({definition:[new sg({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof sf)s=r(t.definition.concat([new sf({definition:t.definition})]));else if(t instanceof sT)return ev(t.definition,e=>{!1===e5(e.definition)&&(s=r(e.definition))}),s;else if(t instanceof sg)i.push(t.terminalType);else throw Error("non exhaustive match");n++}return s.push({partialPath:i,suffixDef:i2(e,n)}),s}function rS(e,t,i,s){let n="EXIT_NONE_TERMINAL",r=[n],a="EXIT_ALTERNATIVE",o=!1,l=t.length,c=l-s-1,h=[],u=[];for(u.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});!e5(u);){let e=u.pop();if(e===a){o&&nj(u).idx<=c&&u.pop();continue}let s=e.def,d=e.idx,p=e.ruleStack,f=e.occurrenceStack;if(e5(s))continue;let m=s[0];
51if(m===n){let e={idx:d,def:i2(s),ruleStack:rd(p),occurrenceStack:rd(f)};u.push(e)}else if(m instanceof sg)if(d<l-1){let e=d+1;if(i(t[e],m.terminalType)){let t={idx:e,def:i2(s),ruleStack:p,occurrenceStack:f};u.push(t)}}else if(d===l-1)h.push({nextTokenType:m.terminalType,nextTokenOccurrence:m.idx,ruleStack:p,occurrenceStack:f}),o=!0;else throw Error("non exhaustive match");else if(m instanceof sl){let e=ij(p);e.push(m.nonTerminalName);let t=ij(f);t.push(m.idx);let i={idx:d,def:m.definition.concat(r,i2(s)),ruleStack:e,occurrenceStack:t};u.push(i)}else if(m instanceof su){let e={idx:d,def:i2(s),ruleStack:p,occurrenceStack:f};u.push(e),u.push(a);let t={idx:d,def:m.definition.concat(i2(s)),ruleStack:p,occurrenceStack:f};u.push(t)}else if(m instanceof sd){let e=new sf({definition:m.definition,idx:m.idx}),t={idx:d,def:m.definition.concat([e],i2(s)),ruleStack:p,occurrenceStack:f};u.push(t)}else if(m instanceof sp){let e=new sf({definition:[new sg({terminalType:m.separator})].concat(m.definition),idx:m.idx}),t={idx:d,def:m.definition.concat([e],i2(s)),ruleStack:p,occurrenceStack:f};u.push(t)}else if(m instanceof sm){let e={idx:d,def:i2(s),ruleStack:p,occurrenceStack:f};u.push(e),u.push(a);let t=new sf({definition:[new sg({terminalType:m.separator})].concat(m.definition),idx:m.idx}),i={idx:d,def:m.definition.concat([t],i2(s)),ruleStack:p,occurrenceStack:f};u.push(i)}else if(m instanceof sf){let e={idx:d,def:i2(s),ruleStack:p,occurrenceStack:f};u.push(e),u.push(a);let t=new sf({definition:m.definition,idx:m.idx}),i={idx:d,def:m.definition.concat([t],i2(s)),ruleStack:p,occurrenceStack:f};u.push(i)}else if(m instanceof sT)for(let e=m.definition.length-1;e>=0;e--){let t={idx:d,def:m.definition[e].definition.concat(i2(s)),ruleStack:p,occurrenceStack:f};u.push(t),u.push(a)}else if(m instanceof sh)u.push({idx:d,def:m.definition.concat(i2(s)),ruleStack:p,occurrenceStack:f});else if(m instanceof sc)u.push(function(e,t,i,s){let n=ij(i);n.push(e.name);let r=ij(s);return r.push(1),{idx:t,def:e.definition,ruleStack:n,occurrenceStack:r}}(m,d,p,f));else throw Error("non exhaustive match")}return h}function rL(e){if(e instanceof su||"Option"===e)return E.OPTION;if(e instanceof sf||"Repetition"===e)return E.REPETITION;if(e instanceof sd||"RepetitionMandatory"===e)return E.REPETITION_MANDATORY;if(e instanceof sp||"RepetitionMandatoryWithSeparator"===e)return E.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof sm||"RepetitionWithSeparator"===e)return E.REPETITION_WITH_SEPARATOR;else if(e instanceof sT||"Alternation"===e)return E.ALTERNATION;else throw Error("non exhaustive match")}function rO(e,t,i,s){let n=e.length,r=sI(e,e=>sI(e,e=>1===e.length));if(t)return function(t){let s=t8(t,e=>e.GATE);for(let t=0;t<n;t++){let n=e[t],r=n.length,a=s[t];if(void 0===a||!1!==a.call(this))t:for(let e=0;e<r;e++){let s=n[e],r=s.length;for(let e=0;e<r;e++)if(!1===i(this.LA(e+1),s[e]))continue t;return t}}};if(!r||s)return function(){for(let t=0;t<n;t++){let s=e[t],n=s.length;t:for(let e=0;e<n;e++){let n=s[e],r=n.length;for(let e=0;e<r;e++)if(!1===i(this.LA(e+1),n[e]))continue t;return t}}};{let t=nl(t8(e,e=>sG(e)),(e,t,i)=>(ev(t,t=>{ie(e,t.tokenTypeIdx)||(e[t.tokenTypeIdx]=i),ev(t.categoryMatches,t=>{ie(e,t)||(e[t]=i)})}),e),{});return function(){return t[this.LA(1).tokenTypeIdx]}}}function rR(e,t,i){let s=sI(e,e=>1===e.length),n=e.length;if(!s||i)return function(){t:for(let i=0;i<n;i++){let s=e[i],n=s.length;for(let e=0;e<n;e++)if(!1===t(this.LA(e+1),s[e]))continue t;return!0}return!1};{let t=sG(e);if(1===t.length&&e5(t[0].categoryMatches)){let e=t[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===e}}{let e=nl(t,(e,t,i)=>(e[t.tokenTypeIdx]=!0,ev(t.categoryMatches,t=>{e[t]=!0}),e),[]);return function(){return!0===e[this.LA(1).tokenTypeIdx]}}}}(f=E||(E={}))[f.OPTION=0]="OPTION",f[f.REPETITION=1]="REPETITION",f[f.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",f[f.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",f[f.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",f[f.ALTERNATION=5]="ALTERNATION";class rb extends sx{constructor(e,t,i){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=i}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,i,s){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=i.concat(s),!0)}walkOption(e,t,i){this.checkIsTarget(e,E.OPTION,t,i)||super.walkOption(e,t,i)}walkAtLeastOne(e,t,i){this.checkIsTarget(e,E.REPETITION_MANDATORY,t,i)||super.walkOption(e,t,i)}walkAtLeastOneSep(e,t,i){this.checkIsTarget(e,E.REPETITION_MANDATORY_WITH_SEPARATOR,t,i)||super.walkOption(e,t,i)}walkMany(e,t,i){this.checkIsTarget(e,E.REPETITION,t,i)||super.walkOption(e,t,i)}walkManySep(e,t,i){this.checkIsTarget(e,E.REPETITION_WITH_SEPARATOR,t,i)||super.walkOption(e,t,i)}}class rN extends sE{constructor(e,t,i){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=i,this.result=[]}checkIsTarget(e,t){e.idx===this.targetOccurrence&&this.targetProdType===t&&(void 0===this.targetRef||e===this.targetRef)&&(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,E.OPTION)}visitRepetition(e){this.checkIsTarget(e,E.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,E.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,E.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,E.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,E.ALTERNATION)}}function rv(e){let t=Array(e);for(let i=0;i<e;i++)t[i]=[];return t}function rk(e){let t=[""];for(let i=0;i<e.length;i++){let s=e[i],n=[];for(let e=0;e<t.length;e++){let i=t[e];n.push(i+"_"+s.tokenTypeIdx);for(let e=0;e<s.categoryMatches.length;e++){let t="_"+s.categoryMatches[e];n.push(i+t)}}t=n}return t}function rI(e,t){let i=t8(e,e=>rA([e],1)),s=rv(i.length),n=t8(i,e=>{let t={};return ev(e,e=>{ev(rk(e.partialPath),e=>{t[e]=!0})}),t}),r=i;for(let e=1;e<=t;e++){let i=r;r=rv(i.length);for(let a=0;a<i.length;a++){let o=i[a];for(let i=0;i<o.length;i++){let l=o[i].partialPath,c=o[i].suffixDef,h=rk(l);if(function(e,t,i){for(let s=0;s<e.length;s++){if(s===i)continue;let n=e[s];for(let e=0;e<t.length;e++)if(!0===n[t[e]])return!1}return!0}(n,h,a)||e5(c)||l.length===t){let e=s[a];if(!1===rx(e,l)){e.push(l);for(let e=0;e<h.length;e++){let t=h[e];n[a][t]=!0}}}else{let t=rA(c,e+1,l);r[a]=r[a].concat(t),ev(t,e=>{ev(rk(e.partialPath),e=>{n[a][e]=!0})})}}}}return s}function rC(e,t,i,s){let n=new rN(e,E.ALTERNATION,s);
51return t.accept(n),rI(n.result,i)}function r_(e,t,i,s){let n=new rN(e,i);t.accept(n);let r=n.result,a=new rb(t,e,i).startWalking();return rI([new sh({definition:r}),new sh({definition:a})],s)}function rx(e,t){i:for(let i=0;i<e.length;i++){let s=e[i];if(s.length===t.length){for(let e=0;e<s.length;e++){let i=t[e],n=s[e];if(!1==(i===n||void 0!==n.categoryMatchesMap[i.tokenTypeIdx]))continue i}return!0}}return!1}function rU(e){return sI(e,e=>sI(e,e=>sI(e,e=>e5(e.categoryMatches))))}function rw(e){return`${s_(e)}_#_${e.idx}_#_${rM(e)}`}function rM(e){return e instanceof sg?e.terminalType.name:e instanceof sl?e.nonTerminalName:""}class rP extends sE{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)}}class rD extends sE{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}class r$ extends sE{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)}}let rF="MismatchedTokenException",rB="NoViableAltException",rK="EarlyExitException",rj="NotAllInputParsedException",rG=[rF,rB,rK,rj];function rW(e){return sN(rG,e.name)}Object.freeze(rG);class rz extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class rV extends rz{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=rF}}class rH extends rz{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=rB}}class rY extends rz{constructor(e,t){super(e,t),this.name=rj}}class rX extends rz{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=rK}}let rJ={},rq="InRuleRecoveryException";class rZ extends Error{constructor(e){super(e),this.name=rq}}class rQ{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=ie(e,"recoveryEnabled")?e.recoveryEnabled:aT.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=r0)}getTokenToInsert(e){let t=ri(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,i,s){let n=this.findReSyncTokenType(),r=this.exportLexerState(),a=[],o=!1,l=this.LA(1),c=this.LA(1),h=()=>{let e=this.LA(0),t=new rV(this.errorMessageProvider.buildMismatchTokenMessage({expected:s,actual:l,previous:e,ruleName:this.getCurrRuleFullName()}),l,this.LA(0));t.resyncedTokens=rd(a),this.SAVE_ERROR(t)};for(;!o;)if(this.tokenMatcher(c,s))return void h();else if(i.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(c,n)?o=!0:(c=this.SKIP_TOKEN(),this.addToResyncTokens(c,a));this.importLexerState(r)}shouldInRepetitionRecoveryBeTried(e,t,i){return!(!1===i||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){let i=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(i)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new rZ("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||e5(t))return!1;let i=this.LA(1);return void 0!==nT(t,e=>this.tokenMatcher(i,e))}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return sN(this.getFollowSetFromFollowKey(t),e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA(1),i=2;
51for(;;){let s=nT(e,e=>nW(t,e));if(void 0!==s)return s;t=this.LA(i),i++}}getCurrFollowKey(){if(1===this.RULE_STACK.length)return rJ;let e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),i=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(i)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return t8(e,(i,s)=>0===s?rJ:{ruleName:this.shortRuleNameToFullName(i),idxInCallingRule:t[s],inRule:this.shortRuleNameToFullName(e[s-1])})}flattenFollowSet(){return sG(t8(this.buildFullFollowKeyStack(),e=>this.getFollowSetFromFollowKey(e)))}getFollowSetFromFollowKey(e){if(e===rJ)return[rt];let t=e.ruleName+e.idxInCallingRule+sz+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,rt)||t.push(e),t}reSyncTo(e){let t=[],i=this.LA(1);for(;!1===this.tokenMatcher(i,e);)i=this.SKIP_TOKEN(),this.addToResyncTokens(i,t);return rd(t)}attemptInRepetitionRecovery(e,t,i,s,n,r,a){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:ij(this.RULE_OCCURRENCE_STACK),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return t8(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function r0(e,t,i,s,n,r,a){let o=this.getKeyForAutomaticLookahead(s,n),l=this.firstAfterRepMap[o];if(void 0===l){let e=this.getCurrRuleFullName();l=new r(this.getGAstProductions()[e],n).startWalking(),this.firstAfterRepMap[o]=l}let c=l.token,h=l.occurrence,u=l.isEndOfRule;1===this.RULE_STACK.length&&u&&void 0===c&&(c=rt,h=1),void 0!==c&&void 0!==h&&this.shouldInRepetitionRecoveryBeTried(c,h,a)&&this.tryInRepetitionRecovery(e,t,i,c)}class r1{constructor(e){var t;this.maxLookahead=null!=(t=null==e?void 0:e.maxLookahead)?t:aT.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);return e5(t)?[...t,...this.validateEmptyOrAlternatives(e.rules),...this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),...this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead)]:t}validateNoLeftRecursion(e){return ro(e,e=>(function e(t,i,s,n=[]){let r=[],a=function e(t){let i=[];if(e5(t))return i;let s=nf(t);if(s instanceof sl)i.push(s.referencedRule);else if(s instanceof sh||s instanceof su||s instanceof sd||s instanceof sp||s instanceof sm||s instanceof sf)i=i.concat(e(s.definition));else if(s instanceof sT)i=sG(t8(s.definition,t=>e(t.definition)));else if(s instanceof sg);else throw Error("non exhaustive match");let n=sC(s),r=t.length>1;if(!n||!r)return i;{let s=i2(t);return i.concat(e(s))}}(i.definition);if(e5(a))return[];{let i=t.name;sN(a,t)&&r.push({message:s.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:n}),type:A.LEFT_RECURSION,ruleName:i});let o=ro(nd(a,n.concat([t])),i=>{let r=ij(n);return r.push(i),e(t,i,s,r)});return r.concat(o)}})(e,e,rr))}validateEmptyOrAlternatives(e){return ro(e,e=>{let t;return t=new rD,e.accept(t),ro(t.alternations,t=>ro(rd(t.definition),(i,s)=>e5(rS([i],[],nW,1))?[{message:rr.buildEmptyAlternationError({topLevelRule:e,alternation:t,emptyChoiceIdx:s}),type:A.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:t.idx,alternative:s+1}]:[]))})}validateAmbiguousAlternationAlternatives(e,t){return ro(e,e=>{let i;return i=new rD,e.accept(i),ro(ns(i.alternations,e=>!0===e.ignoreAmbiguities),i=>{var s,n,r,a,o,l,c,h;let u,d,p=rC(i.idx,e,i.maxLookahead||t,i),f=(s=p,n=i,r=e,a=rr,u=[],t8(nl(s,(e,t,i)=>(!0===n.definition[i].ignoreAmbiguities||ev(t,t=>{let r=[i];ev(s,(e,s)=>{i!==s&&rx(e,t)&&!0!==n.definition[s].ignoreAmbiguities&&r.push(s)}),r.length>1&&!rx(u,t)&&(u.push(t),e.push({alts:r,path:t}))}),e),[]),e=>{let t=t8(e.alts,e=>e+1);return{message:a.buildAlternationAmbiguityError({topLevelRule:r,alternation:n,ambiguityIndices:t,prefixPath:e.path}),type:A.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:n.idx,alternatives:e.alts}})),m=(o=p,l=i,c=e,h=rr,np(ro(d=nl(o,(e,t,i)=>{let s=t8(t,e=>({idx:i,path:e}));return e.concat(s)},[]),e=>{if(!0===l.definition[e.idx].ignoreAmbiguities)return[];let t=e.idx,i=e.path;return t8(nc(d,e=>{var s;return!0!==l.definition[e.idx].ignoreAmbiguities&&e.idx<t&&(s=e.path,s.length<i.length&&sI(s,(e,t)=>{let s=i[t];return e===s||s.categoryMatchesMap[e.tokenTypeIdx]}))}),e=>{let i=[e.idx+1,t+1],s=0===l.idx?"":l.idx;return{message:h.buildAlternationPrefixAmbiguityError({topLevelRule:c,alternation:l,ambiguityIndices:i,prefixPath:e.path}),type:A.AMBIGUOUS_PREFIX_ALTS,ruleName:c.name,occurrence:s,alternatives:i}})})));return f.concat(m)})})}validateSomeNonEmptyLookaheadPath(e,t){let i;return i=[],ev(e,e=>{let s=new r$;e.accept(s),ev(s.allProductions,s=>{let n=rL(s),r=s.maxLookahead||t;if(e5(sG(r_(s.idx,e,n,r)[0]))){let t=rr.buildEmptyRepetitionError({topLevelRule:e,repetition:s});i.push({message:t,type:A.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),i}buildLookaheadForAlternation(e){var t,i,s,n,r;let a,o;return t=e.prodOccurrence,i=e.rule,s=e.maxLookahead,n=e.hasPredicates,r=e.dynamicTokensEnabled,o=rU(a=rC(t,i,s))?nz:nW,rO(a,n,o,r)}buildLookaheadForOptional(e){var t,i,s,n,r;let a,o;return t=e.prodOccurrence,i=e.rule,s=e.maxLookahead,n=e.dynamicTokensEnabled,r=rL(e.prodType),o=rU(a=r_(t,i,r,s))?nz:nW,rR(a[0],o,n)}}class r2{initLooksAhead(e){this.dynamicTokensEnabled=ie(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:aT.dynamicTokensEnabled,this.maxLookahead=ie(e,"maxLookahead")?e.maxLookahead:aT.maxLookahead,this.lookaheadStrategy=ie(e,"lookaheadStrategy")?e.lookaheadStrategy:new r1({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){ev(e,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{var t;let i,{alternation:s,repetition:n,option:r,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:l}=(t=e,r6.reset(),t.accept(r6),i=r6.dslMethods,r6.reset(),i);ev(s,t=>{let i=0===t.idx?"":t.idx;this.TRACE_INIT(`${s_(t)}${i}`,()=>{var i;let s=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),n=(i=this.fullRuleNameToShort[e.name],256|t.idx|i);this.setLaFuncCache(n,s)})}),ev(n,t=>{this.computeLookaheadFunc(e,t.idx,768,"Repetition",t.maxLookahead,s_(t))}),ev(r,t=>{this.computeLookaheadFunc(e,t.idx,512,"Option",t.maxLookahead,s_(t))}),ev(a,t=>{this.computeLookaheadFunc(e,t.idx,1024,"RepetitionMandatory",t.maxLookahead,s_(t))}),ev(o,t=>{this.computeLookaheadFunc(e,t.idx,1536,"RepetitionMandatoryWithSeparator",t.maxLookahead,s_(t))}),ev(l,t=>{this.computeLookaheadFunc(e,t.idx,1280,"RepetitionWithSeparator",t.maxLookahead,s_(t))})})})}computeLookaheadFunc(e,t,i,s,n,r){this.TRACE_INIT(`${r}
51${0===t?"":t}`,()=>{let r=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:n||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:s}),a=t|i|this.fullRuleNameToShort[e.name];this.setLaFuncCache(a,r)})}getKeyForAutomaticLookahead(e,t){return t|e|this.getLastExplicitRuleShortName()}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}}class r3 extends sE{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)}}let r6=new r3;function r5(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset)}function r4(e,t){!0===isNaN(e.startOffset)?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==!0&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}function r8(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function r9(e,t){let i=eR(e),s=i.length;for(let n=0;n<s;n++){let s=e[i[n]],r=s.length;for(let e=0;e<r;e++){let i=s[e];void 0===i.tokenTypeIdx&&this[i.name](i.children,t)}}}(m=y||(y={}))[m.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",m[m.MISSING_METHOD=1]="MISSING_METHOD";class r7{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=ie(e,"nodeLocationTracking")?e.nodeLocationTracking:aT.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=r4,this.setNodeLocationFromNode=r4,this.cstPostRule=sP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=sP,this.setNodeLocationFromNode=sP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=r5,this.setNodeLocationFromNode=r5,this.cstPostRule=sP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=sP,this.setNodeLocationFromNode=sP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=sP,this.setNodeLocationFromNode=sP,this.cstPostRule=sP,this.setInitialNodeLocation=sP;else throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);else this.cstInvocationStateUpdate=sP,this.cstFinallyStateUpdate=sP,this.cstPostTerminal=sP,this.cstPostNonTerminal=sP,this.cstPostRule=sP}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 t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),i=e.location;i.startOffset<=t.startOffset==!0?(i.endOffset=t.endOffset,i.endLine=t.endLine,i.endColumn=t.endColumn):(i.startOffset=NaN,i.startLine=NaN,i.startColumn=NaN)}cstPostRuleOnlyOffset(e){let t=this.LA(0),i=e.location;i.startOffset<=t.startOffset==!0?i.endOffset=t.endOffset:i.startOffset=NaN}cstPostTerminal(e,t){let i=this.CST_STACK[this.CST_STACK.length-1];void 0===i.children[e]?i.children[e]=[t]:i.children[e].push(t),this.setNodeLocationFromToken(i.location,t)}cstPostNonTerminal(e,t){let i=this.CST_STACK[this.CST_STACK.length-1];void 0===i.children[t]?i.children[t]=[e]:i.children[t].push(e),this.setNodeLocationFromNode(i.location,e.location)}getBaseCstVisitorConstructor(){if(sH(this.baseCstVisitorConstructor)){var e,t;let i,s=(e=this.className,t=eR(this.gastProductionsCache),r8(i=function(){},e+"BaseSemantics"),i.prototype={visit:function(e,t){if(q(e)&&(e=e[0]),!sH(e))return this[e.name](e.children,t)},validateVisitor:function(){var e,i,s;let n=(e=this,i=t,s=e,np(t8(nc(i,e=>!1===eL(s[e])),e=>({msg:`Missing visitor method: <${e}> on ${s.constructor.name} CST Visitor.`,type:y.MISSING_METHOD,methodName:e}))));if(!e5(n)){let e=t8(n,e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: 52 ${e.join("\n\n").replace(/\n/g,"\n ")}`)}}},i.prototype.constructor=i,i._RULE_NAMES=t,i);return this.baseCstVisitorConstructor=s,s}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(sH(this.baseCstVisitorWithDefaultsConstructor)){var e,t,i;let s,n,r=(e=this.className,t=eR(this.gastProductionsCache),i=this.getBaseCstVisitorConstructor(),r8(s=function(){},e+"BaseSemanticsWithDefaults"),n=Object.create(i.prototype),ev(t,e=>{n[e]=r9}),s.prototype=n,s.prototype.constructor=s,s);return this.baseCstVisitorWithDefaultsConstructor=r,r}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]}}class ae{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)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)):am}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?am:this.tokVector[t]}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()}}class at{ACTION(e){return e.call(this)}consume(e,t,i){return this.consumeInternal(t,e,i)}subrule(e,t,i){return this.subruleInternal(t,e,i)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}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,t,i=ag){if(sN(this.definedRulesNames,e)){let t={message:rr.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:A.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let s=this.defineRule(e,t,i);return this[e]=s,s}OVERRIDE_RULE(e,t,i=ag){var s,n;let r,a,o=(s=this.definedRulesNames,n=this.className,a=[],sN(s,e)||(r=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,a.push({message:r,type:A.INVALID_RULE_OVERRIDE,ruleName:e})),a);this.definitionErrors=this.definitionErrors.concat(o);let l=this.defineRule(e,t,i);return this[e]=l,l}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);let i=this.saveRecogState();try{return e.apply(this,t),!0}catch(e){if(rW(e))return!1;throw e}finally{this.reloadRecogState(i),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return t8(eI(this.gastProductionsCache),function e(t){function i(t){return t8(t,e)}if(t instanceof sl){let e={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return i3(t.label)&&(e.label=t.label),e}if(t instanceof sh)return{type:"Alternative",definition:i(t.definition)};if(t instanceof su)return{type:"Option",idx:t.idx,definition:i(t.definition)};if(t instanceof sd)return{type:"RepetitionMandatory",idx:t.idx,definition:i(t.definition)};if(t instanceof sp)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:e(new sg({terminalType:t.separator})),definition:i(t.definition)};else if(t instanceof sm)return{type:"RepetitionWithSeparator",idx:t.idx,separator:e(new sg({terminalType:t.separator})),definition:i(t.definition)};else if(t instanceof sf)return{type:"Repetition",idx:t.idx,definition:i(t.definition)};else if(t instanceof sT)return{type:"Alternation",idx:t.idx,definition:i(t.definition)};else if(t instanceof sg){var s,n;let e={type:"Terminal",name:t.terminalType.name,label:i3((n=s=t.terminalType).LABEL)&&""!==n.LABEL?s.LABEL:s.name,idx:t.idx};i3(t.label)&&(e.terminalLabel=t.label);let i=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(e.pattern=sa(i)?i.source:i),e}else if(t instanceof sc)return{type:"Rule",name:t.name,orgText:t.orgText,definition:i(t.definition)};else throw Error("non exhaustive match")})}}class ai{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={}
52,this.ruleShortNameIdx=256,this.tokenMatcher=nz,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},ie(t,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a <serializedGrammar> property.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n For Further details.");if(q(e)){if(e5(e))throw Error("A Token Vocabulary cannot be empty.\n Note that the first argument for the parser constructor\n is no longer a Token vector (since v4.0).");if("number"==typeof e[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n For Further details.")}if(q(e))this.tokensMap=nl(e,(e,t)=>(e[t.name]=t,e),{});else if(ie(e,"modes")&&sI(sG(eI(e.modes)),nq)){let t=sF(sG(eI(e.modes)));this.tokensMap=nl(t,(e,t)=>(e[t.name]=t,e),{})}else if(eS(e))this.tokensMap=ij(e);else throw Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=rt;let i=sI(ie(e,"modes")?sG(eI(e.modes)):eI(e),e=>e5(e.categoryMatches));this.tokenMatcher=i?nz:nW,nY(eI(this.tokensMap))}defineRule(e,t,i){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called' 53Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let s=ie(i,"resyncEnabled")?i.resyncEnabled:ag.resyncEnabled,n=ie(i,"recoveryValueFunc")?i.recoveryValueFunc:ag.recoveryValueFunc,r=this.ruleShortNameIdx<<12;return this.ruleShortNameIdx++,this.shortRuleNameToFull[r]=e,this.fullRuleNameToShort[e]=r,Object.assign(!0===this.outputCst?function(...i){try{this.ruleInvocationStateUpdate(r,e,this.subruleIdx),t.apply(this,i);let s=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(s),s}catch(e){return this.invokeRuleCatch(e,s,n)}finally{this.ruleFinallyStateUpdate()}}:function(...i){try{return this.ruleInvocationStateUpdate(r,e,this.subruleIdx),t.apply(this,i)}catch(e){return this.invokeRuleCatch(e,s,n)}finally{this.ruleFinallyStateUpdate()}},{ruleName:e,originalGrammarAction:t})}invokeRuleCatch(e,t,i){let s=1===this.RULE_STACK.length,n=t&&!this.isBackTracking()&&this.recoveryEnabled;if(rW(e)){if(n){let t=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(t)){if(e.resyncedTokens=this.reSyncTo(t),!this.outputCst)return i(e);{let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}}if(this.outputCst){let t=this.CST_STACK[this.CST_STACK.length-1];t.recoveredNode=!0,e.partialCstResult=t}throw e}if(s)return this.moveToTerminatedState(),i(e)}throw e}optionInternal(e,t){let i=this.getKeyForAutomaticLookahead(512,t);return this.optionInternalLogic(e,t,i)}optionInternalLogic(e,t,i){let s,n=this.getLaFuncFromCache(i);if("function"!=typeof e){s=e.DEF;let t=e.GATE;if(void 0!==t){let e=n;n=()=>t.call(this)&&e.call(this)}}else s=e;if(!0===n.call(this))return s.call(this)}atLeastOneInternal(e,t){let i=this.getKeyForAutomaticLookahead(1024,e);return this.atLeastOneInternalLogic(e,t,i)}atLeastOneInternalLogic(e,t,i){let s,n=this.getLaFuncFromCache(i);if("function"!=typeof t){s=t.DEF;let e=t.GATE;if(void 0!==e){let t=n;n=()=>e.call(this)&&t.call(this)}}else s=t;if(!0===n.call(this)){let e=this.doSingleRepetition(s);for(;!0===n.call(this)&&!0===e;)e=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,E.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],n,1024,e,rE)}atLeastOneSepFirstInternal(e,t){let i=this.getKeyForAutomaticLookahead(1536,e);this.atLeastOneSepFirstInternalLogic(e,t,i)}atLeastOneSepFirstInternalLogic(e,t,i){let s=t.DEF,n=t.SEP;if(!0===this.getLaFuncFromCache(i).call(this)){s.call(this);let t=()=>this.tokenMatcher(this.LA(1),n);for(;!0===this.tokenMatcher(this.LA(1),n);)this.CONSUME(n),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,t,s,ry],t,1536,e,ry)}else throw this.raiseEarlyExitException(e,E.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){let i=this.getKeyForAutomaticLookahead(768,e);return this.manyInternalLogic(e,t,i)}
53manyInternalLogic(e,t,i){let s,n=this.getLaFuncFromCache(i);if("function"!=typeof t){s=t.DEF;let e=t.GATE;if(void 0!==e){let t=n;n=()=>e.call(this)&&t.call(this)}}else s=t;let r=!0;for(;!0===n.call(this)&&!0===r;)r=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],n,768,e,rT,r)}manySepFirstInternal(e,t){let i=this.getKeyForAutomaticLookahead(1280,e);this.manySepFirstInternalLogic(e,t,i)}manySepFirstInternalLogic(e,t,i){let s=t.DEF,n=t.SEP;if(!0===this.getLaFuncFromCache(i).call(this)){s.call(this);let t=()=>this.tokenMatcher(this.LA(1),n);for(;!0===this.tokenMatcher(this.LA(1),n);)this.CONSUME(n),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,t,s,rg],t,1280,e,rg)}}repetitionSepSecondInternal(e,t,i,s,n){for(;i();)this.CONSUME(t),s.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,i,s,n],i,1536,e,n)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let i=this.getKeyForAutomaticLookahead(256,t),s=q(e)?e:e.DEF,n=this.getLaFuncFromCache(i).call(this,s);if(void 0!==n)return s[n].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new rY(t,e))}}subruleInternal(e,t,i){let s;try{let n=void 0!==i?i.ARGS:void 0;return this.subruleIdx=t,s=e.apply(this,n),this.cstPostNonTerminal(s,void 0!==i&&void 0!==i.LABEL?i.LABEL:e.ruleName),s}catch(t){throw this.subruleInternalError(t,i,e.ruleName)}}subruleInternalError(e,t,i){throw rW(e)&&void 0!==e.partialCstResult&&(this.cstPostNonTerminal(e.partialCstResult,void 0!==t&&void 0!==t.LABEL?t.LABEL:i),delete e.partialCstResult),e}consumeInternal(e,t,i){let s;try{let t=this.LA(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),s=t):this.consumeInternalError(e,t,i)}catch(i){s=this.consumeInternalRecovery(e,t,i)}return this.cstPostTerminal(void 0!==i&&void 0!==i.LABEL?i.LABEL:e.name,s),s}consumeInternalError(e,t,i){let s,n=this.LA(0);throw s=void 0!==i&&i.ERR_MSG?i.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:n,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new rV(s,t,n))}consumeInternalRecovery(e,t,i){if(this.recoveryEnabled&&"MismatchedTokenException"===i.name&&!this.isBackTracking()){let s=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,s)}catch(e){if(e.name===rq)throw i;throw e}}throw i}saveRecogState(){let e=this.errors,t=ij(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,i){this.RULE_OCCURRENCE_STACK.push(i),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return 0!==this.isBackTrackingStack.length}getCurrRuleFullName(){let e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),rt)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class as{initErrorHandler(e){this._errors=[],this.errorMessageProvider=ie(e,"errorMessageProvider")?e.errorMessageProvider:aT.errorMessageProvider}SAVE_ERROR(e){if(rW(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:ij(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return ij(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,i){let s=this.getCurrRuleFullName(),n=r_(e,this.getGAstProductions()[s],t,this.maxLookahead)[0],r=[];for(let e=1;e<=this.maxLookahead;e++)r.push(this.LA(e));let a=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:n,actual:r,previous:this.LA(0),customUserDescription:i,ruleName:s});throw this.SAVE_ERROR(new rX(a,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let i=this.getCurrRuleFullName(),s=rC(e,this.getGAstProductions()[i],this.maxLookahead),n=[];for(let e=1;e<=this.maxLookahead;e++)n.push(this.LA(e));let r=this.LA(0),a=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:n,previous:r,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new rH(a,this.LA(1),r))}}class an{initContentAssist(){}computeContentAssist(e,t){let i=this.gastProductionsCache[e];if(sH(i))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return rS([i],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){let t=nf(e.ruleStack);return new rf(this.getGAstProductions()[t],e).startWalking()}}let ar={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ar);let aa=re({name:"RECORDING_PHASE_TOKEN",pattern:nQ.NA});nY([aa]);let ao=ri(aa,"This IToken indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(ao);let al={name:"This CSTNode indicates the Parser is in Recording Phase\n See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}};class ac{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 t=e>0?e:"";this[`CONSUME${t}`]=function(t,i){return this.consumeInternalRecord(t,e,i)},this[`SUBRULE${t}`]=function(t,i){return this.subruleInternalRecord(t,e,i)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,i){return this.consumeInternalRecord(t,e,i)},this.subrule=function(e,t,i){return this.subruleInternalRecord(t,e,i)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},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",()=>{for(let e=0;e<10;e++){let t=e>0?e:"";delete this[`CONSUME${t}`],delete this[`SUBRULE${t}`],delete this[`OPTION${t}`],delete this[`OR${t}`],delete this[`MANY${t}`],delete this[`MANY_SEP${t}`],delete this[`AT_LEAST_ONE${t}`],delete this[`AT_LEAST_ONE_SEP${t}`]}delete this.consume,delete this.subrule,delete this.option,delete this.or,delete this.many,delete this.atLeastOne,delete this.ACTION,delete this.BACKTRACK,delete this.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return am}topLevelRuleRecord(e,t){try{let i=new sc({definition:[],name:e});return i.name=e,this.recordingProdStack.push(i),t.call(this),this.recordingProdStack.pop(),i}
53catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message=e.message+'\n This error was thrown during the "grammar recording phase" For more info see:\n https://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(e){}throw e}}optionInternalRecord(e,t){return ah.call(this,su,e,t)}atLeastOneInternalRecord(e,t){ah.call(this,sd,t,e)}atLeastOneSepFirstInternalRecord(e,t){ah.call(this,sp,t,e,!0)}manyInternalRecord(e,t){ah.call(this,sf,t,e)}manySepFirstInternalRecord(e,t){ah.call(this,sm,t,e,!0)}orInternalRecord(e,t){return au.call(this,e,t)}subruleInternalRecord(e,t,i){if(ap(t),!e||!1===ie(e,"ruleName")){let i=Error(`<SUBRULE${ad(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}> 54 inside top level rule: <${this.recordingProdStack[0].name}>`);throw i.KNOWN_RECORDER_ERROR=!0,i}let s=nj(this.recordingProdStack),n=new sl({idx:t,nonTerminalName:e.ruleName,label:null==i?void 0:i.LABEL,referencedRule:void 0});return s.definition.push(n),this.outputCst?al:ar}consumeInternalRecord(e,t,i){if(ap(t),!nX(e)){let i=Error(`<CONSUME${ad(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}> 55 inside top level rule: <${this.recordingProdStack[0].name}>`);throw i.KNOWN_RECORDER_ERROR=!0,i}let s=nj(this.recordingProdStack),n=new sg({idx:t,terminalType:e,label:null==i?void 0:i.LABEL});return s.definition.push(n),ao}}function ah(e,t,i,s=!1){ap(i);let n=nj(this.recordingProdStack),r=eL(t)?t:t.DEF,a=new e({definition:[],idx:i});return s&&(a.separator=t.SEP),ie(t,"MAX_LOOKAHEAD")&&(a.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(a),r.call(this),n.definition.push(a),this.recordingProdStack.pop(),ar}function au(e,t){ap(t);let i=nj(this.recordingProdStack),s=!1===q(e),n=!1===s?e:e.DEF,r=new sT({definition:[],idx:t,ignoreAmbiguities:s&&!0===e.IGNORE_AMBIGUITIES});return ie(e,"MAX_LOOKAHEAD")&&(r.maxLookahead=e.MAX_LOOKAHEAD),r.hasPredicates=sA(n,e=>eL(e.GATE)),i.definition.push(r),ev(n,e=>{let t=new sh({definition:[]});r.definition.push(t),ie(e,"IGNORE_AMBIGUITIES")?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:ie(e,"GATE")&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),ar}function ad(e){return 0===e?"":`${e}`}function ap(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}> 56 Idx value must be a none negative value smaller than ${256}`);throw t.KNOWN_RECORDER_ERROR=!0,t}}class af{initPerformanceTracer(e){if(ie(e,"traceInitPerf")){let t=e.traceInitPerf,i="number"==typeof t;this.traceInitMaxIdent=i?t:1/0,this.traceInitPerf=i?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=aT.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0!==this.traceInitPerf)return t();{this.traceInitIndent++;let i=Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${i}--> <${e}>`);let{time:s,value:n}=nG(t),r=s>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&r(`${i}<-- <${e}> time: ${s}ms`),this.traceInitIndent--,n}}}let am=ri(rt,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(am);let aT=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:rs,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),ag=Object.freeze({recoveryValueFunc:()=>void 0,resyncEnabled:!0});(T=A||(A={}))[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";class aE{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 t=this.className;this.TRACE_INIT("toFastProps",()=>{iG(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),ev(this.definedRulesNames,e=>{let t,i=this[e].originalGrammarAction;this.TRACE_INIT(`${e} Rule`,()=>{t=this.topLevelRuleRecord(e,i)}),this.gastProductionsCache[e]=t})}finally{this.disableRecording()}});let i=[];if(this.TRACE_INIT("Grammar Resolving",()=>{var e;let t,s,n;s=ne(e={rules:eI(this.gastProductionsCache)},{errMsgProvider:rn}),n={},ev(e.rules,e=>{n[e.name]=e}),(t=new ra(n,s.errMsgProvider)).resolveRefs(),i=t.errors,this.definitionErrors=this.definitionErrors.concat(i)}),this.TRACE_INIT("Grammar Validations",()=>{if(e5(i)&&!1===this.skipValidations){var e,s,n,r,a,o,l,c,h;let i,u,d,p,f,m,T=(s=(e=ne(e={rules:eI(this.gastProductionsCache),tokenTypes:eI(this.tokensMap),errMsgProvider:rr,grammarName:t},{errMsgProvider:rr})).rules,n=e.tokenTypes,r=e.errMsgProvider,a=e.grammarName,d=ro(s,e=>{var t,i;let s;return t=e,i=r,s=new rP,t.accept(s),t8(eI(sn(ru(s.allProductions,rw),e=>e.length>1)),e=>{let s=nf(e),n=i.buildDuplicateFoundError(t,e),r=s_(s),a={message:n,type:A.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:r,occurrence:s.idx},o=rM(s);return o&&(a.parameter=o),a})}),l=s,c=n,h=r,i=[],u=t8(c,e=>e.name),ev(l,e=>{let t=e.name;if(sN(u,t)){let s=h.buildNamespaceConflictError(e);i.push({message:s,type:A.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),p=i,f=ro(s,e=>{var t,i;let s;return t=e,i=r,s=new rD,t.accept(s),ro(s.alternations,e=>e.definition.length>255?[{message:i.buildTooManyAlternativesError({topLevelRule:t,alternation:e}),type:A.TOO_MANY_ALTS,ruleName:t.name,occurrence:e.idx}]:[])}),m=ro(s,e=>(function(e,t,i,s){let n=[];if(nl(t,(t,i)=>i.name===e.name?t+1:t,0)>1){let t=s.buildDuplicateRuleNameError({topLevelRule:e,grammarName:i});n.push({message:t,type:A.DUPLICATE_RULE_NAME,ruleName:e.name})}return n})(e,s,a,r)),d.concat(p,f,m)),g=t8((o={lookaheadStrategy:this.lookaheadStrategy,rules:eI(this.gastProductionsCache),tokenTypes:eI(this.tokensMap),grammarName:t}).lookaheadStrategy.validate({rules:o.rules,tokenTypes:o.tokenTypes,grammarName:o.grammarName}),e=>Object.assign({type:A.CUSTOM_LOOKAHEAD_VALIDATION},e));this.definitionErrors=this.definitionErrors.concat(T,g)}}),e5(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{var e;let t,i=(e=eI(this.gastProductionsCache),t={},ev(e,e=>{st(t,new sV(e).startWalking())}),t);this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var e,t;null==(t=(e=this.lookaheadStrategy).initialize)||t.call(e,{rules:eI(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(eI(this.gastProductionsCache))})),!aE.DEFER_DEFINITION_ERRORS_HANDLING&&!e5(this.definitionErrors))throw e=t8(this.definitionErrors,e=>e.message),Error(`Parser Definition Errors detected: 57 ${e.join("\n-------------------------------\n")}`)})}constructor(e,t){if(this.definitionErrors=[],this.selfAnalysisDone=!1,this.initErrorHandler(t),this.initLexerAdapter(),this.initLooksAhead(t),this.initRecognizerEngine(e,t),this.initRecoverable(t),this.initTreeBuilder(t),this.initContentAssist(),this.initGastRecorder(t),this.initPerformanceTracer(t),ie(t,"ignoredIssues"))throw Error("The <ignoredIssues> IParserConfig property has been deprecated.\n Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.\n See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n For further details.");this.skipValidations=ie(t,"skipValidations")?t.skipValidations:aT.skipValidations}}aE.DEFER_DEFINITION_ERRORS_HANDLING=!1,[rQ,r2,r7,ae,ai,at,as,an,ac,af].forEach(e
57=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(i=>{if("constructor"===i)return;let s=Object.getOwnPropertyDescriptor(t,i);s&&(s.get||s.set)?Object.defineProperty(aE.prototype,i,s):aE.prototype[i]=e.prototype[i]})});class ay extends aE{constructor(e,t=aT){const i=ij(t);i.outputCst=!0,super(e,i)}}var aA=i(56047);function aS(e,t){let i=e.lexer.tokenize(t);if(i.errors.length>0){let s=i.errors[0],n=Number.isFinite(s.offset)?s.offset:t.length,r=n+(Number.isFinite(s.length)?s.length:0);throw Error(`Error lexing ${e.diagramType} diagram: ${s.message} at line ${s.line??1}, column ${s.column??1} [${n},${r})`)}e.parser.input=i.tokens;let s=e.entry();if(e.parser.errors.length>0)throw Error(`Error parsing ${e.diagramType} diagram: ${e.parser.errors[0].message}`);e.visit(s)}(0,I.K)(aS,"runChevrotainParse");var aL=v.UI.usecase,aO=(0,I.K)(()=>({actors:new Map,useCases:new Map,systemBoundaries:new Map,relationships:[],notes:new Map,jsonNodes:new Map,classDefs:new Map,symbols:new Map,direction:"LR",relationshipCounter:0,noteCounter:0,accTitle:"",accDescription:"",ast:void 0,config:structuredClone(aL)}),"createModel"),aR=(0,I.K)(e=>{if(!(e.actors instanceof Map)||!(e.useCases instanceof Map)||!(e.systemBoundaries instanceof Map)||!Array.isArray(e.relationships)||!(e.notes instanceof Map)||!(e.jsonNodes instanceof Map)||!(e.classDefs instanceof Map)||!(e.symbols instanceof Map)||!["TB","TD","BT","RL","LR"].includes(e.direction)||!Number.isSafeInteger(e.relationshipCounter)||e.relationshipCounter<0||!Number.isSafeInteger(e.noteCounter)||e.noteCounter<0||"string"!=typeof e.accTitle||"string"!=typeof e.accDescription||!e.config)throw Error("Cannot commit an incomplete usecase model")},"assertCompleteModel"),ab=aO(),aN=(0,I.K)(()=>structuredClone(ab.config),"getConfig"),av=(0,I.K)(()=>ab.ast,"getAST"),ak=(0,I.K)(e=>{let t=structuredClone(e);aR(t);let i=(0,v.iN)(),s=(0,v.m7)();try{(0,v.SV)(t.accTitle),(0,v.EI)(t.accDescription),ab=t}catch(e){throw(0,v.SV)(i),(0,v.EI)(s),e}},"commit"),aI=(0,I.K)(()=>{ab=aO(),(0,v.IU)()},"clear"),aC=(0,I.K)(()=>ab.actors,"getActors"),a_=(0,I.K)(e=>ab.actors.get(e),"getActor"),ax=(0,I.K)(()=>ab.useCases,"getUseCases"),aU=(0,I.K)(e=>ab.useCases.get(e),"getUseCase"),aw=(0,I.K)(()=>ab.systemBoundaries,"getSystemBoundaries"),aM=(0,I.K)(e=>ab.systemBoundaries.get(e),"getSystemBoundary"),aP=(0,I.K)(()=>ab.relationships,"getRelationships"),aD=(0,I.K)(()=>ab.notes,"getNotes"),a$=(0,I.K)(e=>ab.notes.get(e),"getNote"),aF=(0,I.K)(()=>ab.jsonNodes,"getJsonNodes"),aB=(0,I.K)(e=>ab.jsonNodes.get(e),"getJsonNode"),aK=(0,I.K)(()=>ab.classDefs,"getClassDefs"),aj=(0,I.K)(e=>ab.classDefs.get(e),"getClassDef"),aG=(0,I.K)(()=>ab.direction,"getDirection"),aW=(0,I.K)(e=>{let t=new Map;for(let i of["default",...e]){let e=ab.classDefs.get(i);if(e)for(let i of e.styles){let e=i.trim(),s=e.indexOf(":"),n=(-1===s?e:e.slice(0,s)).trim();n&&t.set(n,e)}}return[...t.values()]},"getCompiledStyles"),az=(0,I.K)(e=>e.replaceAll("~","~0").replaceAll("/","~1"),"escapeJsonPointerPart"),aV=(0,I.K)(e=>"string"==typeof e?e:null===e?"null":String(e),"displayJsonScalar"),aH=(0,I.K)((e,t,i=e=>e)=>{let s=[],n=(0,I.K)((e,t,n)=>{s.push({key:i(e),accessibleKey:i(t),value:i(n)})},"append"),r=(0,I.K)((e,i,s)=>{if(Array.isArray(e)){if(0===e.length)return void n(i,i,"[]");if(e.every(e=>null===e||["string","number","boolean"].includes(typeof e))){for(let[t,s]of e.entries())n(0===t?i:"",i,aV(s));return}for(let[t,n]of e.entries())r(n,`${i}[${t}]`,`${s}/${t}`);return}if(null!==e&&"object"==typeof e){let a=t[s]??Object.keys(e);if(0===a.length)return void n(i,i,"{}");for(let t of a){let n=i?`${i}.${t}`:t;r(e[t],n,`${s}/${az(t)}`)}return}n(i,i,aV(e))},"visit");return r(e,"",""),s},"flattenJsonRows"),aY=(0,I.K)(e=>{switch(e.type){case"hollow":return"usecaseActorHollow";case"awesome":return"usecaseActorAwesome";case"icon":return"usecaseActorIcon";case"normal":return"usecaseActor"}},"actorShape"),aX=(0,I.K)(e=>"ellipse"===e.shape?e.business?"usecaseBusiness":"usecaseEllipse":e.shape,"useCaseShape"),aJ=(0,I.K)(e=>{switch(e){case 0:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point"};case 1:return{arrowTypeStart:"arrow_point",arrowTypeEnd:"none"};case 3:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_circle"};case 4:return{arrowTypeStart:"none",arrowTypeEnd:"arrow_cross"};case 5:return{arrowTypeStart:"arrow_circle",arrowTypeEnd:"none"};case 6:return{arrowTypeStart:"arrow_cross",arrowTypeEnd:"none"};case 2:return{arrowTypeStart:"none",arrowTypeEnd:"none"}}},"associationMarkers"),aq=(0,I.K)(e=>{switch(e.type){case"include":case"extend":return{arrowTypeStart:"none",arrowTypeEnd:"arrow_point",pattern:"dotted",label:e.type,labelType:"text"};case"generalization":return{arrowTypeStart:"none",arrowTypeEnd:"extension",pattern:"solid"};case"association":return{...aJ(e.arrowType),pattern:"solid",...e.label?{label:e.label}:{},...e.labelType?{labelType:e.labelType}:{}}}},"relationshipVisuals"),aZ=(0,I.K)(e=>e.animate||e.animation?[`edge-animation-${e.animation??"fast"}`]:[],"animationClasses"),aQ=(0,I.K)((...e)=>e.filter(e=>!!e).join(" "),"classNames"),a0=(0,I.K)(()=>{let e=(0,v.D7)(),t={...ab.config,...e.usecase},i=(0,I.K)(t=>(0,v.jZ)(t,e),"sanitize"),s=(0,I.K)(e=>i(ab.actors.get(e)?.label??ab.useCases.get(e)?.label??ab.jsonNodes.get(e)?.id??ab.notes.get(e)?.label??e),"endpointLabel"),n=[],r=[],a=0,o=0;for(let t of ab.actors.values())n.push({id:t.id,label:i(t.label),labelType:t.labelType,shape:aY(t),isGroup:!1,padding:10,look:e.look,colorIndex:a++,cssClasse
57s:aQ("default","usecase-actor",`usecase-actor-${t.type}`,t.business&&"usecase-business",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:aW(t.classes),actorType:t.type,business:t.business,...t.icon?{icon:t.icon}:{},...t.stereotype?{stereotype:i(t.stereotype)}:{},...t.parentId?{parentId:t.parentId}:{}});for(let t of ab.useCases.values())n.push({id:t.id,label:i(t.label),labelType:t.labelType,shape:aX(t),isGroup:!1,padding:"ellipse"===t.shape?20:10,look:e.look,colorIndex:a++,cssClasses:aQ("default","usecase-element",`usecase-${t.shape}`,t.business&&"usecase-business",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:aW(t.classes),business:t.business,...t.stereotype?{stereotype:i(t.stereotype)}:{},...t.parentId?{parentId:t.parentId}:{}});for(let t of ab.notes.values())n.push({id:t.id,label:i(t.label),labelType:t.labelType,shape:"note",isGroup:!1,padding:10,look:e.look,cssClasses:"default usecase-note",cssStyles:[],cssCompiledStyles:aW([]),noteTarget:t.target,noteTargetLabel:i(ab.actors.get(t.target)?.label??ab.useCases.get(t.target)?.label??ab.jsonNodes.get(t.target)?.id??t.target)});for(let t of ab.jsonNodes.values())n.push({id:t.id,label:i(t.id),labelType:"text",shape:"usecaseJsonTable",isGroup:!1,padding:10,look:e.look,cssClasses:aQ("default","usecase-json-table",...t.classes),cssStyles:[...t.styles],cssCompiledStyles:aW(t.classes),jsonRows:aH(t.value,t.propertyOrder,i)});for(let t of ab.systemBoundaries.values())n.push({id:t.id,label:i(t.label),labelType:t.labelType,shape:"usecaseSystemBoundary",isGroup:!0,padding:20,look:e.look,colorIndex:o++,cssClasses:aQ("default","system-boundary",`system-boundary-${t.type}`,...t.classes),cssStyles:[...t.styles],cssCompiledStyles:aW(t.classes),boundaryType:t.type});for(let t of ab.relationships){let{label:n,...a}=aq(t);r.push({id:t.id,start:t.source,end:t.target,source:t.source,target:t.target,sourceLabel:s(t.source),targetLabel:s(t.target),type:"edge",relationshipType:t.type,internal:!1,...a,...void 0!==n?{label:i(n)}:{},labelpos:"c",classes:aQ("default","relationship",`relationship-${t.type}`,...t.classes,...aZ(t)),style:[...t.styles],cssCompiledStyles:aW(t.classes),animate:t.animate,...t.animation?{animation:t.animation}:{},look:e.look,thickness:"normal",minlen:t.minlen,isUserDefinedId:t.explicitId})}for(let t of ab.notes.values())r.push({id:`${t.id}-edge`,start:t.id,end:t.target,source:t.id,target:t.target,type:"edge",relationshipType:"note",sourceLabel:s(t.id),targetLabel:s(t.target),internal:!0,pattern:"dotted",arrowTypeStart:"none",arrowTypeEnd:"none",labelpos:"c",classes:"default relationship relationship-note",style:[],cssCompiledStyles:aW([]),animate:!1,look:e.look,thickness:"normal",minlen:1,isUserDefinedId:!1});for(let e of n)e.wrappingWidth??=t.wrappingWidth,e.isGroup||e.shape.startsWith("usecaseActor")||(e.minWidth??=t.minNodeWidth),("usecaseEllipse"===e.shape||"usecaseBusiness"===e.shape)&&(e.spreadPorts=!0);return{nodes:n,edges:r,config:e,type:"usecase",layoutAlgorithm:"dagre",direction:aG(),nodeSpacing:t.nodeSpacing,rankSpacing:t.rankSpacing,actorFontSize:t.actorFontSize,actorFontFamily:t.actorFontFamily,actorFontWeight:t.actorFontWeight,usecaseFontSize:t.usecaseFontSize,usecaseFontFamily:t.usecaseFontFamily,usecaseFontWeight:t.usecaseFontWeight,diagramPadding:t.diagramPadding,useMaxWidth:t.useMaxWidth,markers:["point","circle","cross","extension"]}},"getData"),a1={getConfig:aN,createModel:aO,commit:ak,getAST:av,clear:aI,setDiagramTitle:v.ke,getDiagramTitle:v.ab,setAccTitle:v.SV,getAccTitle:v.iN,setAccDescription:v.EI,getAccDescription:v.m7,getActors:aC,getActor:a_,getUseCases:ax,getUseCase:aU,getSystemBoundaries:aw,getSystemBoundary:aM,getRelationships:aP,getNotes:aD,getNote:a$,getJsonNodes:aF,getJsonNode:aB,getClassDefs:aK,getClassDef:aj,getDirection:aG,getData:a0};function a2(e,t,i){let s=[i];return s.index=t,s.input=e,s}(0,I.K)(a2,"customMatch");var a3=(0,I.K)((e,t)=>{if('"'!==e[t]||"`"!==e[t+1])return null;for(let i=t+2;i<e.length-1;i++)if("`"===e[i]&&'"'===e[i+1])return a2(e,t,e.slice(t,i+2));return null},"matchMarkdownString"),a6=(0,I.K)((e,t)=>{if("%"!==e[t]||"%"!==e[t+1])return null;for(let i=t-1;i>=0;i--){let t=e[i];if("\n"===t||"\r"===t)break;
57if(" "!==t&&" "!==t)return null}let i=t+2;for(;i<e.length&&"\n"!==e[i]&&"\r"!==e[i];)i++;return a2(e,t,e.slice(t,i))},"matchComment"),a5=(0,I.K)((e,t)=>{for(let i=t-1;i>=0;i--){let t=e[i];if("\n"===t||"\r"===t)break;if(" "!==t&&" "!==t)return!1}return!0},"isIndentedLineStart"),a4=(0,I.K)((e,t,i)=>{if(!a5(e,t))return null;let s=i.exec(e.slice(t));return s?a2(e,t,s[0]):null},"matchAccessibilityLine"),a8=(0,I.K)((e,t)=>{if(!a5(e,t))return null;let i=/^accDescr[\t ]*{/.exec(e.slice(t));if(!i)return null;let s=e.indexOf("}",t+i[0].length);return -1===s?null:a2(e,t,e.slice(t,s+1))},"matchAccDescrBlock"),a9=(0,I.K)((e,t)=>{if("{"!==e[t])return null;let i=0,s=!1,n=!1;for(let r=t;r<e.length;r++){let a=e[r];if(s){n?n=!1:"\\"===a?n=!0:'"'===a&&(s=!1);continue}if('"'===a)s=!0;else if("{"===a)i++;else if("}"===a&&0==--i)return a2(e,t,e.slice(t,r+1))}return null},"matchJsonObject"),a7=(0,I.K)((e,t)=>{let i=e.indexOf(">>",t);if(-1===i||/[\n\r]/.test(e.slice(t,i)))return null;let s=e.slice(t,i);return s.trim()?a2(e,t,s):null},"matchStereotypeText"),oe=re({name:"LABEL_TEXT",pattern:nQ.NA}),ot=re({name:"WORD",pattern:nQ.NA,categories:oe}),oi=re({name:"NUMBER",pattern:/(?:\d+\.\d+|\d+|\.\d+)(?:[A-Za-z]+)?/,categories:oe}),os=re({name:"IDENTIFIER",pattern:/\w+/,longer_alt:oi,categories:ot}),on=re({name:"HWS",pattern:/[\t ]+/,group:nQ.SKIPPED}),or=re({name:"MARKDOWN_STRING",pattern:a3,start_chars_hint:['"'],line_breaks:!0}),oa=re({name:"UNCLOSED_MARKDOWN_STRING",pattern:/"`[^]*/,line_breaks:!0}),oo=re({name:"COMMENT",pattern:a6,start_chars_hint:["%"],line_breaks:!1}),ol=re({name:"NEWLINE",pattern:/\r\n|\n|\r/,line_breaks:!0}),oc=re({name:"ACC_DESCR_BLOCK",pattern:a8,start_chars_hint:["a"],line_breaks:!0}),oh=/^accTitle[\t ]*:[^\n\r]*/,ou=/^accDescr[\t ]*:[^\n\r]*/,od=re({name:"ACC_TITLE_LINE",pattern:(0,I.K)((e,t)=>a4(e,t,oh),"pattern"),start_chars_hint:["a"],line_breaks:!1}),op=re({name:"ACC_DESCR_LINE",pattern:(0,I.K)((e,t)=>a4(e,t,ou),"pattern"),start_chars_hint:["a"],line_breaks:!1}),of=re({name:"JSON_DECLARATION_START",pattern:/json[\t ]+\w+[\t ]*@[\t ]*(?={)/,push_mode:"jsonBody"}),om=re({name:"JSON_OBJECT_LITERAL",pattern:a9,start_chars_hint:["{"],line_breaks:!0,pop_mode:!0}),oT=re({name:"UNCLOSED_JSON_OBJECT_LITERAL",pattern:/{[^]*/,line_breaks:!0,pop_mode:!0}),og=(0,I.K)((e,t)=>re({name:e,pattern:t,longer_alt:os,categories:ot}),"keyword"),oE=og("USECASE",/usecase-beta/),oy=og("ACTOR",/actor/),oA=og("SYSTEM_BOUNDARY",/systemBoundary/),oS=og("END",/end/),oL=og("DIRECTION",/direction/),oO=og("TD",/TD/),oR=og("TB",/TB/),ob=og("BT",/BT/),oN=og("LR",/LR/),ov=og("RL",/RL/),ok=og("NOTE",/note/),oI=og("FOR",/for/),oC=og("JSON",/json/),o_=og("CLASS_DEF",/classDef/),ox=og("CLASS",/class/),oU=og("STYLE",/style/),ow=og("INCLUDE",/include/i),oM=og("EXTEND",/extend/i),oP=og("TRUE",/true/),oD=og("FALSE",/false/),o$=re({name:"GENERALIZATION",pattern:/--\|>/}),oF=re({name:"DEPENDENCY_ARROW",pattern:/\.\.>/}),oB=re({name:"STEREOTYPE_START",pattern:/<</,push_mode:"stereotype"}),oK=re({name:"STEREOTYPE_END",pattern:/>>/,pop_mode:!0}),oj=re({name:"STEREOTYPE_TEXT",pattern:a7,line_breaks:!1}),oG=re({name:"UNCLOSED_STEREOTYPE_TEXT",pattern:/[^\n\r]+/,line_breaks:!1,pop_mode:!0}),oW=re({name:"CLASS_SEPARATOR",pattern:/:::/}),oz=re({name:"FORWARD_SOLID",pattern:/--+>/}),oV=re({name:"BACKWARD_SOLID",pattern:/<--+/}),oH=re({name:"FORWARD_CIRCLE",pattern:/--o/}),oY=re({name:"BACKWARD_CIRCLE",pattern:/o--/}),oX=re({name:"FORWARD_CROSS",pattern:/--x/}),oJ=re({name:"BACKWARD_CROSS",pattern:/x--/}),oq=re({name:"MARKERLESS_SOLID",pattern:/--+/}),oZ=re({name:"METADATA_START",pattern:/@{/}),oQ=re({name:"AT",pattern:/@/,categories:oe}),o0=re({name:"LBRACE",pattern:/{/}),o1=re({name:"RBRACE",pattern:/}/}),o2=re({name:"LBRACKET",pattern:/\[/}),o3=re({name:"RBRACKET",pattern:/]/}),o6=re({name:"LPAREN",pattern:/\(/}),o5=re({name:"RPAREN",pattern:/\)/}),o4=re({name:"COMMA",pattern:/,/,categories:oe}),o8=re({name:"COLON",pattern:/:/,categories:oe}),o9=re({name:"HASH_COLOR",pattern:/#[\dA-Fa-f]+/,categories:oe}),o7=re({name:"PLAIN_STRING",pattern:/"[^\n\r"]*"|'[^\n\r']*'/}),le=re({name:"CSS_IDENTIFIER",pattern:/--[A-Z_a-z][\w-]*|[A-Z_a-z]\w*(?:-\w+)+/,categories:oe}),lt=re({name:"CSS_ESCAPED_COMMA",pattern:/\\,/,categories:oe}),li=re({name:"DASH",pattern:/-/,categories:oe}),ls=re({name:"DOT",pattern:/\./,categories:oe}),ln=re({name:"PERCENT",pattern:/%/,categories:oe}
57),lr=re({name:"CSS_PUNCTUATION",pattern:/[!#$&*+/=?^_|~]/,categories:oe}),la=re({name:"LABEL_PUNCTUATION",pattern:/[;<>\\`]/,categories:oe}),lo=re({name:"LABEL_SYMBOL",pattern:/[^\t\n\r !-~]+/,categories:oe}),ll=[oe,ot,on,or,oa,oo,ol,oc,od,op,of,oE,oy,oA,oS,oL,oO,oR,ob,oN,ov,ok,oI,oC,o_,ox,oU,ow,oM,oP,oD,o$,oF,oB,oW,oz,oV,oH,oY,oX,oJ,oq,oZ,oQ,o0,o1,o2,o3,o6,o5,o4,o8,o9,o7,le,os,oi,lt,li,ls,ln,lr,la,lo],lc={defaultMode:"defaultMode",modes:{defaultMode:[...ll],jsonBody:[om,oT],stereotype:[oK,oj,oG]}},lh=[...ll,om,oT,oK,oj,oG],lu=new nQ(lc),ld=(0,I.K)(e=>nW(e,oe)||e.tokenType===o7||e.tokenType===or,"isLabelToken"),lp={allowmixing:!0,newpage:!0,package:!0,rectangle:!0,skinparam:!0},lf=new class extends ay{static{(0,I.K)(this,"UsecaseParser")}constructor(){super(lh,{nodeLocationTracking:"full"}),this.RULE("start",()=>{this.CONSUME(oE),this.SUBRULE(this.lineEnd),this.MANY(()=>this.SUBRULE(this.line))}),this.RULE("line",()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.commentLine),"ALT")},{GATE:(0,I.K)(()=>this.isStatementStart(),"GATE"),ALT:(0,I.K)(()=>this.SUBRULE(this.statement),"ALT")}])}),this.RULE("statement",()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.accTitleStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.accDescrStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.directionStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.actorStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.systemBoundaryStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.noteStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.jsonStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.classDefStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.classStatement),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.styleStatement),"ALT")},{GATE:(0,I.K)(()=>this.isMetadataAssignment(),"GATE"),ALT:(0,I.K)(()=>this.SUBRULE(this.metadataAssignmentStatement),"ALT")},{GATE:(0,I.K)(()=>!this.isForbiddenPlantUmlStatement(),"GATE"),ALT:(0,I.K)(()=>this.SUBRULE(this.entityStatement),"ALT")}])}),this.RULE("lineEnd",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(ol),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(rt),"ALT")}])}),this.RULE("blankLine",()=>{this.CONSUME(ol)}),this.RULE("commentLine",()=>{this.CONSUME(oo),this.SUBRULE(this.lineEnd)}),this.RULE("accTitleStatement",()=>{this.CONSUME(od),this.SUBRULE(this.lineEnd)}),this.RULE("accDescrStatement",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(op),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oc),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("actorStatement",()=>{this.CONSUME(oy),this.SUBRULE(this.actorItem),this.OPTION(()=>{this.OR([{ALT:(0,I.K)(()=>this.AT_LEAST_ONE(()=>{this.CONSUME(o4),this.SUBRULE2(this.actorItem)}),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.relationTail),"ALT")}])}),this.SUBRULE(this.lineEnd)}),this.RULE("actorItem",()=>{this.SUBRULE(this.actorName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.stereotype)),this.OPTION3(()=>this.SUBRULE(this.classSuffix))}),this.RULE("actorName",()=>{this.OR([{ALT:(0,I.K)(()=>{this.CONSUME(os),this.OPTION(()=>{this.CONSUME(o6),this.SUBRULE(this.nodeLabel),this.CONSUME(o5)})},"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o7),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(or),"ALT")}])}),this.RULE("actorDeclarationOnly",()=>{this.CONSUME(oy),this.SUBRULE(this.actorItem),this.MANY(()=>{this.CONSUME(o4),this.SUBRULE2(this.actorItem)}),this.SUBRULE(this.lineEnd)}),this.RULE("entityStatement",()=>{this.SUBRULE(this.entityName),this.OPTION(()=>this.SUBRULE(this.relationTail)),this.SUBRULE(this.lineEnd)}),this.RULE("entityName",()=>{this.OR([{ALT:(0,I.K)(()=>{this.CONSUME(os),this.OPTION(()=>{this.OR2([{ALT:(0,I.K)(()=>{this.CONSUME(o6),this.SUBRULE(this.nodeLabel),this.CONSUME(o5)},"ALT")},{ALT:(0,I.K)(()=>{this.CONSUME(o2),this.SUBRULE2(this.nodeLabel),this.CONSUME(o3)},"ALT")}])})},"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o7),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(or),"ALT")}]),this.OPTION2(()=>this.SUBRULE(this.useCaseMetadata)),this.OPTION3(()=>this.SUBRULE(this.stereotype)),this.OPTION4(()=>this.SUBRULE(this.classSuffix))}),this.RULE("nodeLabel",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(o7),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(or),"ALT")},{ALT:(0,I.K)(()=>this.AT_LEAST_ONE(()=>this.CONSUME(oe)),"ALT")}])}),this.RULE("useCaseMetadata",()=>{this.SUBRULE(this.metadata)}),this.RULE("relationTail",()=>{this.OPTION({GATE:(0,I.K)(()=>this.LA(1).tokenType===os&&this.LA(2).tokenType===oQ,"GATE"),DEF:(0,I.K)(()=>{this.CONSUME(os),this.CONSUME(oQ)},"DEF")}),this.SUBRULE(this.arrow),this.SUBRULE(this.entityName)}),this.RULE("arrow",()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.semanticRelation),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.forwardSolidOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.backwardSolidOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.markerlessSolidOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.forwardCircleOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.backwardCircleOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.forwardCrossOperator),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.backwardCrossOperator),"ALT")}])}),this.RULE("forwardSolidOperator",()=>{this.CONSUME(oz)}),this.RULE("backwardSolidOperator",()=>{this.CONSUME(oV),this.OPTION({GATE:(0,I.K)(()=>"<--"===this.LA(0).image&&this.hasLabeledRight([oq]),"GATE"),DEF:(0,I.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(oq)},"DEF")})}),this.RULE("markerlessSolidOperator",()=>{this.CONSUME(oq),this.OPTION({GATE:(0,I.K)(()=>"--"===this.LA(0).image&&this.hasLabeledRight([oz,oq,oH,oX]),"GATE"),DEF:(0,I.K)(()=>{this.SUBRULE(this.edgeLabel),this.OR([{ALT:(0,I.K)(()=>this.CONSUME(oz),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME2(oq),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oH),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oX),"ALT")}])},"DEF")})}),this.RULE("forwardCircleOperator",()=>{this.CONSUME(oH)}),this.RULE("backwardCircleOperator",()=>{this.CONSUME(oY),this.OPTION({GATE:(0,I.K)(()=>this.hasLabeledRight([oq]),"GATE"),DEF:(0,I.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(oq)},"DEF")})}),this.RULE("forwardCrossOperator",()=>{this.CONSUME(oX)}),this.RULE("backwardCrossOperator",()=>{this.CONSUME(oJ),this.OPTION({GATE:(0,I.K)(()=>this.hasLabeledRight([oq]),"GATE"),DEF:(0,I.K)(()=>{this.SUBRULE(this.edgeLabel),this.CONSUME(oq)},"DEF")})}),this.RULE("edgeLabel",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(o7),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(or),"ALT")},{ALT:(0,I.K)(()=>this.AT_LEAST_ONE(()=>this.CONSUME(oe)),"ALT")}])}),this.RULE("semanticRelation",()=>{this.OR([{ALT:(0,I.K)(()=>{this.CONSUME(oF),this.CONSUME(o8),this.OR2([{ALT:(0,I.K)(()=>this.CONSUME(ow),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oM),"ALT")}])},"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o$),"ALT")}])}),this.RULE("metadata",()=>{this.CONSUME(oZ),this.MANY(()=>this.CONSUME(ol)),this.OPTION(()=>{this.SUBRULE(this.metadataProperty),this.MANY2(()=>{this.SUBRULE(this.metadataSeparator),this.SUBRULE2(this.metadataProperty)}),this.OPTION2(()=>this.CONSUME(o4)),this.MANY3(()=>this.CONSUME2(ol))}),this.CONSUME(o1)}),this.RULE("metadataProperty",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(os),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o7),"ALT")}]),this.CONSUME(o8),this.OR2([{ALT:(0,I.K)(()=>this.CONSUME2(os),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME2(o7),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oP),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oD),"ALT")}])}),this.RULE("metadataSeparator",()=>{this.OR([{ALT:(0,I.K)(()=>{this.CONSUME(o4),this.MANY(()=>this.CONSUME(ol))},"ALT")},{ALT:(0,I.K)(()=>{this.AT_LEAST_ONE(()=>this.CONSUME2(ol)),this.OPTION(()=>this.CONSUME2(o4)),this.MANY2(()=>this.CONSUME3(ol))},"ALT")}])}),this.RULE("systemBoundaryStatement",()=>{this.CONSUME(oA),this.SUBRULE(this.systemBoundaryName),this.OPTION(()=>this.SUBRULE(this.metadata)),this.OPTION2(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd),this.SUBRULE(this.systemBoundaryContent),this.CONSUME(oS),this.SUBRULE2(this.lineEnd)}),this.RULE("systemBoundaryName",()=>{this.OR([{ALT:(0,I.K)(()=>{this.CONSUME(os),this.OPTION(()=>{this.OR2([{ALT:(0,I.K)(()=>{this.CONSUME(o6),this.SUBRULE(this.nodeLabel),this.CONSUME(o5)},"ALT")},{ALT:(0,I.K)(()=>{this.CONSUME(o2),this.SUBRULE2(this.nodeLabel),this.CONSUME(o3)},"ALT")}])})},"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o7),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(or),"ALT")}])}),this.RULE("systemBoundaryContent",()=>{this.MANY(()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.blankLine),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.commentLine),"ALT")},{ALT:(0,I.K)(()=>this.SUBRULE(this.boundaryElement),"ALT")}])})}),this.RULE("boundaryElement",()=>{this.OR([{ALT:(0,I.K)(()=>this.SUBRULE(this.actorDeclarationOnly),"ALT")},{ALT:(0,I.K)(()=>{this.SUBRULE(this.entityName),this.SUBRULE(this.lineEnd)},"ALT")}])}),this.RULE("metadataAssignmentStatement",()=>{this.SUBRULE(this.metadataAssignmentTarget),this.SUBRULE(this.metadata),this.SUBRULE(this.lineEnd)}),this.RULE("metadataAssignmentTarget",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(os),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o7),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(or),"ALT")}])}),this.RULE("noteStatement",()=>{this.CONSUME(ok),this.CONSUME(oI),this.CONSUME(os),this.SUBRULE(this.nodeLabel),this.SUBRULE(this.lineEnd)}),this.RULE("stereotype",()=>{this.CONSUME(oB),this.CONSUME(oj),this.CONSUME(oK)}),this.RULE("classSuffix",()=>{this.CONSUME(oW),this.CONSUME(os),this.MANY(()=>{this.CONSUME(o4),this.CONSUME2(os)})}),this.RULE("jsonStatement",()=>{this.CONSUME(of),this.CONSUME(om),this.OPTION(()=>this.SUBRULE(this.classSuffix)),this.SUBRULE(this.lineEnd)}),this.RULE("directionStatement",()=>{this.CONSUME(oL),this.OR([{ALT:(0,I.K)(()=>this.CONSUME(oO),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oR),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(ob),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oN),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(ov),"ALT")}]),this.SUBRULE(this.lineEnd)}),this.RULE("classDefStatement",()=>{this.CONSUME(o_),this.CONSUME(os),this.MANY(()=>{this.CONSUME(o4),this.CONSUME2(os)}),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("classStatement",()=>{this.CONSUME(ox),this.CONSUME(os),this.MANY(()=>{this.CONSUME(o4),this.CONSUME2(os)}),this.CONSUME3(os),this.MANY2(()=>{this.CONSUME2(o4),this.CONSUME4(os)}),this.SUBRULE(this.lineEnd)}),this.RULE("styleStatement",()=>{this.CONSUME(oU),this.CONSUME(os),this.SUBRULE(this.styles),this.SUBRULE(this.lineEnd)}),this.RULE("styles",()=>{this.SUBRULE(this.styleValue),this.MANY(()=>{this.CONSUME(o4),this.SUBRULE2(this.styleValue)})}),this.RULE("styleValue",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(ot),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(le),"ALT")},{ALT:(0,I.K)(()=>{this.CONSUME(oq),this.CONSUME2(ot)},"ALT")}]),this.CONSUME(o8),this.AT_LEAST_ONE(()=>this.SUBRULE(this.styleComponent))}),this.RULE("styleComponent",()=>{this.OR([{ALT:(0,I.K)(()=>this.CONSUME(ot),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o7),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oi),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o9),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(le),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(lt),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(li),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(ls),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(ln),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(lr),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o8),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o6),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o5),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o2),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o3),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o0),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(o1),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oQ),"ALT")},{ALT:(0,I.K)(()=>this.CONSUME(oq),"ALT")}])}),this.performSelfAnalysis()}isMetadataAssignment(){let e=this.LA(1).tokenType;return(e===os||e===o7||e===or)&&this.LA(2).tokenType===oZ}isStatementStart(){let e=this.LA(1).tokenType;return e!==rt&&e!==ol&&e!==oo}
57isForbiddenPlantUmlStatement(){return this.LA(1).tokenType===os&&!0===lp[this.LA(1).image.toLowerCase()]}hasLabeledRight(e){if(!ld(this.LA(1)))return!1;for(let t=2;;t++){let i=this.LA(t);if(e.includes(i.tokenType))return!0;if(!ld(i))return!1}}},lm=class extends Error{constructor(e,t,i){super(`${e} (line ${t}, column ${i})`),this.line=t,this.column=i,this.name="UsecaseJsonError"}static{(0,I.K)(this,"UsecaseJsonError")}},lT=(0,I.K)((e,t,i,s)=>{let n=i,r=s,a=Math.min(Math.max(t,0),e.length);for(let t=0;t<a;t++){let i=e[t];"\r"===i?(n++,r=1):"\n"===i?(0===t||"\r"!==e[t-1])&&(n++,r=1):r++}return{line:n,column:r}},"locationAtOffset"),lg=(0,I.K)((e,t,i,s)=>{let n=/\bposition (\d+)\b/u.exec(e);if(n)return lT(t,Number.parseInt(n[1],10),i,s);let r=/\bline (\d+) column (\d+)\b/u.exec(e);if(r){let e=Number.parseInt(r[1],10),t=Number.parseInt(r[2],10);return{line:i+e-1,column:1===e?s+t-1:t}}if(/unexpected end|end of json input/iu.test(e))return lT(t,t.length,i,s)},"locationFromErrorMessage"),lE=class extends Error{constructor(e){super("Invalid JSON token"),this.offset=e}static{(0,I.K)(this,"JsonWalkError")}},ly=class{constructor(e){this.text=e,this.offset=0,this.propertyOrder={}}static{(0,I.K)(this,"PropertyOrderCollector")}collect(){if(this.skipWhitespace(),this.collectValue(""),this.skipWhitespace(),this.offset!==this.text.length)throw new lE(this.offset);return this.propertyOrder}collectValue(e){this.skipWhitespace();let t=this.text[this.offset];if("{"===t)this.collectObject(e);else if("["===t)this.collectArray(e);else if('"'===t)this.readString(!1);else if("t"===t)this.consumeLiteral("true");else if("f"===t)this.consumeLiteral("false");else if("n"===t)this.consumeLiteral("null");else if("-"===t||t>="0"&&t<="9")this.consumeNumber();else throw new lE(this.offset)}collectObject(e){this.offset++;let t=[],i=new Set;if(this.propertyOrder[e]=t,this.skipWhitespace(),"}"===this.text[this.offset])return void this.offset++;for(;this.offset<this.text.length&&'"'===this.text[this.offset];){let s=this.readString(!0),n=`${e}/${s.replaceAll("~","~0").replaceAll("/","~1")}`;if(i.has(s)?this.deletePointerSubtree(n):(i.add(s),t.push(s)),this.skipWhitespace(),":"!==this.text[this.offset])break;if(this.offset++,this.collectValue(n),this.skipWhitespace(),"}"===this.text[this.offset])return void this.offset++;if(","!==this.text[this.offset])break;this.offset++,this.skipWhitespace()}throw new lE(this.offset)}collectArray(e){if(this.offset++,this.skipWhitespace(),"]"===this.text[this.offset])return void this.offset++;let t=0;for(;this.offset<this.text.length;){if(this.collectValue(`${e}/${t}`),t++,this.skipWhitespace(),"]"===this.text[this.offset])return void this.offset++;if(","!==this.text[this.offset])break;this.offset++,this.skipWhitespace()}throw new lE(this.offset)}readString(e){this.offset++;let t="";for(;this.offset<this.text.length;){let i=this.offset,s=this.text[this.offset++];if('"'===s)return t;if(32>s.charCodeAt(0))throw new lE(i);if("\\"!==s){e&&(t+=s);continue}let n=this.offset,r=this.text[this.offset++];switch(r){case'"':case"\\":case"/":e&&(t+=r);break;case"b":e&&(t+="\b");break;case"f":e&&(t+="\f");break;case"n":e&&(t+="\n");break;case"r":e&&(t+="\r");break;case"t":e&&(t+=" ");break;case"u":{let i=this.text.slice(this.offset,this.offset+4);if(!/^[\dA-Fa-f]{4}$/u.test(i))throw new lE(this.offset);e&&(t+=String.fromCharCode(Number.parseInt(i,16))),this.offset+=4;break}default:throw new lE(n)}}throw new lE(this.offset)}consumeLiteral(e){let t=0;for(let i of e){if(this.text[this.offset+t]!==i)throw new lE(this.offset+t);t++}this.offset+=e.length}consumeNumber(){if("-"===this.text[this.offset]&&this.offset++,"0"===this.text[this.offset])this.offset++;else if(this.text[this.offset]>="1"&&this.text[this.offset]<="9")for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++;else throw new lE(this.offset);if("."===this.text[this.offset]){if(this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new lE(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}if("e"===this.text[this.offset]||"E"===this.text[this.offset]){if(this.offset++,("+"===this.text[this.offset]||"-"===this.text[this.offset])&&this.offset++,this.text[this.offset]<"0"||this.text[this.offset]>"9")throw new lE(this.offset);for(;this.text[this.offset]>="0"&&this.text[this.offset]<="9";)this.offset++}}skipWhitespace(){for(;this.offset<this.text.length;){let e=this.text[this.offset];if(" "!==e&&" "!==e&&"\n"!==e&&"\r"!==e)return;this.offset++}}deletePointerSubtree(e){let t=`${e}/`;for(let i of Object.keys(this.propertyOrder))(i===e||i.startsWith(t))&&delete this.propertyOrder[i]}};function lA(e,t,i){let s;try{s=JSON.parse(e)}catch(r){let s=r instanceof Error?r.message:String(r),n=lg(s,e,t,i);if(!n){let s=0;try{new ly(e).collect()}catch(e){e instanceof lE&&(s=e.offset)}n=lT(e,s,t,i)}throw new lm(`Invalid JSON: ${s}`,n.line,n.column)}if("object"!=typeof s||null===s||Array.isArray(s))throw new lm("JSON value must have an object root",t,i);return{value:s,propertyOrder:new ly(e).collect()}}(0,I.K)(lA,"parseOrderedJsonObject");var lS=(0,I.K)(e=>({shape:"normal"===e.type?"actor":"hollow"===e.type?"actor-hollow":"awesome"===e.type?"actor-awesome":"actor-icon",...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"actor",actorType:e.type,business:e.business,labelType:e.labelType,...e.icon?{icon:e.icon}:{},...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}
57}),"actorNode"),lL=(0,I.K)(e=>({shape:e.shape,...e.label===e.id?{}:{label:e.label},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"usecase",useCaseShape:e.shape,business:e.business,labelType:e.labelType,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{}}}),"useCaseNode"),lO=(0,I.K)(e=>({label:e.label,shape:"note",attrs:{kind:"note",target:e.target,labelType:e.labelType}}),"noteNode"),lR=(0,I.K)(e=>({label:e.id,shape:"json-table",...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{kind:"json",value:e.value,propertyOrder:e.propertyOrder,labelType:"text"}}),"jsonNode"),lb=(0,I.K)(e=>({id:e.id,source:e.source,target:e.target,...e.label?{label:e.label}:{},...e.classes.length?{classes:[...e.classes]}:{},...e.styles.length?{styles:[...e.styles]}:{},attrs:{relationshipType:e.type,arrowType:e.arrowType,minlen:e.minlen,explicitId:e.explicitId,animate:e.animate,...e.animation?{animation:e.animation}:{},...e.labelType?{labelType:e.labelType}:{}}}),"relationshipEdge"),lN=(0,I.K)(e=>({id:`${e.id}-edge`,source:e.id,target:e.target,attrs:{relationshipType:"note",arrowType:2,pattern:"dotted",minlen:1,explicitId:!1,animate:!1,internal:!0}}),"noteEdge"),lv=(0,I.K)((e,t,i,s)=>{let n={};for(let t of e.getActors().values())n[t.id]=lS(t);for(let t of e.getUseCases().values())n[t.id]=lL(t);for(let t of e.getNotes().values())n[t.id]=lO(t);for(let t of e.getJsonNodes().values())n[t.id]=lR(t);let r={};for(let t of e.getSystemBoundaries().values())r[t.id]={...t.label===t.id?{}:{title:t.label},nodes:[...t.members],...t.classes.length?{classes:[...t.classes]}:{},...t.styles.length?{styles:[...t.styles]}:{},attrs:{kind:"systemBoundary",boundaryType:t.type,labelType:t.labelType}};let a={};for(let t of e.getClassDefs().values())a[t.id]={styles:[...t.styles]};let o=e.getDirection();return{version:1,diagramType:"usecase",source:t,header:{keyword:"usecase",direction:"TD"===o?"TB":o,span:i},...e.getAccTitle()?{accTitle:e.getAccTitle()}:{},...e.getAccDescription()?{accDescr:e.getAccDescription()}:{},nodes:n,edges:[...e.getRelationships().map(lb),...[...e.getNotes().values()].map(lN)],groups:r,classDefs:a,statements:s}},"buildUsecaseGraphAST"),lk=(0,I.K)(e=>`line ${e.line}, column ${e.column} [${e.span[0]},${e.span[1]})`,"locationText"),lI=(0,I.K)(e=>void 0===e?"":` (label "${e}")`,"labelSuffix"),lC=(0,I.K)(e=>e.generated?e.label:void 0,"generatedFrom"),l_=(0,I.K)((e,t)=>{for(let i of t)e.includes(i)||e.push(i)},"pushUnique"),lx=class{constructor(e){this.db=e,this.source="",this.statements=[],this.elements=[],this.boundaries=[],this.jsonDrafts=[],this.relationshipDrafts=[],this.noteDrafts=[],this.metadataAssignments=[],this.classAssignments=[],this.styleAssignments=[],this.classDefinitions=[],this.directions=[],this.model=e.createModel()}static{(0,I.K)(this,"UsecaseModelBuilder")}reset(e){this.model=this.db.createModel(),this.source=e,this.statements=[],this.elements.length=0,this.boundaries.length=0,this.jsonDrafts.length=0,this.relationshipDrafts.length=0,this.noteDrafts.length=0,this.metadataAssignments.length=0,this.classAssignments.length=0,this.styleAssignments.length=0,this.classDefinitions.length=0,this.directions.length=0}addElement(e){this.elements.push(e)}addBoundary(e){this.boundaries.push(e)}addJson(e){this.jsonDrafts.push(e)}addRelationship(e){this.relationshipDrafts.push(e)}addNote(e){this.noteDrafts.push(e)}addMetadataAssignment(e,t,i,s){this.metadataAssignments.push({target:e,targetLocation:t,metadata:i,statement:s})}addClassDef(e,t){this.classDefinitions.push({ids:e,styles:t})}addClassAssignment(e,t){this.classAssignments.push({targets:e,classes:t})}addStyleAssignment(e,t,i){this.styleAssignments.push({target:e,location:t,styles:i})}setDirection(e){this.directions.push("TD"===e?"TB":e)}setAccTitle(e){this.model.accTitle=e}setAccDescription(e){this.model.accDescription=e}setStatements(e){this.statements=e}getActors(){return this.model.actors}getUseCases(){return this.model.useCases}getSystemBoundaries(){return this.model.systemBoundaries}getRelationships(){return this.model.relationships}
vendor: 6,608 bytes, line 57
57getNotes(){return this.model.notes}getJsonNodes(){return this.model.jsonNodes}getClassDefs(){return this.model.classDefs}getDirection(){return this.model.direction}getAccTitle(){return this.model.accTitle}getAccDescription(){return this.model.accDescription}finalize(e){let t=new Map,i=new Map,s=new Map,n=new Map;for(let e of this.relationshipDrafts)this.recordFirst(n,e.source.id,e.source.location.span[0]),this.recordFirst(n,e.target.id,e.target.location.span[0]);for(let e of this.elements)this.recordFirst(n,e.id,e.location.span[0]);for(let e of this.boundaries)this.recordFirst(n,e.id,e.location.span[0]);for(let e of this.jsonDrafts)this.recordFirst(n,e.id,e.location.span[0]);for(let e of[...this.elements.map(e=>({offset:e.location.span[0],type:"element",value:e})),...this.boundaries.map(e=>({offset:e.location.span[0],type:"boundary",value:e})),...this.jsonDrafts.map(e=>({offset:e.location.span[0],type:"json",value:e})),...this.relationshipDrafts.filter(e=>e.explicitId).map(e=>({offset:e.explicitIdLocation.span[0],type:"edge",value:e}))].sort((e,t)=>e.offset-t.offset))"element"===e.type?this.collectElement(e.value,t,i):"boundary"===e.type?this.collectBoundary(e.value,t,s):"json"===e.type?this.registerUnique(t,e.value.id,"json",e.value.location,!1):this.registerUnique(t,e.value.explicitId,"edge",e.value.explicitIdLocation,!1);this.materializeElements(i,n),this.materializeBoundaries(s,n),this.materializeJson(n);let r=this.materializeRelationships(t,i,n);this.reorderElements(i,n),this.applyMetadataAssignments(t,i,s,r),this.validateAndRefreshElements(i),this.refreshBoundaries(s,i),this.materializeNotes(t),this.applyClassDefinitions(),this.applyClassesAndStyles(t,r),this.model.direction=this.directions.at(-1)??this.model.direction,this.model.symbols=new Map([...t].map(([e,t])=>[e,t.kind]));let a=lv(this,this.source,e,this.statements);return this.model.ast=a,this.db.commit(this.model),a}collectElement(e,t,i){let s=t.get(e.id),n=lC({generated:e.generated,label:e.label.text});s&&s.kind!==e.kind&&this.conflict(`ID '${e.id}' is declared as both ${s.kind} and ${e.kind}`,e.location,s.location,n,lC(s)),s&&(s.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,s.location,n,lC(s));let r=i.get(e.id);if(!r){let s={kind:e.kind,id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],...e.parentId?{parentId:e.parentId,parentLocation:e.parentLocation}:{},...e.shape?{shape:e.shape}:{},...e.stereotype?{stereotype:e.stereotype,stereotypeLocation:e.location}:{}};this.applyDeclarationMetadata(s,e.metadata),i.set(e.id,s),t.set(e.id,{kind:e.kind,location:e.location,generated:e.generated,label:e.label.text});return}(r.label.text!==e.label.text||r.label.type!==e.label.type)&&this.conflict(`ID '${e.id}' has conflicting labels`,e.location,r.location),e.shape&&r.shape&&e.shape!==r.shape&&this.conflict(`Use case '${e.id}' has conflicting shapes`,e.location,r.location),e.parentId&&r.parentId&&e.parentId!==r.parentId&&this.conflict(`Element '${e.id}' belongs to more than one system boundary`,e.parentLocation??e.location,r.parentLocation??r.location),e.stereotype&&r.stereotype&&e.stereotype!==r.stereotype&&this.conflict(`Element '${e.id}' has conflicting stereotypes`,e.location,r.stereotypeLocation??r.location),r.shape??=e.shape,r.parentId??=e.parentId,r.parentLocation??=e.parentLocation,r.stereotype??=e.stereotype,r.stereotypeLocation??=e.stereotype?e.location:void 0,l_(r.classes,e.classes),this.applyDeclarationMetadata(r,e.metadata)}collectBoundary(e,t,i){let s=t.get(e.id),n=lC({generated:e.generated,label:e.label.text});s&&"boundary"!==s.kind&&this.conflict(`ID '${e.id}' is declared as both ${s.kind} and boundary`,e.location,s.location,n,lC(s)),s&&(s.generated||e.generated)&&this.conflict(`Generated ID '${e.id}' collides with another declaration`,e.location,s.location,n,lC(s));let r=i.get(e.id);if(r){(r.label.text!==e.label.text||r.label.type!==e.label.type)&&this.conflict(`Boundary '${e.id}' has conflicting titles`,e.location,r.location),l_(r.classes,e.classes);return}i.set(e.id,{id:e.id,label:e.label,location:e.location,generated:e.generated,classes:[...e.classes],styles:[],members:[]}),t.set(e.id,{kind:"boundary",location:e.location,generated:e.generated,label:e.label.text})}materializeElements(e,t){for(let i of[...e.values()].sort((e,i)=>(t.get(e.id)??0)-(t.get(i.id)??0)))this.setElementModel(i)}materializeBoundaries(e,t){for(let i of[...e.values()].sort((e,i)=>(t.get(e.id)??0)-(t.get(i.id)??0)))this.model.systemBoundaries.set(i.id,{id:i.id,label:i.label.text,labelType:i.label.type,type:i.type??"rect",members:[],classes:[...i.classes],styles:[...i.styles]})}materializeJson(e){for(let t of[...this.jsonDrafts].sort((t,i)=>(e.get(t.id)??0)-(e.get(i.id)??0)))this.model.jsonNodes.set(t.id,{id:t.id,value:t.value,propertyOrder:t.propertyOrder,classes:[...t.classes],styles:[]})}materializeRelationships(e,t,i){let s=new Map,n=0;for(let r of this.relationshipDrafts){let a=this.resolveEndpoint(r.source,e,t,i),o=this.resolveEndpoint(r.target,e,t,i);this.validateRelationship(r,a,o,e);let l=r.explicitId??`edge-${n++}`,c={id:l,explicitId:!!r.explicitId,source:r.source.id,target:r.target.id,type:r.type,arrowType:r.arrowType,...r.label?{label:r.label.text,labelType:r.label.type}:{},minlen:r.minlen,classes:[],styles:[],animate:!1};this.model.relationships.push(c),s.set(l,{draft:r,relationship:c})}return this.model.relationshipCounter=n,s}resolveEndpoint(e,t,i,s){if(e.classesOnReference&&!e.declaration)throw Error(`Relationship endpoint '${e.id}' uses ::: without declaring the node at ${lk(e.location)}`);let n=t.get(e.id);return n?n.kind:(i.set(e.id,{kind:"usecase",id:e.id,label:e.label,location:e.location,generated:e.generated,shape:"ellipse",classes:[]}),t.set(e.id,{kind:"usecase",location:e.location,generated:e.generated,label:e.label.text}),this.recordFirst(s,e.id,e.location.span[0]),"usecase")}reorderElements(e,t){let i=new Map(this.model.actors),s=new Map(this.model.useCases);for(let n of(this.model.actors.clear(),this.model.useCases.clear(),[...e.values()].sort((e,i)=>(t.get(e.id)??0)-(t.get(i.id)??0)))){i.has(n.id)||s.has(n.id)||this.setElementModel(n);let e=i.get(n.id)??this.model.actors.get(n.id),t=s.get(n.id)??this.model.useCases.get(n.id);e?this.model.actors.set(n.id,e):t&&this.model.useCases.set(n.id,t)}}applyMetadataAssignments(e,t,i,s){for(let n of this.metadataAssignments){let r=e.get(n.target);if(!r){let e=this.inferMetadataKind(n.metadata);throw Error(`Metadata target '${n.target}' is unresolved${e?` (metadata implies ${e})`:""}
57 at ${lk(n.targetLocation)}`)}if("actor"===r.kind||"usecase"===r.kind)this.applyStandaloneElementMetadata(t.get(n.target),n.metadata);else if("boundary"===r.kind){let e=i.get(n.target);for(let t of n.metadata.properties)("type"!==t.key||"rect"!==t.value&&"package"!==t.value)&&this.invalidMetadata(n.target,r.kind,t),e.type=t.value}else if("edge"===r.kind){let e=s.get(n.target);if(!e)throw Error(`Metadata target '${n.target}' is not an explicit edge at ${lk(n.targetLocation)}`);for(let t of(n.statement.kind="edgeMetadata",n.statement.edges=[{id:n.target,span:n.statement.span,idSpan:n.targetLocation.span,...n.statement.metadata?{metadata:n.statement.metadata}:{}}],delete n.statement.nodes,n.metadata.properties))"animate"===t.key&&"boolean"==typeof t.value?e.relationship.animate=t.value:"animation"===t.key&&("fast"===t.value||"slow"===t.value)?(e.relationship.animation=t.value,e.relationship.animate=!0):this.invalidMetadata(n.target,r.kind,t)}else for(let e of n.metadata.properties)this.invalidMetadata(n.target,r.kind,e)}for(let{relationship:e}of s.values())e.animation&&(e.animate=!0)}applyStandaloneElementMetadata(e,t){for(let i of t.properties)"actor"===e.kind?this.applyActorProperty(e,i,!0):"business"===i.key&&"boolean"==typeof i.value?e.business=i.value:this.invalidMetadata(e.id,e.kind,i)}applyDeclarationMetadata(e,t){if(t)for(let i of t.properties)"actor"===e.kind?this.applyActorProperty(e,i,!1):"business"===i.key&&"boolean"==typeof i.value?(void 0!==e.business&&e.business!==i.value&&this.conflict(`Use case '${e.id}' has conflicting business metadata`,i.location,e.location),e.business=i.value):this.invalidMetadata(e.id,e.kind,i)}applyActorProperty(e,t,i){"type"===t.key&&("normal"===t.value||"hollow"===t.value||"awesome"===t.value)?(i||void 0===e.actorType||e.actorType===t.value||this.conflict(`Actor '${e.id}' has conflicting type metadata`,t.location,e.location),e.actorType=t.value):"icon"===t.key&&"string"==typeof t.value?(i||void 0===e.icon||e.icon===t.value||this.conflict(`Actor '${e.id}' has conflicting icon metadata`,t.location,e.location),e.icon=t.value):"business"===t.key&&"boolean"==typeof t.value?(i||void 0===e.business||e.business===t.value||this.conflict(`Actor '${e.id}' has conflicting business metadata`,t.location,e.location),e.business=t.value):this.invalidMetadata(e.id,e.kind,t)}validateAndRefreshElements(e){for(let t of e.values()){let e=t.icon?"icon":t.actorType??"normal";if("actor"===t.kind){if(t.icon&&t.actorType&&"normal"!==t.actorType)throw Error(`Actor '${t.id}' cannot combine icon with type '${t.actorType}' at ${lk(t.location)}`);if(t.business&&("icon"===e||"awesome"===e))throw Error(`Business actor '${t.id}' must use normal or hollow geometry at ${lk(t.location)}`)}else if((t.shape??"ellipse")==="rect"&&t.business)throw Error(`Rectangular use case '${t.id}' cannot be a business use case at ${lk(t.location)}`);this.setElementModel(t)}}refreshBoundaries(e,t){for(let t of e.values())t.members.length=0;for(let t of[...this.elements].sort((e,t)=>e.location.span[0]-t.location.span[0])){if(!t.parentId)continue;let i=e.get(t.parentId);if(!i)throw Error(`Parent boundary '${t.parentId}' for '${t.id}' is unresolved at ${lk(t.parentLocation??t.location)}`);i.members.includes(t.id)||i.members.push(t.id)}for(let i of t.values())if(i.parentId&&!e.has(i.parentId))throw Error(`Parent boundary '${i.parentId}' for '${i.id}' is unresolved at ${lk(i.parentLocation??i.location)}`);for(let t of e.values()){let e=this.model.systemBoundaries.get(t.id);e.type=t.type??"rect",e.members=[...t.members],e.classes=[...t.classes],e.styles=[...t.styles]}}materializeNotes(e){let t=0;for(let i of this.noteDrafts){let s=e.get(i.target);if(!s)throw Error(`Note target '${i.target}' is unresolved at ${lk(i.targetLocation)}`);"actor"!==s.kind&&"usecase"!==s.kind&&this.conflict(`Note target '${i.target}' must be an actor or use case, not ${s.kind}`,i.targetLocation,s.location);let n=`note-${t++}`;this.model.notes.set(n,{id:n,target:i.target,label:i.label.text,labelType:i.label.type})}this.model.noteCounter=t}applyClassDefinitions(){for(let e of this.classDefinitions)for(let t of e.ids)this.model.classDefs.set(t,{id:t,styles:[...e.styles]})}applyClassesAndStyles(e,t){for(let i of this.classAssignments)for(let s of i.targets)l_(this.getStylable(s.id,e,t,s.location).classes,i.classes);for(let i of this.styleAssignments)this.getStylable(i.target,e,t,i.location).styles.push(...i.styles)}getStylable(e,t,i,s){let n=t.get(e)?.kind,r="actor"===n?this.model.actors.get(e):"usecase"===n?this.model.useCases.get(e):"boundary"===n?this.model.systemBoundaries.get(e):"json"===n?this.model.jsonNodes.get(e):"edge"===n?i.get(e)?.relationship:void 0;if(!r)throw Error(`Class/style target '${e}' is unresolved or anonymous at ${lk(s)}`);return r}validateRelationship(e,t,i,s){let n=(0,I.K)(e=>"actor"===e||"usecase"===e||"json"===e,"allowed");if(n(t)||this.conflict(`Relationship source '${e.source.id}' cannot be ${t}`,e.source.location,s.get(e.source.id).location),n(i)||this.conflict(`Relationship target '${e.target.id}' cannot be ${i}`,e.target.location,s.get(e.target.id).location),("include"===e.type||"extend"===e.type)&&("usecase"!==t||"usecase"!==i))throw Error(`${e.type} relationship requires use-case endpoints at ${lk(e.location)}`);if("generalization"===e.type&&("actor"!==t&&"usecase"!==t||t!==i))throw Error(`Generalization requires actor-to-actor or use-case-to-use-case endpoints at ${lk(e.location)}`);if("association"===e.type&&("json"===t||"json"===i)&&![0,1,2].includes(e.arrowType))throw Error(`JSON relationship '${e.source.id}' to '${e.target.id}' permits only point, reversed-point, or markerless solid association at ${lk(e.location)}`)}setElementModel(e){if("actor"===e.kind){let t=e.icon?"icon":e.actorType??"normal";this.model.useCases.delete(e.id),this.model.actors.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,type:t,...e.icon?{icon:e.icon}:{},business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.actors.get(e.id)?.styles??[]})}else this.model.actors.delete(e.id),this.model.useCases.set(e.id,{id:e.id,label:e.label.text,labelType:e.label.type,shape:e.shape??"ellipse",business:e.business??!1,...e.stereotype?{stereotype:e.stereotype}:{},...e.parentId?{parentId:e.parentId}:{},classes:[...e.classes],styles:this.model.useCases.get(e.id)?.styles??[]})}inferMetadataKind(e){let t=new Set(["actor","usecase","boundary","edge"]);for(let i of e.properties)if("icon"===i.key)t.clear(),t.add("actor");else if("animate"===i.key||"animation"===i.key)t.clear(),t.add("edge");else if("type"===i.key)t.clear(),"rect"===i.value||"package"===i.value?t.add("boundary"):("normal"===i.value||"hollow"===i.value||"awesome"===i.value)&&t.add("actor");else{if("business"!==i.key)return;t.delete("boundary"),t.delete("edge")}return 1===t.size?[...t][0]:void 0}invalidMetadata(e,t,i){throw Error(`Metadata property '${i.key}
57' is invalid for ${t} '${e}' at ${lk(i.location)}`)}registerUnique(e,t,i,s,n){let r=e.get(t);r&&this.conflict(`ID '${t}' is declared more than once (${r.kind} and ${i})`,s,r.location,void 0,lC(r)),e.set(t,{kind:i,location:s,generated:n})}recordFirst(e,t,i){let s=e.get(t);(void 0===s||i<s)&&e.set(t,i)}conflict(e,t,i,s,n){throw Error(`${e} at ${lk(t)}${lI(s)}; previous declaration at ${lk(i)}${lI(n)}`)}},lU=lf.getBaseCstVisitorConstructor(),lw=new class extends lU{constructor(){super(),this.builder=new lx(a1),this.source="",this.anonymousEdge=0,this.anonymousNote=0,this.validateVisitor()}static{(0,I.K)(this,"UsecaseVisitor")}build(e,t){this.source=t,this.parentBoundary=void 0,this.anonymousEdge=0,this.anonymousNote=0,this.builder.reset(t),this.visit(e)}start(e){let t=this.tokens(e,"USECASE")[0],i=[];for(let t of this.nodes(e,"line"))i.push(this.visit(t));this.builder.setStatements(i),this.builder.finalize(this.tokenSpan(t))}line(e){let t=this.firstNode(e,"blankLine","commentLine","statement");return this.wrap(t,this.visit(t))}
vendor: 10,628 bytes, line 57
57statement(e){return this.visit(this.firstNode(e,"accTitleStatement","accDescrStatement","directionStatement","actorStatement","systemBoundaryStatement","noteStatement","jsonStatement","classDefStatement","classStatement","styleStatement","metadataAssignmentStatement","entityStatement"))}lineEnd(e){}blankLine(e){return{kind:"blank",span:this.tokenSpan(this.tokens(e,"NEWLINE")[0])}}commentLine(e){return{kind:"comment",span:this.tokenSpan(this.tokens(e,"COMMENT")[0])}}accTitleStatement(e){let t=this.tokens(e,"ACC_TITLE_LINE")[0].image;return this.builder.setAccTitle(t.slice(t.indexOf(":")+1).trim()),{kind:"accTitle",span:[0,0]}}accDescrStatement(e){let t=this.tokens(e,"ACC_DESCR_LINE")[0],i=this.tokens(e,"ACC_DESCR_BLOCK")[0],s=t?t.image.slice(t.image.indexOf(":")+1).trim():i.image.slice(i.image.indexOf("{")+1,i.image.lastIndexOf("}")).trim();return this.builder.setAccDescription(s),{kind:"accDescr",span:[0,0]}}actorStatement(e){let t=this.nodes(e,"actorItem"),i=t.map(e=>this.visit(e)),s=this.nodes(e,"relationTail")[0],n=i.map((e,i)=>this.actorOccurrence(t[i],e,!0));for(let e of i)this.builder.addElement(this.actorDraft(e));if(!s)return{kind:"node",span:[0,0],nodes:n};let r=this.visit(s);r.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(r.target));let a=this.relationshipDraft(i[0],r,this.nodeLocation(s));this.builder.addRelationship(a);let o=a.explicitId??`edge-${this.anonymousEdge++}`;return n.push(this.entityOccurrence(this.nodes(s.children,"entityName")[0],r.target,r.target.explicitDeclaration)),{kind:"edge",span:[0,0],nodes:n,edges:[{id:o,span:[0,0],...a.explicitIdLocation?{idSpan:a.explicitIdLocation.span}:{},...a.label?{labelSpan:a.label.span}:{}}]}}actorItem(e){let t=this.visit(this.nodes(e,"actorName")[0]),i=this.nodes(e,"metadata")[0],s=this.nodes(e,"stereotype")[0],n=this.nodes(e,"classSuffix")[0],r=n?this.visit(n):{classes:[],spans:[]};return{...t,...i?{metadata:this.visit(i)}:{},...s?{stereotype:this.visit(s)}:{},classes:r.classes,classSpans:r.spans}}actorName(e){let t=this.tokens(e,"IDENTIFIER")[0],i=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0];if(t){let i=this.nodes(e,"nodeLabel")[0],s=i?this.visit(i):this.tokenLabel(t);return{id:t.image,label:s,location:this.tokenLocation(t),generated:!1,classes:[],classSpans:[]}}let s=this.tokenLabel(i);return{id:this.generateId(s.text),label:s,location:this.tokenLocation(i),generated:!0,classes:[],classSpans:[]}}actorDeclarationOnly(e){let t=this.nodes(e,"actorItem"),i=t.map(e=>this.visit(e));for(let e of i)this.builder.addElement(this.actorDraft(e));return{kind:"node",span:[0,0],nodes:i.map((e,i)=>this.actorOccurrence(t[i],e,!0))}}entityStatement(e){let t=this.nodes(e,"entityName"),i=this.visit(t[0]),s=this.nodes(e,"relationTail")[0];if(!s)return i.explicitDeclaration=!0,i.shape??="ellipse",this.builder.addElement(this.entityDraft(i)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(t[0],i,!0)]};i.explicitDeclaration&&this.builder.addElement(this.entityDraft(i));let n=this.visit(s);n.target.explicitDeclaration&&this.builder.addElement(this.entityDraft(n.target));let r={source:this.endpoint(i),target:this.endpoint(n.target),location:this.nodeLocation(s),...n.explicitId?{explicitId:n.explicitId,explicitIdLocation:n.explicitIdLocation}:{},...n.arrow};this.builder.addRelationship(r);let a=r.explicitId??`edge-${this.anonymousEdge++}`;return{kind:"edge",span:[0,0],nodes:[this.entityOccurrence(t[0],i,i.explicitDeclaration),this.entityOccurrence(this.nodes(s.children,"entityName")[0],n.target,n.target.explicitDeclaration)],edges:[{id:a,span:[0,0],...r.explicitIdLocation?{idSpan:r.explicitIdLocation.span}:{},...r.label?{labelSpan:r.label.span}:{}}]}}entityName(e){let t=this.tokens(e,"IDENTIFIER")[0],i=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],s=this.nodes(e,"nodeLabel")[0],n=this.nodes(e,"useCaseMetadata")[0],r=this.nodes(e,"stereotype")[0],a=this.nodes(e,"classSuffix")[0],o=a?this.visit(a):{classes:[],spans:[]};if(t){let i=s?this.visit(s):this.tokenLabel(t),a=s?this.tokens(e,"LBRACKET").length?"rect":"ellipse":void 0;return{id:t.image,label:i,location:this.tokenLocation(t),generated:!1,...a?{shape:a}:{},...n?{metadata:this.visit(n)}:{},...r?{stereotype:this.visit(r)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(a||n||r)}}let l=this.tokenLabel(i);return{id:this.generateId(l.text),label:l,location:this.tokenLocation(i),generated:!0,...n?{metadata:this.visit(n)}:{},...r?{stereotype:this.visit(r)}:{},classes:o.classes,classSpans:o.spans,explicitDeclaration:!!(n||r)}}nodeLabel(e){let t=this.allTokens(e);if(1===t.length&&("PLAIN_STRING"===t[0].tokenType.name||"MARKDOWN_STRING"===t[0].tokenType.name))return this.tokenLabel(t[0]);let i=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return{text:this.source.slice(i[0],i[1]),type:"text",span:i}}useCaseMetadata(e){return this.visit(this.nodes(e,"metadata")[0])}relationTail(e){let t=this.tokens(e,"IDENTIFIER")[0];return{...t?{explicitId:t.image,explicitIdLocation:this.tokenLocation(t)}:{},arrow:this.visit(this.nodes(e,"arrow")[0]),target:this.visit(this.nodes(e,"entityName")[0])}}arrow(e){return this.visit(this.firstNode(e,"semanticRelation","forwardSolidOperator","backwardSolidOperator","markerlessSolidOperator","forwardCircleOperator","backwardCircleOperator","forwardCrossOperator","backwardCrossOperator"))}edgeLabel(e){return this.nodeLabel(e)}semanticRelation(e){if(this.tokens(e,"GENERALIZATION").length)return{type:"generalization",arrowType:0,minlen:1};let t=this.tokens(e,"INCLUDE").length?"include":"extend",i=this.tokens(e,"include"===t?"INCLUDE":"EXTEND")[0];return{type:t,arrowType:0,label:{text:t,type:"text",span:this.tokenSpan(i)},minlen:1}}metadata(e){return{properties:this.nodes(e,"metadataProperty").map(e=>this.visit(e)),location:this.ctxLocation(e)}}metadataProperty(e){let t=this.allTokens(e).filter(e=>"COLON"!==e.tokenType.name),i=t[0],s=t[1],n="TRUE"===s.tokenType.name||"FALSE"!==s.tokenType.name&&this.decodePlain(s),r=[i.startOffset,(s.endOffset??s.startOffset)+1];return{key:this.decodePlain(i),value:n,span:r,keySpan:this.contentSpan(i),valueSpan:this.contentSpan(s),location:this.tokenLocation(i)}}metadataSeparator(e){}systemBoundaryStatement(e){let t=this.visit(this.nodes(e,"systemBoundaryName")[0]),i=this.nodes(e,"classSuffix")[0],s=i?this.visit(i):{classes:[],spans:[]};t.classes=s.classes,this.builder.addBoundary(t);let n=this.parentBoundary;this.parentBoundary={id:t.id,location:t.location};let r=this.nodes(e,"systemBoundaryContent")[0],a=r?this.visit(r):[];this.parentBoundary=n;let o=this.tokens(e,"END")[0],l=this.nodes(e,"metadata")[0],c=l?this.visit(l):void 0,h={kind:"group",span:[0,0],group:t.id,idSpan:t.location.span,titleSpan:t.label.span,endSpan:this.tokenSpan(o),classSpans:s.spans,...c?{metadata:c.properties.map(({key:e,span:t,keySpan:i,valueSpan:s})=>({key:e,span:t,keySpan:i,valueSpan:s}))}:{},...a.length?{children:a}:{}};return c&&this.builder.addMetadataAssignment(t.id,t.location,c,h),h}systemBoundaryName(e){let t=this.tokens(e,"IDENTIFIER")[0];if(t){let i=this.nodes(e,"nodeLabel")[0];return{id:t.image,label:i?this.visit(i):this.tokenLabel(t),location:this.tokenLocation(t),generated:!1,classes:[]}}let i=this.tokens(e,"PLAIN_STRING")[0]??this.tokens(e,"MARKDOWN_STRING")[0],s=this.tokenLabel(i);return{id:this.generateId(s.text),label:s,location:this.tokenLocation(i),generated:!0,classes:[]}}systemBoundaryContent(e){return[...this.nodes(e,"blankLine"),...this.nodes(e,"commentLine"),...this.nodes(e,"boundaryElement")].sort((e,t)=>(e.location?.startOffset??0)-(t.location?.startOffset??0)).map(e=>this.wrap(e,this.visit(e)))}boundaryElement(e){let t=this.nodes(e,"actorDeclarationOnly")[0];if(t)return this.visit(t);let i=this.nodes(e,"entityName")[0],s=this.visit(i);return s.explicitDeclaration=!0,s.shape??="ellipse",this.builder.addElement(this.entityDraft(s)),{kind:"node",span:[0,0],nodes:[this.entityOccurrence(i,s,!0)]}}metadataAssignmentStatement(e){let t=this.visit(this.nodes(e,"metadataAssignmentTarget")[0]),i=this.visit(this.nodes(e,"metadata")[0]),s={kind:"metadata",span:[0,0],nodes:[{id:t.id,span:t.location.span,idSpan:t.location.span}],metadata:i.properties.map(({key:e,span:t,keySpan:i,valueSpan:s})=>({key:e,span:t,keySpan:i,valueSpan:s}))};return this.builder.addMetadataAssignment(t.id,t.location,i,s),s}metadataAssignmentTarget(e){let t=this.allTokens(e)[0],i=this.tokenLabel(t);return{id:"IDENTIFIER"===t.tokenType.name?t.image:this.generateId(i.text),location:this.tokenLocation(t)}}noteStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],i=this.visit(this.nodes(e,"nodeLabel")[0]);return this.builder.addNote({target:t.image,targetLocation:this.tokenLocation(t),label:i,location:this.ctxLocation(e)}),{kind:"note",span:[0,0],ref:`note-${this.anonymousNote++}`,refSpan:i.span,nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}stereotype(e){let t=this.tokens(e,"STEREOTYPE_TEXT")[0];return{value:t.image.trim(),span:this.tokenSpan(t)}}classSuffix(e){let t=this.tokens(e,"IDENTIFIER");return{classes:t.map(e=>e.image),spans:t.map(e=>this.tokenSpan(e))}}jsonStatement(e){let t=this.tokens(e,"JSON_DECLARATION_START")[0],i=this.tokens(e,"JSON_OBJECT_LITERAL")[0],s=/^json[\t ]+(\w+)/.exec(t.image),n=s[1],r=s[0].length-n.length,a={span:[t.startOffset+r,t.startOffset+r+n.length],line:t.startLine??1,column:(t.startColumn??1)+r},o=lA(i.image,i.startLine??1,i.startColumn??1),l=this.nodes(e,"classSuffix")[0],c=l?this.visit(l):{classes:[],spans:[]},h={id:n,value:o.value,propertyOrder:o.propertyOrder,location:a,classes:c.classes};return this.builder.addJson(h),{kind:"json",span:[0,0],nodes:[{id:n,span:a.span,idSpan:a.span,defines:!0,classSpans:c.spans}],classSpans:c.spans}}directionStatement(e){let t=this.allTokens(e).find(e=>["TD","TB","BT","RL","LR"].includes(e.tokenType.name));return this.builder.setDirection(t.image),{kind:"direction",span:[0,0]}}classDefStatement(e){let t=this.tokens(e,"IDENTIFIER"),i=this.visit(this.nodes(e,"styles")[0]);return this.builder.addClassDef(t.map(e=>e.image),i),{kind:"classDef",span:[0,0],ref:t[0].image,refSpan:this.tokenSpan(t[0])}}classStatement(e){let t=this.tokens(e,"IDENTIFIER"),i=1;for(;i<t.length&&this.source.slice((t[i-1].endOffset??t[i-1].startOffset)+1,t[i].startOffset).includes(",");i++);let s=t.slice(0,i).map(e=>({id:e.image,location:this.tokenLocation(e)})),n=t.slice(i).map(e=>e.image);return this.builder.addClassAssignment(s,n),{kind:"classAssign",span:[0,0],ref:n[0],refSpan:this.tokenSpan(t[i]),nodes:s.map(({id:e,location:t})=>({id:e,span:t.span,idSpan:t.span}))}}
57styleStatement(e){let t=this.tokens(e,"IDENTIFIER")[0],i=this.visit(this.nodes(e,"styles")[0]);return this.builder.addStyleAssignment(t.image,this.tokenLocation(t),i),{kind:"style",span:[0,0],nodes:[{id:t.image,span:this.tokenSpan(t),idSpan:this.tokenSpan(t)}]}}styles(e){return this.nodes(e,"styleValue").map(e=>this.visit(e))}styleValue(e){let t=this.allTokens(e),i=[t[0].startOffset,(t.at(-1).endOffset??t.at(-1).startOffset)+1];return this.source.slice(i[0],i[1]).replaceAll("\\,",",")}styleComponent(e){return this.allTokens(e).map(e=>e.image).join("")}forwardSolidOperator(e){let t=this.tokens(e,"FORWARD_SOLID")[0];return{type:"association",arrowType:0,minlen:this.solidMinlen(t)}}backwardSolidOperator(e){let t=this.tokens(e,"BACKWARD_SOLID")[0],i=this.nodes(e,"edgeLabel")[0],s=i?this.tokens(e,"MARKERLESS_SOLID").at(-1):t;return{type:"association",arrowType:1,minlen:this.solidMinlen(s),...i?{label:this.visit(i)}:{}}}markerlessSolidOperator(e){let t=this.nodes(e,"edgeLabel")[0],i=this.allTokens(e);if(!t)return{type:"association",arrowType:2,minlen:this.solidMinlen(this.tokens(e,"MARKERLESS_SOLID")[0])};let s=i.at(-1),n="FORWARD_SOLID"===s.tokenType.name?0:"FORWARD_CIRCLE"===s.tokenType.name?3:"FORWARD_CROSS"===s.tokenType.name?4:2;return{type:"association",arrowType:n,label:this.visit(t),minlen:0===n||2===n?this.solidMinlen(s):1}}forwardCircleOperator(e){return{type:"association",arrowType:3,minlen:1}}backwardCircleOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:5,minlen:1,...t?{label:this.visit(t)}:{}}}forwardCrossOperator(e){return{type:"association",arrowType:4,minlen:1}}backwardCrossOperator(e){let t=this.nodes(e,"edgeLabel")[0];return{type:"association",arrowType:6,minlen:1,...t?{label:this.visit(t)}:{}}}actorDraft(e){return{id:e.id,kind:"actor",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}entityDraft(e){return{id:e.id,kind:"usecase",label:e.label,location:e.location,generated:e.generated,...this.parentBoundary?{parentId:this.parentBoundary.id,parentLocation:this.parentBoundary.location}:{},...e.shape?{shape:e.shape}:{},...e.metadata?{metadata:e.metadata}:{},...e.stereotype?{stereotype:e.stereotype.value,stereotypeSpan:e.stereotype.span}:{},classes:e.classes}}endpoint(e,t=e.explicitDeclaration??!0){return{id:e.id,label:e.label,location:e.location,generated:e.generated,declaration:t,classesOnReference:e.classes.length>0}}relationshipDraft(e,t,i){return{source:this.endpoint(e,!0),target:this.endpoint(t.target),location:i,...t.explicitId?{explicitId:t.explicitId,explicitIdLocation:t.explicitIdLocation}:{},...t.arrow}}actorOccurrence(e,t,i){return{id:t.id,span:this.nodeSpan(e),idSpan:t.location.span,labelSpan:t.label.span,...i?{defines:!0}:{},...t.stereotype?{stereotypeSpan:t.stereotype.span}:{},...t.metadata?{metadata:t.metadata.properties.map(({key:e,span:t,keySpan:i,valueSpan:s})=>({key:e,span:t,keySpan:i,valueSpan:s}))}:{},...t.classSpans.length?{classSpans:t.classSpans}:{}}}entityOccurrence(e,t,i){return this.actorOccurrence(e,t,i)}wrap(e,t){if("blank"===t.kind||"comment"===t.kind)return t;for(let i of(t.span=this.nodeSpan(e),t.edges??[]))i.span=t.span;return t}tokenLabel(e){let t="MARKDOWN_STRING"===e.tokenType.name?"markdown":"text",i="markdown"===t?2:+("PLAIN_STRING"===e.tokenType.name),s=this.tokenSpan(e,i);return{text:this.source.slice(s[0],s[1]),type:t,span:s}}decodePlain(e){return"PLAIN_STRING"===e.tokenType.name?e.image.slice(1,-1):e.image}contentSpan(e){return this.tokenSpan(e,"PLAIN_STRING"===e.tokenType.name?1:2*("MARKDOWN_STRING"===e.tokenType.name))}generateId(e){return e.replace(/\W/g,"_")}solidMinlen(e){return Math.max(1,(e.image.match(/-/g)?.length??2)-1)}nodeLocation(e){let t=this.allTokens(e.children)[0];return{span:this.nodeSpan(e),line:t.startLine??1,column:t.startColumn??1}}ctxLocation(e){let t=this.allTokens(e).filter(e=>"NEWLINE"!==e.tokenType.name&&"EOF"!==e.tokenType.name),i=t[0],s=t.at(-1);return{span:[i.startOffset,Math.min(this.source.length,(s.endOffset??s.startOffset+s.image.length-1)+1)],line:i.startLine??1,column:i.startColumn??1}}tokenLocation(e){let t="PLAIN_STRING"===e.tokenType.name?1:2*("MARKDOWN_STRING"===e.tokenType.name);return{span:this.tokenSpan(e,t),line:e.startLine??1,column:(e.startColumn??1)+t}}nodeSpan(e){let t=this.allTokens(e.children).filter(e=>"NEWLINE"!==e.tokenType.name&&"EOF"!==e.tokenType.name),i=t[0],s=t.at(-1);if(!i||!s)throw Error("Usecase CST node has no source token");return[i.startOffset,Math.min(this.source.length,(s.endOffset??s.startOffset+s.image.length-1)+1)]}tokenSpan(e,t=0){return[e.startOffset+t,Math.min(this.source.length,(e.endOffset??e.startOffset+e.image.length-1)+1-t)]}nodes(e,t){return(e[t]??[]).filter(e=>"children"in e)}tokens(e,t){return(e[t]??[]).filter(e=>"tokenTypeIdx"in e)}firstNode(e,...t){for(let i of t){let t=this.nodes(e,i)[0];if(t)return t}throw Error(`Usecase CST is missing one of: ${t.join(", ")}`)}
57allTokens(e){let t=[];for(let i of Object.values(e))for(let e of i)"tokenTypeIdx"in e?t.push(e):t.push(...this.allTokens(e.children));return t.sort((e,t)=>e.startOffset-t.startOffset)}},lM={parse:(0,I.K)(async e=>{a1.clear(),lf.input=[];try{aS({diagramType:"usecase",lexer:lu,parser:lf,entry:(0,I.K)(()=>lf.start(),"entry"),visit:(0,I.K)(t=>lw.build(t,e),"visit")},e)}catch(i){a1.clear();let t=lf.errors[0];if(t){let{token:s}=t,n=Number.isFinite(s.startOffset)?s.startOffset:e.length,r="number"==typeof s.endOffset&&Number.isFinite(s.endOffset)?s.endOffset+1:n,a=s.startLine??e.slice(0,n).split(/\r\n|\r|\n/).length,o=Math.max(e.lastIndexOf("\n",n-1),e.lastIndexOf("\r",n-1)),l=s.startColumn??n-o,c=i instanceof Error?i.message:String(i);throw Error(`${c} at line ${a}, column ${l} [${n},${r})`)}throw i}},"parse")},lP=["point","circle","cross","extension"],lD={usecaseActor:!0,usecaseActorHollow:!0,usecaseActorAwesome:!0,usecaseActorIcon:!0},l$=(0,I.K)((e,t)=>{let[i,s]=[e,t].map(e=>e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element");return`usecase-${i}-${s}`},"usecaseDomId"),lF=(0,I.K)(e=>`usecase-${e.replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"")||"element"}`,"usecaseNodeDomId"),lB=(0,I.K)((e,t)=>"markdown"!==t?e:(0,R.O6)(e).map(e=>e.map(e=>e.content).join(" ")).join("\n"),"getAccessibleLabel"),lK=(0,I.K)(e=>{let t=lB(e.label??e.id,e.labelType);if(lD[e.shape]){let i=e.actorType&&"normal"!==e.actorType?`${e.actorType} `:"",s=e.business?"business ":"",n=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${s}${i}actor ${t}${n}`}if("note"===e.shape)return`Note for ${e.noteTargetLabel??e.noteTarget??""}: ${t}`;if("usecaseJsonTable"===e.shape){let i=(e.jsonRows??[]).map(e=>`${e.accessibleKey}: ${e.value}`).join("; ");return i?`${t}: ${i}`:t}let i=e.stereotype?`, stereotype ${e.stereotype}`:"";return`${e.business?"business ":""}use case ${t}${i}`},"getUsecaseNodeAccessibleName"),lj=(0,I.K)(e=>`${e.boundaryType} system boundary ${lB(e.label??e.id,e.labelType)}`,"getUsecaseBoundaryAccessibleName"),lG=(0,I.K)(e=>{if("note"===e.relationshipType)return"";let t="association"===e.relationshipType&&e.label?`association ${lB(e.label,e.labelType)}`:e.relationshipType;return`${t} from ${e.sourceLabel} to ${e.targetLabel}`},"getUsecaseEdgeAccessibleName"),lW=(0,I.K)(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),"escapePlainLabel"),lz=(0,I.K)(e=>e.replace(/([*[\\\]_`])/g,"\\$1"),"escapeMarkdownMarkers"),lV=(0,I.K)((e,t)=>{for(let i of(e.diagramId=t,e.markers=[...lP],e.nodes))if(i.domId=lF(i.id),void 0!==i.label&&"text"===i.labelType&&(i.label=lW(i.label)),i.stereotype&&(i.stereotype=lW(i.stereotype)),i.isGroup||"usecaseJsonTable"!==i.shape||(i.jsonRows=i.jsonRows?.map(e=>({...e,key:lW(e.key),value:lW(e.value)}))),!i.isGroup&&("usecaseEllipse"===i.shape||"rect"===i.shape)&&i.stereotype){let e=i.label??lW(i.id);i.label=`\xab${lz(i.stereotype)}\xbb<br/>${"text"===i.labelType?lz(e):e}`,i.labelType="markdown",i.hasFoldedStereotype=!0,delete i.stereotype}for(let t of e.edges)void 0!==t.label&&"text"===t.labelType&&(t.label=lW(t.label));return e},"prepareUsecaseLayoutData"),lH=(0,I.K)((e,t,i)=>{for(let s of t.nodes){let n="string"==typeof s.domId?s.domId:l$(t.diagramId,s.id),r=e.select(`#${n}`),a=s.isGroup?"boundary":lD[s.shape]?"actor":"note"===s.shape?"note":"usecaseJsonTable"===s.shape?"json":"usecase",o=i.nodes.get(s.id)??s.id;if(r.attr("data-usecase-id",s.id).attr("data-usecase-kind",a).attr("role","img").attr("aria-label",o),!s.isGroup&&("usecaseEllipse"===s.shape||"rect"===s.shape)&&"hasFoldedStereotype"in s&&!0===s.hasFoldedStereotype){let e=r.node(),t=e?.querySelector(".nodeLabel"),i=t?.querySelector("p")??t,s=i?.firstChild;if(i&&s?.nodeType===3){let e=i.ownerDocument.createElement("span");e.className="usecase-stereotype",i.insertBefore(e,s),e.appendChild(s)}else e?.querySelector(".label tspan tspan, .label tspan")?.classList.add("usecase-stereotype")}}let s=new Map(t.edges.map(e=>[e.id,e]));e.selectAll('path[data-et="edge"]').each(function(){let e=s.get(this.getAttribute("data-id")??"");if(!e)return;let n=(0,aA.Ltv)(this);n.attr("id",l$(t.diagramId,e.id)).attr("data-usecase-id",e.id).attr("data-usecase-kind",e.internal?"note-connector":"relationship"),e.internal?n.attr("aria-hidden","true"):n.attr("role","img").attr("aria-label",i.edges.get(e.id)??e.id)})},"annotateUsecaseElements"),lY=(0,I.K)((e,t)=>{e.style("--mermaid-usecase-actor-font-size",`${t.actorFontSize}px`).style("--mermaid-usecase-actor-font-family",t.actorFontFamily).style("--mermaid-usecase-actor-font-we
57ight",t.actorFontWeight).style("--mermaid-usecase-font-size",`${t.usecaseFontSize}px`).style("--mermaid-usecase-font-family",t.usecaseFontFamily).style("--mermaid-usecase-font-weight",t.usecaseFontWeight)},"applyUsecaseFonts"),lX=(0,I.K)(async(e,t,i,s)=>{k.R.info("Drawing usecase diagram (unified)",t);let{layout:n}=(0,v.D7)(),r=s.db,a=r.getData(),o=new Map(a.nodes.map(e=>[e.id,lB(e.label??e.id,e.labelType)])),l={nodes:new Map(a.nodes.map(e=>[e.id,e.isGroup?lj(e):lK("note"===e.shape?{...e,noteTargetLabel:o.get(e.noteTarget??"")}:e)])),edges:new Map(a.edges.map(e=>[e.id,lG({...e,sourceLabel:o.get(e.source)??e.sourceLabel,targetLabel:o.get(e.target)??e.targetLabel})]))},c=(0,S.A)(t,a.config.securityLevel);a.layoutAlgorithm=(0,O.q7)(n),lV(a,t),lY(c,a),await (0,O.XX)(a,c),lH(c,a,l);let h=a.diagramPadding;N._K.insertTitle(c,"usecaseDiagramTitleText",0,r.getDiagramTitle?.()??""),(0,L.P)(c,h,"usecaseDiagram",a.useMaxWidth),lY(c,a)},"draw"),lJ=(0,I.K)(e=>({actorBkg:e.usecaseActorBkg??e.actorBkg??e.mainBkg,actorBorder:e.usecaseActorBorder??e.actorBorder??e.primaryColor,bkg:e.usecaseBkg??e.mainBkg,border:e.usecaseBorder??e.nodeBorder??e.primaryColor,boundaryBkg:e.usecaseBoundaryBkg??e.clusterBkg,boundaryBorder:e.usecaseBoundaryBorder??e.clusterBorder,includeLine:e.usecaseIncludeLine??e.lineColor,extendLine:e.usecaseExtendLine??e.lineColor}),"roleColors"),lq=(0,I.K)(e=>{let{theme:t,bkgColorArray:i,borderColorArray:s}=e;if(!(0,b.P1)(t,s))return"";let n=(0,v.zj)().usecase?.colorScheme==="rotate",r=(0,b.rq)(e.look),a="handDrawn"===r,o=(0,b.Ic)(i),l="";for(let e=0;e<(0,b.Hu)(s);e++){let t=s[e],c=o?`fill: ${i[e%i.length]};`:"",h=`[data-look="${r}"][data-color-id="color-${e}"]`;l+=` 58 59 & ${h}
59.system-boundary rect.boundary-body, 60 & ${h}.system-boundary rect.boundary-tab, 61 & ${h}.system-boundary .boundary-body path, 62 & ${h}.system-boundary .boundary-tab path { 63 stroke: ${t}; 64 ${c} 65 } 66 `,n&&(l+=` 67 68 /* Use case bodies -- \`.usecase-element\` covers the ellipse form, the \`[Rect]\` form and 69 the business variant. 70 71 Element selectors only, never a bare \`path\`. Under the handDrawn look roughjs draws 72 the body as a *pair* of paths, an outline stroked in the border colour and a hachure 73 fill stroked in the background colour, with no class to tell them apart. Stroking 74 both repaints the fill lines as border colour and the shape collapses into a solid 75 block -- which is what \`.usecase-element path\` did. So handDrawn bodies keep the 76 theme's uniform colours, exactly as handDrawn flowchart nodes do. */ 77 & ${h}.usecase-element ellipse, 78 & ${h}.usecase-element rect { 79 stroke: ${t}; 80 ${c} 81 } 82 83 /* The business marker is a single classed path, so it can be reached safely by name -- 84 without it the marker keeps the uniform border beside a palette-coloured body. No 85 \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */ 86 & ${h}.usecase-element .usecase-business-marker { 87 stroke: ${t}; 88 } 89 90 /* Actor glyphs, mirroring the uniform rule further down. The fill goes on the glyph 91 group, never on its children, so the hollow variant's own \`fill="none"\` keeps 92 winning and a hollow actor stays hollow. Same reason as above for not descending 93 into the handDrawn paths. */ 94 & ${h}.usecase-actor .usecase-actor-shape, 95 & ${h}.usecase-actor .usecase-actor-hollow, 96 & ${h}.usecase-actor .usecase-actor-awesome, 97 & ${h}.usecase-actor .usecase-actor-icon { 98 stroke: ${t}; 99 ${c} 100 } 101${a?"":` 102 /* The group rule above reaches the glyph by inheritance, which the neo look breaks: it 103 ships a \`[data-look="neo"].node path { stroke }\` rule that hits the glyph's own paths, 104 and a value set directly on the child always beats one inherited from the parent, 105 whatever the parent rule's specificity. So name the children too. 106 107 Emitted for every look *except* handDrawn, where roughjs draws the glyph as an 108 outline path plus a hachure fill path stroked in the fill colour, indistinguishable 109 in CSS -- stroking both turns a hollow actor into a solid disc. Deliberately no 110 \`fill\` either way, so the hollow variant's own \`fill="none"\` keeps winning. */ 111 & ${h}.usecase-actor .usecase-actor-glyph path, 112 & ${h}.usecase-actor .usecase-actor-glyph circle { 113 stroke: ${t}; 114 } 115`} 116 `)}return l},"genColor"),lZ={parser:lM,db:a1,renderer:{draw:lX},styles:(0,I.K)(e=>
116{let t=lJ(e),i="handDrawn"===(0,b.rq)(e.look);return` 117 ${lq(e)} 118 & .usecase-actor { 119 color: ${e.actorTextColor??e.primaryTextColor}; 120 } 121 122 & .usecase-actor-shape, 123 & .usecase-actor-hollow, 124 & .usecase-actor-awesome, 125 & .usecase-actor-icon { 126 fill: ${t.actorBkg}; 127 stroke: ${t.actorBorder}; 128 stroke-width: 2px; 129 } 130${i?"":` 131 /* The rule above colours the glyph group and lets its children inherit, which the neo 132 look breaks: it ships a \`[data-look="neo"].node path { stroke }\` rule that lands on 133 the glyph's own paths, and a value set directly on a child always beats one inherited 134 from its parent, whatever the parent rule's specificity. Since neo is the default look, 135 without this every actor renders in the node border colour rather than the actor 136 colour the rule above asks for. 137 138 \`.node\` is in the selector to outrank that neo rule rather than tie with it: both 139 would otherwise be one attribute plus one class plus one element, leaving the winner to 140 depend on which stylesheet is concatenated last. 141 142 Stroke only: the hollow variant's own \`fill="none"\` has to keep winning. */ 143 & .node.usecase-actor .usecase-actor-glyph path, 144 & .node.usecase-actor .usecase-actor-glyph circle { 145 stroke: ${t.actorBorder}; 146 } 147`} 148 & .usecase-actor .nodeLabel, 149 & .actor-label { 150 color: ${e.actorTextColor??e.primaryTextColor}; 151 fill: ${e.actorTextColor??e.primaryTextColor}; 152 font-family: var(--mermaid-usecase-actor-font-family, ${e.fontFamily}); 153 font-size: var(--mermaid-usecase-actor-font-size, 14px); 154 font-weight: var(--mermaid-usecase-actor-font-weight, normal); 155 } 156 157 & .usecase-element ellipse, 158 & .usecase-element rect, 159 & .usecase-business ellipse, 160 & .usecase-business rect { 161 fill: ${t.bkg}; 162 stroke: ${t.border}; 163 stroke-width: 2px; 164 } 165${i?"":` 166 /* The same interception the actor glyph hits, one element down: neo ships 167 \`[data-look="neo"].node rect { stroke: nodeBorder }\`, which outranks the plain 168 \`.usecase-element rect\` above, so a use case written in the \`[Rect]\` form kept the node 169 border colour while its ellipse siblings took the role colour. An \`<ellipse>\` has no 170 equivalent neo rule and is already correct; restating it here costs nothing and means 171 the two forms cannot drift apart again. 172 173 Qualified with \`[data-look]\` *and* \`.node\` to land strictly above that rule rather than 174 tie with it -- on a tie the later stylesheet would win, which is how neo took this in 175 the first place. Skipped under handDrawn, where roughjs draws paths and neither element 176 exists. */ 177 & [data-look="${(0,b.rq)(e.look)}"].node.usecase-element ellipse, 178 & [data-look="${(0,b.rq)(e.look)}"].node.usecase-element rect { 179 fill: ${t.bkg}; 180 stroke: ${t.border}; 181 } 182 183 /* The business marker is a \`<path>\`, so it loses to \`[data-look="neo"].node path\` the same 184 way. No \`fill\`: the marker is drawn with \`fill="none"\` and has to stay that way. */ 185 & [data-look="${(0,b.rq)(e.look)}"].node.usecase-element .usecase-business-marker { 186 stroke: ${t.border}; 187 } 188`} 189 & .usecase-element .nodeLabel, 190 & .usecase-label { 191 color: ${e.primaryTextColor}; 192 fill: ${e.primaryTextColor}; 193 font-family: var(--mermaid-usecase-font-family, ${e.fontFamily}); 194 font-size: var(--mermaid-usecase-font-size, 12px);
195 font-weight: var(--mermaid-usecase-font-weight, normal); 196 } 197 198 & .usecase-stereotype, 199 & .usecase-business-marker { 200 color: ${e.primaryTextColor}; 201 fill: ${e.primaryTextColor}; 202 stroke: ${t.border}; 203 } 204 205 & .system-boundary rect.boundary-body, 206 & .system-boundary rect.boundary-tab, 207 & .system-boundary-package-tab { 208 fill: ${t.boundaryBkg}; 209 stroke: ${t.boundaryBorder}; 210 stroke-width: 1px; 211 } 212 213 & .system-boundary-title text { 214 fill: ${e.titleColor??e.primaryTextColor}; 215 } 216 217 /* Only the span, never the <p> inside it: the renderer puts a user-supplied 218 'color' on the span, and that has to stay inheritable by its children. */ 219 & .system-boundary-title span { 220 color: ${e.titleColor??e.primaryTextColor}; 221 } 222 223 & .usecase-note { 224 fill: ${e.noteBkgColor}; 225 stroke: ${e.noteBorderColor}; 226 color: ${e.noteTextColor}; 227 } 228 229 & .usecase-note .nodeLabel { 230 color: ${e.noteTextColor}; 231 fill: ${e.noteTextColor}; 232 } 233 234 & .usecase-json-table, 235 & .usecase-json-table rect, 236 & .usecase-json-cell { 237 fill: ${e.mainBkg}; 238 stroke: ${e.nodeBorder??e.primaryColor}; 239 } 240 241 & .usecase-json-title, 242 & .usecase-json-key, 243 & .usecase-json-value { 244 color: ${e.primaryTextColor}; 245 fill: ${e.primaryTextColor}; 246 } 247 248 & .relationship { 249 fill: none; 250 stroke: ${e.lineColor}; 251 } 252 253 & .relationship-include, 254 & .relationship-extend, 255 & .relationship-note { 256 stroke-dasharray: 3; 257 } 258 259 /* Include and extend are both dashed, which is a weak distinction at small sizes. The 260 tokens default to \`lineColor\`, so a theme that does not set them is unchanged. */ 261 & .relationship-include { 262 stroke: ${t.includeLine}; 263 } 264 265 & .relationship-extend { 266 stroke: ${t.extendLine}; 267 } 268 269 & .relationship.edge-animation-fast, 270 & .relationship.edge-animation-slow { 271 stroke-linecap: round; 272 } 273 274 & .edgeLabel, 275 & .edgeLabel p { 276 background-color: ${e.edgeLabelBackground}; 277 } 278 279 & .labelBkg { 280 background-color: ${e.edgeLabelBackground}; 281 padding: 0 2px; 282 } 283 284 & .edgeLabel .label rect { 285 fill: ${e.edgeLabelBackground}; 286 } 287 288 & .relationship-label, 289 & .edgeLabel { 290 color: ${e.primaryTextColor}; 291 fill: ${e.primaryTextColor}; 292 font-family: ${e.fontFamily}; 293 font-size: 10px; 294 font-weight: normal; 295 } 296 297 & .marker, 298 & .marker.point, 299 & .marker.circle, 300 & .marker.cross { 301 fill: ${e.lineColor}; 302 stroke: ${e.lineColor}; 303 } 304 305 & .marker.extension { 306 fill: ${e.mainBkg}; 307 stroke: ${e.lineColor}; 308 } 309`},"getStyles")}},44909:(e,t,i)=>{i.d(t,{P:()=>a});var s=i(77980),n=i(64145),r=i(78923),a=(0,r.K)((e,t,i,r)=>{e.attr("class",i);let{width:a,height:c,x:h,y:u}=o(e,t);(0,s.a$)(e,c,a,r);let d=l(h,u,a,c,t);e.attr("viewBox",d),n.R.debug(`viewBox configured: ${d} with padding: ${t}`)},"setupViewPortForSVG"),o=(0,r.K)((e,t)=>{let i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+2*t,height:i.height+2*t,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=(0,r.K)((e,t,i,s,n)=>`${e-n} ${t-n} ${i} ${s}`,"createViewBox")},67595:(e,t,i)=>{i.d(t,{A:()=>r});var s=i(78923),n=i(56047),r=(0,s.K)((e,t)=>{let i;return"sandbox"===t&&(i=(0,n.Ltv)("#i"+e)),("sandbox"===t?(0,n.Ltv)(i.nodes()[0].contentDocument.body):(0,n.Ltv)("body")).select(`[id="${e}"]`)},"getDiagramElement")}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.