text: /*!
   * SAPUI5
  
  (c) Copyright 2009-2020 SAP SE. All rights reserved
   */
  sap.ui.define(['sap/chart/coloring/ColoringUtils','sap/chart/coloring/criticality/measureValues/ThresholdsUtils','sap/chart/ChartLog','sap/chart/coloring/CriticalityType','sap/chart/data/MeasureSemantics',"sap/ui/thirdparty/jquery"],function(C,T,a,b,M,q){"use strict";var t=q.type;var c={Static:{},Calculated:{},DynamicThresholds:{},ConstantThresholds:{},Unmentioned:{}};var S=['Maximize','Minimize','Target'];c.Static.validate=function(o,m,D,e,h){var j=o[m].Static;var k=function(r,u){if(p[u]===m){n=true;if(p.staticType){if(p.staticType!==j){var v='';Object.keys(M).forEach(function(r,w,x){var u=M[r];if(p[u]){if(w!==(x.length-1)){v+=p[u]+', ';}else{v+=p[u];}}});throw new a('error','Colorings.Criticality.Static','When '+v+' have semantic relationship, they must use the same Criticality type.');}}else{p.staticType=j;if(h[j]){throw new a('error','Colorings.Criticality.Static','Measures, '+h[j]+' and '+m+', which use Static Criticality must have different types.');}else{h[j]=m;}}return false;}};var n=false;for(var i=0;i<e.length;++i){var p=e[i];q.each(M,k);if(n){break;}}return{supportMultiMsr:true};};c.Static.parse=function(o,e,p){var m=o.msr?o.msr.getName():undefined;var h=o.settings[o.type];p.callbacks=c.Static.getCallbacks(h,m);var D=o.msr.getLabel()||o.msr.getName();var i=o.settings.Legend||{};p.legend[h]=(i[h]!=null)?i[h]:D;};c.Static.getCallbacks=function(e,m){var h={};h[e]=[function(o){return o.hasOwnProperty(m);}];return h;};c.Calculated.validate=function(o,m,D){var e=o[m].Calculated;var h=D.allDim.filter(function(j){return j===e;})[0];var i=D.allMsr.filter(function(m){return m===e;})[0];if(h){o[m].type="dimension";}else if(i){o[m].type="measure";if(D.aMsr.find(function(j){return j.getName()===i;})){throw new a('error','Colorings.Criticality.Calculated','Calculated property, '+e+', could not be available measure.');}}if(!o[m].type){throw new a('error','Colorings.Criticality.Calculated','Calculated property, '+e+', does not exist in data model.');}};c.Calculated.parse=function(o,e,p,m,L){var h=o.settings[o.type];var i=o.settings.type;if(i==="dimension"&&!C.find(h,e.aDims)){p.additionalDimensions.push(h);}else if(i==="measure"){if(!e.aMsrs.find(function(j){return j.getName()===h;})){p.additionalMeasures.push(h);}e.oStatus.legend=c.getLegend(o,L);}p.status=e.oStatus;};c.Calculated.getCallbacks=function(p,e,m){var h=function(o){return(o[p]===e||c.Calculated.getCriticalityType(o[p])===e)&&o.hasOwnProperty(m);};return[h];};c.Calculated.getContextHandler=function(e,m,L){var o=e[0];var h=o.settings[o.type];var i=o.settings.type;delete o.settings.type;delete o.parsed.status.callbacks;return function(j){var k=o.parsed.status;k.legend=k.legend||{};k.callbacks=k.callbacks||{};o.parsed.legend=k.legend;o.parsed.callbacks=k.callbacks;var n=j.getProperty(h);if(i==="measure"){n=c.Calculated.getCriticalityType(n);}if(b[n]){if(i==="dimension"){var p=this.getDimensionByName(h);var D=this.getDimensionByName(h).getDisplayText();e.legendTitle=e.legendTitle||p.getLabel();var r=p.getTextProperty();if(r&&D){var u=j.getProperty(r);o.parsed.legend[n]=u;}else if(n){o.parsed.legend[n]=L.getText("COLORING_TYPE_"+n.toUpperCase());}}var v=o.msr.getName();var w=c.Calculated.getCallbacks(h,n,v);o.parsed.callbacks[n]=w;}};};c.Calculated.getCriticalityType=function(v){var e;switch(v){case 0:e=b.Neutral;break;case 1:e=b.Negative;break;case 2:e=b.Critical;break;case 3:e=b.Positive;break;default:e=undefined;break;}return e;};c.DynamicThresholds.validate=function(o,m,D){var h=D.allMsr;var i=[],j=o[m].DynamicThresholds,k;if(S.indexOf(j.ImprovementDirection)>-1){k=j.ImprovementDirection;}else{throw new a('error','Colorings.Criticality.DynamicThresholds','ImprovementDirection should be one of \'Maximize\', \'Minimize\' and \'Target\'.');}var n=[j.ToleranceRangeLowValue,j.DeviationRangeLowValue,j.AcceptanceRangeLowValue];var p=[j.ToleranceRangeHighValue,j.DeviationRangeHighValue,j.AcceptanceRangeHighValue];switch(k){case"Maximize":i=n;break;case"Minimize":i=p;break;case"Target":i=n.concat(p);break;default:}if(C.isNumber.apply(null,i)){throw new a('error','Colorings.Criticality.DynamicThresholds','Invalid Thresholds settings.');}i=i.filter(function(e){return typeof e=="string";});C.notIn(i,h,'Colorings.Criticality.DynamicThresholds','Thresholds measure, ',', does not exist in data model.');};c.DynamicThresholds.parse=function(o,e,p,m,L){var h=o.settings[o.type];var i=o.msr?o.msr.getName():undefined;var D=h.ImprovementDirection.toLowerCase();var j={lo:h.ToleranceRangeLowValue,hi:h.ToleranceRangeHighValue};var k={lo:h.DeviationRangeLowValue,hi:h.DeviationRangeHighValue};var A={lo:h.AcceptanceRangeLowValue,hi:h.AcceptanceRangeHighValue};T.fillOmit(A,j,k);p.additionalMeasures=[A.lo,A.hi,j.lo,j.hi,k.lo,k.hi].filter(function(v){return t(v)==='string'&&e.aMsrs.filter(function(n){return n.getName()===v;}).length==0;});p.callbacks=T.improvement(D,i,A,j,k);p.legend=c.getLegend(o,L);};c.DynamicThresholds.getContextHandler=function(e,m,L){var o=e[0],h=o.settings[o.type],D=h.ImprovementDirection.toLowerCase();function _(i,k){var r;if(typeof k==="number"){r=k;}else{r=k?i.getProperty(k):null;if(typeof r==="string"){r=Number.parseFloat(r);}}return r;}return function(i){var j={};j.lo=_(i,h.ToleranceRangeLowValue);j.hi=_(i,h.ToleranceRangeHighValue);var k={};k.lo=_(i,h.DeviationRangeLowValue);k.hi=_(i,h.DeviationRangeHighValue);var A={};A.lo=_(i,h.AcceptanceRangeLowValue);A.hi=_(i,h.AcceptanceRangeHighValue);T.fillOmit(A,j,k);T.checkThreshold(D,A,j,k);};};c.ConstantThresholds.validate=function(o,m){var e=o[m].ConstantThresholds;if(S.indexOf(e.ImprovementDirection)===-1){throw new a('error','Colorings.Criticality.ConstantThresholds','ImprovementDirection should be one of \'Maximize\', \'Minimize\' and \'Target\'.');}return{supportHeatMap:true};};c.ConstantThresholds.parse=function(o,e,p,m,L){var h=o.settings[o.type];var i=o.msr?o.msr.getName():undefined;var j=o.msr?o.msr.getLabel()||o.msr.getName():undefined;var D=h.ImprovementDirection.toLowerCase();var k={lo:o.byAggregation.ToleranceRangeLowValue,hi:o.byAggregation.ToleranceRangeHighValue};var n={lo:o.byAggregation.DeviationRangeLowValue,hi:o.byAggregation.DeviationRangeHighValue};var A={lo:o.byAggregation.AcceptanceRangeLowValue,hi:o.byAggregation.AcceptanceRangeHighValue};T.fillOmit(A,k,n);T.checkThreshold(D,A,k,n,true);if(m){p.legend=T.MBCimprovement(D,A,k,n);}else{p.callbacks=T.improvement(D,i,A,k,n);p.legend=c.ConstantThresholds.getLegend(D,j,A,k,n,L);}};var g="\u2265";var l="<";var d="\u2264";var f=">";var s={"<":">",">":"<","\u2265":"\u2264","\u2264":"\u2265"};c.ConstantThresholds.getLegend=function(D,m,A,o,h,L){var i={};var j=h.hi;var k=h.lo;var n=o.hi;var p=o.lo;var r=A.hi;var u=A.lo;function v(y,z,B){var E=y.length;var F=y[0]===Number.POSITIVE_INFINITY;var G=y[0]===Number.NEGATIVE_INFINITY;var H=y[E-1]===Number.POSITIVE_INFINITY;var I=y[E-1]===Number.NEGATIVE_INFINITY;if(B&&y[0]===y[E-1]){return"";}if(z){if(E===5&&!(G&&H)){if(H||I){y=y.slice(0,3);}if(F||G){y=y.slice(2);}if(y.length<=1){return"";}}else if(E===3&&(F||G||H||I)){return"";}}y=y.map(function(e){if(e===Number.POSITIVE_INFINITY){return L.getText("POSITIVE_INFINITY");}else if(e===Number.NEGATIVE_INFINITY){return L.getText("NEGATIVE_INFINITY");}return e;});if(y.length===3&&C.isNumber(y[0])){var J=s[y[1]];y=[y[2],J,y[0]];}return y.join(" ");}var w=function(e){return e&&e.length>0;};var x=function(e){return e.filter(w).join(' , ');};switch(D){case'maximize':i={Positive:v([m,g,u]),Critical:v([k,d,m,l,p],true),Neutral:v([p,d,m,l,u],true),Negative:v([m,l,k])};break;case'minimize':i={Positive:v([m,d,r]),Critical:v([n,l,m,d,j],true),Neutral:v([r,l,m,d,n],true),Negative:v([m,f,j])};break;case'target':i={Positive:v([u,d,m,d,r],true),Critical:x([v([k,d,m,l,p],true,true),v([n,l,m,d,j],true,true)]),Neutral:x([v([p,d,m,l,u],true,true),v([r,l,m,d,n],true,true)]),Negative:x([v([m,l,k],true),v([m,f,j],true)])};break;default:}return i;};c.ConstantThresholds.getContextHandler=function(e,m){if(m){var o=e[0];var h=o.msr.getName();var L=o.parsed.legend;return function(i){var v=i.getProperty(h);L.min=Math.min(L.min,v);L.max=Math.max(L.max,v);};}else{return null;}};c.getLegend=function(o,L){var D={};q.each(b,function(k,v){D[v]=L.getText("COLORING_TYPE_"+v.toUpperCase());});return q.extend(true,{},D,o.settings.Legend);};return c;});
  