/*! * * SpreadJS Library 13.1.0 * * Copyright(c) GrapeCity, Inc. All rights reserved. * * Licensed under the SpreadJS Commercial License. * us.sales@grapecity.com * http://www.grapecity.com/en/licensing/grapecity/ * * */ var GC="object"==typeof GC?GC:{};GC.Spread=GC.Spread||{},GC.Spread.Sheets=GC.Spread.Sheets||{},GC.Spread.Sheets.ConditionalFormatting=function(a){var b={};function c(d){if(b[d])return b[d].exports;var e=b[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,c),e.l=!0,e.exports}return c.m=a,c.c=b,c.d=function(a,b,d){c.o(a,b)||Object.defineProperty(a,b,{enumerable:!0,get:d})},c.r=function(a){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},c.t=function(a,b){var d,e;if(1&b&&(a=c(a)),8&b)return a;if(4&b&&"object"==typeof a&&a&&a.__esModule)return a;if(d=Object.create(null),c.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:a}),2&b&&"string"!=typeof a)for(e in a)c.d(d,e,function(b){return a[b]}.bind(null,e));return d},c.n=function(a){var b=a&&a.__esModule?function b(){return a.default}:function b(){return a};return c.d(b,"a",b),b},c.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},c.p="/assets/",c(c.s="./dist/plugins/conditional/conditional.entry.js")}({"./dist/plugins/conditional/conditional.entry.js":function(a,b,c){"use strict";function d(a){for(var c in a)b.hasOwnProperty(c)||(b[c]=a[c])}Object.defineProperty(b,"__esModule",{value:!0}),d(c("./dist/plugins/conditional/conditional.js")),d(c("./dist/plugins/conditional/conditional.ns.js"))},"./dist/plugins/conditional/conditional.js":function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,Ga,Ha,Ia,Ja,Ka,La,Ma,Na,Oa,Pa,Qa,Ra,Sa,Ta,Ua,Va,Wa,Xa,Ya,Za,$a,_a,ab,bb=this&&this.__extends||function(){var a=function(b,c){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])})(b,c)};return function(b,c){a(b,c);function d(){this.constructor=b}b.prototype=null===c?Object.create(c):(d.prototype=c.prototype,new d)}}();Object.defineProperty(b,"__esModule",{value:!0}),d=c("Common"),e=c("Core"),f=c("CalcEngine"),g=c("./dist/plugins/conditional/conditional.ns.js"),h=c("CalcEngine"),i=c("Core"),j=c("SheetsCalc"),k=c("./dist/plugins/conditional/conditionalFormatIcon.js"),l=e.GC$,m=d.Common.u,n=null,o=void 0,p="undefined",q="string",r=Math.min,s=Math.max,t=Math.abs,u=Math.floor,v=Math.ceil,w=f.Convert,x=w.Na,y=w.Pa,z=w.Th,A=d.Common.u,B=A.Db,C=A.kb,D=A.jb,E=A.Bb,F=d.Common.j.Fa,G=d.Common.q,H=d.Common.F,I=e.Ul,J=I.T$a,K=I.l_a,L=!!f,M=e.Style,N=d.Common.k,O=d.Common.pc,P=O.bc,Q=e.kf,R=e.Range,S=d.Common.l,T=d.Common.k,U=T.Fb,V=T.Cb,W=T.ac,X=f.Functions,Y=e.Rm,Z=new d.Common.ResourceManager(g.SR),$=Z.getResource.bind(Z),_=function(a){var b=a.row<0?j.BAND_INDEX_CONST:a.row,c=a.col<0?j.BAND_INDEX_CONST:a.col;return h.uf(n,n,b,c,b+a.rowCount-1,c+a.colCount-1)},aa=function(a){var b;if(a instanceof f.Expression)b=a;else if(a instanceof R)b=_(a);else{if(!x(a))throw $().Exp_NotSupport;a=y(a),isNaN(a)||(b=new f.Expression(2),b.value=a)}return b};function cb(a,b,c){var d,e;for(d=0;dc;case ga.greaterThanOrEqualsTo:return b>=c;case ga.lessThan:return bc},Ga=function(a,b){var c=Aa(a);return bc},Ja=function(a,b){return!Ia(a,b)&&!Ha(a,b)},b.$V=function(a,b,c,d,e,f,g,h,i){return new La(a,{compareType:b,expected:c,formula:d,customValueType:e,type:f,ranges:g,item1:h,item2:i})},b.Cxb=new M,Ka=["conType","compareType","item1","item2","ignoreBlank","expected","formula","treatNullValueAsZero","integerValue","forceValue2Text","useWildCards","ignoreCase","customValueType","expectTypeId","type","ranges","isPercent","regex"],La=function(){function a(a,b){var c,d;b||(b={}),c=b.formula,d=this,d.offsetRow=0,d.offsetCol=0,d.conType("string"==typeof a?ya[a]:a),F(b.compareType)||d.RV(b.compareType),F(b.expected)||d.expected(b.expected),F(c)||d.formula("string"==typeof c?B(l.trim(c),"="):c),F(b.item1)||d.item1(b.item1),F(b.item2)||d.item2(b.item2),F(b.customValueType)||d.customValueType(b.customValueType),F(b.type)||d.type(b.type),d.ranges(b.ranges),d.Lf=n,d.TV=n}return a.prototype.context=function(a){if(1===arguments.length){this.xc=a;var b=this.item1(),c=this.item2();b&&b.context&&b.context(a),c&&c.context&&c.context(a)}return this.xc},a.prototype.j_a=function(a){var b=this,c=b.item1(),d=b.item2();a?b.q$a=!0:b.p$a=!0,c&&c.j_a(a),d&&d.j_a(a)},a.prototype.k_a=function(){var a=this,b=a.item1(),c=a.item2();delete a.q$a,delete a.p$a,b&&b.k_a(),c&&c.k_a()},a.prototype.initExpression=function(a,b,c){var d,e,f,g,h,i=this.item1(),j=this.item2();i&&i.initExpression&&i.initExpression(),j&&j.initExpression&&j.initExpression(),a=a||this.xc,d=this.Yw,a&&d&&!this.Lf&&(this.ranges()?(e=K(this.ranges()),b=e.r,c=e.c):(b=b||0,c=c||0),f=a.getCalcService(),g=a.yj(),f&&g&&(h=!1,this.q$a&&(h=!this.p$a),this.Lf=f.parse(g,d,b,c,!1,!0,h)))},a.prototype.expression=function(a,b,c,d){var e,f,g;return 1===arguments.length?(this.Lf=a,b=b||this.xc,a?b&&(this.ranges()?(e=K(this.ranges()),c=e.r,d=e.c):(c=c||0,d=d||0),f=b.getCalcService(),g=b.yj(),f&&g&&(this.Yw=f.unparse(g,a,c,d))):this.Yw=a,this.Lf):(this.Lf||this.initExpression(b,c,d),this.Lf)},a.prototype.getFormulaString=function(a,b,c,d){var e,f,g;return a=a||this.xc,e=this.Lf,f=this.Yw,a&&f?(e||(this.initExpression(a,b,c),e=this.Lf),g=K(this.ranges()),b=F(b)?g.r:b,c=F(c)?g.c:c,a.getCalcService().unparse(a.yj(),e,b,c,o,!!d)):f},a.prototype.formula=function(a,b,c){if("string"!=typeof a){var d=this.item1(),e=this.item2();return 0===c&&d&&d.formula?d.formula(a,b,c):1===c&&e&&e.formula?e.formula(a,b,c):this.getFormulaString(o,a,b)}this.Yw=a,this.Lf=n},a.prototype.adjustOffset=function(a,b){var c=this,d=c.item1();d&&d.adjustOffset&&d.adjustOffset(a,b),d=c.item2(),d&&d.adjustOffset&&d.adjustOffset(a,b),c.offsetRow=a,c.offsetCol=b},a.prototype.relationConditionEvaluate=function(a,b,c,d,e){var f,g,h,i,j=this;function k(d,e){if(a&&d&&3===d.conType()){var f=a.getActualStyle(b,c,3,!0);f&&(0===d.RV()?e=f.backColor:1===d.RV()&&(e=f.foreColor))}return e}function l(a,b){if(a)return a.ignoreBlank(j.ignoreBlank()),arguments.length<5?k(a,d):b}function m(d,e){return!F(d)&&d.evaluate(a,b,c,e)}return f=l(j.item1(),d),g=l(j.item2(),e),h=m(j.item1(),f)?1:0,i=m(j.item2(),g)?1:0,h+i>j.RV()},a.prototype.cellValueConditionEvaluate=function(a,b,c,d){var e=this.getExpected(a,b,c);return!(e!==n||!a||!a.lRa)||this.cellValueConditionCheckCondition(e,d)},a.prototype.cellValueConditionCheckCondition=function(a,b){var c,d,e,f=this,g=0,h=!1;if(F(b)&&F(a))switch(f.RV()){case ga.equalsTo:case ga.greaterThanOrEqualsTo:case ga.lessThanOrEqualsTo:return!0;case ga.notEqualsTo:case ga.greaterThan:case ga.lessThan:return!1;default:return!1}return"boolean"==typeof a||"boolean"==typeof b?fb(f.RV(),b,a):(c={},F(b)?f.treatNullValueAsZero()?h=!0:g=b:"boolean"!=typeof b&&z(b,c)&&(g=c.value,h=!isNaN(g)),h?(d=0,e=!1,z(a,c)&&(d=c.value,e=!0),e?fb(f.RV(),g,d):f.RV()===ga.notEqualsTo):"string"==typeof b?"string"==typeof a?fb(f.RV(),b,a,!0):1===f.RV():!!F(b)&&f.RV()===ga.notEqualsTo)},a.prototype.numberConditionEvaluate=function(a,b,c,d){var e=this.numberConditionGetExpected(a,b,c);return!(e!==n||!a||!a.lRa)||(this.integerValue()&&(e=isNaN(e)?n:e>0?u(e):v(e)),this.numberConditionCheckCondition(e,d))},a.prototype.numberConditionCheckCondition=function(a,b){var c,d,e=this;if((F(b)||""===b)&&e.ignoreBlank())return!0;if(isNaN(b))return!1;if(F(a)){if(e.ignoreBlank())return!0;a=0}try{c=parseFloat(b)}catch(a){return!1}return!(e.integerValue()&&(d=c-u(c)===0,!d))&&fb(e.RV(),c,a)},a.prototype.numberConditionGetExpected=function(a,b,c){var d,e=this;return e.Yw&&e.Yw.length>0?(d=a.Cf(),d?d.evaluate(a.yj(),e.expression(n,a),b,c):e.expected()):e.expected()},a.prototype.textConditionEvaluate=function(a,b,c,d){var e,f,g,h=this,i=h.compareType(),j=h.ignoreCase();function k(a,b){return h.testTextByCondition(b,a,"^","$",function(){return j?a.toLowerCase()===b.toLowerCase():a===b})}function l(a,b){return h.testTextByCondition(b,a,"^","",function(){return C(b,a,j)})}function m(a,b){return h.testTextByCondition(b,a,"","$",function(){return D(b,a,j)})}function p(a,b){return h.testTextByCondition(b,a,"","",function(){return E(b,a===o||a===n?"":a,j)})}if(!h.forceValue2Text()&&H(d,Date))return i!==ka.beginsWith&&i!==ka.endsWith&&i!==ka.contains&&(i===ka.doesNotBeginWith||i===ka.doesNotEndWith||i===ka.doesNotContain);if(e=F(d)?"":""+d,h.ignoreBlank()&&""===e)return!0;if(f=this.getExpected(a,b,c),g=F(f)?"":""+f,h.hasWildcard(g)&&"number"==typeof d)return i===ka.doesNotBeginWith||i===ka.doesNotContain||i===ka.doesNotEndWith||i===ka.notEqualsTo;switch(i){case ka.equalsTo:return k(g,e);case ka.notEqualsTo:return!k(g,e);case ka.beginsWith:return l(g,e);case ka.doesNotBeginWith:return!l(g,e);case ka.endsWith:return m(g,e);case ka.doesNotEndWith:return!m(g,e);case ka.contains:return p(g,e);case ka.doesNotContain:return!p(g,e);default:return!1}},a.prototype.hasWildcard=function(a){return a.indexOf("*")>-1||a.indexOf("?")>-1},a.prototype.testTextByCondition=function(a,b,c,d,e){var f,g=this.useWildCards();return g?this.regex()?G.qb(this.regex()).test(a):(f=G.ub(b))?(f=c+f+d,this.ignoreCase()?G.sb(f).test(a):G.qb(f).test(a)):e():e()},a.prototype.colorConditionEvaluate=function(a,b,c,d){var e,f,g,h;function i(a){return F(a)||""===a?n:O.ec(a)}if(e=this,f=i(e.expected()),F(f)||""===f){if(e.ignoreBlank()||F(f)&&F(d))return!0}else if(g=i(d),(F(g)||""===g)&&a&&a.getDefaultStyle&&(h=a.getDefaultStyle(),e.RV()===la.backgroundColor?g=h.backColor:e.RV()===la.foregroundColor&&(g=h.foreColor)),!F(g)&&""!==g)return g=g,f=f,g.a===f.a&&g.r===f.r&&g.g===f.g&&g.b===f.b;return!1},a.prototype.formulaConditionEvaluate=function(a,b,c,d){var e,f,g,h;if(!L)return!1;if(e=this,e.customValueType()===ma.formula)return f=e.getExpected(a,b,c),!(!e.ignoreBlank()||!F(f)&&""!==f)||(g={},!!w.Uh(f,g)&&g.value);switch(h=w.vf,e.customValueType()){case ma.empty:return F(d)||""===d;case ma.nonEmpty:return!F(d)&&""!==d;case ma.error:return h(d);case ma.nonError:return!h(d);default:return!1}},a.prototype.formulaConditionGetExpected=function(a,b,c){var d,e,g,i,j,k,l,m,n,p,q=this;if(q.Yw&&q.Yw.length>0){if(d=a.Cf(),!d)return q.expected();if(e=d.Hg(a.yj(),q.expression(o,a),h.pf(b,c),!0),g=void 0,i=void 0,j=void 0,k=void 0,l=void 0,w.Fh(e)){for(g=e.getRowCount(0),i=e.getColumnCount(0),j=[],k=0;k=0&&b.getMonth()<=2;case ra.quarter2:return b.getMonth()>=3&&b.getMonth()<=5;case ra.quarter3:return b.getMonth()>=6&&b.getMonth()<=8;case ra.quarter4:return b.getMonth()>=9&&b.getMonth()<=11;default:return!1}}if(d=this,e=c,d.ignoreBlank()&&(F(e)||""===e))return!0;try{e=w.Wh(e)}catch(a){return!1}if(g=d.expectTypeId(),g===oa.dateOccurring){if(h=this.getExConditionDateScope(a),i=h.from,j=h.to,!F(i)&&!F(j))return k=b.$V(ya.dateCondition,na.afterEqualsTo,i,n),l=b.$V(ya.dateCondition,na.beforeEqualsTo,j,n),m=b.$V(ya.relationCondition,ha.and,n,n,n,n,n,k,l),m.evaluate(n,0,0,e)}else if(f=d.A4(n,0,0),!F(f)){if(g===oa.yearOccurring)return f===e.getFullYear();if(g===oa.quarterOccurring)return q(f,e);if(g===oa.monthOccurring)return f===e.getMonth();if(g===oa.weekOccurring)return f===e.getDay();if(g===oa.dayOccurring)return f===Da(e);if(g===oa.yearTodate)return o=new Date,p=new Date,o.setMonth(0,1),o.setHours(0,0,0,0),p.setHours(23,59,59,59),o<=e&&e<=p}return!1},a.prototype.textLengthConditionEvaluate=function(a,b,c,d){var e,f;return F(d)||""===d?this.ignoreBlank():(e=F(d)?0:(""+d).length,f=this.A4(a,b,c),"number"==typeof f&&fb(this.RV(),e,f))},a.prototype.top10ConditionEvaluate=function(a,b,c,d){var e,f,g,h=this;if(F(d)||""===d)return h.ignoreBlank();if(e=h.A4(a,b,c),!F(e)&&(f=void 0,h.k$a?(F(h.mxb)&&(h.mxb=h.getTopValues(a,e,h.ranges())),f=h.mxb):f=h.getTopValues(a,e,h.ranges()),f)){g=0;try{g=h.Pa(d)}catch(a){return!1}if(T.Bb(f,g))return!0}return!1},a.prototype.A4=function(a,b,c){var d=this.getExpected(a,b,c);return d=parseInt(d,10),isNaN(d)||!isFinite(d)?n:d},a.prototype.adjustRange=function(a,b){return Q(a.row,a.col,Math.min(db(a),b.getRowCount()),Math.min(eb(a),b.getColumnCount()))},a.prototype.getTopValues=function(a,b,c){var d,e,f,g,h,i,j,k,l,m=0===this.type()?1:-1,n=[];if(!c)return n;for(d=this.UV(a,c),e=W(d),j=0;jb&&(n=n.slice(0,b)),n},a.prototype.Pa=function(a){return("number"==typeof a||H(a,Date))&&L?y(a):n},a.prototype.uniqueConditionEvaluate=function(a,b,c,d){var e,f,g,h,i=this,j=d;return F(j)||""===j?i.ignoreBlank():(L&&x(j)&&(j=y(j)),e=this.getExpected(a,b,c),f={},w.Uh(e,f),g=f.value,!F(g)&&(h=i.duplicatedArrayCached||i.getDuplicated(a,i.ranges()),!F(h)&&T.Bb(h,j)?g===!0:g!==!0))},a.prototype.getDuplicated=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=[],o={},p=this.UV(a,b);if(p)for(c=W(p),d=0;dh;case sa.below:return k=h;case sa.equalOrBelow:return k<=h;case sa.above1StdDev:return!l&&k>h+i;case sa.below1StdDev:return!l&&kh+2*i;case sa.below2StdDev:return!l&&kh+3*i;case sa.below3StdDev:return!l&&k=4&&a.type()<=9&&(a.TV=a.YV("STDEV",a.ranges())))},a.prototype.YV=function(a,b){var c,d,e,g;if(!L)return n;if(c=X.findGlobalFunction(a)){for(d=[],e=W(b),g=0;g0?W(b)>1?a.push(c[0]):a.push.apply(a,c):a.push(c)},a.prototype.getValidList=function(a,b,c){var d,e,f=[],g=this.getValidListImp(a,b,c);for(d=0,e=W(g);d0)d=m.getExpected(a,b,c),H(d,Array)?m.ZV(n,d):n.push(d);else if(m.expected()&&m.expected().length>0&&(e=m.expected(),f=e.replace(/\\,/g,String.fromCharCode(206)),g=f.split(",")))for(h=0;h0)for(c=0;c=a?j.ranges()[f]=Q(g.row+k,g.col+l,db(g),eb(g)):a<=h+i&&(j.ranges()[f]=Q(g.row,g.col,db(g)+k,eb(g)+l))}},a.prototype.rI=function(a,b,c){this._V(a,b,!0,c)},a.prototype.tI=function(a,b,c){this._V(a,b,!1,c)},a.prototype.aW=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n=this,o=c?a:0,p=c?0:a,q=c?b:0,s=c?0:b;if(n.yyb(),n.ranges()){for(d=[],e=W(n.ranges()),f=0;fa?h+i<=a+b?d.push(g):n.ranges()[f]=Q(g.row-q,g.col-s,db(g),eb(g)):a0)?"="+B(l.trim(""+d),"="):this._Qa):void(this._Qa=a)},c.prototype.value2=function(a,b){var c,d;return 1!==arguments.length?(c=this.condition(),c&&(d=c.formula(a,b,1),d&&d.length>0)?"="+B(l.trim(""+d),"="):this.aRa):void(this.aRa=a)},c.prototype.formula=function(a,b){var c=this,d=c.condition();return"string"!=typeof a?d&&d.formula(a,b)||c.Yw:(c.Yw=a,void(d&&d.formula(a)))},c.prototype.cellValueRuleCreateCondition=function(){var a,c,d,e,f,g,h,i,j=this,k=j.value1(),l=j.value2(),m=j.ranges(),p=j.bW(k)?B(k,"="):n,q=j.bW(l)?B(l,"="):n,r=j.operator();return r===ia.between?(a=b.$V(ya.cellValueCondition,3,k,p,o,o,m),a.treatNullValueAsZero(!0),c=b.$V(ya.cellValueCondition,5,l,q,o,o,m),c.treatNullValueAsZero(!0),f=b.$V(ya.relationCondition,1,n,n,n,n,m,a,c),d=b.$V(ya.cellValueCondition,5,k,p,o,o,m),d.treatNullValueAsZero(!0),e=b.$V(ya.cellValueCondition,3,l,q,o,o,m),e.treatNullValueAsZero(!0),g=b.$V(ya.relationCondition,1,n,n,n,n,m,d,e),b.$V(ya.relationCondition,0,n,n,n,n,m,f,g)):r===ia.notBetween?(a=b.$V(ya.cellValueCondition,4,k,p,o,o,m),a.treatNullValueAsZero(!0),c=b.$V(ya.cellValueCondition,2,l,q,o,o,m),a.treatNullValueAsZero(!0),f=b.$V(ya.relationCondition,0,n,n,n,n,m,a,c),d=b.$V(ya.cellValueCondition,2,k,p,o,o,m),d.treatNullValueAsZero(!0),e=b.$V(ya.cellValueCondition,4,l,q,o,o,m),e.treatNullValueAsZero(!0),g=b.$V(ya.relationCondition,0,n,n,n,n,m,d,e),b.$V(ya.relationCondition,1,n,n,n,n,m,f,g)):(h=r,i=b.$V(11,h,k,p,o,o,m),i.treatNullValueAsZero(!0),i)},c.prototype.bW=function(a){return!F(a)&&"="===a[0]},c.prototype.specificTextRuleCreateCondition=function(){var a,c,d,e,f=this.operator();switch(f){case 2:a=2;break;case 3:a=4;break;case 0:a=6;break;case 1:a=7;break;default:a=0}return c=this.text(),d=n,c&&"="===c[0]&&(d=c),e=b.$V(2,a,c,d,o,o,this.ranges()),e.ignoreCase(!0),e.useWildCards(2!==f&&3!==f),e},c.prototype.formulaRuleCreateCondition=function(){var a=this,c=a.ranges();return b.$V(4,n,n,a.Yw,4,n,c)},c.prototype.dateOccurringRuleCreateCondition=function(){return b.$V(6,n,this.type(),n,n,o,this.ranges())},c.prototype.top10RuleCreateCondition=function(){return b.$V(8,n,this.rank(),n,n,this.type(),this.ranges())},c.prototype.uniqueRuleCreateCondition=function(){return b.$V(9,n,!1,n,n,n,this.ranges())},c.prototype.duplicateRuleCreateCondition=function(){return b.$V(9,n,!0,n,n,n,this.ranges())},c.prototype.averageRuleCreateCondition=function(){return b.$V(10,n,n,n,n,this.type(),this.ranges())},c.prototype.createCondition=function(){return this[za[this.ruleType()]+"CreateCondition"]()},c.prototype.reset=function(){var a=this;switch(a.ranges(n),a.condition(n),a.style(n),a.stopIfTrue(!1),a.priority(1),a.operator(6),a.value1(n),a.value2(n),a.text(""),a.formula(n),a.type(0),a.rank(10),a.ruleType()){case 1:a.operator(6);break;case 2:a.operator(0);break;case 4:a.style(n);break;case 5:a.type(0),a.rank(10);break;case 8:a.type(0)}},c.prototype.evaluate=function(b,c,d,e){return this.jW(b),a.prototype.evaluate.call(this,b,c,d,e)},c.prototype.jW=function(a){var b,c=this;c.initCondition(),b=c.condition(),9===b.conType()&&(c.iW()&&(c.Nm(),c.cW=c.hW(c.ranges())),c.cached===!1&&(b.duplicatedArrayCached=b.getDuplicated(a,c.ranges()),c.cached=!0))},c.prototype.Nm=function(){this.cached=!1},c.prototype.rI=function(b,c,d){a.prototype.rI.call(this,b,c,d),this.Nm()},c.prototype.tI=function(b,c,d){a.prototype.tI.call(this,b,c,d),this.Nm()},c.prototype.GR=function(b,c){a.prototype.GR.call(this,b,c),this.Nm()},c.prototype.HR=function(b,c){a.prototype.HR.call(this,b,c),this.Nm()},c.prototype.toJSON=function(a){var b,c,d,e,f,g=this;return F(g.condition())&&this.initCondition(),b=ca.call(g,a,Oa),c=g.value1(),hb(b.ruleType,b.operator)&&(d=g.value2()),e=a&&a.parent&&1===a.parent.options.referenceStyle,F(c)||(g.bW(c)&&e&&(c=ib(a,g,c,e)),b.value1=c),F(d)||(g.bW(d)&&e&&(d=ib(a,g,d,e)),b.value2=d),f=g.ruleType(),f===za.conditionRuleBase&&(b.condition=g.condition().toJSON()),b},c.prototype.fromJSON=function(a,b,c){var d=Oa;F(a.condition)||(d=Oa.concat(["condition"])),da.call(this,b,d,a,c),F(a.value1)||this.value1(a.value1),F(a.value2)||this.value2(a.value2),this.initCondition(b)},c}(Ma),b.NormalConditionRule=Pa;function ib(a,b,c,d){var e=b.ranges(),f=K(e),g=j.formulaToExpression(a,c,f.r,f.c,d);return j.expressionToFormula(a,g,f.r,f.c,!d)}Qa={operator:ba("operator",n),text:ba("text",n),type:ba("type",n),rank:ba("rank",n),priority:ba("priority",1)},l.extend(Pa.prototype,Qa),Ra=function(){function a(a,b){this.type=a,this.value=b}return a}(),b.ScaleValue=Ra,Sa=["ruleType","ranges","minType","minValue","minColor","maxType","maxValue","maxColor","midType","midValue","midColor","priority"],Ta=function(a){bb(c,a);function c(b,c,d,e,f,g,h,i,j,k,l){var m,o,p,q,r,s,t,u,v,w=a.call(this,b,n,l)||this,x=w;return x.xyb=!1,x.lowestValueCached=n,x.highestValueCached=n,x.zyb={},x.cached=!1,x.cW=n,m=c,o=d,p=e,q=f,r=g,s=h,t=i,u=j,v=k,arguments.length<=1&&(m=1,o=n,p=P(255,248,105,107),q=4,r=50,s=P(255,255,235,132),t=2,u=n,v=P(255,99,190,123)),x.minColor(p),x.minValue(o),x.minType(m),x.midColor(s),x.midValue(r),x.midType(q),x.maxColor(v),x.maxValue(u),x.maxType(t),w}return c.prototype.stopIfTrue=function(a){return!1},c.prototype.isScaleRule=function(){return!0},c.prototype.createCondition=function(){return n},c.prototype.fW=function(a){var c=b.$V(8,n,n,n,n,1).getTopValues(a,1,this.ranges());return W(c)>0?c[0]:n},c.prototype.gW=function(a){var c=b.$V(8,n,n,n,n,0).getTopValues(a,1,this.ranges());return W(c)>0?c[0]:n},c.prototype.jW=function(a){var b=this;b.iW()&&(b.Nm(),b.cW=b.hW(b.ranges())),b.cached===!1&&(b.lowestValueCached=b.fW(a),b.highestValueCached=b.gW(a),b.cached=!0)},c.prototype.Nm=function(){this.lowestValueCached=n,this.highestValueCached=n,this.zyb={},this.cached=!1},c.prototype.kW=function(a,b,c,d){var e,f;return d&&(e=a.Cf())?(f=e.parse(a.yj(),d,b,c),e.Hg(a.yj(),f,h.pf(b,c),!1)):n},c.prototype.bW=function(a){return a&&"="===a[0]},c.prototype.lW=function(a){return F(a)||""===a?n:"="===a[0]?a.substr(1):a},c.prototype.mW=function(a,b,c,d){if(this.bW(d))return this.kW(a,b,c,this.lW(""+d));var e={};return z(d,e)?e.value:NaN},c.prototype.dW=function(a){return this.jW(a),this.highestValueCached},c.prototype.eW=function(a){return this.jW(a),this.lowestValueCached},c.prototype.nW=function(a,b,c,d){var e,f,g=this.mW(a,b,c,d);return!isNaN(g)&&0<=g&&g<=100&&(e=this.eW(a),f=this.dW(a),typeof e!==p&&e!==n&&typeof f!==p&&f!==n)?e+(f-e)*g/100:n},c.prototype.oW=function(a,b,c,d){var e,f,g,i,j,k,l,m,o,p,q,r,s=this.zyb;if(void 0!==s[d])return s[d];if(e=this.mW(a,b,c,d),!isNaN(e)&&0<=e&&e<=100){for(f=0,g=this.ranges(),i=W(g),j=0;j0?0:g;default:return n}},c.prototype.qW=function(a,b,c){return a===b&&a===c?1:a<=b?0:a>=c?1:(a-b)/(c-b)},c.prototype.rW=function(a,b,c){var d,e,f,g,h,i;return 0<=a&&a<=1?(d=O.ec(b),e=O.ec(c),f=d.a*(1-a)+e.a*a,g=d.r*(1-a)+e.r*a,h=d.g*(1-a)+e.g*a,i=d.b*(1-a)+e.b*a,P(parseFloat(f/255+""),parseInt(g+"",10),parseInt(h+"",10),parseInt(i+"",10))):n},c.prototype.YV=function(a,b){var c,d,e,g;if(!L)return n;if(c=X.findGlobalFunction(a)){for(d=[],e=W(b),g=0;gh)return n;if(isNaN(g)){if(!isNaN(f)&&!isNaN(h))return i.qW(e,f,h)}else if(!isNaN(f)&&!isNaN(h))return e=h?2:f<=e&&e<=g?i.qW(e,f,g):1+i.qW(e,f,h)}catch(a){return n}}return n},c.prototype.twoScaleRuleEvaluate=function(a,b,c,d){var e,f,g,h,i,j;if(!F(d)){if(e={},f=x(d)&&z(d,e)?e.value:NaN,isNaN(f))return n;if(g=this,h=g.pW(a,b,c,g.minType(),g.minValue()),i=g.pW(a,b,c,g.maxType(),g.maxValue()),!F(h)&&!F(i))return j=g.qW(f,h,i),g.rW(j,g.minColor(),g.maxColor())}return n},c.prototype.threeScaleRuleEvaluate=function(a,b,c,d){var e,f,g,h,i,j,k=this;if(k.lh=a,!F(d)){if(e={},f=x(d)&&z(d,e)?e.value:NaN,isNaN(f))return n;if(g=k.pW(a,b,c,k.minType(),k.minValue()),h=k.pW(a,b,c,k.midType(),k.midValue()),i=k.pW(a,b,c,k.maxType(),k.maxValue()),!F(g)&&!F(i)&&!F(h))return j=void 0,g>i?n:f<=g||g===i?f>=i?k.maxColor():k.minColor():f>=i?k.maxColor():f<=h?(j=k.qW(f,g,h),k.rW(j,k.minColor(),k.midColor())):(j=k.qW(f,h,i),k.rW(j,k.midColor(),k.maxColor()))}return n},c.prototype.evaluate=function(a,b,c,d){return this[za[this.ruleType()]+"Evaluate"](a,b,c,d)},c.prototype.ad=function(){var a=this;a.minValue(n),a.minType(1),a.midValue(50),a.midType(4),a.maxValue(n),a.maxType(2),10===a.ruleType()&&(a.minColor(P(0,255,255,255)),a.maxColor(P(255,99,190,123))),11===a.ruleType()&&(a.midValue(50),a.midType(4),a.minColor(P(255,248,105,107)),a.midColor(P(255,255,235,132)),a.maxColor(P(255,99,190,123)))},c.prototype.reset=function(){var a=this;a.ranges(n),a.condition(n),a.style(n),a.ad(),a.lh=n,a.stopIfTrue(!1),a.priority(1)},c.prototype.toJSON=function(a){return ca.call(this,a,Sa)},c.prototype.fromJSON=function(a,b,c){da.call(this,b,Sa,a,c),this.initCondition(b)},c}(Ma),b.ScaleRule=Ta,Ua={minValue:ba("minValue",n),minType:ba("minType",5),minColor:ba("minColor",n),midValue:ba("midValue",50,n,function(a){var b=this;if(b.lh){if(2===b.midType())return b.dW(b.lh);if(1===b.midType())return b.eW(b.lh)}return a}),midType:ba("midType",n),midColor:ba("midColor",n),maxType:ba("maxType",7),maxValue:ba("maxValue",n),maxColor:ba("maxColor",n)},l.extend(Ta.prototype,Ua),Va=["ruleType","ranges","gradient","color","showBorder","borderColor","dataBarDirection","negativeFillColor","useNegativeFillColor","negativeBorderColor","useNegativeBorderColor","axisPosition","axisColor","showBarOnly","minType","minValue","maxType","maxValue","priority"],Wa=function(a){bb(b,a);function b(b,c,d,e,f,g){var h=this,i=b,j=c,k=d,l=e,m=f;return 0===arguments.length&&(i=5,j=n,k=7,l=n,m=P(255,99,142,198)),h=a.call(this,12,i,j,n,n,n,n,k,l,n,g)||this,h.xyb=!1,h.ad(m),h}return b.prototype.ad=function(a){var b=this;b.gradient(!0),b.color(a),b.showBorder(!1),b.borderColor("black"),b.dataBarDirection(0),b.negativeFillColor("red"),b.useNegativeFillColor(!0),b.negativeBorderColor("black"),b.useNegativeBorderColor(!1),b.axisPosition(0),b.axisColor("black"),b.showBarOnly(!1)},b.prototype.reset=function(){var a=this;a.ranges(n),a.condition(n),a.style(n),a.ad(P(255,99,142,198)),a.stopIfTrue(!1),a.priority(1),a.minValue(n),a.minType(5),a.midValue(n),a.midType(n),a.maxValue(n),a.maxType(7),a.minColor(n),a.midColor(n),a.maxColor(n)},b.prototype.sW=function(a,b,c,d){var e,f,g,h,i=this,j=d?i.maxType():i.minType(),k=d?i.maxValue():i.minValue();if(6!==j&&4!==j)return i.pW(a,b,c,j,k);for(f=0;f=c&&a>b?[1,d]:a<=b&&a0&&b>=0?c===b?[.5,f]:a>=c?[.5,f]:a<=b?[b/c*.5,f]:[.5*t(a/c),f]:c>0&&b<0?(d=c>t(b)?.5:c/g,e=c>t(b)?b/g:-.5,a>0?a>=c?[d,f]:[a/c*d,f]:a<0?a<=b?[e,f]:[a/b*e,f]:[0,f]):c<=0&&b<0?c===b?[-.5,f]:a>=c?[-c/b*.5,f]:a<=b?[-.5,f]:[-a/b*.5,f]:0===c&&0===b?[0,f]:(f=-1,[-1,f])},b.prototype.vW=function(a,b,c){var d,e,f,g=-1,h=t(b),i=t(c),j=t(c-b),k=b<0?-1:1;return c>0&&b>=0||c<=0&&b<0?(d=s(h,i),e=r(h,i),f=t(a),g=b<0?1:0,f<=e&&f=d&&f>e?[k,g]:e===d?[.5*k,g]:[k*(t(a)-e)/j,g]):c>0&&b<0?(g=t(b)/j,0===a?[0,g]:a>=c?[1-g,g]:[s(a,b)/j,g]):0===c&&0===b?(g=.5,0===a?[0,g]:[.5*k,g]):[-1,g]},b.prototype.wW=function(a,b,c){var d=this;return 0===d.axisPosition()?d.vW(a,b,c):1===d.axisPosition()?d.uW(a,b,c):d.tW(a,b,c)},b.prototype.evaluate=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,o,p,q;if(!F(d)){if(e={},f=x(d,!0)&&z(d,e)?e.value:NaN,isNaN(f))return n;if(g=this,h=g.sW(a,b,c,!1),i=g.sW(a,b,c,!0),H(h,Date)&&(h=S.Ra(h)),H(i,Date)&&(i=S.Ra(i)),!F(h)&&!F(i))return h>i&&(j=i,i=h,h=j),k=void 0,l=g.wW(f,h,i),!l||W(l)<2?n:(m=l[0],k=l[1],o=f<0&&g.useNegativeFillColor()?g.negativeFillColor():g.color(),p=f<0&&g.useNegativeBorderColor()?g.negativeBorderColor():g.borderColor(),q=g.axisColor(),o=Y.Om(a,o),p=Y.Om(a,p),q=Y.Om(a,q),{fillColor:o,borderColor:p,showBorder:g.showBorder(),axisColor:q,isGradient:g.gradient(),direction:g.dataBarDirection(),axisLocation:k,scale:m,showBarOnly:g.showBarOnly()})}return n},b.prototype.toJSON=function(a){return ca.call(this,a,Va)},b.prototype.fromJSON=function(a,b,c){da.call(this,b,Va,a,c),this.initCondition(b)},b.paintDataBar=function(a,b,c,d,f,g){var h,i,j,k,l,m,n,o,p,q,r,s,v,w,x=new e.Rect(c+2,d+2,f-4,g-4),y=x.x,z=x.y,A=u(t(x.width*b.scale)),B=x.height;if(0===b.axisLocation)b.scale<=0&&(A=0);else if(1===b.axisLocation)b.scale<0?y=y+x.width-A:A=0;else{for(h=u(x.width*b.axisLocation+y)+.5,i=x.y,j=1,k=g-2,a.lineWidth=j,a.strokeStyle=b.axisColor,a.beginPath(),l=0;l<=k;l+=2)1===b.direction?(a.moveTo(2*c+f-h,i+l),a.lineTo(2*c+f-h,i+l+1)):(a.moveTo(h,i+l),a.lineTo(h,i+l+1));a.stroke(),b.scale>0?y=h+j:b.scale<0?y=h-A:A=0}b.showBorder&&(y=u(y)+.5,A-=1,z+=.5,B-=1),m=y,n=y+A,1===b.direction&&(m=2*c+f-y-A,n=2*c+f-y),A>=0&&B>=0&&(o=b.fillColor,b.isGradient&&(p=.9,o=a.createLinearGradient(m,z,n,z),q=O.ec(b.fillColor),r=P(q.a,u(255*p+q.r*(1-p)),u(255*p+q.g*(1-p)),u(255*p+q.b*(1-p))),s=b.scale<0?1-p:p,v=b.fillColor,w=b.scale<0?1:0,1===b.direction?(o.addColorStop(s,v),o.addColorStop(w,r)):(o.addColorStop(s,r),o.addColorStop(w,v))),a.fillStyle=o,a.fillRect(m,z,A,B),b.showBorder&&A>0&&B>0&&(a.strokeStyle=b.borderColor,a.strokeRect(m,z,A,B)))},b}(Ta),b.DataBarRule=Wa,Xa={gradient:ba("gradient",!0),color:ba("color",n),showBorder:ba("showBorder",!1),borderColor:ba("borderColor","black"),dataBarDirection:ba("dataBarDirection",0),negativeFillColor:ba("negativeFillColor","red"),useNegativeFillColor:ba("useNegativeFillColor",!0),negativeBorderColor:ba("negativeBorderColor","black"),useNegativeBorderColor:ba("useNegativeBorderColor",!1),axisPosition:ba("axisPosition",0),axisColor:ba("axisColor","black"),showBarOnly:ba("showBarOnly",!1)},l.extend(Wa.prototype,Xa),Ya=function(){function a(a,b,c){this.isGreaterThanOrEqualTo=a,this.iconValueType=b,this.iconValue=c}return a}(),b.IconCriterion=Ya,Za=["ruleType","ranges","iconSetType","iconCriteria","showIconOnly","reverseIconOrder","priority","icons"],$a=function(a){bb(b,a);function b(b,c){var d=this,e=b;return 0===arguments.length&&(e=0),d=a.call(this,13,n,n,n)||this,d.xyb=!1,d.ranges(c),d.ad(e),d}return b.prototype.xW=function(a){var b=this;b.iconSetType(a,!1),b.iconSetType()>=wa.threeArrowsColored&&b.iconSetType()<=wa.threeSymbolsUncircled?(b.NV=[],b.NV[0]=new Ya((!0),xa.percent,33),b.NV[1]=new Ya((!0),xa.percent,67),b.CZa=[],b.CZa[0]={iconSetType:a,iconIndex:0},b.CZa[1]={iconSetType:a,iconIndex:1},b.CZa[2]={iconSetType:a,iconIndex:2}):b.iconSetType()>=wa.fourArrowsColored&&b.iconSetType()<=wa.fourTrafficLights?(b.NV=[],b.NV[0]=new Ya((!0),xa.percent,25),b.NV[1]=new Ya((!0),xa.percent,50),b.NV[2]=new Ya((!0),xa.percent,75),b.CZa=[],b.CZa[0]={iconSetType:a,iconIndex:0},b.CZa[1]={iconSetType:a,iconIndex:1},b.CZa[2]={iconSetType:a,iconIndex:2},b.CZa[3]={iconSetType:a,iconIndex:3}):b.iconSetType()>=wa.fiveArrowsColored&&b.iconSetType()<=wa.fiveBoxes?(b.NV=[],b.NV[0]=new Ya((!0),xa.percent,20),b.NV[1]=new Ya((!0),xa.percent,40),b.NV[2]=new Ya((!0),xa.percent,60),b.NV[3]=new Ya((!0),xa.percent,80),b.CZa=[],b.CZa[0]={iconSetType:a,iconIndex:0},b.CZa[1]={iconSetType:a,iconIndex:1},b.CZa[2]={iconSetType:a,iconIndex:2},b.CZa[3]={iconSetType:a,iconIndex:3},b.CZa[4]={iconSetType:a,iconIndex:4}):b.iconSetType()>wa.fiveBoxes&&(b.NV=[],b.CZa=[])},b.prototype.ad=function(a){this.showIconOnly(!1),this.reverseIconOrder(!1),this.xW(a)},b.prototype.yW=function(a){var b=W(this.NV)+1;return this.reverseIconOrder()&&b>2?b-1-a:a},b.prototype.pW=function(a,b,c,d){var e=this,f=e.NV[d];if(f)switch(f.iconValueType){case xa.formula:return e.mW(a,b,c,f.iconValue);case xa.number:return e.mW(a,b,c,f.iconValue);case xa.percent:return e.nW(a,b,c,f.iconValue);case xa.percentile:return e.oW(a,b,c,f.iconValue);default:return n}},b.prototype.evaluate=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,o,p,q,r=this,s=d;if(F(s))return n;if(e={},f=x(d,!0)&&"boolean"!=typeof s&&z(d,e)?e.value:NaN,isNaN(f))return n;if(g=0,h=r.iconSetType(),i=r.NV,h>=wa.fiveArrowsColored?g=5:h>=wa.fourArrowsColored?g=4:h>=wa.threeArrowsColored&&(g=3),!i)return 0;for(k=0,l=g-1;l>0;l--)if(l=m:f>m,f0&&(p=Q(f,h,db(a),l-h),o.push(p)),i-m>0&&(q=Q(f,m+1,db(a),i-m),o.push(q)),j-f>0&&(t=Q(f,s(l,h),j-f,r(m,i)-s(l,h)+1),o.push(t)),g-k>0&&(u=Q(k+1,s(l,h),g-k,r(m,i)-s(l,h)+1),o.push(u))),W(o)>0?o:n):[a]},a.prototype.removeRuleByRange=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p=this,q=p.WS;if(q){if(e=[],p.AW)for(q.ITa.YUa(),f=0,g=W(p.AW);f0?h.ranges(p.EW(i)):e.push(h)}for(n=0,o=W(e);n=0;e--)f=g.AW[e],f&&(c?f.GR(a,b):f.HR(a,b),f.ranges().length<=0&&g.AW.splice(e,1))},a.prototype.GR=function(a,b){this.aW(a,b,!0)},a.prototype.HR=function(a,b){this.aW(a,b,!1)},a.prototype.Nm=function(){var a,b,c,d=this.AW;if(d!==n&&W(d)>0)for(b=0,c=W(d);b=f+a?x.rowCount=f-i:a=g+b?x.colCount=g-k:b0&&(y=J.indexOf(n),y<0?(J.push(n),L.push(p)):L[y]=L[y].concat(p))}for(z=0,A=J.length;zq&&m.push(Q(q,t,a-q,v)),b>t&&m.push(Q(s(a,q),t,r(a+c,q+u)-s(a,q),b-t)),b+d0?(k.yyb(),k.ranges(w)):y.removeRule(k)}},a.prototype.Byb=function(a,b,c,d,e,f,g){var h,i,j,k,l,m;for(h=0;h0){for(g.sort(function(a,b){return a.priority()-b.priority()}),i=n,j=n,k=void 0,l=void 0,m=void 0,m=0;m0&&(e=k.getRules(b,c),f=W(e),g=void 0,h=n,f>0))for(e.sort(function(a,b){return a.priority()-b.priority()}),i=0;i0&&(e=p.getRules(a,b),f=W(e),g=void 0,h=n,f>0))for(e.sort(function(a,b){return a.priority()-b.priority()}),i=0;i