@jetstreamapp/soql-parser-js
Version:
Salesforce.com SOQL parser and composer
6 lines • 203 kB
JavaScript
"use strict";var ep=Object.create;var Ps=Object.defineProperty;var tp=Object.getOwnPropertyDescriptor;var rp=Object.getOwnPropertyNames;var np=Object.getPrototypeOf,ip=Object.prototype.hasOwnProperty;var op=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ap=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rp(e))!ip.call(t,i)&&i!==r&&Ps(t,i,{get:()=>e[i],enumerable:!(n=tp(e,i))||n.enumerable});return t};var sp=(t,e,r)=>(r=t!=null?ep(np(t)):{},ap(e||!t||!t.__esModule?Ps(r,"default",{value:t,enumerable:!0}):r,t));var Qf=op((oo,Xf)=>{var dy=require("events").EventEmitter,Ls=require("child_process").spawn,no=require("path"),my=no.dirname,Hf=no.basename,Kf=require("fs");require("util").inherits(P,dy);oo=Xf.exports=new P;oo.Command=P;oo.Option=Mr;function Mr(t,e){this.flags=t,this.required=t.indexOf("<")>=0,this.optional=t.indexOf("[")>=0,this.bool=t.indexOf("-no-")===-1,t=t.split(/[ ,|]+/),t.length>1&&!/^[[<]/.test(t[1])&&(this.short=t.shift()),this.long=t.shift(),this.description=e||""}Mr.prototype.name=function(){return this.long.replace("--","").replace("no-","")};Mr.prototype.attributeName=function(){return gy(this.name())};Mr.prototype.is=function(t){return this.short===t||this.long===t};function P(t){this.commands=[],this.options=[],this._execs={},this._allowUnknownOption=!1,this._args=[],this._name=t||""}P.prototype.command=function(t,e,r){typeof e=="object"&&e!==null&&(r=e,e=null),r=r||{};var n=t.split(/ +/),i=new P(n.shift());return e&&(i.description(e),this.executables=!0,this._execs[i._name]=!0,r.isDefault&&(this.defaultExecutable=i._name)),i._noHelp=!!r.noHelp,this.commands.push(i),i.parseExpectedArgs(n),i.parent=this,e?this:i};P.prototype.arguments=function(t){return this.parseExpectedArgs(t.split(/ +/))};P.prototype.addImplicitHelpCommand=function(){this.command("help [cmd]","display help for [cmd]")};P.prototype.parseExpectedArgs=function(t){if(t.length){var e=this;return t.forEach(function(r){var n={required:!1,name:"",variadic:!1};switch(r[0]){case"<":n.required=!0,n.name=r.slice(1,-1);break;case"[":n.name=r.slice(1,-1);break}n.name.length>3&&n.name.slice(-3)==="..."&&(n.variadic=!0,n.name=n.name.slice(0,-3)),n.name&&e._args.push(n)}),this}};P.prototype.action=function(t){var e=this,r=function(o,a){o=o||[],a=a||[];var s=e.parseOptions(a);Yf(e,s.unknown),s.unknown.length>0&&e.unknownOption(s.unknown[0]),s.args.length&&(o=s.args.concat(o)),e._args.forEach(function(l,c){l.required&&o[c]==null?e.missingArgument(l.name):l.variadic&&(c!==e._args.length-1&&e.variadicArgNotLast(l.name),o[c]=o.splice(c))}),e._args.length?o[e._args.length]=e:o.push(e),t.apply(e,o)},n=this.parent||this,i=n===this?"*":this._name;return n.on("command:"+i,r),this._alias&&n.on("command:"+this._alias,r),this};P.prototype.option=function(t,e,r,n){var i=this,o=new Mr(t,e),a=o.name(),s=o.attributeName();if(typeof r!="function")if(r instanceof RegExp){var l=r;r=function(c,p){var h=l.exec(c);return h?h[0]:p}}else n=r,r=null;return(!o.bool||o.optional||o.required)&&(o.bool||(n=!0),n!==void 0&&(i[s]=n,o.defaultValue=n)),this.options.push(o),this.on("option:"+a,function(c){c!==null&&r&&(c=r(c,i[s]===void 0?n:i[s])),typeof i[s]=="boolean"||typeof i[s]>"u"?c==null?i[s]=o.bool?n||!0:!1:i[s]=c:c!==null&&(i[s]=c)}),this};P.prototype.allowUnknownOption=function(t){return this._allowUnknownOption=arguments.length===0||t,this};P.prototype.parse=function(t){this.executables&&this.addImplicitHelpCommand(),this.rawArgs=t,this._name=this._name||Hf(t[1],".js"),this.executables&&t.length<3&&!this.defaultExecutable&&t.push("--help");var e=this.parseOptions(this.normalize(t.slice(2))),r=this.args=e.args,n=this.parseArgs(this.args,e.unknown),i=n.args[0],o=null;return i&&(o=this.commands.filter(function(a){return a.alias()===i})[0]),this._execs[i]===!0?this.executeSubCommand(t,r,e.unknown):o?(r[0]=o._name,this.executeSubCommand(t,r,e.unknown)):this.defaultExecutable?(r.unshift(this.defaultExecutable),this.executeSubCommand(t,r,e.unknown)):n};P.prototype.executeSubCommand=function(t,e,r){e=e.concat(r),e.length||this.help(),e[0]==="help"&&e.length===1&&this.help(),e[0]==="help"&&(e[0]=e[1],e[1]="--help");var n=t[1],i=Hf(n,no.extname(n))+"-"+e[0],o,a=Kf.realpathSync(n);o=my(a);var s=no.join(o,i),l=!1;Os(s+".js")?(i=s+".js",l=!0):Os(s+".ts")?(i=s+".ts",l=!0):Os(s)&&(i=s),e=e.slice(1);var c;process.platform!=="win32"?l?(e.unshift(i),e=(process.execArgv||[]).concat(e),c=Ls(process.argv[0],e,{stdio:"inherit",customFds:[0,1,2]})):c=Ls(i,e,{stdio:"inherit",customFds:[0,1,2]}):(e.unshift(i),c=Ls(process.execPath,e,{stdio:"inherit"}));var p=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];p.forEach(function(h){process.on(h,function(){c.killed===!1&&c.exitCode===null&&c.kill(h)})}),c.on("close",process.exit.bind(process)),c.on("error",function(h){h.code==="ENOENT"?console.error("error: %s(1) does not exist, try --help",i):h.code==="EACCES"&&console.error("error: %s(1) not executable. try chmod or run with root",i),process.exit(1)}),this.runningCommand=c};P.prototype.normalize=function(t){for(var e=[],r,n,i,o=0,a=t.length;o<a;++o)if(r=t[o],o>0&&(n=this.optionFor(t[o-1])),r==="--"){e=e.concat(t.slice(o));break}else n&&n.required?e.push(r):r.length>1&&r[0]==="-"&&r[1]!=="-"?r.slice(1).split("").forEach(function(s){e.push("-"+s)}):/^--/.test(r)&&~(i=r.indexOf("="))?e.push(r.slice(0,i),r.slice(i+1)):e.push(r);return e};P.prototype.parseArgs=function(t,e){var r;return t.length?(r=t[0],this.listeners("command:"+r).length?this.emit("command:"+t.shift(),t,e):this.emit("command:*",t)):(Yf(this,e),e.length>0&&this.unknownOption(e[0]),this.commands.length===0&&this._args.filter(function(n){return n.required}).length===0&&this.emit("command:*")),this};P.prototype.optionFor=function(t){for(var e=0,r=this.options.length;e<r;++e)if(this.options[e].is(t))return this.options[e]};P.prototype.parseOptions=function(t){for(var e=[],r=t.length,n,i,o,a=[],s=0;s<r;++s){if(o=t[s],n){e.push(o);continue}if(o==="--"){n=!0;continue}if(i=this.optionFor(o),i){if(i.required){if(o=t[++s],o==null)return this.optionMissingArgument(i);this.emit("option:"+i.name(),o)}else i.optional?(o=t[s+1],o==null||o[0]==="-"&&o!=="-"?o=null:++s,this.emit("option:"+i.name(),o)):this.emit("option:"+i.name());continue}if(o.length>1&&o[0]==="-"){a.push(o),s+1<t.length&&t[s+1][0]!=="-"&&a.push(t[++s]);continue}e.push(o)}return{args:e,unknown:a}};P.prototype.opts=function(){for(var t={},e=this.options.length,r=0;r<e;r++){var n=this.options[r].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t};P.prototype.missingArgument=function(t){console.error("error: missing required argument `%s'",t),process.exit(1)};P.prototype.optionMissingArgument=function(t,e){e?console.error("error: option `%s' argument missing, got `%s'",t.flags,e):console.error("error: option `%s' argument missing",t.flags),process.exit(1)};P.prototype.unknownOption=function(t){this._allowUnknownOption||(console.error("error: unknown option `%s'",t),process.exit(1))};P.prototype.variadicArgNotLast=function(t){console.error("error: variadic arguments must be last `%s'",t),process.exit(1)};P.prototype.version=function(t,e){if(arguments.length===0)return this._version;this._version=t,e=e||"-V, --version";var r=new Mr(e,"output the version number");return this._versionOptionName=r.long.substr(2)||"version",this.options.push(r),this.on("option:"+this._versionOptionName,function(){process.stdout.write(t+`
`),process.exit(0)}),this};P.prototype.description=function(t,e){return arguments.length===0?this._description:(this._description=t,this._argsDescription=e,this)};P.prototype.alias=function(t){var e=this;if(this.commands.length!==0&&(e=this.commands[this.commands.length-1]),arguments.length===0)return e._alias;if(t===e._name)throw new Error("Command alias can't be the same as its name");return e._alias=t,this};P.prototype.usage=function(t){var e=this._args.map(function(n){return qf(n)}),r="[options]"+(this.commands.length?" [command]":"")+(this._args.length?" "+e.join(" "):"");return arguments.length===0?this._usage||r:(this._usage=t,this)};P.prototype.name=function(t){return arguments.length===0?this._name:(this._name=t,this)};P.prototype.prepareCommands=function(){return this.commands.filter(function(t){return!t._noHelp}).map(function(t){var e=t._args.map(function(r){return qf(r)}).join(" ");return[t._name+(t._alias?"|"+t._alias:"")+(t.options.length?" [options]":"")+(e?" "+e:""),t._description]})};P.prototype.largestCommandLength=function(){var t=this.prepareCommands();return t.reduce(function(e,r){return Math.max(e,r[0].length)},0)};P.prototype.largestOptionLength=function(){var t=[].slice.call(this.options);return t.push({flags:"-h, --help"}),t.reduce(function(e,r){return Math.max(e,r.flags.length)},0)};P.prototype.largestArgLength=function(){return this._args.reduce(function(t,e){return Math.max(t,e.name.length)},0)};P.prototype.padWidth=function(){var t=this.largestOptionLength();return this._argsDescription&&this._args.length&&this.largestArgLength()>t&&(t=this.largestArgLength()),this.commands&&this.commands.length&&this.largestCommandLength()>t&&(t=this.largestCommandLength()),t};P.prototype.optionHelp=function(){var t=this.padWidth();return this.options.map(function(e){return io(e.flags,t)+" "+e.description+(e.bool&&e.defaultValue!==void 0?" (default: "+JSON.stringify(e.defaultValue)+")":"")}).concat([io("-h, --help",t)+" output usage information"]).join(`
`)};P.prototype.commandHelp=function(){if(!this.commands.length)return"";var t=this.prepareCommands(),e=this.padWidth();return["Commands:",t.map(function(r){var n=r[1]?" "+r[1]:"";return(n?io(r[0],e):r[0])+n}).join(`
`).replace(/^/gm," "),""].join(`
`)};P.prototype.helpInformation=function(){var t=[];if(this._description){t=[this._description,""];var e=this._argsDescription;if(e&&this._args.length){var r=this.padWidth();t.push("Arguments:"),t.push(""),this._args.forEach(function(l){t.push(" "+io(l.name,r)+" "+e[l.name])}),t.push("")}}var n=this._name;this._alias&&(n=n+"|"+this._alias);var i=["Usage: "+n+" "+this.usage(),""],o=[],a=this.commandHelp();a&&(o=[a]);var s=["Options:",""+this.optionHelp().replace(/^/gm," "),""];return i.concat(t).concat(s).concat(o).join(`
`)};P.prototype.outputHelp=function(t){t||(t=function(e){return e}),process.stdout.write(t(this.helpInformation())),this.emit("--help")};P.prototype.help=function(t){this.outputHelp(t),process.exit()};function gy(t){return t.split("-").reduce(function(e,r){return e+r[0].toUpperCase()+r.slice(1)})}function io(t,e){var r=Math.max(0,e-t.length);return t+Array(r+1).join(" ")}function Yf(t,e){e=e||[];for(var r=0;r<e.length;r++)(e[r]==="--help"||e[r]==="-h")&&(t.outputHelp(),process.exit(0))}function qf(t){var e=t.name+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}function Os(t){try{if(Kf.statSync(t).isFile())return!0}catch{return!1}}});function Qt(t){return t=Array.isArray(t)?t[0]:t,t.image&&!0}function Fs(t,e){return e}function Pe(t){return typeof t=="string"}function At(t){return Number.isFinite(t)}function ve(t){return t==null}function Bt(t,e,r){return ve(t)?"":`${r||""}${t}${e||""}`}function Ms(t,e=!1){return Array.isArray(t)?t.length>0?`(${t.join(", ")})`:e?"()":"":e?`(${t||""})`:t||""}function Us(t,e,r=""){return At(t)&&t>0?new Array(t).fill(e).join(r):""}function co(t){return t&&!ve(t.alias)}function Dr(t){return Pe(t.relationshipName)}function fo(t){return!!t&&!!t.operator&&!!t.right}function po(t){return!!t&&!!t.operator&&!!t.right}function ho(t){return t&&!ve(t.fn)&&Pe(t.operator)&&!ve(t.value)}function Gr(t){return t&&At(t.openParen)&&ve(t.operator)&&ve(t.field)&&ve(t.fn)&&ve(t.closeParen)}function mo(t){return t&&Pe(t.field)&&Pe(t.operator)&&!ve(t.valueQuery)&&ve(t.value)}function go(t){return t&&!ve(t.field)}function Eo(t){return t&&!ve(t.field)}function lp(t){return["IN","NOT IN","INCLUDES","EXCLUDES"].includes(t)}function ks(t,e,r){if(ve(e))return t;if(r&&e!=="APEX_BIND_VARIABLE"&&lp(r)&&!Array.isArray(t)&&(t=[t],e=Array.isArray(e)?e:[e]),Array.isArray(e)&&Array.isArray(t))return t.map((n,i)=>up(n,e?.[i]));switch(Array.isArray(e)&&(e=e[0]),e){case"STRING":return Array.isArray(t)?t.filter(Boolean).map(n=>Pe(n)&&n.startsWith("'")?n:`'${n??""}'`):(t=String(t??""),Pe(t)&&t.startsWith("'")?t:`'${t??""}'`);case"APEX_BIND_VARIABLE":return`:${t}`;default:return t}}function up(t,e){switch(e){case"STRING":return Pe(t)&&t.startsWith("'")?t:`'${t??""}'`;default:return t}}var fp=typeof global=="object"&&global&&global.Object===Object&&global,Cn=fp;var pp=typeof self=="object"&&self&&self.Object===Object&&self,hp=Cn||pp||Function("return this")(),ie=hp;var dp=ie.Symbol,fe=dp;var ws=Object.prototype,mp=ws.hasOwnProperty,gp=ws.toString,Wr=fe?fe.toStringTag:void 0;function Ep(t){var e=mp.call(t,Wr),r=t[Wr];try{t[Wr]=void 0;var n=!0}catch{}var i=gp.call(t);return n&&(e?t[Wr]=r:delete t[Wr]),i}var Bs=Ep;var xp=Object.prototype,Ap=xp.toString;function Tp(t){return Ap.call(t)}var Ds=Tp;var Sp="[object Null]",yp="[object Undefined]",Gs=fe?fe.toStringTag:void 0;function Cp(t){return t==null?t===void 0?yp:Sp:Gs&&Gs in Object(t)?Bs(t):Ds(t)}var xe=Cp;function Lp(t){return t!=null&&typeof t=="object"}var ee=Lp;var Op="[object Symbol]";function Np(t){return typeof t=="symbol"||ee(t)&&xe(t)==Op}var Tt=Np;function Rp(t,e){for(var r=-1,n=t==null?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var Ye=Rp;var _p=Array.isArray,y=_p;var Ip=1/0,Ws=fe?fe.prototype:void 0,$s=Ws?Ws.toString:void 0;function Vs(t){if(typeof t=="string")return t;if(y(t))return Ye(t,Vs)+"";if(Tt(t))return $s?$s.call(t):"";var e=t+"";return e=="0"&&1/t==-Ip?"-0":e}var js=Vs;var bp=/\s/;function vp(t){for(var e=t.length;e--&&bp.test(t.charAt(e)););return e}var Hs=vp;var Pp=/^\s+/;function Fp(t){return t&&t.slice(0,Hs(t)+1).replace(Pp,"")}var Ks=Fp;function Mp(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Y=Mp;var Ys=NaN,Up=/^[-+]0x[0-9a-f]+$/i,kp=/^0b[01]+$/i,wp=/^0o[0-7]+$/i,Bp=parseInt;function Dp(t){if(typeof t=="number")return t;if(Tt(t))return Ys;if(Y(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Y(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Ks(t);var r=kp.test(t);return r||wp.test(t)?Bp(t.slice(2),r?2:8):Up.test(t)?Ys:+t}var qs=Dp;var Xs=1/0,Gp=17976931348623157e292;function Wp(t){if(!t)return t===0?t:0;if(t=qs(t),t===Xs||t===-Xs){var e=t<0?-1:1;return e*Gp}return t===t?t:0}var Qs=Wp;function $p(t){var e=Qs(t),r=e%1;return e===e?r?e-r:e:0}var qe=$p;function Vp(t){return t}var we=Vp;var jp="[object AsyncFunction]",Hp="[object Function]",Kp="[object GeneratorFunction]",Yp="[object Proxy]";function qp(t){if(!Y(t))return!1;var e=xe(t);return e==Hp||e==Kp||e==jp||e==Yp}var Ae=qp;var Xp=ie["__core-js_shared__"],Ln=Xp;var zs=function(){var t=/[^.]+$/.exec(Ln&&Ln.keys&&Ln.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Qp(t){return!!zs&&zs in t}var Zs=Qp;var zp=Function.prototype,Zp=zp.toString;function Jp(t){if(t!=null){try{return Zp.call(t)}catch{}try{return t+""}catch{}}return""}var ut=Jp;var eh=/[\\^$.*+?()[\]{}|]/g,th=/^\[object .+?Constructor\]$/,rh=Function.prototype,nh=Object.prototype,ih=rh.toString,oh=nh.hasOwnProperty,ah=RegExp("^"+ih.call(oh).replace(eh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function sh(t){if(!Y(t)||Zs(t))return!1;var e=Ae(t)?ah:th;return e.test(ut(t))}var Js=sh;function lh(t,e){return t?.[e]}var el=lh;function uh(t,e){var r=el(t,e);return Js(r)?r:void 0}var Oe=uh;var ch=Oe(ie,"WeakMap"),On=ch;var tl=Object.create,fh=function(){function t(){}return function(e){if(!Y(e))return{};if(tl)return tl(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),rl=fh;function ph(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}var nl=ph;function hh(){}var q=hh;function dh(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}var il=dh;var mh=800,gh=16,Eh=Date.now;function xh(t){var e=0,r=0;return function(){var n=Eh(),i=gh-(n-r);if(r=n,i>0){if(++e>=mh)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var ol=xh;function Ah(t){return function(){return t}}var al=Ah;var Th=function(){try{var t=Oe(Object,"defineProperty");return t({},"",{}),t}catch{}}(),zt=Th;var Sh=zt?function(t,e){return zt(t,"toString",{configurable:!0,enumerable:!1,value:al(e),writable:!0})}:we,sl=Sh;var yh=ol(sl),ll=yh;function Ch(t,e){for(var r=-1,n=t==null?0:t.length;++r<n&&e(t[r],r,t)!==!1;);return t}var Nn=Ch;function Lh(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}var Rn=Lh;function Oh(t){return t!==t}var ul=Oh;function Nh(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}var cl=Nh;function Rh(t,e,r){return e===e?cl(t,e,r):Rn(t,ul,r)}var Zt=Rh;function _h(t,e){var r=t==null?0:t.length;return!!r&&Zt(t,e,0)>-1}var _n=_h;var Ih=9007199254740991,bh=/^(?:0|[1-9]\d*)$/;function vh(t,e){var r=typeof t;return e=e??Ih,!!e&&(r=="number"||r!="symbol"&&bh.test(t))&&t>-1&&t%1==0&&t<e}var St=vh;function Ph(t,e,r){e=="__proto__"&&zt?zt(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Jt=Ph;function Fh(t,e){return t===e||t!==t&&e!==e}var Xe=Fh;var Mh=Object.prototype,Uh=Mh.hasOwnProperty;function kh(t,e,r){var n=t[e];(!(Uh.call(t,e)&&Xe(n,r))||r===void 0&&!(e in t))&&Jt(t,e,r)}var yt=kh;function wh(t,e,r,n){var i=!r;r||(r={});for(var o=-1,a=e.length;++o<a;){var s=e[o],l=n?n(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),i?Jt(r,s,l):yt(r,s,l)}return r}var Qe=wh;var fl=Math.max;function Bh(t,e,r){return e=fl(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=fl(n.length-e,0),a=Array(o);++i<o;)a[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=r(a),nl(t,this,s)}}var pl=Bh;function Dh(t,e){return ll(pl(t,e,we),t+"")}var er=Dh;var Gh=9007199254740991;function Wh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Gh}var tr=Wh;function $h(t){return t!=null&&tr(t.length)&&!Ae(t)}var oe=$h;function Vh(t,e,r){if(!Y(r))return!1;var n=typeof e;return(n=="number"?oe(r)&&St(e,r.length):n=="string"&&e in r)?Xe(r[e],t):!1}var Ct=Vh;function jh(t){return er(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,a&&Ct(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var s=r[n];s&&t(e,s,n,o)}return e})}var hl=jh;var Hh=Object.prototype;function Kh(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Hh;return t===r}var ze=Kh;function Yh(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}var dl=Yh;var qh="[object Arguments]";function Xh(t){return ee(t)&&xe(t)==qh}var xo=Xh;var ml=Object.prototype,Qh=ml.hasOwnProperty,zh=ml.propertyIsEnumerable,Zh=xo(function(){return arguments}())?xo:function(t){return ee(t)&&Qh.call(t,"callee")&&!zh.call(t,"callee")},Lt=Zh;function Jh(){return!1}var gl=Jh;var Al=typeof exports=="object"&&exports&&!exports.nodeType&&exports,El=Al&&typeof module=="object"&&module&&!module.nodeType&&module,ed=El&&El.exports===Al,xl=ed?ie.Buffer:void 0,td=xl?xl.isBuffer:void 0,rd=td||gl,ct=rd;var nd="[object Arguments]",id="[object Array]",od="[object Boolean]",ad="[object Date]",sd="[object Error]",ld="[object Function]",ud="[object Map]",cd="[object Number]",fd="[object Object]",pd="[object RegExp]",hd="[object Set]",dd="[object String]",md="[object WeakMap]",gd="[object ArrayBuffer]",Ed="[object DataView]",xd="[object Float32Array]",Ad="[object Float64Array]",Td="[object Int8Array]",Sd="[object Int16Array]",yd="[object Int32Array]",Cd="[object Uint8Array]",Ld="[object Uint8ClampedArray]",Od="[object Uint16Array]",Nd="[object Uint32Array]",V={};V[xd]=V[Ad]=V[Td]=V[Sd]=V[yd]=V[Cd]=V[Ld]=V[Od]=V[Nd]=!0;V[nd]=V[id]=V[gd]=V[od]=V[Ed]=V[ad]=V[sd]=V[ld]=V[ud]=V[cd]=V[fd]=V[pd]=V[hd]=V[dd]=V[md]=!1;function Rd(t){return ee(t)&&tr(t.length)&&!!V[xe(t)]}var Tl=Rd;function _d(t){return function(e){return t(e)}}var Ze=_d;var Sl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$r=Sl&&typeof module=="object"&&module&&!module.nodeType&&module,Id=$r&&$r.exports===Sl,Ao=Id&&Cn.process,bd=function(){try{var t=$r&&$r.require&&$r.require("util").types;return t||Ao&&Ao.binding&&Ao.binding("util")}catch{}}(),Be=bd;var yl=Be&&Be.isTypedArray,vd=yl?Ze(yl):Tl,rr=vd;var Pd=Object.prototype,Fd=Pd.hasOwnProperty;function Md(t,e){var r=y(t),n=!r&&Lt(t),i=!r&&!n&&ct(t),o=!r&&!n&&!i&&rr(t),a=r||n||i||o,s=a?dl(t.length,String):[],l=s.length;for(var c in t)(e||Fd.call(t,c))&&!(a&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||St(c,l)))&&s.push(c);return s}var In=Md;function Ud(t,e){return function(r){return t(e(r))}}var bn=Ud;var kd=bn(Object.keys,Object),Cl=kd;var wd=Object.prototype,Bd=wd.hasOwnProperty;function Dd(t){if(!ze(t))return Cl(t);var e=[];for(var r in Object(t))Bd.call(t,r)&&r!="constructor"&&e.push(r);return e}var vn=Dd;function Gd(t){return oe(t)?In(t):vn(t)}var w=Gd;var Wd=Object.prototype,$d=Wd.hasOwnProperty,Vd=hl(function(t,e){if(ze(e)||oe(e)){Qe(e,w(e),t);return}for(var r in e)$d.call(e,r)&&yt(t,r,e[r])}),he=Vd;function jd(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Ll=jd;var Hd=Object.prototype,Kd=Hd.hasOwnProperty;function Yd(t){if(!Y(t))return Ll(t);var e=ze(t),r=[];for(var n in t)n=="constructor"&&(e||!Kd.call(t,n))||r.push(n);return r}var Ol=Yd;function qd(t){return oe(t)?In(t,!0):Ol(t)}var Ot=qd;var Xd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Qd=/^\w*$/;function zd(t,e){if(y(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Tt(t)?!0:Qd.test(t)||!Xd.test(t)||e!=null&&t in Object(e)}var nr=zd;var Zd=Oe(Object,"create"),ft=Zd;function Jd(){this.__data__=ft?ft(null):{},this.size=0}var Nl=Jd;function em(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Rl=em;var tm="__lodash_hash_undefined__",rm=Object.prototype,nm=rm.hasOwnProperty;function im(t){var e=this.__data__;if(ft){var r=e[t];return r===tm?void 0:r}return nm.call(e,t)?e[t]:void 0}var _l=im;var om=Object.prototype,am=om.hasOwnProperty;function sm(t){var e=this.__data__;return ft?e[t]!==void 0:am.call(e,t)}var Il=sm;var lm="__lodash_hash_undefined__";function um(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ft&&e===void 0?lm:e,this}var bl=um;function ir(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ir.prototype.clear=Nl;ir.prototype.delete=Rl;ir.prototype.get=_l;ir.prototype.has=Il;ir.prototype.set=bl;var To=ir;function cm(){this.__data__=[],this.size=0}var vl=cm;function fm(t,e){for(var r=t.length;r--;)if(Xe(t[r][0],e))return r;return-1}var Nt=fm;var pm=Array.prototype,hm=pm.splice;function dm(t){var e=this.__data__,r=Nt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():hm.call(e,r,1),--this.size,!0}var Pl=dm;function mm(t){var e=this.__data__,r=Nt(e,t);return r<0?void 0:e[r][1]}var Fl=mm;function gm(t){return Nt(this.__data__,t)>-1}var Ml=gm;function Em(t,e){var r=this.__data__,n=Nt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}var Ul=Em;function or(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}or.prototype.clear=vl;or.prototype.delete=Pl;or.prototype.get=Fl;or.prototype.has=Ml;or.prototype.set=Ul;var Rt=or;var xm=Oe(ie,"Map"),_t=xm;function Am(){this.size=0,this.__data__={hash:new To,map:new(_t||Rt),string:new To}}var kl=Am;function Tm(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var wl=Tm;function Sm(t,e){var r=t.__data__;return wl(e)?r[typeof e=="string"?"string":"hash"]:r.map}var It=Sm;function ym(t){var e=It(this,t).delete(t);return this.size-=e?1:0,e}var Bl=ym;function Cm(t){return It(this,t).get(t)}var Dl=Cm;function Lm(t){return It(this,t).has(t)}var Gl=Lm;function Om(t,e){var r=It(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}var Wl=Om;function ar(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ar.prototype.clear=kl;ar.prototype.delete=Bl;ar.prototype.get=Dl;ar.prototype.has=Gl;ar.prototype.set=Wl;var Dt=ar;var Nm="Expected a function";function So(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Nm);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=t.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(So.Cache||Dt),r}So.Cache=Dt;var $l=So;var Rm=500;function _m(t){var e=$l(t,function(n){return r.size===Rm&&r.clear(),n}),r=e.cache;return e}var Vl=_m;var Im=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bm=/\\(\\)?/g,vm=Vl(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Im,function(r,n,i,o){e.push(i?o.replace(bm,"$1"):n||r)}),e}),jl=vm;function Pm(t){return t==null?"":js(t)}var Hl=Pm;function Fm(t,e){return y(t)?t:nr(t,e)?[t]:jl(Hl(t))}var bt=Fm;var Mm=1/0;function Um(t){if(typeof t=="string"||Tt(t))return t;var e=t+"";return e=="0"&&1/t==-Mm?"-0":e}var Je=Um;function km(t,e){e=bt(e,t);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Je(e[r++])];return r&&r==n?t:void 0}var sr=km;function wm(t,e,r){var n=t==null?void 0:sr(t,e);return n===void 0?r:n}var Kl=wm;function Bm(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}var lr=Bm;var Yl=fe?fe.isConcatSpreadable:void 0;function Dm(t){return y(t)||Lt(t)||!!(Yl&&t&&t[Yl])}var ql=Dm;function Xl(t,e,r,n,i){var o=-1,a=t.length;for(r||(r=ql),i||(i=[]);++o<a;){var s=t[o];e>0&&r(s)?e>1?Xl(s,e-1,r,n,i):lr(i,s):n||(i[i.length]=s)}return i}var ur=Xl;function Gm(t){var e=t==null?0:t.length;return e?ur(t,1):[]}var le=Gm;var Wm=bn(Object.getPrototypeOf,Object),Pn=Wm;function $m(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}var Fn=$m;function Vm(t,e,r,n){var i=-1,o=t==null?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}var Ql=Vm;function jm(){this.__data__=new Rt,this.size=0}var zl=jm;function Hm(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}var Zl=Hm;function Km(t){return this.__data__.get(t)}var Jl=Km;function Ym(t){return this.__data__.has(t)}var eu=Ym;var qm=200;function Xm(t,e){var r=this.__data__;if(r instanceof Rt){var n=r.__data__;if(!_t||n.length<qm-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Dt(n)}return r.set(t,e),this.size=r.size,this}var tu=Xm;function cr(t){var e=this.__data__=new Rt(t);this.size=e.size}cr.prototype.clear=zl;cr.prototype.delete=Zl;cr.prototype.get=Jl;cr.prototype.has=eu;cr.prototype.set=tu;var vt=cr;function Qm(t,e){return t&&Qe(e,w(e),t)}var ru=Qm;function zm(t,e){return t&&Qe(e,Ot(e),t)}var nu=zm;var su=typeof exports=="object"&&exports&&!exports.nodeType&&exports,iu=su&&typeof module=="object"&&module&&!module.nodeType&&module,Zm=iu&&iu.exports===su,ou=Zm?ie.Buffer:void 0,au=ou?ou.allocUnsafe:void 0;function Jm(t,e){if(e)return t.slice();var r=t.length,n=au?au(r):new t.constructor(r);return t.copy(n),n}var lu=Jm;function eg(t,e){for(var r=-1,n=t==null?0:t.length,i=0,o=[];++r<n;){var a=t[r];e(a,r,t)&&(o[i++]=a)}return o}var fr=eg;function tg(){return[]}var Mn=tg;var rg=Object.prototype,ng=rg.propertyIsEnumerable,uu=Object.getOwnPropertySymbols,ig=uu?function(t){return t==null?[]:(t=Object(t),fr(uu(t),function(e){return ng.call(t,e)}))}:Mn,pr=ig;function og(t,e){return Qe(t,pr(t),e)}var cu=og;var ag=Object.getOwnPropertySymbols,sg=ag?function(t){for(var e=[];t;)lr(e,pr(t)),t=Pn(t);return e}:Mn,Un=sg;function lg(t,e){return Qe(t,Un(t),e)}var fu=lg;function ug(t,e,r){var n=e(t);return y(t)?n:lr(n,r(t))}var kn=ug;function cg(t){return kn(t,w,pr)}var Vr=cg;function fg(t){return kn(t,Ot,Un)}var wn=fg;var pg=Oe(ie,"DataView"),Bn=pg;var hg=Oe(ie,"Promise"),Dn=hg;var dg=Oe(ie,"Set"),Pt=dg;var pu="[object Map]",mg="[object Object]",hu="[object Promise]",du="[object Set]",mu="[object WeakMap]",gu="[object DataView]",gg=ut(Bn),Eg=ut(_t),xg=ut(Dn),Ag=ut(Pt),Tg=ut(On),Gt=xe;(Bn&&Gt(new Bn(new ArrayBuffer(1)))!=gu||_t&&Gt(new _t)!=pu||Dn&&Gt(Dn.resolve())!=hu||Pt&&Gt(new Pt)!=du||On&&Gt(new On)!=mu)&&(Gt=function(t){var e=xe(t),r=e==mg?t.constructor:void 0,n=r?ut(r):"";if(n)switch(n){case gg:return gu;case Eg:return pu;case xg:return hu;case Ag:return du;case Tg:return mu}return e});var $e=Gt;var Sg=Object.prototype,yg=Sg.hasOwnProperty;function Cg(t){var e=t.length,r=new t.constructor(e);return e&&typeof t[0]=="string"&&yg.call(t,"index")&&(r.index=t.index,r.input=t.input),r}var Eu=Cg;var Lg=ie.Uint8Array,hr=Lg;function Og(t){var e=new t.constructor(t.byteLength);return new hr(e).set(new hr(t)),e}var dr=Og;function Ng(t,e){var r=e?dr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}var xu=Ng;var Rg=/\w*$/;function _g(t){var e=new t.constructor(t.source,Rg.exec(t));return e.lastIndex=t.lastIndex,e}var Au=_g;var Tu=fe?fe.prototype:void 0,Su=Tu?Tu.valueOf:void 0;function Ig(t){return Su?Object(Su.call(t)):{}}var yu=Ig;function bg(t,e){var r=e?dr(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}var Cu=bg;var vg="[object Boolean]",Pg="[object Date]",Fg="[object Map]",Mg="[object Number]",Ug="[object RegExp]",kg="[object Set]",wg="[object String]",Bg="[object Symbol]",Dg="[object ArrayBuffer]",Gg="[object DataView]",Wg="[object Float32Array]",$g="[object Float64Array]",Vg="[object Int8Array]",jg="[object Int16Array]",Hg="[object Int32Array]",Kg="[object Uint8Array]",Yg="[object Uint8ClampedArray]",qg="[object Uint16Array]",Xg="[object Uint32Array]";function Qg(t,e,r){var n=t.constructor;switch(e){case Dg:return dr(t);case vg:case Pg:return new n(+t);case Gg:return xu(t,r);case Wg:case $g:case Vg:case jg:case Hg:case Kg:case Yg:case qg:case Xg:return Cu(t,r);case Fg:return new n;case Mg:case wg:return new n(t);case Ug:return Au(t);case kg:return new n;case Bg:return yu(t)}}var Lu=Qg;function zg(t){return typeof t.constructor=="function"&&!ze(t)?rl(Pn(t)):{}}var Ou=zg;var Zg="[object Map]";function Jg(t){return ee(t)&&$e(t)==Zg}var Nu=Jg;var Ru=Be&&Be.isMap,eE=Ru?Ze(Ru):Nu,_u=eE;var tE="[object Set]";function rE(t){return ee(t)&&$e(t)==tE}var Iu=rE;var bu=Be&&Be.isSet,nE=bu?Ze(bu):Iu,vu=nE;var iE=1,oE=2,aE=4,Pu="[object Arguments]",sE="[object Array]",lE="[object Boolean]",uE="[object Date]",cE="[object Error]",Fu="[object Function]",fE="[object GeneratorFunction]",pE="[object Map]",hE="[object Number]",Mu="[object Object]",dE="[object RegExp]",mE="[object Set]",gE="[object String]",EE="[object Symbol]",xE="[object WeakMap]",AE="[object ArrayBuffer]",TE="[object DataView]",SE="[object Float32Array]",yE="[object Float64Array]",CE="[object Int8Array]",LE="[object Int16Array]",OE="[object Int32Array]",NE="[object Uint8Array]",RE="[object Uint8ClampedArray]",_E="[object Uint16Array]",IE="[object Uint32Array]",B={};B[Pu]=B[sE]=B[AE]=B[TE]=B[lE]=B[uE]=B[SE]=B[yE]=B[CE]=B[LE]=B[OE]=B[pE]=B[hE]=B[Mu]=B[dE]=B[mE]=B[gE]=B[EE]=B[NE]=B[RE]=B[_E]=B[IE]=!0;B[cE]=B[Fu]=B[xE]=!1;function Gn(t,e,r,n,i,o){var a,s=e&iE,l=e&oE,c=e&aE;if(r&&(a=i?r(t,n,i,o):r(t)),a!==void 0)return a;if(!Y(t))return t;var p=y(t);if(p){if(a=Eu(t),!s)return il(t,a)}else{var h=$e(t),d=h==Fu||h==fE;if(ct(t))return lu(t,s);if(h==Mu||h==Pu||d&&!i){if(a=l||d?{}:Ou(t),!s)return l?fu(t,nu(a,t)):cu(t,ru(a,t))}else{if(!B[h])return i?t:{};a=Lu(t,h,s)}}o||(o=new vt);var A=o.get(t);if(A)return A;o.set(t,a),vu(t)?t.forEach(function(N){a.add(Gn(N,e,r,N,t,o))}):_u(t)&&t.forEach(function(N,S){a.set(S,Gn(N,e,r,S,t,o))});var C=c?l?wn:Vr:l?Ot:w,L=p?void 0:C(t);return Nn(L||t,function(N,S){L&&(S=N,N=t[S]),yt(a,S,Gn(N,e,r,S,t,o))}),a}var Uu=Gn;var bE=4;function vE(t){return Uu(t,bE)}var D=vE;function PE(t){for(var e=-1,r=t==null?0:t.length,n=0,i=[];++e<r;){var o=t[e];o&&(i[n++]=o)}return i}var et=PE;var FE="__lodash_hash_undefined__";function ME(t){return this.__data__.set(t,FE),this}var ku=ME;function UE(t){return this.__data__.has(t)}var wu=UE;function Wn(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new Dt;++e<r;)this.add(t[e])}Wn.prototype.add=Wn.prototype.push=ku;Wn.prototype.has=wu;var mr=Wn;function kE(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var $n=kE;function wE(t,e){return t.has(e)}var gr=wE;var BE=1,DE=2;function GE(t,e,r,n,i,o){var a=r&BE,s=t.length,l=e.length;if(s!=l&&!(a&&l>s))return!1;var c=o.get(t),p=o.get(e);if(c&&p)return c==e&&p==t;var h=-1,d=!0,A=r&DE?new mr:void 0;for(o.set(t,e),o.set(e,t);++h<s;){var C=t[h],L=e[h];if(n)var N=a?n(L,C,h,e,t,o):n(C,L,h,t,e,o);if(N!==void 0){if(N)continue;d=!1;break}if(A){if(!$n(e,function(S,E){if(!gr(A,E)&&(C===S||i(C,S,r,n,o)))return A.push(E)})){d=!1;break}}else if(!(C===L||i(C,L,r,n,o))){d=!1;break}}return o.delete(t),o.delete(e),d}var Vn=GE;function WE(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}var Bu=WE;function $E(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Er=$E;var VE=1,jE=2,HE="[object Boolean]",KE="[object Date]",YE="[object Error]",qE="[object Map]",XE="[object Number]",QE="[object RegExp]",zE="[object Set]",ZE="[object String]",JE="[object Symbol]",ex="[object ArrayBuffer]",tx="[object DataView]",Du=fe?fe.prototype:void 0,yo=Du?Du.valueOf:void 0;function rx(t,e,r,n,i,o,a){switch(r){case tx:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ex:return!(t.byteLength!=e.byteLength||!o(new hr(t),new hr(e)));case HE:case KE:case XE:return Xe(+t,+e);case YE:return t.name==e.name&&t.message==e.message;case QE:case ZE:return t==e+"";case qE:var s=Bu;case zE:var l=n&VE;if(s||(s=Er),t.size!=e.size&&!l)return!1;var c=a.get(t);if(c)return c==e;n|=jE,a.set(t,e);var p=Vn(s(t),s(e),n,i,o,a);return a.delete(t),p;case JE:if(yo)return yo.call(t)==yo.call(e)}return!1}var Gu=rx;var nx=1,ix=Object.prototype,ox=ix.hasOwnProperty;function ax(t,e,r,n,i,o){var a=r&nx,s=Vr(t),l=s.length,c=Vr(e),p=c.length;if(l!=p&&!a)return!1;for(var h=l;h--;){var d=s[h];if(!(a?d in e:ox.call(e,d)))return!1}var A=o.get(t),C=o.get(e);if(A&&C)return A==e&&C==t;var L=!0;o.set(t,e),o.set(e,t);for(var N=a;++h<l;){d=s[h];var S=t[d],E=e[d];if(n)var m=a?n(E,S,d,e,t,o):n(S,E,d,t,e,o);if(!(m===void 0?S===E||i(S,E,r,n,o):m)){L=!1;break}N||(N=d=="constructor")}if(L&&!N){var _=t.constructor,I=e.constructor;_!=I&&"constructor"in t&&"constructor"in e&&!(typeof _=="function"&&_ instanceof _&&typeof I=="function"&&I instanceof I)&&(L=!1)}return o.delete(t),o.delete(e),L}var Wu=ax;var sx=1,$u="[object Arguments]",Vu="[object Array]",jn="[object Object]",lx=Object.prototype,ju=lx.hasOwnProperty;function ux(t,e,r,n,i,o){var a=y(t),s=y(e),l=a?Vu:$e(t),c=s?Vu:$e(e);l=l==$u?jn:l,c=c==$u?jn:c;var p=l==jn,h=c==jn,d=l==c;if(d&&ct(t)){if(!ct(e))return!1;a=!0,p=!1}if(d&&!p)return o||(o=new vt),a||rr(t)?Vn(t,e,r,n,i,o):Gu(t,e,l,r,n,i,o);if(!(r&sx)){var A=p&&ju.call(t,"__wrapped__"),C=h&&ju.call(e,"__wrapped__");if(A||C){var L=A?t.value():t,N=C?e.value():e;return o||(o=new vt),i(L,N,r,n,o)}}return d?(o||(o=new vt),Wu(t,e,r,n,i,o)):!1}var Hu=ux;function Ku(t,e,r,n,i){return t===e?!0:t==null||e==null||!ee(t)&&!ee(e)?t!==t&&e!==e:Hu(t,e,r,n,Ku,i)}var Hn=Ku;var cx=1,fx=2;function px(t,e,r,n){var i=r.length,o=i,a=!n;if(t==null)return!o;for(t=Object(t);i--;){var s=r[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){s=r[i];var l=s[0],c=t[l],p=s[1];if(a&&s[2]){if(c===void 0&&!(l in t))return!1}else{var h=new vt;if(n)var d=n(c,p,l,t,e,h);if(!(d===void 0?Hn(p,c,cx|fx,n,h):d))return!1}}return!0}var Yu=px;function hx(t){return t===t&&!Y(t)}var Kn=hx;function dx(t){for(var e=w(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Kn(i)]}return e}var qu=dx;function mx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}var Yn=mx;function gx(t){var e=qu(t);return e.length==1&&e[0][2]?Yn(e[0][0],e[0][1]):function(r){return r===t||Yu(r,t,e)}}var Xu=gx;function Ex(t,e){return t!=null&&e in Object(t)}var Qu=Ex;function xx(t,e,r){e=bt(e,t);for(var n=-1,i=e.length,o=!1;++n<i;){var a=Je(e[n]);if(!(o=t!=null&&r(t,a)))break;t=t[a]}return o||++n!=i?o:(i=t==null?0:t.length,!!i&&tr(i)&&St(a,i)&&(y(t)||Lt(t)))}var qn=xx;function Ax(t,e){return t!=null&&qn(t,e,Qu)}var zu=Ax;var Tx=1,Sx=2;function yx(t,e){return nr(t)&&Kn(e)?Yn(Je(t),e):function(r){var n=Kl(r,t);return n===void 0&&n===e?zu(r,t):Hn(e,n,Tx|Sx)}}var Zu=yx;function Cx(t){return function(e){return e?.[t]}}var Ju=Cx;function Lx(t){return function(e){return sr(e,t)}}var ec=Lx;function Ox(t){return nr(t)?Ju(Je(t)):ec(t)}var tc=Ox;function Nx(t){return typeof t=="function"?t:t==null?we:typeof t=="object"?y(t)?Zu(t[0],t[1]):Xu(t):tc(t)}var ae=Nx;function Rx(t,e,r,n){for(var i=-1,o=t==null?0:t.length;++i<o;){var a=t[i];e(n,a,r(a),t)}return n}var rc=Rx;function _x(t){return function(e,r,n){for(var i=-1,o=Object(e),a=n(e),s=a.length;s--;){var l=a[t?s:++i];if(r(o[l],l,o)===!1)break}return e}}var nc=_x;var Ix=nc(),ic=Ix;function bx(t,e){return t&&ic(t,e,w)}var oc=bx;function vx(t,e){return function(r,n){if(r==null)return r;if(!oe(r))return t(r,n);for(var i=r.length,o=e?i:-1,a=Object(r);(e?o--:++o<i)&&n(a[o],o,a)!==!1;);return r}}var ac=vx;var Px=ac(oc),Ne=Px;function Fx(t,e,r,n){return Ne(t,function(i,o,a){e(n,i,r(i),a)}),n}var sc=Fx;function Mx(t,e){return function(r,n){var i=y(r)?rc:sc,o=e?e():{};return i(r,t,ae(n,2),o)}}var lc=Mx;var uc=Object.prototype,Ux=uc.hasOwnProperty,kx=er(function(t,e){t=Object(t);var r=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&Ct(e[0],e[1],i)&&(n=1);++r<n;)for(var o=e[r],a=Ot(o),s=-1,l=a.length;++s<l;){var c=a[s],p=t[c];(p===void 0||Xe(p,uc[c])&&!Ux.call(t,c))&&(t[c]=o[c])}return t}),xr=kx;function wx(t){return ee(t)&&oe(t)}var Co=wx;function Bx(t,e,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}var Xn=Bx;var Dx=200;function Gx(t,e,r,n){var i=-1,o=_n,a=!0,s=t.length,l=[],c=e.length;if(!s)return l;r&&(e=Ye(e,Ze(r))),n?(o=Xn,a=!1):e.length>=Dx&&(o=gr,a=!1,e=new mr(e));e:for(;++i<s;){var p=t[i],h=r==null?p:r(p);if(p=n||p!==0?p:0,a&&h===h){for(var d=c;d--;)if(e[d]===h)continue e;l.push(p)}else o(e,h,n)||l.push(p)}return l}var cc=Gx;var Wx=er(function(t,e){return Co(t)?cc(t,ur(e,1,Co,!0)):[]}),Ft=Wx;function $x(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var tt=$x;function Vx(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:qe(e),Fn(t,e<0?0:e,n)):[]}var te=Vx;function jx(t,e,r){var n=t==null?0:t.length;return n?(e=r||e===void 0?1:qe(e),e=n-e,Fn(t,0,e<0?0:e)):[]}var pt=jx;function Hx(t){return typeof t=="function"?t:we}var fc=Hx;function Kx(t,e){var r=y(t)?Nn:Ne;return r(t,fc(e))}var x=Kx;function Yx(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}var pc=Yx;function qx(t,e){var r=!0;return Ne(t,function(n,i,o){return r=!!e(n,i,o),r}),r}var hc=qx;function Xx(t,e,r){var n=y(t)?pc:hc;return r&&Ct(t,e,r)&&(e=void 0),n(t,ae(e,3))}var me=Xx;function Qx(t,e){var r=[];return Ne(t,function(n,i,o){e(n,i,o)&&r.push(n)}),r}var Qn=Qx;function zx(t,e){var r=y(t)?fr:Qn;return r(t,ae(e,3))}var ge=zx;function Zx(t){return function(e,r,n){var i=Object(e);if(!oe(e)){var o=ae(r,3);e=w(e),r=function(s){return o(i[s],s,i)}}var a=t(e,r,n);return a>-1?i[o?e[a]:a]:void 0}}var dc=Zx;var Jx=Math.max;function eA(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:qe(r);return i<0&&(i=Jx(n+i,0)),Rn(t,ae(e,3),i)}var mc=eA;var tA=dc(mc),rt=tA;function rA(t){return t&&t.length?t[0]:void 0}var pe=rA;function nA(t,e){var r=-1,n=oe(t)?Array(t.length):[];return Ne(t,function(i,o,a){n[++r]=e(i,o,a)}),n}var gc=nA;function iA(t,e){var r=y(t)?Ye:gc;return r(t,ae(e,3))}var g=iA;function oA(t,e){return ur(g(t,e),1)}var Te=oA;var aA=Object.prototype,sA=aA.hasOwnProperty,lA=lc(function(t,e,r){sA.call(t,r)?t[r].push(e):Jt(t,r,[e])}),Lo=lA;var uA=Object.prototype,cA=uA.hasOwnProperty;function fA(t,e){return t!=null&&cA.call(t,e)}var Ec=fA;function pA(t,e){return t!=null&&qn(t,e,Ec)}var T=pA;var hA="[object String]";function dA(t){return typeof t=="string"||!y(t)&&ee(t)&&xe(t)==hA}var ue=dA;function mA(t,e){return Ye(e,function(r){return t[r]})}var xc=mA;function gA(t){return t==null?[]:xc(t,w(t))}var U=gA;var EA=Math.max;function xA(t,e,r,n){t=oe(t)?t:U(t),r=r&&!n?qe(r):0;var i=t.length;return r<0&&(r=EA(i+r,0)),ue(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Zt(t,e,r)>-1}var H=xA;var AA=Math.max;function TA(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var i=r==null?0:qe(r);return i<0&&(i=AA(n+i,0)),Zt(t,e,i)}var zn=TA;var SA="[object Map]",yA="[object Set]",CA=Object.prototype,LA=CA.hasOwnProperty;function OA(t){if(t==null)return!0;if(oe(t)&&(y(t)||typeof t=="string"||typeof t.splice=="function"||ct(t)||rr(t)||Lt(t)))return!t.length;var e=$e(t);if(e==SA||e==yA)return!t.size;if(ze(t))return!vn(t).length;for(var r in t)if(LA.call(t,r))return!1;return!0}var v=OA;var NA="[object RegExp]";function RA(t){return ee(t)&&xe(t)==NA}var Ac=RA;var Tc=Be&&Be.isRegExp,_A=Tc?Ze(Tc):Ac,De=_A;function IA(t){return t===void 0}var Ee=IA;var bA="Expected a function";function vA(t){if(typeof t!="function")throw new TypeError(bA);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}var Sc=vA;function PA(t,e,r,n){if(!Y(t))return t;e=bt(e,t);for(var i=-1,o=e.length,a=o-1,s=t;s!=null&&++i<o;){var l=Je(e[i]),c=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(i!=a){var p=s[l];c=n?n(p,l,s):void 0,c===void 0&&(c=Y(p)?p:St(e[i+1])?[]:{})}yt(s,l,c),s=s[l]}return t}var yc=PA;function FA(t,e,r){for(var n=-1,i=e.length,o={};++n<i;){var a=e[n],s=sr(t,a);r(s,a)&&yc(o,bt(a,t),s)}return o}var Cc=FA;function MA(t,e){if(t==null)return{};var r=Ye(wn(t),function(n){return[n]});return e=ae(e),Cc(t,r,function(n,i){return e(n,i[0])})}var Re=MA;function UA(t,e,r,n,i){return i(t,function(o,a,s){r=n?(n=!1,o):e(r,o,a,s)}),r}var Lc=UA;function kA(t,e,r){var n=y(t)?Ql:Lc,i=arguments.length<3;return n(t,ae(e,4),r,i,Ne)}var se=kA;function wA(t,e){var r=y(t)?fr:Qn;return r(t,Sc(ae(e,3)))}var Mt=wA;function BA(t,e){var r;return Ne(t,function(n,i,o){return r=e(n,i,o),!r}),!!r}var Oc=BA;function DA(t,e,r){var n=y(t)?$n:Oc;return r&&Ct(t,e,r)&&(e=void 0),n(t,ae(e,3))}var jr=DA;var GA=1/0,WA=Pt&&1/Er(new Pt([,-0]))[1]==GA?function(t){return new Pt(t)}:q,Nc=WA;var $A=200;function VA(t,e,r){var n=-1,i=_n,o=t.length,a=!0,s=[],l=s;if(r)a=!1,i=Xn;else if(o>=$A){var c=e?null:Nc(t);if(c)return Er(c);a=!1,i=gr,l=new mr}else l=e?[]:s;e:for(;++n<o;){var p=t[n],h=e?e(p):p;if(p=r||p!==0?p:0,a&&h===h){for(var d=l.length;d--;)if(l[d]===h)continue e;e&&l.push(h),s.push(p)}else i(l,h,r)||(l!==s&&l.push(h),s.push(p))}return s}var Rc=VA;function jA(t){return t&&t.length?Rc(t):[]}var Ar=jA;function Tr(t){console&&console.error&&console.error(`Error: ${t}`)}function Hr(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function Kr(t){let e=new Date().getTime(),r=t();return{time:new Date().getTime()-e,value:r}}function Yr(t){function e(){}e.prototype=t;let r=new e;function n(){return typeof r.bar}return n(),n(),t;(0,eval)(t)}function HA(t){return KA(t)?t.LABEL:t.name}function KA(t){return ue(t.LABEL)&&t.LABEL!==""}var Fe=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),x(this.definition,r=>{r.accept(e)})}},G=class extends Fe{constructor(e){super([]),this.idx=1,he(this,Re(e,r=>r!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}},Se=class extends Fe{constructor(e){super(e.definition),this.orgText="",he(this,Re(e,r=>r!==void 0))}},W=class extends Fe{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,he(this,Re(e,r=>r!==void 0))}},j=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},re=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},ne=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},M=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},Z=class extends Fe{constructor(e){super(e.definition),this.idx=1,he(this,Re(e,r=>r!==void 0))}},J=class extends Fe{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,he(this,Re(e,r=>r!==void 0))}},F=class{constructor(e){this.idx=1,he(this,Re(e,r=>r!==void 0))}accept(e){e.visit(this)}};function Zn(t){return g(t,Sr)}function Sr(t){function e(r){return g(r,Sr)}if(t instanceof G){let r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ue(t.label)&&(r.label=t.label),r}else{if(t instanceof W)return{type:"Alternative",definition:e(t.definition)};if(t instanceof j)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof re)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof ne)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Sr(new F({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Z)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Sr(new F({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof M)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof J)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof F){let r={type:"Terminal",name:t.terminalType.name,label:HA(t.terminalType),idx:t.idx};ue(t.label)&&(r.terminalLabel=t.label);let n=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(r.pattern=De(n)?n.source:n),r}else{if(t instanceof Se)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}}}var ye=class{visit(e){let r=e;switch(r.constructor){case G:return this.visitNonTerminal(r);case W:return this.visitAlternative(r);case j:return this.visitOption(r);case re:return this.visitRepetitionMandatory(r);case ne:return this.visitRepetitionMandatoryWithSeparator(r);case Z:return this.visitRepetitionWithSeparator(r);case M:return this.visitRepetition(r);case J:return this.visitAlternation(r);case F:return this.visitTerminal(r);case Se:return this.visitRule(r);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function Oo(t){return t instanceof W||t instanceof j||t instanceof M||t instanceof re||t instanceof ne||t instanceof Z||t instanceof F||t instanceof Se}function Wt(t,e=[]){return t instanceof j||t instanceof M||t instanceof Z?!0:t instanceof J?jr(t.definition,n=>Wt(n,e)):t instanceof G&&H(e,t)?!1:t instanceof Fe?(t instanceof G&&e.push(t),me(t.definition,n=>Wt(n,e))):!1}function No(t){return t instanceof J}function _e(t){if(t instanceof G)return"SUBRULE";if(t instanceof j)return"OPTION";if(t instanceof J)return"OR";if(t instanceof re)return"AT_LEAST_ONE";if(t instanceof ne)return"AT_LEAST_ONE_SEP";if(t instanceof Z)return"MANY_SEP";if(t instanceof M)return"MANY";if(t instanceof F)return"CONSUME";throw Error("non exhaustive match")}var ht=class{walk(e,r=[]){x(e.definition,(n,i)=>{let o=te(e.definition,i+1);if(n instanceof G)this.walkProdRef(n,o,r);else if(n instanceof F)this.walkTerminal(n,o,r);else if(n instanceof W)this.walkFlat(n,o,r);else if(n instanceof j)this.walkOption(n,o,r);else if(n instanceof re)this.walkAtLeastOne(n,o,r);else if(n instanceof ne)this.walkAtLeastOneSep(n,o,r);else if(n instanceof Z)this.walkManySep(n,o,r);else if(n instanceof M)this.walkMany(n,o,r);else if(n instanceof J)this.walkOr(n,o,r);else throw Error("non exhaustive match")})}walkTerminal(e,r,n){}walkProdRef(e,r,n){}walkFlat(e,r,n){let i=r.concat(n);this.walk(e,i)}walkOption(e,r,n){let i=r.concat(n);this.walk(e,i)}walkAtLeastOne(e,r,n){let i=[new j({definition:e.definition})].concat(r,n);this.walk(e,i)}walkAtLeastOneSep(e,r,n){let i=_c(e,r,n);this.walk(e,i)}walkMany(e,r,n){let i=[new j({definition:e.definition})].concat(r,n);this.walk(e,i)}walkManySep(e,r,n){let i=_c(e,r,n);this.walk(e,i)}walkOr(e,r,n){let i=r.concat(n);x(e.definition,o=>{let a=new W({definition:[o]});this.walk(a,i)})}};function _c(t,e,r){return[new j({definition:[new F({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}function $t(t){if(t instanceof G)return $t(t.referencedRule);if(t instanceof F)return XA(t);if(Oo(t))return YA(t);if(No(t))return qA(t);throw Error("non exhaustive match")}function YA(t){let e=[],r=t.definition,n=0,i=r.length>n,o,a=!0;for(;i&&a;)o=r[n],a=Wt(o),e=e.concat($t(o)),n=n+1,i=r.length>n;return Ar(e)}function qA(t){let e=g(t.definition,r=>$t(r));return Ar(le(e))}function XA(t){return[t.terminalType]}var Jn="_~IN~_";var Ro=class extends ht{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,r,n){}walkProdRef(e,r,n){let i=QA(e.referencedRule,e.idx)+this.topProd.name,o=r.concat(n),a=new W({definition:o}),s=$t(a);this.follows[i]=s}};function Ic(t){let e={};return x(t,r=>{let n=new Ro(r).startWalking();he(e,n)}),e}function QA(t,e){return t.name+e+Jn}function O(t){return t.charCodeAt(0)}function ei(t,e){Array.isArray(t)?t.forEach(function(r){e.push(r)}):e.push(t)}function yr(t,e){if(t[e]===!0)throw"duplicate flag "+e;let r=t[e];t[e]=!0}function Vt(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function qr(){throw Error("Internal Error - Should never get here!")}function _o(t){return t.type==="Character"}var Xr=[];for(let t=O("0");t<=O("9");t++)Xr.push(t);var Qr=[O("_")].concat(Xr);for(let t=O("a")