@eclipse-scout/chart 23.1.1 → 23.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import*as R from"@eclipse-scout/core";import*as Ft from"chart.js";import"chart.js/auto";import*as Vt from"chartjs-plugin-datalabels";var M={};M.n=o=>{var t=o&&o.__esModule?()=>o.default:()=>o;return M.d(t,{a:t}),t},M.d=(o,t)=>{for(var e in t)M.o(t,e)&&!M.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:t[e]})},M.o=(o,t)=>Object.prototype.hasOwnProperty.call(o,t),M.r=o=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})};var S={};M.r(S),M.d(S,{AbstractChartRenderer:()=>ot,AbstractSvgChartRenderer:()=>I,Chart:()=>u,ChartAdapter:()=>Ot,ChartField:()=>Et,ChartFieldAdapter:()=>Mt,ChartFieldTile:()=>It,ChartFieldTileAdapter:()=>Dt,ChartJsRenderer:()=>X,ChartLayout:()=>gt,ChartTableControl:()=>Q,ChartTableControlAdapter:()=>wt,ChartTableControlLayout:()=>Bt,ChartTableUserFilter:()=>z,FulfillmentChartRenderer:()=>Ct,SalesfunnelChartRenderer:()=>xt,SpeedoChartRenderer:()=>x,VennAsync3Calculator:()=>Tt,VennChartRenderer:()=>At,VennCircle:()=>W,VennCircleHelper:()=>vt,default:()=>Ht});var lt={};M.r(lt),M.d(lt,{AbstractChartRenderer:()=>ot,AbstractSvgChartRenderer:()=>I,Chart:()=>u,ChartAdapter:()=>Ot,ChartField:()=>Et,ChartFieldAdapter:()=>Mt,ChartFieldTile:()=>It,ChartFieldTileAdapter:()=>Dt,ChartJsRenderer:()=>X,ChartLayout:()=>gt,ChartTableControl:()=>Q,ChartTableControlAdapter:()=>wt,ChartTableControlLayout:()=>Bt,ChartTableUserFilter:()=>z,FulfillmentChartRenderer:()=>Ct,SalesfunnelChartRenderer:()=>xt,SpeedoChartRenderer:()=>x,VennAsync3Calculator:()=>Tt,VennChartRenderer:()=>At,VennCircle:()=>W,VennCircleHelper:()=>vt,default:()=>Ht});var $t=o=>{var t={};return M.d(t,o),t},er=o=>()=>o;const h=$t({AbstractLayout:()=>R.AbstractLayout,DateColumn:()=>R.DateColumn,FormField:()=>R.FormField,FormFieldAdapter:()=>R.FormFieldAdapter,FormFieldTile:()=>R.FormFieldTile,FormFieldTileAdapter:()=>R.FormFieldTileAdapter,HtmlComponent:()=>R.HtmlComponent,Icon:()=>R.Icon,ModelAdapter:()=>R.ModelAdapter,NumberColumn:()=>R.NumberColumn,ObjectFactory:()=>R.ObjectFactory,RoundingMode:()=>R.RoundingMode,TableControl:()=>R.TableControl,TableControlAdapter:()=>R.TableControlAdapter,TableMatrix:()=>R.TableMatrix,TableUserFilter:()=>R.TableUserFilter,Tooltip:()=>R.Tooltip,Widget:()=>R.Widget,arrays:()=>R.arrays,colorSchemes:()=>R.colorSchemes,graphics:()=>R.graphics,icons:()=>R.icons,numbers:()=>R.numbers,objects:()=>R.objects,scout:()=>R.scout,scrollbars:()=>R.scrollbars,strings:()=>R.strings,styles:()=>R.styles,tooltips:()=>R.tooltips}),jt=require("jquery");var C=M.n(jt);function D(o,t,e){return t=Ut(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function Ut(o){var t=Wt(o,"string");return typeof t=="symbol"?t:String(t)}function Wt(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class u extends h.Widget{constructor(){super(),D(this,"data",void 0),D(this,"config",void 0),D(this,"checkedItems",void 0),D(this,"chartRenderer",void 0),D(this,"_updatedOnce",void 0),D(this,"_updateChartTimeoutId",void 0),D(this,"_updateChartOpts",void 0),D(this,"_updateChartOptsWhileNotAttached",void 0),this.$container=null,this.data=null,this.config=null,this.checkedItems=[],this.chartRenderer=null,this._updateChartTimeoutId=null,this._updateChartOpts=null,this._updateChartOptsWhileNotAttached=[],this._updatedOnce=!1}_init(t){super._init(t),this.setConfig(this.config),this._setData(this.data)}_render(){this.$container=this.$parent.appendDiv("chart"),this.htmlComp=h.HtmlComponent.install(this.$container,this.session),this.htmlComp.setLayout(new gt(this))}_renderProperties(){super._renderProperties(),this._renderClickable(),this._renderCheckable(),this._renderChartType(),this._renderColorScheme(),this.updateChart({requestAnimation:!0,debounce:u.DEFAULT_DEBOUNCE_TIMEOUT})}_renderOnAttach(){super._renderOnAttach(),this._updateChartOptsWhileNotAttached.splice(0).forEach(t=>this.updateChart(C().extend(!0,{},t,{debounce:!0})))}_remove(){this.chartRenderer&&this.chartRenderer.remove(!1),this.$container.remove(),this.$container=null}setData(t){this.setProperty("data",t),this.setCheckedItems(this.checkedItems)}_setData(t){t&&(t=C().extend({axes:[]},t)),this._setProperty("data",t)}_renderData(){this.updateChart({requestAnimation:!0,debounce:u.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0})}setConfig(t){let e={type:u.Type.PIE,options:{autoColor:!0,colorScheme:h.colorSchemes.ColorSchemeId.DEFAULT,transparent:!1,maxSegments:5,adjustGridMaxMin:!0,clickable:!1,checkable:!1,animation:{duration:u.DEFAULT_ANIMATION_DURATION},plugins:{datalabels:{display:!1},tooltip:{enabled:!0},legend:{display:!0,clickable:!1,position:u.Position.RIGHT}}}};if(t=C().extend(!0,{},e,t),t.options.colorScheme=h.colorSchemes.ensureColorScheme(t.options.colorScheme),h.objects.equalsRecursive(this.config,t))return;let r=C().extend(!0,{},this.config);t.data?r.data=t.data:delete r.data;let a=(i,s,l)=>{if(!(!i||!s||!l)){if(!i.options||!i.options[l]){s.options&&delete s.options[l],s.options&&h.objects.isEmpty(s.options.scales)&&!(i.options&&i.options.scales)&&delete s.options.scales,h.objects.isEmpty(s.options)&&!i.options&&delete s.options;return}s.options[l]=i.options[l]}};if(a(t,r,"xLabelMap"),a(t,r,"yLabelMap"),h.objects.equalsRecursive(r,t)){this._setProperty("config",t),this.rendered&&this._renderConfig(!0),this.setCheckedItems(this.checkedItems);return}this.rendered&&this.config&&this.config.type&&this.$container.removeClass(this.config.type+"-chart"),this.setProperty("config",t),this.setCheckedItems(this.checkedItems),this._updateChartRenderer()}_renderConfig(t){this._renderClickable(),this._renderCheckable(),this._renderChartType(),this._renderColorScheme(),this.updateChart({requestAnimation:!0,debounce:u.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:t})}setCheckedItems(t){this.setProperty("checkedItems",h.arrays.ensure(this._filterCheckedItems(t)))}_filterCheckedItems(t){if(!Array.isArray(t))return t;let e=[];this.data&&this.data.chartValueGroups?this.data.chartValueGroups.forEach(a=>e.push(a.values.length)):this.config&&this.config.data&&this.config.data.datasets.forEach(a=>e.push(a.data.length));let r=t.filter(a=>e[a.datasetIndex]&&a.dataIndex<e[a.datasetIndex]);return r.length<t.length?r:t}_renderCheckedItems(){this.chartRenderer&&this.chartRenderer.renderCheckedItems()}_renderEnabled(){this.updateChart()}_renderClickable(){this.$container.toggleClass("clickable",this.config.options.clickable)}_renderCheckable(){this.$container.toggleClass("checkable",this.config.options.checkable)}_renderChartType(){this.$container.addClass(this.config.type+"-chart")}_renderColorScheme(){h.colorSchemes.toggleColorSchemeClasses(this.$container,this.config.options.colorScheme)}updateChart(t){t=t||{},t.onlyUpdateData=t.onlyUpdateData&&this.chartRenderer&&this.chartRenderer.isDataUpdatable(),t.enforceRerender=!t.onlyUpdateData&&!t.onlyRefresh,this._updateChartTimeoutId&&(clearTimeout(this._updateChartTimeoutId),this._updateChartOpts&&(t.requestAnimation=t.requestAnimation||this._updateChartOpts.requestAnimation,t.onlyUpdateData=t.onlyUpdateData||this._updateChartOpts.onlyUpdateData,t.onlyRefresh=t.onlyRefresh||this._updateChartOpts.onlyRefresh,t.enforceRerender=t.enforceRerender||this._updateChartOpts.enforceRerender),this._updateChartTimeoutId=null,this._updateChartOpts=null);let e=a.bind(this);t.debounce===!0||typeof t.debounce=="number"?(this._updateChartOpts=t,typeof t.debounce=="number"?this._updateChartTimeoutId=setTimeout(e,t.debounce):this._updateChartTimeoutId=setTimeout(e)):e();function a(){if(this._updateChartTimeoutId=null,this._updateChartOpts=null,!this.$container||!this.$container.isAttached()){this._updateChartOptsWhileNotAttached.push(t);return}this._updatedOnce=!0,this.chartRenderer&&(t.enforceRerender?this.chartRenderer.remove(this.chartRenderer.shouldAnimateRemoveOnUpdate(t),i=>{this.removing||i||(this.chartRenderer.render(t.requestAnimation),this.trigger("chartRender"))}):t.onlyUpdateData?this.chartRenderer.updateData(t.requestAnimation):t.onlyRefresh&&this.chartRenderer.refresh())}}_resolveChartRenderer(){switch(this.config.type){case u.Type.FULFILLMENT:return new Ct(this);case u.Type.SPEEDO:return new x(this);case u.Type.SALESFUNNEL:return new xt(this);case u.Type.VENN:return new At(this);case u.Type.BAR:case u.Type.BAR_HORIZONTAL:case u.Type.LINE:case u.Type.COMBO_BAR_LINE:case u.Type.PIE:case u.Type.DOUGHNUT:case u.Type.POLAR_AREA:case u.Type.RADAR:case u.Type.BUBBLE:case u.Type.SCATTER:return new X(this)}return null}_updateChartRenderer(){this.chartRenderer&&this.chartRenderer.remove(),this.setProperty("chartRenderer",this._resolveChartRenderer())}handleValueClick(t,e){if(this.config.options.checkable){let r=[...this.checkedItems],a=r.filter(i=>i.datasetIndex===t.datasetIndex&&i.dataIndex===t.dataIndex)[0];a?h.arrays.remove(r,a):r.push(t),this.setCheckedItems(r)}this.trigger("valueClick",{data:t,originalEvent:e})}}D(u,"Type",{PIE:"pie",LINE:"line",BAR:"bar",BAR_HORIZONTAL:"horizontalBar",COMBO_BAR_LINE:"comboBarLine",FULFILLMENT:"fulfillment",SPEEDO:"speedo",SALESFUNNEL:"salesfunnel",VENN:"venn",DOUGHNUT:"doughnut",POLAR_AREA:"polarArea",RADAR:"radar",BUBBLE:"bubble",SCATTER:"scatter"}),D(u,"Position",{TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center"}),D(u,"DEFAULT_ANIMATION_DURATION",600),D(u,"DEFAULT_DEBOUNCE_TIMEOUT",100);class Ot extends h.ModelAdapter{_onWidgetValueClick(t){this._send("valueClick",t.data)}_onWidgetEvent(t){t.type==="valueClick"?this._onWidgetValueClick(t):super._onWidgetEvent(t)}}function zt(o,t,e){return t=Xt(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function Xt(o){var t=Yt(o,"string");return typeof t=="symbol"?t:String(t)}function Yt(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class gt extends h.AbstractLayout{constructor(t){super(),zt(this,"chart",void 0),this.chart=t}layout(t){let e={requestAnimation:!0,debounce:u.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0};(!this.chart.session.ready||this.chart._updatedOnce)&&(e.requestAnimation=!1),this.chart.session.ready||(e.debounce=!1),this.chart.updateChart(e)}}function et(o,t,e){return t=Jt(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function Jt(o){var t=Kt(o,"string");return typeof t=="symbol"?t:String(t)}function Kt(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class ot{constructor(t){et(this,"chart",void 0),et(this,"session",void 0),et(this,"rendering",void 0),et(this,"rendered",void 0),et(this,"animationDuration",void 0),et(this,"firstOpaqueBackgroundColor",void 0),this.chart=t,this.session=t.session,this.rendering=!1,this.rendered=!1,this.animationDuration=0,this.firstOpaqueBackgroundColor=""}validate(){return this._validateChartData()?this._validate():!1}_validateChartData(){let t=this.chart&&this.chart.data;if(!t||!t.chartValueGroups||t.chartValueGroups.length===0)return!1;let e,r=0;for(e=0;e<t.chartValueGroups.length;e++){let a=t.chartValueGroups[e];if(!a.values)return!1;if(e===0)r=a.values.length;else if(a.values.length!==r)return!1;if(!this.chart.config.options.autoColor&&!a.colorHexValue&&!a.cssClass)return!1}for(e=0;e<t.axes.length;e++)if(t.axes[e].length!==r)return!1;return!0}_validate(){return!0}render(t){this.animationDuration=t?this.chart.config.options.animation.duration:0,!(!this.validate()||!this.chart.rendered)&&(this.rendering=!0,this._render(),this.rendering=!1,this.rendered=!0)}_render(){}renderCheckedItems(){this.rendered&&this._renderCheckedItems()}_renderCheckedItems(){}updateData(t){if(!this.rendered){this.render(t);return}this.animationDuration=t?this.chart.config.options.animation.duration:0,!(!this.validate()||!this.isDataUpdatable())&&this._updateData()}_updateData(){}isDataUpdatable(){return!1}refresh(){this.rendered&&this.remove(!1),this.render(!1)}remove(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=arguments.length>1?arguments[1]:void 0;this.animationDuration=t&&this.chart.config.options.animation.duration,this.animationDuration&&this.rendered?this._removeAnimated(e):this._remove(e)}_remove(t){this.rendered=!1,t&&t()}_removeAnimated(t){this._remove(t)}shouldAnimateRemoveOnUpdate(t){return t.requestAnimation}}function w(o,t,e){return t=qt(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function qt(o){var t=Zt(o,"string");return typeof t=="symbol"?t:String(t)}function Zt(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class I extends ot{constructor(t){super(t),w(this,"chartBox",void 0),w(this,"clipId",void 0),w(this,"maskId",void 0),w(this,"suppressLegendBox",void 0),w(this,"height",void 0),w(this,"width",void 0),w(this,"chartAnimationStopping",void 0),w(this,"$svg",void 0),this.chartBox=null,this.clipId="Clip-"+h.ObjectFactory.get().createUniqueId(),this.maskId="Mask-"+h.ObjectFactory.get().createUniqueId(),this.suppressLegendBox=!1}_render(){this.$svg||(this.$svg=this.chart.$container.appendSVG("svg","chart-svg")),this.firstOpaqueBackgroundColor=h.styles.getFirstOpaqueBackgroundColor(this.$svg),this.height=this.$svg.height(),this.width=this.$svg.width(),this._initChartBox(),this._useFontSizeBig()?this.$svg.addClass(I.FONT_SIZE_BIG):this._useFontSizeMiddle()?this.$svg.addClass(I.FONT_SIZE_MIDDLE):this._useFontSizeSmall()?this.$svg.addClass(I.FONT_SIZE_SMALL):this._useFontSizeSmallest()&&this.$svg.addClass(I.FONT_SIZE_SMALLEST),this.$svg.isAttached()&&this._renderInternal()}_renderInternal(){}_useFontSizeBig(){return!1}_useFontSizeMiddle(){return!1}_useFontSizeSmall(){return!1}_useFontSizeSmallest(){return!1}remove(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=arguments.length>1?arguments[1]:void 0;this.rendered&&!this.chartAnimationStopping&&(this.chartAnimationStopping=!0,this.$svg.children().stop(!0,!1),this.chartAnimationStopping=!1),super.remove(t,e)}_remove(t){this.rendered&&(this.$svg.children().stop(!0,!1),this.rendered&&(this.$svg.remove(),this.$svg=null)),this.rendered=!1,t&&t(this.chartAnimationStopping)}_createClickObject(t,e){return{xIndex:t,dataIndex:t,datasetIndex:e}}_measureText(t,e){let r=this.$svg.appendSVG("text",e).attr("x",0).attr("y",0).attr("visibility","hidden").text(t),a;try{a=r[0].getBBox()}catch{return{height:0,width:0}}return r.remove(),a}_renderLine(t,e,r,a,i){let s=this.$svg.appendSVG("line",i).attr("x1",t).attr("y1",e).attr("x2",r).attr("y2",a);return this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),s}_renderLineLabel(t,e,r,a,i){let s=this.$svg.appendSVG("text",a||"line-label").attr("x",t).attr("y",e).text(r);if(i){s.attr("mask","url(#"+this.maskId+")");let l=this.$svg.appendSVG("text",a?a+" background":"line-label-background").attr("x",t).attr("y",e).attr("clip-path","url(#"+this.clipId+")").text(r);s.data("$background",l),this.animationDuration&&l.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}return this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),s}_initChartBox(){this.chartBox={width:this.width,height:this.height,xOffset:0,yOffset:0,mX:function(){return this.xOffset+this.width/2},mY:function(){return this.yOffset+this.height/2}}}_createAnimationObjectWithTabIndexRemoval(t,e){return{step:function(r,a){try{t.bind(this)(r,a)}catch(i){throw C()(this).stop(!0,!1),i}},duration:e||u.DEFAULT_ANIMATION_DURATION,complete:function(){C()(this).removeAttr("tabindex")}}}_addClipping(t){let e=this.$svg.appendSVG("clipPath");e[0].id=this.clipId;let r=this.$svg.appendSVG("mask");r.appendSVG("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height","100%").attr("fill","white"),r[0].id=this.maskId,this.chart.$container.find("."+t).each(function(a){this.id="ClipMask-"+h.ObjectFactory.get().createUniqueId(),e.appendSVG("use").attrXLINK("href","#"+this.id),r.appendSVG("use").attrXLINK("href","#"+this.id)})}_renderWireLegend(t,e,r,a){if(!this.chart.config.options.plugins.tooltip.enabled)return{detachFunc:()=>{},attachFunc:()=>{},removeFunc:()=>{}};let i={},s=5,l,d=0,n=17,c=n;a&&(l=this.$svg.appendSVG("rect","wire-legend-background-box").attr("opacity","1"));let p=e,f,m=0,y=0;if(p.h===-1?y=p.x2-2*s:y=this.width-p.x2-2*s,Array.isArray(t))for(let _=0;_<t.length;_++){let T=t.length-_-1,A=p.y2+p.v*s-n*T-s*T,B=this._renderLineLabel(p.x2+s,A,h.strings.truncateText(t[_],y,this._measureText.bind(this)),"",a);B.addClass(r),m=Math.max(m,B[0].getComputedTextLength()),_===0?f=B:f.data("lines")?f.data("lines").push(B):f.data("lines",[B])}else f=this._renderLineLabel(p.x2+s,p.y2+p.v*s,h.strings.truncateText(t,y,this._measureText.bind(this)),"",a),f.addClass(r),m=f[0].getComputedTextLength();if(d=m+2*s,e.autoPosition&&(p=e.posFunc.call(this,d,c),f.attr("x",p.x2+s),f.attr("y",p.y2+p.v*s)),p.h===-1?(f.attr("x",p.x2-s-m),f.css("text-anchor","left"),f.data("lines")&&f.data("lines").forEach(_=>{_.attr("x",p.x2-s-m),_.css("text-anchor","left")})):(f.attr("x",p.x2+s),f.css("text-anchor","right"),f.data("lines")&&f.data("lines").forEach(_=>{_.attr("x",p.x2+s),_.css("text-anchor","right")})),p.v===1)f.data("lines")&&f.data("lines").forEach((_,T)=>{_.attr("y",p.x2-s-m);let A=1+T;_.attr("y",p.y2+p.v*s+n*A+s*(A+1))}),f.attr("dy","0.7em");else if(f.data("lines")){let _=f.data("lines").length;f.attr("y",p.y2+p.v*s-n*_-s*_),f.data("lines").forEach((T,A)=>{_=f.data("lines").length-1-A,T.attr("y",p.y2+p.v*s-n*_-s*_)})}f.add(f.data("lines")).each((_,T)=>{let A=C()(T),B=A.data("$background");B&&(B.attr("x",A.attr("x")),B.attr("y",A.attr("y")),B.css("text-anchor",A.css("text-anchor")),B.attr("dy",A.attr("dy")))});let b=[];p.x1>0&&p.y1>0&&(b.push(this._renderLine(p.x1,p.y1,p.x2,p.y2,"label-line")),b.push(this._renderLine(p.x2,p.y2,p.x2+p.h*(m+2*s),p.y2,"label-line"))),f.data("wires",b);let g=this.$svg;return i.detachFunc=()=>{f.data("wires").forEach(_=>{_.detach()}),f.data("lines")&&f.data("lines").forEach(_=>{_.data("$background")&&g.append(_.data("$background")),_.detach()}),f.data("$background")&&f.data("$background").remove(),f.detach()},i.attachFunc=()=>{g.append(f),f.data("$background")&&g.append(f.data("$background")),g.append(f.data("wires")),f.data("lines")&&f.data("lines").forEach(_=>{g.append(_),_.data("$background")&&g.append(_.data("$background"))})},i.removeFunc=()=>{f.data("wires").forEach(_=>{_.remove()}),f.data("lines")&&f.data("lines").forEach(_=>{_.data("$background")&&_.data("$background").remove(),_().remove()}),f.data("$background")&&f.data("$background").remove(),f.remove()},i.$field=f,i}}w(I,"FONT_SIZE_SMALLEST","smallestFont"),w(I,"FONT_SIZE_SMALL","smallFont"),w(I,"FONT_SIZE_MIDDLE","middleFont"),w(I,"FONT_SIZE_BIG","bigFont");var Qt=o=>{var t={};return M.d(t,o),t},rr=o=>()=>o;const L=Qt({Chart:()=>Ft.Chart});var te=o=>{var t={};return M.d(t,o),t},ar=o=>()=>o;const ir=te({});var ee=o=>{var t={};return M.d(t,o),t},sr=o=>()=>o;const yt=ee({default:()=>Vt.default});function v(o,t,e){return t=re(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function re(o){var t=ae(o,"string");return typeof t=="symbol"?t:String(t)}function ae(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}L.Chart.register(yt.default),C().extend(!0,L.Chart.defaults,{maintainAspectRatio:!1,elements:{line:{borderWidth:2},point:{radius:0,hitRadius:10,hoverRadius:7,hoverBorderWidth:2},arc:{borderWidth:1},bar:{borderWidth:1,borderSkipped:""}},plugins:{legend:{labels:{usePointStyle:!0,boxHeight:7}}}}),C().extend(!0,L.Chart.overrides,{line:{elements:{point:{borderWidth:2}}},scatter:{elements:{point:{radius:3}}}});let Pt=!1;const ie=(1+Math.sqrt(5))/2;class X extends ot{constructor(t){super(t),v(this,"chartJs",void 0),v(this,"onlyIntegers",void 0),v(this,"maxXAxesTicksHeight",void 0),v(this,"numSupportedColors",void 0),v(this,"colorSchemeCssClass",void 0),v(this,"minRadialChartDatalabelSpace",void 0),v(this,"resetDatasetAfterHover",void 0),v(this,"legendHoverDatasets",void 0),v(this,"removing",void 0),v(this,"$canvas",void 0),v(this,"_labelFormatter",void 0),v(this,"_xLabelFormatter",void 0),v(this,"_yLabelFormatter",void 0),v(this,"_xAxisFitter",void 0),v(this,"_yAxisFitter",void 0),v(this,"_radialChartDatalabelsDisplayHandler",void 0),v(this,"_radialChartDatalabelsFormatter",void 0),v(this,"_datalabelsFormatter",void 0),v(this,"_datalabelBackgroundColorHandler",void 0),v(this,"_legendLabelGenerator",void 0),v(this,"_clickHandler",void 0),v(this,"_hoverHandler",void 0),v(this,"_pointerHoverHandler",void 0),v(this,"_legendClickHandler",void 0),v(this,"_legendHoverHandler",void 0),v(this,"_legendPointerHoverHandler",void 0),v(this,"_legendLeaveHandler",void 0),v(this,"_legendPointerLeaveHandler",void 0),v(this,"_resizeHandler",void 0),v(this,"_tooltipTitleGenerator",void 0),v(this,"_tooltipItemsGenerator",void 0),v(this,"_tooltipLabelGenerator",void 0),v(this,"_tooltipLabelValueGenerator",void 0),v(this,"_tooltipLabelColorGenerator",void 0),v(this,"_tooltipRenderer",void 0),v(this,"_tooltip",void 0),v(this,"_tooltipTimeoutId",void 0),v(this,"_updatingDatalabels",void 0),this.chartJs=null,this.onlyIntegers=!0,this.maxXAxesTicksHeight=75,this.numSupportedColors=6,this.colorSchemeCssClass="",this.minRadialChartDatalabelSpace=25,this._labelFormatter=this._formatLabel.bind(this),this._xLabelFormatter=this._formatXLabel.bind(this),this._yLabelFormatter=this._formatYLabel.bind(this),this._xAxisFitter=this._fitXAxis.bind(this),this._yAxisFitter=this._fitYAxis.bind(this),this._radialChartDatalabelsDisplayHandler=this._displayDatalabelsOnRadialChart.bind(this),this._radialChartDatalabelsFormatter=this._formatDatalabelsOnRadialChart.bind(this),this._datalabelsFormatter=this._formatDatalabels.bind(this),this._datalabelBackgroundColorHandler=this._getBackgroundColorOfDataset.bind(this),this._legendLabelGenerator=this._generateLegendLabels.bind(this),this.resetDatasetAfterHover=!1,this._clickHandler=this._onClick.bind(this),this._hoverHandler=this._onHover.bind(this),this._pointerHoverHandler=this._onHoverPointer.bind(this),this.legendHoverDatasets=[],this._legendClickHandler=this._onLegendClick.bind(this),this._legendHoverHandler=this._onLegendHover.bind(this),this._legendPointerHoverHandler=this._onLegendHoverPointer.bind(this),this._legendLeaveHandler=this._onLegendLeave.bind(this),this._legendPointerLeaveHandler=this._onLegendLeavePointer.bind(this),this._resizeHandler=this._onResize.bind(this),this._tooltipTitleGenerator=this._generateTooltipTitle.bind(this),this._tooltipItemsGenerator=this._generateTooltipItems.bind(this),this._tooltipLabelGenerator=this._generateTooltipLabel.bind(this),this._tooltipLabelValueGenerator=this._generateTooltipLabelValue.bind(this),this._tooltipLabelColorGenerator=this._generateTooltipLabelColor.bind(this),this._tooltipRenderer=this._renderTooltip.bind(this),this._tooltip=null,this._tooltipTimeoutId=null}_validateChartData(){let t=!0,e=this.chart&&this.chart.data;if((!e||!e.chartValueGroups||e.chartValueGroups.length===0||!e.axes)&&(t=!1),t&&h.scout.isOneOf(this.chart.config.type,u.Type.POLAR_AREA,u.Type.RADAR)){let i,s=0;for(i=0;i<e.chartValueGroups.length;i++){let l=e.chartValueGroups[i];l.values||(t=!1),i===0?s=l.values.length:l.values.length!==s&&(t=!1)}for(i=0;i<e.axes.length;i++)e.axes[i].length!==s&&(t=!1)}if(t)return!0;let r=!0,a=this.chart&&this.chart.config;if((!a||!a.data||!a.data.datasets||a.data.datasets.length===0)&&(r=!1),r&&h.scout.isOneOf(a.type,u.Type.POLAR_AREA,u.Type.RADAR)){let i,s=0;for(i=0;i<a.data.datasets.length;i++){let l=a.data.datasets[i];l.data||(r=!1),i===0?s=l.data.length:l.data.length!==s&&(r=!1)}}return r}_render(){this.$canvas||(this.$canvas=this.chart.$container.appendElement("<canvas>")),this.firstOpaqueBackgroundColor=h.styles.getFirstOpaqueBackgroundColor(this.$canvas),Pt||(L.Chart.defaults.font.family=this.$canvas.css("font-family"),Pt=!0);let t=C().extend(!0,{},this.chart.config);this._adjustConfig(t),this._renderChart(t,!0)}_renderChart(t,e){this.chartJs&&this.chartJs.destroy(),t=C().extend(!0,{},t,{options:{animation:{}}},t),t.options.animation.duration=e?this.animationDuration:0,this.chartJs=new L.Chart(this.$canvas[0].getContext("2d"),t),this._adjustSize(this.chartJs.config,this.chartJs.chartArea),this.chartJs.update()}_updateData(){if(!this.chartJs)return;let t=C().extend(!0,{},this.chart.config);this._adjustConfig(t);let e=this.chartJs.config.data,r=t.data,a=(n,c,p,f)=>{if(!n||!c||!p)return;if(!c[p]){let b=n[p];(b||f)&&(c[p]=b);return}if(!n[p]){if(f){c[p]=void 0;return}if(Array.isArray(c[p])){c[p].splice(0,c[p].length);return}c[p]=void 0;return}if(!Array.isArray(n[p])||!Array.isArray(c[p])){c[p]=n[p];return}for(let b=0;b<Math.min(n[p].length,c[p].length);b++)c[p][b]=n[p][b];let m=c[p].length,y=n[p].length;m>y?c[p].splice(y,m-y):m<y&&c[p].push(...n[p].splice(m))},i=(n,c)=>h.arrays.find(n,p=>p.datasetId===c),s=(n,c)=>h.arrays.findIndex(n,p=>p.datasetId===c);if(e&&r){a(r,e,"labels"),e.datasets||(e.datasets=[]),r.datasets||(r.datasets=[]),r.datasets.every(n=>h.objects.isNullOrUndefined(n.datasetId))&&(r.datasets.forEach((n,c)=>{n.datasetId=""+c}),e.datasets.forEach((n,c)=>{n.datasetId=""+c})),e.datasets.forEach(n=>{let c=i(r.datasets,n.datasetId);c&&(n.label=c.label,n.type=c.type,a(c,n,"data"),a(c,n,"backgroundColor",!0),a(c,n,"borderColor",!0),a(c,n,"hoverBackgroundColor",!0),a(c,n,"hoverBorderColor",!0),a(c,n,"legendColor",!0),a(c,n,"pointBackgroundColor",!0),a(c,n,"pointHoverBackgroundColor",!0),a(c,n,"pointBorderColor",!0),a(c,n,"pointHoverBorderColor",!0),a(c,n,"uncheckedBackgroundColor",!0),a(c,n,"uncheckedHoverBackgroundColor",!0),a(c,n,"checkedBackgroundColor",!0),a(c,n,"checkedHoverBackgroundColor",!0),a(c,n,"uncheckedPointBackgroundColor",!0),a(c,n,"uncheckedPointHoverBackgroundColor",!0),a(c,n,"checkedPointBackgroundColor",!0),a(c,n,"checkedPointHoverBackgroundColor",!0),a(c,n,"lineTension",!0),a(c,n,"pointRadius",!0),a(c,n,"uncheckedPointRadius",!0),a(c,n,"checkedPointRadius",!0),this._adjustDatasetBorderWidths(n))});for(let n=e.datasets.length-1;n>=0;n--){let c=e.datasets[n].datasetId;(h.objects.isNullOrUndefined(c)||s(r.datasets,c)===-1)&&e.datasets.splice(n,1)}e.datasets.sort((n,c)=>s(r.datasets,n.datasetId)-s(r.datasets,c.datasetId)),r.datasets.forEach((n,c)=>{let p=e.datasets[c];p&&p.datasetId&&n.datasetId===p.datasetId||e.datasets.splice(c,0,n)})}else this.chartJs.config.data=r;a(t.options,this.chartJs.config.options,"xLabelMap",!0),a(t.options,this.chartJs.config.options,"yLabelMap",!0),C().extend(!0,this.chartJs.config,{options:{animation:{duration:this.animationDuration}}});let l=this.chartJs.config.options.scales||{};[l.x||{},l.y||{},l.yDiffType||{},l.r||{}].forEach(n=>{(n.ticks||{}).stepSize=void 0}),this.chartJs.update(),this._adjustSize(this.chartJs.config,this.chartJs.chartArea),this.chartJs.update()}isDataUpdatable(){return!0}refresh(){this.chartJs?this.chartJs.update():super.refresh()}_renderCheckedItems(){this.chartJs&&this._checkItems(this.chartJs.config)&&this.chartJs.update()}_checkItems(t){if(!t||!t.data)return!1;let e=(a,i,s)=>{if(Array.isArray(a)&&Array.isArray(i)){let l=0;return h.arrays.ensure(s).filter(d=>!isNaN(d)&&d<Math.min(a.length,i.length)).forEach(d=>{a[d]!==i[d]&&(a[d]=i[d],l++)}),l}return 0},r=0;return t.data.datasets.forEach((a,i)=>{let s=this.chart.checkedItems.filter(d=>d.datasetIndex===i).map(d=>d.dataIndex),l=h.arrays.init(a.data.length,null).map((d,n)=>n);h.arrays.removeAll(l,s),r=r+e(a.backgroundColor,a.checkedBackgroundColor,s)+e(a.hoverBackgroundColor,a.checkedHoverBackgroundColor,s)+e(a.pointBackgroundColor,a.checkedPointBackgroundColor,s)+e(a.pointHoverBackgroundColor,a.checkedPointHoverBackgroundColor,s)+e(a.pointRadius,a.checkedPointRadius,s)+e(a.backgroundColor,a.uncheckedBackgroundColor,l)+e(a.hoverBackgroundColor,a.uncheckedHoverBackgroundColor,l)+e(a.pointBackgroundColor,a.uncheckedPointBackgroundColor,l)+e(a.pointHoverBackgroundColor,a.uncheckedPointHoverBackgroundColor,l)+e(a.pointRadius,a.uncheckedPointRadius,l),this._adjustDatasetBorderWidths(a)}),0<r}stopAnimations(){this.chartJs&&this.chartJs.stop()}_adjustConfig(t){!t||!t.type||(this._adjustType(t),this.chart.data&&this._computeDatasets(this.chart.data,t),this._adjustData(t),this._adjustTooltip(t),this._adjustGrid(t),this._adjustPlugins(t),this._adjustColors(t),this._adjustClickHandler(t),this._adjustResizeHandler(t))}_adjustType(t){if(t.type===u.Type.COMBO_BAR_LINE){t.type=u.Type.BAR;let e=(t.options||{}).scaleLabelByTypeMap;e&&(e[u.Type.BAR]=e[u.Type.COMBO_BAR_LINE])}else this._isHorizontalBar(t)&&(t.type=u.Type.BAR,t.options=C().extend(!0,{},t.options,{indexAxis:"y"}))}_computeDatasets(t,e){let r=[],a=[],i=(l,d)=>{C().isEmptyObject(d)||(e.options[l]=d)};(t.axes[0]||[]).forEach(l=>r.push(l.label));let s=this._isHorizontalBar(e);i(s?"yLabelMap":"xLabelMap",this._computeLabelMap(t.axes[0])),i(s?"xLabelMap":"yLabelMap",this._computeLabelMap(t.axes[1])),t.chartValueGroups.forEach(l=>a.push({type:l.type,label:l.groupName,data:C().extend(!0,[],l.values)})),e.data={labels:r,datasets:a}}_isHorizontalBar(t){return t&&(t.type===u.Type.BAR_HORIZONTAL||t.type===u.Type.BAR&&t.options&&t.options.indexAxis==="y")}_computeLabelMap(t){let e={};return(t||[]).forEach((r,a)=>{e[a]=r.label}),e}_adjustData(t){!t||!t.data||!t.type||(this._adjustBarBorderWidth(t),this._adjustMaxSegments(t),this._adjustBubbleRadii(t),this._adjustOnlyIntegers(t))}_adjustBarBorderWidth(t){!t||!t.data||!t.type||!h.scout.isOneOf(t.type,u.Type.BAR)||t.data.datasets.forEach(e=>{(e.type||u.Type.BAR)===u.Type.BAR&&(e.borderWidth=e.borderWidth||1,e.hoverBorderWidth=e.hoverBorderWidth||2,this._adjustDatasetBorderWidths(e))})}_adjustDatasetBorderWidths(t){this._adjustDatasetBorderWidth(t),this._adjustDatasetBorderWidth(t,!0)}_adjustDatasetBorderWidth(t,e){if(!t)return;let r=e?"hoverBorderWidth":"borderWidth",a=e?"hoverBorderWidthBackup":"borderWidthBackup",i=e?"hoverBackgroundColor":"backgroundColor",s=e?"hoverBorderColor":"borderColor";if(t[a]&&(t[r]=t[a],delete t[a]),!t[r]||h.objects.isFunction(t[r]))return;let l=Array.isArray(t[r]),d=Array.isArray(t[i]),n=Array.isArray(t[s]);if(!(l||d||n)&&t[i]===t[s]){t[a]=t[r],t[r]=0;return}let p=(t.data||[]).length;l?t[r].length<p&&t[r].push(...h.arrays.init(p-t[r].length,t[r][0])):t[r]=h.arrays.init(p,t[r]);let f=t[r],m=f.length,y=h.arrays.init(m,null);for(let b=0;b<m;b++){let g=d?t[i][b]:t[i],_=n?t[s][b]:t[s];y[b]=f[b],g===_&&(f[b]=0)}h.arrays.equals(f,y)||(t[a]=y)}_adjustMaxSegments(t){if(!t||!t.data||!t.type||!h.scout.isOneOf(t.type,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA,u.Type.RADAR))return;let e=t.options.maxSegments;if(!(e&&t.data.datasets.length&&e<t.data.datasets[0].data.length))return;t.data.datasets.forEach(a=>{let i=a.data.slice(0,e);i[e-1]=a.data.slice(e-1,a.data.length).reduce((s,l)=>s+l,0),a.data=i});let r=t.data.labels.slice(0,e);r[e-1]=this.chart.session.text("ui.OtherValues"),t.data.labels=r,t.data.maxSegmentsExceeded=!0}_isMaxSegmentsExceeded(t,e){return!h.scout.isOneOf(t.type,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA,u.Type.RADAR)||t.options.otherSegmentClickable||!t.data.maxSegmentsExceeded||!t.options.maxSegments?!1:t.options.maxSegments-1<=e}_adjustBubbleRadii(t){!t||!t.data||!t.type||t.type!==u.Type.BUBBLE||t.data.datasets.forEach(e=>e.data.forEach(r=>{isNaN(r.r)||(r.z=Math.pow(r.r,2)),r.r=1}))}_adjustOnlyIntegers(t){this.onlyIntegers=!0,!(!t||!t.data||!t.type)&&(h.scout.isOneOf(t.type,u.Type.BUBBLE,u.Type.SCATTER)?this.onlyIntegers=t.data.datasets.every(e=>e.data.every(r=>h.numbers.isInteger(r.x)&&h.numbers.isInteger(r.y))):this.onlyIntegers=t.data.datasets.every(e=>e.data.every(r=>h.numbers.isInteger(r))))}_adjustTooltip(t){if(!t)return;t.options=C().extend(!0,{},{plugins:{tooltip:{callbacks:{title:this._tooltipTitleGenerator,items:this._tooltipItemsGenerator,label:this._tooltipLabelGenerator,labelValue:this._tooltipLabelValueGenerator,labelColor:this._tooltipLabelColorGenerator}}}},t.options);let e=t.options.plugins.tooltip;!e.enabled||(e.enabled=!1,e.external=this._tooltipRenderer)}_generateTooltipTitle(t){if(!t||!t.length)return"";let e=t[0],r=e.chart,a=r.config,i=e.dataset,s=[];if(h.scout.isOneOf(a.type,u.Type.BUBBLE)){let l=a.options.scales.x,d=a.options.scales.y,n=this._getAxisLabels(a),c=l.ticks.callback(i.data[e.dataIndex].x,null,null);c&&s.push(this._createTooltipAttribute(n.x,h.strings.encode(c),!0));let p=d.ticks.callback(i.data[e.dataIndex].y,null,null);p&&s.push(this._createTooltipAttribute(n.y,h.strings.encode(p),!0))}else if(!h.scout.isOneOf(a.type,u.Type.SCATTER)){let l=r.data.labels[e.dataIndex];s.push(this._createTooltipAttribute(a.options.reformatLabels?this._formatLabel(l):l,"",!0))}return s}_getAxisLabels(t){let e=t.options.scales.x.title.text,r=t.options.scales.y.title.text;return e=this._resolveAxisLabel(e,X.ARROW_LEFT_RIGHT),r=this._resolveAxisLabel(r,"&nbsp;"+X.ARROW_UP_DOWN+"&nbsp;"),{x:e,y:r}}_resolveAxisLabel(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return h.objects.isFunction(t)&&(t=t(),t=h.objects.isString(t)?t:""),t?h.strings.encode(t):e}_generateTooltipItems(t,e,r,a){if(!t||!t.length)return"";let i=t[0],s=i.chart,l=s.config,d=!1,n=!1,c="";if(t.forEach(p=>{let{label:f,labelValue:m,labelColor:y}=this._getItemDetails(p,e,r,a);if(h.scout.isOneOf(l.type,u.Type.SCATTER)){let{x:b,y:g}=m;d||(d=h.objects.isString(b)),n||(n=h.objects.isString(g)),c+=this._createTooltipScatterAttribute(f,b,g,!1,y)}else c+=this._createTooltipAttribute(f,m,!1,y)}),h.scout.isOneOf(l.type,u.Type.SCATTER)){let p="<table><tbody>",f=this._getAxisLabels(l);p+=this._createTooltipScatterAttribute("",d?f.x:"",n?f.y:"",!0);let m="</tbody></table>";c=h.strings.box(p,c,m)}return c}_getItemDetails(t,e,r,a){let i,s,l;return h.objects.isFunction(e)&&(i=e(t),i=h.objects.isString(i)?i:""),h.objects.isFunction(r)&&(s=r(t),s=h.objects.isString(s)||h.objects.isPlainObject(s)?s:""),h.objects.isFunction(a)&&(l=a(t),l=h.objects.isPlainObject(l)&&l.backgroundColor||""),{label:i,labelValue:s,labelColor:l}}_generateTooltipLabel(t){return h.strings.encode(t.dataset.label)}_generateTooltipLabelValue(t){let e=t.chart.config,r=t.dataset;return e.type===u.Type.BUBBLE?h.strings.encode(this._formatLabel(r.data[t.dataIndex].z)):e.type===u.Type.SCATTER?{x:h.strings.encode(this._formatLabel(r.data[t.dataIndex].x)),y:h.strings.encode(this._formatLabel(r.data[t.dataIndex].y))}:h.strings.encode(this._formatLabel(r.data[t.dataIndex]))}_generateTooltipLabelColor(t){let e=t.chart.config,r=t.dataset,a,i,s,l;h.scout.isOneOf(r.type||e.type,u.Type.LINE,u.Type.BAR,u.Type.BAR_HORIZONTAL,u.Type.RADAR,u.Type.BUBBLE,u.Type.SCATTER)&&(s=r.borderColor,a=r.legendColor,l=t.datasetIndex),h.scout.isOneOf(e.type,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)&&(a=Array.isArray(r.legendColor)?r.legendColor[t.dataIndex]:r.legendColor,i=Array.isArray(r.backgroundColor)?r.backgroundColor[t.dataIndex]:r.backgroundColor,i=this._adjustColorOpacity(i,1),l=t.dataIndex),h.objects.isFunction(a)&&(a=a.call(t.chart,l));let d=a||i||s;if(!d||h.objects.isFunction(d)){let n;L.Chart.overrides[e.type]&&L.Chart.overrides[e.type].plugins&&L.Chart.overrides[e.type].plugins.tooltip&&L.Chart.overrides[e.type].plugins.tooltip.callbacks&&(n=L.Chart.overrides[e.type].plugins.tooltip.callbacks.labelColor),d=(n||L.Chart.defaults.plugins.tooltip.callbacks.labelColor).call(t.chart,t).backgroundColor}return{backgroundColor:d}}_createTooltipAttribute(t,e,r,a){return'<div class="'+(r?"attribute title":"attribute")+'">'+(a?'<div class="color" style="background-color:'+a+'"></div>':"")+(t?"<label>"+t+"</label>":"")+(e?'<div class="value">'+e+"</div>":"")+"</div>"}_createTooltipScatterAttribute(t,e,r,a,i){return'<tr class="'+(a?"attribute title":"attribute")+'"><td class="color-cell">'+(i?'<div class="color" style="background-color:'+i+'"></div>':"")+'</td><td class="label">'+t+"</td>"+(e?'<td class="value">'+e+"</td>":"")+(r?'<td class="value">'+r+"</td>":"")+"</tr>"}_renderTooltip(t){if(t.tooltip.opacity===0||t.tooltip.dataPoints.length<1){this._tooltipTimeoutId&&(clearTimeout(this._tooltipTimeoutId),this._tooltipTimeoutId=void 0),this._tooltip&&(this._tooltip.destroy(),this._tooltip=null);return}!!this._tooltip?this._renderTooltipLater(t):this._tooltipTimeoutId=setTimeout(()=>this._renderTooltipLater(t),h.tooltips.DEFAULT_TOOLTIP_DELAY)}_renderTooltipLater(t){if(!this.rendered||this.removing)return;let e=t.tooltip,r=e.dataPoints;if(r.length<1)return;let a=r[0];if(!a.chart.getDatasetMeta(a.datasetIndex).data[a.dataIndex])return;this._tooltip&&(this._tooltip.destroy(),this._tooltip=null);let s=e.options||{},l=s.callbacks||{},d=l.title,n=l.items,c=l.label,p=l.labelValue,f=l.labelColor,m="";h.objects.isFunction(d)&&(m+=h.arrays.ensure(d(r)).join("")),h.objects.isFunction(n)&&(m+=h.arrays.ensure(n(r,c,p,f)).join(""));let y=this._computeTooltipPositionAndOffset(a),b=h.graphics.offsetBounds(this.$canvas);b.x+=e.caretX+y.offsetX,b.y+=e.caretY+y.offsetY,b.height=y.height,this._tooltip=h.scout.create({objectType:h.Tooltip,parent:this.chart,$anchor:this.$canvas,text:m,htmlEnabled:!0,cssClass:h.strings.join(" ","chart-tooltip",s.cssClass),tooltipPosition:y.tooltipPosition,tooltipDirection:y.tooltipDirection,origin:b}),this._tooltip.render(),this._tooltip.$container.css("pointer-events","none");let g=!1,_=(s.titleFont||{}).family;_&&(this._tooltip.$container.css("--chart-tooltip-font-family",_),g=!0);let T=0;this._tooltip.$container.find("label").each((A,B)=>{T=Math.max(T,h.graphics.prefSize(C()(B)).width)}),T>0&&(this._tooltip.$container.css("--chart-tooltip-label-width",Math.min(T,120)+"px"),g=!0),g&&this._tooltip.position()}_computeTooltipPositionAndOffset(t){let e="top",r="right",a=0,i=0,s=0,l=t.chart,d=t.datasetIndex,n=t.dataIndex,c=l.config,p=c.data.datasets,f=p[d],m=f.data[n];if(this._isHorizontalBar(c))h.objects.isPlainObject(m)&&h.objects.isArray(m.x)&&m.x.length===2?r=(m.x[0]+m.x[1])/2<0?"left":"right":r=m<0?"left":"right";else if((f.type||c.type)===u.Type.BAR)e=m<0?"bottom":"top";else if(h.scout.isOneOf(c.type,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)){let y=l.getDatasetMeta(d).data[n].getProps(["startAngle","endAngle"]),b=y.startAngle,g=y.endAngle,_=(b+g)/2;e=0<=_&&_<Math.PI?"bottom":"top",r=-Math.PI/2<=_&&_<Math.PI/2?"right":"left"}else if(c.type===u.Type.RADAR){let b=l.getDatasetMeta(d).data[n].getProps(["angle"]).angle;e=0<=b&&b<Math.PI?"bottom":"top",r=-Math.PI/2<=b&&b<Math.PI/2?"right":"left"}else if(h.scout.isOneOf(c.type,u.Type.BUBBLE,u.Type.SCATTER)){let y=l.getDatasetMeta(d).data[n],b=l.chartArea,g=b.left+b.width/2;r=y.x<g?"left":"right"}if(this._isHorizontalBar(c)){let y=l.getDatasetMeta(d).data[n].getProps(["height","width"]);s=y.height;let b=y.width,g=b/(ie+1);i=-s/2,a=r==="left"?g:-g}else if(h.scout.isOneOf(c.type,u.Type.LINE,u.Type.BUBBLE,u.Type.SCATTER,u.Type.RADAR)||f.type===u.Type.LINE){let b=l.getDatasetMeta(d).data[n].options,g=b.hoverRadius+b.hoverBorderWidth;c.type===u.Type.BUBBLE&&(g+=m.r),s=2*g,i=-g}else if(h.scout.isOneOf(c.type,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)){let y=l.getDatasetMeta(d).data[n].getProps(["startAngle","endAngle","innerRadius","outerRadius"]),b=y.startAngle,g=y.endAngle,_=(b+g)/2,T=y.innerRadius,A=y.outerRadius,B=(A-T)/2;a=B*Math.cos(_),i=B*Math.sin(_)}return{tooltipPosition:e,tooltipDirection:r,offsetX:a,offsetY:i,height:s}}_adjustGrid(t){!t||(t.options=C().extend(!0,{},t.options),this._adjustScalesR(t),this._adjustScalesXY(t))}_adjustScalesR(t){if(!t||!t.type||!t.options)return;h.scout.isOneOf(t.type,u.Type.POLAR_AREA,u.Type.RADAR)&&(t.options=C().extend(!0,{},{scales:{r:{}}},t.options));let e=t.options,r=e?e.scales:{};r&&r.r&&(r.r=C().extend(!0,{},{minSpaceBetweenTicks:35,beginAtZero:!0,angleLines:{display:!1},ticks:{callback:this._labelFormatter},pointLabels:{font:{size:L.Chart.defaults.font.size}}},r.r))}_adjustScalesXY(t){!t||!t.type||!t.options||(h.scout.isOneOf(t.type,u.Type.BAR,u.Type.LINE,u.Type.BUBBLE)?t.options=C().extend(!0,{},{scales:{x:{minSpaceBetweenTicks:150},y:{minSpaceBetweenTicks:35}}},t.options):h.scout.isOneOf(t.type,u.Type.SCATTER)&&(t.options=C().extend(!0,{},{scales:{x:{minSpaceBetweenTicks:35,ticks:{padding:10}},y:{minSpaceBetweenTicks:35,ticks:{padding:10}}}},t.options)),this._adjustXAxis(t),this._adjustYAxis(t))}_adjustXAxis(t){if(!t||!t.type||!t.options||!t.options.scales||!t.options.scales.x)return;let e=t.type,r=t.options.scales;this._isHorizontalBar(t)||h.scout.isOneOf(e,u.Type.BUBBLE,u.Type.SCATTER)?r.x=C().extend(!0,{},{beginAtZero:this._isHorizontalBar(t),offset:e===u.Type.BUBBLE,grid:{drawBorder:!1,drawTicks:!1},ticks:{padding:5}},r.x):r.x=C().extend(!0,{},{offset:!0,grid:{display:!1,drawBorder:!1}},r.x),(this._isHorizontalBar(t)||h.scout.isOneOf(e,u.Type.BUBBLE,u.Type.SCATTER)||t.options.reformatLabels)&&(r.x=C().extend(!0,{},{ticks:{callback:this._xLabelFormatter}},r.x)),r.x.afterCalculateLabelRotation=this._xAxisFitter}_adjustYAxis(t){if(!t||!t.type||!t.options||!t.options.scales||!t.options.scales.y)return;let e=t.type,r=t.options.scales;this._isHorizontalBar(t)?r.y=C().extend(!0,{},{grid:{display:!1,drawBorder:!1}},r.y):r.y=C().extend(!0,{},{beginAtZero:!h.scout.isOneOf(e,u.Type.BUBBLE,u.Type.SCATTER),grid:{drawBorder:!1,drawTicks:!1},ticks:{padding:5}},r.y),(!this._isHorizontalBar(t)||t.options.reformatLabels)&&(r.y=C().extend(!0,{},{ticks:{callback:this._yLabelFormatter}},r.y)),r.y.afterFit=this._yAxisFitter}_adjustPlugins(t){this._adjustPluginsDatalabels(t)}_adjustPluginsDatalabels(t){if(!t||!t.type||!t.options||!t.options.plugins||!t.options.plugins.datalabels||!t.options.plugins.datalabels.display)return;let e=t.options.plugins;if(h.scout.isOneOf(t.type,u.Type.PIE,u.Type.DOUGHNUT)){e.datalabels=C().extend(!0,{},{formatter:this._radialChartDatalabelsFormatter},e.datalabels),e.datalabels.display=this._radialChartDatalabelsDisplayHandler,this._updatingDatalabels=!1;let r=t.options.animation||{},a=r.onProgress,i=r.onComplete,s=d=>{if(this._updatingDatalabels)return;this._updatingDatalabels=!0;let n=d.chart,c=n.getSortedVisibleDatasetMetas(),p=[...n.getActiveElements()],f=[];c.forEach((m,y)=>{m.data.forEach((b,g)=>{let _=h.arrays.findIndex(p,T=>T.datasetIndex===y&&T.index===g);_>0?p.splice(_,1):f.push({datasetIndex:y,index:g,element:b})})}),n["$"+yt.default.id]._actives=f,yt.default.afterEvent(n,null,null),this._updatingDatalabels=!1},l=(d,n)=>{s(d),n&&n(d)};t.options.animation=C().extend(!0,{},t.options.animation,{onProgress:d=>l(d,a),onComplete:d=>l(d,i)})}else h.scout.isOneOf(t.type,u.Type.BAR,u.Type.LINE,u.Type.POLAR_AREA,u.Type.RADAR,u.Type.BUBBLE)?(e.datalabels=C().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3},e.datalabels),e.datalabels.display="auto"):h.scout.isOneOf(t.type,u.Type.SCATTER)&&(e.datalabels=C().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3,anchor:"end",align:"top",offset:3},e.datalabels),e.datalabels.display="auto");if(t.options.reformatLabels){let r=a=>(i,s)=>{let l=a.call(s.chart,i,s);return this._formatLabel(l)};t.data&&t.data.datasets.forEach(i=>{i.datalabels&&i.datalabels.formatter&&(i.datalabels.formatter=r(i.datalabels.formatter))}),e.datalabels.formatter&&(e.datalabels.formatter=r(e.datalabels.formatter))}e.datalabels=C().extend(!0,{},{formatter:this._datalabelsFormatter},e.datalabels)}_formatLabel(t){return this._formatLabelMap(t,null,this._getNumberFormatter())}_getNumberFormatter(){if(this.chartJs&&this.chartJs.config&&this.chartJs.config.options)return this.chartJs.config.options.numberFormatter}_formatXLabel(t){return this._formatLabelMap(t,this._getXLabelMap(),this._getNumberFormatter())}_formatYLabel(t){return this._formatLabelMap(t,this._getYLabelMap(),this._getNumberFormatter())}_getXLabelMap(){return this._getLabelMap("xLabelMap")}_getYLabelMap(){return this._getLabelMap("yLabelMap")}_getLabelMap(t){if(this.chartJs&&this.chartJs.config&&this.chartJs.config.options)return this.chartJs.config.options[t]}_formatLabelMap(t,e,r){return e?e[t]:isNaN(t)?""+t:r?r(t,this._formatNumberLabel.bind(this)):this._formatNumberLabel(t)}_formatNumberLabel(t){if(isNaN(t))return""+t;let e=Math.abs(t),r="";if(e>=1e6){e=e/1e6,r=" "+this.chart.session.text("ui.Mio");let a=[this.chart.session.text("ui.Mrd"),this.chart.session.text("ui.Bio"),this.chart.session.text("ui.Brd"),this.chart.session.text("ui.Tri"),this.chart.session.text("ui.Trd")];for(let i=0;i<a.length&&e>=1e3;i++)e=e/1e3,r=" "+a[i]}return this.session.locale.decimalFormat.format(Math.sign(t)*e)+r}_fitXAxis(t){if(!t||t.labelRotation===0)return;let e=this.maxXAxesTicksHeight,r=L.Chart.defaults.font,a=L.Chart.defaults.scale.ticks,i=a.font||{},s,l;if(this.chartJs){let f=this.chartJs.chartArea,m=Math.abs(f.top-f.bottom);e=Math.min(e,m/3)}t.options&&t.options.ticks&&(l=t.options.ticks.maxRotation,s=(t.options.ticks.font||{}).size),l=l||a.maxRotation,s=s||i.size||r.size,isNaN(t.labelRotation)&&(t.labelRotation=l),t.height=isNaN(t.height)?e:Math.min(t.height,e);let d=t.labelRotation,n=(e-s*Math.sin((90-d)/180*Math.PI))/Math.sin(d/180*Math.PI);if(((t._labelSizes||{}).widest||{}).width>n){let f=t.ctx.measureText.bind(t.ctx);t.ticks.forEach(m=>{m.label=h.strings.truncateText(m.label,n,f)}),t._labelSizes=void 0}}_fitYAxis(t){if(!t)return;let e=0,r=0;if(t.options&&t.options.ticks&&(e=t.options.ticks.padding||0),t.options&&t.options.grid&&(r=t.options.grid.tickLength||0),((t._labelSizes||{}).widest||{}).width>t.maxWidth-e){let s=t.maxWidth-e-r,l=t.ctx.measureText.bind(t.ctx);t.ticks.forEach(d=>{d.label=h.strings.truncateText(d.label,s,l)})}}_displayDatalabelsOnRadialChart(t){let e=t.chart.getDatasetMeta(t.datasetIndex).data[t.dataIndex].getProps(["startAngle","endAngle","innerRadius","outerRadius"]),r=(e.outerRadius+e.innerRadius)/2,a=Math.min(e.endAngle-e.startAngle,Math.PI)/2,i=Math.abs(Math.sin(a))*r,s=i*2,l=e.outerRadius-e.innerRadius;return Math.min(s,l)>this.minRadialChartDatalabelSpace}_formatDatalabelsOnRadialChart(t,e){let r=this._computeSumOfVisibleElements(e),a=e.dataset,i=0,s=[];for(let l=0;l<e.dataIndex+1;l++){let d=a.data[l]/r*100-i,n=Math.round(d);i=n-d,s.push(n+"%")}return s[e.dataIndex]}_computeSumOfVisibleElements(t){let e=t.dataset,r=t.chart,a=0;for(let i=0;i<e.data.length;i++)r.getDataVisibility(i)&&(a+=e.data[i]);return a}_formatDatalabels(t,e){let r=e.chart.config;return r.type===u.Type.BUBBLE?this._formatLabel(t.z):r.type===u.Type.SCATTER?h.strings.join(" / ",this._formatLabel(t.x),this._formatLabel(t.y)):this._formatLabel(t)}_getBackgroundColorOfDataset(t){return t.dataset.backgroundColor}_adjustColors(t){this._adjustColorSchemeCssClass(t),this._adjustDatasetColors(t),this._adjustLegendColors(t),this._adjustScalesRColors(t),this._adjustScalesXYColors(t),this._adjustPluginColors(t)}_adjustColorSchemeCssClass(t){!t||!t.options||(this.colorSchemeCssClass=h.colorSchemes.getCssClasses(t.options.colorScheme).join(" "))}_adjustDatasetColors(t){if(!t||!t.data||!t.type)return;let e=t.data,r=t.type,a=t.options&&t.options.autoColor,i=t.options&&t.options.checkable,s=a&&h.scout.isOneOf(r,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA),l={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]};l=C().extend(!0,l,this._computeDatasetColors(t,s)),e.datasets.forEach((d,n)=>{let c=s?l.backgroundColors:l.backgroundColors[n],p=s?l.borderColors:l.borderColors[n],f=s?l.hoverBackgroundColors:l.hoverBackgroundColors[n],m=s?l.hoverBorderColors:l.hoverBorderColors[n],y=s?l.legendColors:l.legendColors[n],b=s?l.pointHoverColors:l.legendColors[n],g=(_,T)=>{typeof d[_]!="function"&&T&&T.length&&(d[_]=Array.isArray(T)?[...T]:T)};if(g("backgroundColor",c),g("borderColor",p),g("hoverBackgroundColor",f),g("hoverBorderColor",m),g("legendColor",y),(h.scout.isOneOf(r,u.Type.LINE,u.Type.RADAR)||r===u.Type.BAR&&d.type===u.Type.LINE)&&(g("pointHoverBackgroundColor",b),g("pointBorderColor",this.firstOpaqueBackgroundColor),g("pointHoverBorderColor",this.firstOpaqueBackgroundColor)),i){let _=d.data.length;if(h.scout.isOneOf(r,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA,u.Type.BUBBLE,u.Type.SCATTER)||r===u.Type.BAR&&(d.type||u.Type.BAR)===u.Type.BAR){let T=s?l.backgroundColors:h.arrays.init(_,l.backgroundColors[n]),A=s?l.hoverBackgroundColors:h.arrays.init(_,l.hoverBackgroundColors[n]),B=s?l.checkedBackgroundColors:h.arrays.init(_,l.checkedBackgroundColors[n]),V=s?l.checkedHoverBackgroundColors:h.arrays.init(_,l.checkedHoverBackgroundColors[n]);g("uncheckedBackgroundColor",T),g("uncheckedHoverBackgroundColor",A),g("checkedBackgroundColor",B),g("checkedHoverBackgroundColor",V),g("backgroundColor",d.uncheckedBackgroundColor),g("hoverBackgroundColor",d.uncheckedHoverBackgroundColor)}else if(h.scout.isOneOf(r,u.Type.LINE,u.Type.RADAR)||r===u.Type.BAR&&d.type===u.Type.LINE){let T=h.arrays.init(_,b),A=h.arrays.init(_,b),B=h.arrays.init(_,p),V=h.arrays.init(_,m||p);g("uncheckedPointBackgroundColor",T),g("uncheckedPointHoverBackgroundColor",A),g("checkedPointBackgroundColor",B),g("checkedPointHoverBackgroundColor",V),g("pointBackgroundColor",d.uncheckedPointBackgroundColor),g("pointHoverBackgroundColor",d.uncheckedPointHoverBackgroundColor);let rt=h.arrays.init(_,((t.options.elements||{}).point||{}).radius||L.Chart.defaults.elements.point.radius),at=h.arrays.init(_,(((t.options.elements||{}).point||{}).hoverRadius||L.Chart.defaults.elements.point.hoverRadius)-1);g("uncheckedPointRadius",rt),g("checkedPointRadius",at),g("pointRadius",d.uncheckedPointRadius)}}this._adjustDatasetBorderWidths(d)}),i&&this._checkItems(t)}_computeDatasetColors(t,e){if(!t||!t.data||!t.type)return{};let r=t.data,a=t.type,i={};if(t.options&&t.options.autoColor)i=this._computeDatasetColorsAutoColor(t,e);else if(i=this._computeDatasetColorsChartValueGroups(t,e),h.scout.isOneOf(a,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)){let s=this._computeBorderColor(a,0);i.borderColors=h.arrays.init(r.datasets.length,s),i.hoverBorderColors=i.borderColors}return i}_computeDatasetColorsAutoColor(t,e){if(!t||!t.data||!t.type||!t.options||!t.options.autoColor)return{};let r=t.data,a=t.type,i=t.options&&t.options.checkable,s=t.options&&t.options.transparent,l={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]},d=[];return e?d=h.arrays.init(r.datasets.length&&r.datasets[0].data.length||0,a):r.datasets.forEach(n=>d.push(n.type||a)),d.forEach((n,c)=>{l.backgroundColors.push(this._computeBackgroundColor(n,c,i||s)),l.borderColors.push(this._computeBorderColor(n,c)),l.hoverBackgroundColors.push(this._computeHoverBackgroundColor(n,c,i||s)),l.hoverBorderColors.push(this._computeHoverBorderColor(n,c)),l.checkedBackgroundColors.push(this._computeCheckedBackgroundColor(n,c,i)),l.checkedHoverBackgroundColors.push(this._computeCheckedHoverBackgroundColor(n,c,i)),l.legendColors.push(this._computeLegendColor(n,c)),l.pointHoverColors.push(this._computePointHoverColor(n,c))}),l}_computeBackgroundColor(t,e,r){return h.styles.get([this.colorSchemeCssClass,t+"-chart"+(r?" checkable":""),"elements","color"+e%this.numSupportedColors],"fill").fill}_computeBorderColor(t,e){let r;return h.scout.isOneOf(t,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)&&(r={stroke:this.firstOpaqueBackgroundColor}),h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","stroke-color"+e%this.numSupportedColors],"stroke",r).stroke}_computeHoverBackgroundColor(t,e,r){return h.styles.get([this.colorSchemeCssClass,t+"-chart"+(r?" checkable":""),"elements","color"+e%this.numSupportedColors+" hover"],"fill").fill}_computeHoverBorderColor(t,e){let r;return h.scout.isOneOf(t,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)&&(r={stroke:this.firstOpaqueBackgroundColor}),h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","stroke-color"+e%this.numSupportedColors+" hover"],"stroke",r).stroke}_computeCheckedBackgroundColor(t,e,r){return h.styles.get([this.colorSchemeCssClass,t+"-chart"+(r?" checkable":""),"elements","color"+e%this.numSupportedColors+" checked"],"fill").fill}_computeCheckedHoverBackgroundColor(t,e,r){return h.styles.get([this.colorSchemeCssClass,t+"-chart"+(r?" checkable":""),"elements","color"+e%this.numSupportedColors+" hover checked"],"fill").fill}_computeLegendColor(t,e){return h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","color"+e%this.numSupportedColors+" legend"],"fill").fill}_computePointHoverColor(t,e){return h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","color"+e%this.numSupportedColors+" point hover"],"fill").fill}_computeDatasetColorsChartValueGroups(t,e){if(!t||!t.type||!this.chart.data)return{};let r=t.type,a=t.options&&t.options.checkable,i=t.options&&t.options.transparent,s={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]};return this.chart.data.chartValueGroups.forEach(l=>{let d=h.styles.hexToRgb(l.colorHexValue),n=(B,V)=>this._adjustColorOpacity(h.styles.darkerColor(d,V),B),c=1,p=1,f=.1,m=.1,y=.2,b=.35,g=1,_=0,T=1,A=.1;h.scout.isOneOf(r,u.Type.PIE,u.Type.DOUGHNUT)?(y=.7,b=.85,_=.1,A=0):r===u.Type.POLAR_AREA?(c=.7,p=.85,y=.7,b=.85,_=.1,A=0):h.scout.isOneOf(l.type||r,u.Type.LINE,u.Type.RADAR)?(c=.2,p=.35,f=0,m=0,g=.2,T=.35,A=0):h.scout.isOneOf(r,u.Type.BUBBLE,u.Type.SCATTER)&&(c=.2,p=.35,f=0),s.backgroundColors.push(n(a||i?y:c,0)),s.borderColors.push(n(1,0)),s.hoverBackgroundColors.push(n(a||i?b:p,a||i?0:f)),s.hoverBorderColors.push(n(1,m)),s.checkedBackgroundColors.push(n(g,_)),s.checkedHoverBackgroundColors.push(n(T,A)),s.legendColors.push(n(1,0)),s.pointHoverColors.push(n(1,0))}),s.datalabelColor=this._computeDatalabelColor(r),s}_adjustColorOpacity(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return!t||typeof t=="function"?t:t.indexOf("rgb")===0?this._adjustRgbColorOpacity(t,e):t.indexOf("#")===0?this._adjustHexColorOpacity(t,e):t}_adjustRgbColorOpacity(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if(!t||t.indexOf("rgb")!==0)return t;let r=h.styles.rgb(t);return r.alpha=e,"rgba("+r.red+", "+r.green+", "+r.blue+", "+r.alpha+")"}_adjustHexColorOpacity(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return!t||t.indexOf("#")!==0||!(t.length===4||t.length===5||t.length===7||t.length===9)?t:this._adjustRgbColorOpacity(h.styles.hexToRgb(t),e)}_adjustLegendColors(t){!t||!t.type||!t.options||(t.options=C().extend(!0,{},t.options,{plugins:{legend:{labels:{color:this._computeLabelColor(t.type),generateLabels:this._legendLabelGenerator}}}}))}_computeLabelColor(t){return h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","label"],"fill").fill}_generateLegendLabels(t){let e=t.config,r;L.Chart.overrides[e.type]&&L.Chart.overrides[e.type].plugins&&L.Chart.overrides[e.type].plugins.legend&&L.Chart.overrides[e.type].plugins.legend.labels&&(r=L.Chart.overrides[e.type].plugins.legend.labels.generateLabels);let i=(r||L.Chart.defaults.plugins.legend.labels.generateLabels).call(t,t);if(this.removing)return i;let s=e.data,l=t.ctx.measureText.bind(t.ctx),d=t.legend,n=d.getProps(["width","maxWidth"]),c=((d||{}).options||{}).labels||{},p=c.boxWidth||0,f=c.padding||0,m;return h.scout.isOneOf(e.options.plugins.legend.position,u.Position.LEFT,u.Position.RIGHT)?((n.maxWidth||d.width)&&(m=Math.max((n.maxWidth||d.width)-p-2*f,0)),m=Math.min(250,m||0,this.$canvas.cssWidth()/3)):m=Math.min(250,this.$canvas.cssWidth()*2/3),i.forEach((y,b)=>{y.text=h.strings.truncateText(y.text,m,l);let g=s.datasets[b],_,T,A;g&&h.scout.isOneOf(g.type||e.type,u.Type.LINE,u.Type.BAR,u.Type.RADAR,u.Type.BUBBLE,u.Type.SCATTER)?(_=g.legendColor,T=this._adjustColorOpacity(g.borderColor,1)):s.datasets.length&&h.scout.isOneOf(e.type,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)&&(g=s.datasets[0],_=Array.isArray(g.legendColor)?g.legendColor[b]:g.legendColor,A=Array.isArray(g.backgroundColor)?g.backgroundColor[b]:g.backgroundColor,A=this._adjustColorOpacity(A,1)),h.objects.isFunction(_)&&(_=_.call(t,b));let B=_||A||T;h.objects.isFunction(B)||(y.fillStyle=B,y.strokeStyle=B)}),i}_adjustScalesRColors(t){if(!t||!t.type||!t.options||!t.options.scales||!t.options.scales.r)return;let e=this._computeLabelColor(t.type),r=this._computeLabelBackdropColor(t.type),a=this._computeGridColor(t.type),i=this._computeScaleTicksColor(t.type);t.options.scales.r.ticks=C().extend(!0,{},t.options.scales.r.ticks,{color:i,backdropColor:r}),t.options.scales.r.pointLabels=C().extend(!0,{},t.options.scales.r.pointLabels,{color:e}),t.options.scales.r.grid=C().extend(!0,{},t.options.scales.r.grid,{color:a})}_computeLabelBackdropColor(t){return h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","label-backdrop"],"fill",{fill:this.firstOpaqueBackgroundColor}).fill}_computeGridColor(t){return h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","grid"],"fill").fill}_computeScaleTicksColor(t){return h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","scale-ticks"],"fill").fill}_adjustScalesXYColors(t){if(!t||!t.type||!t.options||!t.options.scales)return;let e=[];if(t.options.scales.x&&e.push(t.options.scales.x),t.options.scales.y&&e.push(t.options.scales.y),!e.length)return;let r=this._computeLabelColor(t.type),a=this._computeGridColor(t.type),i=this._computeAxisLabelColor(t.type);e.forEach(s=>{s.grid=C().extend(!0,{},s.grid,{color:a}),s.ticks=C().extend(!0,{},s.ticks,{color:r}),s.title=C().extend(!0,{},s.title,{color:i})})}_computeAxisLabelColor(t){return h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","axis-label"],"fill").fill}_adjustPluginColors(t){!t||!t.type||!t.options||!t.options.plugins||this._adjustPluginsDatalabelColors(t)}_adjustPluginsDatalabelColors(t){!t||!t.type||!t.options||!t.options.plugins||!t.options.plugins.datalabels||(t.options.plugins.datalabels=C().extend(!0,{},t.options.plugins.datalabels,{color:this._computeDatalabelColor(t.type)}))}_computeDatalabelColor(t){return h.styles.get([this.colorSchemeCssClass,t+"-chart","elements","datalabel"],"fill").fill}_adjustClickHandler(t){if(!t||!t.options||(t.options.clickable?(t.options.onClick=this._clickHandler,t.options.onHover=this._pointerHoverHandler):t.options.onHover=this._hoverHandler,!t.options.plugins||!t.options.plugins.legend))return;let e=t.options.plugins.legend;e.clickable?(e.onClick=this._legendClickHandler,e.onHover=this._legendPointerHoverHandler,e.onLeave=this._legendPointerLeaveHandler):(e.onClick=r=>r.native.stopPropagation(),e.onHover=this._legendHoverHandler,e.onLeave=this._legendLeaveHandler)}_onClick(t,e){if(!e.length)return;let r=this._selectRelevantItem(e);if(this._isMaxSegmentsExceeded(this.chartJs.config,r.index))return;let a=r.index,i=r.datasetIndex,s={datasetIndex:i,dataIndex:a};if(h.scout.isOneOf(this.chartJs.config.type,u.Type.BUBBLE,u.Type.SCATTER)){let l=this.chartJs.config.data.datasets[i].data[a];s.xIndex=l.x,s.yIndex=l.y}else s.xIndex=a;this.chart.handleValueClick(s,t.native)}_selectRelevantItem(t){let e=this.chartJs.config.data.datasets,r=t[0];return this.chartJs.config.type===u.Type.BUBBLE&&t.forEach(a=>{e[a.datasetIndex].data[a.index].z<=e[r.datasetIndex].data[r.index].z&&(r=a)}),r}_onHover(t,e){if(!this.chartJs.config||!this.chartJs.config.type)return;let r=this.chartJs.config,a=r.type;if(!h.scout.isOneOf(a,u.Type.LINE,u.Type.BAR,u.Type.RADAR))return;let i=!1;this.resetDatasetAfterHover&&(this._restoreBackgroundColor(),this.resetDatasetAfterHover=!1,i=!0),e.forEach(s=>{let l=r.data.datasets[s.datasetIndex];h.scout.isOneOf(l.type||a,u.Type.LINE,u.Type.RADAR)&&(this._setHoverBackgroundColor(l),this.resetDatasetAfterHover=!0,i=!0)}),i&&this.chartJs.update()}_onHoverPointer(t,e){this._onHover(t,e),!(!this.rendered||this.removing)&&(e.length&&!this._isMaxSegmentsExceeded(this.chartJs.config,e[0].index)?this.$canvas.css("cursor","pointer"):this.$canvas.css("cursor","default"))}_onLegendClick(t,e,r){if(!this.chartJs.config||!this.chartJs.config.type)return;let a=this.chartJs.config.type,i;L.Chart.overrides[a]&&L.Chart.overrides[a].plugins&&L.Chart.overrides[a].plugins.legend&&(i=L.Chart.overrides[a].plugins.legend.onClick),(i||L.Chart.defaults.plugins.legend.onClick).call(this.chartJs,t,e,r),this._onLegendLeave(t,e,r),this._onLegendHoverPointer(t,e,r)}_onLegendHover(t,e,r){let a=e.datasetIndex,i=this.chartJs.config,s=i.type;if(h.scout.isOneOf(s,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)&&(a=e.index),this.legendHoverDatasets.indexOf(a)>-1)return;let l=i.data.datasets[a];((l?l.type:null)||s)===u.Type.LINE&&(this._setHoverBackgroundColor(l),this.chartJs.update()),this._updateHoverStyle(a,!0),this.chartJs.render(),this.legendHoverDatasets.push(a)}_onLegendHoverPointer(t,e,r){this._onLegendHover(t,e,r),!(!this.rendered||this.removing)&&this.$canvas.css("cursor","pointer")}_onLegendLeave(t,e,r){let a=e.datasetIndex,i=this.chartJs.config,s=i.type;if(h.scout.isOneOf(s,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)&&(a=e.index),this.legendHoverDatasets.indexOf(a)<0)return;let l=i.data.datasets[a];((l?l.type:null)||s)===u.Type.LINE&&(this._restoreBackgroundColor(l),this.chartJs.update()),this._updateHoverStyle(a,!1),this.chartJs.render(),this.legendHoverDatasets.splice(this.legendHoverDatasets.indexOf(a),1)}_setHoverBackgroundColor(t){!t||(t.backgroundColorBackup=t.backgroundColor,t.backgroundColor=t.hoverBackgroundColor,this._adjustDatasetBorderWidths(t))}_restoreBackgroundColor(t){t?(t.backgroundColor=t.backgroundColorBackup||t.backgroundColor,delete t.backgroundColorBackup,this._adjustDatasetBorderWidths(t)):this.chartJs.config.data.datasets.forEach(e=>this._restoreBackgroundColor(e))}_onLegendLeavePointer(t,e,r){this._onLegendLeave(t,e,r),!(!this.rendered||this.removing)&&this.$canvas.css("cursor","default")}_updateHoverStyle(t,e){let r=this.chartJs.config,a=r.type,i,s=[],l=r.data.datasets,d=l?l[t]:null,n=d?d.type:null;h.scout.isOneOf(a,u.Type.LINE,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA,u.Type.SCATTER)||n===u.Type.LINE?i="point":i="dataset",h.scout.isOneOf(a,u.Type.PIE,u.Type.DOUGHNUT,u.Type.POLAR_AREA)?this.chartJs.getSortedVisibleDatasetMetas().forEach((c,p)=>s.push({element:c.data[t],datasetIndex:p,index:t})):this.chartJs.getDatasetMeta(t).data.forEach((c,p)=>s.push({element:c,datasetIndex:t,index:p})),s&&s.length&&this.chartJs.updateHoverStyle(s,i,e)}_adjustResizeHandler(t){!t||!t.options||t.options.handleResize&&(t.options.onResize=this._resizeHandler)}_onResize(t,e){t.update(),this._adjustSize(t.config,t.chartArea)}_adjustSize(t,e){this._adjustBubbleSizes(t,e),this._adjustGridMaxMin(t,e)}_adjustBubbleSizes(t,e){if(t.type!==u.Type.BUBBLE)return;let r=t.data.datasets;r.forEach(p=>p.data.forEach(f=>{isNaN(f.z)||(f.r=Math.sqrt(f.z))}));let a=this._computeMaxMinValue(t,r,"r",!0),i=a.maxValue,s=a.minValue,l=1,d=0,n=(t.options||{}).bubble?t.options.bubble.sizeOfLargestBubble:0,c=(t.options||{}).bubble?t.options.bubble.minBubbleSize:0;if(n){let p=Math.abs(e.right-e.left),f=Math.abs(e.top-e.bottom);n=Math.min(n,Math.floor(Math.min(p,f)/6)),i===0?d=n:c&&n>c&&s/i<c/n?(l=(n-c)/(i-s),d=c-l*s):l=n/i}else c&&c>s&&(s===0?d=c:l=c/s);r.forEach(p=>p.data.forEach(f=>{h.objects.isNullOrUndefined(f.r)||(f.r=f.r*l+d)}))}_computeMaxMinValue(t,e,r,a,i,s,l){if(!e)return;let d,n;if(t.type===u.Type.SCATTER&&r==="r")d=0,n=0;else for(let m=0;m<e.length;m++)for(let y=0;y<e[m].data.length;y++){let b;r?b=e[m].data[y][r]:b=e[m].data[y],isNaN(d)?d=b:d=Math.max(b,d),isNaN(n)?n=b:n=Math.min(b,n)}isNaN(d)&&(d=0),isNaN(n)&&(n=0);let c=0,p=d,f=n;if(a||(i&&Math.sign(n)===Math.sign(d)&&(c=Math.floor(n)),p=this._calculateBoundary(d-c,Math.ceil,Math.floor),f=this._calculateBoundary(n-c,Math.floor,Math.ceil)),s&&l&&l>2*s){let m=(d-n)/(l-2*s),y=m*s;p=Math.max(p,d-c+y),f=Math.min(f,n-c-y)}return a?{maxValue:p,minValue:f}:{maxValue:p+c,minValue:f+c}}_calculateBoundary(t,e,r){let a=e,i=!1;return t<0&&(i=!0,t=t*-1,a=r),t=this._calculateBoundaryPositive(t,a),i&&(t=t*-1),t}_calculateBoundaryPositive(t,e){if(!(t>0)||!e)return t;let r=Math.floor(Math.log(t)/Math.LN10);return r<0?t=e(t*Math.pow(10,Math.abs(r))/5)*5/Math.pow(10,Math.abs(r)):t=e(t/(5*Math.pow(10,r-1)))*5*Math.pow(10,r-1),t}_adjustGridMaxMin(t,e){if(!t||!t.type||!t.options||!t.options.adjustGridMaxMin||!t.options.scales||!e)return;let r=t.type;if(!h.scout.isOneOf(r,u.Type.BAR,u.Type.LINE,u.Type.POLAR_AREA,u.Type.RADAR,u.Type.BUBBLE,u.Type.SCATTER))return;let a=t.options.scales,i=a.x,s=a.y,l=a.r,d=i?i.minSpaceBetweenTicks:1,n=s?s.minSpaceBetweenTicks:1;l&&(d=l.minSpaceBetweenTicks,n=l.minSpaceBetweenTicks);let c=Math.abs(e.right-e.left),p=Math.abs(e.top-e.bottom),f=Math.max(Math.floor(c/d)+1,3),m=Math.max(Math.floor(p/n)+1,3),y=this._computeYBoundaries(t,p),b=y.yBoundary,g=y.yBoundaryDiffType;if(l){this._adjustAxisMaxMin(l,Math.ceil(Math.min(f,m)/2),b);return}if(g?(this._adjustAxisMaxMin(s,m,b),this._adjustAxisMaxMin(a.yDiffType,m,g)):this._isHorizontalBar(t)?this._adjustAxisMaxMin(i,f,b):this._adjustAxisMaxMin(s,m,b),!h.scout.isOneOf(r,u.Type.BUBBLE,u.Type.SCATTER))return;let _=this._computeXBoundaryPointElement(t,c);this._adjustAxisMaxMin(i,f,_)}_computeBoundaryPointElement(t,e,r){if(!t||!t.type||!h.scout.isOneOf(t.type,u.Type.BUBBLE,u.Type.SCATTER)||!t.data||!t.options||!t.options.scales||!(e==="x"||e==="y")||!r)return;let a=t.data.datasets,i=t.options.scales[e],s=i&&i.offset,l=t.options[e+"LabelMap"],d,n=this._computeMaxMinValue(t,a,"r",!0).maxValue,c=n;return t.options.elements&&t.options.elements.point&&t.options.elements.point.hoverRadius&&(c=c+t.options.elements.point.hoverRadius),s?d=this._computeMaxMinValue(t,a,e,l,!0):d=this._computeMaxMinValue(t,a,e,l,!0,c,r),l&&(d.maxValue=Math.ceil(d.maxValue),d.minValue=Math.floor(d.minValue)),d}_computeXBoundaryPointElement(t,e){return this._computeBoundaryPointElement(t,"x",e)}_computeYBoundaryPointElement(t,e){return this._computeBoundaryPointElement(t,"y",e)}_computeYBoundaries(t,e){if(!t||!t.type)return{};let r=t.type,a,i;if(h.scout.isOneOf(r,u.Type.BUBBLE,u.Type.SCATTER))a=this._computeYBoundaryPointElement(t,e);else{let s=[],l=[];if(t.data&&t.data.datasets&&t.data.datasets.forEach(d=>{d.type&&d.type!==r?l.push(d):s.push(d)}),a=this._computeMaxMinValue(t,s),s.length&&l.length){i=this._computeMaxMinValue(t,l);let d=a.maxValue-a.minValue,n=i.maxValue-i.minValue;d&&n&&(d/n>10||n/d>10)&&this._adjustYAxisDiffType(t,s,l)}}return{yBoundary:a,yBoundaryDiffType:i}}_adjustYAxisDiffType(t,e,r){if(!t||!t.type||!e||!e.length||!r||!r.length||!t.options||!t.options.scales||!t.options.scales.y||t.options.scales.yDiffType)return;let a=t.type,i=t.options,s=i.scales,l=s.y,d=C().extend(!0,{},l);s.yDiffType=d,t.data&&t.data.datasets&&t.data.datasets.length&&t.data.datasets[0].type&&t.data.datasets[0].type!==a?(d.position=u.Position.LEFT,l.position=u.Position.RIGHT,l.grid.drawOnChartArea=!1):(l.position=u.Position.LEFT,d.position=u.Position.RIGHT,d.grid.drawOnChartArea=!1),l.grid.drawBorder=!0,l.grid.drawTicks=!0,d.grid.drawBorder=!0,d.grid.drawTicks=!0;let n=e[0].type||a,c=r[0].type||a,p=this.chart.session.text("ui."+n),f=this.chart.session.text("ui."+c),m=i.scaleLabelByTypeMap?i.scaleLabelByTypeMap[n]:null,y=i.scaleLabelByTypeMap?i.scaleLabelByTypeMap[c]:null;l.title.display=!0,l.title.text=m?m+" ("+p+")":p,d.title.display=!0,d.title.text=y?y+" ("+f+")":f,e.forEach(b=>{b.yAxisID="y"}),r.forEach(b=>{b.yAxisID="yDiffType"})}_adjustAxisMaxMin(t,e,r){if(!t)return;let a=1;t.ticks=C().extend(!0,{},t.ticks,{maxTicksLimit:e}),r&&(t.suggestedMax=r.maxValue,t.suggestedMin=r.minValue,a=(r.maxValue-r.minValue)/(e-1)),t.ticks.stepSize=this.onlyIntegers&&a<1?1:void 0}_remove(t){this.rendered&&!this.removing&&(this.removing=!0,this.chartJs.destroy(),this.chartJs=null,this.$canvas.remove(),this.$canvas=null),super._remove(t),this.removing=!1}}v(X,"ARROW_LEFT_RIGHT","↔"),v(X,"ARROW_UP_DOWN","↕");function nt(o,t,e){return t=se(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function se(o){var t=le(o,"string");return typeof t=="symbol"?t:String(t)}function le(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class Ct extends I{constructor(t){super(t),nt(this,"animationTriggered",void 0),nt(this,"segmentSelectorForAnimation",void 0),nt(this,"r",void 0),nt(this,"fullR",void 0),this.animationTriggered=!1,this.segmentSelectorForAnimation=".fulfillment-chart",this.suppressLegendBox=!0;let e={options:{fulfillment:{startValue:void 0}}};t.config=C().extend(!0,{},e,t.config)}_validate(){let t=this.chart.data.chartValueGroups;return!(t.length!==2||t[0].values.length!==1||t[1].values.length!==1)}_renderInternal(){let t=this.chart.data,e=t.chartValueGroups[0].values[0],r=t.chartValueGroups[1].values[0];this.fullR=Math.min(this.chartBox.height,this.chartBox.width)/2-2,this._renderInnerCircle(),this._renderPercentage(e,r)}_renderPercentage(t,e){let r="fulfillment-chart",a=this.chart.data.chartValueGroups[0].colorHexValue,i=this.chart.data.chartValueGroups[0].cssClass;this.chart.config.options.autoColor?r+=" auto-color":i&&(r+=" "+i);let s=h.scout.nvl(this.chart.config.options.fulfillment.startValue,0),l=0,d=0;e&&(l=Math.min(t/e,.999999),d=Math.min(s/e,.999999)),this.r=this.fullR;let n=this,c=function(g,_){let T=C()(this),A=T.data("animation-start"),B=T.data("animation-end");T.attr("d",n.pathSegment(A*_.pos,d+(B-d)*_.pos))},p=this.$svg.appendSVG("path",r).data("animation-start",0).data("animation-end",l),f=this.fullR/8*6.7;this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle3",f).css("fill",this.firstOpaqueBackgroundColor);let y=e?Math.round(t/e*100):0,b=this.$svg.appendSVG("text","fulfillment-chart-label ").attr("x",this.chartBox.mX()).attr("y",this.chartBox.mY()).css("font-size",this.fullR/2+"px").attr("dy","0.3em").attrXLINK("href","#InnerCircle").text(y+"%");this.chart.config.options.clickable&&p.on("click",this._createClickObject(null,null),g=>this.chart.handleValueClick(g.data)),!this.chart.config.options.autoColor&&!i&&p.attr("fill",a),this.animationDuration?(p.attr("d",this.pathSegment(0,d)).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(c,this.animationDuration)),b.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)):p.attr("d",this.pathSegment(0,l))}pathSegment(t,e){let r=t*2*Math.PI,a=e*2*Math.PI,i="";return i+="M"+(this.chartBox.mX()+this.r*Math.sin(r))+","+(this.chartBox.mY()-this.r*Math.cos(r)),i+="A"+this.r+", "+this.r,i+=e-t<.5?" 0 0,1 ":" 0 1,1 ",i+=this.chartBox.mX()+this.r*Math.sin(a)+","+(this.chartBox.mY()-this.r*Math.cos(a)),i+="L"+this.chartBox.mX()+","+this.chartBox.mY()+"Z",i}_renderCirclePath(t,e,r){let a=this.chart.data.chartValueGroups[0].cssClass,i=this.chart.data.chartValueGroups[1].colorHexValue;this.chart.config.options.autoColor?t+=" auto-color":a&&(t+=" "+a);let s=r*2,l=this.$svg.appendSVG("path",t).attr("id",e).attr("d","M "+this.chartBox.mX()+" "+this.chartBox.mY()+" m 0, "+-r+" a "+r+","+r+" 0 1, 1 0,"+s+" a "+r+","+r+" 0 1, 1 0,"+-s);return!this.chart.config.options.autoColor&&!a&&l.attr("fill",i).attr("stroke",i),l}_renderInnerCircle(){let t=this.fullR/8*7.5,e=this.fullR/8*7.2;this._renderCirclePath("fulfillment-chart-inner-circle","InnerCircle",t),this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle2",e).css("fill",this.firstOpaqueBackgroundColor)}shouldAnimateRemoveOnUpdate(t){let e=h.objects.optProperty(this.chart,"config","options","fulfillment","startValue");return h.objects.isNullOrUndefined(e)?super.shouldAnimateRemoveOnUpdate(t):!1}_removeAnimated(t){if(this.animationTriggered)return;let e=this,r=function(a,i){let s=C()(this),l=s.data("animation-start"),d=s.data("animation-end");s.attr("d",e.pathSegment(l*(1-i.pos),d*(1-i.pos)))};this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(t),this.animationTriggered=!1})}}function O(o,t,e){return t=oe(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function oe(o){var t=ne(o,"string");return typeof t=="symbol"?t:String(t)}function ne(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class x extends I{constructor(t){super(t),O(this,"segmentSelectorForAnimation",void 0),O(this,"r",void 0),O(this,"scaleWeight",void 0),O(this,"my",void 0),O(this,"parts",void 0),O(this,"numSegmentsPerPart",void 0),O(this,"segmentWidth",void 0),O(this,"widthOfSegmentWithGap",void 0),O(this,"animationTriggered",void 0),O(this,"$filledParts",void 0),O(this,"$pointer",void 0),this.segmentSelectorForAnimation=".pointer",this.suppressLegendBox=!0;let e={options:{speedo:{greenAreaPosition:void 0}}};t.config=$.extend(!0,{},e,t.config)}_validate(){let t=this.chart.data,e=this.chart.config;return!(!t||!e||t.axes.length>0||t.chartValueGroups.length!==1||t.chartValueGroups[0].values.length!==3||e.options.speedo.greenAreaPosition===void 0)}_renderInternal(){let t=this.chart.data,e=t.chartValueGroups[0].values[0],r=t.chartValueGroups[0].values[2],a=t.chartValueGroups[0].values[1];this.r=Math.min(this.chartBox.height,this.chartBox.width/2)*.7,this.scaleWeight=this.r*.27,this.my=this.chartBox.yOffset+this.chartBox.height-(this.chartBox.height-this.r*1.12)/2,this.parts=this.chart.config.options.speedo.greenAreaPosition===x.Position.CENTER?x.NUM_PARTS_GREEN_CENTER:x.NUM_PARTS_GREEN_EDGE,this.numSegmentsPerPart=this.parts===x.NUM_PARTS_GREEN_CENTER?5:8,this.$filledParts=[];let i=this.parts*this.numSegmentsPerPart,s=i-1;this.segmentWidth=(x.ARC_RANGE-s*x.SEGMENT_GAP)/i,this.widthOfSegmentWithGap=this.segmentWidth+x.SEGMENT_GAP;let l=this._getValuePercentage(a,e,r),d=this._getSegmentToPointAt(l,i),n=this._getPercentageValueOfSegment(d%this.numSegmentsPerPart,this._getPartForValue(l));for(let c=0;c<this.parts;c++)this._renderCirclePart(c);this._renderPointer(n),this._renderLegend(e,a,r,t.chartValueGroups[0].groupName),this.$svg.addClass("speedo-chart-svg"),this.chart.config.options.clickable&&this.$svg.on("click",this._createClickObject(null,null),c=>this.chart.handleValueClick(c.data))}_getValuePercentage(t,e,r){return this._limitValue((t-e)/(r-e),1)}_getSegmentToPointAt(t,e){return this._limitValue(Math.floor(t*e),e-1)}_limitValue(t,e){return t=Math.max(t,0),t=Math.min(t,e),t}_getPercentageValueOfSegment(t,e){let r=this._calcSegmentPos(t,e),a=r.from-x.ARC_MIN+(r.to-r.from)/2;return this._limitValue(a/x.ARC_RANGE,1)}_renderPointer(t){if(this.$pointer=this.$svg.appendSVG("path","pointer").attr("d",this._pathPointer(0)).attr("data-end",t).attr("stroke-width",this.scaleWeight/6+"px").attr("fill","none"),this.animationDuration){let e=this,r=function(a,i){let s=this.getAttribute("data-end")*i.pos;e._updatePointer(s),e._updatePartsFill(s)};this.$pointer.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r,this.animationDuration))}else this._updatePointer(t),this._updatePartsFill(t)}_renderSegment(t,e,r){return this.$svg.appendSVG("path","speedo-chart-arc "+r).attr("id","ArcAxisWide"+this.chart.id).attr("fill","none").attr("stroke-width",this.scaleWeight+"px").attr("d",this._pathSegment(t,e))}_renderCirclePart(t){let e=this._getColorForPart(t);for(let r=0;r<this.numSegmentsPerPart;r++){let a=this._calcSegmentPos(r,t);this._renderSegment(a.from,a.to,e)}this.$filledParts.push(this._renderSegment(x.ARC_MIN,x.ARC_MIN,e))}_renderLegend(t,e,r,a){let i=this.scaleWeight*.8,s=5,l=this.my+s,d=l+i*.8,n={x1:null,x2:this.chartBox.mX()-s,y1:null,y2:l,v:-1,h:1},c=t?this._formatValue(t):0,p=e?this._formatValue(e):""+0,f=r?this._formatValue(r):0;if(this.chart.config.options.plugins.tooltip.enabled){let m=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()-this.r).attr("y",d).text(c).attr("style","font-size: "+i+"px; text-anchor: middle"),y=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()+this.r).attr("y",d).text(f).attr("style","font-size: "+i+"px; text-anchor: middle"),b=function(){this.$svg.append(m),this.$svg.append(y)}.bind(this),g=()=>{m.detach(),y.detach()};g(),this.$svg.on("mouseenter",b).on("mouseleave",g)}this.chart.config.options.plugins.legend.display&&this._renderLineLabel(n.x2+s,n.y2+n.v*s,p,"",!1).addClass("speedo-chart-label").attr("style","font-size: "+this.scaleWeight*1.55+"px;")}_getPartForValue(t){let e=Math.floor(t*this.parts);return this._limitValue(e,this.parts-1)}_formatValue(t){if(t<x.TEN_THOUSAND)return this.session.locale.decimalFormat.format(t);if(t<x.ONE_MILLION)return Math.floor(t/x.ONE_THOUSAND)+"k";let e=t/x.ONE_MILLION;return e=h.numbers.round(e,h.RoundingMode.HALF_UP,2),this.session.locale.decimalFormat.format(e)+"M"}_updatePointer(t){this.$pointer.attr("d",this._pathPointer(t)).removeClass("red yellow light-green dark-green").addClass(this._getColorForPart(this._getPartForValue(t)))}_updatePartsFill(t){let e,r;for(let a=0;a<this.$filledParts.length;a++)e=this._calcSegmentPos(0,a).from,(a+1)/this.parts<t?r=this._calcSegmentPos(this.numSegmentsPerPart-1,a).to:a/this.parts>t?(e=x.ARC_MIN,r=x.ARC_MIN):r=x.ARC_RANGE*t-x.ARC_MAX,this.$filledParts[a].attr("d",this._pathSegment(e,r))}_calcSegmentPos(t,e){let r={from:0,to:0},a=t+e*this.numSegmentsPerPart;return r.from=a*this.widthOfSegmentWithGap-x.ARC_MAX,r.to=r.from+this.segmentWidth,r}_getColorForPart(t){switch(this.chart.config.options.speedo.greenAreaPosition){case x.Position.LEFT:if(t===0)return"dark-green";if(t===1)return"light-green";if(t===2)return"yellow";if(t===3)return"red";break;case x.Position.RIGHT:if(t===0)return"red";if(t===1)return"yellow";if(t===2)return"light-green";if(t===3)return"dark-green";break;case x.Position.CENTER:if(t===0)return"red";if(t===1)return"yellow";if(t===2)return"light-green";if(t===3)return"dark-green";if(t===4)return"light-green";if(t===5)return"yellow";if(t===6)return"red";break;default:break}}_pathSegment(t,e){let r=t*2*Math.PI,a=e*2*Math.PI,i="";return i+="M "+(this.chartBox.mX()+this.r*Math.sin(r))+" "+(this.my-this.r*Math.cos(r))+" ",i+="A "+this.r+" "+this.r+" ",i+="0 "+(e-t<.5?"0":"1")+" 1 ",i+=this.chartBox.mX()+this.r*Math.sin(a)+" "+(this.my-this.r*Math.cos(a)),i}_pathPointer(t){let r=(x.ARC_RANGE*t-x.ARC_MAX)*2*Math.PI,a=this.r-1.4*this.scaleWeight,i=this.r+1.37*this.scaleWeight,s="";return s+="M "+(this.chartBox.mX()+i*Math.sin(r))+" "+(this.my-i*Math.cos(r))+" ",s+="L "+(this.chartBox.mX()+a*Math.sin(r))+" "+(this.my-a*Math.cos(r))+" ",s+="Z",s}_removeAnimated(t){if(this.animationTriggered)return;let e=this,r=function(a,i){let s=this.getAttribute("data-end")*(1-i.pos);e._updatePointer(s),e._updatePartsFill(s)};this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(t),this.animationTriggered=!1})}}O(x,"Position",{LEFT:"left",CENTER:"center",RIGHT:"right"}),O(x,"NUM_PARTS_GREEN_CENTER",7),O(x,"NUM_PARTS_GREEN_EDGE",4),O(x,"ONE_THOUSAND",1e3),O(x,"TEN_THOUSAND",1e4),O(x,"ONE_MILLION",1e6),O(x,"ARC_MIN",-.25),O(x,"ARC_MAX",.25),O(x,"ARC_RANGE",x.ARC_MAX-x.ARC_MIN),O(x,"SEGMENT_GAP",.0103);function H(o,t,e){return t=he(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function he(o){var t=de(o,"string");return typeof t=="symbol"?t:String(t)}function de(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class xt extends I{constructor(t){super(t),H(this,"segmentSelectorForAnimation",void 0),H(this,"widthThresholdMedium",void 0),H(this,"widthThresholdSmall",void 0),H(this,"barDeltaPercentage",void 0),H(this,"lastBarAdditionalPercentage",void 0),H(this,"lastBarMinWidthPercentage",void 0),H(this,"paddingBetweenLabel",void 0),H(this,"dataAnalyzeResult",void 0),H(this,"barHeight",void 0),H(this,"barAreaWidth",void 0),H(this,"centerX",void 0),H(this,"animationTriggered",void 0),this.segmentSelectorForAnimation=".salesfunnel-chart-bar",this.widthThresholdMedium=400,this.widthThresholdSmall=200,this.barDeltaPercentage=.95,this.lastBarAdditionalPercentage=.7,this.lastBarMinWidthPercentage=.4,this.suppressLegendBox=!0;let e={options:{salesfunnel:{normalized:void 0,calcConversionRate:void 0}}};t.config=C().extend(!0,{},e,t.config)}_validate(){let t=this.chart.data,e=this.chart.config;return!(!t||!e||t.axes.length!==t.chartValueGroups.length||t.chartValueGroups.length===0||t.chartValueGroups[0].values.length===0||e.options.salesfunnel.normalized===void 0||e.options.salesfunnel.calcConversionRate===void 0)}_renderInternal(){let t=this.chart.data,e=t.chartValueGroups.length,r=this._dynamicConversionRateWidth();this.paddingBetweenLabel=20,this.dataAnalyzeResult=this._analyzeData(t.chartValueGroups),this.barHeight=this.chartBox.height/e,this.barAreaWidth=this.chartBox.width-this.dataAnalyzeResult.maxLengthFirstValueRow-this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount-this.dataAnalyzeResult.maxLengthSecondValueRow-r,this.centerX=this.barAreaWidth/2,this.chart.config.options.salesfunnel.normalized?this._renderBarsNormalized(t.chartValueGroups):this._renderBarsAccordingToValues(t.chartValueGroups),this._addClipping("salesfunnel-chart-bar")}_renderBarsNormalized(t){let e=t.length,r=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*(this.dataAnalyzeResult.labelCount+1),a=this.barAreaWidth*(1-this.barDeltaPercentage),s=this.barAreaWidth*this.lastBarMinWidthPercentage/this.lastBarAdditionalPercentage;a=Math.min(a,(this.barAreaWidth-s)/(e-1));for(let l=0;l<e;l++){let d=this.barAreaWidth-l*a,n=t[l].groupName,c=this.barAreaWidth-(l+1)*a,p=l*this.barHeight,f={xStart:this.centerX,yStart:p,rect:!0,width:d,widthBottom:c,cssClass:"salesfunnel-chart-bar",fill:t[l].colorHexValue,label:t[l].groupName,clickObject:this._createClickObject(null,l)};this.chart.config.options.autoColor?f.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[l].cssClass&&(f.cssClass+=" "+this.chart.data.chartValueGroups[l].cssClass),l===e-1&&(f.width=f.width*this.lastBarAdditionalPercentage,f.widthBottom=f.widthBottom*this.lastBarAdditionalPercentage),this._renderPolygon(f),this._renderLabel(t[l].values[0],!1,l),this._renderBarLabel(n,l,f.widthBottom);let m=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;t[l].values.length>1&&(this._renderLabel(t[l].values[1],!0,l),m+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),l>0&&(this._renderLabelSeparatorLine(p,m),this.chart.config.options.salesfunnel.calcConversionRate&&this._renderConversionRate(l,r,this._calcConversionRate(t[l-1].values[0],t[l].values[0])))}}_renderLabel(t,e,r){if(t===null)return;let a=r*this.barHeight+this.barHeight/2,i=this.dataAnalyzeResult.maxLengthFirstValueRow+(e?this.dataAnalyzeResult.maxLengthSecondValueRow:0),s=e?2:1,l=this.barAreaWidth+i+s*this.paddingBetweenLabel,d=this._dynamicCssClass("salesfunnel-label"),n=this.$svg.appendSVG("text",d).attr("x",l).attr("y",a).text(this.session.locale.decimalFormat.format(t));if(this.animationDuration&&n.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),this.chart.config.options.plugins.tooltip.enabled&&this.chart.data.axes.length>0){let c=this.chart.data.axes[r][e?1:0].label,p=this._measureText(""+t,d);this._renderWireLabels(c,n,l-p.width/2,a-p.height)}}_renderWireLabels(t,e,r,a){let i={x1:r,x2:r-10,y1:a,y2:a-10,v:-1,h:-1},s=(c,p)=>(i.y2-p<0&&(i.v=1,i.y1=i.y1+p*1.5,i.y2=i.y1+10),i);i.autoPosition=!0,i.posFunc=s;let l=this._renderWireLegend(t,i,"line-chart-wire-label",!0),d=l.attachFunc.bind(l),n=l.detachFunc.bind(l);l.detachFunc(),e.on("mouseenter",d).on("mouseleave",n)}_renderBarLabel(t,e,r){let a=e*this.barHeight+this.barHeight/2,i=this.centerX,s=this._dynamicCssClass("salesfunnel-bar-label");this._renderLineLabel(i,a,t,s,!0)}_renderConversionRate(t,e,r){if(r===void 0)return;let a=t*this.barHeight,i=this._dynamicCssClass("salesfunnel-conversionrate-label"),s=this.$svg.appendSVG("text",i).attr("x",e).attr("y",a).text("↓ "+r+"%");this.animationDuration&&s.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_renderPolygon(t){let e=this,r=this._calcPolygonPoints(!0,this.animationDuration?0:1,t.xStart,t.yStart,t.width,t.widthBottom,this.barHeight-1),a=this.$svg.appendSVG("polygon",t.cssClass,"",t.id).attr("points",r).data("xStart",t.xStart).data("yStart",t.yStart).data("widthBar",t.width).data("widthBottom",t.widthBottom).data("heightBar",this.barHeight);!this.chart.config.options.autoColor&&t.fill&&a.attr("fill",t.fill),a.css("stroke",this.firstOpaqueBackgroundColor);let i=function(s,l){let d=C()(this),n=d.data("xStart"),c=d.data("yStart"),p=d.data("widthBar"),f=d.data("heightBar"),m=d.data("widthBottom");d.attr("points",e._calcPolygonPoints(!0,l.pos,n,c,p,m,f))};return this.animationDuration&&a.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(i,this.animationDuration)),this.chart.config.options.clickable&&a.on("click",t.clickObject,s=>this.chart.handleValueClick(s.data)),t.fill&&a.attr("fill",t.fill),a}_calcPolygonPoints(t,e,r,a,i,s,l){let d=0,n=0;return t?(d=i/2*e,n=s/2*e):(d=i/2-i/2*e,n=s/2-s/2*e),h.strings.join(" ",r-d+","+a,r+d+","+a,r+n+","+(a+l),r-n+","+(a+l))}_renderBarsAccordingToValues(t){let e=this.dataAnalyzeResult.maxValue?this.barAreaWidth*.8/this.dataAnalyzeResult.maxValue:0,r=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount+2*this.paddingBetweenLabel,a=t.length;for(let i=0;i<a;i++){let s=t[i].values[0]*e+this.barAreaWidth*.2,l=t[i].groupName,d=i*this.barHeight,n={xStart:this.centerX,yStart:d,rect:!0,width:s,widthBottom:s,cssClass:"salesfunnel-chart-bar",fill:t[i].colorHexValue,label:t[i].groupName,clickObject:this._createClickObject(null,i)};this.chart.config.options.autoColor?n.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[i].cssClass&&(n.cssClass+=" "+this.chart.data.chartValueGroups[i].cssClass),this._renderPolygon(n),this._renderLabel(t[i].values[0],!1,i),this._renderBarLabel(l,i,n.widthBottom);let c=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;t[i].values.length>1&&(this._renderLabel(t[i].values[1],!0,i),c+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),i>0&&(this._renderLabelSeparatorLine(d,c),this.chart.config.options.salesfunnel.calcConversionRate&&this._renderConversionRate(i,r,this._calcConversionRate(t[i-1].values[0],t[i].values[0])))}}_renderLabelSeparatorLine(t,e){let r=this.$svg.appendSVG("line","label-separator").attr("x1",this.barAreaWidth+this.paddingBetweenLabel).attr("y1",t).attr("x2",this.barAreaWidth+e).attr("y2",t);this.animationDuration&&r.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_calcConversionRate(t,e){if(!(h.objects.isNullOrUndefined(t)||h.objects.isNullOrUndefined(e)||t===0))return Math.round(e/t*100)}_analyzeData(t){let e={labelCount:0,maxValue:null,maxLengthFirstValueRow:0,maxLengthSecondValueRow:0},r=this._dynamicCssClass("salesfunnel-label");for(let a=0;a<t.length;a++){let i=t[a];e.labelCount=Math.max(e.labelCount,i.values.length),i.values.length>0&&i.values[0]&&(e.maxValue===null?e.maxValue=i.values[0]:e.maxValue=Math.max(e.maxValue,i.values[0]),e.maxLengthFirstValueRow=Math.max(e.maxLengthFirstValueRow,this._measureText(this.session.locale.decimalFormat.format(i.values[0]),r).width)),i.values.length>1&&i.values[1]&&(e.maxLengthSecondValueRow=Math.max(e.maxLengthSecondValueRow,this._measureText(this.session.locale.decimalFormat.format(i.values[1]),r).width))}return e}_removeAnimated(t){if(this.animationTriggered)return;this.animationTriggered=!0;let e=this,r=function(a,i){let s=C()(this),l=s.data("xStart"),d=s.data("yStart"),n=s.data("widthBar"),c=s.data("heightBar"),p=s.data("widthBottom");s.attr("points",e._calcPolygonPoints(!1,i.pos,l,d,n,p,c))};this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(r)).promise().done(()=>{this._remove(t),this.animationTriggered=!1})}_dynamicCssClass(t){let e="";return this.chartBox.width<=this.widthThresholdSmall?e="small":this.chartBox.width<=this.widthThresholdMedium&&(e="medium"),h.strings.join(" ",t,e)}_dynamicConversionRateWidth(){return this.chart.config.options.salesfunnel.calcConversionRate?this.chartBox.width<=this.widthThresholdSmall?60:this.chartBox.width<=this.widthThresholdMedium?80:100:0}}function P(o,t,e){return t=ue(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function ue(o){var t=ce(o,"string");return typeof t=="symbol"?t:String(t)}function ce(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class Tt{constructor(t,e,r,a,i,s,l,d,n,c,p,f,m,y){P(this,"helper",void 0),P(this,"venn1",void 0),P(this,"venn2",void 0),P(this,"venn3",void 0),P(this,"u",void 0),P(this,"v",void 0),P(this,"w",void 0),P(this,"uv",void 0),P(this,"uw",void 0),P(this,"vw",void 0),P(this,"uvw",void 0),P(this,"maxD",void 0),P(this,"dStep",void 0),P(this,"rStep",void 0),P(this,"alphaStep",void 0),P(this,"alphaBest",void 0),P(this,"dBest",void 0),P(this,"rBest",void 0),P(this,"errorBest",void 0),P(this,"callback",void 0),P(this,"cancelled",void 0),i===0&&d===0&&n===0&&p===0&&(i=1),s===0&&d===0&&c===0&&p===0&&(s=1),l===0&&n===0&&c===0&&p===0&&(l=1),this.helper=t,this.venn1=e,this.venn2=r,this.venn3=a,this.u=i,this.v=s,this.w=l,this.uv=d,this.uw=n,this.vw=c,this.uvw=p,this.maxD=this.venn1.r+2*this.venn2.r+2*this.venn1.r+this.helper.distR,this.dStep=this.maxD/30,this.rStep=a.r/4,this.alphaStep=Math.PI/30,this.alphaBest=0,this.dBest=0,this.rBest=0,this.errorBest=0,this.callback=null,this.cancelled=!1}start(t){this.callback=t,setTimeout(this._next.bind(this,0))}cancel(){this.cancelled=!0}_end(){this.venn3.x=this.venn1.x+this.dBest*Math.cos(this.alphaBest),this.venn3.y=this.venn1.y-this.dBest*Math.sin(this.alphaBest),this.venn3.r=this.rBest,this.callback()}_next(t){this.cancelled||this._iteration(t),!this.cancelled&&(t+=this.alphaStep,t<Math.PI?setTimeout(this._next.bind(this,t)):this._end())}_iteration(t){let e=this.maxD,r=this.dStep,a=this.helper.minR,i=this.rStep,s=this.helper.total,l=this.venn1.x,d=this.venn1.y,n=this.venn1.r,c=this.venn2.x,p=this.venn2.y,f=this.venn2.r,m=this.venn3.r,y=this.u,b=this.v,g=this.w,_=this.uv,T=this.uw,A=this.vw,B=this.uvw,V=this.alphaBest,rt=this.dBest,at=this.rBest,dt=this.errorBest;for(let tt=0;tt<e;tt+=r){let it=l+tt*Math.cos(t),st=d-tt*Math.sin(t);for(let N=Math.max(a,m*.75);N<=m*1.25;N+=i){let Rt=Math.min(l-n,c-f,it-N),Lt=Math.max(l+n,c+f,it+N),kt=Math.min(d-n,p-f,st-N),St=Math.max(d+n,p+f,st+N),Nt=(Lt-Rt)/100,Gt=(St-kt)/100,ut=0,ct=0,pt=0,ft=0,mt=0,_t=0,bt=0;for(let j=Rt;j<Lt;j+=Nt)for(let U=kt;U<St;U+=Gt){let J=(j-l)*(j-l)+(U-d)*(U-d)<n*n,K=(j-c)*(j-c)+(U-p)*(U-p)<f*f,q=(j-it)*(j-it)+(U-st)*(U-st)<N*N;J&&K&&q?bt++:J&&K&&!q?ft++:J&&!K&&!q?ut++:!J&&K&&!q?ct++:J&&!K&&q?mt++:!J&&K&&q?_t++:!J&&!K&&q&&pt++}let Y=ut+ct+pt+ft+mt+_t+bt,G=tt/e;G+=this._error(B,s,bt,Y),G+=this._error(_,s,ft,Y),G+=this._error(T,s,mt,Y),G+=this._error(A,s,_t,Y),G+=this._error(y,s,ut,Y),G+=this._error(b,s,ct,Y),G+=this._error(g,s,pt,Y),(t===0||G<dt)&&(V=t,rt=tt,at=N,dt=G)}}this.alphaBest=V,this.dBest=rt,this.rBest=at,this.errorBest=dt}_error(t,e,r,a){return t===0&&r!==0||t!==0&&r===0?1e3:Math.abs(t/e-r/a)*100}}function ht(o,t,e){return t=pe(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function pe(o){var t=fe(o,"string");return typeof t=="symbol"?t:String(t)}function fe(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class vt{constructor(t,e,r,a){ht(this,"distR",void 0),ht(this,"maxR",void 0),ht(this,"minR",void 0),ht(this,"total",void 0),this.distR=t,this.maxR=e,this.minR=r,this.total=a}findBalance2(t,e){let r=(t.r*t.x+e.r*e.x)/(t.r+e.r),a=(t.r*t.y+e.r*e.y)/(t.r+e.r);t.x=t.x-r,e.x=e.x-r,t.y=t.y-a,e.y=e.y-a}findBalance3(t,e,r){let a=(t.r*t.x+e.r*e.x+r.r*r.x)/(t.r+e.r+r.r),i=(t.r*t.y+e.r*e.y+r.r*r.y)/(t.r+e.r+r.r);t.x=t.x-a,e.x=e.x-a,r.x=r.x-a,t.y=t.y-i,e.y=e.y-i,r.y=r.y-i}calcR(t,e){return t===-1?this.maxR*e:Math.max(this.minR,Math.sqrt(t/this.total)*this.maxR*e)}calcD(t,e,r,a,i,s){let l;if(i===0)l=t.r+e.r+this.distR*2;else if(r===0&&a===0)l=0;else if(r===0)l=Math.max(0,e.r-t.r-this.distR),l<1.5*this.distR&&s&&(l=1.5*this.distR,t.r=e.r-l);else if(a===0)l=Math.max(0,t.r-e.r-this.distR),l<1.5*this.distR&&s&&(l=1.5*this.distR,e.r=t.r-l);else{let d=Math.min(t.r,e.r),n=Math.max(t.r,e.r);l=2*(Math.min(r,a)/(Math.min(r,a)+i))*d-d+n,l=Math.max(3*this.distR,l),l=Math.min(d+n-3*this.distR,l),l=Math.max(n-d+3*this.distR,l)}return l}}function E(o,t,e){return t=me(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function me(o){var t=_e(o,"string");return typeof t=="symbol"?t:String(t)}function _e(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class At extends I{constructor(t){super(t),E(this,"animationTriggered",void 0),E(this,"data",void 0),E(this,"centerX",void 0),E(this,"centerY",void 0),E(this,"numberOfCircles",void 0),E(this,"readyToDraw",void 0),E(this,"wasCircle",void 0),E(this,"vennCircleHelper",void 0),E(this,"async3Calculator",void 0),E(this,"vennNumber1",void 0),E(this,"vennReal1",void 0),E(this,"vennNumber2",void 0),E(this,"vennReal2",void 0),E(this,"vennNumber3",void 0),E(this,"vennReal3",void 0),E(this,"$v1",void 0),E(this,"$v2",void 0),E(this,"$v3",void 0),this.animationTriggered=!1,this.suppressLegendBox=!0;let e={options:{venn:{numberOfCircles:void 0}}};t.config=C().extend(!0,{},e,t.config)}_validate(){let t=this.chart.data;return!(!t||t.axes.length!==0||t.chartValueGroups.length===0||t.chartValueGroups[0].values.length===0)}_renderInternal(){if(this.centerX=this.width/2,this.centerY=this.height/2,this.centerX===0||this.centerY===0)return;this.data=this.chart.data.chartValueGroups,this.numberOfCircles=this.chart.config.options.venn.numberOfCircles;let t=10,e=Math.min(this.centerX,this.centerY),r=e/15,a=this.data.reduce((s,l)=>s+l.values[0],1);this.vennCircleHelper=new vt(t,e,r,a),this.numberOfCircles>0&&(this.$v1=this._createCircle(0,this.data[0].colorHexValue,this.data[0].cssClass),this.vennNumber1=new W(this.$v1),this.vennReal1=new W(this.$v1)),this.numberOfCircles>1&&(this.$v2=this._createCircle(1,this.data[1].colorHexValue,this.data[1].cssClass),this.vennNumber2=new W(this.$v2),this.vennReal2=new W(this.$v2)),this.numberOfCircles>2&&(this.$v3=this._createCircle(2,this.data[2].colorHexValue,this.data[2].cssClass),this.vennNumber3=new W(this.$v3),this.vennReal3=new W(this.$v3));let i=function(){this.readyToDraw=!0,this.$svg.isAttached()&&(this.readyToDraw=!1,this._draw(!0,!0))}.bind(this);this.readyToDraw=!1,this.numberOfCircles===1?(this._calc1(this.vennNumber1),this._calc1(this.vennReal1),i()):this.numberOfCircles===2?(this._calc2(this.vennNumber1,this.vennNumber2,!1),this._calc2(this.vennReal1,this.vennReal2,!0),i()):this.numberOfCircles===3&&this._calc3(this.vennNumber1,this.vennNumber2,this.vennNumber3,!1,()=>{(this.rendering||this.rendered)&&this._calc3(this.vennReal1,this.vennReal2,this.vennReal3,!0,i)})}remove(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=arguments.length>1?arguments[1]:void 0;this._cancelAsync3Calculator(),super.remove(t,e)}_calc1(t){let e=this.data[0].values[0];e>0?t.r=this.vennCircleHelper.calcR(e,.8):t.r=this.vennCircleHelper.calcR(e,0),t.x=0,t.y=0,t.setLegend(this.data[0].groupName,1,-1),t.addLabel(e,t.x,t.y)}_calc2(t,e,r){let a=this.data[0].values[0],i=this.data[1].values[0],s=this.data[2].values[0],l;r?(t.r=this.vennCircleHelper.calcR(a+s,.8),e.r=this.vennCircleHelper.calcR(i+s,.8),l=this.vennCircleHelper.calcD(t,e,a,i,s,!0),t.x=0,e.x=l):(t.r=e.r=this.vennCircleHelper.calcR(-1,.7),t.x=-t.r*.6,e.x=e.r*.6),t.y=0,e.y=0,this.vennCircleHelper.findBalance2(t,e),t.setLegend(this.data[0].groupName,-1,-1),e.setLegend(this.data[1].groupName,1,-1),r?s===0?(t.addLabel(a,t.x,t.y),e.addLabel(i,e.x,e.y)):a===0&&i===0?t.addLabel(s,t.x,t.y):a===0?(e.addLabel(s,t.x,t.y),e.addLabel(i,e.x-(l-e.r-t.r)/2,e.y),t.legendR=e.r-l):i===0?(t.addLabel(s,e.x,e.y),t.addLabel(a,t.x+(l-e.r-t.r)/2,t.y),e.legendR=t.r-l):(t.addLabel(a,t.x+(l-e.r-t.r)/2,t.y),t.addLabel(i,e.x-(l-e.r-t.r)/2,e.y),e.addLabel(s,t.x+t.r+(l-e.r-t.r)/2,t.y)):(t.addLabel(a,-t.r*.9,0),t.addLabel(i,t.r*.9,0),e.addLabel(s,0,0))}_calc3(t,e,r,a,i){let s=this.data[0].values[0],l=this.data[1].values[0],d=this.data[2].values[0],n=this.data[3].values[0],c=this.data[4].values[0],p=this.data[5].values[0],f=this.data[6].values[0],m,y,b;a?(t.r=this.vennCircleHelper.calcR(s+n+c+f,.55),e.r=this.vennCircleHelper.calcR(l+n+p+f,.55),r.r=this.vennCircleHelper.calcR(d+c+p+f,.55),m=this.vennCircleHelper.calcD(t,e,s+c,l+p,n+f,!0),y=this.vennCircleHelper.calcD(t,r,s+n,d+p,n+f,!1),b=this.vennCircleHelper.calcD(e,r,l+n,d+c,n+f,!1),t.x=0,e.x=m,r.x=y,t.y=0,e.y=0,r.y=0,this._cancelAsync3Calculator(),this.async3Calculator=new Tt(this.vennCircleHelper,t,e,r,s,l,d,n,c,p,f,m,y,b),this.async3Calculator.start(()=>{this.async3Calculator=null,this.vennCircleHelper.findBalance3(t,e,r),t.setLegend(this.data[0].groupName,-1,1),e.setLegend(this.data[1].groupName,1,1),r.setLegend(this.data[2].groupName,1,-1),i()})):(t.r=e.r=r.r=this.vennCircleHelper.calcR(-1,.55),t.x=-t.r*.73,e.x=e.r*.73,r.x=0,t.y=t.r*.58,e.y=e.r*.58,r.y=-r.r*.58,t.setLegend(this.data[0].groupName,-1,1),e.setLegend(this.data[1].groupName,1,1),r.setLegend(this.data[2].groupName,1,-1),t.addLabel(s,-t.r,t.r*.76),e.addLabel(l,t.r,t.r*.76),r.addLabel(d,0,-t.r*.82),t.addLabel(n,0,t.r*.76),t.addLabel(c,-t.r*.49,-t.r*.05),e.addLabel(p,t.r*.49,-t.r*.05),t.addLabel(f,0,t.r*.22),i())}_cancelAsync3Calculator(){this.async3Calculator&&(this.async3Calculator.cancel(),this.async3Calculator=null)}_draw(t,e){if(!this.rendered&&!this.rendering||this.animationTriggered)return;this.animationTriggered=!0;let r=this;this.$svg.children(".venn-legend, .venn-label, .venn-axis-white, .label-line").stop().animateSVG("opacity",1,0,null,!0).promise().done(function(){this.remove(),r.animationTriggered=!1});let a=[];this.numberOfCircles>0&&a.push(e?this.vennReal1:this.vennNumber1),this.numberOfCircles>1&&a.push(e?this.vennReal2:this.vennNumber2),this.numberOfCircles>2&&a.push(e?this.vennReal3:this.vennNumber3);for(let i=0;i<a.length;i++){let s=a[i];this._updateVenn(s,t);for(let l=0;l<s.labels.length;l++){let d=s.labels[l];this._drawLabel(d.text,d.x,d.y,t)}}}_createCircle(t,e,r){let a=this.$svg.appendSVG("circle","venn-circle").attr("cx",this.centerX).attr("cy",this.centerY).attr("r",0).on("mouseenter",{showReal:!1},this._show.bind(this)).on("mouseleave",{showReal:!0},this._show.bind(this));return this.chart.config.options.autoColor?a.addClass("auto-color color0"):r?a.addClass(r):a.attr("fill",e),this.chart.config.options.clickable&&a.on("click",this._createClickObject(null,t),i=>this.chart.handleValueClick(i.data)),a}_updateVenn(t,e){t.$circle.animateSVG("cx",this.centerX+t.x,e?this.animationDuration:0,null,!0).animateSVG("cy",this.centerY+t.y,e?this.animationDuration:0,null,!0).animateSVG("r",t.r,e?this.animationDuration:0,null,!0);let r=this.vennCircleHelper.minR,a=this.centerX+t.x+t.legendH*Math.sin(Math.PI/5)*t.r,i=this.centerY+t.y+t.legendV*Math.cos(Math.PI/5)*t.r,s=this.centerX+t.x+t.legendH*Math.sin(Math.PI/5)*(t.legendR+r*1.5),l=this.centerY+t.y+t.legendV*Math.cos(Math.PI/5)*(t.legendR+r*1.5),d={x1:a,x2:s,y1:i,y2:l,v:t.legendV,h:t.legendH};this._renderWireLegend(t.legend,d,"venn-legend")}_drawLabel(t,e,r,a){let i=this.$svg.appendSVG("text","venn-label").attr("x",this.centerX+e).attr("y",this.centerY+r).text(t);a&&this.animationDuration&&i.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_show(t){if(this.numberOfCircles===1)return;let e=t.type==="mouseenter"?t.target:t.relatedTarget,r=e&&C()(e).hasClass("venn-circle");this.wasCircle&&r||(this.wasCircle=r,this._draw(!0,t.data.showReal))}}function F(o,t,e){return t=be(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function be(o){var t=ge(o,"string");return typeof t=="symbol"?t:String(t)}function ge(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class W{constructor(t){F(this,"labels",void 0),F(this,"$circle",void 0),F(this,"x",void 0),F(this,"y",void 0),F(this,"r",void 0),F(this,"legend",void 0),F(this,"legendR",void 0),F(this,"legendH",void 0),F(this,"legendV",void 0),this.$circle=t,this.labels=[]}setLegend(t,e,r,a){this.legend=t,this.legendH=e,this.legendV=r,this.legendR=a||this.r}addLabel(t,e,r){this.labels.push({text:t,x:e,y:r})}}function ye(o,t,e){return t=Ce(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function Ce(o){var t=xe(o,"string");return typeof t=="symbol"?t:String(t)}function xe(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class Et extends h.FormField{constructor(){super(),ye(this,"chart",void 0),this._addWidgetProperties(["chart"]),this.chart=null}_render(){this.addContainer(this.$parent,"chart-field"),this.addLabel(),this.addMandatoryIndicator(),this.addStatus(),this._renderChart()}_renderChart(){this.chart&&(this.chart.render(),this.addField(this.chart.$container))}_removeChart(){this.chart.remove(),this._removeField()}}class Mt extends h.FormFieldAdapter{}function Te(o,t,e){return t=ve(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function ve(o){var t=Ae(o,"string");return typeof t=="symbol"?t:String(t)}function Ae(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class It extends h.FormFieldTile{constructor(){super(),Te(this,"_chartConfigChangeHandler",void 0),this._chartConfigChangeHandler=this._onChartConfigChange.bind(this)}_renderColorScheme(){super._renderColorScheme(),this._updateChartColorScheme()}_updateChartColorScheme(){let t=$.extend(!0,{},this.tileWidget.chart.config,{options:{colorScheme:this.colorScheme}});this.tileWidget.chart.setConfig(t)}_onChartConfigChange(t){this._updateChartColorScheme()}_setTileWidget(t){this.tileWidget&&this.tileWidget.chart.off("propertyChange:config",this._chartConfigChangeHandler),super._setTileWidget(t),this.tileWidget.chart.on("propertyChange:config",this._chartConfigChangeHandler)}}class Dt extends h.FormFieldTileAdapter{}function k(o,t,e){return t=Be(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function Be(o){var t=Re(o,"string");return typeof t=="symbol"?t:String(t)}function Re(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class Q extends h.TableControl{constructor(){super(),k(this,"chartAggregation",void 0),k(this,"chartGroup1",void 0),k(this,"chartGroup2",void 0),k(this,"chartType",void 0),k(this,"oldChartType",void 0),k(this,"chart",void 0),k(this,"chartColorScheme",void 0),k(this,"xAxis",void 0),k(this,"yAxis",void 0),k(this,"dateGroup",void 0),k(this,"$chartSelect",void 0),k(this,"$axisSelectContainer",void 0),k(this,"$xAxisSelect",void 0),k(this,"$yAxisSelect",void 0),k(this,"$dataSelect",void 0),k(this,"_chartTypeMap",void 0),k(this,"_aggregationMap",void 0),k(this,"_chartGroup1Map",void 0),k(this,"_chartGroup2Map",void 0),k(this,"_tableUpdatedHandler",void 0),k(this,"_tableColumnStructureChangedHandler",void 0),k(this,"_chartValueClickedHandler",void 0),k(this,"_filterResetListener",void 0),k(this,"_tableUpdatedTimeOutId",void 0),this.tooltipText="${textKey:ui.Chart}",this.chartAggregation={modifier:h.TableMatrix.NumberGroup.COUNT},this.chartType=u.Type.BAR,this.oldChartType=null,this.chart=null,this.chartColorScheme="chart-table-control",this.$chartSelect=null,this.$xAxisSelect=null,this.$yAxisSelect=null,this.$dataSelect=null,this.xAxis=null,this.yAxis=null,this.dateGroup=null,this._tableUpdatedHandler=this._onTableUpdated.bind(this),this._tableColumnStructureChangedHandler=this._onTableColumnStructureChanged.bind(this),this._chartValueClickedHandler=this._onChartValueClick.bind(this)}_init(t){super._init(t),this.table.on("columnStructureChanged",this._tableColumnStructureChangedHandler),this.chart=h.scout.create(u,{parent:this})}_destroy(){this.table.off("columnStructureChanged",this._tableColumnStructureChangedHandler),super._destroy()}_computeEnabled(t,e){return!this._hasColumns()&&!this.selected?!1:super._computeEnabled(t,e)}_renderChart(){this.chart&&(this.chart.render(this.$contentContainer),this.chart.$container.addClass(this.denseClass))}_createLayout(){return new Bt(this)}_renderChartType(){this._selectChartType(),this.$yAxisSelect.toggleClass("hide",this.chartType!==u.Type.BUBBLE),this.$yAxisSelect.toggleClass("animated",h.scout.isOneOf(u.Type.BUBBLE,this.chartType,this.oldChartType)&&!!this.oldChartType),this.$yAxisSelect.data("scroll-shadow").setVisible(!1),this.$yAxisSelect.oneAnimationEnd(()=>{h.scrollbars.update(this.$yAxisSelect),this.$yAxisSelect.data("scroll-shadow").setVisible(!0),this.$yAxisSelect.removeClass("animated")}),this.contentRendered&&this.chart.$container.animateAVCSD("opacity",0,()=>{this.chart.$container.css("opacity",1),this._drawChart()})}_selectChartType(){h.objects.values(this._chartTypeMap).forEach(t=>{t.removeClass("selected")}),this._chartTypeMap[this.chartType].addClass("selected")}_renderChartGroup1(){this._renderChartGroup(1)}_renderChartGroup2(){this._renderChartGroup(2)}_renderChartGroup(t){if(!this._hasColumns())return;let e="chartGroup"+t,r="_"+e+"Map",a=this[e];if(a){let i=this[r][a.id];if(i.siblings(".select-axis").animateAVCSD("height",30),i.selectOne("selected"),a.modifier>0){let s=a.modifier^Q.DATE_GROUP_FLAG;i.animateAVCSD("height",42),i.children(".select-axis-group").text(this.dateGroup[s][1])}this.contentRendered&&this._drawChart()}}_renderChartAggregation(){let t=this._aggregationMap[this.chartAggregation.id||"all"];t&&(t.selectOne(),t.removeClass("data-sum").removeClass("data-avg"),t.addClass(this._getAggregationCssClass()),this.contentRendered&&this._drawChart())}_getAggregationCssClass(){switch(this.chartAggregation.modifier){case h.TableMatrix.NumberGroup.COUNT:return"data-count";case h.TableMatrix.NumberGroup.SUM:return"data-sum";case h.TableMatrix.NumberGroup.AVG:return"data-avg";default:return null}}_renderChartSelect(t,e,r){let a=h.scout.create(h.Icon,{parent:this,iconDesc:r,cssClass:t});a.render(this.$chartSelect),this.$contentContainer.one("remove",()=>a.destroy());let i=a.$container;i.toggleClass("disabled",!this.enabledComputed||!this._hasColumns()).data("chartType",e),this.enabledComputed&&this._hasColumns()&&i.on("click",this._onClickChartType.bind(this)),this._chartTypeMap[e]=i}_renderChartSelectContainer(){this.$chartSelect=this.$contentContainer.appendDiv("chart-select"),this._chartTypeMap={};let t=this._getSupportedChartTypes();h.scout.isOneOf(u.Type.BAR,t)&&this._renderChartSelect("chart-bar",u.Type.BAR,h.icons.DIAGRAM_BARS_VERTICAL),h.scout.isOneOf(u.Type.BAR_HORIZONTAL,t)&&this._renderChartSelect("chart-stacked",u.Type.BAR_HORIZONTAL,h.icons.DIAGRAM_BARS_HORIZONTAL),h.scout.isOneOf(u.Type.LINE,t)&&this._renderChartSelect("chart-line",u.Type.LINE,h.icons.DIAGRAM_LINE),h.scout.isOneOf(u.Type.PIE,t)&&this._renderChartSelect("chart-pie",u.Type.PIE,h.icons.DIAGRAM_PIE),h.scout.isOneOf(u.Type.BUBBLE,t)&&this._renderChartSelect("chart-bubble",u.Type.BUBBLE,h.icons.DIAGRAM_SCATTER)}_getSupportedChartTypes(){return[u.Type.BAR,u.Type.BAR_HORIZONTAL,u.Type.LINE,u.Type.PIE,u.Type.BUBBLE]}_onClickChartType(t){let e=C()(t.currentTarget),r=e.data("chartType");this.setChartType(r)}_onClickChartGroup(t){let e=C()(t.currentTarget),r=e.parent().data("groupId"),a=e.data("column"),i=e.data("modifier");if(!e.isEnabled())return;let s=e.isSelected()?this._nextDateModifier(i):i;e.data("modifier",s);let l={id:a?a.id:null,modifier:s};this._setChartGroup(r,l)}_onClickAggregation(t){let e=C()(t.currentTarget),r=e.data("modifier"),a=e.isSelected()?this._nextModifier(r):r;e.data("modifier",a);let i=e.data("column"),s={id:i?i.id:null,modifier:a};this._setChartAggregation(s)}_nextDateModifier(t){switch(t){case h.TableMatrix.DateGroup.DATE:return h.TableMatrix.DateGroup.MONTH;case h.TableMatrix.DateGroup.MONTH:return h.TableMatrix.DateGroup.WEEKDAY;case h.TableMatrix.DateGroup.WEEKDAY:return h.TableMatrix.DateGroup.YEAR;case h.TableMatrix.DateGroup.YEAR:return h.TableMatrix.DateGroup.DATE;default:return t}}_nextModifier(t){switch(t){case h.TableMatrix.NumberGroup.SUM:return h.TableMatrix.NumberGroup.AVG;case h.TableMatrix.NumberGroup.AVG:return h.TableMatrix.NumberGroup.SUM;default:return t}}_setChartAggregation(t){t!==this.chartAggregation&&(this._setProperty("chartAggregation",t),this.contentRendered&&this._renderChartAggregation())}_setChartGroup1(t){this._setChartGroup(1,t)}_setChartGroup2(t){this._setChartGroup(2,t)}_setChartGroup(t,e){let r="chartGroup"+t;this._changeProperty(r,e)}_changeProperty(t,e){e!==this[t]&&(this._setProperty(t,e),this.contentRendered&&this["_render"+t.charAt(0).toUpperCase()+t.slice(1)]())}setChartType(t){this.oldChartType=this.chartType,this.setProperty("chartType",t)}_hasColumns(){return this.table.columns.length!==0}_axisCount(t,e){let r;for(let a=0;a<t.length;a++)if(r=t[a][0],r===e)return t[a][1];return 0}_plainAxisText(t,e){return t.headerHtmlEnabled?h.strings.plainText(e).replace(/\n/g," "):e}_renderContent(t){this.$contentContainer=t.appendDiv("chart-container"),this._installScrollbars(),this._renderChartSelectContainer(),this.dateGroup=[[h.TableMatrix.DateGroup.YEAR,this.session.text("ui.groupedByYear")],[h.TableMatrix.DateGroup.MONTH,this.session.text("ui.groupedByMonth")],[h.TableMatrix.DateGroup.WEEKDAY,this.session.text("ui.groupedByWeekday")],[h.TableMatrix.DateGroup.DATE,this.session.text("ui.groupedByDate")]],this._filterResetListener=this.table.on("filterReset",r=>{this.chart&&this.chart.setCheckedItems([])}),this._addListeners(),this._renderAxisSelectorsContainer();let e=this._renderAxisSelectors();this._renderChart(),this._initializeSelection(e),this._renderChartParts(),this._drawChart()}_addListeners(){this.table.on("rowsInserted",this._tableUpdatedHandler),this.table.on("rowsDeleted",this._tableUpdatedHandler),this.table.on("allRowsDeleted",this._tableUpdatedHandler),this.chart.on("valueClick",this._chartValueClickedHandler)}_renderAxisSelectorsContainer(){this.$axisSelectContainer=this.$contentContainer.appendDiv("axis-select-container")}_renderAxisSelectors(){this.$xAxisSelect=this.$axisSelectContainer.appendDiv("xaxis-select").data("groupId",1),h.scrollbars.install(this.$xAxisSelect,{parent:this,session:this.session,axis:"y"}),this.$yAxisSelect=this.$axisSelectContainer.appendDiv("yaxis-select").data("groupId",2),h.scrollbars.install(this.$yAxisSelect,{parent:this,session:this.session,axis:"y"}),this._chartGroup1Map={},this._chartGroup2Map={};let t=new h.TableMatrix(this.table,this.session),e=t.columnCount(!1);e.sort((l,d)=>Math.abs(l[1]-8)-Math.abs(d[1]-8));let r,a,i=0,s=t.columns(!1);for(let l=0;l<s.length;l++){let d,n,c,p=s[l];p instanceof h.DateColumn?a=!0:(r=this._axisCount(e,p),a=r<=Q.MAX_AXIS_COUNT),d=this._axisContentForColumn(p),n=this.$contentContainer.makeDiv("select-axis",this._plainAxisText(p,d.text)).data("column",p).setEnabled(a),a||(this.chartGroup1&&this.chartGroup1.id===p.id&&(this.chartGroup1=null,this.chartGroup2=null),this.chartGroup2&&this.chartGroup2.id===p.id&&(this.chartGroup2=null)),d.icon&&n.addClass(d.icon.appendCssClass("font-icon")),p instanceof h.DateColumn&&n.data("modifier",h.TableMatrix.DateGroup.YEAR).appendDiv("select-axis-group",this.dateGroup[0][1]),a?(n.on("click",this._onClickChartGroup.bind(this)),h.tooltips.installForEllipsis(n,{parent:this})):h.tooltips.install(n,{parent:this,text:this.session.text("ui.TooMuchData")}),i++,c=n.clone(!0),this._chartGroup1Map[p.id]=n,this._chartGroup2Map[p.id]=c,this.$xAxisSelect.append(n),this.$yAxisSelect.append(c)}if(this._aggregationMap={},this._hasColumns()){this.$dataSelect=this.$axisSelectContainer.appendDiv("data-select"),h.scrollbars.install(this.$dataSelect,{parent:this,session:this.session,axis:"y"});let l=this.session.text("ui.Count");this._aggregationMap.all=this.$dataSelect.appendDiv("select-data data-count",l).data("column",null).data("modifier",h.TableMatrix.NumberGroup.COUNT);for(let d=0;d<s.length;d++){let n=s[d],c=d+1;if(n instanceof h.NumberColumn){let p;h.strings.hasText(n.text)?p=this._plainAxisText(n,n.text):h.strings.hasText(n.headerTooltipText)?p=n.headerTooltipText:p="["+c+"]",this._aggregationMap[n.id]=this.$dataSelect.appendDiv("select-data data-sum",p).data("column",n).data("modifier",h.TableMatrix.NumberGroup.SUM)}}C()(".select-data",this.$contentContainer).on("click",this._onClickAggregation.bind(this))}return e}_initializeSelection(t){let e;this.chartType||this.setChartType(u.Type.BAR),(!this.chartAggregation||!this._aggregationMap[this.chartAggregation.id])&&this._setChartAggregation({id:null,modifier:h.TableMatrix.NumberGroup.COUNT}),(!this.chartGroup1||!this.chartGroup1.id||!this._chartGroup1Map[this.chartGroup1.id])&&(e=this.$xAxisSelect.children(":not(.disabled)"),this._setDefaultSelectionForGroup(1,t,e,0)),(!this.chartGroup2||!this.chartGroup2.id||!this._chartGroup2Map[this.chartGroup2.id])&&(e=this.$yAxisSelect.children(":not(.disabled)"),this._setDefaultSelectionForGroup(2,t,e,1))}_setDefaultSelectionForGroup(t,e,r,a){let i=this._getDefaultSelectedColumn(e,r,a);i&&this._setChartGroup(t,this._getDefaultChartGroup(i))}_getDefaultSelectedColumn(t,e,r){let a=0,i,s;for(let l=0;l<t.length&&a<=r;l++)i=t[l][0],this._existsInAxisColumns(e,i)&&(s=i,a++);return s}_existsInAxisColumns(t,e){for(let r=0;r<t.length;r++)if(t.eq(r).data("column")===e)return!0;return!1}_getDefaultChartGroup(t){let e;return t instanceof h.DateColumn&&(e=256),{id:t.id,modifier:e}}_renderChartParts(){this._renderChartType(),this._renderChartAggregation(),this._renderChartGroup1(),this._renderChartGroup2()}_drawChart(){if(!this._hasColumns()){this._hideChart();return}let t=this._calculateValues();if(t&&t.length)this.chart.setVisible(!0);else{this._hideChart();return}let e={type:this.chartType,options:{handleResize:!0,colorScheme:this.chartColorScheme,maxSegments:5,plugins:{legend:{display:!1}}}},r=[];e.data=this._computeData(r,t),this._adjustFont(e,r),this._adjustConfig(e),this.chart.setConfig(e);let a=this._computeCheckedItems(e.data.datasets[0].deterministicKeys);this.chart.setCheckedItems(a)}_hideChart(){this.chart.setConfig({type:this.chartType}),this.chart.setVisible(!1)}_getDatasetLabel(){let t=this._aggregationMap[this.chartAggregation.id||"all"];return(t?t.text():null)||this.session.text("ui.Value")}_calculateValues(){let t=new h.TableMatrix(this.table,this.session),e=this.chartAggregation.id?this._aggregationMap[this.chartAggregation.id].data("column"):-1;if(t.addData(e,this.chartAggregation.modifier),this.chartGroup1){let r=this._chartGroup1Map[this.chartGroup1.id].data("column");this.xAxis=t.addAxis(r,this.chartGroup1.modifier)}if(this.chartType===u.Type.BUBBLE&&this.chartGroup2){let r=this._chartGroup2Map[this.chartGroup2.id].data("column");this.yAxis=t.addAxis(r,this.chartGroup2.modifier)}else this.yAxis=null;if(!(t.isEmpty()||!t.isMatrixValid()))return t.calculate()}_getXAxis(){return this.xAxis}_getYAxis(){return this.yAxis}_computeData(t,e){let r={datasets:[{label:this._getDatasetLabel()}]};if(!e)return r;t=t||[];let a=[];if(this.chartType===u.Type.BUBBLE)a=this._computeBubbleData(t,e);else{let l=this._getXAxis();for(let d=0;d<l.length;d++){let n,c=l[d];l.column instanceof h.NumberColumn?n=c:n=this._handleIconLabel(l.format(c),l,t),a.push({value:e.getValue([c])[0],label:n,deterministicKey:l.keyToDeterministicKey(c)})}}let i=r.datasets[0],s=[];return i.data=[],i.deterministicKeys=[],a.forEach(l=>{i.data.push(l.value),i.deterministicKeys.push(l.deterministicKey),h.objects.isNullOrUndefined(l.label)||s.push(l.label)}),s.length&&(r.labels=s),r}_computeBubbleData(t,e){if(!e)return[];t=t||[];let r=this._getXAxis(),a=this._getYAxis(),i=[];for(let s=0;s<r.length;s++){let l=r[s],d=l;this._handleIconLabel(r.format(l),r,t),!(r.column instanceof h.NumberColumn)&&d===null&&(d=r.max),r.column instanceof h.DateColumn&&(d=d-r.min);for(let n=0;n<a.length;n++){let c=a[n],p=c,f=e.getValue([l,c]);this._handleIconLabel(a.format(c),a,t),f&&f.length&&(!(a.column instanceof h.NumberColumn)&&p===null&&(p=a.max),a.column instanceof h.DateColumn&&(p=p-a.min),i.push({value:{x:d,y:p,z:f[0]},deterministicKey:[r.keyToDeterministicKey(l),a.keyToDeterministicKey(c)]}))}}return i}_handleIconLabel(t,e,r){if(e&&e.textIsIcon){let a=h.icons.parseIconId(t);if(a&&a.isFontIcon())return r.push(...a.appendCssClass("font-icon").split(" ")),a.iconCharacter}return t}_adjustFont(t,e){if(!(!t||!e)&&(e=e.filter((r,a,i)=>i.indexOf(r)===a),e.length)){let r=h.styles.get(e,"font-family").fontFamily;this.chartType!==u.Type.PIE&&(t.options=C().extend(!0,{},t.options,{scales:{x:{ticks:{font:{family:r}}},y:{ticks:{font:{family:r}}}}})),t.options=C().extend(!0,{},t.options,{plugins:{tooltip:{titleFont:{family:r}}}}),t.options=C().extend(!0,{},t.options,{plugins:{datalabels:{font:{family:r}}}})}}_adjustLabels(t){if(!t)return;let e=this._getXAxis(),r=this._getYAxis();this.chartType===u.Type.BUBBLE?(e.column instanceof h.NumberColumn||(t.options=C().extend(!0,{},t.options,{scales:{x:{ticks:{callback:a=>this._formatLabel(a,e)}}}})),r.column instanceof h.NumberColumn||(t.options=C().extend(!0,{},t.options,{scales:{y:{ticks:{callback:a=>this._formatLabel(a,r)}}}}))):e.column instanceof h.NumberColumn&&(t.options=C().extend(!0,{},t.options,{reformatLabels:!0}))}_formatLabel(t,e){if(e){if(e.column instanceof h.DateColumn&&(t=t+e.min,t!==parseInt(""+t)||e.length<2&&(t<e.min||t>e.max)))return null;if(e.indexOf(null)!==-1){if(t===e.max)t=null;else if(t>e.max)return null}if(t=e.format(t),e.textIsIcon){let r=h.icons.parseIconId(t);r&&r.isFontIcon()&&(t=r.iconCharacter)}}return""+t}_adjustConfig(t){!t||(this._adjustLabels(t),this._adjustClickable(t),this.chartType===u.Type.BUBBLE?this._adjustBubble(t):this.chartType===u.Type.PIE?this._adjustPie(t):this._adjustScales(t))}_adjustClickable(t){!t||this._isChartClickable()&&(t.options=C().extend(!0,{},t.options,{clickable:!0,checkable:!0,otherSegmentClickable:!0}))}_isChartClickable(){return!0}_adjustBubble(t){!t||this.chartType!==u.Type.BUBBLE||(t.options.bubble=C().extend(!0,{},t.options.bubble,{sizeOfLargestBubble:25,minBubbleSize:5}))}_adjustPie(t){if(!t||this.chartType!==u.Type.PIE)return;t.data.datasets[0].datalabels={labels:{index:{display:"auto",color:h.styles.get([this.chartColorScheme,this.chartType+"-chart","elements","label"],"fill").fill,formatter:(r,a)=>a.chart.data.labels[a.dataIndex],anchor:"end",align:"end",clamp:!0,offset:10,padding:4},labels:{}}},t.options=C().extend(!0,{},t.options,{plugins:{datalabels:{display:!0}}});let e=this.chart.$container.cssMarginTop()-this.chart.$container.cssMarginBottom();t.options=C().extend(!0,{},t.options,{layout:{padding:{top:30+(Math.sign(e)<0?Math.abs(e):0),bottom:30+(Math.sign(e)>0?e:0)}}})}_adjustScales(t){!t||(t.options=C().extend(!0,{},t.options,{scales:{x:{beginAtZero:!0},y:{beginAtZero:!0}}}))}_computeCheckedItems(t){if(!t)return[];let e=this._getXAxis(),r=this._getYAxis(),a=this.table.getFilter(z.TYPE),i=[],s=[];a&&(a.xAxis||{}).column===(e||{}).column&&(a.yAxis||{}).column===(r||{}).column&&(i=a.filters),t.forEach((n,c)=>{i.filter(p=>Array.isArray(p.deterministicKey)&&Array.isArray(n)?h.arrays.equals(p.deterministicKey,n):p.deterministicKey===n).length&&s.push(c)});let l=0;if(this.chartType===u.Type.PIE){let n=this.chart.config.options.maxSegments,c=h.arrays.init(t.length-n,null).map((p,f)=>f+n);h.arrays.containsAll(s,c)||h.arrays.remove(s,n-1),h.arrays.removeAll(s,c),l=1}let d=[];return s.length&&s.forEach(n=>{d.push({datasetIndex:l,dataIndex:n})}),d}_onChartValueClick(){let t=[];if(this.chart&&this.chart.config.data){let e=this.chart.config.options.maxSegments,r=this.chart.config.data.datasets[0],a=s=>({deterministicKey:r.deterministicKeys[s]});this.chartType===u.Type.PIE&&(a=s=>(s=parseInt(""+s),e&&e===s+1?h.arrays.init(r.deterministicKeys.length-s,null).map((l,d)=>({deterministicKey:r.deterministicKeys[d+s]})):{deterministicKey:r.deterministicKeys[s]})),this.chart.checkedItems.filter(s=>s.datasetIndex===0).map(s=>s.dataIndex).forEach(s=>{h.arrays.pushAll(t,a(s))})}if(t.length){let e=h.scout.create(z,{session:this.session,table:this.table,text:this.tooltipText,xAxis:this._getXAxis(),yAxis:this._getYAxis(),filters:t});this.table.addFilter(e)}else this.table.removeFilterByKey(z.TYPE)}_axisContentForColumn(t){let e=t.text;if(h.strings.hasText(e))return{text:e};if(t.headerIconId){let r=h.icons.parseIconId(t.headerIconId);if(r.isFontIcon())return{text:r.iconCharacter,icon:r}}return t.headerTooltipText?{text:t.headerTooltipText}:{text:"["+(this.table.visibleColumns().indexOf(t)+1)+"]"}}_removeContent(){this._removeScrollbars(),this.$contentContainer.remove(),this.chart.remove(),this.table.events.removeListener(this._filterResetListener),this._removeListeners(),this.oldChartType=null,this.recomputeEnabled()}_removeScrollbars(){this.$xAxisSelect.each((t,e)=>{h.tooltips.uninstall(C()(e))}),h.scrollbars.uninstall(this.$xAxisSelect,this.session),this.$yAxisSelect.each((t,e)=>{h.tooltips.uninstall(C()(e))}),h.scrollbars.uninstall(this.$yAxisSelect,this.session),h.scrollbars.uninstall(this.$dataSelect,this.session),this._uninstallScrollbars()}_removeListeners(){this.table.off("rowsInserted",this._tableUpdatedHandler),this.table.off("rowsDeleted",this._tableUpdatedHandler),this.table.off("allRowsDeleted",this._tableUpdatedHandler),this.chart.off("valueClick",this._chartValueClickedHandler)}_onTableUpdated(t){this._tableUpdatedTimeOutId||(this._tableUpdatedTimeOutId=setTimeout(()=>{this._tableUpdatedTimeOutId=null,this.rendered&&(this._setChartGroup1(null),this._setChartGroup2(null),this.removeContent(),this.renderContent())}))}_onTableColumnStructureChanged(){this.recomputeEnabled(),this.contentRendered&&this.selected&&this._onTableUpdated()}}k(Q,"DATE_GROUP_FLAG",256),k(Q,"MAX_AXIS_COUNT",100);function Z(o,t,e){return t=Le(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function Le(o){var t=ke(o,"string");return typeof t=="symbol"?t:String(t)}function ke(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class z extends h.TableUserFilter{constructor(){super(),Z(this,"text",void 0),Z(this,"xAxis",void 0),Z(this,"yAxis",void 0),Z(this,"filters",void 0),Z(this,"columnIdX",void 0),Z(this,"columnIdY",void 0),this.filterType=z.TYPE,this.text=null,this.xAxis=null,this.yAxis=null,this.filters=[],this.columnIdX=null,this.columnIdY=null}createLabel(){return this.text}createFilterAddedEventData(){let t=super.createFilterAddedEventData();return t.text=this.text,t.filters=this.filters,t.columnIdX=this.xAxis&&this.xAxis.column?this.xAxis.column.id:null,t.columnIdY=this.yAxis&&this.yAxis.column?this.yAxis.column.id:null,t}calculate(){let t=new h.TableMatrix(this.table,this.session),e=this.table.columnById(this.columnIdX),r=e.createFilter().axisGroup();if(this.xAxis=t.addAxis(e,r),this.columnIdY){let a=this.table.columnById(this.columnIdY),i=a.createFilter().axisGroup();this.yAxis=t.addAxis(a,i)}t.calculate()}accept(t){this.xAxis||this.calculate();let e=this.xAxis.column.cellValueOrTextForCalculation(t),r=this.xAxis.normDeterministic(e);if(!this.yAxis)return this.filters.filter(i=>i.deterministicKey===r).length>0;e=this.yAxis.column.cellValueOrTextForCalculation(t);let a=this.yAxis.normDeterministic(e);return this.filters.filter(i=>h.arrays.equals(i.deterministicKey,[r,a])).length>0}}Z(z,"TYPE","CHART");class wt extends h.TableControlAdapter{constructor(){super(),this._addRemoteProperties(["chartType","chartAggregation","chartGroup1","chartGroup2"])}}function Se(o,t,e){return t=Oe(t),t in o?Object.defineProperty(o,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):o[t]=e,o}function Oe(o){var t=Pe(o,"string");return typeof t=="symbol"?t:String(t)}function Pe(o,t){if(typeof o!="object"||o===null)return o;var e=o[Symbol.toPrimitive];if(e!==void 0){var r=e.call(o,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(o)}class Bt extends h.AbstractLayout{constructor(t){super(),Se(this,"control",void 0),this.control=t}layout(t){!this.control.contentRendered||(h.scrollbars.update(this.control.$contentContainer),h.scrollbars.update(this.control.$xAxisSelect),h.scrollbars.update(this.control.$yAxisSelect),h.scrollbars.update(this.control.$dataSelect))}}const Ht=lt;h.ObjectFactory.get().registerNamespace("scout",lt);var Ee=S.AbstractChartRenderer,Me=S.AbstractSvgChartRenderer,Ie=S.Chart,De=S.ChartAdapter,we=S.ChartField,He=S.ChartFieldAdapter,Ne=S.ChartFieldTile,Ge=S.ChartFieldTileAdapter,Fe=S.ChartJsRenderer,Ve=S.ChartLayout,$e=S.ChartTableControl,je=S.ChartTableControlAdapter,Ue=S.ChartTableControlLayout,We=S.ChartTableUserFilter,ze=S.FulfillmentChartRenderer,Xe=S.SalesfunnelChartRenderer,Ye=S.SpeedoChartRenderer,Je=S.VennAsync3Calculator,Ke=S.VennChartRenderer,qe=S.VennCircle,Ze=S.VennCircleHelper,Qe=S.default;export{Ee as AbstractChartRenderer,Me as AbstractSvgChartRenderer,Ie as Chart,De as ChartAdapter,we as ChartField,He as ChartFieldAdapter,Ne as ChartFieldTile,Ge as ChartFieldTileAdapter,Fe as ChartJsRenderer,Ve as ChartLayout,$e as ChartTableControl,je as ChartTableControlAdapter,Ue as ChartTableControlLayout,We as ChartTableUserFilter,ze as FulfillmentChartRenderer,Xe as SalesfunnelChartRenderer,Ye as SpeedoChartRenderer,Je as VennAsync3Calculator,Ke as VennChartRenderer,qe as VennCircle,Ze as VennCircleHelper,Qe as default};
2
+
3
+ //# sourceMappingURL=eclipse-scout-chart.esm-558d382efe651ca2215b.min.js.map