formula
Version:
Formula compiler and function library
1 lines • 128 kB
JavaScript
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=global||self,factory(global.Formula={}))})(this,function(exports){"use strict";var funcs=Object.freeze({__proto__:null,get ERROR(){return _error},get ERRORTYPES(){return ERRORTYPES},get PARSE(){return parse},get parse(){return parse},get WALKER(){return walker},get WALKERCONFIGDEFAULT(){return defaultConfig},get WALKERCONFIGFP(){return fpConfig},get WALKERCONFIGJS(){return jsConfig},get COMPILE(){return compile},get compile(){return compile},get RUN(){return run},get run(){return run},get BRANCH(){return branch},get IF(){return branch},get IFS(){return branch},get branch(){return branch},get ifs(){return branch},get if(){return branch},get CHOOSE(){return choose},get choose(){return choose},get SWITCH(){return SWITCH},get switch(){return SWITCH},get AND(){return and},get and(){return and},get NAND(){return nand},get nand(){return nand},get OR(){return or},get or(){return or},get NOR(){return nor},get nor(){return nor},get XOR(){return xor},get xor(){return xor},get NOT(){return not},get not(){return not},get EQ(){return eq},get eq(){return eq},get NE(){return ne},get ne(){return ne},get GT(){return gt},get gt(){return gt},get GTE(){return gte},get gte(){return gte},get LT(){return lt},get lt(){return lt},get LTE(){return lte},get lte(){return lte},get IDENTITY(){return identity},get identity(){return identity},get IFBLANK(){return ifblank},get ifBlank(){return ifblank},get ifblank(){return ifblank},get IFEMPTY(){return ifempty},get ifEmpty(){return ifempty},get ifempty(){return ifempty},get IFERROR(){return iferror},get ifError(){return iferror},get iferror(){return iferror},get IFNA(){return ifna},get ifNA(){return ifna},get ifna(){return ifna},get ISARRAY(){return isarray},get isArray(){return isarray},get isarray(){return isarray},get ISASYNCFUNCTION(){return isasyncfunction},get isAsyncFunction(){return isasyncfunction},get isasyncfunction(){return isasyncfunction},get ISBLANK(){return isblank},get isBlank(){return isblank},get isblank(){return isblank},get ISBOOLEAN(){return isboolean},get isBoolean(){return isboolean},get isboolean(){return isboolean},get ISDATE(){return isdate},get isDate(){return isdate},get isdate(){return isdate},get ISEMAIL(){return isemail},get isEmail(){return isemail},get isemail(){return isemail},get ISEMPTY(){return isempty},get isEmpty(){return isempty},get isempty(){return isempty},get ISERROR(){return iserror},get isError(){return iserror},get iserror(){return iserror},get ISEVEN(){return iseven},get isEven(){return iseven},get iseven(){return iseven},get ISFALSY(){return isfalsy},get isFalsy(){return isfalsy},get isfalsy(){return isfalsy},get ISFUNCTION(){return isfunction},get isFunction(){return isfunction},get isfunction(){return isfunction},get ISLEAPYEAR(){return isleapyear},get isLeapYear(){return isleapyear},get isleapyear(){return isleapyear},get ISLOWERCASE(){return islowercase},get isLowerCase(){return islowercase},get islowercase(){return islowercase},get ISOBJECT(){return isobject},get isObject(){return isobject},get ISNA(){return isna},get isNA(){return isna},get isna(){return isna},get ISNAN(){return isnan},get isNaN(){return isnan},get isnan(){return isnan},get ISNUMBER(){return isnumber},get isNumber(){return isnumber},get isnumber(){return isnumber},get ISODD(){return isodd},get isOdd(){return isodd},get isodd(){return isodd},get ISOWEEKNUM(){return isoweeknum},get ISOWeekNum(){return isoweeknum},get isoweeknum(){return isoweeknum},get ISPROMISE(){return ispromise},get isPromise(){return ispromise},get ispromise(){return ispromise},get ISREF(){return isref},get isRef(){return isref},get isref(){return isref},get ISTEXT(){return istext},get isText(){return istext},get ISTRUTHY(){return istruthy},get isTruthy(){return istruthy},get istruthy(){return istruthy},get ISUPPERCASE(){return isuppercase},get isUpperCase(){return isuppercase},get isuppercase(){return isuppercase},get ISURL(){return isurl},get isURL(){return isurl},get isurl(){return isurl},get ISWHOLENUMBER(){return iswholenumber},get isWholeNumber(){return iswholenumber},get iswholenumber(){return iswholenumber},get MINUS(){return minus},get minus(){return minus},get PLUS(){return plus},get plus(){return plus},get ADD(){return add},get add(){return add},get SUBTRACT(){return subtract},get subtract(){return subtract},get MULTIPLY(){return multiply},get multiply(){return multiply},get DIVIDE(){return divide},get divide(){return divide},get ABS(){return abs},get abs(){return abs},get ACOS(){return acos},get acos(){return acos},get ACOSH(){return acosh},get acosh(){return acosh},get ACOT(){return acot},get acot(){return acot},get ACOTH(){return acoth},get acoth(){return acoth},get ASIN(){return asin},get asin(){return asin},get ASINH(){return asinh},get asinh(){return asinh},get ATAN(){return atan},get atan(){return atan},get ATAN2(){return atan2},get atan2(){return atan2},get ATANH(){return atan$1},get atanh(){return atan$1},get COS(){return cos},get cos(){return cos},get DEGREES(){return degrees},get degrees(){return degrees},get MOD(){return mod},get mod(){return mod},get PI(){return pi},get pi(){return pi},get POWER(){return power},get power(){return power},get ROUND(){return round},get round(){return round},get ROUNDUP(){return roundup},get roundUp(){return roundup},get roundup(){return roundup},get SIN(){return sin},get sin(){return sin},get TAN(){return tan},get tan(){return tan},get TAU(){return tau},get tau(){return tau},get TRUNC(){return trunc},get trunc(){return trunc},get WITHIN(){return within},get withIn(){return within},get within(){return within},get CHAR(){return char},get char(){return char},get CAMELCASE(){return camelcase},get camelCase(){return camelcase},get camelcase(){return camelcase},get CODE(){return code},get code(){return code},get CONCATENATE(){return concatenate},get concatenate(){return concatenate},get EXACT(){return exact},get exact(){return exact},get FIND(){return find},get find(){return find},get JOIN(){return join},get join(){return join},get LEFT(){return left},get left(){return left},get LEN(){return len},get len(){return len},get LOWER(){return lower},get lower(){return lower},get NUMBERVALUE(){return numbervalue},get numberValue(){return numbervalue},get numbervalue(){return numbervalue},get PARSEBOOL(){return parsebool},get parseBool(){return parsebool},get parsebool(){return parsebool},get PARSEDATE(){return parsedate},get parseDate(){return parsedate},get parsedate(){return parsedate},get PARSEQUERY(){return parsequery},get parseQuery(){return parsequery},get parsequery(){return parsequery},get PROPER(){return proper},get proper(){return proper},get REPLACE(){return replace},get replace(){return replace},get RIGHT(){return right},get right(){return right},get REPT(){return rept},get rept(){return rept},get SEARCH(){return search},get search(){return search},get SNAKECASE(){return snakecase},get snakeCase(){return snakecase},get snakecase(){return snakecase},get SUBSTITUTE(){return substitute},get substitute(){return substitute},get SUBSTITUTEALL(){return substituteAll},get substituteAll(){return substituteAll},get substituteall(){return substituteAll},get SURROUNDKEYS(){return surroundKeys},get surroundKeys(){return surroundKeys},get surroundkeys(){return surroundKeys},get SPLIT(){return split},get split(){return split},get TEXT(){return text},get text(){return text},get TRIM(){return trim},get trim(){return trim},get UPPER(){return upper},get upper(){return upper},get HLOOKUP(){return hlookup},get hlookup(){return hlookup},get INCLUDES(){return includes},get includes(){return includes},get NOTINCLUDES(){return notincludes},get notIncludes(){return notincludes},get notincludes(){return notincludes},get INDEX(){return index},get index(){return index},get LOOKUP(){return lookup},get lookup(){return lookup},get MATCH(){return match},get match(){return match},get VLOOKUP(){return vlookup},get vlookup(){return vlookup},get DATE(){return date},get date(){return date},get DATEVALUE(){return datevalue},get datevalue(){return datevalue},get DATEDIF(){return datedif},get datedif(){return datedif},get DAY(){return day},get day(){return day},get DAYS360(){return days360},get days360(){return days360},get EDATE(){return edate},get edate(){return edate},get EOMONTH(){return eomonth},get eomonth(){return eomonth},get HOUR(){return hour},get hour(){return hour},get MINUTE(){return minute},get minute(){return minute},get MONTH(){return month},get month(){return month},get NOW(){return now},get now(){return now},get SECOND(){return second},get second(){return second},get TODAY(){return today},get today(){return today},get TIME(){return time},get time(){return time},get TIMEVALUE(){return timevalue},get timevalue(){return timevalue},get YEAR(){return year},get year(){return year},get YEARFRAC(){return yearfrac},get yearfrac(){return yearfrac},get AVERAGE(){return average},get average(){return average},get MIN(){return min},get min(){return min},get MAX(){return max},get max(){return max},get QUERY(){return query},get query(){return query},get SUM(){return sum},get sum(){return sum},get ACCRINT(){return accrint},get accrint(){return accrint},get FV(){return fv},get fv(){return fv},get NPER(){return nper},get nper(){return nper},get NPV(){return npv},get npv(){return npv},get PMT(){return pmt},get pmt(){return pmt},get CUMIPMT(){return cumipmt},get cumipmt(){return cumipmt},get IPMT(){return ipmt},get ipmt(){return ipmt},get PV(){return pv},get pv(){return pv},get BIN2DEC(){return bin2dec},get bin2dec(){return bin2dec},get DEC2BIN(){return dec2bin},get dec2bin(){return dec2bin},get OCT2DEC(){return oct2dec},get oct2dec(){return oct2dec},get FILTER(){return filter},get filter(){return filter},get FLATTEN(){return flatten},get flatten(){return flatten},get MAP(){return map},get map(){return map},get PLUCK(){return pluck},get pluck(){return pluck},get REDUCE(){return reduce},get reduce(){return reduce},get SOME(){return some},get some(){return some},get SORT(){return sort},get sort(){return sort},get UNFLATTEN(){return unflatten},get unFlatten(){return unflatten},get unflatten(){return unflatten},get UNIQUE(){return unique},get unique(){return unique},get CHANGED(){return changed},get changed(){return changed},get DIFF(){return diff},get diff(){return diff},get CLEAN(){return clean},get clean(){return clean},get GET(){return get},get get(){return get},get SELECT(){return select},get select(){return select},get KEYS(){return keys},get keys(){return keys},get ADDRESS(){return address},get address(){return address},get ASSIGN(){return assign$1},get assign(){return assign$1},get BASE(){return base},get base(){return base},get CELLINDEX(){return cellindex},get cellIndex(){return cellindex},get cellindex(){return cellindex},get CEILING(){return ceiling},get ceiling(){return ceiling},get COLUMN(){return column},get column(){return column},get COLUMNLETTER(){return columnletter},get columnLetter(){return columnletter},get columnletter(){return columnletter},get COLUMNNUMBER(){return columnnumber},get columnNumber(){return columnnumber},get columnnumber(){return columnnumber},get DECODEBASE64(){return decodebase64},get decodeBase64(){return decodebase64},get decodebase64(){return decodebase64},get DECODEJWT(){return decodejwt},get decodeJWT(){return decodejwt},get decodejwt(){return decodejwt},get ENTRIES(){return entries},get entries(){return entries},get EVEN(){return even},get even(){return even},get FLOOR(){return floor},get floor(){return floor},get GROUP(){return group},get group(){return group},get GUID(){return guid},get guid(){return guid},get HASH(){return hash},get hash(){return hash},get INT(){return int},get int(){return int},get INDEX2COL(){return index2col},get index2Col(){return index2col},get index2col(){return index2col},get INDEX2ROW(){return index2row},get index2Row(){return index2row},get index2row(){return index2row},get INTERSECT(){return intersect},get intersect(){return intersect},get INTERPOLATE(){return interpolate},get interpolate(){return interpolate},get INTERPOLATOR(){return interpolator},get interpolator(){return interpolator},get N(){return n},get n(){return n},get NUMBERS(){return numbers},get numbers(){return numbers},get OVERLAP(){return overlap},get overlap(){return overlap},get REF(){return ref$1},get ref(){return ref$1},get SERIAL(){return serial},get serial(){return serial}});function FormulaError(name,message){this.name=name||"NotImplementedError";this.message=message||""}FormulaError.prototype=Error.prototype;FormulaError.prototype.toString=function(){return this.name};var nil=new FormulaError("#NULL!","Null reference"),div0=new FormulaError("#DIV/0!","Divide by zero"),value=new FormulaError("#VALUE!","Invalid value"),ref=new FormulaError("#REF!","Invalid reference"),name=new FormulaError("#NAME?","Invalid name"),num=new FormulaError("#NUM!","Invalid number"),na=new FormulaError("#N/A!","Not applicable"),error$1=new FormulaError("#ERROR!","Error"),data=new FormulaError("#GETTING_DATA!","Error getting data"),missing=new FormulaError("#MISSING!","Missing"),unknown=new FormulaError("#UNKNOWN!","Unknown error");var ERRORTYPES={nil:nil,"#NULL!":nil,div0:div0,"#DIV/0!":div0,value:value,"#VALUE!":value,ref:ref,"#REF!":ref,name:name,"#NAME?":name,num:num,"#NUM!":num,na:na,"#N/A!":na,error:error$1,"#ERROR!":error$1,data:data,"#GETTING_DATA!":data,missing:missing,"#MISSING!":missing,unknown:unknown,"#UNKNOWN!":unknown};function _error(type){return ERRORTYPES[type]||error$1}var parser=function(){var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v){}return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,8],$V5=[1,11],$V6=[1,12],$V7=[1,13],$V8=[1,14],$V9=[1,15],$Va=[1,16],$Vb=[1,24],$Vc=[1,18],$Vd=[1,19],$Ve=[1,20],$Vf=[1,21],$Vg=[1,22],$Vh=[1,23],$Vi=[1,25],$Vj=[1,26],$Vk=[1,27],$Vl=[1,28],$Vm=[1,29],$Vn=[1,30],$Vo=[5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,32,33,36],$Vp=[5,6,7,8,12,13,14,15,16,17,19,32,33,36],$Vq=[1,58],$Vr=[1,59],$Vs=[19,32,33,36],$Vt=[5,6,7,8,9,10,12,13,14,15,16,17,19,32,33,36],$Vu=[5,6,12,13,14,15,16,19,32,33,36];var parser={trace:function trace(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,"=":6,"+":7,"-":8,"*":9,"/":10,"^":11,"<>":12,">":13,"<":14,">=":15,"<=":16,"&":17,"(":18,")":19,":":20,IDENT:21,SCOPE:22,func:23,array_literal:24,TRUE:25,FALSE:26,STRING:27,NUMBER:28,"%":29,range:30,param_list:31,",":32,";":33,FUNC:34,"{":35,"}":36,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"=",7:"+",8:"-",9:"*",10:"/",11:"^",12:"<>",13:">",14:"<",15:">=",16:"<=",17:"&",18:"(",19:")",20:":",21:"IDENT",22:"SCOPE",25:"TRUE",26:"FALSE",27:"STRING",28:"NUMBER",29:"%",32:",",33:";",34:"FUNC",35:"{",36:"}"},productions_:[0,[3,2],[3,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,3],[4,2],[4,3],[4,3],[4,1],[4,2],[4,1],[4,1],[4,1],[4,1],[4,1],[4,2],[4,1],[30,3],[31,1],[31,3],[31,3],[23,4],[23,3],[24,3]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:case 2:return $$[$0-1];case 3:this.$={type:"operator",subtype:"infix-add",operands:[$$[$0-2],$$[$0]]};break;case 4:this.$={type:"operator",subtype:"infix-subtract",operands:[$$[$0-2],$$[$0]]};break;case 5:this.$={type:"operator",subtype:"infix-multiply",operands:[$$[$0-2],$$[$0]]};break;case 6:this.$={type:"operator",subtype:"infix-divide",operands:[$$[$0-2],$$[$0]]};break;case 7:this.$={type:"operator",subtype:"infix-power",operands:[$$[$0-2],$$[$0]]};break;case 8:this.$={type:"operator",subtype:"infix-ne",operands:[$$[$0-2],$$[$0]]};break;case 9:this.$={type:"operator",subtype:"infix-eq",operands:[$$[$0-2],$$[$0]]};break;case 10:this.$={type:"operator",subtype:"infix-gt",operands:[$$[$0-2],$$[$0]]};break;case 11:this.$={type:"operator",subtype:"infix-lt",operands:[$$[$0-2],$$[$0]]};break;case 12:this.$={type:"operator",subtype:"infix-gte",operands:[$$[$0-2],$$[$0]]};break;case 13:this.$={type:"operator",subtype:"infix-lte",operands:[$$[$0-2],$$[$0]]};break;case 14:this.$={type:"operator",subtype:"prefix-plus",operands:[$$[$0]]};break;case 15:this.$={type:"operator",subtype:"infix-concat",operands:[$$[$0-2],$$[$0]]};break;case 16:this.$={type:"operator",subtype:"prefix-minus",operands:[$$[$0]]};break;case 17:this.$={type:"group",exp:$$[$0-1]};break;case 18:this.$={type:"range",subtype:"local",topLeft:$$[$0-2],bottomRight:$$[$0]};break;case 19:this.$={type:"variable",name:$$[$0]};break;case 20:this.$={type:"variable",scope:$$[$0-1],name:$$[$0]};break;case 21:case 22:this.$=$$[$0];break;case 23:this.$={type:"value",subtype:"boolean",value:true};break;case 24:this.$={type:"value",subtype:"boolean",value:false};break;case 25:this.$={type:"value",subtype:"string",value:String(yytext)};break;case 26:this.$={type:"value",subtype:"number",value:$$[$0-1]/100};break;case 27:this.$={type:"value",subtype:"number",value:Number(yytext)};break;case 29:this.$=[$$[$0]];break;case 30:this.$=$$[$0-2].concat([$$[$0]]);break;case 31:this.$=$$[$0][0].subtype!=="array"?[{type:"value",subtype:"array",items:$$[$0-2]},{type:"value",subtype:"array",items:$$[$0]}]:[{type:"value",subtype:"array",items:$$[$0-2]}].concat($$[$0]);break;case 32:this.$={type:"function",name:$$[$0-3],args:$$[$0-1]};break;case 33:this.$={type:"function",name:$$[$0-2],args:[]};break;case 34:this.$={type:"value",subtype:"array",items:$$[$0-1]};break}},table:[{3:1,4:2,6:[1,3],7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{1:[3]},{5:[1,17],6:$Vb,7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,12:$Vh,13:$Vi,14:$Vj,15:$Vk,16:$Vl,17:$Vm,20:$Vn},{4:31,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:32,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:33,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:34,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},o($Vo,[2,19]),{21:[1,35]},o($Vo,[2,21]),o($Vo,[2,22]),o($Vo,[2,23]),o($Vo,[2,24]),o($Vo,[2,25]),o($Vo,[2,27],{29:[1,36]}),{18:[1,37]},{4:39,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,31:38,34:$V9,35:$Va},{1:[2,1]},{4:40,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:41,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:42,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:43,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:44,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:45,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:46,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:47,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:48,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:49,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:50,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:51,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:52,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{5:[1,53],6:$Vb,7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,12:$Vh,13:$Vi,14:$Vj,15:$Vk,16:$Vl,17:$Vm,20:$Vn},o($Vp,[2,14],{9:$Ve,10:$Vf,11:$Vg,20:$Vn}),o($Vp,[2,16],{9:$Ve,10:$Vf,11:$Vg,20:$Vn}),{6:$Vb,7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,12:$Vh,13:$Vi,14:$Vj,15:$Vk,16:$Vl,17:$Vm,19:[1,54],20:$Vn},o($Vo,[2,20]),o($Vo,[2,26]),{4:39,7:$V0,8:$V1,18:$V2,19:[1,56],21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,31:55,34:$V9,35:$Va},{32:$Vq,33:$Vr,36:[1,57]},o($Vs,[2,29],{6:$Vb,7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,12:$Vh,13:$Vi,14:$Vj,15:$Vk,16:$Vl,17:$Vm,20:$Vn}),o($Vp,[2,3],{9:$Ve,10:$Vf,11:$Vg,20:$Vn}),o($Vp,[2,4],{9:$Ve,10:$Vf,11:$Vg,20:$Vn}),o($Vt,[2,5],{11:$Vg,20:$Vn}),o($Vt,[2,6],{11:$Vg,20:$Vn}),o([5,6,7,8,9,10,11,12,13,14,15,16,17,19,32,33,36],[2,7],{20:$Vn}),o($Vu,[2,8],{7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,17:$Vm,20:$Vn}),o($Vu,[2,9],{7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,17:$Vm,20:$Vn}),o($Vu,[2,10],{7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,17:$Vm,20:$Vn}),o($Vu,[2,11],{7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,17:$Vm,20:$Vn}),o($Vu,[2,12],{7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,17:$Vm,20:$Vn}),o($Vu,[2,13],{7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,17:$Vm,20:$Vn}),o([5,6,12,13,14,15,16,17,19,32,33,36],[2,15],{7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,20:$Vn}),o($Vo,[2,18]),{1:[2,2]},o($Vo,[2,17]),{19:[1,60],32:$Vq,33:$Vr},o($Vo,[2,33]),o($Vo,[2,34]),{4:61,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,34:$V9,35:$Va},{4:39,7:$V0,8:$V1,18:$V2,21:$V3,22:$V4,23:9,24:10,25:$V5,26:$V6,27:$V7,28:$V8,31:62,34:$V9,35:$Va},o($Vo,[2,32]),o($Vs,[2,30],{6:$Vb,7:$Vc,8:$Vd,9:$Ve,10:$Vf,11:$Vg,12:$Vh,13:$Vi,14:$Vj,15:$Vk,16:$Vl,17:$Vm,20:$Vn}),o([19,36],[2,31],{32:$Vq,33:$Vr})],defaultActions:{17:[2,1],53:[2,2]},parseError:function parseError(str,hash){if(hash.recoverable){this.trace(str)}else{var error=new Error(str);error.hash=hash;throw error}},parse:function parse(input){var self=this,stack=[0],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,TERROR=2,EOF=1;var args=lstack.slice.call(arguments,1);var lexer=Object.create(this.lexer);var sharedState={yy:{}};for(var k in this.yy){if(Object.prototype.hasOwnProperty.call(this.yy,k)){sharedState.yy[k]=this.yy[k]}}lexer.setInput(input,sharedState.yy);sharedState.yy.lexer=lexer;sharedState.yy.parser=this;if(typeof lexer.yylloc=="undefined"){lexer.yylloc={}}var yyloc=lexer.yylloc;lstack.push(yyloc);var ranges=lexer.options&&lexer.options.ranges;if(typeof sharedState.yy.parseError==="function"){this.parseError=sharedState.yy.parseError}else{this.parseError=Object.getPrototypeOf(this).parseError}var lex=function(){var token;token=lexer.lex()||EOF;if(typeof token!=="number"){token=self.symbols_[token]||token}return token};var symbol,state,action,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state]}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex()}action=table[state]&&table[state][symbol]}if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";expected=[];for(p in table[state]){if(this.terminals_[p]&&p>TERROR){expected.push("'"+this.terminals_[p]+"'")}}if(lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'"}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==EOF?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'")}this.parseError(errStr,{text:lexer.match,token:this.terminals_[symbol]||symbol,line:lexer.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol)}switch(action[0]){case 1:stack.push(symbol);vstack.push(lexer.yytext);lstack.push(lexer.yylloc);stack.push(action[1]);symbol=null;{yyleng=lexer.yyleng;yytext=lexer.yytext;yylineno=lexer.yylineno;yyloc=lexer.yylloc}break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]}r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args));if(typeof r!=="undefined"){return r}if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len)}stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true}}return true}};var lexer=function(){var lexer={EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash)}else{throw new Error(str)}},setInput:function(input,yy){this.yy=yy||this.yy||{};this._input=input;this._more=this._backtrack=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges){this.yylloc.range=[0,0]}this.offset=0;return this},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges){this.yylloc.range[1]++}this._input=this._input.slice(1);return ch},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len);this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(lines.length-1){this.yylineno-=lines.length-1}var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len]}this.yyleng=this.yytext.length;return this},more:function(){this._more=true;return this},reject:function(){if(this.options.backtrack_lexer){this._backtrack=true}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}return this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length)}return(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},test_match:function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer){backup={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done};if(this.options.ranges){backup.yylloc.range=this.yylloc.range.slice(0)}}lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno+=lines.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._backtrack=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input){this.done=false}if(token){return token}else if(this._backtrack){for(var k in backup){this[k]=backup[k]}return false}return false},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var token,match,tempMatch,index;if(!this._more){this.yytext="";this.match=""}var rules=this._currentRules();for(var i=0;i<rules.length;i++){tempMatch=this._input.match(this.rules[rules[i]]);if(tempMatch&&(!match||tempMatch[0].length>match[0].length)){match=tempMatch;index=i;if(this.options.backtrack_lexer){token=this.test_match(tempMatch,rules[i]);if(token!==false){return token}else if(this._backtrack){match=false;continue}else{return false}}else if(!this.options.flex){break}}}if(match){token=this.test_match(match,rules[index]);if(token!==false){return token}return false}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function lex(){var r=this.next();if(r){return r}else{return this.lex()}},begin:function begin(condition){this.conditionStack.push(condition)},popState:function popState(){var n=this.conditionStack.length-1;if(n>0){return this.conditionStack.pop()}else{return this.conditionStack[0]}},_currentRules:function _currentRules(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules}else{return this.conditions["INITIAL"].rules}},topState:function topState(n){n=this.conditionStack.length-1-Math.abs(n||0);if(n>=0){return this.conditionStack[n]}else{return"INITIAL"}},pushState:function pushState(condition){this.begin(condition)},stateStackSize:function stateStackSize(){return this.conditionStack.length},options:{},performAction:function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:break;case 1:return 28;case 2:return 25;case 3:return 26;case 4:return 25;case 5:return 26;case 6:return 25;case 7:return 26;case 8:return 9;case 9:return 10;case 10:return 8;case 11:return 7;case 12:return 17;case 13:return 11;case 14:return 18;case 15:return 19;case 16:return">=";case 17:return"<=";case 18:return"<>";case 19:return"=";case 20:return">";case 21:return"<";case 22:return"{";case 23:return"}";case 24:return"!";case 25:return",";case 26:return":";case 27:return";";case 28:return"%";case 29:return 34;case 30:return 34;case 31:yy_.yytext=yy_.yytext.substr(1,yy_.yyleng-2).replace(/\"\"/g,'"');return"STRING";case 32:yy_.yytext=yy_.yytext.substr(2,yy_.yyleng-3).replace(/\"\"/g,'"');return"SCOPE";case 33:yy_.yytext=yy_.yytext.substr(1,yy_.yyleng-3).replace(/\"\"/g,'"');return"SCOPE";case 34:yy_.yytext=yy_.yytext.slice(0,-1);return"SCOPE";case 35:yy_.yytext=yy_.yytext.slice(1,-1);return"SCOPE";case 36:return 21;case 37:return 5;case 38:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]+(\.[0-9]+)?\b)/,/^(?:TRUE\b)/,/^(?:FALSE\b)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:True\b)/,/^(?:False\b)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:&)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:>=)/,/^(?:<=)/,/^(?:<>)/,/^(?:=)/,/^(?:>)/,/^(?:<)/,/^(?:\{)/,/^(?:\})/,/^(?:!)/,/^(?:,)/,/^(?::)/,/^(?:;)/,/^(?:%)/,/^(?:[A-Za-z](?=[(]))/,/^(?:[A-Za-z][A-Za-z0-9\.]+(?=[(]))/,/^(?:"(?:""|[^"])*")/,/^(?:\$'(?:''|[^'])*'!)/,/^(?:'(?:''|[^'])*'!)/,/^(?:[a-zA-Z]([a-zA-Z0-9_.$]+)?!)/,/^(?:\$([a-zA-Z])([a-zA-Z0-9_.$]+)?!)/,/^(?:([\[\]a-zA-Z0-9_.$^@\(]+))/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],inclusive:true}}};return lexer}();parser.lexer=lexer;function Parser(){this.yy={}}Parser.prototype=parser;parser.Parser=Parser;return new Parser}();function parse(){return parser.parse.apply(parser,arguments)}function reduce(arr,func){var rest=[],len=arguments.length-2;while(len-- >0)rest[len]=arguments[len+2];return arr.reduce.apply(arr,[func].concat(rest))}function iserror(){var values=[],len=arguments.length;while(len--)values[len]=arguments[len];return reduce(values,function(p,v){return p===true?true:v instanceof Error},false)}function isasyncfunction(value){return value&&Object.prototype.toString.call(value)=="[object AsyncFunction]"}function isfunction(value){return value&&Object.prototype.toString.call(value)=="[object Function]"||isasyncfunction(value)}function and(){var criteria=[],len=arguments.length;while(len--)criteria[len]=arguments[len];return reduce(criteria,function(acc,item){if(iserror(acc)){return acc}if(acc===0||acc===false){return false}var val=isfunction(item)?item():item;if(!(val===true||val===false||val===1||val===0)){return ERRORTYPES.value}return val===true||val===1},undefined)}function isnan(value){if(Number.isNaN){return Number.isNaN(value)}return typeof value==="number"&&isNaN(value)}function isfalsy(value){return value===false||value===0||value===""||typeof value==="undefined"||value===null||isnan(value)}function istruthy(value){return!isfalsy(value)}function branch(){var cases=[],len=arguments.length;while(len--)cases[len]=arguments[len];var resolved=false;return reduce(cases,function(acc,item,index){var val;if(resolved===true){return acc}if(index===cases.length-1){if(index%2===1){return}return isfunction(item)?item():item}if(index%2===0&&(isfunction(item)&&istruthy(item())||!isfunction(item)&&istruthy(item))){resolved=true;val=cases[index+1];return isfunction(val)?val():val}return acc},undefined)}function istext(value){return"string"===typeof value}function isblank(value){return typeof value==="undefined"||value===null}function isarray(value){return Object.prototype.toString.call(value)==="[object Array]"}function eq(a,b){if(typeof a==="string"&&typeof b==="string"){return a.toLowerCase()===b.toLowerCase()}else{return a===b}}function some(needle,list){if(isblank(needle)&&isblank(list)){return ERRORTYPES.na}if(!isarray(list)){return ERRORTYPES.na}return list.some(function(n){return eq(n,needle)})}function assign(target,varArgs){var arguments$1=arguments;if(target==null){return ERRORTYPES.nil}var to=Object(target);for(var index=1;index<arguments.length;index++){var nextSource=arguments$1[index];if(nextSource!=null){for(var nextKey in nextSource){if(Object.prototype.hasOwnProperty.call(nextSource,nextKey)){to[nextKey]=nextSource[nextKey]}}}}return to}function assign$1(initial){var list=[],len=arguments.length-1;while(len-- >0)list[len]=arguments[len+1];var func=Object.assign||assign;return func.apply(void 0,[{},initial].concat(list))}var defaultConfig={upCase:true,visit:function(){return undefined},labelEQ:"=",labelNE:"<>",labelGT:">",labelGTE:">=",labelLT:"<",labelLTE:"<=",renderMINUS:function(){return"-"},renderPLUS:function(){return"+"},renderEQ:function(){return" = "},renderNE:function(){return" <> "},renderGT:function(){return" > "},renderGTE:function(){return" >= "},renderLT:function(){return" < "},renderLTE:function(){return" <= "},renderADD:function(){return" + "},renderSUBTRACT:function(){return" - "},renderMULTIPLY:function(){return" * "},renderDIVIDE:function(){return" / "},renderPOWER:function(){return" ^ "},renderCONCAT:function(){return" & "},renderGroupBegin:function(){return"("},renderGroupEnd:function(){return")"},renderGroup:function(config,g,depth){return""+config.renderGroupBegin(config,g,depth)+walk(config,g.exp,depth+1)+config.renderGroupEnd(config,g,depth)},renderFunctionBegin:function(config,f,depth){return config.upCase?f.name.toUpperCase():f.name},renderFunctionEnd:function(config,f,depth){return")"},renderFunction:function(config,f,depth){return config.renderFunctionBegin(config,f,depth)+"("+f.args.map(function(d){return walk(config,d,depth+1)}).join(", ")+config.renderFunctionEnd(config,f,depth)},renderOperator:function(config,ref,depth){var subtype=ref.subtype;var operands=ref.operands;return branch(operands.length==1,function(){return""+branch(subtype=="prefix-minus",config.renderMINUS(config,depth),subtype=="prefix-plus",config.renderPLUS(config,depth))+walk(config,operands[0],depth+1)},operands.length===2,function(){return""+walk(config,operands[0],depth+1)+branch(subtype=="infix-eq",config.renderEQ(config,{operands:operands},depth),subtype=="infix-ne",config.renderNE(config,{operands:operands},depth),subtype=="infix-gt",config.renderGT(config,{operands:operands},depth),subtype=="infix-gte",config.renderGTE(config,{operands:operands},depth),subtype=="infix-lt",config.renderLT(config,{operands:operands},depth),subtype=="infix-lte",config.renderLTE(config,{operands:operands},depth),subtype=="infix-add",config.renderADD(config,{operands:operands},depth),subtype=="infix-subtract",config.renderSUBTRACT(config,{operands:operands},depth),subtype=="infix-multiply",config.renderMULTIPLY(config,{operands:operands},depth),subtype=="infix-divide",config.renderDIVIDE(config,{operands:operands},depth),subtype=="infix-power",config.renderPOWER(config,{operands:operands},depth),subtype=="infix-concat",config.renderCONCAT(config,{operands:operands},depth))+walk(config,operands[1],depth+1)})},renderRangeBetween:function(){return":"},renderRange:function(config,ref,depth){var topLeft=ref.topLeft;var bottomRight=ref.bottomRight;return""+walk(config,topLeft,depth)+config.renderRangeBetween(config,{topLeft:topLeft,bottomRight:bottomRight},depth)+walk(config,bottomRight,depth)},renderVariable:function(config,ref,depth){var scope=ref.scope;var name=ref.name;return""+(scope?scope+"!":"")+name},renderString:function(value){return'"'+value.replace(/\"/g,'""')+'"'},renderNumber:function(value){return value.toString()},renderBoolean:function(value){return value?"TRUE":"FALSE"},renderValue:function(config,ref,depth){var subtype=ref.subtype;var items=ref.items;var value=ref.value;return branch(subtype==="string",function(){return config.renderString(value)},subtype==="number",function(){return config.renderNumber(value)},subtype==="boolean",function(){return config.renderBoolean(value)},subtype==="array",function(){return""+config.renderArray(config,{items:items},depth)})},renderArray:function(config,ref,depth){var items=ref.items;return"{"+items.map(function(d){return config.renderValue(config,d,depth+1)}).join(",")+"}"},renderRule:function(config,ast,depth){if(depth===void 0)depth=0;var type=ast.type;var renderGroup=config.renderGroup;var renderFunction=config.renderFunction;var renderOperator=config.renderOperator;var renderVariable=config.renderVariable;var renderValue=config.renderValue;config.visit(config,ast,depth);config.walk=walk;return branch(type==="group",function(){return renderGroup(config,ast,depth)},type==="function",function(){return renderFunction(config,ast,depth)},type==="operator",function(){return renderOperator(config,ast,depth)},type==="variable",function(){return renderVariable(config,ast,depth)},type==="value",function(){return renderValue(config,ast,config,depth)},type==="range",function(){return renderRange(config,ast,config,depth)})}};function runFunc(name,config,ref,depth){var operands=ref.operands;var subtype=ref.subtype;return name+"("+walk(config,operands[0],depth+1)+", "+walk(config,operands[1],depth+1)+")"}var fpConfig=assign$1(defaultConfig,{renderOperator:function(config,ref,depth){var subtype=ref.subtype;var operands=ref.operands;return branch(subtype=="prefix-minus","MINUS("+walk(config,operands[0],depth+1)+")",subtype=="prefix-plus","PLUS("+walk(config,operands[0],depth+1)+")",subtype=="infix-eq",runFunc("EQ",config,{operands:operands,subtype:subtype},depth),subtype=="infix-ne",runFunc("NE",config,{operands:operands,subtype:subtype},depth),subtype=="infix-gt",runFunc("GT",config,{operands:operands,subtype:subtype},depth),subtype=="infix-gte",runFunc("GTE",config,{operands:operands,subtype:subtype},depth),subtype=="infix-lt",runFunc("LT",config,{operands:operands,subtype:subtype},depth),subtype=="infix-lte",runFunc("LTE",config,{operands:operands,subtype:subtype},depth),subtype=="infix-add",runFunc("ADD",config,{operands:operands,subtype:subtype},depth),subtype=="infix-subtract",runFunc("SUBTRACT",config,{operands:operands,subtype:subtype},depth),subtype=="infix-multiply",runFunc("MULTIPLY",config,{operands:operands,subtype:subtype},depth),subtype=="infix-divide",runFunc("DIVIDE",config,{operands:operands,subtype:subtype},depth),subtype=="infix-power",runFunc("POWER",config,{operands:operands,subtype:subtype},depth),subtype=="infix-concat",runFunc("CONCATENATE",config,{operands:operands,subtype:subtype},depth))}});var jsConfig=assign$1(fpConfig,{renderVariable:function(config,v,depth){return v.scope?'context.get("'+v.name+'", "'+v.scope+'")':'context.get("'+v.name+'")'},renderFunctionBegin:function(config,f){return"Formula."+fpConfig.renderFunctionBegin(config,f)},renderArray:function(config,items,depth){return"["+items.map(function(d){return config.walk(config,d,depth+1)})+"]"},renderValue:function(config,ref,depth){var subtype=ref.subtype;var items=ref.items;var value=ref.value;return branch(subtype==="string",function(){return'"'+value.replace(/\"/g,'\\"')+'"'},subtype==="number",function(){return""+value},subtype==="boolean",function(){return value?"true":"false"},subtype==="array",function(){return config.renderArray(config,items,depth)})}});function walk(config,astOrExp,depth){if(depth===void 0)depth=0;var ast=astOrExp;if(!ast){return}if(istext(astOrExp)){ast=parse(astOrExp)}return config.renderRule(config,ast,depth)}var walker=function(config){if(config===void 0)config=defaultConfig;return function(ast){return walk(config,ast)}};function map(array,func){return array.map(func)}function unique(array){return reduce(array,function(p,c){if(p.indexOf(c)<0){p.push(c)}return p},[])}var compiledNumber=0;function compile(exp){var ast=exp,f,precedents=[],requires=[];if(typeof ast==="string"){ast=parse(exp)}var walk1=walker(fpConfig);var walk2=walker(assign$1(jsConfig,{visit:function(config,node,depth){if(node.type==="variable"){precedents.push(node)}if(node.type==="function"){requires.push(node.name)}}}));var fpExp=walk1(ast);var code=walk2(fpExp);var id=compiledNumber++;precedents=unique(precedents.map(JSON.stringify)).map(JSON.parse);requires=unique(requires.map(JSON.stringify)).map(JSON.parse);f=new Function("context","Formula","/* formula: "+exp+" */\nreturn "+code+";\n//# sourceURL=formula_"+id+"\n");f.id=id;f.exp=exp;f.exp=fpExp;f.exp=exp;f.ast=ast;f.code=code;f.precedents=precedents;f.requires=requires;return f}function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(obj){return typeof obj}}else{_typeof=function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass){_setPrototypeOf(subClass,superClass)}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct){return false}if(Reflect.construct.sham){return false}if(typeof Proxy==="function"){return true}try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor;if(Class){_setPrototypeOf(instance,Class.prototype)}return instance}}return _construct.apply(null,arguments)}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1}function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map:undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class)){return Class}if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof _cache!=="undefined"){if(_cache.has(Class)){return _cache.get(Class)}_cache.set(Class,Wrapper)}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor)}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class)};return _wrapNativeSuper(Class)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _possibleConstructorReturn(self,call){if(call&&(typeof call==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return _possibleConstructorReturn(this,result)}}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr)){return _arrayLikeToArray(arr)}}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null){return Array.from(iter)}}function _unsupportedIterableToArray(o,minLen){if(!o){return}if(typeof o==="string"){return _arrayLikeToArray(o,minLen)}var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor){n=o.constructor.name}if(n==="Map"||n==="Set"){return Array.from(o)}if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)){return _arrayLikeToArray(o,minLen)}}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length){len=arr.length}for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i]}return arr2}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it){o=it}var i=0;var F=function(){};return{s:F,n:function(){if(i>=o.length){return{done:true}}return{done:false,value:o[i++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function(){it=it.call(o)},n:function(){var step=it.next();normalCompletion=step.done;return step},e:function(e){didErr=true;err=e},f:function(){try{if(!normalCompletion&&it.return!=null){it.return()}}finally{if(didErr){throw err}}}}}var hasOwnProp=Object.prototype.hasOwnProperty;function push(arr,item){arr=arr.slice();arr.push(item);return arr}function unshift(item,arr){arr=arr.slice();arr.unshift(item);return arr}var NewError=function(_Error){_inherits(NewError,_Error);var _super=_createSuper(NewError);function NewError(value){var _this;_classCallCheck(this,NewError);_this=_super.call(this,'JSONPath should not be called with "new" (it prevents return '+"of (unwrapped) scalar values)");_this.avoidNew=true;_this.value=value;_this.name="NewError";return _this}return NewError}(_wrapNativeSuper(Error));function JSONPath(opts,expr,obj,callback,otherTypeCallback){if(!(this instanceof JSONPath)){try{return new JSONPath(opts,expr,obj,callback,otherTypeCallback)}catch(e){if(!e.avoidNew){throw e}return e.value}}if(typeof opts==="string"){otherTypeCallback=callback;callback=obj;obj=expr;expr=opts;opts=null}var optObj=opts&&_typeof(opts)==="object";opts=opts||{};this.json=opts.json||obj;this.path=opts.path||expr;this.resultType=opts.resultType||"value";this.flatten=opts.flatten||false;this.wrap=hasOwnProp.call(opts,"wrap")?opts.wrap:true;this.sandbox=opts.sandbox||{};this.preventEval=opts.preventEval||false;this.parent=opts.parent||null;this.parentProperty=opts.parentProperty||null;this.callback=opts.callback||callback||null;this.otherTypeCallback=opts.otherTypeCallback||otherTypeCallback||function(){throw new TypeError("You must supply an otherTypeCallback callback option "+"with the @other() operator.")};if(opts.autostart!==false){var args={path:optObj?opts.path:expr};if(!optObj){args.json=obj}else if("json"in opts){args.json=opts.json}var ret=this.evaluate(args);if(!ret||_typeof(ret)!=="object"){throw new NewError(ret)}return ret}}JSONPath.prototype.evaluate=function(expr,json,callback,otherTypeCallback){var _this2=this;var currParent=this.parent,currParentProperty=this.parentProperty;var flatten=this.flatten,wrap=this.wrap;this.currResultType=this.resultType;this.currPreventEval=this.preventEval;this.currSandbox=this.sandbox;callback=callback||this.callback;this.currOtherTypeCallback=otherTypeCallback||this.otherTypeCallback;json=json||this.json;expr=expr||t