@eclipse-scout/chart 22.0.29 → 22.0.34
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.
- package/dist/eclipse-scout-chart-bc08151d11e1909eff6c.min.js +3 -0
- package/dist/{eclipse-scout-chart-4ad3082843cacd9fd867.min.js.LICENSE.txt → eclipse-scout-chart-bc08151d11e1909eff6c.min.js.LICENSE.txt} +0 -0
- package/dist/eclipse-scout-chart-bc08151d11e1909eff6c.min.js.map +1 -0
- package/dist/eclipse-scout-chart-theme-79622289bda68b525e3e.min.css +1 -0
- package/dist/eclipse-scout-chart-theme-dark-1de09c03e3dc40a9529a.min.css +1 -0
- package/dist/eclipse-scout-chart-theme-dark.css +528 -242
- package/dist/eclipse-scout-chart-theme-dark.css.map +1 -1
- package/dist/eclipse-scout-chart-theme.css +528 -242
- package/dist/eclipse-scout-chart-theme.css.map +1 -1
- package/dist/eclipse-scout-chart.js +988 -4973
- package/dist/eclipse-scout-chart.js.map +1 -1
- package/dist/file-list +5 -5
- package/package.json +3 -3
- package/src/chart/Chart.js +4 -2
- package/src/chart/Chart.less +60 -4
- package/src/chart/ChartJsRenderer.js +204 -89
- package/src/chart/SalesfunnelChartRenderer.js +6 -9
- package/dist/eclipse-scout-chart-4ad3082843cacd9fd867.min.js +0 -3
- package/dist/eclipse-scout-chart-4ad3082843cacd9fd867.min.js.map +0 -1
- package/dist/eclipse-scout-chart-theme-4801a2aff3179586b17c.min.css +0 -1
- package/dist/eclipse-scout-chart-theme-dark-7429dc23c823152027f3.min.css +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! For license information please see eclipse-scout-chart-bc08151d11e1909eff6c.min.js.LICENSE.txt */
|
|
2
|
+
(()=>{"use strict";var t={n:e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return t.d(i,{a:i}),i},d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{AbstractChartRenderer:()=>l,AbstractSvgChartRenderer:()=>u,Chart:()=>n,ChartAdapter:()=>o,ChartField:()=>No,ChartFieldAdapter:()=>Ho,ChartFieldTile:()=>zo,ChartFieldTileAdapter:()=>jo,ChartJsRenderer:()=>Lo,ChartLayout:()=>r,ChartTableControl:()=>Go,ChartTableControlAdapter:()=>Jo,ChartTableControlLayout:()=>qo,ChartTableUserFilter:()=>Uo,FulfillmentChartRenderer:()=>Oo,SalesfunnelChartRenderer:()=>Bo,SpeedoChartRenderer:()=>Po,VennAsync3Calculator:()=>Eo,VennChartRenderer:()=>Vo,VennCircle:()=>Fo,VennCircleHelper:()=>Io,default:()=>Zo});var i={};t.r(i),t.d(i,{AbstractChartRenderer:()=>l,AbstractSvgChartRenderer:()=>u,Chart:()=>n,ChartAdapter:()=>o,ChartField:()=>No,ChartFieldAdapter:()=>Ho,ChartFieldTile:()=>zo,ChartFieldTileAdapter:()=>jo,ChartJsRenderer:()=>Lo,ChartLayout:()=>r,ChartTableControl:()=>Go,ChartTableControlAdapter:()=>Jo,ChartTableControlLayout:()=>qo,ChartTableUserFilter:()=>Uo,FulfillmentChartRenderer:()=>Oo,SalesfunnelChartRenderer:()=>Bo,SpeedoChartRenderer:()=>Po,VennAsync3Calculator:()=>Eo,VennChartRenderer:()=>Vo,VennCircle:()=>Fo,VennCircleHelper:()=>Io,default:()=>Zo});const s=scout;function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class n extends s.Widget{constructor(){super(),this.$container=null,this.chartRenderer=null,this.data=null,this.config=null,this.checkedItems=[],this._updateChartTimeoutId=null,this._updateChartOpts=null,this._updateChartOptsWhileNotAttached=[],this.updatedOnce=!1}_init(t){super._init(t),this.setConfig(this.config)}_render(){this.$container=this.$parent.appendDiv("chart"),this.htmlComp=s.HtmlComponent.install(this.$container,this.session),this.htmlComp.setLayout(new r(this))}_renderProperties(){super._renderProperties(),this._renderClickable(),this._renderCheckable(),this._renderChartType(),this._renderColorScheme(),this.updateChart({requestAnimation:!0,debounce:n.DEFAULT_DEBOUNCE_TIMEOUT})}_renderOnAttach(){super._renderOnAttach(),this._updateChartOptsWhileNotAttached.splice(0).forEach((t=>this.updateChart($.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)}_renderData(){this.updateChart({requestAnimation:!0,debounce:n.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:!0})}setConfig(t){let e={type:n.Type.PIE,options:{autoColor:!0,colorScheme:s.colorSchemes.ColorSchemeId.DEFAULT,transparent:!1,maxSegments:5,adjustGridMaxMin:!0,clickable:!1,checkable:!1,animation:{duration:n.DEFAULT_ANIMATION_DURATION},plugins:{datalabels:{display:!1},tooltip:{enabled:!0},legend:{display:!0,clickable:!1,position:n.Position.RIGHT}}}};if((t=$.extend(!0,{},e,t)).options.colorScheme=s.colorSchemes.ensureColorScheme(t.options.colorScheme),s.objects.equalsRecursive(this.config,t))return;let i=$.extend(!0,{},this.config);t.data?i.data=t.data:delete i.data;let a=(t,e,i)=>{if(t&&e&&i)return t.options&&t.options[i]?void(e.options[i]=t.options[i]):(e.options&&delete e.options[i],!e.options||!s.objects.isEmpty(e.options.scales)||t.options&&t.options.scales||delete e.options.scales,void(s.objects.isEmpty(e.options)&&!t.options&&delete e.options))};if(a(t,i,"xLabelMap"),a(t,i,"yLabelMap"),s.objects.equalsRecursive(i,t))return this._setProperty("config",t),this.rendered&&this._renderConfig(!0),void this.setCheckedItems(this.checkedItems);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:n.DEFAULT_DEBOUNCE_TIMEOUT,onlyUpdateData:t})}setCheckedItems(t){this.setProperty("checkedItems",s.arrays.ensure(this._filterCheckedItems(t)))}_filterCheckedItems(t){if(!Array.isArray(t))return t;let e=[];this.data&&this.data.chartValueGroups?this.data.chartValueGroups.forEach((t=>e.push(t.values.length))):this.config&&this.config.data&&this.config.data.datasets.forEach((t=>e.push(t.data.length)));let i=t.filter((t=>e[t.datasetIndex]&&t.dataIndex<e[t.datasetIndex]));return i.length<t.length?i: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(){s.colorSchemes.toggleColorSchemeClasses(this.$container,this.config.options.colorScheme)}updateChart(t){(t=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=function(){if(this._updateChartTimeoutId=null,this._updateChartOpts=null,!this.$container||!this.$container.isAttached())return void this._updateChartOptsWhileNotAttached.push(t);if(this.updatedOnce=!0,!this.chartRenderer)return;t.enforceRerender?this.chartRenderer.remove(this.chartRenderer.shouldAnimateRemoveOnUpdate(t),(e=>{this.removing||e||(this.chartRenderer.render(t.requestAnimation),this.trigger("chartRender"))})):t.onlyUpdateData&&this.chartRenderer.isDataUpdatable()?this.chartRenderer.updateData(t.requestAnimation):t.onlyRefresh&&this.chartRenderer.refresh()}.bind(this);!0===t.debounce||"number"==typeof t.debounce?(this._updateChartOpts=t,"number"==typeof t.debounce?this._updateChartTimeoutId=setTimeout(e,t.debounce):this._updateChartTimeoutId=setTimeout(e)):e()}_resolveChartRenderer(){switch(this.config.type){case n.Type.FULFILLMENT:return new Oo(this);case n.Type.SPEEDO:return new Po(this);case n.Type.SALESFUNNEL:return new Bo(this);case n.Type.VENN:return new Vo(this);case n.Type.BAR:case n.Type.BAR_HORIZONTAL:case n.Type.LINE:case n.Type.COMBO_BAR_LINE:case n.Type.PIE:case n.Type.DOUGHNUT:case n.Type.POLAR_AREA:case n.Type.RADAR:case n.Type.BUBBLE:case n.Type.SCATTER:return new Lo(this)}return null}_updateChartRenderer(){this.chartRenderer&&this.chartRenderer.remove(),this.setProperty("chartRenderer",this._resolveChartRenderer())}_onValueClick(t){if(this.config.options.checkable){let e=[...this.checkedItems],i=t.data,a=e.filter((t=>t.datasetIndex===i.datasetIndex&&t.dataIndex===i.dataIndex))[0];a?s.arrays.remove(e,a):e.push(i),this.setCheckedItems(e)}this.trigger("valueClick",t)}}a(n,"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"}),a(n,"Position",{TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center"}),a(n,"DEFAULT_ANIMATION_DURATION",600),a(n,"DEFAULT_DEBOUNCE_TIMEOUT",100);class o extends s.ModelAdapter{constructor(){super()}_onWidgetValueClick(t){this._send("valueClick",t.data)}_onWidgetEvent(t){"valueClick"===t.type?this._onWidgetValueClick(t):super._onWidgetEvent(t)}}class r extends s.AbstractLayout{constructor(t){super(),this.chart=t}layout(t){let e={requestAnimation:!0,debounce:n.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)}}class l{constructor(t){this.chart=t,this.session=t.session,this.rendering=!1,this.rendered=!1,this.animationDuration=0,this.firstOpaqueBackgroundColor=""}validate(){return!!this._validateChartData()&&this._validate()}_validateChartData(){let t=this.chart&&this.chart.data;if(!t||!t.chartValueGroups||0===t.chartValueGroups.length)return!1;let e,i=0;for(e=0;e<t.chartValueGroups.length;e++){let s=t.chartValueGroups[e];if(!s.values)return!1;if(0===e)i=s.values.length;else if(s.values.length!==i)return!1;if(!this.chart.config.options.autoColor&&!s.colorHexValue&&!s.cssClass)return!1}for(e=0;e<t.axes.length;e++)if(t.axes[e].length!==i)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){this.rendered?(this.animationDuration=t?this.chart.config.options.animation.duration:0,this.validate()&&this.isDataUpdatable()&&this._updateData()):this.render(t)}_updateData(){}isDataUpdatable(){return!1}refresh(){this.rendered&&this.remove(!1),this.render(!1)}remove(t,e){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}}const h=jQuery;var c=t.n(h);function d(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class u extends l{constructor(t){super(t),this.chartBox={},this.labelBox={},this.clipId="Clip-"+s.ObjectFactory.get().createUniqueId(),this.maskId="Mask-"+s.ObjectFactory.get().createUniqueId(),this.suppressLegendBox=!1}_render(){this.$svg||(this.$svg=this.chart.$container.appendSVG("svg","chart-svg")),this.firstOpaqueBackgroundColor=s.styles.getFirstOpaqueBackgroundColor(this.$svg),this.svgHeight=this.$svg.height(),this.svgWidth=this.$svg.width(),this.height=this.svgHeight,this.width=this.svgWidth,this._initChartBox(),this._useFontSizeBig()?this.$svg.addClass(u.FONT_SIZE_BIG):this._useFontSizeMiddle()?this.$svg.addClass(u.FONT_SIZE_MIDDLE):this._useFontSizeSmall()?this.$svg.addClass(u.FONT_SIZE_SMALL):this._useFontSizeSmallest()&&this.$svg.addClass(u.FONT_SIZE_SMALLEST),this.$svg.isAttached()&&this._renderInternal()}_renderInternal(){}_useFontSizeBig(){return!1}_useFontSizeMiddle(){return!1}_useFontSizeSmall(){return!1}_useFontSizeSmallest(){return!1}remove(t,e){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 i,s=this.$svg.appendSVG("text",e).attr("x",0).attr("y",0).attr("visibility","hidden").text(t);try{i=s[0].getBBox()}catch(t){return{height:0,width:0}}return s.remove(),i}_renderLine(t,e,i,s,a){let n=this.$svg.appendSVG("line",a).attr("x1",t).attr("y1",e).attr("x2",i).attr("y2",s);return this.animationDuration&&n.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),n}_renderLineLabel(t,e,i,s,a){let n=this.$svg.appendSVG("text",s||"line-label").attr("x",t).attr("y",e).text(i);if(a){n.attr("mask","url(#"+this.maskId+")");let a=this.$svg.appendSVG("text",s?s+" background":"line-label-background").attr("x",t).attr("y",e).attr("clip-path","url(#"+this.clipId+")").text(i);n.data("$background",a),this.animationDuration&&a.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}return this.animationDuration&&n.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),n}_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(e,i){try{t.bind(this)(e,i)}catch(t){throw c()(this).stop(!0,!1),t}},duration:e||n.DEFAULT_ANIMATION_DURATION,complete:function(){c()(this).removeAttr("tabindex")}}}_addClipping(t){let e=this.$svg.appendSVG("clipPath");e[0].id=this.clipId;let i=this.$svg.appendSVG("mask");i.appendSVG("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height","100%").attr("fill","white"),i[0].id=this.maskId,this.chart.$container.find("."+t).each((function(t){this.id="ClipMask-"+s.ObjectFactory.get().createUniqueId(),e.appendSVG("use").attrXLINK("href","#"+this.id),i.appendSVG("use").attrXLINK("href","#"+this.id)}))}_renderWireLegend(t,e,i,a){let n={detachFunc:()=>{},attachFunc:()=>{},removeFunc:()=>{}};if(!this.chart.config.options.plugins.tooltip.enabled)return n;let o,r=0;a&&(o=this.$svg.appendSVG("rect","wire-legend-background-box").attr("opacity","1"));let l,h=e,d=0,u=0;if(u=-1===h.h?h.x2-10:this.width-h.x2-10,Array.isArray(t))for(let e=0;e<t.length;e++){let n=t.length-e-1,o=h.y2+5*h.v-17*n-5*n,r=this._renderLineLabel(h.x2+5,o,s.strings.truncateText(t[e],u,this._measureText.bind(this)),"",a);r.addClass(i),d=Math.max(d,r[0].getComputedTextLength()),0===e?l=r:l.data("lines")?l.data("lines").push(r):l.data("lines",[r])}else l=this._renderLineLabel(h.x2+5,h.y2+5*h.v,s.strings.truncateText(t,u,this._measureText.bind(this)),"",a),l.addClass(i),d=l[0].getComputedTextLength();if(r=d+10,e.autoPosition&&(h=e.posFunc.call(this,r,17),l.attr("x",h.x2+5),l.attr("y",h.y2+5*h.v)),-1===h.h?(l.attr("x",h.x2-5-d),l.css("text-anchor","left"),l.data("lines")&&l.data("lines").forEach((t=>{t.attr("x",h.x2-5-d),t.css("text-anchor","left")}))):(l.attr("x",h.x2+5),l.css("text-anchor","right"),l.data("lines")&&l.data("lines").forEach((t=>{t.attr("x",h.x2+5),t.css("text-anchor","right")}))),1===h.v)l.data("lines")&&l.data("lines").forEach(((t,e)=>{t.attr("y",h.x2-5-d);let i=1+e;t.attr("y",h.y2+5*h.v+17*i+5*(i+1))})),l.attr("dy","0.7em");else if(l.data("lines")){let t=l.data("lines").length;l.attr("y",h.y2+5*h.v-17*t-5*t),l.data("lines").forEach(((e,i)=>{t=l.data("lines").length-1-i,e.attr("y",h.y2+5*h.v-17*t-5*t)}))}l.add(l.data("lines")).each(((t,e)=>{let i=c()(e),s=i.data("$background");s&&(s.attr("x",i.attr("x")),s.attr("y",i.attr("y")),s.css("text-anchor",i.css("text-anchor")),s.attr("dy",i.attr("dy")))}));let p=[];h.x1>0&&h.y1>0&&(p.push(this._renderLine(h.x1,h.y1,h.x2,h.y2,"label-line")),p.push(this._renderLine(h.x2,h.y2,h.x2+h.h*(d+10),h.y2,"label-line"))),l.data("wires",p);let g=this.$svg;return n.detachFunc=()=>{l.data("wires").forEach((t=>{t.detach()})),l.data("lines")&&l.data("lines").forEach((t=>{t.data("$background")&&g.append(t.data("$background")),t.detach()})),l.data("$background")&&l.data("$background").remove(),l.detach()},n.attachFunc=()=>{g.append(l),l.data("$background")&&g.append(l.data("$background")),g.append(l.data("wires")),l.data("lines")&&l.data("lines").forEach((t=>{g.append(t),t.data("$background")&&g.append(t.data("$background"))}))},n.removeFunc=()=>{l.data("wires").forEach((t=>{t.remove()})),l.data("lines")&&l.data("lines").forEach((t=>{t.data("$background")&&t.data("$background").remove(),t().remove()})),l.data("$background")&&l.data("$background").remove(),l.remove()},n.$field=l,n}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},p.apply(this,arguments)}d(u,"FONT_SIZE_SMALLEST","smallestFont"),d(u,"FONT_SIZE_SMALL","smallFont"),d(u,"FONT_SIZE_MIDDLE","middleFont"),d(u,"FONT_SIZE_BIG","bigFont");const g="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function f(t,e,i){const s=i||(t=>Array.prototype.slice.call(t));let a=!1,n=[];return function(){for(var i=arguments.length,o=new Array(i),r=0;r<i;r++)o[r]=arguments[r];n=s(o),a||(a=!0,g.call(window,(()=>{a=!1,t.apply(e,n)})))}}const m=t=>"start"===t?"left":"end"===t?"right":"center",b=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function x(){}const _=function(){let t=0;return function(){return t++}}();function y(t){return null==t}function v(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.substr(0,7)&&"Array]"===e.substr(-6)}function C(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const k=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function T(t,e){return k(t)?t:e}function A(t,e){return void 0===t?e:t}const M=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function S(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function w(t,e,i,s){let a,n,o;if(v(t))if(n=t.length,s)for(a=n-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;a<n;a++)e.call(i,t[a],a);else if(C(t))for(o=Object.keys(t),n=o.length,a=0;a<n;a++)e.call(i,t[o[a]],o[a])}function R(t,e){let i,s,a,n;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(a=t[i],n=e[i],a.datasetIndex!==n.datasetIndex||a.index!==n.index)return!1;return!0}function L(t){if(v(t))return t.map(L);if(C(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let a=0;for(;a<s;++a)e[i[a]]=L(t[i[a]]);return e}return t}function O(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function D(t,e,i,s){if(!O(t))return;const a=e[t],n=i[t];C(a)&&C(n)?P(a,n,s):e[t]=L(n)}function P(t,e,i){const s=v(e)?e:[e],a=s.length;if(!C(t))return t;const n=(i=i||{}).merger||D;for(let o=0;o<a;++o){if(!C(e=s[o]))continue;const a=Object.keys(e);for(let s=0,o=a.length;s<o;++s)n(a[s],t,e,i)}return t}function B(t,e){return P(t,e,{merger:E})}function E(t,e,i){if(!O(t))return;const s=e[t],a=i[t];C(s)&&C(a)?B(s,a):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=L(a))}function I(t,e){const i=t.indexOf(".",e);return-1===i?t.length:i}function V(t,e){if(""===e)return t;let i=0,s=I(e,i);for(;t&&s>i;)t=t[e.substr(i,s-i)],i=s+1,s=I(e,i);return t}function F(t){return t.charAt(0).toUpperCase()+t.slice(1)}const N=t=>void 0!==t,H=t=>"function"==typeof t,z=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const j=Math.PI,W=2*j,G=W+j,U=Number.POSITIVE_INFINITY,Y=j/180,X=j/2,J=j/4,q=2*j/3,K=Math.log10,Z=Math.sign;function Q(t){const e=Math.round(t);t=et(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(K(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function tt(t){return!isNaN(parseFloat(t))&&isFinite(t)}function et(t,e,i){return Math.abs(t-e)<i}function it(t,e,i){let s,a,n;for(s=0,a=t.length;s<a;s++)n=t[s][i],isNaN(n)||(e.min=Math.min(e.min,n),e.max=Math.max(e.max,n))}function st(t){return t*(j/180)}function at(t){return t*(180/j)}function nt(t){if(!k(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function ot(t,e){const i=e.x-t.x,s=e.y-t.y,a=Math.sqrt(i*i+s*s);let n=Math.atan2(s,i);return n<-.5*j&&(n+=W),{angle:n,distance:a}}function rt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lt(t,e){return(t-e+G)%W-j}function ht(t){return(t%W+W)%W}function ct(t,e,i,s){const a=ht(t),n=ht(e),o=ht(i),r=ht(n-a),l=ht(o-a),h=ht(a-n),c=ht(a-o);return a===n||a===o||s&&n===o||r>l&&h<c}function dt(t,e,i){return Math.max(e,Math.min(i,t))}function ut(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e-6;return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}const pt=t=>0===t||1===t,gt=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*W/i),ft=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*W/i)+1,mt={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*X),easeOutSine:t=>Math.sin(t*X),easeInOutSine:t=>-.5*(Math.cos(j*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>pt(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>pt(t)?t:gt(t,.075,.3),easeOutElastic:t=>pt(t)?t:ft(t,.075,.3),easeInOutElastic(t){const e=.1125;return pt(t)?t:t<.5?.5*gt(2*t,e,.45):.5+.5*ft(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-mt.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*mt.easeInBounce(2*t):.5*mt.easeOutBounce(2*t-1)+.5},bt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},xt="0123456789ABCDEF",_t=t=>xt[15&t],yt=t=>xt[(240&t)>>4]+xt[15&t],vt=t=>(240&t)>>4==(15&t);function Ct(t){var e=function(t){return vt(t.r)&&vt(t.g)&&vt(t.b)&&vt(t.a)}(t)?_t:yt;return t?"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):""):t}function kt(t){return t+.5|0}const Tt=(t,e,i)=>Math.max(Math.min(t,i),e);function At(t){return Tt(kt(2.55*t),0,255)}function Mt(t){return Tt(kt(255*t),0,255)}function St(t){return Tt(kt(t/2.55)/100,0,1)}function wt(t){return Tt(kt(100*t),0,100)}const Rt=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Lt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Ot(t,e,i){const s=e*Math.min(i,1-i),a=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(e+t/30)%12;return i-s*Math.max(Math.min(a-3,9-a,1),-1)};return[a(0),a(8),a(4)]}function Dt(t,e,i){const s=function(s){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(s+t/60)%6;return i-i*e*Math.max(Math.min(a,4-a,1),0)};return[s(5),s(3),s(1)]}function Pt(t,e,i){const s=Ot(t,1,.5);let a;for(e+i>1&&(a=1/(e+i),e*=a,i*=a),a=0;a<3;a++)s[a]*=1-e-i,s[a]+=e;return s}function Bt(t){const e=t.r/255,i=t.g/255,s=t.b/255,a=Math.max(e,i,s),n=Math.min(e,i,s),o=(a+n)/2;let r,l,h;return a!==n&&(h=a-n,l=o>.5?h/(2-a-n):h/(a+n),r=a===e?(i-s)/h+(i<s?6:0):a===i?(s-e)/h+2:(e-i)/h+4,r=60*r+.5),[0|r,l||0,o]}function Et(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Mt)}function It(t,e,i){return Et(Ot,t,e,i)}function Vt(t){return(t%360+360)%360}function Ft(t){const e=Lt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?At(+e[5]):Mt(+e[5]));const a=Vt(+e[2]),n=+e[3]/100,o=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Et(Pt,t,e,i)}(a,n,o):"hsv"===e[1]?function(t,e,i){return Et(Dt,t,e,i)}(a,n,o):It(a,n,o),{r:i[0],g:i[1],b:i[2],a:s}}const Nt={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Ht={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let zt;function jt(t){zt||(zt=function(){const t={},e=Object.keys(Ht),i=Object.keys(Nt);let s,a,n,o,r;for(s=0;s<e.length;s++){for(o=r=e[s],a=0;a<i.length;a++)n=i[a],r=r.replace(n,Nt[n]);n=parseInt(Ht[o],16),t[r]=[n>>16&255,n>>8&255,255&n]}return t}(),zt.transparent=[0,0,0,0]);const e=zt[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}function Wt(t,e,i){if(t){let s=Bt(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=It(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function Gt(t,e){return t?p(e||{},t):t}function Ut(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Mt(t[3]))):(e=Gt(t,{r:0,g:0,b:0,a:1})).a=Mt(e.a),e}function $t(t){return"r"===t.charAt(0)?function(t){const e=Rt.exec(t);let i,s,a,n=255;if(e){if(e[7]!==i){const t=+e[7];n=255&(e[8]?At(t):255*t)}return i=+e[1],s=+e[3],a=+e[5],i=255&(e[2]?At(i):i),s=255&(e[4]?At(s):s),a=255&(e[6]?At(a):a),{r:i,g:s,b:a,a:n}}}(t):Ft(t)}class Yt{constructor(t){if(t instanceof Yt)return t;const e=typeof t;let i;var s,a,n;"object"===e?i=Ut(t):"string"===e&&(n=(s=t).length,"#"===s[0]&&(4===n||5===n?a={r:255&17*bt[s[1]],g:255&17*bt[s[2]],b:255&17*bt[s[3]],a:5===n?17*bt[s[4]]:255}:7!==n&&9!==n||(a={r:bt[s[1]]<<4|bt[s[2]],g:bt[s[3]]<<4|bt[s[4]],b:bt[s[5]]<<4|bt[s[6]],a:9===n?bt[s[7]]<<4|bt[s[8]]:255})),i=a||jt(t)||$t(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Gt(this._rgb);return t&&(t.a=St(t.a)),t}set rgb(t){this._rgb=Ut(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?"rgba(".concat(t.r,", ").concat(t.g,", ").concat(t.b,", ").concat(St(t.a),")"):"rgb(".concat(t.r,", ").concat(t.g,", ").concat(t.b,")")):this._rgb;var t}hexString(){return this._valid?Ct(this._rgb):this._rgb}hslString(){return this._valid?function(t){if(!t)return;const e=Bt(t),i=e[0],s=wt(e[1]),a=wt(e[2]);return t.a<255?"hsla(".concat(i,", ").concat(s,"%, ").concat(a,"%, ").concat(St(t.a),")"):"hsl(".concat(i,", ").concat(s,"%, ").concat(a,"%)")}(this._rgb):this._rgb}mix(t,e){const i=this;if(t){const s=i.rgb,a=t.rgb;let n;const o=e===n?.5:e,r=2*o-1,l=s.a-a.a,h=((r*l==-1?r:(r+l)/(1+r*l))+1)/2;n=1-h,s.r=255&h*s.r+n*a.r+.5,s.g=255&h*s.g+n*a.g+.5,s.b=255&h*s.b+n*a.b+.5,s.a=o*s.a+(1-o)*a.a,i.rgb=s}return i}clone(){return new Yt(this.rgb)}alpha(t){return this._rgb.a=Mt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=kt(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Wt(this._rgb,2,t),this}darken(t){return Wt(this._rgb,2,-t),this}saturate(t){return Wt(this._rgb,1,t),this}desaturate(t){return Wt(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Bt(t);i[0]=Vt(i[0]+e),i=It(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Xt(t){return new Yt(t)}const Jt=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function qt(t){return Jt(t)?t:Xt(t)}function Kt(t){return Jt(t)?t:Xt(t).saturate(.5).darken(.1).hexString()}const Zt=Object.create(null),Qt=Object.create(null);function te(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;e<s;++e){const s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function ee(t,e,i){return"string"==typeof e?P(te(t,e),i):P(te(t,""),e)}var ie=new class{constructor(t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>Kt(e.backgroundColor),this.hoverBorderColor=(t,e)=>Kt(e.borderColor),this.hoverColor=(t,e)=>Kt(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return ee(this,t,e)}get(t){return te(this,t)}describe(t,e){return ee(Qt,t,e)}override(t,e){return ee(Zt,t,e)}route(t,e,i,s){const a=te(this,t),n=te(this,i),o="_"+e;Object.defineProperties(a,{[o]:{value:a[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[o],e=n[s];return C(t)?p({},e,t):A(t,e)},set(t){this[o]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function se(t,e,i,s,a){let n=e[a];return n||(n=e[a]=t.measureText(a).width,i.push(a)),n>s&&(s=n),s}function ae(t,e,i,s){let a=(s=s||{}).data=s.data||{},n=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(a=s.data={},n=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let o=0;const r=i.length;let l,h,c,d,u;for(l=0;l<r;l++)if(d=i[l],null!=d&&!0!==v(d))o=se(t,a,n,o,d);else if(v(d))for(h=0,c=d.length;h<c;h++)u=d[h],null==u||v(u)||(o=se(t,a,n,o,u));t.restore();const p=n.length/2;if(p>i.length){for(l=0;l<p;l++)delete a[n[l]];n.splice(0,p)}return o}function ne(t,e,i){const s=t.currentDevicePixelRatio,a=0!==i?Math.max(i/2,.5):0;return Math.round((e-a)*s)/s+a}function oe(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function re(t,e,i,s){let a,n,o,r,l;const h=e.pointStyle,c=e.rotation,d=e.radius;let u=(c||0)*Y;if(h&&"object"==typeof h&&(a=h.toString(),"[object HTMLImageElement]"===a||"[object HTMLCanvasElement]"===a))return t.save(),t.translate(i,s),t.rotate(u),t.drawImage(h,-h.width/2,-h.height/2,h.width,h.height),void t.restore();if(!(isNaN(d)||d<=0)){switch(t.beginPath(),h){default:t.arc(i,s,d,0,W),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(u)*d,s-Math.cos(u)*d),u+=q,t.lineTo(i+Math.sin(u)*d,s-Math.cos(u)*d),u+=q,t.lineTo(i+Math.sin(u)*d,s-Math.cos(u)*d),t.closePath();break;case"rectRounded":l=.516*d,r=d-l,n=Math.cos(u+J)*r,o=Math.sin(u+J)*r,t.arc(i-n,s-o,l,u-j,u-X),t.arc(i+o,s-n,l,u-X,u),t.arc(i+n,s+o,l,u,u+X),t.arc(i-o,s+n,l,u+X,u+j),t.closePath();break;case"rect":if(!c){r=Math.SQRT1_2*d,t.rect(i-r,s-r,2*r,2*r);break}u+=J;case"rectRot":n=Math.cos(u)*d,o=Math.sin(u)*d,t.moveTo(i-n,s-o),t.lineTo(i+o,s-n),t.lineTo(i+n,s+o),t.lineTo(i-o,s+n),t.closePath();break;case"crossRot":u+=J;case"cross":n=Math.cos(u)*d,o=Math.sin(u)*d,t.moveTo(i-n,s-o),t.lineTo(i+n,s+o),t.moveTo(i+o,s-n),t.lineTo(i-o,s+n);break;case"star":n=Math.cos(u)*d,o=Math.sin(u)*d,t.moveTo(i-n,s-o),t.lineTo(i+n,s+o),t.moveTo(i+o,s-n),t.lineTo(i-o,s+n),u+=J,n=Math.cos(u)*d,o=Math.sin(u)*d,t.moveTo(i-n,s-o),t.lineTo(i+n,s+o),t.moveTo(i+o,s-n),t.lineTo(i-o,s+n);break;case"line":n=Math.cos(u)*d,o=Math.sin(u)*d,t.moveTo(i-n,s-o),t.lineTo(i+n,s+o);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(u)*d,s+Math.sin(u)*d)}t.fill(),e.borderWidth>0&&t.stroke()}}function le(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function he(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function ce(t){t.restore()}function de(t,e,i,s,a){if(!e)return t.lineTo(i.x,i.y);if("middle"===a){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===a!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function ue(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function pe(t,e,i,s,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};const o=v(e)?e:[e],r=n.strokeWidth>0&&""!==n.strokeColor;let l,h;for(t.save(),t.font=a.string,ge(t,n),l=0;l<o.length;++l)h=o[l],r&&(n.strokeColor&&(t.strokeStyle=n.strokeColor),y(n.strokeWidth)||(t.lineWidth=n.strokeWidth),t.strokeText(h,i,s,n.maxWidth)),t.fillText(h,i,s,n.maxWidth),fe(t,i,s,h,n),s+=a.lineHeight;t.restore()}function ge(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),y(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}function fe(t,e,i,s,a){if(a.strikethrough||a.underline){const n=t.measureText(s),o=e-n.actualBoundingBoxLeft,r=e+n.actualBoundingBoxRight,l=i-n.actualBoundingBoxAscent,h=i+n.actualBoundingBoxDescent,c=a.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=a.decorationWidth||2,t.moveTo(o,c),t.lineTo(r,c),t.stroke()}}function me(t,e){const{x:i,y:s,w:a,h:n,radius:o}=e;t.arc(i+o.topLeft,s+o.topLeft,o.topLeft,-X,j,!0),t.lineTo(i,s+n-o.bottomLeft),t.arc(i+o.bottomLeft,s+n-o.bottomLeft,o.bottomLeft,j,X,!0),t.lineTo(i+a-o.bottomRight,s+n),t.arc(i+a-o.bottomRight,s+n-o.bottomRight,o.bottomRight,X,0,!0),t.lineTo(i+a,s+o.topRight),t.arc(i+a-o.topRight,s+o.topRight,o.topRight,0,-X,!0),t.lineTo(i+o.topLeft,s)}const be=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),xe=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function _e(t,e){const i=(""+t).match(be);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function ye(t,e){const i={},s=C(e),a=s?Object.keys(e):e,n=C(t)?s?i=>A(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of a)i[t]=+n(t)||0;return i}function ve(t){return ye(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Ce(t){return ye(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ke(t){const e=ve(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Te(t,e){t=t||{},e=e||ie.font;let i=A(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=A(t.style,e.style);s&&!(""+s).match(xe)&&(console.warn('Invalid font style specified: "'+s+'"'),s="");const a={family:A(t.family,e.family),lineHeight:_e(A(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:A(t.weight,e.weight),string:""};return a.string=function(t){return!t||y(t.size)||y(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(a),a}function Ae(t,e,i,s){let a,n,o,r=!0;for(a=0,n=t.length;a<n;++a)if(o=t[a],void 0!==o&&(void 0!==e&&"function"==typeof o&&(o=o(e),r=!1),void 0!==i&&v(o)&&(o=o[i%o.length],r=!1),void 0!==o))return s&&!r&&(s.cacheable=!1),o}function Me(t,e){return p(Object.create(t),e)}function Se(t,e,i){i=i||(i=>t[i]<e);let s,a=t.length-1,n=0;for(;a-n>1;)s=n+a>>1,i(s)?n=s:a=s;return{lo:n,hi:a}}const we=(t,e,i)=>Se(t,i,(s=>t[s][e]<i)),Re=(t,e,i)=>Se(t,i,(s=>t[s][e]>=i));const Le=["push","pop","shift","splice","unshift"];function Oe(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,a=s.indexOf(e);-1!==a&&s.splice(a,1),s.length>0||(Le.forEach((e=>{delete t[e]})),delete t._chartjs)}function De(t){const e=new Set;let i,s;for(i=0,s=t.length;i<s;++i)e.add(t[i]);return e.size===s?t:Array.from(e)}function Pe(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[""],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,s=arguments.length>3?arguments[3]:void 0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:()=>t[0];N(s)||(s=Ue("_fallback",t));const n={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:a,override:a=>Pe([a,...t],e,i,s)};return new Proxy(n,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>Fe(i,s,(()=>Ge(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>$e(t).includes(e),ownKeys:t=>$e(t),set(t,e,i){const s=t._storage||(t._storage=a());return t[e]=s[e]=i,delete t._keys,!0}})}function Be(t,e,i,s){const a={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Ee(t,s),setContext:e=>Be(t,e,i,s),override:a=>Be(t.override(a),e,i,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Fe(t,e,(()=>function(t,e,i){const{_proxy:s,_context:a,_subProxy:n,_descriptors:o}=t;let r=s[e];H(r)&&o.isScriptable(e)&&(r=function(t,e,i,s){const{_proxy:a,_context:n,_subProxy:o,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t),e=e(n,o||s),r.delete(t),Ve(t,e)&&(e=je(a._scopes,a,t,e));return e}(e,r,t,i));v(r)&&r.length&&(r=function(t,e,i,s){const{_proxy:a,_context:n,_subProxy:o,_descriptors:r}=i;if(N(n.index)&&s(t))e=e[n.index%e.length];else if(C(e[0])){const i=e,s=a._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=je(s,a,t,l);e.push(Be(i,n,o&&o[t],r))}}return e}(e,r,t,o.isIndexable));Ve(e,r)&&(r=Be(r,a,n&&n[e],o));return r}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Ee(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{scriptable:!0,indexable:!0};const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:a=e.allKeys}=t;return{allKeys:a,scriptable:i,indexable:s,isScriptable:H(i)?i:()=>i,isIndexable:H(s)?s:()=>s}}const Ie=(t,e)=>t?t+F(e):e,Ve=(t,e)=>C(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Fe(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const s=i();return t[e]=s,s}function Ne(t,e,i){return H(t)?t(e,i):t}const He=(t,e)=>!0===t?e:"string"==typeof t?V(e,t):void 0;function ze(t,e,i,s,a){for(const n of e){const e=He(i,n);if(e){t.add(e);const n=Ne(e._fallback,i,a);if(N(n)&&n!==i&&n!==s)return n}else if(!1===e&&N(s)&&i!==s)return null}return!1}function je(t,e,i,s){const a=e._rootScopes,n=Ne(e._fallback,i,s),o=[...t,...a],r=new Set;r.add(s);let l=We(r,o,i,n||i,s);return null!==l&&((!N(n)||n===i||(l=We(r,o,n,l,s),null!==l))&&Pe(Array.from(r),[""],a,n,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const a=s[e];if(v(a)&&C(i))return i;return a}(e,i,s))))}function We(t,e,i,s,a){for(;i;)i=ze(t,e,i,s,a);return i}function Ge(t,e,i,s){let a;for(const n of e)if(a=Ue(Ie(n,t),i),N(a))return Ve(t,a)?je(i,s,t,a):a}function Ue(t,e){for(const i of e){if(!i)continue;const e=i[t];if(N(e))return e}}function $e(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}const Ye=Number.EPSILON||1e-14,Xe=(t,e)=>e<t.length&&!t[e].skip&&t[e],Je=t=>"x"===t?"y":"x";function qe(t,e,i,s){const a=t.skip?e:t,n=e,o=i.skip?e:i,r=rt(n,a),l=rt(o,n);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:n.x-d*(o.x-a.x),y:n.y-d*(o.y-a.y)},next:{x:n.x+u*(o.x-a.x),y:n.y+u*(o.y-a.y)}}}function Ke(t,e,i){const s=t.length;let a,n,o,r,l,h=Xe(t,0);for(let c=0;c<s-1;++c)l=h,h=Xe(t,c+1),l&&h&&(et(e[c],0,Ye)?i[c]=i[c+1]=0:(a=i[c]/e[c],n=i[c+1]/e[c],r=Math.pow(a,2)+Math.pow(n,2),r<=9||(o=3/Math.sqrt(r),i[c]=a*o*e[c],i[c+1]=n*o*e[c])))}function Ze(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"x";const s=Je(i),a=t.length;let n,o,r,l=Xe(t,0);for(let h=0;h<a;++h){if(o=r,r=l,l=Xe(t,h+1),!r)continue;const a=r[i],c=r[s];o&&(n=(a-o[i])/3,r["cp1".concat(i)]=a-n,r["cp1".concat(s)]=c-n*e[h]),l&&(n=(l[i]-a)/3,r["cp2".concat(i)]=a+n,r["cp2".concat(s)]=c+n*e[h])}}function Qe(t,e,i){return Math.max(Math.min(t,i),e)}function ti(t,e,i,s,a){let n,o,r,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"x";const i=Je(e),s=t.length,a=Array(s).fill(0),n=Array(s);let o,r,l,h=Xe(t,0);for(o=0;o<s;++o)if(r=l,l=h,h=Xe(t,o+1),l){if(h){const t=h[e]-l[e];a[o]=0!==t?(h[i]-l[i])/t:0}n[o]=r?h?Z(a[o-1])!==Z(a[o])?0:(a[o-1]+a[o])/2:a[o-1]:a[o]}Ke(t,a,n),Ze(t,n,e)}(t,a);else{let i=s?t[t.length-1]:t[0];for(n=0,o=t.length;n<o;++n)r=t[n],l=qe(i,r,t[Math.min(n+1,o-(s?0:1))%o],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,i=r}e.capBezierPoints&&function(t,e){let i,s,a,n,o,r=le(t[0],e);for(i=0,s=t.length;i<s;++i)o=n,n=r,r=i<s-1&&le(t[i+1],e),n&&(a=t[i],o&&(a.cp1x=Qe(a.cp1x,e.left,e.right),a.cp1y=Qe(a.cp1y,e.top,e.bottom)),r&&(a.cp2x=Qe(a.cp2x,e.left,e.right),a.cp2y=Qe(a.cp2y,e.top,e.bottom)))}(t,i)}function ei(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ii(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function si(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const ai=t=>window.getComputedStyle(t,null);const ni=["top","right","bottom","left"];function oi(t,e,i){const s={};i=i?"-"+i:"";for(let a=0;a<4;a++){const n=ni[a];s[n]=parseFloat(t[e+"-"+n+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function ri(t,e){const{canvas:i,currentDevicePixelRatio:s}=e,a=ai(i),n="border-box"===a.boxSizing,o=oi(a,"padding"),r=oi(a,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.native||t,s=i.touches,a=s&&s.length?s[0]:i,{offsetX:n,offsetY:o}=a;let r,l,h=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(n,o,i.target))r=n,l=o;else{const t=e.getBoundingClientRect();r=a.clientX-t.left,l=a.clientY-t.top,h=!0}return{x:r,y:l,box:h}}(t,i),d=o.left+(c&&r.left),u=o.top+(c&&r.top);let{width:p,height:g}=e;return n&&(p-=o.width+r.width,g-=o.height+r.height),{x:Math.round((l-d)/p*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const li=t=>Math.round(10*t)/10;function hi(t,e,i,s){const a=ai(t),n=oi(a,"margin"),o=si(a.maxWidth,t,"clientWidth")||U,r=si(a.maxHeight,t,"clientHeight")||U,l=function(t,e,i){let s,a;if(void 0===e||void 0===i){const n=ii(t);if(n){const t=n.getBoundingClientRect(),o=ai(n),r=oi(o,"border","width"),l=oi(o,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=si(o.maxWidth,n,"clientWidth"),a=si(o.maxHeight,n,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||U,maxHeight:a||U}}(t,e,i);let{width:h,height:c}=l;if("content-box"===a.boxSizing){const t=oi(a,"border","width"),e=oi(a,"padding");h-=e.width+t.width,c-=e.height+t.height}return h=Math.max(0,h-n.width),c=Math.max(0,s?Math.floor(h/s):c-n.height),h=li(Math.min(h,o,l.maxWidth)),c=li(Math.min(c,r,l.maxHeight)),h&&!c&&(c=li(h/2)),{width:h,height:c}}function ci(t,e,i){const s=e||1,a=Math.floor(t.height*s),n=Math.floor(t.width*s);t.height=a/s,t.width=n/s;const o=t.canvas;return o.style&&(i||!o.style.height&&!o.style.width)&&(o.style.height="".concat(t.height,"px"),o.style.width="".concat(t.width,"px")),(t.currentDevicePixelRatio!==s||o.height!==a||o.width!==n)&&(t.currentDevicePixelRatio=s,o.height=a,o.width=n,t.ctx.setTransform(s,0,0,s,0,0),!0)}const di=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function ui(t,e){const i=function(t,e){return ai(t).getPropertyValue(e)}(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function pi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function gi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function fi(t,e,i,s){const a={x:t.cp2x,y:t.cp2y},n={x:e.cp1x,y:e.cp1y},o=pi(t,a,i),r=pi(a,n,i),l=pi(n,e,i),h=pi(o,r,i),c=pi(r,l,i);return pi(h,c,i)}const mi=new Map;function bi(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=mi.get(i);return s||(s=new Intl.NumberFormat(t,e),mi.set(i,s)),s}(e,i).format(t)}function xi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function _i(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function yi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function vi(t){return"angle"===t?{between:ct,compare:lt,normalize:ht}:{between:ut,compare:(t,e)=>t-e,normalize:t=>t}}function Ci(t){let{start:e,end:i,count:s,loop:a,style:n}=t;return{start:e%s,end:i%s,loop:a&&(i-e+1)%s==0,style:n}}function ki(t,e,i){if(!i)return[t];const{property:s,start:a,end:n}=i,o=e.length,{compare:r,between:l,normalize:h}=vi(s),{start:c,end:d,loop:u,style:p}=function(t,e,i){const{property:s,start:a,end:n}=i,{between:o,normalize:r}=vi(s),l=e.length;let h,c,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,h=0,c=l;h<c&&o(r(e[d%l][s]),a,n);++h)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),g=[];let f,m,b,x=!1,_=null;const y=()=>x||l(a,b,f)&&0!==r(a,b),v=()=>!x||0===r(n,f)||l(n,b,f);for(let t=c,i=c;t<=d;++t)m=e[t%o],m.skip||(f=h(m[s]),f!==b&&(x=l(f,a,n),null===_&&y()&&(_=0===r(f,a)?t:i),null!==_&&v()&&(g.push(Ci({start:_,end:t,loop:u,count:o,style:p})),_=null),i=t,b=f));return null!==_&&g.push(Ci({start:_,end:d,loop:u,count:o,style:p})),g}function Ti(t,e){const i=[],s=t.segments;for(let a=0;a<s.length;a++){const n=ki(s[a],t.points,e);n.length&&i.push(...n)}return i}function Ai(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const a=t._chart.getContext(),n=Mi(t.options),{_datasetIndex:o,options:{spanGaps:r}}=t,l=i.length,h=[];let c=n,d=e[0].start,u=d;function p(t,e,s,a){const n=r?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=n;for(;i[e%l].skip;)e+=n;t%l!=e%l&&(h.push({start:t%l,end:e%l,loop:s,style:a}),c=a,d=e%l)}}for(const t of e){d=r?d:t.start;let e,n=i[d%l];for(u=d+1;u<=t.end;u++){const r=i[u%l];e=Mi(s.setContext(Me(a,{type:"segment",p0:n,p1:r,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:o}))),Si(e,c)&&p(d,u-1,t.loop,c),n=r,c=e}d<u-1&&p(d,u-1,t.loop,c)}return h}(t,e,i,s):e}function Mi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Si(t,e){return e&&JSON.stringify(t)!==JSON.stringify(e)}function wi(){return wi=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},wi.apply(this,arguments)}var Ri=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const a=e.listeners[s],n=e.duration;a.forEach((s=>s({chart:t,initial:e.initial,numSteps:n,currentStep:Math.min(i-e.start,n)})))}_refresh(){this._request||(this._running=!0,this._request=g.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now(),e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const a=i.items;let n,o=a.length-1,r=!1;for(;o>=0;--o)n=a[o],n._active?(n._total>i.duration&&(i.duration=n._total),n.tick(t),r=!0):(a[o]=a[a.length-1],a.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),a.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=a.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};const Li="transparent",Oi={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=qt(t||Li),a=s.valid&&qt(e||Li);return a&&a.valid?a.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class Di{constructor(t,e,i,s){const a=e[i];s=Ae([t.to,s,a,t.from]);const n=Ae([t.from,a,s]);this._active=!0,this._fn=t.fn||Oi[t.type||typeof n],this._easing=mt[t.easing]||mt.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=n,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],a=i-this._start,n=this._duration-a;this._start=i,this._duration=Math.floor(Math.max(n,t.duration)),this._total+=a,this._loop=!!t.loop,this._to=Ae([t.to,e,s,t.from]),this._from=Ae([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,a=this._from,n=this._loop,o=this._to;let r;if(this._active=a!==o&&(n||e<i),!this._active)return this._target[s]=o,void this._notify(!0);e<0?this._target[s]=a:(r=e/i%2,r=n&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(a,o,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}ie.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const Pi=Object.keys(ie.animation);ie.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),ie.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),ie.describe("animations",{_fallback:"animation"}),ie.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}});class Bi{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!C(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((i=>{const s=t[i];if(!C(s))return;const a={};for(const t of Pi)a[t]=s[t];(v(s.properties)&&s.properties||[i]).forEach((t=>{t!==i&&e.has(t)||e.set(t,a)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=wi({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const a=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){const a=t[s[e]];a&&a.active()&&i.push(a.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),a}_createAnimations(t,e){const i=this._properties,s=[],a=t.$animations||(t.$animations={}),n=Object.keys(e),o=Date.now();let r;for(r=n.length-1;r>=0;--r){const l=n[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=a[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,o);continue}c.cancel()}d&&d.duration?(a[l]=c=new Di(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void wi(t,e);const i=this._createAnimations(t,e);return i.length?(Ri.add(this._chart,i),!0):void 0}}function Ei(t,e){const i=t&&t.options||{},s=i.reverse,a=void 0===i.min?e:0,n=void 0===i.max?e:0;return{start:s?n:a,end:s?a:n}}function Ii(t,e){const i=[],s=t._getSortedDatasetMetas(e);let a,n;for(a=0,n=s.length;a<n;++a)i.push(s[a].index);return i}function Vi(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const a=t.keys,n="single"===s.mode;let o,r,l,h;if(null!==e){for(o=0,r=a.length;o<r;++o){if(l=+a[o],l===i){if(s.all)continue;break}h=t.values[l],k(h)&&(n||0===e||Z(e)===Z(h))&&(e+=h)}return e}}function Fi(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Ni(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function Hi(t,e,i,s){for(const a of e.getMatchingVisibleMetas(s).reverse()){const e=t[a.index];if(i&&e>0||!i&&e<0)return a.index}return null}function zi(t,e){const{chart:i,_cachedMeta:s}=t,a=i._stacks||(i._stacks={}),{iScale:n,vScale:o,index:r}=s,l=n.axis,h=o.axis,c=function(t,e,i){return"".concat(t.id,".").concat(e.id,".").concat(i.stack||i.type)}(n,o,s),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:n,[h]:d}=i;u=(i._stacks||(i._stacks={}))[h]=Ni(a,c,n),u[r]=d,u._top=Hi(u,o,!0,s.type),u._bottom=Hi(u,o,!1,s.type)}}function ji(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Wi(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i]}}}const Gi=t=>"reset"===t||"none"===t,Ui=(t,e)=>e?t:wi({},t);class $i{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Fi(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Wi(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,a=e.xAxisID=A(i.xAxisID,ji(t,"x")),n=e.yAxisID=A(i.yAxisID,ji(t,"y")),o=e.rAxisID=A(i.rAxisID,ji(t,"r")),r=e.indexAxis,l=e.iAxisID=s(r,a,n,o),h=e.vAxisID=s(r,n,a,o);e.xScale=this.getScaleForId(a),e.yScale=this.getScaleForId(n),e.rScale=this.getScaleForId(o),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Oe(this._data,this),t._stacked&&Wi(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(C(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,a,n;for(s=0,a=e.length;s<a;++s)n=e[s],i[s]={x:n,y:t[n]};return i}(e);else if(i!==e){if(i){Oe(i,this);const t=this._cachedMeta;Wi(t),t._parsed=[]}e&&Object.isExtensible(e)&&(a=this,(s=e)._chartjs?s._chartjs.listeners.push(a):(Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[a]}}),Le.forEach((t=>{const e="_onData"+F(t),i=s[t];Object.defineProperty(s,t,{configurable:!0,enumerable:!1,value(){for(var t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];const o=i.apply(this,a);return s._chartjs.listeners.forEach((t=>{"function"==typeof t[e]&&t[e](...a)})),o}})})))),this._syncList=[],this._data=e}var s,a}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const a=e._stacked;e._stacked=Fi(e.vScale,e),e.stack!==i.stack&&(s=!0,Wi(e),e.stack=i.stack),this._resyncElements(t),(s||a!==e._stacked)&&zi(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:a,_stacked:n}=i,o=a.axis;let r,l,h,c=0===t&&e===s.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,h=s;else{h=v(s[t])?this.parseArrayData(i,s,t,e):C(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const a=()=>null===l[o]||d&&l[o]<d[o];for(r=0;r<e;++r)i._parsed[r+t]=l=h[r],c&&(a()&&(c=!1),d=l);i._sorted=c}n&&zi(this,h)}parsePrimitiveData(t,e,i,s){const{iScale:a,vScale:n}=t,o=a.axis,r=n.axis,l=a.getLabels(),h=a===n,c=new Array(s);let d,u,p;for(d=0,u=s;d<u;++d)p=d+i,c[d]={[o]:h||a.parse(l[p],p),[r]:n.parse(e[p],p)};return c}parseArrayData(t,e,i,s){const{xScale:a,yScale:n}=t,o=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],o[r]={x:a.parse(c[0],h),y:n.parse(c[1],h)};return o}parseObjectData(t,e,i,s){const{xScale:a,yScale:n}=t,{xAxisKey:o="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let h,c,d,u;for(h=0,c=s;h<c;++h)d=h+i,u=e[d],l[h]={x:a.parse(V(u,o),d),y:n.parse(V(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,a=this._cachedMeta,n=e[t.axis];return Vi({keys:Ii(s,!0),values:e._stacks[t.axis]},n,a.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const a=i[e.axis];let n=null===a?NaN:a;const o=s&&i._stacks[e.axis];s&&o&&(s.values=o,n=Vi(s,a,this._cachedMeta.index)),t.min=Math.min(t.min,n),t.max=Math.max(t.max,n)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,a=i._sorted&&t===i.iScale,n=s.length,o=this._getOtherScale(t),r=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Ii(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:c}=function(t){const{min:e,max:i,minDefined:s,maxDefined:a}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:a?i:Number.POSITIVE_INFINITY}}(o);let d,u;function p(){u=s[d];const e=u[o.axis];return!k(u[t.axis])||h>e||c<e}for(d=0;d<n&&(p()||(this.updateRangeFromParsed(l,t,u,r),!a));++d);if(a)for(d=n-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,r);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,a,n;for(s=0,a=e.length;s<a;++s)n=e[s][t.axis],k(n)&&i.push(n);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,a=this.getParsed(t);return{label:i?""+i.getLabelForValue(a[i.axis]):"",value:s?""+s.getLabelForValue(a[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,s,a;return C(t)?(e=t.top,i=t.right,s=t.bottom,a=t.left):e=i=s=a=t,{top:e,right:i,bottom:s,left:a,disabled:!1===t}}(A(this.options.clip,function(t,e,i){if(!1===i)return!1;const s=Ei(t,i),a=Ei(e,i);return{top:a.end,right:s.end,bottom:a.start,left:s.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],a=e.chartArea,n=[],o=this._drawStart||0,r=this._drawCount||s.length-o,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,a,o,r),h=o;h<o+r;++h){const e=s[h];e.hidden||(e.active&&l?n.push(e):e.draw(t,a))}for(h=0;h<n.length;++h)n[h].draw(t,a)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let a;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];a=e.$context||(e.$context=function(t,e,i){return Me(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),a.parsed=this.getParsed(t),a.raw=s.data[t],a.index=a.dataIndex=t}else a=this.$context||(this.$context=function(t,e){return Me(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),a.dataset=s,a.index=a.datasetIndex=this.index;return a.active=!!e,a.mode=i,a}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",i=arguments.length>2?arguments[2]:void 0;const s="active"===e,a=this._cachedDataOpts,n=t+"-"+e,o=a[n],r=this.enableOptionSharing&&N(i);if(o)return Ui(o,r);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=s?["".concat(t,"Hover"),"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),u=Object.keys(ie.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,s)),c);return p.$shared&&(p.$shared=r,a[n]=Object.freeze(Ui(p,r))),p}_resolveAnimations(t,e,i){const s=this.chart,a=this._cachedDataOpts,n="animation-".concat(e),o=a[n];if(o)return o;let r;if(!1!==s.options.animation){const s=this.chart.config,a=s.datasetAnimationScopeKeys(this._type,e),n=s.getOptionScopes(this.getDataset(),a);r=s.createResolver(n,this.getContext(t,i,e))}const l=new Bi(s,r&&r.animations);return r&&r._cacheable&&(a[n]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=wi({},t))}includeOptions(t,e){return!e||Gi(t)||this.chart._animationsDisabled}updateElement(t,e,i,s){Gi(s)?wi(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Gi(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const a=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(a)||a})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,a=e.length,n=Math.min(a,s);n&&this.parse(0,n),a>s?this._insertElements(s,a-s,t):a<s&&this._removeElements(a,s-a)}_insertElements(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this._cachedMeta,a=s.data,n=t+e;let o;const r=t=>{for(t.length+=e,o=t.length-1;o>=n;o--)t[o]=t[o-e]};for(r(a),o=t;o<n;++o)a[o]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(a,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&Wi(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Yi(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,a=i.length;e<a;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=De(s.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let s,a,n,o,r=e._length;const l=()=>{32767!==n&&-32768!==n&&(N(o)&&(r=Math.min(r,Math.abs(n-o)||r)),o=n)};for(s=0,a=i.length;s<a;++s)n=e.getPixelForValue(i[s]),l();for(o=void 0,s=0,a=e.ticks.length;s<a;++s)n=e.getPixelForTick(s),l();return r}function Xi(t,e,i,s){return v(t)?function(t,e,i,s){const a=i.parse(t[0],s),n=i.parse(t[1],s),o=Math.min(a,n),r=Math.max(a,n);let l=o,h=r;Math.abs(o)>Math.abs(r)&&(l=r,h=o),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:a,end:n,min:o,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Ji(t,e,i,s){const a=t.iScale,n=t.vScale,o=a.getLabels(),r=a===n,l=[];let h,c,d,u;for(h=i,c=i+s;h<c;++h)u=e[h],d={},d[a.axis]=r||a.parse(o[h],h),l.push(Xi(u,d,n,h));return l}function qi(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Ki(t,e,i,s){let a=e.borderSkipped;const n={};if(!a)return void(t.borderSkipped=n);const{start:o,end:r,reverse:l,top:h,bottom:c}=function(t){let e,i,s,a,n;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(a="end",n="start"):(a="start",n="end"),{start:i,end:s,reverse:e,top:a,bottom:n}}(t);"middle"===a&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?a=h:(i._bottom||0)===s?a=c:(n[Zi(c,o,r,l)]=!0,a=h)),n[Zi(a,o,r,l)]=!0,t.borderSkipped=n}function Zi(t,e,i,s){var a,n,o;return s?(o=i,t=Qi(t=(a=t)===(n=e)?o:a===o?n:a,i,e)):t=Qi(t,e,i),t}function Qi(t,e,i){return"start"===t?e:"end"===t?i:t}function ts(t,e,i){let{inflateAmount:s}=e;t.inflateAmount="auto"===s?1===i?.33:0:s}$i.defaults={},$i.prototype.datasetElementType=null,$i.prototype.dataElementType=null;class es extends $i{parsePrimitiveData(t,e,i,s){return Ji(t,e,i,s)}parseArrayData(t,e,i,s){return Ji(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:a,vScale:n}=t,{xAxisKey:o="x",yAxisKey:r="y"}=this._parsing,l="x"===a.axis?o:r,h="x"===n.axis?o:r,c=[];let d,u,p,g;for(d=i,u=i+s;d<u;++d)g=e[d],p={},p[a.axis]=a.parse(V(g,l),d),c.push(Xi(V(g,h),p,n,d));return c}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const a=i._custom;a&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,a.min),t.max=Math.max(t.max,a.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,a=this.getParsed(t),n=a._custom,o=qi(n)?"["+n.start+", "+n.end+"]":""+s.getLabelForValue(a[s.axis]);return{label:""+i.getLabelForValue(a[i.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const a="reset"===s,{index:n,_cachedMeta:{vScale:o}}=this,r=o.getBasePixel(),l=o.isHorizontal(),h=this._getRuler(),c=this.resolveDataElementOptions(e,s),d=this.getSharedOptions(c),u=this.includeOptions(s,d);this.updateSharedOptions(d,s,c);for(let c=e;c<e+i;c++){const e=this.getParsed(c),i=a||y(e[o.axis])?{base:r,head:r}:this._calculateBarValuePixels(c),p=this._calculateBarIndexPixels(c,h),g=(e._stacks||{})[o.axis],f={horizontal:l,base:i.base,enableBorderRadius:!g||qi(e._custom)||n===g._top||n===g._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};u&&(f.options=d||this.resolveDataElementOptions(c,t[c].active?"active":s));const m=f.options||t[c].options;Ki(f,m,g,n),ts(f,m,h.ratio),this.updateElement(t[c],c,f,s)}}_getStacks(t,e){const i=this._cachedMeta.iScale,s=i.getMatchingVisibleMetas(this._type),a=i.options.stacked,n=s.length,o=[];let r,l;for(r=0;r<n;++r)if(l=s[r],l.controller.options.grouped){if(void 0!==e){const t=l.controller.getParsed(e)[l.controller._cachedMeta.vScale.axis];if(y(t)||isNaN(t))continue}if((!1===a||-1===o.indexOf(l.stack)||void 0===a&&void 0===l.stack)&&o.push(l.stack),l.index===t)break}return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),a=void 0!==e?s.indexOf(e):-1;return-1===a?s.length-1:a}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let a,n;for(a=0,n=e.data.length;a<n;++a)s.push(i.getPixelForValue(this.getParsed(a)[i.axis],a));const o=t.barThickness;return{min:o||Yi(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i},options:{base:s,minBarLength:a}}=this,n=s||0,o=this.getParsed(t),r=o._custom,l=qi(r);let h,c,d=o[e.axis],u=0,p=i?this.applyStack(e,o,i):d;p!==d&&(u=p-d,p=d),l&&(d=r.barStart,p=r.barEnd-r.barStart,0!==d&&Z(d)!==Z(r.barEnd)&&(u=0),u+=d);const g=y(s)||l?u:s;let f=e.getPixelForValue(g);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(u+p):f,c=h-f,Math.abs(c)<a&&(c=function(t,e,i){return 0!==t?Z(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(c,e,n)*a,d===n&&(f-=c/2),h=f+c),f===e.getPixelForValue(n)){const t=Z(c)*e.getLineWidthForValue(n)/2;f+=t,c-=t}return{size:c,base:f,head:h,center:h+c/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,a=s.skipNull,n=A(s.maxBarThickness,1/0);let o,r;if(e.grouped){const i=a?this._getStackCount(t):e.stackCount,l="flex"===s.barThickness?function(t,e,i,s){const a=e.pixels,n=a[t];let o=t>0?a[t-1]:null,r=t<a.length-1?a[t+1]:null;const l=i.categoryPercentage;null===o&&(o=n-(null===r?e.end-e.start:r-n)),null===r&&(r=n+n-o);const h=n-(n-Math.min(o,r))/2*l;return{chunk:Math.abs(r-o)/2*l/s,ratio:i.barPercentage,start:h}}(t,e,s,i):function(t,e,i,s){const a=i.barThickness;let n,o;return y(a)?(n=e.min*i.categoryPercentage,o=i.barPercentage):(n=a*s,o=1),{chunk:n/s,ratio:o,start:e.pixels[t]-n/2}}(t,e,s,i),h=this._getStackIndex(this.index,this._cachedMeta.stack,a?t:void 0);o=l.start+l.chunk*h+l.chunk/2,r=Math.min(n,l.chunk*l.ratio)}else o=i.getPixelForValue(this.getParsed(t)[i.axis],t),r=Math.min(n,e.min*e.ratio);return{base:o-r/2,head:o+r/2,center:o,size:r}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let a=0;for(;a<s;++a)null!==this.getParsed(a)[e.axis]&&i[a].draw(this._ctx)}}es.id="bar",es.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},es.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class is extends $i{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const a=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<a.length;t++)a[t]._custom=this.resolveDataElementOptions(t+i).radius;return a}parseArrayData(t,e,i,s){const a=super.parseArrayData(t,e,i,s);for(let t=0;t<a.length;t++){const s=e[i+t];a[t]._custom=A(s[2],this.resolveDataElementOptions(t+i).radius)}return a}parseObjectData(t,e,i,s){const a=super.parseObjectData(t,e,i,s);for(let t=0;t<a.length;t++){const s=e[i+t];a[t]._custom=A(s&&s.r&&+s.r,this.resolveDataElementOptions(t+i).radius)}return a}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:s}=e,a=this.getParsed(t),n=i.getLabelForValue(a.x),o=s.getLabelForValue(a.y),r=a._custom;return{label:e.label,value:"("+n+", "+o+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const a="reset"===s,{iScale:n,vScale:o}=this._cachedMeta,r=this.resolveDataElementOptions(e,s),l=this.getSharedOptions(r),h=this.includeOptions(s,l),c=n.axis,d=o.axis;for(let r=e;r<e+i;r++){const e=t[r],i=!a&&this.getParsed(r),l={},u=l[c]=a?n.getPixelForDecimal(.5):n.getPixelForValue(i[c]),p=l[d]=a?o.getBasePixel():o.getPixelForValue(i[d]);l.skip=isNaN(u)||isNaN(p),h&&(l.options=this.resolveDataElementOptions(r,e.active?"active":s),a&&(l.options.radius=0)),this.updateElement(e,r,l,s)}this.updateSharedOptions(l,s,r)}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=wi({},s,{$shared:!1}));const a=s.radius;return"active"!==e&&(s.radius=0),s.radius+=A(i&&i._custom,a),s}}is.id="bubble",is.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},is.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class ss extends $i{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let a,n,o=t=>+i[t];if(C(i[t])){const{key:t="value"}=this._parsing;o=e=>+V(i[e],t)}for(a=t,n=t+e;a<n;++a)s._parsed[a]=o(a)}}_getRotation(){return st(this.options.rotation-90)}_getCircumference(){return st(this.options.circumference)}_getRotationExtents(){let t=W,e=-W;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)){const s=this.chart.getDatasetMeta(i).controller,a=s._getRotation(),n=s._getCircumference();t=Math.min(t,a),e=Math.max(e,a+n)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,a=s.data,n=this.getMaxBorderWidth()+this.getMaxOffset(a)+this.options.spacing,o=Math.max((Math.min(i.width,i.height)-n)/2,0),r=Math.min((l=this.options.cutout,h=o,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:l/h),1);var l,h;const c=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:g,offsetX:f,offsetY:m}=function(t,e,i){let s=1,a=1,n=0,o=0;if(e<W){const r=t,l=r+e,h=Math.cos(r),c=Math.sin(r),d=Math.cos(l),u=Math.sin(l),p=(t,e,s)=>ct(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>ct(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),f=p(0,h,d),m=p(X,c,u),b=g(j,h,d),x=g(j+X,c,u);s=(f-b)/2,a=(m-x)/2,n=-(f+b)/2,o=-(m+x)/2}return{ratioX:s,ratioY:a,offsetX:n,offsetY:o}}(u,d,r),b=(i.width-n)/p,x=(i.height-n)/g,_=Math.max(Math.min(b,x)/2,0),y=M(this.options.radius,_),v=(y-Math.max(y*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*y,this.offsetY=m*y,s.total=this.calculateTotal(),this.outerRadius=y-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*c,0),this.updateElements(a,0,a.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,a=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*a/W)}updateElements(t,e,i,s){const a="reset"===s,n=this.chart,o=n.chartArea,r=n.options.animation,l=(o.left+o.right)/2,h=(o.top+o.bottom)/2,c=a&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,p=this.resolveDataElementOptions(e,s),g=this.getSharedOptions(p),f=this.includeOptions(s,g);let m,b=this._getRotation();for(m=0;m<e;++m)b+=this._circumference(m,a);for(m=e;m<e+i;++m){const e=this._circumference(m,a),i=t[m],n={x:l+this.offsetX,y:h+this.offsetY,startAngle:b,endAngle:b+e,circumference:e,outerRadius:u,innerRadius:d};f&&(n.options=g||this.resolveDataElementOptions(m,i.active?"active":s)),b+=e,this.updateElement(i,m,n,s)}this.updateSharedOptions(g,s,p)}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){const a=t._parsed[i];null===a||isNaN(a)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(a))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?W*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],a=bi(e._parsed[t],i.options.locale);return{label:s[t]||"",value:a}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,a,n,o,r;if(!t)for(s=0,a=i.data.datasets.length;s<a;++s)if(i.isDatasetVisible(s)){n=i.getDatasetMeta(s),t=n.data,o=n.controller;break}if(!t)return 0;for(s=0,a=t.length;s<a;++s)r=o.resolveDataElementOptions(s),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(A(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}ss.id="doughnut",ss.defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"},ss.descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t},ss.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const a=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,lineWidth:a.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return v(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class as extends $i{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:a}=e,n=this.chart._animationsDisabled;let{start:o,count:r}=function(t,e,i){const s=e.length;let a=0,n=s;if(t._sorted){const{iScale:o,_parsed:r}=t,l=o.axis,{min:h,max:c,minDefined:d,maxDefined:u}=o.getUserBounds();d&&(a=dt(Math.min(we(r,o.axis,h).lo,i?s:we(e,l,o.getPixelForValue(h)).lo),0,s-1)),n=u?dt(Math.max(we(r,o.axis,c).hi+1,i?0:we(e,l,o.getPixelForValue(c)).hi+1),a,s)-a:s-a}return{start:a,count:n}}(e,s,n);this._drawStart=o,this._drawCount=r,function(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,a={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=a,!0;const n=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return wi(s,a),n}(e)&&(o=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!a._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!n,options:l},t),this.updateElements(s,o,r,t)}updateElements(t,e,i,s){const a="reset"===s,{iScale:n,vScale:o,_stacked:r,_dataset:l}=this._cachedMeta,h=this.resolveDataElementOptions(e,s),c=this.getSharedOptions(h),d=this.includeOptions(s,c),u=n.axis,p=o.axis,{spanGaps:g,segment:f}=this.options,m=tt(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||a||"none"===s;let x=e>0&&this.getParsed(e-1);for(let h=e;h<e+i;++h){const e=t[h],i=this.getParsed(h),g=b?e:{},_=y(i[p]),v=g[u]=n.getPixelForValue(i[u],h),C=g[p]=a||_?o.getBasePixel():o.getPixelForValue(r?this.applyStack(o,i,r):i[p],h);g.skip=isNaN(v)||isNaN(C)||_,g.stop=h>0&&i[u]-x[u]>m,f&&(g.parsed=i,g.raw=l.data[h]),d&&(g.options=c||this.resolveDataElementOptions(h,e.active?"active":s)),b||this.updateElement(e,h,g,s),x=i}this.updateSharedOptions(c,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const a=s[0].size(this.resolveDataElementOptions(0)),n=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,a,n)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}as.id="line",as.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},as.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class ns extends $i{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],a=bi(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:a}}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),a=Math.max(s/2,0),n=(a-Math.max(i.cutoutPercentage?a/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=a-n*this.index,this.innerRadius=this.outerRadius-n}updateElements(t,e,i,s){const a="reset"===s,n=this.chart,o=this.getDataset(),r=n.options.animation,l=this._cachedMeta.rScale,h=l.xCenter,c=l.yCenter,d=l.getIndexAngle(0)-.5*j;let u,p=d;const g=360/this.countVisibleElements();for(u=0;u<e;++u)p+=this._computeAngle(u,s,g);for(u=e;u<e+i;u++){const e=t[u];let i=p,f=p+this._computeAngle(u,s,g),m=n.getDataVisibility(u)?l.getDistanceFromCenterForValue(o.data[u]):0;p=f,a&&(r.animateScale&&(m=0),r.animateRotate&&(i=f=d));const b={x:h,y:c,innerRadius:0,outerRadius:m,startAngle:i,endAngle:f,options:this.resolveDataElementOptions(u,e.active?"active":s)};this.updateElement(e,u,b,s)}}countVisibleElements(){const t=this.getDataset(),e=this._cachedMeta;let i=0;return e.data.forEach(((e,s)=>{!isNaN(t.data[s])&&this.chart.getDataVisibility(s)&&i++})),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?st(this.resolveDataElementOptions(t,e).angle||i):0}}ns.id="polarArea",ns.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},ns.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const a=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,lineWidth:a.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class os extends ss{}os.id="pie",os.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class rs extends $i{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],a=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const n={_loop:!0,_fullLoop:a.length===s.length,options:e};this.updateElement(i,void 0,n,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const a=this.getDataset(),n=this._cachedMeta.rScale,o="reset"===s;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":s),l=n.getPointPositionForValue(r,a.data[r]),h=o?n.xCenter:l.x,c=o?n.yCenter:l.y,d={x:h,y:c,angle:l.angle,skip:isNaN(h)||isNaN(c),options:i};this.updateElement(e,r,d,s)}}}rs.id="radar",rs.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},rs.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class ls extends as{}ls.id="scatter",ls.defaults={showLine:!1,fill:!1},ls.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var hs=Object.freeze({__proto__:null,BarController:es,BubbleController:is,DoughnutController:ss,LineController:as,PolarAreaController:ns,PieController:os,RadarController:rs,ScatterController:ls});function cs(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class ds{constructor(t){this.options=t||{}}formats(){return cs()}parse(t,e){return cs()}format(t,e){return cs()}add(t,e,i){return cs()}diff(t,e,i){return cs()}startOf(t,e,i){return cs()}endOf(t,e){return cs()}}ds.override=function(t){wi(ds.prototype,t)};var us={_date:ds};function ps(t,e){return"native"in t?{x:t.x,y:t.y}:ri(t,e)}function gs(t,e,i,s){const{controller:a,data:n,_sorted:o}=t,r=a._cachedMeta.iScale;if(r&&e===r.axis&&"r"!==e&&o&&n.length){const t=r._reversePixels?Re:we;if(!s)return t(n,e,i);if(a._sharedOptions){const s=n[0],a="function"==typeof s.getRange&&s.getRange(e);if(a){const s=t(n,e,i-a),o=t(n,e,i+a);return{lo:s.lo,hi:o.hi}}}}return{lo:0,hi:n.length-1}}function fs(t,e,i,s,a){const n=t.getSortedVisibleDatasetMetas(),o=i[e];for(let t=0,i=n.length;t<i;++t){const{index:i,data:r}=n[t],{lo:l,hi:h}=gs(n[t],e,o,a);for(let t=l;t<=h;++t){const e=r[t];e.skip||s(e,i,t)}}}function ms(t,e,i,s){const a=[];if(!le(e,t.chartArea,t._minPadding))return a;return fs(t,i,e,(function(t,i,n){t.inRange(e.x,e.y,s)&&a.push({element:t,datasetIndex:i,index:n})}),!0),a}function bs(t,e,i,s,a){let n=[];const o=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const a=e?Math.abs(t.x-s.x):0,n=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(a,2)+Math.pow(n,2))}}(i);let r=Number.POSITIVE_INFINITY;return fs(t,i,e,(function(i,l,h){const c=i.inRange(e.x,e.y,a);if(s&&!c)return;const d=i.getCenterPoint(a);if(!le(d,t.chartArea,t._minPadding)&&!c)return;const u=o(e,d);u<r?(n=[{element:i,datasetIndex:l,index:h}],r=u):u===r&&n.push({element:i,datasetIndex:l,index:h})})),n}function xs(t,e,i,s,a){return le(e,t.chartArea,t._minPadding)?"r"!==i||s?bs(t,e,i,s,a):function(t,e,i,s){let a=[];return fs(t,i,e,(function(t,i,n){const{startAngle:o,endAngle:r}=t.getProps(["startAngle","endAngle"],s),{angle:l}=ot(t,{x:e.x,y:e.y});ct(l,o,r)&&a.push({element:t,datasetIndex:i,index:n})})),a}(t,e,i,a):[]}function _s(t,e,i,s){const a=ps(e,t),n=[],o=i.axis,r="x"===o?"inXRange":"inYRange";let l=!1;return function(t,e){const i=t.getSortedVisibleDatasetMetas();let s,a,n;for(let t=0,o=i.length;t<o;++t){({index:s,data:a}=i[t]);for(let t=0,i=a.length;t<i;++t)n=a[t],n.skip||e(n,s,t)}}(t,((t,e,i)=>{t[r](a[o],s)&&n.push({element:t,datasetIndex:e,index:i}),t.inRange(a.x,a.y,s)&&(l=!0)})),i.intersect&&!l?[]:n}var ys={modes:{index(t,e,i,s){const a=ps(e,t),n=i.axis||"x",o=i.intersect?ms(t,a,n,s):xs(t,a,n,!1,s),r=[];return o.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=o[0].index,i=t.data[e];i&&!i.skip&&r.push({element:i,datasetIndex:t.index,index:e})})),r):[]},dataset(t,e,i,s){const a=ps(e,t),n=i.axis||"xy";let o=i.intersect?ms(t,a,n,s):xs(t,a,n,!1,s);if(o.length>0){const e=o[0].datasetIndex,i=t.getDatasetMeta(e).data;o=[];for(let t=0;t<i.length;++t)o.push({element:i[t],datasetIndex:e,index:t})}return o},point:(t,e,i,s)=>ms(t,ps(e,t),i.axis||"xy",s),nearest:(t,e,i,s)=>xs(t,ps(e,t),i.axis||"xy",i.intersect,s),x:(t,e,i,s)=>_s(t,e,{axis:"x",intersect:i.intersect},s),y:(t,e,i,s)=>_s(t,e,{axis:"y",intersect:i.intersect},s)}};const vs=["left","top","right","bottom"];function Cs(t,e){return t.filter((t=>t.pos===e))}function ks(t,e){return t.filter((t=>-1===vs.indexOf(t.pos)&&t.box.axis===e))}function Ts(t,e){return t.sort(((t,i)=>{const s=e?i:t,a=e?t:i;return s.weight===a.weight?s.index-a.index:s.weight-a.weight}))}function As(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:a}=i;if(!t||!vs.includes(s))continue;const n=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});n.count++,n.weight+=a}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:a}=e;let n,o,r;for(n=0,o=t.length;n<o;++n){r=t[n];const{fullSize:o}=r.box,l=i[r.stack],h=l&&r.stackWeight/l.weight;r.horizontal?(r.width=h?h*s:o&&e.availableWidth,r.height=a):(r.width=s,r.height=h?h*a:o&&e.availableHeight)}return i}function Ms(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function Ss(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function ws(t,e,i,s){const{pos:a,box:n}=i,o=t.maxPadding;if(!C(a)){i.size&&(t[a]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?n.height:n.width),i.size=e.size/e.count,t[a]+=i.size}n.getPadding&&Ss(o,n.getPadding());const r=Math.max(0,e.outerWidth-Ms(o,t,"left","right")),l=Math.max(0,e.outerHeight-Ms(o,t,"top","bottom")),h=r!==t.w,c=l!==t.h;return t.w=r,t.h=l,i.horizontal?{same:h,other:c}:{same:c,other:h}}function Rs(t,e){const i=e.maxPadding;function s(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function Ls(t,e,i,s){const a=[];let n,o,r,l,h,c;for(n=0,o=t.length,h=0;n<o;++n){r=t[n],l=r.box,l.update(r.width||e.w,r.height||e.h,Rs(r.horizontal,e));const{same:o,other:d}=ws(e,i,r,s);h|=o&&a.length,c=c||d,l.fullSize||a.push(r)}return h&&Ls(a,e,i,s)||c}function Os(t,e,i,s,a){t.top=i,t.left=e,t.right=e+s,t.bottom=i+a,t.width=s,t.height=a}function Ds(t,e,i,s){const a=i.padding;let{x:n,y:o}=e;for(const r of t){const t=r.box,l=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/l.weight||1;if(r.horizontal){const s=e.w*h,n=l.size||t.height;N(l.start)&&(o=l.start),t.fullSize?Os(t,a.left,o,i.outerWidth-a.right-a.left,n):Os(t,e.left+l.placed,o,s,n),l.start=o,l.placed+=s,o=t.bottom}else{const s=e.h*h,o=l.size||t.width;N(l.start)&&(n=l.start),t.fullSize?Os(t,n,a.top,o,i.outerHeight-a.bottom-a.top):Os(t,n,e.top+l.placed,o,s),l.start=n,l.placed+=s,n=t.right}}e.x=n,e.y=o}ie.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var Ps={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const a=ke(t.options.layout.padding),n=Math.max(e-a.width,0),o=Math.max(i-a.height,0),r=function(t){const e=function(t){const e=[];let i,s,a,n,o,r;for(i=0,s=(t||[]).length;i<s;++i)a=t[i],({position:n,options:{stack:o,stackWeight:r=1}}=a),e.push({index:i,box:a,pos:n,horizontal:a.isHorizontal(),weight:a.weight,stack:o&&n+o,stackWeight:r});return e}(t),i=Ts(e.filter((t=>t.box.fullSize)),!0),s=Ts(Cs(e,"left"),!0),a=Ts(Cs(e,"right")),n=Ts(Cs(e,"top"),!0),o=Ts(Cs(e,"bottom")),r=ks(e,"x"),l=ks(e,"y");return{fullSize:i,leftAndTop:s.concat(n),rightAndBottom:a.concat(l).concat(o).concat(r),chartArea:Cs(e,"chartArea"),vertical:s.concat(a).concat(l),horizontal:n.concat(o).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;w(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:a,availableWidth:n,availableHeight:o,vBoxMaxWidth:n/2/c,hBoxMaxHeight:o/2}),u=wi({},a);Ss(u,ke(s));const p=wi({maxPadding:u,w:n,h:o,x:a.left,y:a.top},a),g=As(l.concat(h),d);Ls(r.fullSize,p,d,g),Ls(l,p,d,g),Ls(h,p,d,g)&&Ls(l,p,d,g),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),Ds(r.leftAndTop,p,d,g),p.x+=p.w,p.y+=p.h,Ds(r.rightAndBottom,p,d,g),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},w(r.chartArea,(e=>{const i=e.box;wi(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Bs{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Es extends Bs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Is={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Vs=t=>null===t||""===t;const Fs=!!di&&{passive:!0};function Ns(t,e,i){t.canvas.removeEventListener(e,i,Fs)}function Hs(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function zs(t,e,i){const s=t.canvas,a=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Hs(i.addedNodes,s),e=e&&!Hs(i.removedNodes,s);e&&i()}));return a.observe(document,{childList:!0,subtree:!0}),a}function js(t,e,i){const s=t.canvas,a=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Hs(i.removedNodes,s),e=e&&!Hs(i.addedNodes,s);e&&i()}));return a.observe(document,{childList:!0,subtree:!0}),a}const Ws=new Map;let Gs=0;function Us(){const t=window.devicePixelRatio;t!==Gs&&(Gs=t,Ws.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function $s(t,e,i){const s=t.canvas,a=s&&ii(s);if(!a)return;const n=f(((t,e)=>{const s=a.clientWidth;i(t,e),s<a.clientWidth&&i()}),window),o=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||n(i,s)}));return o.observe(a),function(t,e){Ws.size||window.addEventListener("resize",Us),Ws.set(t,e)}(t,n),o}function Ys(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){Ws.delete(t),Ws.size||window.removeEventListener("resize",Us)}(t)}function Xs(t,e,i){const s=t.canvas,a=f((e=>{null!==t.ctx&&i(function(t,e){const i=Is[t.type]||t.type,{x:s,y:a}=ri(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==a?a:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,Fs)}(s,e,a),a}class Js extends Bs{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),a=t.getAttribute("width");if(t.$chartjs={initial:{height:s,width:a,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Vs(a)){const e=ui(t,"width");void 0!==e&&(t.width=e)}if(Vs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=ui(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const i=e.$chartjs.initial;["height","width"].forEach((t=>{const s=i[t];y(s)?e.removeAttribute(t):e.setAttribute(t,s)}));const s=i.style||{};return Object.keys(s).forEach((t=>{e.style[t]=s[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),a={attach:zs,detach:js,resize:$s}[e]||Xs;s[e]=a(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Ys,detach:Ys,resize:Ys}[e]||Ns)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return hi(t,e,i,s)}isAttached(t){const e=ii(t);return!(!e||!e.isConnected)}}class qs{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return tt(this.x)&&tt(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach((t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}qs.defaults={},qs.defaultRoutes=void 0;const Ks={values:t=>v(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let a,n=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(a="scientific"),n=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const o=K(Math.abs(n)),r=Math.max(Math.min(-1*Math.floor(o),20),0),l={notation:a,minimumFractionDigits:r,maximumFractionDigits:r};return wi(l,this.options.ticks.format),bi(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=t/Math.pow(10,Math.floor(K(t)));return 1===s||2===s||5===s?Ks.numeric.call(this,t,e,i):""}};var Zs={formatters:Ks};function Qs(t,e){const i=t.options.ticks,s=i.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),a=t._maxLength/i;return Math.floor(Math.min(s,a))}(t),a=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}(e):[],n=a.length,o=a[0],r=a[n-1],l=[];if(n>s)return function(t,e,i,s){let a,n=0,o=i[0];for(s=Math.ceil(s),a=0;a<t.length;a++)a===o&&(e.push(t[a]),n++,o=i[n*s])}(e,l,a,n/s),l;const h=function(t,e,i){const s=function(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),a=e.length/i;if(!s)return Math.max(a,1);const n=function(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(s);for(let t=0,e=n.length-1;t<e;t++){const e=n[t];if(e>a)return e}return Math.max(a,1)}(a,e,s);if(n>0){let t,i;const s=n>1?Math.round((r-o)/(n-1)):null;for(ta(e,l,h,y(s)?0:o-s,o),t=0,i=n-1;t<i;t++)ta(e,l,h,a[t],a[t+1]);return ta(e,l,h,r,y(s)?e.length:r+s),l}return ta(e,l,h),l}function ta(t,e,i,s,a){const n=A(s,0),o=Math.min(A(a,t.length),t.length);let r,l,h,c=0;for(i=Math.ceil(i),a&&(r=a-s,i=r/Math.floor(r/i)),h=n;h<0;)c++,h=Math.round(n+c*i);for(l=Math.max(n,0);l<o;l++)l===h&&(e.push(t[l]),c++,h=Math.round(n+c*i))}ie.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Zs.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),ie.route("scale.ticks","color","","color"),ie.route("scale.grid","color","","borderColor"),ie.route("scale.grid","borderColor","","borderColor"),ie.route("scale.title","color","","color"),ie.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),ie.describe("scales",{_fallback:"scale"}),ie.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const ea=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function ia(t,e){const i=[],s=t.length/e,a=t.length;let n=0;for(;n<a;n+=s)i.push(t[Math.floor(n)]);return i}function sa(t,e,i){const s=t.ticks.length,a=Math.min(e,s-1),n=t._startPixel,o=t._endPixel,r=1e-6;let l,h=t.getPixelForTick(a);if(!(i&&(l=1===s?Math.max(h-n,o-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(a-1))/2,h+=a<e?l:-l,h<n-r||h>o+r)))return h}function aa(t){return t.drawTicks?t.tickLength:0}function na(t,e){if(!t.display)return 0;const i=Te(t.font,e),s=ke(t.padding);return(v(t.text)?t.text.length:1)*i.lineHeight+s.height}function oa(t,e,i){let s=m(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class ra extends qs{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=T(t,Number.POSITIVE_INFINITY),e=T(e,Number.NEGATIVE_INFINITY),i=T(i,Number.POSITIVE_INFINITY),s=T(s,Number.NEGATIVE_INFINITY),{min:T(t,i),max:T(e,s),minDefined:k(t),maxDefined:k(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:a,maxDefined:n}=this.getUserBounds();if(a&&n)return{min:i,max:s};const o=this.getMatchingVisibleMetas();for(let r=0,l=o.length;r<l;++r)e=o[r].controller.getMinMax(this,t),a||(i=Math.min(i,e.min)),n||(s=Math.max(s,e.max));return i=n&&i>s?s:i,s=a&&i>s?i:s,{min:T(i,T(s,i)),max:T(s,T(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){S(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:a,ticks:n}=this.options,o=n.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=wi({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:s,max:a}=t,n=M(e,(a-s)/2),o=(t,e)=>i&&0===t?0:t+e;return{min:o(s,-Math.abs(n)),max:o(a,n)}}(this,a,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=o<this.ticks.length;this._convertTicksToLabels(r?ia(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),n.display&&(n.autoSkip||"auto"===n.source)&&(this.ticks=Qs(this,this.ticks),this._labelSizes=null),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){S(this.options.afterUpdate,[this])}beforeSetDimensions(){S(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){S(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),S(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){S(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,a;for(i=0,s=t.length;i<s;i++)a=t[i],a.label=S(e.callback,[a.value,i,t],this)}afterTickToLabelConversion(){S(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){S(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=this.ticks.length,s=e.minRotation||0,a=e.maxRotation;let n,o,r,l=s;if(!this._isVisible()||!e.display||s>=a||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=dt(this.chart.width-c,0,this.maxWidth);n=t.offset?this.maxWidth/i:u/(i-1),c+6>n&&(n=u/(i-(t.offset?.5:1)),o=this.maxHeight-aa(t.grid)-e.padding-na(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=at(Math.min(Math.asin(dt((h.highest.height+6)/n,-1,1)),Math.asin(dt(o/r,-1,1))-Math.asin(dt(d/r,-1,1)))),l=Math.max(s,Math.min(a,l))),this.labelRotation=l}afterCalculateLabelRotation(){S(this.options.afterCalculateLabelRotation,[this])}beforeFit(){S(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:a}}=this,n=this._isVisible(),o=this.isHorizontal();if(n){const n=na(s,e.options.font);if(o?(t.width=this.maxWidth,t.height=aa(a)+n):(t.height=this.maxHeight,t.width=aa(a)+n),i.display&&this.ticks.length){const{first:e,last:s,widest:a,highest:n}=this._getLabelSizes(),r=2*i.padding,l=st(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(o){const e=i.mirror?0:c*a.width+h*n.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*a.width+c*n.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),o?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:a,padding:n},position:o}=this.options,r=0!==this.labelRotation,l="top"!==o&&"x"===this.axis;if(this.isHorizontal()){const o=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===a?d=e.width:"end"===a?c=t.width:(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-o+n)*this.width/(this.width-o),0),this.paddingRight=Math.max((d-h+n)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===a?(i=0,s=t.height):"end"===a&&(i=e.height,s=0),this.paddingTop=i+n,this.paddingBottom=s+n}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){S(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)y(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=ia(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length)}return t}_computeLabelSizes(t,e){const{ctx:i,_longestTextCache:s}=this,a=[],n=[];let o,r,l,h,c,d,u,p,g,f,m,b=0,x=0;for(o=0;o<e;++o){if(h=t[o].label,c=this._resolveTickFontOptions(o),i.font=d=c.string,u=s[d]=s[d]||{data:{},gc:[]},p=c.lineHeight,g=f=0,y(h)||v(h)){if(v(h))for(r=0,l=h.length;r<l;++r)m=h[r],y(m)||v(m)||(g=se(i,u.data,u.gc,g,m),f+=p)}else g=se(i,u.data,u.gc,g,h),f=p;a.push(g),n.push(f),b=Math.max(g,b),x=Math.max(f,x)}!function(t,e){w(t,(t=>{const i=t.gc,s=i.length/2;let a;if(s>e){for(a=0;a<s;++a)delete t.data[i[a]];i.splice(0,s)}}))}(s,e);const _=a.indexOf(b),C=n.indexOf(x),k=t=>({width:a[t]||0,height:n[t]||0});return{first:k(0),last:k(e-1),widest:k(_),highest:k(C),widths:a,heights:n}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return dt(this._alignToPixels?ne(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Me(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Me(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=st(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),a=this._getLabelSizes(),n=t.autoSkipPadding||0,o=a?a.widest.width+n:0,r=a?a.highest.height+n:0;return this.isHorizontal()?r*i>o*s?o/i:r/s:r*s<o*i?r/i:o/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:a,position:n}=s,o=a.offset,r=this.isHorizontal(),l=this.ticks.length+(o?1:0),h=aa(a),c=[],d=a.setContext(this.getContext()),u=d.drawBorder?d.borderWidth:0,p=u/2,g=function(t){return ne(i,t,u)};let f,m,b,x,_,y,v,k,T,M,S,w;if("top"===n)f=g(this.bottom),y=this.bottom-h,k=f-p,M=g(t.top)+p,w=t.bottom;else if("bottom"===n)f=g(this.top),M=t.top,w=g(t.bottom)-p,y=f+p,k=this.top+h;else if("left"===n)f=g(this.right),_=this.right-h,v=f-p,T=g(t.left)+p,S=t.right;else if("right"===n)f=g(this.left),T=t.left,S=g(t.right)-p,_=f+p,v=this.left+h;else if("x"===e){if("center"===n)f=g((t.top+t.bottom)/2+.5);else if(C(n)){const t=Object.keys(n)[0],e=n[t];f=g(this.chart.scales[t].getPixelForValue(e))}M=t.top,w=t.bottom,y=f+p,k=y+h}else if("y"===e){if("center"===n)f=g((t.left+t.right)/2);else if(C(n)){const t=Object.keys(n)[0],e=n[t];f=g(this.chart.scales[t].getPixelForValue(e))}_=f-p,v=_-h,T=t.left,S=t.right}const R=A(s.ticks.maxTicksLimit,l),L=Math.max(1,Math.ceil(l/R));for(m=0;m<l;m+=L){const t=a.setContext(this.getContext(m)),e=t.lineWidth,s=t.color,n=a.borderDash||[],l=t.borderDashOffset,h=t.tickWidth,d=t.tickColor,u=t.tickBorderDash||[],p=t.tickBorderDashOffset;b=sa(this,m,o),void 0!==b&&(x=ne(i,b,e),r?_=v=T=S=x:y=k=M=w=x,c.push({tx1:_,ty1:y,tx2:v,ty2:k,x1:T,y1:M,x2:S,y2:w,width:e,color:s,borderDash:n,borderDashOffset:l,tickWidth:h,tickColor:d,tickBorderDash:u,tickBorderDashOffset:p}))}return this._ticksLength=l,this._borderValue=f,c}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:a}=i,n=this.isHorizontal(),o=this.ticks,{align:r,crossAlign:l,padding:h,mirror:c}=a,d=aa(i.grid),u=d+h,p=c?-h:u,g=-st(this.labelRotation),f=[];let m,b,x,_,y,k,T,A,M,S,w,R,L="middle";if("top"===s)k=this.bottom-p,T=this._getXAxisLabelAlignment();else if("bottom"===s)k=this.top+p,T=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(d);T=t.textAlign,y=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(d);T=t.textAlign,y=t.x}else if("x"===e){if("center"===s)k=(t.top+t.bottom)/2+u;else if(C(s)){const t=Object.keys(s)[0],e=s[t];k=this.chart.scales[t].getPixelForValue(e)+u}T=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)y=(t.left+t.right)/2-u;else if(C(s)){const t=Object.keys(s)[0],e=s[t];y=this.chart.scales[t].getPixelForValue(e)}T=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===r?L="top":"end"===r&&(L="bottom"));const O=this._getLabelSizes();for(m=0,b=o.length;m<b;++m){x=o[m],_=x.label;const t=a.setContext(this.getContext(m));A=this.getPixelForTick(m)+a.labelOffset,M=this._resolveTickFontOptions(m),S=M.lineHeight,w=v(_)?_.length:1;const e=w/2,i=t.color,r=t.textStrokeColor,h=t.textStrokeWidth;let d;if(n?(y=A,R="top"===s?"near"===l||0!==g?-w*S+S/2:"center"===l?-O.highest.height/2-e*S+S:-O.highest.height+S/2:"near"===l||0!==g?S/2:"center"===l?O.highest.height/2-e*S:O.highest.height-w*S,c&&(R*=-1)):(k=A,R=(1-w)*S/2),t.showLabelBackdrop){const e=ke(t.backdropPadding),i=O.heights[m],s=O.widths[m];let a=k+R-e.top,n=y-e.left;switch(L){case"middle":a-=i/2;break;case"bottom":a-=i}switch(T){case"center":n-=s/2;break;case"right":n-=s}d={left:n,top:a,width:s+e.width,height:i+e.height,color:t.backdropColor}}f.push({rotation:g,label:_,font:M,color:i,strokeColor:r,strokeWidth:h,textOffset:R,textAlign:T,textBaseline:L,translation:[y,k],backdrop:d})}return f}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-st(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align&&(i="right"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:a}}=this.options,n=t+a,o=this._getLabelSizes().widest.width;let r,l;return"left"===e?s?(l=this.right+a,"near"===i?r="left":"center"===i?(r="center",l+=o/2):(r="right",l+=o)):(l=this.right-n,"near"===i?r="right":"center"===i?(r="center",l-=o/2):(r="left",l=this.left)):"right"===e?s?(l=this.left+a,"near"===i?r="right":"center"===i?(r="center",l-=o/2):(r="left",l-=o)):(l=this.left+n,"near"===i?r="left":"center"===i?(r="center",l+=o/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:a,height:n}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,a,n),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let a,n;const o=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(a=0,n=s.length;a<n;++a){const t=s[a];e.drawOnChartArea&&o({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&o({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{grid:i}}=this,s=i.setContext(this.getContext()),a=i.drawBorder?s.borderWidth:0;if(!a)return;const n=i.setContext(this.getContext(0)).lineWidth,o=this._borderValue;let r,l,h,c;this.isHorizontal()?(r=ne(t,this.left,a)-a/2,l=ne(t,this.right,n)+n/2,h=c=o):(h=ne(t,this.top,a)-a/2,c=ne(t,this.bottom,n)+n/2,r=l=o),e.save(),e.lineWidth=s.borderWidth,e.strokeStyle=s.borderColor,e.beginPath(),e.moveTo(r,h),e.lineTo(l,c),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&he(e,i);const s=this._labelItems||(this._labelItems=this._computeLabelItems(t));let a,n;for(a=0,n=s.length;a<n;++a){const t=s[a],i=t.font,n=t.label;t.backdrop&&(e.fillStyle=t.backdrop.color,e.fillRect(t.backdrop.left,t.backdrop.top,t.backdrop.width,t.backdrop.height)),pe(e,n,0,t.textOffset,i,t)}i&&ce(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const a=Te(i.font),n=ke(i.padding),o=i.align;let r=a.lineHeight/2;"bottom"===e||"center"===e||C(e)?(r+=n.bottom,v(i.text)&&(r+=a.lineHeight*(i.text.length-1))):r+=n.top;const{titleX:l,titleY:h,maxWidth:c,rotation:d}=function(t,e,i,s){const{top:a,left:n,bottom:o,right:r,chart:l}=t,{chartArea:h,scales:c}=l;let d,u,p,g=0;const f=o-a,m=r-n;if(t.isHorizontal()){if(u=b(s,n,r),C(i)){const t=Object.keys(i)[0],s=i[t];p=c[t].getPixelForValue(s)+f-e}else p="center"===i?(h.bottom+h.top)/2+f-e:ea(t,i,e);d=r-n}else{if(C(i)){const t=Object.keys(i)[0],s=i[t];u=c[t].getPixelForValue(s)-m+e}else u="center"===i?(h.left+h.right)/2-m+e:ea(t,i,e);p=b(s,o,a),g="left"===i?-X:X}return{titleX:u,titleY:p,maxWidth:d,rotation:g}}(this,r,e,o);pe(t,i.text,0,0,a,{color:i.color,maxWidth:c,rotation:d,textAlign:oa(o,e,s),textBaseline:"middle",translation:[l,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=A(t.grid&&t.grid.z,-1);return this._isVisible()&&this.draw===ra.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let a,n;for(a=0,n=e.length;a<n;++a){const n=e[a];n[i]!==this.id||t&&n.type!==t||s.push(n)}return s}_resolveTickFontOptions(t){return Te(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class la{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const s=this.items,a=t.id,n=this.scope+"."+a;if(!a)throw new Error("class does not have id: "+t);return a in s||(s[a]=t,function(t,e,i){const s=P(Object.create(null),[i?ie.get(i):{},ie.get(e),t.defaults]);ie.set(e,s),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const s=i.split("."),a=s.pop(),n=[t].concat(s).join("."),o=e[i].split("."),r=o.pop(),l=o.join(".");ie.route(n,a,l,r)}))}(e,t.defaultRoutes);t.descriptors&&ie.describe(e,t.descriptors)}(t,n,i),this.override&&ie.override(t.id,t.overrides)),n}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ie[s]&&(delete ie[s][i],this.override&&delete Zt[i])}}var ha=new class{constructor(){this.controllers=new la($i,"datasets",!0),this.elements=new la(qs,"elements"),this.plugins=new la(Object,"plugins"),this.scales=new la(ra,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("register",e)}remove(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("unregister",e)}addControllers(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("register",e,this.controllers)}addElements(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("register",e,this.elements)}addPlugins(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("register",e,this.plugins)}addScales(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("register",e,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("unregister",e,this.controllers)}removeElements(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("unregister",e,this.elements)}removePlugins(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("unregister",e,this.plugins)}removeScales(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];this._each("unregister",e,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):w(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=F(t);S(i["before"+s],[],i),e[t](i),S(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}};class ca{constructor(){this._init=[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const a=s?this._descriptors(t).filter(s):this._descriptors(t),n=this._notify(a,t,e,i);return"afterDestroy"===e&&(this._notify(a,t,"stop"),this._notify(this._init,t,"uninstall")),n}_notify(t,e,i,s){s=s||{};for(const a of t){const t=a.plugin;if(!1===S(t[i],[e,s,a.options],t)&&s.cancelable)return!1}return!0}invalidate(){y(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=A(i.options&&i.options.plugins,{}),a=function(t){const e=[],i=Object.keys(ha.plugins.items);for(let t=0;t<i.length;t++)e.push(ha.getPlugin(i[t]));const s=t.plugins||[];for(let t=0;t<s.length;t++){const i=s[t];-1===e.indexOf(i)&&e.push(i)}return e}(i);return!1!==s||e?function(t,e,i,s){const a=[],n=t.getContext();for(let o=0;o<e.length;o++){const r=e[o],l=da(i[r.id],s);null!==l&&a.push({plugin:r,options:ua(t.config,r,l,n)})}return a}(t,a,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function da(t,e){return e||!1!==t?!0===t?{}:t:null}function ua(t,e,i,s){const a=t.pluginScopeKeys(e),n=t.getOptionScopes(i,a);return t.createResolver(n,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function pa(t,e){const i=ie.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function ga(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function fa(t){const e=t.options||(t.options={});e.plugins=A(e.plugins,{}),e.scales=function(t,e){const i=Zt[t.type]||{scales:{}},s=e.scales||{},a=pa(t.type,e),n=Object.create(null),o=Object.create(null);return Object.keys(s).forEach((t=>{const e=s[t];if(!C(e))return console.error("Invalid scale configuration for scale: ".concat(t));if(e._proxy)return console.warn("Ignoring resolver passed as options for scale: ".concat(t));const r=ga(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(r,a),h=i.scales||{};n[r]=n[r]||t,o[t]=B(Object.create(null),[{axis:r},e,h[r],h[l]])})),t.data.datasets.forEach((i=>{const a=i.type||t.type,r=i.indexAxis||pa(a,e),l=(Zt[a]||{}).scales||{};Object.keys(l).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),a=i[e+"AxisID"]||n[e]||e;o[a]=o[a]||Object.create(null),B(o[a],[{axis:e},s[a],l[t]])}))})),Object.keys(o).forEach((t=>{const e=o[t];B(e,[ie.scales[e.type],ie.scale])})),o}(t,e)}function ma(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const ba=new Map,xa=new Set;function _a(t,e){let i=ba.get(t);return i||(i=e(),ba.set(t,i),xa.add(i)),i}const ya=(t,e,i)=>{const s=V(e,i);void 0!==s&&t.add(s)};class va{constructor(t){this._config=function(t){return(t=t||{}).data=ma(t.data),fa(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=ma(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),fa(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return _a(t,(()=>[["datasets.".concat(t),""]]))}datasetAnimationScopeKeys(t,e){return _a("".concat(t,".transition.").concat(e),(()=>[["datasets.".concat(t,".transitions.").concat(e),"transitions.".concat(e)],["datasets.".concat(t),""]]))}datasetElementScopeKeys(t,e){return _a("".concat(t,"-").concat(e),(()=>[["datasets.".concat(t,".elements.").concat(e),"datasets.".concat(t),"elements.".concat(e),""]]))}pluginScopeKeys(t){const e=t.id,i=this.type;return _a("".concat(i,"-plugin-").concat(e),(()=>[["plugins.".concat(e),...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:a}=this,n=this._cachedScopes(t,i),o=n.get(e);if(o)return o;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>ya(r,t,e)))),e.forEach((t=>ya(r,s,t))),e.forEach((t=>ya(r,Zt[a]||{},t))),e.forEach((t=>ya(r,ie,t))),e.forEach((t=>ya(r,Qt,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),xa.has(e)&&n.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Zt[e]||{},ie.datasets[e]||{},{type:e},ie,Qt]}resolveNamedOptions(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[""];const a={$shared:!0},{resolver:n,subPrefixes:o}=Ca(this._resolverCache,t,s);let r=n;if(function(t,e){const{isScriptable:i,isIndexable:s}=Ee(t);for(const a of e){const e=i(a),n=s(a),o=(n||e)&&t[a];if(e&&(H(o)||ka(o))||n&&v(o))return!0}return!1}(n,e)){a.$shared=!1;r=Be(n,i=H(i)?i():i,this.createResolver(t,i,o))}for(const t of e)a[t]=r[t];return a}createResolver(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[""],s=arguments.length>3?arguments[3]:void 0;const{resolver:a}=Ca(this._resolverCache,t,i);return C(e)?Be(a,e,void 0,s):a}}function Ca(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const a=i.join();let n=s.get(a);if(!n){n={resolver:Pe(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(a,n)}return n}const ka=t=>C(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||H(t[i])),!1);const Ta=["top","bottom","left","right","chartArea"];function Aa(t,e){return"top"===t||"bottom"===t||-1===Ta.indexOf(t)&&"x"===e}function Ma(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function Sa(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),S(i&&i.onComplete,[t],e)}function wa(t){const e=t.chart,i=e.options.animation;S(i&&i.onProgress,[t],e)}function Ra(t){return ei()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const La={},Oa=t=>{const e=Ra(t);return Object.values(La).filter((t=>t.canvas===e)).pop()};function Da(t,e,i){const s=Object.keys(t);for(const a of s){const s=+a;if(s>=e){const n=t[a];delete t[a],(i>0||s>e)&&(t[s+i]=n)}}}class Pa{constructor(t,e){const i=this.config=new va(e),s=Ra(t),a=Oa(s);if(a)throw new Error("Canvas is already in use. Chart with ID '"+a.id+"' must be destroyed before the canvas can be reused.");const n=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!ei()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Es:Js}(s)),this.platform.updateConfig(i);const o=this.platform.acquireContext(s,n.aspectRatio),r=o&&o.canvas,l=r&&r.height,h=r&&r.width;this.id=_(),this.ctx=o,this.canvas=r,this.width=h,this.height=l,this._options=n,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ca,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(){for(var s=arguments.length,a=new Array(s),n=0;n<s;n++)a[n]=arguments[n];return e?(clearTimeout(i),i=setTimeout(t,e,a)):t.apply(this,a),e}}((t=>this.update(t)),n.resizeDelay||0),this._dataChanges=[],La[this.id]=this,o&&r?(Ri.listen(this,"complete",Sa),Ri.listen(this,"progress",wa),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:a}=this;return y(t)?e&&a?a:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ci(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return oe(this.canvas,this.ctx),this}stop(){return Ri.stop(this),this}resize(t,e){Ri.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,a=i.maintainAspectRatio&&this.aspectRatio,n=this.platform.getMaximumSize(s,t,e,a),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=n.width,this.height=n.height,this._aspectRatio=this.aspectRatio,ci(this,o,!0)&&(this.notifyPlugins("resize",{size:n}),S(i.onResize,[this,n],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){w(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let a=[];e&&(a=a.concat(Object.keys(e).map((t=>{const i=e[t],s=ga(t,i),a="r"===s,n="x"===s;return{options:i,dposition:a?"chartArea":n?"bottom":"left",dtype:a?"radialLinear":n?"category":"linear"}})))),w(a,(e=>{const a=e.options,n=a.id,o=ga(n,a),r=A(a.type,e.dtype);void 0!==a.position&&Aa(a.position,o)===Aa(e.dposition)||(a.position=e.dposition),s[n]=!0;let l=null;if(n in i&&i[n].type===r)l=i[n];else{l=new(ha.getScale(r))({id:n,type:r,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(a,t)})),w(s,((t,e)=>{t||delete i[e]})),w(i,(t=>{Ps.configure(this,t,t.options),Ps.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Ma("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const s=e[i];let a=this.getDatasetMeta(i);const n=s.type||this.config.type;if(a.type&&a.type!==n&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=n,a.indexAxis=s.indexAxis||pa(n,this.options),a.order=s.order||0,a.index=i,a.label=""+s.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{const e=ha.getController(n),{datasetElementType:s,dataElementType:o}=ie.datasets[n];wi(e.prototype,{dataElementType:ha.getElement(o),datasetElementType:s&&ha.getElement(s)}),a.controller=new e(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){w(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const a=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let n=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!s&&-1===a.indexOf(e);e.buildOrUpdateElements(i),n=Math.max(+e.getMaxOverflow(),n)}n=this._minPadding=i.layout.autoPadding?n:0,this._updateLayout(n),s||w(a,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ma("z","_idx"));const{_active:o,_lastEvent:r}=this;r?this._eventHandler(r,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){w(this.scales,(t=>{Ps.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);z(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:a}of e){Da(t,s,"_removeElements"===i?-a:a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;t<e;t++)if(!z(s,i(t)))return;return Array.from(s).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;Ps.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],w(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,H(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(Ri.has(this)?this.attached&&!Ri.running(this)&&Ri.start(this):(this.draw(),Sa({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resize(t,e),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,a;for(s=0,a=e.length;s<a;++s){const a=e[s];t&&!a.visible||i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,a=this.chartArea,n={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",n)&&(s&&he(e,{left:!1===i.left?0:a.left-i.left,right:!1===i.right?this.width:a.right+i.right,top:!1===i.top?0:a.top-i.top,bottom:!1===i.bottom?this.height:a.bottom+i.bottom}),t.controller.draw(),s&&ce(e),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}getElementsAtEventForMode(t,e,i,s){const a=ys.modes[e];return"function"==typeof a?a(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Me(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",a=this.getDatasetMeta(t),n=a.controller._resolveAnimations(void 0,s);N(e)?(a.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),n.update(a,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Ri.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),oe(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete La[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(){return this.canvas.toDataURL(...arguments)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};w(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},a=(t,e)=>{this.canvas&&this.resize(t,e)};let n;const o=()=>{s("attach",o),this.attached=!0,this.resize(),i("resize",a),i("detach",n)};n=()=>{this.attached=!1,s("resize",a),this._stop(),this._resize(0,0),i("attach",o)},e.isAttached(this.canvas)?o():n()}unbindEvents(){w(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},w(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let a,n,o,r;for("dataset"===e&&(a=this.getDatasetMeta(t[0].datasetIndex),a.controller["_"+s+"DatasetHoverStyle"]()),o=0,r=t.length;o<r;++o){n=t[o];const e=n&&this.getDatasetMeta(n.datasetIndex).controller;e&&e[s+"HoverStyle"](n.element,n.datasetIndex,n.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((t=>{let{datasetIndex:e,index:i}=t;const s=this.getDatasetMeta(e);if(!s)throw new Error("No dataset found at index "+e);return{datasetIndex:e,element:s.data[i],index:i}}));!R(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const s=this.options.hover,a=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),n=a(e,t),o=i?t:a(t,e);n.length&&this.updateHoverStyle(n,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:le(t,this.chartArea,this._minPadding)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const a=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(a||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:a}=this,n=e,o=this._getActiveElements(t,s,i,n),r=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,S(a.onHover,[t,o,this],this),r&&S(a.onClick,[t,o,this],this));const h=!R(o,s);return(h||e)&&(this._active=o,this._updateHoverStyles(o,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const a=this.options.hover;return this.getElementsAtEventForMode(t,a.mode,a,s)}}const Ba=()=>w(Pa.instances,(t=>t._plugins.invalidate())),Ea=!0;function Ia(t,e,i){const{startAngle:s,pixelMargin:a,x:n,y:o,outerRadius:r,innerRadius:l}=e;let h=a/r;t.beginPath(),t.arc(n,o,r,s-h,i+h),l>a?(h=a/l,t.arc(n,o,l,i+h,s-h,!0)):t.arc(n,o,a,i+X,s-X),t.closePath(),t.clip()}function Va(t,e,i,s){const a=ye(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const n=(i-e)/2,o=Math.min(n,s*e/2),r=t=>{const e=(i-Math.min(n,t))*s/2;return dt(t,0,Math.min(n,e))};return{outerStart:r(a.outerStart),outerEnd:r(a.outerEnd),innerStart:dt(a.innerStart,0,o),innerEnd:dt(a.innerEnd,0,o)}}function Fa(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Na(t,e,i,s,a){const{x:n,y:o,startAngle:r,pixelMargin:l,innerRadius:h}=e,c=Math.max(e.outerRadius+s+i-l,0),d=h>0?h+s+i+l:0;let u=0;const p=a-r;if(s){const t=((h>0?h-s:0)+(c>0?c-s:0))/2;u=(p-(0!==t?p*t/(t+s):p))/2}const g=(p-Math.max(.001,p*c-i/j)/c)/2,f=r+g+u,m=a-g-u,{outerStart:b,outerEnd:x,innerStart:_,innerEnd:y}=Va(e,d,c,m-f),v=c-b,C=c-x,k=f+b/v,T=m-x/C,A=d+_,M=d+y,S=f+_/A,w=m-y/M;if(t.beginPath(),t.arc(n,o,c,k,T),x>0){const e=Fa(C,T,n,o);t.arc(e.x,e.y,x,T,m+X)}const R=Fa(M,m,n,o);if(t.lineTo(R.x,R.y),y>0){const e=Fa(M,w,n,o);t.arc(e.x,e.y,y,m+X,w+Math.PI)}if(t.arc(n,o,d,m-y/d,f+_/d,!0),_>0){const e=Fa(A,S,n,o);t.arc(e.x,e.y,_,S+Math.PI,f-X)}const L=Fa(v,f,n,o);if(t.lineTo(L.x,L.y),b>0){const e=Fa(v,k,n,o);t.arc(e.x,e.y,b,f-X,k)}t.closePath()}function Ha(t,e,i,s,a){const{options:n}=e,{borderWidth:o,borderJoinStyle:r}=n,l="inner"===n.borderAlign;o&&(l?(t.lineWidth=2*o,t.lineJoin=r||"round"):(t.lineWidth=o,t.lineJoin=r||"bevel"),e.fullCircles&&function(t,e,i){const{x:s,y:a,startAngle:n,pixelMargin:o,fullCircles:r}=e,l=Math.max(e.outerRadius-o,0),h=e.innerRadius+o;let c;for(i&&Ia(t,e,n+W),t.beginPath(),t.arc(s,a,h,n+W,n,!0),c=0;c<r;++c)t.stroke();for(t.beginPath(),t.arc(s,a,l,n,n+W),c=0;c<r;++c)t.stroke()}(t,e,l),l&&Ia(t,e,a),Na(t,e,i,s,a),t.stroke())}Object.defineProperties(Pa,{defaults:{enumerable:Ea,value:ie},instances:{enumerable:Ea,value:La},overrides:{enumerable:Ea,value:Zt},registry:{enumerable:Ea,value:ha},version:{enumerable:Ea,value:"3.7.0"},getChart:{enumerable:Ea,value:Oa},register:{enumerable:Ea,value:function(){ha.add(...arguments),Ba()}},unregister:{enumerable:Ea,value:function(){ha.remove(...arguments),Ba()}}});class za extends qs{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&wi(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:a,distance:n}=ot(s,{x:t,y:e}),{startAngle:o,endAngle:r,innerRadius:l,outerRadius:h,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=this.options.spacing/2,u=A(c,r-o)>=W||ct(a,o,r),p=ut(n,l+d,h+d);return u&&p}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:a,innerRadius:n,outerRadius:o}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:r,spacing:l}=this.options,h=(s+a)/2,c=(n+o+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,a=(e.spacing||0)/2;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>W?Math.floor(i/W):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let n=0;if(s){n=s/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*n,Math.sin(e)*n),this.circumference>=j&&(n=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const o=function(t,e,i,s){const{fullCircles:a,startAngle:n,circumference:o}=e;let r=e.endAngle;if(a){Na(t,e,i,s,n+W);for(let e=0;e<a;++e)t.fill();isNaN(o)||(r=n+o%W,o%W==0&&(r+=W))}return Na(t,e,i,s,r),t.fill(),r}(t,this,n,a);Ha(t,this,n,a,o),t.restore()}}function ja(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;t.lineCap=A(i.borderCapStyle,e.borderCapStyle),t.setLineDash(A(i.borderDash,e.borderDash)),t.lineDashOffset=A(i.borderDashOffset,e.borderDashOffset),t.lineJoin=A(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=A(i.borderWidth,e.borderWidth),t.strokeStyle=A(i.borderColor,e.borderColor)}function Wa(t,e,i){t.lineTo(i.x,i.y)}function Ga(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=t.length,{start:a=0,end:n=s-1}=i,{start:o,end:r}=e,l=Math.max(a,o),h=Math.min(n,r),c=a<o&&n<o||a>r&&n>r;return{count:s,start:l,loop:e.loop,ilen:h<l&&!c?s+h-l:h-l}}function Ua(t,e,i,s){const{points:a,options:n}=e,{count:o,start:r,loop:l,ilen:h}=Ga(a,i,s),c=function(t){return t.stepped?de:t.tension||"monotone"===t.cubicInterpolationMode?ue:Wa}(n);let d,u,p,{move:g=!0,reverse:f}=s||{};for(d=0;d<=h;++d)u=a[(r+(f?h-d:d))%o],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):c(t,p,u,f,n.stepped),p=u);return l&&(u=a[(r+(f?h:0))%o],c(t,p,u,f,n.stepped)),!!l}function $a(t,e,i,s){const a=e.points,{count:n,start:o,ilen:r}=Ga(a,i,s),{move:l=!0,reverse:h}=s||{};let c,d,u,p,g,f,m=0,b=0;const x=t=>(o+(h?r-t:t))%n,_=()=>{p!==g&&(t.lineTo(m,g),t.lineTo(m,p),t.lineTo(m,f))};for(l&&(d=a[x(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=a[x(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(i<p?p=i:i>g&&(g=i),m=(b*m+e)/++b):(_(),t.lineTo(e,i),u=s,b=0,p=g=i),f=i}_()}function Ya(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?$a:Ua}za.id="arc",za.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0},za.defaultRoutes={backgroundColor:"backgroundColor"};const Xa="function"==typeof Path2D;function Ja(t,e,i,s){Xa&&!e.options.segment?function(t,e,i,s){let a=e._path;a||(a=e._path=new Path2D,e.path(a,i,s)&&a.closePath()),ja(t,e.options),t.stroke(a)}(t,e,i,s):function(t,e,i,s){const{segments:a,options:n}=e,o=Ya(e);for(const r of a)ja(t,n,r.style),t.beginPath(),o(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class qa extends qs{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&wi(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;ti(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,s=t.options.spanGaps,a=i.length;if(!a)return[];const n=!!t._loop,{start:o,end:r}=function(t,e,i,s){let a=0,n=e-1;if(i&&!s)for(;a<e&&!t[a].skip;)a++;for(;a<e&&t[a].skip;)a++;for(a%=e,i&&(n+=a);n>a&&t[n%e].skip;)n--;return n%=e,{start:a,end:n}}(i,a,n,s);return Ai(t,!0===s?[{start:o,end:r,loop:n}]:function(t,e,i,s){const a=t.length,n=[];let o,r=e,l=t[e];for(o=e+1;o<=i;++o){const i=t[o%a];i.skip||i.stop?l.skip||(s=!1,n.push({start:e%a,end:(o-1)%a,loop:s}),e=r=i.stop?o:null):(r=o,l.skip&&(e=o)),l=i}return null!==r&&n.push({start:e%a,end:r%a,loop:s}),n}(i,o,r<o?r+a:r,!!t._fullLoop&&0===o&&r===a-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],a=this.points,n=Ti(this,{property:e,start:s,end:s});if(!n.length)return;const o=[],r=function(t){return t.stepped?gi:t.tension||"monotone"===t.cubicInterpolationMode?fi:pi}(i);let l,h;for(l=0,h=n.length;l<h;++l){const{start:h,end:c}=n[l],d=a[h],u=a[c];if(d===u){o.push(d);continue}const p=r(d,u,Math.abs((s-d[e])/(u[e]-d[e])),i.stepped);p[e]=t[e],o.push(p)}return 1===o.length?o[0]:o}pathSegment(t,e,i){return Ya(this)(t,this,e,i)}path(t,e,i){const s=this.segments,a=Ya(this);let n=this._loop;e=e||0,i=i||this.points.length-e;for(const o of s)n&=a(t,this,o,{start:e,end:e+i-1});return!!n}draw(t,e,i,s){const a=this.options||{};(this.points||[]).length&&a.borderWidth&&(t.save(),Ja(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Ka(t,e,i,s){const a=t.options,{[i]:n}=t.getProps([i],s);return Math.abs(e-n)<a.radius+a.hitRadius}qa.id="line",qa.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},qa.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},qa.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class Za extends qs{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&wi(this,t)}inRange(t,e,i){const s=this.options,{x:a,y:n}=this.getProps(["x","y"],i);return Math.pow(t-a,2)+Math.pow(e-n,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return Ka(this,t,"x",e)}inYRange(t,e){return Ka(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!le(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,re(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Qa(t,e){const{x:i,y:s,base:a,width:n,height:o}=t.getProps(["x","y","base","width","height"],e);let r,l,h,c,d;return t.horizontal?(d=o/2,r=Math.min(i,a),l=Math.max(i,a),h=s-d,c=s+d):(d=n/2,r=i-d,l=i+d,h=Math.min(s,a),c=Math.max(s,a)),{left:r,top:h,right:l,bottom:c}}function tn(t,e,i,s){return t?0:dt(e,i,s)}function en(t){const e=Qa(t),i=e.right-e.left,s=e.bottom-e.top,a=function(t,e,i){const s=t.options.borderWidth,a=t.borderSkipped,n=ve(s);return{t:tn(a.top,n.top,0,i),r:tn(a.right,n.right,0,e),b:tn(a.bottom,n.bottom,0,i),l:tn(a.left,n.left,0,e)}}(t,i/2,s/2),n=function(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),a=t.options.borderRadius,n=Ce(a),o=Math.min(e,i),r=t.borderSkipped,l=s||C(a);return{topLeft:tn(!l||r.top||r.left,n.topLeft,0,o),topRight:tn(!l||r.top||r.right,n.topRight,0,o),bottomLeft:tn(!l||r.bottom||r.left,n.bottomLeft,0,o),bottomRight:tn(!l||r.bottom||r.right,n.bottomRight,0,o)}}(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:n},inner:{x:e.left+a.l,y:e.top+a.t,w:i-a.l-a.r,h:s-a.t-a.b,radius:{topLeft:Math.max(0,n.topLeft-Math.max(a.t,a.l)),topRight:Math.max(0,n.topRight-Math.max(a.t,a.r)),bottomLeft:Math.max(0,n.bottomLeft-Math.max(a.b,a.l)),bottomRight:Math.max(0,n.bottomRight-Math.max(a.b,a.r))}}}}function sn(t,e,i,s){const a=null===e,n=null===i,o=t&&!(a&&n)&&Qa(t,s);return o&&(a||ut(e,o.left,o.right))&&(n||ut(i,o.top,o.bottom))}function an(t,e){t.rect(e.x,e.y,e.w,e.h)}function nn(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=t.x!==i.x?-e:0,a=t.y!==i.y?-e:0,n=(t.x+t.w!==i.x+i.w?e:0)-s,o=(t.y+t.h!==i.y+i.h?e:0)-a;return{x:t.x+s,y:t.y+a,w:t.w+n,h:t.h+o,radius:t.radius}}Za.id="point",Za.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},Za.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class on extends qs{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&wi(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:a,outer:n}=en(this),o=(r=n.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?me:an;var r;t.save(),n.w===a.w&&n.h===a.h||(t.beginPath(),o(t,nn(n,e,a)),t.clip(),o(t,nn(a,-e,n)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),o(t,nn(a,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return sn(this,t,e,i)}inXRange(t,e){return sn(this,t,null,e)}inYRange(t,e){return sn(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:a}=this.getProps(["x","y","base","horizontal"],t);return{x:a?(e+s)/2:e,y:a?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}on.id="bar",on.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0},on.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var rn=Object.freeze({__proto__:null,ArcElement:za,LineElement:qa,PointElement:Za,BarElement:on});function ln(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{value:e})}}function hn(t){t.data.datasets.forEach((t=>{ln(t)}))}var cn={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void hn(t);const s=t.width;t.data.datasets.forEach(((e,a)=>{const{_data:n,indexAxis:o}=e,r=t.getDatasetMeta(a),l=n||e.data;if("y"===Ae([o,t.options.indexAxis]))return;if("line"!==r.type)return;const h=t.scales[r.xAxisID];if("linear"!==h.type&&"time"!==h.type)return;if(t.options.parsing)return;let{start:c,count:d}=function(t,e){const i=e.length;let s,a=0;const{iScale:n}=t,{min:o,max:r,minDefined:l,maxDefined:h}=n.getUserBounds();return l&&(a=dt(we(e,n.axis,o).lo,0,i-1)),s=h?dt(we(e,n.axis,r).hi+1,a,i)-a:i-a,{start:a,count:s}}(r,l);if(d<=(i.threshold||4*s))return void ln(e);let u;switch(y(n)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,s,a){const n=a.samples||s;if(n>=i)return t.slice(e,e+i);const o=[],r=(i-2)/(n-2);let l=0;const h=e+i-1;let c,d,u,p,g,f=e;for(o[l++]=t[f],c=0;c<n-2;c++){let s,a=0,n=0;const h=Math.floor((c+1)*r)+1+e,m=Math.min(Math.floor((c+2)*r)+1,i)+e,b=m-h;for(s=h;s<m;s++)a+=t[s].x,n+=t[s].y;a/=b,n/=b;const x=Math.floor(c*r)+1+e,_=Math.min(Math.floor((c+1)*r)+1,i)+e,{x:y,y:v}=t[f];for(u=p=-1,s=x;s<_;s++)p=.5*Math.abs((y-a)*(t[s].y-v)-(y-t[s].x)*(n-v)),p>u&&(u=p,d=t[s],g=s);o[l++]=d,f=g}return o[l++]=t[h],o}(l,c,d,s,i);break;case"min-max":u=function(t,e,i,s){let a,n,o,r,l,h,c,d,u,p,g=0,f=0;const m=[],b=e+i-1,x=t[e].x,_=t[b].x-x;for(a=e;a<e+i;++a){n=t[a],o=(n.x-x)/_*s,r=n.y;const e=0|o;if(e===l)r<u?(u=r,h=a):r>p&&(p=r,c=a),g=(f*g+n.x)/++f;else{const i=a-1;if(!y(h)&&!y(c)){const e=Math.min(h,c),s=Math.max(h,c);e!==d&&e!==i&&m.push({...t[e],x:g}),s!==d&&s!==i&&m.push({...t[s],x:g})}a>0&&i!==d&&m.push(t[i]),m.push(n),l=e,f=0,u=p=r,h=c=d=a}}return m}(l,c,d,s);break;default:throw new Error("Unsupported decimation algorithm '".concat(i.algorithm,"'"))}e._decimated=u}))},destroy(t){hn(t)}};function dn(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=A(i&&i.target,i);return void 0===s&&(s=!!e.backgroundColor),!1!==s&&null!==s&&(!0===s?"origin":s)}(t);if(C(s))return!isNaN(s.value)&&s;let a=parseFloat(s);return k(a)&&Math.floor(a)===a?("-"!==s[0]&&"+"!==s[0]||(a=e+a),!(a===e||a<0||a>=i)&&a):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}class un{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:a,radius:n}=this;return e=e||{start:0,end:W},t.arc(s,a,n,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,a=t.angle;return{x:e+Math.cos(a)*s,y:i+Math.sin(a)*s,angle:a}}}function pn(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:e,fill:i}=t,s=e.options,a=e.getLabels().length,n=[],o=s.reverse?e.max:e.min,r=s.reverse?e.min:e.max;let l,h,c;if(c="start"===i?o:"end"===i?r:C(i)?i.value:e.getBaseValue(),s.grid.circular)return h=e.getPointPositionForValue(0,o),new un({x:h.x,y:h.y,radius:e.getDistanceFromCenterForValue(c)});for(l=0;l<a;++l)n.push(e.getPointPositionForValue(l,c));return n}(t):function(t){const{scale:e={},fill:i}=t;let s,a=null;return"start"===i?a=e.bottom:"end"===i?a=e.top:C(i)?a=e.getPixelForValue(i.value):e.getBasePixel&&(a=e.getBasePixel()),k(a)?(s=e.isHorizontal(),{x:s?a:null,y:s?null:a}):null}(t)}function gn(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function fn(t,e,i){const s=[];for(let a=0;a<i.length;a++){const n=i[a],{first:o,last:r,point:l}=mn(n,e,"x");if(!(!l||o&&r))if(o)s.unshift(l);else if(t.push(l),!r)break}t.push(...s)}function mn(t,e,i){const s=t.interpolate(e,i);if(!s)return{};const a=s[i],n=t.segments,o=t.points;let r=!1,l=!1;for(let t=0;t<n.length;t++){const e=n[t],s=o[e.start][i],h=o[e.end][i];if(ut(a,s,h)){r=a===s,l=a===h;break}}return{first:r,last:l,point:s}}function bn(t){const{chart:e,fill:i,line:s}=t;if(k(i))return function(t,e){const i=t.getDatasetMeta(e);return i&&t.isDatasetVisible(e)?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:s}=t,a=[],n=s.segments,o=s.points,r=function(t,e){const i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t<s.length;t++){const a=s[t];if(a.index===e)break;a.hidden||i.unshift(a.dataset)}return i}(e,i);r.push(xn({x:null,y:e.bottom},s));for(let t=0;t<n.length;t++){const e=n[t];for(let t=e.start;t<=e.end;t++)fn(a,o[t],r)}return new qa({points:a,options:{}})}(t);if("shape"===i)return!0;const a=pn(t);return a instanceof un?a:xn(a,s)}function xn(t,e){let i=[],s=!1;return v(t)?(s=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},a=e.points,n=[];return e.segments.forEach((t=>{let{start:e,end:o}=t;o=gn(e,o,a);const r=a[e],l=a[o];null!==s?(n.push({x:r.x,y:s}),n.push({x:l.x,y:s})):null!==i&&(n.push({x:i,y:r.y}),n.push({x:i,y:l.y}))})),n}(t,e),i.length?new qa({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function _n(t,e,i){let s=t[e].fill;const a=[e];let n;if(!i)return s;for(;!1!==s&&-1===a.indexOf(s);){if(!k(s))return s;if(n=t[s],!n)return!1;if(n.visible)return s;a.push(s),s=n.fill}return!1}function yn(t,e,i){t.beginPath(),e.path(t),t.lineTo(e.last().x,i),t.lineTo(e.first().x,i),t.closePath(),t.clip()}function vn(t,e,i,s){if(s)return;let a=e[t],n=i[t];return"angle"===t&&(a=ht(a),n=ht(n)),{property:t,start:a,end:n}}function Cn(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function kn(t,e,i){const{top:s,bottom:a}=e.chart.chartArea,{property:n,start:o,end:r}=i||{};"x"===n&&(t.beginPath(),t.rect(o,s,r-o,a-s),t.clip())}function Tn(t,e,i,s){const a=e.interpolate(i,s);a&&t.lineTo(a.x,a.y)}function An(t,e){const{line:i,target:s,property:a,color:n,scale:o}=e,r=function(t,e,i){const s=t.segments,a=t.points,n=e.points,o=[];for(const t of s){let{start:s,end:r}=t;r=gn(s,r,a);const l=vn(i,a[s],a[r],t.loop);if(!e.segments){o.push({source:t,target:l,start:a[s],end:a[r]});continue}const h=Ti(e,l);for(const e of h){const s=vn(i,n[e.start],n[e.end],e.loop),r=ki(t,a,s);for(const t of r)o.push({source:t,target:e,start:{[i]:Cn(l,s,"start",Math.max)},end:{[i]:Cn(l,s,"end",Math.min)}})}}return o}(i,s,a);for(const{source:e,target:l,start:h,end:c}of r){const{style:{backgroundColor:r=n}={}}=e,d=!0!==s;t.save(),t.fillStyle=r,kn(t,o,d&&vn(a,h,c)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(d){u?t.closePath():Tn(t,s,c,a);const e=!!s.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||Tn(t,s,h,a)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function Mn(t,e,i){const s=bn(e),{line:a,scale:n,axis:o}=e,r=a.options,l=r.fill,h=r.backgroundColor,{above:c=h,below:d=h}=l||{};s&&a.points.length&&(he(t,i),function(t,e){const{line:i,target:s,above:a,below:n,area:o,scale:r}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&n!==a&&(yn(t,s,o.top),An(t,{line:i,target:s,color:a,scale:r,property:l}),t.restore(),t.save(),yn(t,s,o.bottom)),An(t,{line:i,target:s,color:n,scale:r,property:l}),t.restore()}(t,{line:a,target:s,above:c,below:d,area:i,scale:n,axis:o}),ce(t))}var Sn={id:"filler",afterDatasetsUpdate(t,e,i){const s=(t.data.datasets||[]).length,a=[];let n,o,r,l;for(o=0;o<s;++o)n=t.getDatasetMeta(o),r=n.dataset,l=null,r&&r.options&&r instanceof qa&&(l={visible:t.isDatasetVisible(o),index:o,fill:dn(r,o,s),chart:t,axis:n.controller.options.indexAxis,scale:n.vScale,line:r}),n.$filler=l,a.push(l);for(o=0;o<s;++o)l=a[o],l&&!1!==l.fill&&(l.fill=_n(a,o,i.propagate))},beforeDraw(t,e,i){const s="beforeDraw"===i.drawTime,a=t.getSortedVisibleDatasetMetas(),n=t.chartArea;for(let e=a.length-1;e>=0;--e){const i=a[e].$filler;i&&(i.line.updateControlPoints(n,i.axis),s&&Mn(t.ctx,i,n))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;i&&Mn(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;s&&!1!==s.fill&&"beforeDatasetDraw"===i.drawTime&&Mn(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const wn=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class Rn extends qs{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=S(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=Te(i.font),a=s.size,n=this._computeTitleHeight(),{boxWidth:o,itemHeight:r}=wn(i,a);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(n,a,o,r)+10):(h=this.maxHeight,l=this._fitCols(n,a,o,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:a,maxWidth:n,options:{labels:{padding:o}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+o;let c=t;a.textAlign="left",a.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach(((t,p)=>{const g=i+e/2+a.measureText(t.text).width;(0===p||l[l.length-1]+g+2*o>n)&&(c+=h,l[l.length-(p>0?0:1)]=0,u+=h,d++),r[p]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+o})),c}_fitCols(t,e,i,s){const{ctx:a,maxHeight:n,options:{labels:{padding:o}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=n-t;let c=o,d=0,u=0,p=0,g=0;return this.legendItems.forEach(((t,n)=>{const f=i+e/2+a.measureText(t.text).width;n>0&&u+s+2*o>h&&(c+=d+o,l.push({width:d,height:u}),p+=d+o,g++,d=u=0),r[n]={left:p,top:u,col:g,width:f,height:s},d=Math.max(d,f),u+=s+o})),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:a}}=this,n=xi(a,this.left,this.width);if(this.isHorizontal()){let a=0,o=b(i,this.left+s,this.right-this.lineWidths[a]);for(const r of e)a!==r.row&&(a=r.row,o=b(i,this.left+s,this.right-this.lineWidths[a])),r.top+=this.top+t+s,r.left=n.leftForLtr(n.x(o),r.width),o+=r.width+s}else{let a=0,o=b(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const r of e)r.col!==a&&(a=r.col,o=b(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),r.top=o,r.left+=this.left+s,r.left=n.leftForLtr(n.x(r.left),r.width),o+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;he(t,this),this._draw(),ce(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:a,labels:n}=t,o=ie.color,r=xi(t.rtl,this.left,this.width),l=Te(n.font),{color:h,padding:c}=n,d=l.size,u=d/2;let p;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:g,boxHeight:f,itemHeight:m}=wn(n,d),x=this.isHorizontal(),_=this._computeTitleHeight();p=x?{x:b(a,this.left+c,this.right-i[0]),y:this.top+c+_,line:0}:{x:this.left+c,y:b(a,this.top+_+c,this.bottom-e[0].height),line:0},_i(this.ctx,t.textDirection);const y=m+c;this.legendItems.forEach(((v,C)=>{s.strokeStyle=v.fontColor||h,s.fillStyle=v.fontColor||h;const k=s.measureText(v.text).width,T=r.textAlign(v.textAlign||(v.textAlign=n.textAlign)),M=g+u+k;let S=p.x,w=p.y;r.setWidth(this.width),x?C>0&&S+M+c>this.right&&(w=p.y+=y,p.line++,S=p.x=b(a,this.left+c,this.right-i[p.line])):C>0&&w+y>this.bottom&&(S=p.x=S+e[p.line].width+c,p.line++,w=p.y=b(a,this.top+_+c,this.bottom-e[p.line].height));!function(t,e,i){if(isNaN(g)||g<=0||isNaN(f)||f<0)return;s.save();const a=A(i.lineWidth,1);if(s.fillStyle=A(i.fillStyle,o),s.lineCap=A(i.lineCap,"butt"),s.lineDashOffset=A(i.lineDashOffset,0),s.lineJoin=A(i.lineJoin,"miter"),s.lineWidth=a,s.strokeStyle=A(i.strokeStyle,o),s.setLineDash(A(i.lineDash,[])),n.usePointStyle){const n={radius:g*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:a},o=r.xPlus(t,g/2);re(s,n,o,e+u)}else{const n=e+Math.max((d-f)/2,0),o=r.leftForLtr(t,g),l=Ce(i.borderRadius);s.beginPath(),Object.values(l).some((t=>0!==t))?me(s,{x:o,y:n,w:g,h:f,radius:l}):s.rect(o,n,g,f),s.fill(),0!==a&&s.stroke()}s.restore()}(r.x(S),w,v),S=((t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e)(T,S+g+u,x?S+M:this.right,t.rtl),function(t,e,i){pe(s,i.text,t,e+m/2,l,{strikethrough:i.hidden,textAlign:r.textAlign(i.textAlign)})}(r.x(S),w,v),x?p.x+=M+c:p.y+=y})),yi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Te(e.font),s=ke(e.padding);if(!e.display)return;const a=xi(t.rtl,this.left,this.width),n=this.ctx,o=e.position,r=i.size/2,l=s.top+r;let h,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,c=b(t.align,c,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);h=l+b(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=b(o,c,c+d);n.textAlign=a.textAlign(m(o)),n.textBaseline="middle",n.strokeStyle=e.color,n.fillStyle=e.color,n.font=i.string,pe(n,e.text,u,h,i)}_computeTitleHeight(){const t=this.options.title,e=Te(t.font),i=ke(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,a;if(ut(t,this.left,this.right)&&ut(e,this.top,this.bottom))for(a=this.legendHitBoxes,i=0;i<a.length;++i)if(s=a[i],ut(t,s.left,s.left+s.width)&&ut(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if("mousemove"===t&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type){const n=this._hoveredItem,o=(a=i,null!==(s=n)&&null!==a&&s.datasetIndex===a.datasetIndex&&s.index===a.index);n&&!o&&S(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&S(e.onHover,[t,i,this],this)}else i&&S(e.onClick,[t,i,this],this);var s,a}}var Ln={id:"legend",_element:Rn,start(t,e,i){const s=t.legend=new Rn({ctx:t.ctx,options:i,chart:t});Ps.configure(t,s,i),Ps.addBox(t,s)},stop(t){Ps.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;Ps.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,a=i.chart;a.isDatasetVisible(s)?(a.hide(s),e.hidden=!0):(a.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:a,color:n}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const o=t.controller.getStyle(i?0:void 0),r=ke(o.borderWidth);return{text:e[t.index].label,fillStyle:o.backgroundColor,fontColor:n,hidden:!t.visible,lineCap:o.borderCapStyle,lineDash:o.borderDash,lineDashOffset:o.borderDashOffset,lineJoin:o.borderJoinStyle,lineWidth:(r.width+r.height)/4,strokeStyle:o.borderColor,pointStyle:s||o.pointStyle,rotation:o.rotation,textAlign:a||o.textAlign,borderRadius:0,datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class On extends qs{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const s=v(i.text)?i.text.length:1;this._padding=ke(i.padding);const a=s*Te(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=a:this.width=a}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:a,options:n}=this,o=n.align;let r,l,h,c=0;return this.isHorizontal()?(l=b(o,i,a),h=e+t,r=a-i):("left"===n.position?(l=i+t,h=b(o,s,e),c=-.5*j):(l=a-t,h=b(o,e,s),c=.5*j),r=s-e),{titleX:l,titleY:h,maxWidth:r,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Te(e.font),s=i.lineHeight/2+this._padding.top,{titleX:a,titleY:n,maxWidth:o,rotation:r}=this._drawArgs(s);pe(t,e.text,0,0,i,{color:e.color,maxWidth:o,rotation:r,textAlign:m(e.align),textBaseline:"middle",translation:[a,n]})}}var Dn={id:"title",_element:On,start(t,e,i){!function(t,e){const i=new On({ctx:t.ctx,options:e,chart:t});Ps.configure(t,i,e),Ps.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Ps.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;Ps.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Pn=new WeakMap;var Bn={id:"subtitle",start(t,e,i){const s=new On({ctx:t.ctx,options:i,chart:t});Ps.configure(t,s,i),Ps.addBox(t,s),Pn.set(t,s)},stop(t){Ps.removeBox(t,Pn.get(t)),Pn.delete(t)},beforeUpdate(t,e,i){const s=Pn.get(t);Ps.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const En={average(t){if(!t.length)return!1;let e,i,s=0,a=0,n=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s+=t.x,a+=t.y,++n}}return{x:s/n,y:a/n}},nearest(t,e){if(!t.length)return!1;let i,s,a,n=e.x,o=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=rt(e,s.getCenterPoint());t<r&&(r=t,a=s)}}if(a){const t=a.tooltipPosition();n=t.x,o=t.y}return{x:n,y:o}}};function In(t,e){return e&&(v(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Vn(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Fn(t,e){const{element:i,datasetIndex:s,index:a}=e,n=t.getDatasetMeta(s).controller,{label:o,value:r}=n.getLabelAndValue(a);return{chart:t,label:o,parsed:n.getParsed(a),raw:t.data.datasets[s].data[a],formattedValue:r,dataset:n.getDataset(),dataIndex:a,datasetIndex:s,element:i}}function Nn(t,e){const i=t.chart.ctx,{body:s,footer:a,title:n}=t,{boxWidth:o,boxHeight:r}=e,l=Te(e.bodyFont),h=Te(e.titleFont),c=Te(e.footerFont),d=n.length,u=a.length,p=s.length,g=ke(e.padding);let f=g.height,m=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(b+=t.beforeBody.length+t.afterBody.length,d&&(f+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b){f+=p*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-p)*l.lineHeight+(b-1)*e.bodySpacing}u&&(f+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let x=0;const _=function(t){m=Math.max(m,i.measureText(t).width+x)};return i.save(),i.font=h.string,w(t.title,_),i.font=l.string,w(t.beforeBody.concat(t.afterBody),_),x=e.displayColors?o+2+e.boxPadding:0,w(s,(t=>{w(t.before,_),w(t.lines,_),w(t.after,_)})),x=0,i.font=c.string,w(t.footer,_),i.restore(),m+=g.width,{width:m,height:f}}function Hn(t,e,i,s){const{x:a,width:n}=i,{width:o,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=a<=(r+l)/2?"left":"right":a<=n/2?h="left":a>=o-n/2&&(h="right"),function(t,e,i,s){const{x:a,width:n}=s,o=i.caretSize+i.caretPadding;return"left"===t&&a+n+o>e.width||"right"===t&&a-n-o<0||void 0}(h,t,e,i)&&(h="center"),h}function zn(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||Hn(t,e,i,s),yAlign:s}}function jn(t,e,i,s){const{caretSize:a,caretPadding:n,cornerRadius:o}=t,{xAlign:r,yAlign:l}=i,h=a+n,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:p}=Ce(o);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const f=function(t,e,i){let{y:s,height:a}=t;return"top"===e?s+=i:s-="bottom"===e?a+i:a/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+a:"right"===r&&(g+=Math.max(d,p)+a),{x:dt(g,0,s.width-e.width),y:dt(f,0,s.height-e.height)}}function Wn(t,e,i){const s=ke(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function Gn(t){return In([],Vn(t))}function Un(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class $n extends qs{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,a=new Bi(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,Me(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),a=i.title.apply(this,[t]),n=i.afterTitle.apply(this,[t]);let o=[];return o=In(o,Vn(s)),o=In(o,Vn(a)),o=In(o,Vn(n)),o}getBeforeBody(t,e){return Gn(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return w(t,(t=>{const e={before:[],lines:[],after:[]},a=Un(i,t);In(e.before,Vn(a.beforeLabel.call(this,t))),In(e.lines,a.label.call(this,t)),In(e.after,Vn(a.afterLabel.call(this,t))),s.push(e)})),s}getAfterBody(t,e){return Gn(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),a=i.footer.apply(this,[t]),n=i.afterFooter.apply(this,[t]);let o=[];return o=In(o,Vn(s)),o=In(o,Vn(a)),o=In(o,Vn(n)),o}_createItems(t){const e=this._active,i=this.chart.data,s=[],a=[],n=[];let o,r,l=[];for(o=0,r=e.length;o<r;++o)l.push(Fn(this.chart,e[o]));return t.filter&&(l=l.filter(((e,s,a)=>t.filter(e,s,a,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),w(l,(e=>{const i=Un(t.callbacks,e);s.push(i.labelColor.call(this,e)),a.push(i.labelPointStyle.call(this,e)),n.push(i.labelTextColor.call(this,e))})),this.labelColors=s,this.labelPointStyles=a,this.labelTextColors=n,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let a,n=[];if(s.length){const t=En[i.position].call(this,s,this._eventPosition);n=this._createItems(i),this.title=this.getTitle(n,i),this.beforeBody=this.getBeforeBody(n,i),this.body=this.getBody(n,i),this.afterBody=this.getAfterBody(n,i),this.footer=this.getFooter(n,i);const e=this._size=Nn(this,i),o=wi({},t,e),r=zn(this.chart,i,o),l=jn(i,o,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,a={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(a={opacity:0});this._tooltipItems=n,this.$context=void 0,a&&this._resolveAnimations().update(this,a),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const a=this.getCaretPosition(t,i,s);e.lineTo(a.x1,a.y1),e.lineTo(a.x2,a.y2),e.lineTo(a.x3,a.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:a}=this,{caretSize:n,cornerRadius:o}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=Ce(o),{x:d,y:u}=t,{width:p,height:g}=e;let f,m,b,x,_,y;return"center"===a?(_=u+g/2,"left"===s?(f=d,m=f-n,x=_+n,y=_-n):(f=d+p,m=f+n,x=_-n,y=_+n),b=f):(m="left"===s?d+Math.max(r,h)+n:"right"===s?d+p-Math.max(l,c)-n:this.caretX,"top"===a?(x=u,_=x-n,f=m-n,b=m+n):(x=u+g,_=x+n,f=m+n,b=m-n),y=x),{x1:f,x2:m,x3:b,y1:x,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,a=s.length;let n,o,r;if(a){const l=xi(i.rtl,this.x,this.width);for(t.x=Wn(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",n=Te(i.titleFont),o=i.titleSpacing,e.fillStyle=i.titleColor,e.font=n.string,r=0;r<a;++r)e.fillText(s[r],l.x(t.x),t.y+n.lineHeight/2),t.y+=n.lineHeight+o,r+1===a&&(t.y+=i.titleMarginBottom-o)}}_drawColorBox(t,e,i,s,a){const n=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:r,boxWidth:l,boxPadding:h}=a,c=Te(a.bodyFont),d=Wn(this,"left",a),u=s.x(d),p=r<c.lineHeight?(c.lineHeight-r)/2:0,g=e.y+p;if(a.usePointStyle){const e={radius:Math.min(l,r)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},i=s.leftForLtr(u,l)+l/2,h=g+r/2;t.strokeStyle=a.multiKeyBackground,t.fillStyle=a.multiKeyBackground,re(t,e,i,h),t.strokeStyle=n.borderColor,t.fillStyle=n.backgroundColor,re(t,e,i,h)}else{t.lineWidth=n.borderWidth||1,t.strokeStyle=n.borderColor,t.setLineDash(n.borderDash||[]),t.lineDashOffset=n.borderDashOffset||0;const e=s.leftForLtr(u,l-h),i=s.leftForLtr(s.xPlus(u,1),l-h-2),o=Ce(n.borderRadius);Object.values(o).some((t=>0!==t))?(t.beginPath(),t.fillStyle=a.multiKeyBackground,me(t,{x:e,y:g,w:l,h:r,radius:o}),t.fill(),t.stroke(),t.fillStyle=n.backgroundColor,t.beginPath(),me(t,{x:i,y:g+1,w:l-2,h:r-2,radius:o}),t.fill()):(t.fillStyle=a.multiKeyBackground,t.fillRect(e,g,l,r),t.strokeRect(e,g,l,r),t.fillStyle=n.backgroundColor,t.fillRect(i,g+1,l-2,r-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:a,bodyAlign:n,displayColors:o,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=Te(i.bodyFont);let d=c.lineHeight,u=0;const p=xi(i.rtl,this.x,this.width),g=function(i){e.fillText(i,p.x(t.x+u),t.y+d/2),t.y+=d+a},f=p.textAlign(n);let m,b,x,_,y,v,C;for(e.textAlign=n,e.textBaseline="middle",e.font=c.string,t.x=Wn(this,f,i),e.fillStyle=i.bodyColor,w(this.beforeBody,g),u=o&&"right"!==f?"center"===n?l/2+h:l+2+h:0,_=0,v=s.length;_<v;++_){for(m=s[_],b=this.labelTextColors[_],e.fillStyle=b,w(m.before,g),x=m.lines,o&&x.length&&(this._drawColorBox(e,t,_,p,i),d=Math.max(c.lineHeight,r)),y=0,C=x.length;y<C;++y)g(x[y]),d=c.lineHeight;w(m.after,g)}u=0,d=c.lineHeight,w(this.afterBody,g),t.y-=a}drawFooter(t,e,i){const s=this.footer,a=s.length;let n,o;if(a){const r=xi(i.rtl,this.x,this.width);for(t.x=Wn(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",n=Te(i.footerFont),e.fillStyle=i.footerColor,e.font=n.string,o=0;o<a;++o)e.fillText(s[o],r.x(t.x),t.y+n.lineHeight/2),t.y+=n.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:a,yAlign:n}=this,{x:o,y:r}=t,{width:l,height:h}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:p}=Ce(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(o+c,r),"top"===n&&this.drawCaret(t,e,i,s),e.lineTo(o+l-d,r),e.quadraticCurveTo(o+l,r,o+l,r+d),"center"===n&&"right"===a&&this.drawCaret(t,e,i,s),e.lineTo(o+l,r+h-p),e.quadraticCurveTo(o+l,r+h,o+l-p,r+h),"bottom"===n&&this.drawCaret(t,e,i,s),e.lineTo(o+u,r+h),e.quadraticCurveTo(o,r+h,o,r+h-u),"center"===n&&"left"===a&&this.drawCaret(t,e,i,s),e.lineTo(o,r+c),e.quadraticCurveTo(o,r,o+c,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,a=i&&i.y;if(s||a){const i=En[t.position].call(this,this._active,this._eventPosition);if(!i)return;const n=this._size=Nn(this,t),o=wi({},i,this._size),r=zn(e,t,o),l=jn(t,o,r,e);s._to===l.x&&a._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=n.width,this.height=n.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},a={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const n=ke(e.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&o&&(t.save(),t.globalAlpha=i,this.drawBackground(a,t,s,e),_i(t,e.textDirection),a.y+=n.top,this.drawTitle(a,t,e),this.drawBody(a,t,e),this.drawFooter(a,t,e),yi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((t=>{let{datasetIndex:e,index:i}=t;const s=this.chart.getDatasetMeta(e);if(!s)throw new Error("Cannot find a dataset at index "+e);return{datasetIndex:e,element:s.data[i],index:i}})),a=!R(i,s),n=this._positionChanged(s,e);(a||n)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,a=this._active||[],n=this._getActiveElements(t,a,e,i),o=this._positionChanged(n,t),r=e||!R(n,a)||o;return r&&(this._active=n,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const a=this.options;if("mouseout"===t.type)return[];if(!s)return e;const n=this.chart.getElementsAtEventForMode(t,a.mode,a,i);return a.reverse&&n.reverse(),n}_positionChanged(t,e){const{caretX:i,caretY:s,options:a}=this,n=En[a.position].call(this,t,e);return!1!==n&&(i!==n.x||s!==n.y)}}$n.positioners=En;var Yn={id:"tooltip",_element:$n,positioners:En,afterInit(t,e,i){i&&(t.tooltip=new $n({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip,i={tooltip:e};!1!==t.notifyPlugins("beforeTooltipDraw",i)&&(e&&e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i))},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:x,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:x,beforeBody:x,beforeLabel:x,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return y(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:x,afterBody:x,beforeFooter:x,footer:x,afterFooter:x}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Xn=Object.freeze({__proto__:null,Decimation:cn,Filler:Sn,Legend:Ln,SubTitle:Bn,Title:Dn,Tooltip:Yn});function Jn(t,e,i,s){const a=t.indexOf(e);if(-1===a)return((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s);return a!==t.lastIndexOf(e)?i:a}class qn extends ra{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(y(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:dt(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:Jn(i,t,A(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let a=this.getLabels();a=0===t&&e===a.length-1?a:a.slice(t,e+1),this._valueRange=Math.max(a.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Kn(t,e){const i=[],{bounds:s,step:a,min:n,max:o,precision:r,count:l,maxTicks:h,maxDigits:c,includeBounds:d}=t,u=a||1,p=h-1,{min:g,max:f}=e,m=!y(n),b=!y(o),x=!y(l),_=(f-g)/(c+1);let v,C,k,T,A=Q((f-g)/p/u)*u;if(A<1e-14&&!m&&!b)return[{value:g},{value:f}];T=Math.ceil(f/A)-Math.floor(g/A),T>p&&(A=Q(T*A/p/u)*u),y(r)||(v=Math.pow(10,r),A=Math.ceil(A*v)/v),"ticks"===s?(C=Math.floor(g/A)*A,k=Math.ceil(f/A)*A):(C=g,k=f),m&&b&&a&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((o-n)/a,A/1e3)?(T=Math.round(Math.min((o-n)/A,h)),A=(o-n)/T,C=n,k=o):x?(C=m?n:C,k=b?o:k,T=l-1,A=(k-C)/T):(T=(k-C)/A,T=et(T,Math.round(T),A/1e3)?Math.round(T):Math.ceil(T));const M=Math.max(nt(A),nt(C));v=Math.pow(10,y(r)?M:r),C=Math.round(C*v)/v,k=Math.round(k*v)/v;let S=0;for(m&&(d&&C!==n?(i.push({value:n}),C<n&&S++,et(Math.round((C+S*A)*v)/v,n,Zn(n,_,t))&&S++):C<n&&S++);S<T;++S)i.push({value:Math.round((C+S*A)*v)/v});return b&&d&&k!==o?i.length&&et(i[i.length-1].value,o,Zn(o,_,t))?i[i.length-1].value=o:i.push({value:o}):b&&k!==o||i.push({value:k}),i}function Zn(t,e,i){let{horizontal:s,minRotation:a}=i;const n=st(a),o=(s?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+t).length;return Math.min(e/o,r)}qn.id="category",qn.defaults={ticks:{callback:qn.prototype.getLabelForValue}};class Qn extends ra{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return y(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:a}=this;const n=t=>s=e?s:t,o=t=>a=i?a:t;if(t){const t=Z(s),e=Z(a);t<0&&e<0?o(0):t>0&&e>0&&n(0)}if(s===a){let e=1;(a>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*a)),o(a+e),t||n(s-e)}this.min=s,this.max=a}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn("scales.".concat(this.id,".ticks.stepSize: ").concat(s," would result generating up to ").concat(e," ticks. Limiting to 1000.")),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s=Kn({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&it(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return bi(t,this.chart.options.locale,this.options.ticks.format)}}class to extends Qn{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=k(t)?t:0,this.max=k(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=st(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,a=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,a.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}function eo(t){return 1===t/Math.pow(10,Math.floor(K(t)))}to.id="linear",to.defaults={ticks:{callback:Zs.formatters.numeric}};class io extends ra{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Qn.prototype.parse.apply(this,[t,e]);if(0!==i)return k(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=k(t)?Math.max(0,t):null,this.max=k(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const a=e=>i=t?i:e,n=t=>s=e?s:t,o=(t,e)=>Math.pow(10,Math.floor(K(t))+e);i===s&&(i<=0?(a(1),n(10)):(a(o(i,-1)),n(o(s,1)))),i<=0&&a(o(s,-1)),s<=0&&n(o(i,1)),this._zero&&this.min!==this._suggestedMin&&i===o(this.min,0)&&a(o(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor(K(e.max)),s=Math.ceil(e.max/Math.pow(10,i)),a=[];let n=T(t.min,Math.pow(10,Math.floor(K(e.min)))),o=Math.floor(K(n)),r=Math.floor(n/Math.pow(10,o)),l=o<0?Math.pow(10,Math.abs(o)):1;do{a.push({value:n,major:eo(n)}),++r,10===r&&(r=1,++o,l=o>=0?1:l),n=Math.round(r*Math.pow(10,o)*l)/l}while(o<i||o===i&&r<s);const h=T(t.max,n);return a.push({value:h,major:eo(n)}),a}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&it(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":bi(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=K(t),this._valueRange=K(this.max)-K(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(K(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function so(t){const e=t.ticks;if(e.display&&t.display){const t=ke(e.backdropPadding);return A(e.font&&e.font.size,ie.font.size)+t.height}return 0}function ao(t,e,i,s,a){return t===s||t===a?{start:e-i/2,end:e+i/2}:t<s||t>a?{start:e-i,end:e}:{start:e,end:e+i}}function no(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=wi({},e),s=[],a=[],n=t._pointLabels.length,o=t.options.pointLabels,r=o.centerPointLabels?j/n:0;for(let d=0;d<n;d++){const n=o.setContext(t.getPointLabelContext(d));a[d]=n.padding;const u=t.getPointPosition(d,t.drawingArea+a[d],r),p=Te(n.font),g=(l=t.ctx,h=p,c=v(c=t._pointLabels[d])?c:[c],{w:ae(l,h.string,c),h:c.length*h.lineHeight});s[d]=g;const f=ht(t.getIndexAngle(d)+r),m=Math.round(at(f));oo(i,e,f,ao(m,u.x,g.w,0,180),ao(m,u.y,g.h,90,270))}var l,h,c;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const s=[],a=t._pointLabels.length,n=t.options,o=so(n)/2,r=t.drawingArea,l=n.pointLabels.centerPointLabels?j/a:0;for(let n=0;n<a;n++){const a=t.getPointPosition(n,r+o+i[n],l),h=Math.round(at(ht(a.angle+X))),c=e[n],d=ho(a.y,c.h,h),u=ro(h),p=lo(a.x,c.w,u);s.push({x:a.x,y:d,textAlign:u,left:p,top:d,right:p+c.w,bottom:d+c.h})}return s}(t,s,a)}function oo(t,e,i,s,a){const n=Math.abs(Math.sin(i)),o=Math.abs(Math.cos(i));let r=0,l=0;s.start<e.l?(r=(e.l-s.start)/n,t.l=Math.min(t.l,e.l-r)):s.end>e.r&&(r=(s.end-e.r)/n,t.r=Math.max(t.r,e.r+r)),a.start<e.t?(l=(e.t-a.start)/o,t.t=Math.min(t.t,e.t-l)):a.end>e.b&&(l=(a.end-e.b)/o,t.b=Math.max(t.b,e.b+l))}function ro(t){return 0===t||180===t?"center":t<180?"left":"right"}function lo(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function ho(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function co(t,e,i,s){const{ctx:a}=t;if(i)a.arc(t.xCenter,t.yCenter,e,0,W);else{let i=t.getPointPosition(0,e);a.moveTo(i.x,i.y);for(let n=1;n<s;n++)i=t.getPointPosition(n,e),a.lineTo(i.x,i.y)}}io.id="logarithmic",io.defaults={ticks:{callback:Zs.formatters.logarithmic,major:{enabled:!0}}};class uo extends Qn{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=ke(so(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=k(t)&&!isNaN(t)?t:0,this.max=k(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/so(this.options))}generateTickLabels(t){Qn.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=S(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?no(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return ht(t*(W/(this._pointLabels.length||1))+st(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(y(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(y(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return Me(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.getIndexAngle(t)-X+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:a}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:a}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),co(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s}=e,a=this._pointLabels.length;let n,o,r;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let a=e-1;a>=0;a--){const e=s.setContext(t.getPointLabelContext(a)),n=Te(e.font),{x:o,y:r,textAlign:l,left:h,top:c,right:d,bottom:u}=t._pointLabelItems[a],{backdropColor:p}=e;if(!y(p)){const t=ke(e.backdropPadding);i.fillStyle=p,i.fillRect(h-t.left,c-t.top,d-h+t.width,u-c+t.height)}pe(i,t._pointLabels[a],o,r+n.lineHeight/2,n,{color:e.color,textAlign:l,textBaseline:"middle"})}}(this,a),s.display&&this.ticks.forEach(((t,e)=>{if(0!==e){o=this.getDistanceFromCenterForValue(t.value);!function(t,e,i,s){const a=t.ctx,n=e.circular,{color:o,lineWidth:r}=e;!n&&!s||!o||!r||i<0||(a.save(),a.strokeStyle=o,a.lineWidth=r,a.setLineDash(e.borderDash),a.lineDashOffset=e.borderDashOffset,a.beginPath(),co(t,i,n,s),a.closePath(),a.stroke(),a.restore())}(this,s.setContext(this.getContext(e-1)),o,a)}})),i.display){for(t.save(),n=a-1;n>=0;n--){const s=i.setContext(this.getPointLabelContext(n)),{color:a,lineWidth:l}=s;l&&a&&(t.lineWidth=l,t.strokeStyle=a,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,o=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),r=this.getPointPosition(n,o),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(r.x,r.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let a,n;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,o)=>{if(0===o&&!e.reverse)return;const r=i.setContext(this.getContext(o)),l=Te(r.font);if(a=this.getDistanceFromCenterForValue(this.ticks[o].value),r.showLabelBackdrop){t.font=l.string,n=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=ke(r.backdropPadding);t.fillRect(-n/2-e.left,-a-l.size/2-e.top,n+e.width,l.size+e.height)}pe(t,s.label,0,-a,l,{color:r.color})})),t.restore()}drawTitle(){}}uo.id="radialLinear",uo.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Zs.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}},uo.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},uo.descriptors={angleLines:{_fallback:"grid"}};const po={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},go=Object.keys(po);function fo(t,e){return t-e}function mo(t,e){if(y(e))return null;const i=t._adapter,{parser:s,round:a,isoWeekday:n}=t._parseOpts;let o=e;return"function"==typeof s&&(o=s(o)),k(o)||(o="string"==typeof s?i.parse(o,s):i.parse(o)),null===o?null:(a&&(o="week"!==a||!tt(n)&&!0!==n?i.startOf(o,a):i.startOf(o,"isoWeek",n)),+o)}function bo(t,e,i,s){const a=go.length;for(let n=go.indexOf(t);n<a-1;++n){const t=po[go[n]],a=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(a*t.size))<=s)return go[n]}return go[a-1]}function xo(t,e,i){if(i){if(i.length){const{lo:s,hi:a}=Se(i,e);t[i[s]>=e?i[s]:i[a]]=!0}}else t[e]=!0}function _o(t,e,i){const s=[],a={},n=e.length;let o,r;for(o=0;o<n;++o)r=e[o],a[r]=o,s.push({value:r,major:!1});return 0!==n&&i?function(t,e,i,s){const a=t._adapter,n=+a.startOf(e[0].value,s),o=e[e.length-1].value;let r,l;for(r=n;r<=o;r=+a.add(r,1,s))l=i[r],l>=0&&(e[l].major=!0);return e}(t,s,a,i):s}class yo extends ra{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){const i=t.time||(t.time={}),s=this._adapter=new us._date(t.adapters.date);B(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:mo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:a,minDefined:n,maxDefined:o}=this.getUserBounds();function r(t){n||isNaN(t.min)||(s=Math.min(s,t.min)),o||isNaN(t.max)||(a=Math.max(a,t.max))}n&&o||(r(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||r(this.getMinMax(!1))),s=k(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),a=k(a)&&!isNaN(a)?a:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,a-1),this.max=Math.max(s+1,a)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const a=this.min,n=function(t,e,i){let s=0,a=t.length;for(;s<a&&t[s]<e;)s++;for(;a>s&&t[a-1]>i;)a--;return s>0||a<t.length?t.slice(s,a):t}(s,a,this.max);return this._unit=e.unit||(i.autoSkip?bo(e.minUnit,this.min,this.max,this._getLabelCapacity(a)):function(t,e,i,s,a){for(let n=go.length-1;n>=go.indexOf(i);n--){const i=go[n];if(po[i].common&&t._adapter.diff(a,s,i)>=e-1)return i}return go[i?go.indexOf(i):0]}(this,n.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=go.indexOf(t)+1,i=go.length;e<i;++e)if(po[go[e]].common)return go[e]}(this._unit):void 0,this.initOffsets(s),t.reverse&&n.reverse(),_o(this,n,this._majorUnit)}initOffsets(t){let e,i,s=0,a=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),a=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const n=t.length<3?.5:.25;s=dt(s,0,n),a=dt(a,0,n),this._offsets={start:s,end:a,factor:1/(s+1+a)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,a=s.time,n=a.unit||bo(a.minUnit,e,i,this._getLabelCapacity(e)),o=A(a.stepSize,1),r="week"===n&&a.isoWeekday,l=tt(r)||!0===r,h={};let c,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",r)),u=+t.startOf(u,l?"day":n),t.diff(i,e,n)>1e5*o)throw new Error(e+" and "+i+" are too far apart with stepSize of "+o+" "+n);const p="data"===s.ticks.source&&this.getDataTimestamps();for(c=u,d=0;c<i;c=+t.add(c,o,n),d++)xo(h,c,p);return c!==i&&"ticks"!==s.bounds&&1!==d||xo(h,c,p),Object.keys(h).sort(((t,e)=>t-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const a=this.options,n=a.time.displayFormats,o=this._unit,r=this._majorUnit,l=o&&n[o],h=r&&n[r],c=i[e],d=r&&h&&c&&c.major,u=this._adapter.format(t,s||(d?h:l)),p=a.ticks.callback;return p?S(p,[u,e,i],this):u}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=st(this.isHorizontal()?e.maxRotation:e.minRotation),a=Math.cos(s),n=Math.sin(s),o=this._resolveTickFontOptions(0).size;return{w:i*a+o*n,h:i*n+o*a}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,a=this._tickFormatFunction(t,0,_o(this,[t],this._majorUnit),s),n=this._getLabelSize(a),o=Math.floor(this.isHorizontal()?this.width/n.w:this.height/n.h)-1;return o>0?o:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(mo(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return De(t.sort(fo))}}function vo(t,e,i){let s,a,n,o,r=0,l=t.length-1;i?(e>=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=we(t,"pos",e)),({pos:s,time:n}=t[r]),({pos:a,time:o}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=we(t,"time",e)),({time:s,pos:n}=t[r]),({time:a,pos:o}=t[l]));const h=a-s;return h?n+(o-n)*(e-s)/h:n}yo.id="time",yo.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class Co extends yo{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=vo(e,this.min),this._tableRange=vo(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],a=[];let n,o,r,l,h;for(n=0,o=t.length;n<o;++n)l=t[n],l>=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(n=0,o=s.length;n<o;++n)h=s[n+1],r=s[n-1],l=s[n],Math.round((h+r)/2)!==l&&a.push({time:l,pos:n/(o-1)});return a}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(vo(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return vo(this._table,i*this._tableRange+this._minPos,!0)}}Co.id="timeseries",Co.defaults=yo.defaults;const ko=[hs,rn,Xn,Object.freeze({__proto__:null,CategoryScale:qn,LinearScale:to,LogarithmicScale:io,RadialLinearScale:uo,TimeScale:yo,TimeSeriesScale:Co})];Pa.register(...ko);const To=Pa,Ao=ChartDataLabels;var Mo=t.n(Ao);function So(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}To.register(Mo()),c().extend(!0,To.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,boxWidth:7}}}}),c().extend(!0,To.overrides,{line:{elements:{point:{borderWidth:2}}},scatter:{elements:{point:{radius:3}}}});let wo=!1;const Ro=(1+Math.sqrt(5))/2;class Lo extends l{constructor(t){super(t),this.chartJs=null,this.onlyIntegers=!0,this.maxXAxesTicksHeigth=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&&0!==e.chartValueGroups.length&&e.axes||(t=!1),t&&s.scout.isOneOf(this.chart.config.type,n.Type.POLAR_AREA,n.Type.RADAR)){let i,s=0;for(i=0;i<e.chartValueGroups.length;i++){let a=e.chartValueGroups[i];a.values||(t=!1),0===i?s=a.values.length:a.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 i=!0,a=this.chart&&this.chart.config;if(a&&a.data&&a.data.datasets&&0!==a.data.datasets.length||(i=!1),i&&s.scout.isOneOf(a.type,n.Type.POLAR_AREA,n.Type.RADAR)){let t,e=0;for(t=0;t<a.data.datasets.length;t++){let s=a.data.datasets[t];s.data||(i=!1),0===t?e=s.data.length:s.data.length!==e&&(i=!1)}}return i}_render(){this.$canvas||(this.$canvas=this.chart.$container.appendElement("<canvas>")),this.firstOpaqueBackgroundColor=s.styles.getFirstOpaqueBackgroundColor(this.$canvas),wo||(To.defaults.font.family=this.$canvas.css("font-family"),wo=!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)).options.animation.duration=e?this.animationDuration:0,this.chartJs=new To(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,i=t.data,a=(t,e,i,s)=>{if(!t||!e||!i)return;if(!e[i]){let a=t[i];return void((a||s)&&(e[i]=a))}if(!t[i])return s?void(e[i]=void 0):Array.isArray(e[i])?void e[i].splice(0,e[i].length):void(e[i]=void 0);if(!Array.isArray(t[i])||!Array.isArray(e[i]))return void(e[i]=t[i]);for(let s=0;s<Math.min(t[i].length,e[i].length);s++)e[i][s]=t[i][s];let a=e[i].length,n=t[i].length;a>n?e[i].splice(n,a-n):a<n&&e[i].push(...t[i].splice(a))},n=(t,e)=>s.arrays.findIndex(t,(t=>t.datasetId===e));if(e&&i){a(i,e,"labels"),e.datasets||(e.datasets=[]),i.datasets||(i.datasets=[]),i.datasets.every((t=>s.objects.isNullOrUndefined(t.datasetId)))&&(i.datasets.forEach(((t,e)=>{t.datasetId=""+e})),e.datasets.forEach(((t,e)=>{t.datasetId=""+e}))),e.datasets.forEach((t=>{let e=(n=i.datasets,o=t.datasetId,s.arrays.find(n,(t=>t.datasetId===o)));var n,o;e&&(t.label=e.label,t.type=e.type,a(e,t,"data"),a(e,t,"backgroundColor",!0),a(e,t,"borderColor",!0),a(e,t,"hoverBackgroundColor",!0),a(e,t,"hoverBorderColor",!0),a(e,t,"legendColor",!0),a(e,t,"pointBackgroundColor",!0),a(e,t,"pointHoverBackgroundColor",!0),a(e,t,"pointBorderColor",!0),a(e,t,"pointHoverBorderColor",!0),a(e,t,"uncheckedBackgroundColor",!0),a(e,t,"uncheckedHoverBackgroundColor",!0),a(e,t,"checkedBackgroundColor",!0),a(e,t,"checkedHoverBackgroundColor",!0),a(e,t,"uncheckedPointBackgroundColor",!0),a(e,t,"uncheckedPointHoverBackgroundColor",!0),a(e,t,"checkedPointBackgroundColor",!0),a(e,t,"checkedPointHoverBackgroundColor",!0),a(e,t,"lineTension",!0),a(e,t,"pointRadius",!0),a(e,t,"uncheckedPointRadius",!0),a(e,t,"checkedPointRadius",!0),this._adjustDatasetBorderWidths(t))}));for(let t=e.datasets.length-1;t>=0;t--){let a=e.datasets[t].datasetId;(s.objects.isNullOrUndefined(a)||-1===n(i.datasets,a))&&e.datasets.splice(t,1)}e.datasets.sort(((t,e)=>n(i.datasets,t.datasetId)-n(i.datasets,e.datasetId))),i.datasets.forEach(((t,i)=>{let s=e.datasets[i];s&&s.datasetId&&t.datasetId===s.datasetId||e.datasets.splice(i,0,t)}))}else this.chartJs.config.data=i;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 o=this.chartJs.config.options.scales||{};[o.x||{},o.y||{},o.yDiffType||{},o.r||{}].forEach((t=>{(t.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=(t,e,i)=>{if(Array.isArray(t)&&Array.isArray(e)){let a=0;return s.arrays.ensure(i).filter((i=>!isNaN(i)&&i<Math.min(t.length,e.length))).forEach((i=>{t[i]!==e[i]&&(t[i]=e[i],a++)})),a}return 0},i=0;return t.data.datasets.forEach(((t,a)=>{let n=this.chart.checkedItems.filter((t=>t.datasetIndex===a)).map((t=>t.dataIndex)),o=s.arrays.init(t.data.length).map(((t,e)=>e));s.arrays.removeAll(o,n),i=i+e(t.backgroundColor,t.checkedBackgroundColor,n)+e(t.hoverBackgroundColor,t.checkedHoverBackgroundColor,n)+e(t.pointBackgroundColor,t.checkedPointBackgroundColor,n)+e(t.pointHoverBackgroundColor,t.checkedPointHoverBackgroundColor,n)+e(t.pointRadius,t.checkedPointRadius,n)+e(t.backgroundColor,t.uncheckedBackgroundColor,o)+e(t.hoverBackgroundColor,t.uncheckedHoverBackgroundColor,o)+e(t.pointBackgroundColor,t.uncheckedPointBackgroundColor,o)+e(t.pointHoverBackgroundColor,t.uncheckedPointHoverBackgroundColor,o)+e(t.pointRadius,t.uncheckedPointRadius,o),this._adjustDatasetBorderWidths(t)})),0<i}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===n.Type.COMBO_BAR_LINE){t.type=n.Type.BAR;let e=(t.options||{}).scaleLabelByTypeMap;e&&(e[n.Type.BAR]=e[n.Type.COMBO_BAR_LINE])}else this._isHorizontalBar(t)&&(t.type=n.Type.BAR,t.options=c().extend(!0,{},t.options,{indexAxis:"y"}))}_computeDatasets(t,e){let i=[],s=[],a=(t,i)=>{c().isEmptyObject(i)||(e.options[t]=i)};(t.axes[0]||[]).forEach((t=>i.push(t.label)));let n=this._isHorizontalBar(e);a(n?"yLabelMap":"xLabelMap",this._computeLabelMap(t.axes[0])),a(n?"xLabelMap":"yLabelMap",this._computeLabelMap(t.axes[1])),t.chartValueGroups.forEach((t=>s.push({type:t.type,label:t.groupName,data:c().extend(!0,[],t.values)}))),e.data={labels:i,datasets:s}}_isHorizontalBar(t){return t&&(t.type===n.Type.BAR_HORIZONTAL||t.type===n.Type.BAR&&t.options&&"y"===t.options.indexAxis)}_computeLabelMap(t){let e={};return(t||[]).forEach(((t,i)=>{e[i]=t.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&&s.scout.isOneOf(t.type,n.Type.BAR)&&t.data.datasets.forEach((t=>{(t.type||n.Type.BAR)===n.Type.BAR&&(t.borderWidth=t.borderWidth||1,t.hoverBorderWidth=t.hoverBorderWidth||2,this._adjustDatasetBorderWidths(t))}))}_adjustDatasetBorderWidths(t){this._adjustDatasetBorderWidth(t),this._adjustDatasetBorderWidth(t,!0)}_adjustDatasetBorderWidth(t,e){if(!t)return;let i=e?"hoverBorderWidth":"borderWidth",a=e?"hoverBorderWidthBackup":"borderWidthBackup",n=e?"hoverBackgroundColor":"backgroundColor",o=e?"hoverBorderColor":"borderColor";if(t[a]&&(t[i]=t[a],delete t[a]),!t[i]||s.objects.isFunction(t[i]))return;let r=Array.isArray(t[i]),l=Array.isArray(t[n]),h=Array.isArray(t[o]);if(!(r||l||h)&&t[n]===t[o])return t[a]=t[i],void(t[i]=0);let c=(t.data||[]).length;r?t[i].length<c&&t[i].push(...s.arrays.init(c-t[i].length,t[i][0])):t[i]=s.arrays.init(c,t[i]);let d=t[i],u=d.length,p=s.arrays.init(u);for(let e=0;e<u;e++){let i=l?t[n][e]:t[n],s=h?t[o][e]:t[o];p[e]=d[e],i===s&&(d[e]=0)}s.arrays.equals(d,p)||(t[a]=p)}_adjustMaxSegments(t){if(!(t&&t.data&&t.type&&s.scout.isOneOf(t.type,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA,n.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((t=>{let i=t.data.slice(0,e);i[e-1]=t.data.slice(e-1,t.data.length).reduce(((t,e)=>t+e),0),t.data=i}));let i=t.data.labels.slice(0,e);i[e-1]=this.chart.session.text("ui.OtherValues"),t.data.labels=i,t.data.maxSegmentsExceeded=!0}_isMaxSegmentsExceeded(t,e){return!!s.scout.isOneOf(t.type,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA,n.Type.RADAR)&&(!t.options.otherSegmentClickable&&(!(!t.data.maxSegmentsExceeded||!t.options.maxSegments)&&t.options.maxSegments-1<=e))}_adjustBubbleRadii(t){t&&t.data&&t.type&&t.type===n.Type.BUBBLE&&t.data.datasets.forEach((t=>t.data.forEach((t=>{isNaN(t.r)||(t.z=Math.pow(t.r,2)),t.r=1}))))}_adjustOnlyIntegers(t){this.onlyIntegers=!0,t&&t.data&&t.type&&(s.scout.isOneOf(t.type,n.Type.BUBBLE,n.Type.SCATTER)?this.onlyIntegers=t.data.datasets.every((t=>t.data.every((t=>s.numbers.isInteger(t.x)&&s.numbers.isInteger(t.y))))):this.onlyIntegers=t.data.datasets.every((t=>t.data.every((t=>s.numbers.isInteger(t))))))}_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],i=e.chart,a=i.config,o=e.dataset,r=[];if(s.scout.isOneOf(a.type,n.Type.BUBBLE)){let t=a.options.scales.x,i=a.options.scales.y,n=this._getAxisLabels(a),l=t.ticks.callback(o.data[e.dataIndex].x);l&&r.push(this._createTooltipAttribute(n.x,s.strings.encode(l),!0));let h=i.ticks.callback(o.data[e.dataIndex].y);h&&r.push(this._createTooltipAttribute(n.y,s.strings.encode(h),!0))}else if(s.scout.isOneOf(a.type,n.Type.SCATTER));else{let t=i.data.labels[e.dataIndex];r.push(this._createTooltipAttribute(a.options.reformatLabels?this._formatLabel(t):t,"",!0))}return r}_getAxisLabels(t){let e=t.options.scales.x.title.text,i=t.options.scales.y.title.text;return e=this._resolveAxisLabel(e,Lo.ARROW_LEFT_RIGHT),i=this._resolveAxisLabel(i," "+Lo.ARROW_UP_DOWN+" "),{x:e,y:i}}_resolveAxisLabel(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return s.objects.isFunction(t)&&(t=t(),t=s.objects.isString(t)?t:""),t?s.strings.encode(t):e}_generateTooltipItems(t,e,i,a){if(!t||!t.length)return"";let o=t[0].chart.config,r=!1,l=!1,h="";if(t.forEach((t=>{let{label:c,labelValue:d,labelColor:u}=this._getItemDetails(t,e,i,a);s.scout.isOneOf(o.type,n.Type.SCATTER)?(r|=s.objects.isString(d.x),l|=s.objects.isString(d.y),h+=this._createTooltipScatterAttribute(c,d.x,d.y,!1,u)):h+=this._createTooltipAttribute(c,d,!1,u)})),s.scout.isOneOf(o.type,n.Type.SCATTER)){let t="<table><tbody>",e=this._getAxisLabels(o);t+=this._createTooltipScatterAttribute("",r?e.x:"",l?e.y:"",!0,null);let i="</tbody></table>";h=s.strings.box(t,h,i)}return h}_getItemDetails(t,e,i,a){let n,o,r;return s.objects.isFunction(e)&&(n=e(t),n=s.objects.isString(n)?n:""),s.objects.isFunction(i)&&(o=i(t),o=s.objects.isString(o)||s.objects.isPlainObject(o)?o:""),s.objects.isFunction(a)&&(r=a(t),r=s.objects.isPlainObject(r)&&r.backgroundColor||""),{label:n,labelValue:o,labelColor:r}}_generateTooltipLabel(t){return s.strings.encode(t.dataset.label)}_generateTooltipLabelValue(t){let e=t.chart.config,i=t.dataset;return e.type===n.Type.BUBBLE?s.strings.encode(this._formatLabel(i.data[t.dataIndex].z)):e.type===n.Type.SCATTER?{x:s.strings.encode(this._formatLabel(i.data[t.dataIndex].x)),y:s.strings.encode(this._formatLabel(i.data[t.dataIndex].y))}:s.strings.encode(this._formatLabel(i.data[t.dataIndex]))}_generateTooltipLabelColor(t){let e,i,a,o,r=t.chart.config,l=t.dataset;s.scout.isOneOf(l.type||r.type,n.Type.LINE,n.Type.BAR,n.Type.BAR_HORIZONTAL,n.Type.RADAR,n.Type.BUBBLE,n.Type.SCATTER)&&(a=l.borderColor,e=l.legendColor,o=t.datasetIndex),s.scout.isOneOf(r.type,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)&&(e=Array.isArray(l.legendColor)?l.legendColor[t.dataIndex]:l.legendColor,i=Array.isArray(l.backgroundColor)?l.backgroundColor[t.dataIndex]:l.backgroundColor,i=this._adjustColorOpacity(i,1),o=t.dataIndex),s.objects.isFunction(e)&&(e=e.call(t.chart,o));let h=e||i||a;if(!h||s.objects.isFunction(h)){let e;To.overrides[r.type]&&To.overrides[r.type].plugins&&To.overrides[r.type].plugins.tooltip&&To.overrides[r.type].plugins.tooltip.callbacks&&(e=To.overrides[r.type].plugins.tooltip.callbacks.labelColor),h=(e||To.defaults.plugins.tooltip.callbacks.labelColor).call(t.chart,t).backgroundColor}return{backgroundColor:h}}_createTooltipAttribute(t,e,i,s){return'<div class="'+(i?"attribute title":"attribute")+'">'+(s?'<div class="color" style="background-color:'+s+'"></div>':"")+(t?"<label>"+t+"</label>":"")+(e?'<div class="value">'+e+"</div>":"")+"</div>"}_createTooltipScatterAttribute(t,e,i,s,a){return'<tr class="'+(s?"attribute title":"attribute")+'"><td class="color-cell">'+(a?'<div class="color" style="background-color:'+a+'"></div>':"")+'</td><td class="label">'+t+"</td>"+(e?'<td class="value">'+e+"</td>":"")+(i?'<td class="value">'+i+"</td>":"")+"</tr>"}_renderTooltip(t){if(0===t.tooltip.opacity||t.tooltip._tooltipItems.length<1)return this._tooltipTimeoutId&&(clearTimeout(this._tooltipTimeoutId),this._tooltipTimeoutId=void 0),void(this._tooltip&&(this._tooltip.destroy(),this._tooltip=null));!!this._tooltip?this._renderTooltipLater(t):this._tooltipTimeoutId=setTimeout((()=>this._renderTooltipLater(t)),s.tooltips.DEFAULT_TOOLTIP_DELAY)}_renderTooltipLater(t){if(!this.rendered||this.removing)return;let e=t.tooltip,i=e.dataPoints;if(i.length<1)return;this._tooltip&&(this._tooltip.destroy(),this._tooltip=null);let a=e.options||{},n=a.callbacks||{},o=n.title,r=n.items,l=n.label,h=n.labelValue,d=n.labelColor,u="";s.objects.isFunction(o)&&(u+=s.arrays.ensure(o(i)).join("")),s.objects.isFunction(r)&&(u+=s.arrays.ensure(r(i,l,h,d)).join(""));let p=this._computeTooltipPositionAndOffset(i[0]),g=s.graphics.offsetBounds(this.$canvas);g.x+=e.caretX+p.offsetX,g.y+=e.caretY+p.offsetY,g.height=p.height,this._tooltip=s.scout.create({objectType:"Tooltip",parent:this.chart,$anchor:this.$canvas,text:u,htmlEnabled:!0,cssClass:s.strings.join(" ","chart-tooltip",a.cssClass),tooltipPosition:p.tooltipPosition,tooltipDirection:p.tooltipDirection,origin:g}),this._tooltip.render(),this._tooltip.$container.css("pointer-events","none");let f=!1;(a.titleFont||{}).family&&(this._tooltip.$container.css("--chart-tooltip-font-family",a.titleFont.family),f=!0);let m=0;this._tooltip.$container.find("label").each(((t,e)=>{m=Math.max(m,s.graphics.prefSize(c()(e)).width)})),m>0&&(this._tooltip.$container.css("--chart-tooltip-label-width",Math.min(m,120)+"px"),f=!0),f&&this._tooltip.position()}_computeTooltipPositionAndOffset(t){let e="top",i="right",a=0,o=0,r=0,l=t.chart,h=t.datasetIndex,c=t.dataIndex,d=l.config,u=d.data.datasets[h],p=u.data[c];if(this._isHorizontalBar(d))i=p<0?"left":"right";else if((u.type||d.type)===n.Type.BAR)e=p<0?"bottom":"top";else if(s.scout.isOneOf(d.type,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)){let t=l.getDatasetMeta(h).data[c],s=(t.startAngle+t.endAngle)/2;e=0<=s&&s<Math.PI?"bottom":"top",i=-Math.PI/2<=s&&s<Math.PI/2?"right":"left"}else if(d.type===n.Type.RADAR){let t=l.getDatasetMeta(h).data[c].angle;e=0<=t&&t<Math.PI?"bottom":"top",i=-Math.PI/2<=t&&t<Math.PI/2?"right":"left"}else if(s.scout.isOneOf(d.type,n.Type.BUBBLE,n.Type.SCATTER)){let t=l.getDatasetMeta(h).data[c],e=l.chartArea,s=e.left+e.width/2;i=t.x<s?"left":"right"}if(this._isHorizontalBar(d)){let t=l.getDatasetMeta(h).data[c];r=t.height;let e=t.width/(Ro+1);o=-r/2,a="left"===i?e:-e}else if(s.scout.isOneOf(d.type,n.Type.LINE,n.Type.BUBBLE,n.Type.SCATTER,n.Type.RADAR)||u.type===n.Type.LINE){let t=l.getDatasetMeta(h).data[c].options,e=t.hoverRadius+t.hoverBorderWidth;d.type===n.Type.BUBBLE&&(e+=p.r),r=2*e,o=-e}else if(s.scout.isOneOf(d.type,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)){let t=l.getDatasetMeta(h).data[c],e=(t.startAngle+t.endAngle)/2,i=t.innerRadius,s=(t.outerRadius-i)/2;a=s*Math.cos(e),o=s*Math.sin(e)}return{tooltipPosition:e,tooltipDirection:i,offsetX:a,offsetY:o,height:r}}_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;s.scout.isOneOf(t.type,n.Type.POLAR_AREA,n.Type.RADAR)&&(t.options=c().extend(!0,{},{scales:{r:{}}},t.options));let e=t.options,i=e?e.scales:{};i&&i.r&&(i.r=c().extend(!0,{},{minSpaceBetweenTicks:35,beginAtZero:!0,angleLines:{display:!1},ticks:{callback:this._labelFormatter},pointLabels:{font:{size:To.defaults.font.size}}},i.r))}_adjustScalesXY(t){t&&t.type&&t.options&&(s.scout.isOneOf(t.type,n.Type.BAR,n.Type.LINE,n.Type.BUBBLE)?t.options=c().extend(!0,{},{scales:{x:{minSpaceBetweenTicks:150},y:{minSpaceBetweenTicks:35}}},t.options):s.scout.isOneOf(t.type,n.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,i=t.options.scales;this._isHorizontalBar(t)||s.scout.isOneOf(e,n.Type.BUBBLE,n.Type.SCATTER)?i.x=c().extend(!0,{},{beginAtZero:this._isHorizontalBar(t),offset:e===n.Type.BUBBLE,grid:{drawBorder:!1,drawTicks:!1},ticks:{padding:5}},i.x):i.x=c().extend(!0,{},{offset:!0,grid:{display:!1,drawBorder:!1}},i.x),(this._isHorizontalBar(t)||s.scout.isOneOf(e,n.Type.BUBBLE,n.Type.SCATTER)||t.options.reformatLabels)&&(i.x=c().extend(!0,{},{ticks:{callback:this._xLabelFormatter}},i.x)),i.x.afterCalculateLabelRotation=this._xAxisFitter}_adjustYAxis(t){if(!(t&&t.type&&t.options&&t.options.scales&&t.options.scales.y))return;let e=t.type,i=t.options.scales;this._isHorizontalBar(t)?i.y=c().extend(!0,{},{grid:{display:!1,drawBorder:!1}},i.y):i.y=c().extend(!0,{},{beginAtZero:!s.scout.isOneOf(e,n.Type.BUBBLE,n.Type.SCATTER),grid:{drawBorder:!1,drawTicks:!1},ticks:{padding:5}},i.y),this._isHorizontalBar(t)&&!t.options.reformatLabels||(i.y=c().extend(!0,{},{ticks:{callback:this._yLabelFormatter}},i.y)),i.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(s.scout.isOneOf(t.type,n.Type.PIE,n.Type.DOUGHNUT)){e.datalabels=c().extend(!0,{},{formatter:this._radialChartDatalabelsFormatter},e.datalabels),e.datalabels.display=this._radialChartDatalabelsDisplayHandler,this._updatingDatalabels=!1;let i=t.options.animation||{},a=i.onProgress,n=i.onComplete,o=t=>{if(this._updatingDatalabels)return;this._updatingDatalabels=!0;let e=t.chart,i=e.getSortedVisibleDatasetMetas(),a=[...e.getActiveElements()],n=[];i.forEach(((t,e)=>{t.data.forEach(((t,i)=>{let o=s.arrays.findIndex(a,(t=>t.datasetIndex===e&&t.index===i));o>0?a.splice(o,1):n.push({datasetIndex:e,index:i,element:t})}))})),e["$"+Mo().id]._actives=n,Mo().afterEvent(e),this._updatingDatalabels=!1},r=(t,e)=>{o(t),e&&e(t)};t.options.animation=c().extend(!0,{},t.options.animation,{onProgress:t=>r(t,a),onComplete:t=>r(t,n)})}else s.scout.isOneOf(t.type,n.Type.BAR,n.Type.LINE,n.Type.POLAR_AREA,n.Type.RADAR,n.Type.BUBBLE)?(e.datalabels=c().extend(!0,{},{backgroundColor:this._datalabelBackgroundColorHandler,borderRadius:3},e.datalabels),e.datalabels.display="auto"):s.scout.isOneOf(t.type,n.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 i=t=>(e,i)=>{let s=t.call(i.chart,e,i);return this._formatLabel(s)};if(t.data){t.data.datasets.forEach((t=>{t.datalabels&&t.datalabels.formatter&&(t.datalabels.formatter=i(t.datalabels.formatter))}))}e.datalabels.formatter&&(e.datalabels.formatter=i(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,i){return e?e[t]:isNaN(t)?t:i?i(t,this._formatNumberLabel.bind(this)):this._formatNumberLabel(t)}_formatNumberLabel(t){if(isNaN(t))return t;let e=Math.abs(t),i="";if(e>=1e6){e/=1e6,i=" "+this.chart.session.text("ui.Mio");let t=[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 s=0;s<t.length&&e>=1e3;s++)e/=1e3,i=" "+t[s]}return this.session.locale.decimalFormat.format(Math.sign(t)*e)+i}_fitXAxis(t){if(!t||0===t.labelRotation)return;let e,i,a=this.maxXAxesTicksHeigth,n=To.defaults.font,o=To.defaults.scale.ticks,r=o.font||{};if(this.chartJs){let t=this.chartJs.chartArea,e=Math.abs(t.top-t.bottom);a=Math.min(a,e/3)}if(t.options&&t.options.ticks){i=t.options.ticks.maxRotation,e=(t.options.ticks.font||{}).size}i=i||o.maxRotation,e=e||r.size||n.size,isNaN(t.labelRotation)&&(t.labelRotation=i),t.height=isNaN(t.height)?a:Math.min(t.height,a);let l=t.labelRotation,h=(a-e*Math.sin((90-l)/180*Math.PI))/Math.sin(l/180*Math.PI);if(((t._labelSizes||{}).widest||{}).width>h){let e=t.ctx.measureText.bind(t.ctx);t.ticks.forEach((t=>{t.label=s.strings.truncateText(t.label,h,e)})),t._labelSizes=void 0}}_fitYAxis(t){if(!t)return;let e=0,i=0;if(t.options&&t.options.ticks&&(e=t.options.ticks.padding||0),t.options&&t.options.grid&&(i=t.options.grid.tickLength||0),((t._labelSizes||{}).widest||{}).width>t.maxWidth-e){let a=t.maxWidth-e-i,n=t.ctx.measureText.bind(t.ctx);t.ticks.forEach((t=>{t.label=s.strings.truncateText(t.label,a,n)}))}}_displayDatalabelsOnRadialChart(t){let e=t.chart.getDatasetMeta(t.datasetIndex).data[t.dataIndex],i=(e.outerRadius+e.innerRadius)/2,s=Math.min(e.endAngle-e.startAngle,Math.PI)/2,a=2*(Math.abs(Math.sin(s))*i),n=e.outerRadius-e.innerRadius;return Math.min(a,n)>this.minRadialChartDatalabelSpace}_formatDatalabelsOnRadialChart(t,e){let i=this._computeSumOfVisibleElements(e),s=e.dataset,a=0,n=[];for(let t=0;t<e.dataIndex+1;t++){let e=s.data[t]/i*100-a,o=Math.round(e);a=o-e,n.push(o+"%")}return n[e.dataIndex]}_computeSumOfVisibleElements(t){let e=t.dataset,i=t.chart,s=0;for(let t=0;t<e.data.length;t++)i.getDataVisibility(t)&&(s+=e.data[t]);return s}_formatDatalabels(t,e){return e.chart.config.type===n.Type.BUBBLE?this._formatLabel(t.z):e.chart.config.type===n.Type.SCATTER?s.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=s.colorSchemes.getCssClasses(t.options.colorScheme).join(" "))}_adjustDatasetColors(t){if(!t||!t.data||!t.type)return;let e=t.data,i=t.type,a=t.options&&t.options.autoColor,o=t.options&&t.options.checkable,r=a&&s.scout.isOneOf(i,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA),l={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]};l=c().extend(!0,l,this._computeDatasetColors(t,r)),e.datasets.forEach(((e,a)=>{let h=r?l.backgroundColors:l.backgroundColors[a],c=r?l.borderColors:l.borderColors[a],d=r?l.hoverBackgroundColors:l.hoverBackgroundColors[a],u=r?l.hoverBorderColors:l.hoverBorderColors[a],p=r?l.legendColors:l.legendColors[a],g=r?l.pointHoverColors:l.legendColors[a],f=(t,i)=>{"function"!=typeof e[t]&&i&&i.length&&(e[t]=Array.isArray(i)?[...i]:i)};if(f("backgroundColor",h),f("borderColor",c),f("hoverBackgroundColor",d),f("hoverBorderColor",u),f("legendColor",p),(s.scout.isOneOf(i,n.Type.LINE,n.Type.RADAR)||i===n.Type.BAR&&e.type===n.Type.LINE)&&(f("pointHoverBackgroundColor",g),f("pointBorderColor",this.firstOpaqueBackgroundColor),f("pointHoverBorderColor",this.firstOpaqueBackgroundColor)),o){let o=e.data.length;if(s.scout.isOneOf(i,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA,n.Type.BUBBLE,n.Type.SCATTER)||i===n.Type.BAR&&(e.type||n.Type.BAR)===n.Type.BAR){let t=r?l.backgroundColors:s.arrays.init(o,l.backgroundColors[a]),i=r?l.hoverBackgroundColors:s.arrays.init(o,l.hoverBackgroundColors[a]),n=r?l.checkedBackgroundColors:s.arrays.init(o,l.checkedBackgroundColors[a]),h=r?l.checkedHoverBackgroundColors:s.arrays.init(o,l.checkedHoverBackgroundColors[a]);f("uncheckedBackgroundColor",t),f("uncheckedHoverBackgroundColor",i),f("checkedBackgroundColor",n),f("checkedHoverBackgroundColor",h),f("backgroundColor",e.uncheckedBackgroundColor),f("hoverBackgroundColor",e.uncheckedHoverBackgroundColor)}else if(s.scout.isOneOf(i,n.Type.LINE,n.Type.RADAR)||i===n.Type.BAR&&e.type===n.Type.LINE){let i=s.arrays.init(o,g),a=s.arrays.init(o,g),n=s.arrays.init(o,c),r=s.arrays.init(o,u||c);f("uncheckedPointBackgroundColor",i),f("uncheckedPointHoverBackgroundColor",a),f("checkedPointBackgroundColor",n),f("checkedPointHoverBackgroundColor",r),f("pointBackgroundColor",e.uncheckedPointBackgroundColor),f("pointHoverBackgroundColor",e.uncheckedPointHoverBackgroundColor);let l=s.arrays.init(o,((t.options.elements||{}).point||{}).radius||To.defaults.elements.point.radius),h=s.arrays.init(o,(((t.options.elements||{}).point||{}).hoverRadius||To.defaults.elements.point.hoverRadius)-1);f("uncheckedPointRadius",l),f("checkedPointRadius",h),f("pointRadius",e.uncheckedPointRadius)}}this._adjustDatasetBorderWidths(e)})),o&&this._checkItems(t)}_computeDatasetColors(t,e){if(!t||!t.data||!t.type)return{};let i=t.data,a=t.type,o={};if(t.options&&t.options.autoColor)o=this._computeDatasetColorsAutoColor(t,e);else if(o=this._computeDatasetColorsChartValueGroups(t,e),s.scout.isOneOf(a,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)){let t=this._computeBorderColor(a,0);o.borderColors=s.arrays.init(i.datasets.length,t),o.hoverBorderColors=o.borderColors}return o}_computeDatasetColorsAutoColor(t,e){if(!(t&&t.data&&t.type&&t.options&&t.options.autoColor))return{};let i=t.data,a=t.type,n=t.options&&t.options.checkable,o=t.options&&t.options.transparent,r={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]},l=[];return e?l=s.arrays.init(i.datasets.length&&i.datasets[0].data.length||0,a):i.datasets.forEach((t=>l.push(t.type||a))),l.forEach(((t,e)=>{r.backgroundColors.push(this._computeBackgroundColor(t,e,n||o)),r.borderColors.push(this._computeBorderColor(t,e)),r.hoverBackgroundColors.push(this._computeHoverBackgroundColor(t,e,n||o)),r.hoverBorderColors.push(this._computeHoverBorderColor(t,e)),r.checkedBackgroundColors.push(this._computeCheckedBackgroundColor(t,e,n)),r.checkedHoverBackgroundColors.push(this._computeCheckedHoverBackgroundColor(t,e,n)),r.legendColors.push(this._computeLegendColor(t,e)),r.pointHoverColors.push(this._computePointHoverColor(t,e))})),r}_computeBackgroundColor(t,e,i){return s.styles.get([this.colorSchemeCssClass,t+"-chart"+(i?" checkable":""),"elements","color"+e%this.numSupportedColors],"fill").fill}_computeBorderColor(t,e){let i;return s.scout.isOneOf(t,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)&&(i={stroke:this.firstOpaqueBackgroundColor}),s.styles.get([this.colorSchemeCssClass,t+"-chart","elements","stroke-color"+e%this.numSupportedColors],"stroke",i).stroke}_computeHoverBackgroundColor(t,e,i){return s.styles.get([this.colorSchemeCssClass,t+"-chart"+(i?" checkable":""),"elements","color"+e%this.numSupportedColors+" hover"],"fill").fill}_computeHoverBorderColor(t,e){let i;return s.scout.isOneOf(t,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)&&(i={stroke:this.firstOpaqueBackgroundColor}),s.styles.get([this.colorSchemeCssClass,t+"-chart","elements","stroke-color"+e%this.numSupportedColors+" hover"],"stroke",i).stroke}_computeCheckedBackgroundColor(t,e,i){return s.styles.get([this.colorSchemeCssClass,t+"-chart"+(i?" checkable":""),"elements","color"+e%this.numSupportedColors+" checked"],"fill").fill}_computeCheckedHoverBackgroundColor(t,e,i){return s.styles.get([this.colorSchemeCssClass,t+"-chart"+(i?" checkable":""),"elements","color"+e%this.numSupportedColors+" hover checked"],"fill").fill}_computeLegendColor(t,e){return s.styles.get([this.colorSchemeCssClass,t+"-chart","elements","color"+e%this.numSupportedColors+" legend"],"fill").fill}_computePointHoverColor(t,e){return s.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 i=t.type,a=t.options&&t.options.checkable,o=t.options&&t.options.transparent,r={backgroundColors:[],borderColors:[],hoverBackgroundColors:[],hoverBorderColors:[],checkedBackgroundColors:[],checkedHoverBackgroundColors:[],legendColors:[],pointHoverColors:[]};return this.chart.data.chartValueGroups.forEach((t=>{let e=s.styles.hexToRgb(t.colorHexValue),l=(t,i)=>this._adjustColorOpacity(s.styles.darkerColor(e,i),t),h=1,c=1,d=.1,u=.1,p=.2,g=.35,f=1,m=0,b=1,x=.1;s.scout.isOneOf(i,n.Type.PIE,n.Type.DOUGHNUT)?(p=.7,g=.85,m=.1,x=0):i===n.Type.POLAR_AREA?(h=.7,c=.85,p=.7,g=.85,m=.1,x=0):s.scout.isOneOf(t.type||i,n.Type.LINE,n.Type.RADAR)?(h=.2,c=.35,d=0,u=0,f=.2,b=.35,x=0):s.scout.isOneOf(i,n.Type.BUBBLE,n.Type.SCATTER)&&(h=.2,c=.35,d=0),r.backgroundColors.push(l(a||o?p:h,0)),r.borderColors.push(l(1,0)),r.hoverBackgroundColors.push(l(a||o?g:c,a||o?0:d)),r.hoverBorderColors.push(l(1,u)),r.checkedBackgroundColors.push(l(f,m)),r.checkedHoverBackgroundColors.push(l(b,x)),r.legendColors.push(l(1,0)),r.pointHoverColors.push(l(1,0))})),r.datalabelColor=this._computeDatalabelColor(i),r}_adjustColorOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t&&"function"!=typeof t?0===t.indexOf("rgb")?this._adjustRgbColorOpacity(t,e):0===t.indexOf("#")?this._adjustHexColorOpacity(t,e):t:t}_adjustRgbColorOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!t||0!==t.indexOf("rgb"))return t;let i=s.styles.rgb(t);return i.alpha=e,"rgba("+i.red+", "+i.green+", "+i.blue+", "+i.alpha+")"}_adjustHexColorOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return!t||0!==t.indexOf("#")||4!==t.length&&5!==t.length&&7!==t.length&&9!==t.length?t:this._adjustRgbColorOpacity(s.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 s.styles.get([this.colorSchemeCssClass,t+"-chart","elements","label"],"fill").fill}_generateLegendLabels(t){let e,i=t.config;To.overrides[i.type]&&To.overrides[i.type].plugins&&To.overrides[i.type].plugins.legend&&To.overrides[i.type].plugins.legend.labels&&(e=To.overrides[i.type].plugins.legend.labels.generateLabels);let a=(e||To.defaults.plugins.legend.labels.generateLabels).call(t,t);if(this.removing)return a;let o,r=i.data,l=t.ctx.measureText.bind(t.ctx),h=t.legend,c=((h||{}).options||{}).labels||{},d=c.boxWidth||0,u=c.padding||0;return s.scout.isOneOf(i.options.plugins.legend.position,n.Position.LEFT,n.Position.RIGHT)?((h.maxWidth||h.width)&&(o=Math.max((h.maxWidth||h.width)-d-2*u,0)),o=Math.min(250,o||0,this.$canvas.cssWidth()/3)):o=Math.min(250,2*this.$canvas.cssWidth()/3),a.forEach(((e,a)=>{e.text=s.strings.truncateText(e.text,o,l);let h,c,d,u=r.datasets[a];u&&s.scout.isOneOf(u.type||i.type,n.Type.LINE,n.Type.BAR,n.Type.RADAR,n.Type.BUBBLE,n.Type.SCATTER)?(h=u.legendColor,c=this._adjustColorOpacity(u.borderColor,1)):r.datasets.length&&s.scout.isOneOf(i.type,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)&&(u=r.datasets[0],h=Array.isArray(u.legendColor)?u.legendColor[a]:u.legendColor,d=Array.isArray(u.backgroundColor)?u.backgroundColor[a]:u.backgroundColor,d=this._adjustColorOpacity(d,1)),s.objects.isFunction(h)&&(h=h.call(t,a));let p=h||d||c;s.objects.isFunction(p)||(e.fillStyle=p,e.strokeStyle=p)})),a}_adjustScalesRColors(t){if(!(t&&t.type&&t.options&&t.options.scales&&t.options.scales.r))return;let e=this._computeLabelColor(t.type),i=this._computeLabelBackdropColor(t.type),s=this._computeGridColor(t.type),a=this._computeScaleTicksColor(t.type);t.options.scales.r.ticks=c().extend(!0,{},t.options.scales.r.ticks,{color:a,backdropColor:i}),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:s})}_computeLabelBackdropColor(t){return s.styles.get([this.colorSchemeCssClass,t+"-chart","elements","label-backdrop"],"fill",{fill:this.firstOpaqueBackgroundColor}).fill}_computeGridColor(t){return s.styles.get([this.colorSchemeCssClass,t+"-chart","elements","grid"],"fill").fill}_computeScaleTicksColor(t){return s.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 i=this._computeLabelColor(t.type),s=this._computeGridColor(t.type),a=this._computeAxisLabelColor(t.type);e.forEach((t=>{t.grid=c().extend(!0,{},t.grid,{color:s}),t.ticks=c().extend(!0,{},t.ticks,{color:i}),t.title=c().extend(!0,{},t.title,{color:a})}))}_computeAxisLabelColor(t){return s.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 s.styles.get([this.colorSchemeCssClass,t+"-chart","elements","datalabel"],"fill").fill}_adjustClickHandler(t){if(!t||!t.options)return;if(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=t=>t.native.stopPropagation(),e.onHover=this._legendHoverHandler,e.onLeave=this._legendLeaveHandler)}_onClick(t,e){if(!e.length)return;let i=this._selectRelevantItem(e);if(this._isMaxSegmentsExceeded(this.chartJs.config,i.index))return;let a=i.index,o=i.datasetIndex,r={datasetIndex:o,dataIndex:a};if(s.scout.isOneOf(this.chartJs.config.type,n.Type.BUBBLE,n.Type.SCATTER)){let t=this.chartJs.config.data.datasets[o].data[a];r.xIndex=t.x,r.yIndex=t.y}else r.xIndex=a;let l=new s.Event;l.data=r,l.originalEvent=t.native,this.chart._onValueClick(l)}_selectRelevantItem(t){let e=this.chartJs.config.data.datasets,i=t[0];return this.chartJs.config.type===n.Type.BUBBLE&&t.forEach((t=>{e[t.datasetIndex].data[t.index].z<=e[i.datasetIndex].data[i.index].z&&(i=t)})),i}_onHover(t,e){if(!this.chartJs.config||!this.chartJs.config.type)return;let i=this.chartJs.config,a=i.type;if(!s.scout.isOneOf(a,n.Type.LINE,n.Type.BAR,n.Type.RADAR))return;let o=!1;this.resetDatasetAfterHover&&(this._restoreBackgroundColor(),this.resetDatasetAfterHover=!1,o=!0),e.forEach((t=>{let e=i.data.datasets[t.datasetIndex];s.scout.isOneOf(e.type||a,n.Type.LINE,n.Type.RADAR)&&(this._setHoverBackgroundColor(e),this.resetDatasetAfterHover=!0,o=!0)})),o&&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,i){if(!this.chartJs.config||!this.chartJs.config.type)return;let s,a=this.chartJs.config.type;To.overrides[a]&&To.overrides[a].plugins&&To.overrides[a].plugins.legend&&(s=To.overrides[a].plugins.legend.onClick),(s||To.defaults.plugins.legend.onClick).call(this.chartJs,t,e,i),this._onLegendLeave(t,e,i),this._onLegendHoverPointer(t,e,!0)}_onLegendHover(t,e,i){let a=e.datasetIndex,o=this.chartJs.config,r=o.type;if(s.scout.isOneOf(r,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)&&(a=e.index),this.legendHoverDatasets.indexOf(a)>-1)return;let l=o.data.datasets[a];((l?l.type:null)||r)===n.Type.LINE&&(this._setHoverBackgroundColor(l),this.chartJs.update()),this._updateHoverStyle(a,!0),this.chartJs.render(),this.legendHoverDatasets.push(a)}_onLegendHoverPointer(t,e,i){this._onLegendHover(t,e,i),this.rendered&&!this.removing&&this.$canvas.css("cursor","pointer")}_onLegendLeave(t,e,i){let a=e.datasetIndex,o=this.chartJs.config,r=o.type;if(s.scout.isOneOf(r,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)&&(a=e.index),this.legendHoverDatasets.indexOf(a)<0)return;let l=o.data.datasets[a];((l?l.type:null)||r)===n.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((t=>this._restoreBackgroundColor(t)))}_onLegendLeavePointer(t,e,i){this._onLegendLeave(t,e,i),this.rendered&&!this.removing&&this.$canvas.css("cursor","default")}_updateHoverStyle(t,e){let i,a=this.chartJs.config,o=a.type,r=[],l=a.data.datasets,h=l?l[t]:null,c=h?h.type:null;i=s.scout.isOneOf(o,n.Type.LINE,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA,n.Type.SCATTER)||c===n.Type.LINE?"point":"dataset",s.scout.isOneOf(o,n.Type.PIE,n.Type.DOUGHNUT,n.Type.POLAR_AREA)?this.chartJs.getSortedVisibleDatasetMetas().forEach(((e,i)=>r.push({element:e.data[t],datasetIndex:i,index:t}))):this.chartJs.getDatasetMeta(t).data.forEach(((e,i)=>r.push({element:e,datasetIndex:t,index:i}))),r&&r.length&&this.chartJs.updateHoverStyle(r,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!==n.Type.BUBBLE)return;let i=t.data.datasets;i.forEach((t=>t.data.forEach((t=>{isNaN(t.z)||(t.r=Math.sqrt(t.z))}))));let a=this._computeMaxMinValue(t,i,"r",!0),o=a.maxValue,r=a.minValue,l=1,h=0,c=(t.options||{}).bubble?t.options.bubble.sizeOfLargestBubble:0,d=(t.options||{}).bubble?t.options.bubble.minBubbleSize:0;if(c){let t=Math.abs(e.right-e.left),i=Math.abs(e.top-e.bottom);c=Math.min(c,Math.floor(Math.min(t,i)/6)),0===o?h=c:d&&c>d&&r/o<d/c?(l=(c-d)/(o-r),h=d-l*r):l=c/o}else d&&d>r&&(0===r?h=d:l=d/r);i.forEach((t=>t.data.forEach((t=>{s.objects.isNullOrUndefined(t.r)||(t.r=t.r*l+h)}))))}_computeMaxMinValue(t,e,i,s,a,o,r){if(!e)return;let l,h;if(t.type===n.Type.SCATTER&&"r"===i)l=0,h=0;else for(let t=0;t<e.length;t++)for(let s=0;s<e[t].data.length;s++){let a;a=i?e[t].data[s][i]:e[t].data[s],l=isNaN(l)?a:Math.max(a,l),h=isNaN(h)?a:Math.min(a,h)}isNaN(l)&&(l=0),isNaN(h)&&(h=0);let c=0,d=l,u=h;if(s||(a&&Math.sign(h)===Math.sign(l)&&(c=Math.floor(h)),d=this._calculateBoundary(l-c,Math.ceil,Math.floor),u=this._calculateBoundary(h-c,Math.floor,Math.ceil)),o&&r&&r>2*o){let t=(l-h)/(r-2*o)*o;d=Math.max(d,l-c+t),u=Math.min(u,h-c-t)}return s?{maxValue:d,minValue:u}:{maxValue:d+c,minValue:u+c}}_calculateBoundary(t,e,i){let s=e,a=!1;return t<0&&(a=!0,t*=-1,s=i),t=this._calculateBoundaryPositive(t,s),a&&(t*=-1),t}_calculateBoundaryPositive(t,e){if(!(t>0&&e))return t;let i=Math.floor(Math.log(t)/Math.LN10);return t=i<0?5*e(t*Math.pow(10,Math.abs(i))/5)/Math.pow(10,Math.abs(i)):5*e(t/(5*Math.pow(10,i-1)))*Math.pow(10,i-1)}_adjustGridMaxMin(t,e){if(!(t&&t.type&&t.options&&t.options.adjustGridMaxMin&&t.options.scales&&e))return;let i=t.type;if(!s.scout.isOneOf(i,n.Type.BAR,n.Type.LINE,n.Type.POLAR_AREA,n.Type.RADAR,n.Type.BUBBLE,n.Type.SCATTER))return;let a=t.options.scales,o=a.x,r=a.y,l=a.r,h=o?o.minSpaceBetweenTicks:1,c=r?r.minSpaceBetweenTicks:1;l&&(h=l.minSpaceBetweenTicks,c=l.minSpaceBetweenTicks);let d=Math.abs(e.right-e.left),u=Math.abs(e.top-e.bottom),p=Math.max(Math.floor(d/h)+1,3),g=Math.max(Math.floor(u/c)+1,3),f=this._computeYBoundaries(t,u),m=f.yBoundary,b=f.yBoundaryDiffType;if(l)return void this._adjustAxisMaxMin(l,Math.ceil(Math.min(p,g)/2),m);if(b?(this._adjustAxisMaxMin(r,g,m),this._adjustAxisMaxMin(a.yDiffType,g,b)):this._isHorizontalBar(t)?this._adjustAxisMaxMin(o,p,m):this._adjustAxisMaxMin(r,g,m),!s.scout.isOneOf(i,n.Type.BUBBLE,n.Type.SCATTER))return;let x=this._computeXBoundaryPointElement(t,d);this._adjustAxisMaxMin(o,p,x)}_computeBoundaryPointElement(t,e,i){if(!(t&&t.type&&s.scout.isOneOf(t.type,n.Type.BUBBLE,n.Type.SCATTER)&&t.data&&t.options&&t.options.scales&&("x"===e||"y"===e)&&i))return;let a,o=t.data.datasets,r=t.options.scales[e],l=r&&r.offset,h=t.options[e+"LabelMap"],c=this._computeMaxMinValue(t,o,"r",!0).maxValue;return t.options.elements&&t.options.elements.point&&t.options.elements.point.hoverRadius&&(c+=t.options.elements.point.hoverRadius),a=l?this._computeMaxMinValue(t,o,e,h,!0):this._computeMaxMinValue(t,o,e,h,!0,c,i),h&&(a.maxValue=Math.ceil(a.maxValue),a.minValue=Math.floor(a.minValue)),a}_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 i,a,o=t.type;if(s.scout.isOneOf(o,n.Type.BUBBLE,n.Type.SCATTER))i=this._computeYBoundaryPointElement(t,e);else{let e=[],s=[];if(t.data&&t.data.datasets&&t.data.datasets.forEach((t=>{t.type&&t.type!==o?s.push(t):e.push(t)})),i=this._computeMaxMinValue(t,e),e.length&&s.length){a=this._computeMaxMinValue(t,s);let n=i.maxValue-i.minValue,o=a.maxValue-a.minValue;n&&o&&(n/o>10||o/n>10)&&this._adjustYAxisDiffType(t,e,s)}}return{yBoundary:i,yBoundaryDiffType:a}}_adjustYAxisDiffType(t,e,i){if(!(t&&t.type&&e&&e.length&&i&&i.length))return;if(!t.options||!t.options.scales||!t.options.scales.y||t.options.scales.yDiffType)return;let s=t.type,a=t.options,o=a.scales,r=o.y,l=c().extend(!0,{},r);o.yDiffType=l,r.id="y",l.id="yDiffType",t.data&&t.data.datasets&&t.data.datasets.length&&t.data.datasets[0].type&&t.data.datasets[0].type!==s?(l.position=n.Position.LEFT,r.position=n.Position.RIGHT,r.grid.drawOnChartArea=!1):(r.position=n.Position.LEFT,l.position=n.Position.RIGHT,l.grid.drawOnChartArea=!1),r.grid.drawBorder=!0,r.grid.drawTicks=!0,l.grid.drawBorder=!0,l.grid.drawTicks=!0;let h=e[0].type||s,d=i[0].type||s,u=this.chart.session.text("ui."+h),p=this.chart.session.text("ui."+d),g=a.scaleLabelByTypeMap?a.scaleLabelByTypeMap[h]:null,f=a.scaleLabelByTypeMap?a.scaleLabelByTypeMap[d]:null;r.title.display=!0,r.title.text=g?g+" ("+u+")":u,l.title.display=!0,l.title.text=f?f+" ("+p+")":p,e.forEach((t=>{t.yAxisID="y"})),i.forEach((t=>{t.yAxisID="yDiffType"}))}_adjustAxisMaxMin(t,e,i){if(!t)return;let s=1;t.ticks=c().extend(!0,{},t.ticks,{maxTicksLimit:e}),i&&(t.suggestedMax=i.maxValue,t.suggestedMin=i.minValue,s=(i.maxValue-i.minValue)/(e-1)),t.ticks.stepSize=this.onlyIntegers&&s<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}}So(Lo,"ARROW_LEFT_RIGHT","↔"),So(Lo,"ARROW_UP_DOWN","↕");class Oo extends u{constructor(t){super(t),this.animationTriggered=!1,this.r,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 2===t.length&&1===t[0].values.length&&1===t[1].values.length}_renderInternal(){let t=this.chart.data,e=t.chartValueGroups[0].values[0],i=t.chartValueGroups[1].values[0];this.fullR=Math.min(this.chartBox.height,this.chartBox.width)/2-2,this._renderInnerCircle(),this._renderPercentage(e,i)}_renderPercentage(t,e){let i="fulfillment-chart",a=this.chart.data.chartValueGroups[0].colorHexValue,n=this.chart.data.chartValueGroups[0].cssClass;this.chart.config.options.autoColor?i+=" auto-color":n&&(i+=" "+n);let o=s.scout.nvl(this.chart.config.options.fulfillment.startValue,0),r=0,l=0;e&&(r=Math.min(t/e,.999999),l=Math.min(o/e,.999999)),this.r=this.fullR;let h=this,d=function(t,e){let i=c()(this),s=i.data("animation-start"),a=i.data("animation-end");i.attr("d",h.pathSegment(s*e.pos,l+(a-l)*e.pos))},u=this.$svg.appendSVG("path",i).data("animation-start",0).data("animation-end",r),p=this.fullR/8*6.7;this._renderCirclePath("fulfillment-chart-inner-circle-transparent","InnerCircle3",p).css("fill",this.firstOpaqueBackgroundColor);let g=e?Math.round(t/e*100):0,f=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(g+"%");this.chart.config.options.clickable&&u.on("click",this._createClickObject(null,null),this.chart._onValueClick.bind(this.chart)),this.chart.config.options.autoColor||n||u.attr("fill",a),this.animationDuration?(u.attr("d",this.pathSegment(0,l)).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(d,this.animationDuration)),f.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)):u.attr("d",this.pathSegment(0,r))}pathSegment(t,e){let i=2*t*Math.PI,s=2*e*Math.PI,a="";return a+="M"+(this.chartBox.mX()+this.r*Math.sin(i))+","+(this.chartBox.mY()-this.r*Math.cos(i)),a+="A"+this.r+", "+this.r,a+=e-t<.5?" 0 0,1 ":" 0 1,1 ",a+=this.chartBox.mX()+this.r*Math.sin(s)+","+(this.chartBox.mY()-this.r*Math.cos(s)),a+="L"+this.chartBox.mX()+","+this.chartBox.mY()+"Z",a}_renderCirclePath(t,e,i){let s=this.chart.data.chartValueGroups[0].cssClass,a=this.chart.data.chartValueGroups[1].colorHexValue;this.chart.config.options.autoColor?t+=" auto-color":s&&(t+=" "+s);let n=2*i,o=this.$svg.appendSVG("path",t).attr("id",e).attr("d","M "+this.chartBox.mX()+" "+this.chartBox.mY()+" m 0, "+-i+" a "+i+","+i+" 0 1, 1 0,"+n+" a "+i+","+i+" 0 1, 1 0,"+-n);return this.chart.config.options.autoColor||s||o.attr("fill",a).attr("stroke",a),o}_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=s.objects.optProperty(this.chart,"config","options","fulfillment","startValue");return!!s.objects.isNullOrUndefined(e)&&super.shouldAnimateRemoveOnUpdate(t)}_removeAnimated(t){if(this.animationTriggered)return;let e=this;this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,i){let s=c()(this),a=s.data("animation-start"),n=s.data("animation-end");s.attr("d",e.pathSegment(a*(1-i.pos),n*(1-i.pos)))}))).promise().done((()=>{this._remove(t),this.animationTriggered=!1}))}}function Do(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class Po extends u{constructor(t){super(t),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||1!==t.chartValueGroups.length||3!==t.chartValueGroups[0].values.length||void 0===e.options.speedo.greenAreaPosition)}_renderInternal(){let t=this.chart.data,e=t.chartValueGroups[0].values[0],i=t.chartValueGroups[0].values[2],s=t.chartValueGroups[0].values[1];this.r=.7*Math.min(this.chartBox.height,this.chartBox.width/2),this.scaleWeight=.27*this.r,this.my=this.chartBox.yOffset+this.chartBox.height-(this.chartBox.height-1.12*this.r)/2,this.parts=this.chart.config.options.speedo.greenAreaPosition===Po.Position.CENTER?Po.NUM_PARTS_GREEN_CENTER:Po.NUM_PARTS_GREEN_EDGE,this.numSegmentsPerPart=this.parts===Po.NUM_PARTS_GREEN_CENTER?5:8,this.$filledParts=[];let a=this.parts*this.numSegmentsPerPart,n=a-1;this.segmentWidth=(Po.ARC_RANGE-n*Po.SEGMENT_GAP)/a,this.widthOfSegmentWithGap=this.segmentWidth+Po.SEGMENT_GAP;let o=this._limitValue((s-e)/(i-e),1),r=Math.round(o*n),l=this._getPercentageValueOfSegment(r%this.numSegmentsPerPart,this._getPartForValue(o));for(let t=0;t<this.parts;t++)this._renderCirclePart(t);this._renderPointer(l),this._renderLegend(e,s,i,t.chartValueGroups[0].groupName),this.$svg.addClass("speedo-chart-svg"),this.chart.config.options.clickable&&this.$svg.on("click",this._createClickObject(null,null),this.chart._onValueClick.bind(this.chart))}_limitValue(t,e){return t=Math.max(t,0),t=Math.min(t,e)}_getPercentageValueOfSegment(t,e){let i=this._calcSegmentPos(t,e),s=i.from-Po.ARC_MIN+(i.to-i.from)/2;return this._limitValue(s/Po.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 t=this,e=function(e,i){let s=this.getAttribute("data-end")*i.pos;t._updatePointer(s),t._updatePartsFill(s)};this.$pointer.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(e,this.animationDuration))}else this._updatePointer(t),this._updatePartsFill(t)}_renderSegment(t,e,i){return this.$svg.appendSVG("path","speedo-chart-arc "+i).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 i=0;i<this.numSegmentsPerPart;i++){let s=this._calcSegmentPos(i,t);this._renderSegment(s.from,s.to,e)}this.$filledParts.push(this._renderSegment(Po.ARC_MIN,Po.ARC_MIN,e))}_renderLegend(t,e,i,s){let a=.8*this.scaleWeight,n=this.my+5,o=n+.8*a,r=this.chartBox.mX()-5,l=n,h=-1,c=t?this._formatValue(t):0,d=e?this._formatValue(e):0,u=i?this._formatValue(i):0;if(this.chart.config.options.plugins.tooltip.enabled){let t=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()-this.r).attr("y",o).text(c).attr("style","font-size: "+a+"px; text-anchor: middle"),e=this.$svg.appendSVG("text","line-label line-chart-wire-label").attr("x",this.chartBox.mX()+this.r).attr("y",o).text(u).attr("style","font-size: "+a+"px; text-anchor: middle"),i=function(){this.$svg.append(t),this.$svg.append(e)}.bind(this),s=()=>{t.detach(),e.detach()};s(),this.$svg.mouseenter(i).mouseleave(s)}this.chart.config.options.plugins.legend.display&&this._renderLineLabel(r+5,l+5*h,d,"",!1).addClass("speedo-chart-label").attr("style","font-size: "+1.55*this.scaleWeight+"px;")}_getPartForValue(t){let e=Math.floor(t*this.parts);return this._limitValue(e,this.parts-1)}_formatValue(t){if(t<Po.TEN_THOUSAND)return this.session.locale.decimalFormat.format(t);if(t<Po.ONE_MILLION)return Math.floor(t/Po.ONE_THOUSAND)+"k";let e=t/Po.ONE_MILLION;return e=s.numbers.round(e,s.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,i;for(let s=0;s<this.$filledParts.length;s++)e=this._calcSegmentPos(0,s,this.segmentWidth).from,(s+1)/this.parts<t?i=this._calcSegmentPos(this.numSegmentsPerPart-1,s,this.segmentWidth).to:s/this.parts>t?(e=Po.ARC_MIN,i=Po.ARC_MIN):i=Po.ARC_RANGE*t-Po.ARC_MAX,this.$filledParts[s].attr("d",this._pathSegment(e,i))}_calcSegmentPos(t,e){let i={from:0,to:0},s=t+e*this.numSegmentsPerPart;return i.from=s*this.widthOfSegmentWithGap-Po.ARC_MAX,i.to=i.from+this.segmentWidth,i}_getColorForPart(t){switch(this.chart.config.options.speedo.greenAreaPosition){case Po.Position.LEFT:if(0===t)return"dark-green";if(1===t)return"light-green";if(2===t)return"yellow";if(3===t)return"red";break;case Po.Position.RIGHT:if(0===t)return"red";if(1===t)return"yellow";if(2===t)return"light-green";if(3===t)return"dark-green";break;case Po.Position.CENTER:if(0===t)return"red";if(1===t)return"yellow";if(2===t)return"light-green";if(3===t)return"dark-green";if(4===t)return"light-green";if(5===t)return"yellow";if(6===t)return"red"}}_pathSegment(t,e){let i=2*t*Math.PI,s=2*e*Math.PI,a="";return a+="M "+(this.chartBox.mX()+this.r*Math.sin(i))+" "+(this.my-this.r*Math.cos(i))+" ",a+="A "+this.r+" "+this.r+" ",a+="0 "+(e-t<.5?"0":"1")+" 1 ",a+=this.chartBox.mX()+this.r*Math.sin(s)+" "+(this.my-this.r*Math.cos(s)),a}_pathPointer(t){let e=2*(Po.ARC_RANGE*t-Po.ARC_MAX)*Math.PI,i=this.r-1.4*this.scaleWeight,s=this.r+1.37*this.scaleWeight,a="";return a+="M "+(this.chartBox.mX()+s*Math.sin(e))+" "+(this.my-s*Math.cos(e))+" ",a+="L "+(this.chartBox.mX()+i*Math.sin(e))+" "+(this.my-i*Math.cos(e))+" ",a+="Z",a}_removeAnimated(t){if(this.animationTriggered)return;let e=this;this.animationTriggered=!0,this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,i){let s=this.getAttribute("data-end")*(1-i.pos);e._updatePointer(s),e._updatePartsFill(s)}))).promise().done((()=>{this._remove(t),this.animationTriggered=!1}))}}Do(Po,"Position",{LEFT:"left",CENTER:"center",RIGHT:"right"}),Do(Po,"NUM_PARTS_GREEN_CENTER",7),Do(Po,"NUM_PARTS_GREEN_EDGE",4),Do(Po,"ONE_THOUSAND",1e3),Do(Po,"TEN_THOUSAND",1e4),Do(Po,"ONE_MILLION",1e6),Do(Po,"ARC_MIN",-.25),Do(Po,"ARC_MAX",.25),Do(Po,"ARC_RANGE",Po.ARC_MAX-Po.ARC_MIN),Do(Po,"SEGMENT_GAP",.0103);class Bo extends u{constructor(t){super(t),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||0===t.chartValueGroups.length||0===t.chartValueGroups[0].values.length||void 0===e.options.salesfunnel.normalized||void 0===e.options.salesfunnel.calcConversionRate)}_renderInternal(){let t=this.chart.data,e=t.chartValueGroups.length;this.conversionRateWidth=this._dynamicConversionRateWidth(),this.dataAnalyzeResult=this._analyzeData(t.chartValueGroups),this.paddingBetweenLabel=20,this.barHeight=this.chartBox.height/e,this.barAreaHeight=this.barHeight*e,this.barAreaWidth=this.chartBox.width-this.dataAnalyzeResult.maxLengthFirstValueRow-this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount-this.dataAnalyzeResult.maxLengthSecondValueRow-this.conversionRateWidth,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,i=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*(this.dataAnalyzeResult.labelCount+1),s=this.barAreaWidth*(1-this.barDeltaPercentage),a=this.barAreaWidth*this.lastBarMinWidthPercentage/this.lastBarAdditionalPercentage;s=Math.min(s,(this.barAreaWidth-a)/(e-1));for(let a=0;a<e;a++){let n=this.barAreaWidth-a*s,o=t[a].groupName,r=this.barAreaWidth-(a+1)*s,l=a*this.barHeight,h={xStart:this.centerX,yStart:l,rect:!0,width:n,widthBottom:r,cssClass:"salesfunnel-chart-bar",fill:t[a].colorHexValue,label:t[a].groupName,clickObject:this._createClickObject(null,a)};this.chart.config.options.autoColor?h.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[a].cssClass&&(h.cssClass+=" "+this.chart.data.chartValueGroups[a].cssClass),a===e-1&&(h.width=h.width*this.lastBarAdditionalPercentage,h.widthBottom=h.widthBottom*this.lastBarAdditionalPercentage),this._renderPolygon(h),this._renderLabel(t[a].values[0],!1,a),this._renderBarLabel(o,a,h.widthBottom);let c=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;t[a].values.length>1&&(this._renderLabel(t[a].values[1],!0,a),c+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),a>0&&(this._renderLabelSeparatorLine(l,c),this.chart.config.options.salesfunnel.calcConversionRate&&this._renderConversionRate(a,i,this._calcConversionRate(t[a-1].values[0],t[a].values[0])))}}_renderLabel(t,e,i){if(null===t)return;let s=i*this.barHeight+this.barHeight/2,a=this.dataAnalyzeResult.maxLengthFirstValueRow+(e?this.dataAnalyzeResult.maxLengthSecondValueRow:0),n=e?2:1,o=this.barAreaWidth+a+n*this.paddingBetweenLabel,r=this._dynamicCssClass("salesfunnel-label"),l=this.$svg.appendSVG("text",r).attr("x",o).attr("y",s).text(this.session.locale.decimalFormat.format(t));if(this.animationDuration&&l.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0),this.chart.config.options.plugins.tooltip.enabled&&this.chart.data.axes.length>0){let a=this.chart.data.axes[i][e?1:0].label,n=this._measureText(t,r);this._renderWireLabels(a,l,o-n.width/2,s-n.height)}}_renderWireLabels(t,e,i,s){let a={x1:i,x2:i-10,y1:s,y2:s-10,v:-1,h:-1};a.autoPosition=!0,a.posFunc=(t,e)=>(a.y2-e<0&&(a.v=1,a.y1=a.y1+1.5*e,a.y2=a.y1+10),a);let n=this._renderWireLegend(t,a,"line-chart-wire-label","wire-label-line-white",!1),o=n.attachFunc.bind(n),r=n.detachFunc.bind(n);n.detachFunc(),e.mouseenter(o).mouseleave(r)}_renderBarLabel(t,e,i){let s=e*this.barHeight+this.barHeight/2,a=this.centerX,n=this._dynamicCssClass("salesfunnel-bar-label");this._renderLineLabel(a,s,t,n,!0)}_renderConversionRate(t,e,i){if(void 0===i)return;let s=t*this.barHeight,a=this._dynamicCssClass("salesfunnel-conversionrate-label"),n=this.$svg.appendSVG("text",a).attr("x",e).attr("y",s).text("↓ "+i+"%");this.animationDuration&&n.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_renderPolygon(t){let e=this,i=this._calcPolygonPoints(!0,this.animationDuration?0:1,t.xStart,t.yStart,t.width,t.widthBottom,this.barHeight-1),s=this.$svg.appendSVG("polygon",t.cssClass,"",t.id).attr("points",i).attr("opacity",t.opacity).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&&s.attr("fill",t.fill),s.css("stroke",this.firstOpaqueBackgroundColor);let a=function(t,i){let s=c()(this),a=s.data("xStart"),n=s.data("yStart"),o=s.data("widthBar"),r=s.data("heightBar"),l=s.data("widthBottom");s.attr("points",e._calcPolygonPoints(!0,i.pos,a,n,o,l,r))};return this.animationDuration&&s.animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval(a,this.animationDuration)),this.chart.config.options.clickable&&s.on("click",t.clickObject,this.chart._onValueClick.bind(this.chart)),t.fill&&s.attr("fill",t.fill),s}_calcPolygonPoints(t,e,i,s,a,n,o){let r=0,l=0;t?(r=a/2*e,l=n/2*e):(r=a/2-a/2*e,l=n/2-n/2*e);let h=s+o;return i-r+","+s+" "+(i+r)+","+s+" "+(i+l)+","+h+" "+(i-l)+","+h+" "}_renderBarsAccordingToValues(t){let e=this.dataAnalyzeResult.maxValue?.8*this.barAreaWidth/this.dataAnalyzeResult.maxValue:0,i=this.barAreaWidth+this.dataAnalyzeResult.maxLengthFirstValueRow+this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel*this.dataAnalyzeResult.labelCount+2*this.paddingBetweenLabel,s=t.length;for(let a=0;a<s;a++){let s=t[a].values[0]*e+.2*this.barAreaWidth,n=t[a].groupName,o=a*this.barHeight,r={xStart:this.centerX,yStart:o,rect:!0,width:s,widthBottom:s,cssClass:"salesfunnel-chart-bar",fill:t[a].colorHexValue,label:t[a].groupName,clickObject:this._createClickObject(null,a)};this.chart.config.options.autoColor?r.cssClass+=" auto-color color0":this.chart.data.chartValueGroups[a].cssClass&&(r.cssClass+=" "+this.chart.data.chartValueGroups[a].cssClass),this._renderPolygon(r),this._renderLabel(t[a].values[0],!1,a),this._renderBarLabel(n,a,r.widthBottom);let l=this.dataAnalyzeResult.maxLengthFirstValueRow+this.paddingBetweenLabel;t[a].values.length>1&&(this._renderLabel(t[a].values[1],!0,a),l+=this.dataAnalyzeResult.maxLengthSecondValueRow+this.paddingBetweenLabel),a>0&&(this._renderLabelSeparatorLine(o,l),this.chart.config.options.salesfunnel.calcConversionRate&&this._renderConversionRate(a,i,this._calcConversionRate(t[a-1].values[0],t[a].values[0])))}}_renderLabelSeparatorLine(t,e){let i=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&&i.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_calcConversionRate(t,e){if(!s.objects.isNullOrUndefined(t)&&!s.objects.isNullOrUndefined(e)&&0!==t)return Math.round(e/t*100)}_analyzeData(t){let e={labelCount:0,maxValue:null,maxLengthFirstValueRow:0,maxLengthSecondValueRow:0},i=this._dynamicCssClass("salesfunnel-label");for(let s=0;s<t.length;s++){let a=t[s];e.labelCount=Math.max(e.labelCount,a.values.length),a.values.length>0&&a.values[0]&&(null===e.maxValue?e.maxValue=a.values[0]:e.maxValue=Math.max(e.maxValue,a.values[0]),e.maxLengthFirstValueRow=Math.max(e.maxLengthFirstValueRow,this._measureText(this.session.locale.decimalFormat.format(a.values[0]),i).width)),a.values.length>1&&a.values[1]&&(e.maxLengthSecondValueRow=Math.max(e.maxLengthSecondValueRow,this._measureText(this.session.locale.decimalFormat.format(a.values[1]),i).width))}return e}_removeAnimated(t){if(this.animationTriggered)return;this.animationTriggered=!0;let e=this;this.$svg.children(this.segmentSelectorForAnimation).animate({tabIndex:0},this._createAnimationObjectWithTabIndexRemoval((function(t,i){let s=c()(this),a=s.data("xStart"),n=s.data("yStart"),o=s.data("widthBar"),r=s.data("heightBar"),l=s.data("widthBottom");s.attr("points",e._calcPolygonPoints(!1,i.pos,a,n,o,l,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"),s.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}}class Eo{constructor(t,e,i,s,a,n,o,r,l,h,c,d,u,p){0===a&&0===r&&0===l&&0===c&&(a=1),0===n&&0===r&&0===h&&0===c&&(n=1),0===o&&0===l&&0===h&&0===c&&(o=1),this.helper=t,this.venn1=e,this.venn2=i,this.venn3=s,this.u=a,this.v=n,this.w=o,this.uv=r,this.uw=l,this.vw=h,this.uvw=c,this.maxD=this.venn1.r+2*this.venn2.r+2*this.venn1.r+this.helper.distR,this.dStep=this.maxD/30,this.rStep=s.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)<Math.PI?setTimeout(this._next.bind(this,t)):this._end())}_iteration(t){let e=this.maxD,i=this.dStep,s=this.helper.minR,a=this.rStep,n=this.helper.total,o=this.venn1.x,r=this.venn1.y,l=this.venn1.r,h=this.venn2.x,c=this.venn2.y,d=this.venn2.r,u=this.venn3.r,p=this.u,g=this.v,f=this.w,m=this.uv,b=this.uw,x=this.vw,_=this.uvw,y=this.alphaBest,v=this.dBest,C=this.rBest,k=this.errorBest;for(let T=0;T<e;T+=i){let i=o+T*Math.cos(t),A=r-T*Math.sin(t);for(let M=Math.max(s,.75*u);M<=1.25*u;M+=a){let s=Math.min(o-l,h-d,i-M),a=Math.max(o+l,h+d,i+M),u=Math.min(r-l,c-d,A-M),S=Math.max(r+l,c+d,A+M),w=(a-s)/100,R=(S-u)/100,L=0,O=0,D=0,P=0,B=0,E=0,I=0;for(let t=s;t<a;t+=w)for(let e=u;e<S;e+=R){let s=(t-o)*(t-o)+(e-r)*(e-r)<l*l,a=(t-h)*(t-h)+(e-c)*(e-c)<d*d,n=(t-i)*(t-i)+(e-A)*(e-A)<M*M;s&&a&&n?I++:s&&a&&!n?P++:!s||a||n?s||!a||n?s&&!a&&n?B++:!s&&a&&n?E++:s||a||!n||D++:O++:L++}let V=L+O+D+P+B+E+I,F=T/e;F+=this._error(_,n,I,V),F+=this._error(m,n,P,V),F+=this._error(b,n,B,V),F+=this._error(x,n,E,V),F+=this._error(p,n,L,V),F+=this._error(g,n,O,V),F+=this._error(f,n,D,V),(0===t||F<k)&&(y=t,v=T,C=M,k=F)}}this.alphaBest=y,this.dBest=v,this.rBest=C,this.errorBest=k}_error(t,e,i,s){return 0===t&&0!==i||0!==t&&0===i?1e3:100*Math.abs(t/e-i/s)}}class Io{constructor(t,e,i,s){this.distR=t,this.maxR=e,this.minR=i,this.total=s}findBalance2(t,e){let i=(t.r*t.x+e.r*e.x)/(t.r+e.r),s=(t.r*t.y+e.r*e.y)/(t.r+e.r);t.x=t.x-i,e.x=e.x-i,t.y=t.y-s,e.y=e.y-s}findBalance3(t,e,i){let s=(t.r*t.x+e.r*e.x+i.r*i.x)/(t.r+e.r+i.r),a=(t.r*t.y+e.r*e.y+i.r*i.y)/(t.r+e.r+i.r);t.x=t.x-s,e.x=e.x-s,i.x=i.x-s,t.y=t.y-a,e.y=e.y-a,i.y=i.y-a}calcR(t,e){return-1===t?this.maxR*e:Math.max(this.minR,Math.sqrt(t/this.total)*this.maxR*e)}calcD(t,e,i,s,a,n){let o;if(0===a)o=t.r+e.r+2*this.distR;else if(0===i&&0===s)o=0;else if(0===i)o=Math.max(0,e.r-t.r-this.distR),o<1.5*this.distR&&n&&(o=1.5*this.distR,t.r=e.r-o);else if(0===s)o=Math.max(0,t.r-e.r-this.distR),o<1.5*this.distR&&n&&(o=1.5*this.distR,e.r=t.r-o);else{let n=Math.min(t.r,e.r),r=Math.max(t.r,e.r);o=2*(Math.min(i,s)/(Math.min(i,s)+a))*n-n+r,o=Math.max(3*this.distR,o),o=Math.min(n+r-3*this.distR,o),o=Math.max(r-n+3*this.distR,o)}return o}}class Vo extends u{constructor(t){super(t),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||0!==t.axes.length||0===t.chartValueGroups.length||0===t.chartValueGroups[0].values.length)}_renderInternal(){if(this.centerX=this.width/2,this.centerY=this.height/2,0===this.centerX||0===this.centerY)return!1;this.data=this.chart.data.chartValueGroups,this.numberOfCircles=this.chart.config.options.venn.numberOfCircles;let t=Math.min(this.centerX,this.centerY),e=t/15,i=this.data.reduce(((t,e)=>t+parseFloat(e.values[0])),1);this.vennCircleHelper=new Io(10,t,e,i),this.numberOfCircles>0&&(this.$v1=this._createCircle(0,this.data[0].colorHexValue,this.data[0].cssClass),this.vennNumber1=new Fo(this.$v1),this.vennReal1=new Fo(this.$v1)),this.numberOfCircles>1&&(this.$v2=this._createCircle(1,this.data[1].colorHexValue,this.data[1].cssClass),this.vennNumber2=new Fo(this.$v2),this.vennReal2=new Fo(this.$v2)),this.numberOfCircles>2&&(this.$v3=this._createCircle(2,this.data[2].colorHexValue,this.data[2].cssClass),this.vennNumber3=new Fo(this.$v3),this.vennReal3=new Fo(this.$v3));let s=function(){this.readyToDraw=!0,this.$svg.isAttached()&&(this.readyToDraw=!1,this._draw(!0,!0))}.bind(this);this.readyToDraw=!1,1===this.numberOfCircles?(this._calc1(this.vennNumber1),this._calc1(this.vennReal1),s()):2===this.numberOfCircles?(this._calc2(this.vennNumber1,this.vennNumber2,!1),this._calc2(this.vennReal1,this.vennReal2,!0),s()):3===this.numberOfCircles&&this._calc3(this.vennNumber1,this.vennNumber2,this.vennNumber3,!1,(()=>{(this.rendering||this.rendered)&&this._calc3(this.vennReal1,this.vennReal2,this.vennReal3,!0,s)}))}remove(t,e){this._cancelAsync3Calculator(),super.remove(t,e)}_calc1(t){let e=this.data[0].values[0];t.r=e>0?this.vennCircleHelper.calcR(e,.8):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,i){let s,a=this.data[0].values[0],n=this.data[1].values[0],o=this.data[2].values[0];i?(t.r=this.vennCircleHelper.calcR(a+o,.8),e.r=this.vennCircleHelper.calcR(n+o,.8),s=this.vennCircleHelper.calcD(t,e,a,n,o,!0),t.x=0,e.x=s):(t.r=e.r=this.vennCircleHelper.calcR(-1,.7),t.x=.6*-t.r,e.x=.6*e.r),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),i?0===o?(t.addLabel(a,t.x,t.y),e.addLabel(n,e.x,e.y)):0===a&&0===n?t.addLabel(o,t.x,t.y):0===a?(e.addLabel(o,t.x,t.y),e.addLabel(n,e.x-(s-e.r-t.r)/2,e.y),t.legendR=e.r-s):0===n?(t.addLabel(o,e.x,e.y),t.addLabel(a,t.x+(s-e.r-t.r)/2,t.y),e.legendR=t.r-s):(t.addLabel(a,t.x+(s-e.r-t.r)/2,t.y),t.addLabel(n,e.x-(s-e.r-t.r)/2,e.y),e.addLabel(o,t.x+t.r+(s-e.r-t.r)/2,t.y)):(t.addLabel(a,.9*-t.r,0),t.addLabel(n,.9*t.r,0),e.addLabel(o,0,0))}_calc3(t,e,i,s,a){let n,o,r,l=this.data[0].values[0],h=this.data[1].values[0],c=this.data[2].values[0],d=this.data[3].values[0],u=this.data[4].values[0],p=this.data[5].values[0],g=this.data[6].values[0];s?(t.r=this.vennCircleHelper.calcR(l+d+u+g,.55),e.r=this.vennCircleHelper.calcR(h+d+p+g,.55),i.r=this.vennCircleHelper.calcR(c+u+p+g,.55),n=this.vennCircleHelper.calcD(t,e,l+u,h+p,d+g,!0),o=this.vennCircleHelper.calcD(t,i,l+d,c+p,d+g,!1),r=this.vennCircleHelper.calcD(e,i,h+d,c+u,d+g,!1),t.x=0,e.x=n,i.x=o,t.y=0,e.y=0,i.y=0,this._cancelAsync3Calculator(),this.async3Calculator=new Eo(this.vennCircleHelper,t,e,i,l,h,c,d,u,p,g,n,o,r),this.async3Calculator.start((()=>{this.async3Calculator=null,this.vennCircleHelper.findBalance3(t,e,i),t.setLegend(this.data[0].groupName,-1,1),e.setLegend(this.data[1].groupName,1,1),i.setLegend(this.data[2].groupName,1,-1),a()}))):(t.r=e.r=i.r=this.vennCircleHelper.calcR(-1,.55),t.x=.73*-t.r,e.x=.73*e.r,i.x=0,t.y=.58*t.r,e.y=.58*e.r,i.y=.58*-i.r,t.setLegend(this.data[0].groupName,-1,1),e.setLegend(this.data[1].groupName,1,1),i.setLegend(this.data[2].groupName,1,-1),t.addLabel(l,-t.r,.76*t.r),e.addLabel(h,t.r,.76*t.r),i.addLabel(c,0,.82*-t.r),t.addLabel(d,0,.76*t.r),t.addLabel(u,.49*-t.r,.05*-t.r),e.addLabel(p,.49*t.r,.05*-t.r),t.addLabel(g,0,.22*t.r),a())}_cancelAsync3Calculator(){this.async3Calculator&&(this.async3Calculator.cancel(),this.async3Calculator=null)}_draw(t,e){if(!this.rendered&&!this.rendering)return;if(this.animationTriggered)return;this.animationTriggered=!0;let i=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(),i.animationTriggered=!1}));let s=[];this.numberOfCircles>0&&s.push(e?this.vennReal1:this.vennNumber1),this.numberOfCircles>1&&s.push(e?this.vennReal2:this.vennNumber2),this.numberOfCircles>2&&s.push(e?this.vennReal3:this.vennNumber3);for(let e=0;e<s.length;e++){let i=s[e];this._updateVenn(i,t);for(let e=0;e<i.labels.length;e++){let s=i.labels[e];this._drawLabel(s.text,s.x,s.y,t)}}}_createCircle(t,e,i){let s=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?s.addClass("auto-color color0"):i?s.addClass(i):s.attr("fill",e),this.chart.config.options.clickable&&s.on("click",this._createClickObject(null,t),this.chart._onValueClick.bind(this.chart)),s}_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 i=this.vennCircleHelper.minR,s=this.centerX+t.x+t.legendH*Math.sin(Math.PI/5)*t.r,a=this.centerY+t.y+t.legendV*Math.cos(Math.PI/5)*t.r,n={x1:s,x2:this.centerX+t.x+t.legendH*Math.sin(Math.PI/5)*(t.legendR+1.5*i),y1:a,y2:this.centerY+t.y+t.legendV*Math.cos(Math.PI/5)*(t.legendR+1.5*i),v:t.legendV,h:t.legendH};this._renderWireLegend(t.legend,n,"venn-legend")}_drawLabel(t,e,i,s){let a=this.$svg.appendSVG("text","venn-label").attr("x",this.centerX+e).attr("y",this.centerY+i).text(t);s&&this.animationDuration&&a.attr("opacity",0).animateSVG("opacity",1,this.animationDuration,null,!0)}_show(t){if(1===this.numberOfCircles)return;let e="mouseenter"===t.type?t.target:t.relatedTarget,i=e&&c()(e).hasClass("venn-circle");if(this.wasCircle&&i)return!1;this.wasCircle=i,this._draw(!0,t.data.showReal)}}class Fo{constructor(t){this.$circle=t,this.x,this.y,this.r,this.legend,this.legendR,this.legendH,this.legendV,this.labels=[]}setLegend(t,e,i,s){this.legend=t,this.legendH=e,this.legendV=i,this.legendR=s||this.r}addLabel(t,e,i){this.labels.push({text:t,x:e,y:i})}}class No extends s.FormField{constructor(){super(),this._addWidgetProperties(["chart"])}_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 Ho extends s.FormFieldAdapter{constructor(){super()}}class zo extends s.FormFieldTile{constructor(){super(),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 jo extends s.FormFieldTileAdapter{constructor(){super()}}function Wo(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class Go extends s.TableControl{constructor(){super(),this.tooltipText="${textKey:ui.Chart}",this.chartAggregation={modifier:s.TableMatrix.NumberGroup.COUNT},this.chartType=n.Type.BAR,this.oldChartType=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=s.scout.create("Chart",{parent:this})}_destroy(){this.table.off("columnStructureChanged",this._tableColumnStructureChangedHandler),super._destroy()}_computeEnabled(t,e){return!(!this._hasColumns()&&!this.selected)&&super._computeEnabled(t,e)}_renderChart(){this.chart&&(this.chart.render(this.$contentContainer),this.chart.$container.addClass(this.denseClass))}_createLayout(){return new qo(this)}_renderChartType(){this._selectChartType(),this.$yAxisSelect.toggleClass("hide",this.chartType!==n.Type.BUBBLE),this.$yAxisSelect.toggleClass("animated",s.scout.isOneOf(n.Type.BUBBLE,this.chartType,this.oldChartType)&&!!this.oldChartType),this.$yAxisSelect.data("scroll-shadow").setVisible(!1),this.$yAxisSelect.oneAnimationEnd((()=>{s.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(){s.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,i="_"+e+"Map",s=this[e];if(s){let t=this[i][s.id];if(t.siblings(".select-axis").animateAVCSD("height",30),t.selectOne("selected"),s.modifier>0){let e=s.modifier^Go.DATE_GROUP_FLAG;t.animateAVCSD("height",42),t.children(".select-axis-group").text(this.dateGroup[e][1])}this.contentRendered&&this._drawChart()}}_renderChartAggregation(){let t=this._aggregationMap[this.chartAggregation.id||"all"];t&&(t.selectOne("selected"),t.removeClass("data-sum").removeClass("data-avg"),t.addClass(this._getAggregationCssClass()),this.contentRendered&&this._drawChart())}_getAggregationCssClass(){switch(this.chartAggregation.modifier){case s.TableMatrix.NumberGroup.COUNT:return"data-count";case s.TableMatrix.NumberGroup.SUM:return"data-sum";case s.TableMatrix.NumberGroup.AVG:return"data-avg";default:return null}}_renderChartSelect(t,e,i){let a=s.scout.create("Icon",{parent:this,iconDesc:i,cssClass:t});a.render(this.$chartSelect),this.$contentContainer.one("remove",(()=>a.destroy()));let n=a.$container;n.toggleClass("disabled",!this.enabledComputed||!this._hasColumns()).data("chartType",e),this.enabledComputed&&this._hasColumns()&&n.on("click",this._onClickChartType.bind(this)),this._chartTypeMap[e]=n}_renderChartSelectContainer(){this.$chartSelect=this.$contentContainer.appendDiv("chart-select"),this._chartTypeMap={};let t=this._getSupportedChartTypes();s.scout.isOneOf(n.Type.BAR,t)&&this._renderChartSelect("chart-bar",n.Type.BAR,s.icons.DIAGRAM_BARS_VERTICAL),s.scout.isOneOf(n.Type.BAR_HORIZONTAL,t)&&this._renderChartSelect("chart-stacked",n.Type.BAR_HORIZONTAL,s.icons.DIAGRAM_BARS_HORIZONTAL),s.scout.isOneOf(n.Type.LINE,t)&&this._renderChartSelect("chart-line",n.Type.LINE,s.icons.DIAGRAM_LINE),s.scout.isOneOf(n.Type.PIE,t)&&this._renderChartSelect("chart-pie",n.Type.PIE,s.icons.DIAGRAM_PIE),s.scout.isOneOf(n.Type.BUBBLE,t)&&this._renderChartSelect("chart-bubble",n.Type.BUBBLE,s.icons.DIAGRAM_SCATTER)}_getSupportedChartTypes(){return[n.Type.BAR,n.Type.BAR_HORIZONTAL,n.Type.LINE,n.Type.PIE,n.Type.BUBBLE]}_onClickChartType(t){let e=c()(t.currentTarget).data("chartType");this.setChartType(e)}_onClickChartGroup(t){let e=c()(t.currentTarget),i=e.parent().data("groupId"),s=e.data("column"),a=e.data("modifier");if(!e.isEnabled())return;let n=e.isSelected()?this._nextDateModifier(a):a;e.data("modifier",n);let o={id:s?s.id:null,modifier:n};this._setChartGroup(i,o)}_onClickAggregation(t){let e=c()(t.currentTarget),i=e.data("modifier"),s=e.isSelected()?this._nextModifier(i):i;e.data("modifier",s);let a=e.data("column"),n={id:a?a.id:null,modifier:s};this._setChartAggregation(n)}_nextDateModifier(t){switch(t){case s.TableMatrix.DateGroup.DATE:return s.TableMatrix.DateGroup.MONTH;case s.TableMatrix.DateGroup.MONTH:return s.TableMatrix.DateGroup.WEEKDAY;case s.TableMatrix.DateGroup.WEEKDAY:return s.TableMatrix.DateGroup.YEAR;case s.TableMatrix.DateGroup.YEAR:return s.TableMatrix.DateGroup.DATE;default:return t}}_nextModifier(t){switch(t){case s.TableMatrix.NumberGroup.SUM:return s.TableMatrix.NumberGroup.AVG;case s.TableMatrix.NumberGroup.AVG:return s.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 i="chartGroup"+t;this._changeProperty(i,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 0!==this.table.columns.length}_axisCount(t,e){let i,s;for(i=0;i<t.length;i++)if(s=t[i][0],s===e)return t[i][1];return 0}_plainAxisText(t,e){if(t.headerHtmlEnabled){return s.strings.plainText(e).replace(/\n/g," ")}return e}_renderContent(t){this.$contentContainer=t.appendDiv("chart-container"),this._installScrollbars(),this._renderChartSelectContainer(),this.dateGroup=[[s.TableMatrix.DateGroup.YEAR,this.session.text("ui.groupedByYear")],[s.TableMatrix.DateGroup.MONTH,this.session.text("ui.groupedByMonth")],[s.TableMatrix.DateGroup.WEEKDAY,this.session.text("ui.groupedByWeekday")],[s.TableMatrix.DateGroup.DATE,this.session.text("ui.groupedByDate")]],this._filterResetListener=this.table.on("filterReset",(t=>{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),s.scrollbars.install(this.$xAxisSelect,{parent:this,session:this.session,axis:"y"}),this.$yAxisSelect=this.$axisSelectContainer.appendDiv("yaxis-select").data("groupId",2),s.scrollbars.install(this.$yAxisSelect,{parent:this,session:this.session,axis:"y"}),this._chartGroup1Map={},this._chartGroup2Map={};let t=new s.TableMatrix(this.table,this.session),e=t.columnCount(!1);e.sort(((t,e)=>Math.abs(t[1]-8)-Math.abs(e[1]-8)));let i,a,n=t.columns(!1);for(let t=0;t<n.length;t++){let o,r,l,h=n[t];h instanceof s.DateColumn?a=!0:(i=this._axisCount(e,h),a=i<=Go.MAX_AXIS_COUNT),o=this._axisContentForColumn(h),r=this.$contentContainer.makeDiv("select-axis",this._plainAxisText(h,o.text)).data("column",h).setEnabled(a),a||(this.chartGroup1&&this.chartGroup1.id===h.id&&(this.chartGroup1=null,this.chartGroup2=null),this.chartGroup2&&this.chartGroup2.id===h.id&&(this.chartGroup2=null)),o.icon&&r.addClass(o.icon.appendCssClass("font-icon")),h instanceof s.DateColumn&&r.data("modifier",s.TableMatrix.DateGroup.YEAR).appendDiv("select-axis-group",this.dateGroup[0][1]),a?(r.on("click",this._onClickChartGroup.bind(this)),s.tooltips.installForEllipsis(r,{parent:this})):s.tooltips.install(r,{parent:this,text:this.session.text("ui.TooMuchData")}),l=r.clone(!0),this._chartGroup1Map[h.id]=r,this._chartGroup2Map[h.id]=l,this.$xAxisSelect.append(r),this.$yAxisSelect.append(l)}if(this._aggregationMap={},this._hasColumns()){this.$dataSelect=this.$axisSelectContainer.appendDiv("data-select"),s.scrollbars.install(this.$dataSelect,{parent:this,session:this.session,axis:"y"});let t=this.session.text("ui.Count");this._aggregationMap.all=this.$dataSelect.appendDiv("select-data data-count",t).data("column",null).data("modifier",s.TableMatrix.NumberGroup.COUNT);for(let t=0;t<n.length;t++){let e=n[t],i=t+1;if(e instanceof s.NumberColumn){let t;t=s.strings.hasText(e.text)?this._plainAxisText(e,e.text):s.strings.hasText(e.headerTooltipText)?e.headerTooltipText:"["+i+"]",this._aggregationMap[e.id]=this.$dataSelect.appendDiv("select-data data-sum",t).data("column",e).data("modifier",s.TableMatrix.NumberGroup.SUM)}}c()(".select-data",this.$contentContainer).on("click",this._onClickAggregation.bind(this))}return e}_initializeSelection(t){let e;this.chartType||this.setChartType(n.Type.BAR),this.chartAggregation&&this._aggregationMap[this.chartAggregation.id]||this._setChartAggregation({id:null,modifier:s.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,i,s){let a=this._getDefaultSelectedColumn(e,i,s);a&&this._setChartGroup(t,this._getDefaultChartGroup(a))}_getDefaultSelectedColumn(t,e,i){let s,a,n=0;for(let o=0;o<t.length&&n<=i;o++)s=t[o][0],this._existsInAxisColumns(e,s)&&(a=s,n++);return a}_existsInAxisColumns(t,e){for(let i=0;i<t.length;i++)if(t.eq(i).data("column")===e)return!0;return!1}_getDefaultChartGroup(t){let e;return t instanceof s.DateColumn&&(e=256),{id:t.id,modifier:e}}_renderChartParts(){this._renderChartType(),this._renderChartAggregation(),this._renderChartGroup1(),this._renderChartGroup2()}_drawChart(){if(!this._hasColumns())return void this._hideChart();let t=this._calculateValues();if(!t.length)return void this._hideChart();this.chart.setVisible(!0);let e={type:this.chartType,options:{handleResize:!0,colorScheme:this.chartColorScheme,maxSegments:5,plugins:{legend:{display:!1}}}},i=[];e.data=this._computeData(i,t),this._adjustFont(e,i),this._adjustConfig(e),this.chart.setConfig(e);let s=this._computeCheckedItems(e.data.datasets[0].deterministicKeys);this.chart.setCheckedItems(s)}_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 s.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 e=this._chartGroup1Map[this.chartGroup1.id].data("column");this.xAxis=t.addAxis(e,this.chartGroup1.modifier)}if(this.chartType===n.Type.BUBBLE&&this.chartGroup2){let e=this._chartGroup2Map[this.chartGroup2.id].data("column");this.yAxis=t.addAxis(e,this.chartGroup2.modifier)}else this.yAxis=null;return!(t.isEmpty()||!t.isMatrixValid())&&t.calculate()}_getXAxis(){return this.xAxis}_getYAxis(){return this.yAxis}_computeData(t,e){let i={datasets:[{label:this._getDatasetLabel()}]};if(!e)return i;t=t||[];let a=[];if(this.chartType===n.Type.BUBBLE)a=this._computeBubbleData(t,e);else{let i=this._getXAxis();for(let n=0;n<i.length;n++){let o,r=i[n];o=i.column instanceof s.NumberColumn?r:this._handleIconLabel(i.format(r),i,t),a.push({value:e.getValue([r])[0],label:o,deterministicKey:i.keyToDeterministicKey(r)})}}let o=i.datasets[0],r=[];return o.data=[],o.deterministicKeys=[],a.forEach((t=>{o.data.push(t.value),o.deterministicKeys.push(t.deterministicKey),s.objects.isNullOrUndefined(t.label)||r.push(t.label)})),r.length&&(i.labels=r),i}_computeBubbleData(t,e){if(!e)return[];t=t||[];let i=this._getXAxis(),a=this._getYAxis(),n=[];for(let o=0;o<i.length;o++){let r=i[o],l=r;this._handleIconLabel(i.format(r),i,t),i.column instanceof s.NumberColumn||null!==l||(l=i.max),i.column instanceof s.DateColumn&&(l-=i.min);for(let o=0;o<a.length;o++){let h=a[o],c=h,d=e.getValue([r,h]);this._handleIconLabel(a.format(h),a,t),d&&d.length&&(a.column instanceof s.NumberColumn||null!==c||(c=a.max),a.column instanceof s.DateColumn&&(c-=a.min),n.push({value:{x:l,y:c,z:d[0]},deterministicKey:[i.keyToDeterministicKey(r),a.keyToDeterministicKey(h)]}))}}return n}_handleIconLabel(t,e,i){if(e&&e.textIsIcon){let e=s.icons.parseIconId(t);if(e&&e.isFontIcon())return i.push(...e.appendCssClass("font-icon").split(" ")),e.iconCharacter}return t}_adjustFont(t,e){if(t&&e&&(e=e.filter(((t,e,i)=>i.indexOf(t)===e))).length){let i=s.styles.get(e,"font-family").fontFamily;this.chartType!==n.Type.PIE&&(t.options=c().extend(!0,{},t.options,{scales:{x:{ticks:{font:{family:i}}},y:{ticks:{font:{family:i}}}}})),t.options=c().extend(!0,{},t.options,{plugins:{tooltip:{titleFont:{family:i}}}}),t.options=c().extend(!0,{},t.options,{plugins:{datalabels:{font:{family:i}}}})}}_adjustLabels(t){if(!t)return;let e=this._getXAxis(),i=this._getYAxis();this.chartType===n.Type.BUBBLE?(e.column instanceof s.NumberColumn||(t.options=c().extend(!0,{},t.options,{scales:{x:{ticks:{callback:t=>this._formatLabel(t,e)}}}})),i.column instanceof s.NumberColumn||(t.options=c().extend(!0,{},t.options,{scales:{y:{ticks:{callback:t=>this._formatLabel(t,i)}}}}))):e.column instanceof s.NumberColumn&&(t.options=c().extend(!0,{},t.options,{reformatLabels:!0}))}_formatLabel(t,e){if(e){if(e.column instanceof s.DateColumn&&((t+=e.min)!==parseInt(t)||e.length<2&&(t<e.min||t>e.max)))return null;if(-1!==e.indexOf(null))if(t===e.max)t=null;else if(t>e.max)return null;if(t=e.format(t),e.textIsIcon){let e=s.icons.parseIconId(t);e&&e.isFontIcon()&&(t=e.iconCharacter)}}return t}_adjustConfig(t){t&&(this._adjustLabels(t),this._adjustClickable(t),this.chartType===n.Type.BUBBLE?this._adjustBubble(t):this.chartType===n.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===n.Type.BUBBLE&&(t.options.bubble=c().extend(!0,{},t.options.bubble,{sizeOfLargestBubble:25,minBubbleSize:5}))}_adjustPie(t){if(!t||this.chartType!==n.Type.PIE)return;t.data.datasets[0].datalabels={labels:{index:{display:"auto",color:s.styles.get([this.chartColorScheme,this.chartType+"-chart","elements","label"],"fill").fill,formatter:(t,e)=>e.chart.data.labels[e.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(),i=this._getYAxis(),a=this.table.getFilter(Uo.TYPE),o=[],r=[];a&&(a.xAxis||{}).column===(e||{}).column&&(a.yAxis||{}).column===(i||{}).column&&(o=a.filters),t.forEach(((t,e)=>{o.filter((e=>Array.isArray(e.deterministicKey)&&Array.isArray(t)?s.arrays.equals(e.deterministicKey,t):e.deterministicKey===t)).length&&r.push(e)}));let l=0;if(this.chartType===n.Type.PIE){let e=this.chart.config.options.maxSegments,i=s.arrays.init(t.length-e).map(((t,i)=>i+e));s.arrays.containsAll(r,i)||s.arrays.remove(r,e-1),s.arrays.removeAll(r,i),l=1}let h=[];return r.length&&r.forEach((t=>{h.push({datasetIndex:l,dataIndex:t})})),h}_onChartValueClick(){let t=[];if(this.chart&&this.chart.config.data){let e=this.chart.config.options.maxSegments,i=this.chart.config.data.datasets[0],a=t=>({deterministicKey:i.deterministicKeys[t]});this.chartType===n.Type.PIE&&(a=t=>(t=parseInt(t),e&&e===t+1?s.arrays.init(i.deterministicKeys.length-t).map(((e,s)=>({deterministicKey:i.deterministicKeys[s+t]}))):{deterministicKey:i.deterministicKeys[t]})),this.chart.checkedItems.filter((t=>0===t.datasetIndex)).map((t=>t.dataIndex)).forEach((e=>{s.arrays.pushAll(t,a(e))}))}if(t.length){let e=s.scout.create("ChartTableUserFilter",{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(Uo.TYPE)}_axisContentForColumn(t){let e,i=t.text;return s.strings.hasText(i)?{text:i}:t.headerIconId&&(e=s.icons.parseIconId(t.headerIconId),e.isFontIcon())?{text:e.iconCharacter,icon:e}: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)=>{s.tooltips.uninstall(c()(e))})),s.scrollbars.uninstall(this.$xAxisSelect,this.session),this.$yAxisSelect.each(((t,e)=>{s.tooltips.uninstall(c()(e))})),s.scrollbars.uninstall(this.$yAxisSelect,this.session),s.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)}_pathSegment(t,e,i,s,a){let n=2*s*Math.PI,o=2*a*Math.PI,r="";return r+="M"+(t+i*Math.sin(n))+","+(e-i*Math.cos(n)),r+="A"+i+", "+i,r+=a-s<.5?" 0 0,1 ":" 0 1,1 ",r+=t+i*Math.sin(o)+","+(e-i*Math.cos(o)),r+="L"+t+","+e+"Z",r}_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()}}Wo(Go,"DATE_GROUP_FLAG",256),Wo(Go,"MAX_AXIS_COUNT",100);class Uo extends s.TableUserFilter{constructor(){super(),this.filterType=Uo.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 s.TableMatrix(this.table,this.session),e=this.table.columnById(this.columnIdX),i=e.createFilter().axisGroup();if(this.xAxis=t.addAxis(e,i),this.columnIdY){let e=this.table.columnById(this.columnIdY),i=e.createFilter().axisGroup();this.yAxis=t.addAxis(e,i)}t.calculate()}accept(t){this.xAxis||this.calculate();let e=this.xAxis.column.cellValueOrTextForCalculation(t),i=this.xAxis.normDeterministic(e);if(!this.yAxis)return this.filters.filter((t=>t.deterministicKey===i)).length;e=this.yAxis.column.cellValueOrTextForCalculation(t);let a=this.yAxis.normDeterministic(e);return this.filters.filter((t=>s.arrays.equals(t.deterministicKey,[i,a]))).length}}var $o,Yo,Xo;Xo="CHART",(Yo="TYPE")in($o=Uo)?Object.defineProperty($o,Yo,{value:Xo,enumerable:!0,configurable:!0,writable:!0}):$o[Yo]=Xo;class Jo extends s.TableControlAdapter{constructor(){super(),this._addRemoteProperties(["chartType","chartAggregation","chartGroup1","chartGroup2"])}}class qo extends s.AbstractLayout{constructor(t){super(),this.control=t}layout(t){this.control.contentRendered&&(s.scrollbars.update(this.control.$contentContainer),s.scrollbars.update(this.control.$xAxisSelect),s.scrollbars.update(this.control.$yAxisSelect),s.scrollbars.update(this.control.$dataSelect))}}function Ko(){return Ko=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},Ko.apply(this,arguments)}const Zo=i;window.scout=Ko(window.scout||{},i)})();
|
|
3
|
+
//# sourceMappingURL=eclipse-scout-chart-bc08151d11e1909eff6c.min.js.map
|