"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[570],{3328:function(t,e,i){i.d(e,{kL:function(){return he},zX:function(){return Gi}});var s=i(3940);var n=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=s.r.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.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 o="transparent",a={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=(0,s.c)(t||o),a=n.valid&&(0,s.c)(e||o);return a&&a.valid?a.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class r{constructor(t,e,i,n){const o=e[i];n=(0,s.a)([t.to,n,o,t.from]);const r=(0,s.a)([t.from,o,n]);this._active=!0,this._fn=t.fn||a[t.type||typeof r],this._easing=s.e[t.easing]||s.e.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=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=(0,s.a)([t.to,e,n,t.from]),this._from=(0,s.a)([t.from,n,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,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,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 s=0;s"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),s.d.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),s.d.describe("animations",{_fallback:"animation"}),s.d.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 l{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!(0,s.i)(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((i=>{const n=t[i];if(!(0,s.i)(n))return;const o={};for(const t of h)o[t]=n[t];((0,s.b)(n.properties)&&n.properties||[i]).forEach((t=>{t!==i&&e.has(t)||e.set(t,o)}))}))}_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=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let n=0;n{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let h;for(h=o.length-1;h>=0;--h){const l=o[h];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const c=e[l];let d=n[l];const u=i.get(l);if(d){if(u&&d.active()){d.update(u,c,a);continue}d.cancel()}u&&u.duration?(n[l]=d=new r(u,t,l,c),s.push(d)):t[l]=c}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(n.add(this._chart,i),!0):void 0}}function c(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function d(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n0||!i&&e<0)return n.index}return null}function m(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,h=o.axis,l=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let g=0;gi[t].axis===e)).shift()}function b(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 _=t=>"reset"===t||"none"===t,y=(t,e)=>e?t:Object.assign({},t);class v{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=g(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&b(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,o=e.xAxisID=(0,s.v)(i.xAxisID,x(t,"x")),a=e.yAxisID=(0,s.v)(i.yAxisID,x(t,"y")),r=e.rAxisID=(0,s.v)(i.rAxisID,x(t,"r")),h=e.indexAxis,l=e.iAxisID=n(h,o,a,r),c=e.vAxisID=n(h,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}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&&(0,s.u)(this._data,this),t._stacked&&b(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if((0,s.i)(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,n,o;for(s=0,n=e.length;s0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,c=n;else{c=(0,s.b)(n[t])?this.parseArrayData(i,n,t,e):(0,s.i)(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const o=()=>null===l[r]||u&&l[r]t&&!e.hidden&&e._stacked&&{keys:d(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:u}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(r);let g,p;function f(){p=n[g];const e=p[r.axis];return!(0,s.g)(p[t.axis])||c>e||u=0;--g)if(!f()){this.updateRangeFromParsed(l,t,p,h);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,a;for(n=0,o=e.length;n=0&&tthis.getContext(i,n)),d);return p.$shared&&(p.$shared=h,o[a]=Object.freeze(y(p,h))),p}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const h=new l(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||_(t)||this.chart._animationsDisabled}updateElement(t,e,i,s){_(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!_(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}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[a,r,h]of this._syncList)this[a](r,h);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;at-e)))}return t._cache.$bar}(e,t.type);let n,o,a,r,h=e._length;const l=()=>{32767!==a&&-32768!==a&&((0,s.j)(r)&&(h=Math.min(h,Math.abs(a-r)||h)),r=a)};for(n=0,o=i.length;nMath.abs(r)&&(h=r,l=a),e[i.axis]=l,e._custom={barStart:h,barEnd:l,start:n,end:o,min:a,max:r}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function M(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,h=[];let l,c,d,u;for(l=i,c=i+s;lt.x,i="left",s="right"):(e=t.base=i?1:-1)}(d,e,a)*o,u===a&&(m-=d/2),c=m+d),m===e.getPixelForValue(a)){const t=(0,s.s)(d)*e.getLineWidthForValue(a)/2;m+=t,d-=t}return{size:d,base:m,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,a=(0,s.v)(n.maxBarThickness,1/0);let r,h;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t=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,n=this.getParsed(t),o=i.getLabelForValue(n.x),a=s.getLabelForValue(n.y),r=n._custom;return{label:e.label,value:"("+o+", "+a+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,r=this.resolveDataElementOptions(e,s),h=this.getSharedOptions(r),l=this.includeOptions(s,h),c=o.axis,d=a.axis;for(let u=e;u""}}}};class T extends v{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,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let o,a,r=t=>+i[t];if((0,s.i)(i[t])){const{key:t="value"}=this._parsing;r=e=>+(0,s.f)(i[e],t)}for(o=t,a=t+e;o(0,s.p)(t,h,l,!0)?1:Math.max(e,e*i,n,n*i),f=(t,e,n)=>(0,s.p)(t,h,l,!0)?-1:Math.min(e,e*i,n,n*i),m=p(0,c,u),x=p(s.H,d,g),b=f(s.P,c,u),_=f(s.P+s.H,d,g);n=(m-b)/2,o=(x-_)/2,a=-(m+b)/2,r=-(x+_)/2}return{ratioX:n,ratioY:o,offsetX:a,offsetY:r}}(d,c,h),m=(i.width-a)/u,x=(i.height-a)/g,b=Math.max(Math.min(m,x)/2,0),_=(0,s.n)(this.options.radius,b),y=(_-Math.max(_*h,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*_,this.offsetY=f*_,n.total=this.calculateTotal(),this.outerRadius=_-y*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-y*l,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/s.T)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,h=(a.left+a.right)/2,l=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,g=this.resolveDataElementOptions(e,s),p=this.getSharedOptions(g),f=this.includeOptions(s,p);let m,x=this._getRotation();for(m=0;m0&&!isNaN(t)?s.T*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=(0,s.o)(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s"spacing"!==t,_indexable:t=>"spacing"!==t},T.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 n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.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(0,s.b)(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class E extends v{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,a=this.chart._animationsDisabled;let{start:r,count:h}=function(t,e,i){const n=e.length;let o=0,a=n;if(t._sorted){const{iScale:r,_parsed:h}=t,l=r.axis,{min:c,max:d,minDefined:u,maxDefined:g}=r.getUserBounds();u&&(o=(0,s.w)(Math.min((0,s.x)(h,r.axis,c).lo,i?n:(0,s.x)(e,l,r.getPixelForValue(c)).lo),0,n-1)),a=g?(0,s.w)(Math.max((0,s.x)(h,r.axis,d).hi+1,i?0:(0,s.x)(e,l,r.getPixelForValue(d)).hi+1),o,n)-o:n-o}return{start:o,count:a}}(e,n,a);this._drawStart=r,this._drawCount=h,function(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}(e)&&(r=0,h=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!a,options:l},t),this.updateElements(n,r,h,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:a,vScale:r,_stacked:h,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(c),u=this.includeOptions(n,d),g=a.axis,p=r.axis,{spanGaps:f,segment:m}=this.options,x=(0,s.q)(f)?f:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||"none"===n;let _=e>0&&this.getParsed(e-1);for(let y=e;y0&&i[g]-_[g]>x,m&&(c.parsed=i,c.raw=l.data[y]),u&&(c.options=d||this.resolveDataElementOptions(y,e.active?"active":n)),b||this.updateElement(e,y,c,n),_=i}this.updateSharedOptions(d,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}E.id="line",E.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},E.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class R extends v{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=(0,s.o)(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}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),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,n){const o="reset"===n,a=this.chart,r=this.getDataset(),h=a.options.animation,l=this._cachedMeta.rScale,c=l.xCenter,d=l.yCenter,u=l.getIndexAngle(0)-.5*s.P;let g,p=u;const f=360/this.countVisibleElements();for(g=0;g{!isNaN(t.data[s])&&this.chart.getDataVisibility(s)&&i++})),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?(0,s.t)(this.resolveDataElementOptions(t,e).angle||i):0}}R.id="polarArea",R.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},R.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 n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.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 z extends T{}z.id="pie",z.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class F extends v{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||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this.getDataset(),o=this._cachedMeta.rScale,a="reset"===s;for(let r=e;r"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var V=Object.freeze({__proto__:null,BarController:L,BubbleController:O,DoughnutController:T,LineController:E,PolarAreaController:R,PieController:z,RadarController:F,ScatterController:I});function B(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class H{constructor(t){this.options=t||{}}formats(){return B()}parse(t,e){return B()}format(t,e){return B()}add(t,e,i){return B()}diff(t,e,i){return B()}startOf(t,e,i){return B()}endOf(t,e){return B()}}H.override=function(t){Object.assign(H.prototype,t)};var W={_date:H};function N(t,e){return"native"in t?{x:t.x,y:t.y}:(0,s.y)(t,e)}function j(t,e,i,n){const{controller:o,data:a,_sorted:r}=t,h=o._cachedMeta.iScale;if(h&&e===h.axis&&"r"!==e&&r&&a.length){const t=h._reversePixels?s.A:s.x;if(!n)return t(a,e,i);if(o._sharedOptions){const s=a[0],n="function"===typeof s.getRange&&s.getRange(e);if(n){const s=t(a,e,i-n),o=t(a,e,i+n);return{lo:s.lo,hi:o.hi}}}}return{lo:0,hi:a.length-1}}function $(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let r=0,h=o.length;r{t[r](n[a],s)&&o.push({element:t,datasetIndex:e,index:i}),t.inRange(n.x,n.y,s)&&(h=!0)})),i.intersect&&!h?[]:o}var G={modes:{index(t,e,i,s){const n=N(e,t),o=i.axis||"x",a=i.intersect?U(t,n,o,s):X(t,n,o,!1,s),r=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[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 n=N(e,t),o=i.axis||"xy";let a=i.intersect?U(t,n,o,s):X(t,n,o,!1,s);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;tU(t,N(e,t),i.axis||"xy",s),nearest:(t,e,i,s)=>X(t,N(e,t),i.axis||"xy",i.intersect,s),x:(t,e,i,s)=>Z(t,e,{axis:"x",intersect:i.intersect},s),y:(t,e,i,s)=>Z(t,e,{axis:"y",intersect:i.intersect},s)}};const q=["left","top","right","bottom"];function K(t,e){return t.filter((t=>t.pos===e))}function J(t,e){return t.filter((t=>-1===q.indexOf(t.pos)&&t.box.axis===e))}function Q(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function tt(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!q.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function ot(t,e,i,s){const n=[];let o,a,r,h,l,c;for(o=0,a=t.length,l=0;ot.box.fullSize)),!0),s=Q(K(e,"left"),!0),n=Q(K(e,"right")),o=Q(K(e,"top"),!0),a=Q(K(e,"bottom")),r=J(e,"x"),h=J(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(h).concat(a).concat(r),chartArea:K(e,"chartArea"),vertical:s.concat(n).concat(h),horizontal:o.concat(a).concat(r)}}(t.boxes),l=h.vertical,c=h.horizontal;(0,s.D)(t.boxes,(t=>{"function"===typeof t.beforeLayout&&t.beforeLayout()}));const d=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:a,availableHeight:r,vBoxMaxWidth:a/2/d,hBoxMaxHeight:r/2}),g=Object.assign({},o);it(g,(0,s.C)(n));const p=Object.assign({maxPadding:g,w:a,h:r,x:o.left,y:o.top},o),f=tt(l.concat(c),u);ot(h.fullSize,p,u,f),ot(l,p,u,f),ot(c,p,u,f)&&ot(l,p,u,f),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),rt(h.leftAndTop,p,u,f),p.x+=p.w,p.y+=p.h,rt(h.rightAndBottom,p,u,f),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},(0,s.D)(h.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class lt{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 ct extends lt{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const dt={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ut=t=>null===t||""===t;const gt=!!s.J&&{passive:!0};function pt(t,e,i){t.canvas.removeEventListener(e,i,gt)}function ft(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function mt(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ft(i.addedNodes,s),e=e&&!ft(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function xt(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ft(i.removedNodes,s),e=e&&!ft(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const bt=new Map;let _t=0;function yt(){const t=window.devicePixelRatio;t!==_t&&(_t=t,bt.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function vt(t,e,i){const n=t.canvas,o=n&&(0,s.F)(n);if(!o)return;const a=(0,s.I)(((t,e)=>{const s=o.clientWidth;i(t,e),s{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||a(i,s)}));return r.observe(o),function(t,e){bt.size||window.addEventListener("resize",yt),bt.set(t,e)}(t,a),r}function kt(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){bt.delete(t),bt.size||window.removeEventListener("resize",yt)}(t)}function wt(t,e,i){const n=t.canvas,o=(0,s.I)((e=>{null!==t.ctx&&i(function(t,e){const i=dt[t.type]||t.type,{x:n,y:o}=(0,s.y)(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,gt)}(n,e,o),o}class Mt extends lt{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t.$chartjs={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",ut(o)){const e=(0,s.G)(t,"width");void 0!==e&&(t.width=e)}if(ut(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=(0,s.G)(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 n=i[t];(0,s.k)(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:mt,detach:xt,resize:vt}[e]||wt;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:kt,detach:kt,resize:kt}[e]||pt)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return(0,s.E)(t,e,i,n)}isAttached(t){const e=(0,s.F)(t);return!(!e||!e.isConnected)}}class Dt{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(0,s.q)(this.x)&&(0,s.q)(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}}Dt.defaults={},Dt.defaultRoutes=void 0;const St={values:t=>(0,s.b)(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,a=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)&&(o="scientific"),a=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 r=(0,s.L)(Math.abs(a)),h=Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:o,minimumFractionDigits:h,maximumFractionDigits:h};return Object.assign(l,this.options.ticks.format),(0,s.o)(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=t/Math.pow(10,Math.floor((0,s.L)(t)));return 1===n||2===n||5===n?St.numeric.call(this,t,e,i):""}};var Pt={formatters:St};function Ct(t,e){const i=t.options.ticks,n=i.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),o=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;in)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;no)return t}return Math.max(o,1)}(o,e,n);if(a>0){let t,i;const n=a>1?Math.round((h-r)/(a-1)):null;for(At(e,l,c,(0,s.k)(n)?0:r-n,r),t=0,i=a-1;te.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:Pt.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.d.route("scale.ticks","color","","color"),s.d.route("scale.grid","color","","borderColor"),s.d.route("scale.grid","borderColor","","borderColor"),s.d.route("scale.title","color","","color"),s.d.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),s.d.describe("scales",{_fallback:"scale"}),s.d.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const Lt=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Ot(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;oa+r)))return l}function Et(t){return t.drawTicks?t.tickLength:0}function Rt(t,e){if(!t.display)return 0;const i=(0,s.Z)(t.font,e),n=(0,s.C)(t.padding);return((0,s.b)(t.text)?t.text.length:1)*i.lineHeight+n.height}function zt(t,e,i){let n=(0,s.$)(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class Ft extends Dt{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:n}=this;return t=(0,s.N)(t,Number.POSITIVE_INFINITY),e=(0,s.N)(e,Number.NEGATIVE_INFINITY),i=(0,s.N)(i,Number.POSITIVE_INFINITY),n=(0,s.N)(n,Number.NEGATIVE_INFINITY),{min:(0,s.N)(t,i),max:(0,s.N)(e,n),minDefined:(0,s.g)(t),maxDefined:(0,s.g)(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:o,maxDefined:a}=this.getUserBounds();if(o&&a)return{min:i,max:n};const r=this.getMatchingVisibleMetas();for(let s=0,h=r.length;sn?n:i,n=o&&i>n?i:n,{min:(0,s.N)(i,(0,s.N)(n,i)),max:(0,s.N)(n,(0,s.N)(i,n))}}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(){(0,s.O)(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({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=(0,s.Q)(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const h=r=o||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const c=this._getLabelSizes(),d=c.widest.width,u=c.highest.height,g=(0,s.w)(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/i:g/(i-1),d+6>a&&(a=g/(i-(t.offset?.5:1)),r=this.maxHeight-Et(t.grid)-e.padding-Rt(t.title,this.chart.options.font),h=Math.sqrt(d*d+u*u),l=(0,s.R)(Math.min(Math.asin((0,s.w)((c.highest.height+6)/a,-1,1)),Math.asin((0,s.w)(r/h,-1,1))-Math.asin((0,s.w)(u/h,-1,1)))),l=Math.max(n,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){(0,s.O)(this.options.afterCalculateLabelRotation,[this])}beforeFit(){(0,s.O)(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const a=Rt(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=Et(o)+a):(t.height=this.maxHeight,t.width=Et(o)+a),i.display&&this.ticks.length){const{first:e,last:n,widest:o,highest:a}=this._getLabelSizes(),h=2*i.padding,l=(0,s.t)(this.labelRotation),c=Math.cos(l),d=Math.sin(l);if(r){const e=i.mirror?0:d*o.width+c*a.height;t.height=Math.min(this.maxHeight,t.height+e+h)}else{const e=i.mirror?0:c*o.width+d*a.height;t.width=Math.min(this.maxWidth,t.width+e+h)}this._calculatePadding(e,n,d,c)}}this._handleMargins(),r?(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:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,h="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?h?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-l+o)*this.width/(this.width-l),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_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(){(0,s.O)(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{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n({width:o[t]||0,height:a[t]||0});return{first:k(0),last:k(e-1),widest:k(y),highest:k(v),widths:o,heights:a}}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(0,s.U)(this._alignToPixels?(0,s.V)(this.chart,e,0):e)}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&&tr*n?r/i:h/n:h*n0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:a}=n,r=o.offset,h=this.isHorizontal(),l=this.ticks.length+(r?1:0),c=Et(o),d=[],u=o.setContext(this.getContext()),g=u.drawBorder?u.borderWidth:0,p=g/2,f=function(t){return(0,s.V)(i,t,g)};let m,x,b,_,y,v,k,w,M,D,S,P;if("top"===a)m=f(this.bottom),v=this.bottom-c,w=m-p,D=f(t.top)+p,P=t.bottom;else if("bottom"===a)m=f(this.top),D=t.top,P=f(t.bottom)-p,v=m+p,w=this.top+c;else if("left"===a)m=f(this.right),y=this.right-c,k=m-p,M=f(t.left)+p,S=t.right;else if("right"===a)m=f(this.left),M=t.left,S=f(t.right)-p,y=m+p,k=this.left+c;else if("x"===e){if("center"===a)m=f((t.top+t.bottom)/2+.5);else if((0,s.i)(a)){const t=Object.keys(a)[0],e=a[t];m=f(this.chart.scales[t].getPixelForValue(e))}D=t.top,P=t.bottom,v=m+p,w=v+c}else if("y"===e){if("center"===a)m=f((t.left+t.right)/2);else if((0,s.i)(a)){const t=Object.keys(a)[0],e=a[t];m=f(this.chart.scales[t].getPixelForValue(e))}y=m-p,k=y-c,M=t.left,S=t.right}const C=(0,s.v)(n.ticks.maxTicksLimit,l),A=Math.max(1,Math.ceil(l/C));for(x=0;xe.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 n,o;const a=(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(n=0,o=s.length;n{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 n,o;for(n=0,o=e.length;n{const n=i.split("."),o=n.pop(),a=[t].concat(n).join("."),r=e[i].split("."),h=r.pop(),l=r.join(".");s.d.route(a,o,l,h)}))}(e,t.defaultRoutes);t.descriptors&&s.d.describe(e,t.descriptors)}(t,a,i),this.override&&s.d.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in s.d[n]&&(delete s.d[n][i],this.override&&delete s.a1[i])}}var Vt=new class{constructor(){this.controllers=new It(v,"datasets",!0),this.elements=new It(Dt,"elements"),this.plugins=new It(Object,"plugins"),this.scales=new It(Ft,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,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(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):(0,s.D)(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const n=(0,s.a3)(t);(0,s.O)(i["before"+n],[],i),e[t](i),(0,s.O)(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;et.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 Ht(t,e){return e||!1!==t?!0===t?{}:t:null}function Wt(t,e,i,s){const n=t.pluginScopeKeys(e),o=t.getOptionScopes(i,n);return t.createResolver(o,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Nt(t,e){const i=s.d.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function jt(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 $t(t){const e=t.options||(t.options={});e.plugins=(0,s.v)(e.plugins,{}),e.scales=function(t,e){const i=s.a1[t.type]||{scales:{}},n=e.scales||{},o=Nt(t.type,e),a=Object.create(null),r=Object.create(null);return Object.keys(n).forEach((t=>{const e=n[t];if(!(0,s.i)(e))return console.error(`Invalid scale configuration for scale: ${t}`);if(e._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const h=jt(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(h,o),c=i.scales||{};a[h]=a[h]||t,r[t]=(0,s.a9)(Object.create(null),[{axis:h},e,c[h],c[l]])})),t.data.datasets.forEach((i=>{const o=i.type||t.type,h=i.indexAxis||Nt(o,e),l=(s.a1[o]||{}).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,h),o=i[e+"AxisID"]||a[e]||e;r[o]=r[o]||Object.create(null),(0,s.a9)(r[o],[{axis:e},n[o],l[t]])}))})),Object.keys(r).forEach((t=>{const e=r[t];(0,s.a9)(e,[s.d.scales[e.type],s.d.scale])})),r}(t,e)}function Ut(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Yt=new Map,Xt=new Set;function Zt(t,e){let i=Yt.get(t);return i||(i=e(),Yt.set(t,i),Xt.add(i)),i}const Gt=(t,e,i)=>{const n=(0,s.f)(e,i);void 0!==n&&t.add(n)};class qt{constructor(t){this._config=function(t){return(t=t||{}).data=Ut(t.data),$t(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=Ut(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(),$t(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Zt(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Zt(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Zt(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Zt(`${this.type}-plugin-${e}`,(()=>[[`plugins.${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:n,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;const h=new Set;e.forEach((e=>{t&&(h.add(t),e.forEach((e=>Gt(h,t,e)))),e.forEach((t=>Gt(h,n,t))),e.forEach((t=>Gt(h,s.a1[o]||{},t))),e.forEach((t=>Gt(h,s.d,t))),e.forEach((t=>Gt(h,s.a4,t)))}));const l=Array.from(h);return 0===l.length&&l.push(Object.create(null)),Xt.has(e)&&a.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,s.a1[e]||{},s.d.datasets[e]||{},{type:e},s.d,s.a4]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=Kt(this._resolverCache,t,n);let h=a;if(function(t,e){const{isScriptable:i,isIndexable:n}=(0,s.a8)(t);for(const o of e){const e=i(o),a=n(o),r=(a||e)&&t[o];if(e&&((0,s.a5)(r)||Jt(r))||a&&(0,s.b)(r))return!0}return!1}(a,e)){o.$shared=!1,i=(0,s.a5)(i)?i():i;const e=this.createResolver(t,i,r);h=(0,s.a6)(a,i,e)}for(const s of e)o[s]=h[s];return o}createResolver(t,e,i=[""],n){const{resolver:o}=Kt(this._resolverCache,t,i);return(0,s.i)(e)?(0,s.a6)(o,e,void 0,n):o}}function Kt(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let a=n.get(o);if(!a){a={resolver:(0,s.a7)(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,a)}return a}const Jt=t=>(0,s.i)(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||(0,s.a5)(t[i])),!1);const Qt=["top","bottom","left","right","chartArea"];function te(t,e){return"top"===t||"bottom"===t||-1===Qt.indexOf(t)&&"x"===e}function ee(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function ie(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),(0,s.O)(i&&i.onComplete,[t],e)}function se(t){const e=t.chart,i=e.options.animation;(0,s.O)(i&&i.onProgress,[t],e)}function ne(t){return(0,s.K)()&&"string"===typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const oe={},ae=t=>{const e=ne(t);return Object.values(oe).filter((t=>t.canvas===e)).pop()};function re(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class he{constructor(t,e){const i=this.config=new qt(e),o=ne(t),a=ae(o);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 r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!(0,s.K)()||"undefined"!==typeof OffscreenCanvas&&t instanceof OffscreenCanvas?ct:Mt}(o)),this.platform.updateConfig(i);const h=this.platform.acquireContext(o,r.aspectRatio),l=h&&h.canvas,c=l&&l.height,d=l&&l.width;this.id=(0,s.aa)(),this.ctx=h,this.canvas=l,this.width=d,this.height=c,this._options=r,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 Bt,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=(0,s.ab)((t=>this.update(t)),r.resizeDelay||0),this._dataChanges=[],oe[this.id]=this,h&&l?(n.listen(this,"complete",ie),n.listen(this,"progress",se),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:n,_aspectRatio:o}=this;return(0,s.k)(t)?e&&o?o:n?i/n: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():(0,s.ac)(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return(0,s.ad)(this.canvas,this.ctx),this}stop(){return n.stop(this),this}resize(t,e){n.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),h=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,(0,s.ac)(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),(0,s.O)(i.onResize,[this,a],this),this.attached&&this._doResize(h)&&this.render())}ensureScalesHaveIDs(){const t=this.options.scales||{};(0,s.D)(t,((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let o=[];e&&(o=o.concat(Object.keys(e).map((t=>{const i=e[t],s=jt(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),(0,s.D)(o,(e=>{const o=e.options,a=o.id,r=jt(a,o),h=(0,s.v)(o.type,e.dtype);void 0!==o.position&&te(o.position,r)===te(e.dposition)||(o.position=e.dposition),n[a]=!0;let l=null;if(a in i&&i[a].type===h)l=i[a];else{l=new(Vt.getScale(h))({id:a,type:h,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(o,t)})),(0,s.D)(n,((t,e)=>{t||delete i[e]})),(0,s.D)(i,(t=>{ht.configure(this,t,t.options),ht.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;te.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,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i{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()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let s=0,l=this.data.datasets.length;s{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ee("z","_idx"));const{_active:r,_lastEvent:h}=this;h?this._eventHandler(h,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){(0,s.D)(this.scales,(t=>{ht.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(0,s.ae)(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:n}of e){re(t,s,"_removeElements"===i?-n:n)}}_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(",")))),n=i(0);for(let o=1;ot.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;ht.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],(0,s.D)(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=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=this.chartArea,a={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",a)&&(n&&(0,s.W)(e,{left:!1===i.left?0:o.left-i.left,right:!1===i.right?this.width:o.right+i.right,top:!1===i.top?0:o.top-i.top,bottom:!1===i.bottom?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&(0,s.Y)(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}getElementsAtEventForMode(t,e,i,s){const n=G.modes[e];return"function"===typeof n?n(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=(0,s.h)(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 n=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,n);(0,s.j)(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update((e=>e.datasetIndex===t?n: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(),n.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};(0,s.D)(this.options.events,(t=>i(t,n)))}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])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){(0,s.D)(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},(0,s.D)(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!(0,s.af)(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,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:(0,s.z)(t,this.chartArea,this._minPadding)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,a=e,r=this._getActiveElements(t,n,i,a),h=(0,s.ag)(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,h);i&&(this._lastEvent=null,(0,s.O)(o.onHover,[t,r,this],this),h&&(0,s.O)(o.onClick,[t,r,this],this));const c=!(0,s.af)(r,n);return(c||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}const le=()=>(0,s.D)(he.instances,(t=>t._plugins.invalidate())),ce=!0;function de(t,e,i){const{startAngle:n,pixelMargin:o,x:a,y:r,outerRadius:h,innerRadius:l}=e;let c=o/h;t.beginPath(),t.arc(a,r,h,n-c,i+c),l>o?(c=o/l,t.arc(a,r,l,i+c,n-c,!0)):t.arc(a,r,o,i+s.H,n-s.H),t.closePath(),t.clip()}function ue(t,e,i,n){const o=(a=t.options.borderRadius,(0,s.ai)(a,["outerStart","outerEnd","innerStart","innerEnd"]));var a;const r=(i-e)/2,h=Math.min(r,n*e/2),l=t=>{const e=(i-Math.min(r,t))*n/2;return(0,s.w)(t,0,Math.min(r,e))};return{outerStart:l(o.outerStart),outerEnd:l(o.outerEnd),innerStart:(0,s.w)(o.innerStart,0,h),innerEnd:(0,s.w)(o.innerEnd,0,h)}}function ge(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function pe(t,e,i,n,o){const{x:a,y:r,startAngle:h,pixelMargin:l,innerRadius:c}=e,d=Math.max(e.outerRadius+n+i-l,0),u=c>0?c+n+i+l:0;let g=0;const p=o-h;if(n){const t=((c>0?c-n:0)+(d>0?d-n:0))/2;g=(p-(0!==t?p*t/(t+n):p))/2}const f=(p-Math.max(.001,p*d-i/s.P)/d)/2,m=h+f+g,x=o-f-g,{outerStart:b,outerEnd:_,innerStart:y,innerEnd:v}=ue(e,u,d,x-m),k=d-b,w=d-_,M=m+b/k,D=x-_/w,S=u+y,P=u+v,C=m+y/S,A=x-v/P;if(t.beginPath(),t.arc(a,r,d,M,D),_>0){const e=ge(w,D,a,r);t.arc(e.x,e.y,_,D,x+s.H)}const L=ge(P,x,a,r);if(t.lineTo(L.x,L.y),v>0){const e=ge(P,A,a,r);t.arc(e.x,e.y,v,x+s.H,A+Math.PI)}if(t.arc(a,r,u,x-v/u,m+y/u,!0),y>0){const e=ge(S,C,a,r);t.arc(e.x,e.y,y,C+Math.PI,m-s.H)}const O=ge(k,m,a,r);if(t.lineTo(O.x,O.y),b>0){const e=ge(k,M,a,r);t.arc(e.x,e.y,b,m-s.H,M)}t.closePath()}function fe(t,e,i,n,o){const{options:a}=e,{borderWidth:r,borderJoinStyle:h}=a,l="inner"===a.borderAlign;r&&(l?(t.lineWidth=2*r,t.lineJoin=h||"round"):(t.lineWidth=r,t.lineJoin=h||"bevel"),e.fullCircles&&function(t,e,i){const{x:n,y:o,startAngle:a,pixelMargin:r,fullCircles:h}=e,l=Math.max(e.outerRadius-r,0),c=e.innerRadius+r;let d;for(i&&de(t,e,a+s.T),t.beginPath(),t.arc(n,o,c,a+s.T,a,!0),d=0;d{Vt.add(...t),le()}},unregister:{enumerable:ce,value:(...t)=>{Vt.remove(...t),le()}}});class me extends Dt{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&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:a}=(0,s.B)(n,{x:t,y:e}),{startAngle:r,endAngle:h,innerRadius:l,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=this.options.spacing/2,g=(0,s.v)(d,h-r)>=s.T||(0,s.p)(o,r,h),p=(0,s.ah)(a,l+u,c+u);return g&&p}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:r,spacing:h}=this.options,l=(s+n)/2,c=(o+a+h+r)/2;return{x:e+Math.cos(l)*c,y:i+Math.sin(l)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/2,o=(e.spacing||0)/2;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>s.T?Math.floor(i/s.T):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let a=0;if(n){a=n/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*a,Math.sin(e)*a),this.circumference>=s.P&&(a=n)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const r=function(t,e,i,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let h=e.endAngle;if(o){pe(t,e,i,n,a+s.T);for(let e=0;er&&o>r;return{count:s,start:h,loop:e.loop,ilen:l(a+(l?r-t:t))%o,_=()=>{g!==p&&(t.lineTo(m,p),t.lineTo(m,g),t.lineTo(m,f))};for(h&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[b(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(ip&&(p=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=s,x=0,g=p=i),f=i}_()}function ke(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&"monotone"!==e.cubicInterpolationMode&&!e.stepped&&!i?ve:ye}me.id="arc",me.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0},me.defaultRoutes={backgroundColor:"backgroundColor"};const we="function"===typeof Path2D;function Me(t,e,i,s){we&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),xe(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=ke(e);for(const r of n)xe(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class De extends Dt{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&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;(0,s.aj)(this._points,i,t,n,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=(0,s.ak)(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,n=t[e],o=this.points,a=(0,s.al)(this,{property:e,start:n,end:n});if(!a.length)return;const r=[],h=function(t){return t.stepped?s.am:t.tension||"monotone"===t.cubicInterpolationMode?s.an:s.ao}(i);let l,c;for(l=0,c=a.length;l"borderDash"!==t&&"fill"!==t};class Pe extends Dt{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2){Fe(t)}))}var Ve={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Ie(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:a,indexAxis:r}=e,h=t.getDatasetMeta(o),l=a||e.data;if("y"===(0,s.a)([r,t.options.indexAxis]))return;if("line"!==h.type)return;const c=t.scales[h.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:d,count:u}=function(t,e){const i=e.length;let n,o=0;const{iScale:a}=t,{min:r,max:h,minDefined:l,maxDefined:c}=a.getUserBounds();return l&&(o=(0,s.w)((0,s.x)(e,a.axis,r).lo,0,i-1)),n=c?(0,s.w)((0,s.x)(e,a.axis,h).hi+1,o,i)-o:i-o,{start:o,count:n}}(h,l);if(u<=(i.threshold||4*n))return void Fe(e);let g;switch((0,s.k)(a)&&(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":g=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let h=0;const l=e+i-1;let c,d,u,g,p,f=e;for(a[h++]=t[f],c=0;cu&&(u=g,d=t[s],p=s);a[h++]=d,f=p}return a[h++]=t[l],a}(l,d,u,n,i);break;case"min-max":g=function(t,e,i,n){let o,a,r,h,l,c,d,u,g,p,f=0,m=0;const x=[],b=e+i-1,_=t[e].x,y=t[b].x-_;for(o=e;op&&(p=h,d=o),f=(m*f+a.x)/++m;else{const i=o-1;if(!(0,s.k)(c)&&!(0,s.k)(d)){const e=Math.min(c,d),s=Math.max(c,d);e!==u&&e!==i&&x.push({...t[e],x:f}),s!==u&&s!==i&&x.push({...t[s],x:f})}o>0&&i!==u&&x.push(t[i]),x.push(a),l=e,m=0,g=p=h,c=d=u=o}}return x}(l,d,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=g}))},destroy(t){Ie(t)}};function Be(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=(0,s.v)(i&&i.target,i);return void 0===n&&(n=!!e.backgroundColor),!1!==n&&null!==n&&(!0===n?"origin":n)}(t);if((0,s.i)(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return(0,s.g)(o)&&Math.floor(o)===o?("-"!==n[0]&&"+"!==n[0]||(o=e+o),!(o===e||o<0||o>=i)&&o):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}class He{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:a}=this;return e=e||{start:0,end:s.T},t.arc(n,o,a,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,n=t.angle;return{x:e+Math.cos(n)*s,y:i+Math.sin(n)*s,angle:n}}}function We(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,a=[],r=n.reverse?e.max:e.min,h=n.reverse?e.min:e.max;let l,c,d;if(d="start"===i?r:"end"===i?h:(0,s.i)(i)?i.value:e.getBaseValue(),n.grid.circular)return c=e.getPointPositionForValue(0,r),new He({x:c.x,y:c.y,radius:e.getDistanceFromCenterForValue(d)});for(l=0;lt;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function je(t,e,i){const s=[];for(let n=0;n{e=Ne(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))})),o}(t,e),i.length?new De({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function Xe(t,e,i){let n=t[e].fill;const o=[e];let a;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!(0,s.g)(n))return n;if(a=t[n],!a)return!1;if(a.visible)return n;o.push(n),n=a.fill}return!1}function Ze(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:h}=r,l=n[s],c=n[Ne(s,h,n)];o?(t.moveTo(l.x,l.y),o=!1):(t.lineTo(l.x,i),t.lineTo(l.x,l.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function Ge(t,e,i,n){if(n)return;let o=e[t],a=i[t];return"angle"===t&&(o=(0,s.aw)(o),a=(0,s.aw)(a)),{property:t,start:o,end:a}}function qe(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function Ke(t,e,i){const{top:s,bottom:n}=e.chart.chartArea,{property:o,start:a,end:r}=i||{};"x"===o&&(t.beginPath(),t.rect(a,s,r-a,n-s),t.clip())}function Je(t,e,i,s){const n=e.interpolate(i,s);n&&t.lineTo(n.x,n.y)}function Qe(t,e){const{line:i,target:n,property:o,color:a,scale:r}=e,h=function(t,e,i){const n=t.segments,o=t.points,a=e.points,r=[];for(const h of n){let{start:t,end:n}=h;n=Ne(t,n,o);const l=Ge(i,o[t],o[n],h.loop);if(!e.segments){r.push({source:h,target:l,start:o[t],end:o[n]});continue}const c=(0,s.al)(e,l);for(const e of c){const t=Ge(i,a[e.start],a[e.end],e.loop),n=(0,s.av)(h,o,t);for(const s of n)r.push({source:s,target:e,start:{[i]:qe(l,t,"start",Math.max)},end:{[i]:qe(l,t,"end",Math.min)}})}}return r}(i,n,o);for(const{source:s,target:l,start:c,end:d}of h){const{style:{backgroundColor:e=a}={}}=s,h=!0!==n;t.save(),t.fillStyle=e,Ke(t,r,h&&Ge(o,c,d)),t.beginPath();const u=!!i.pathSegment(t,s);let g;if(h){u?t.closePath():Je(t,n,d,o);const e=!!n.pathSegment(t,l,{move:u,reverse:!0});g=u&&e,g||Je(t,n,c,o)}t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}function ti(t,e,i){const n=Ue(e),{line:o,scale:a,axis:r}=e,h=o.options,l=h.fill,c=h.backgroundColor,{above:d=c,below:u=c}=l||{};n&&o.points.length&&((0,s.W)(t,i),function(t,e){const{line:i,target:s,above:n,below:o,area:a,scale:r}=e,h=i._loop?"angle":e.axis;t.save(),"x"===h&&o!==n&&(Ze(t,s,a.top),Qe(t,{line:i,target:s,color:n,scale:r,property:h}),t.restore(),t.save(),Ze(t,s,a.bottom)),Qe(t,{line:i,target:s,color:o,scale:r,property:h}),t.restore()}(t,{line:o,target:n,above:d,below:u,area:i,scale:a,axis:r}),(0,s.Y)(t))}var ei={id:"filler",afterDatasetsUpdate(t,e,i){const s=(t.data.datasets||[]).length,n=[];let o,a,r,h;for(a=0;a=0;--a){const e=n[a].$filler;e&&(e.line.updateControlPoints(o,e.axis),s&&ti(t.ctx,e,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){const e=s[n].$filler;e&&ti(t.ctx,e,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;s&&!1!==s.fill&&"beforeDatasetDraw"===i.drawTime&&ti(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ii=(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 si extends Dt{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=(0,s.O)(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,n=(0,s.Z)(i.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:h}=ii(i,o);let l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(a,o,r,h)+10):(c=this.maxHeight,l=this._fitCols(a,o,r,h)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],h=this.lineWidths=[0],l=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-l;return this.legendItems.forEach(((t,g)=>{const p=i+e/2+n.measureText(t.text).width;(0===g||h[h.length-1]+p+2*a>o)&&(c+=l,h[h.length-(g>0?0:1)]=0,u+=l,d++),r[g]={left:0,top:u,row:d,width:p,height:s},h[h.length-1]+=p+a})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],h=this.columnSizes=[],l=o-t;let c=a,d=0,u=0,g=0,p=0;return this.legendItems.forEach(((t,o)=>{const f=i+e/2+n.measureText(t.text).width;o>0&&u+s+2*a>l&&(c+=d+a,h.push({width:d,height:u}),g+=d+a,p++,d=u=0),r[o]={left:g,top:u,col:p,width:f,height:s},d=Math.max(d,f),u+=s+a})),c+=d,h.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,a=(0,s.ax)(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=(0,s.a0)(i,this.left+n,this.right-this.lineWidths[o]);for(const h of e)o!==h.row&&(o=h.row,r=(0,s.a0)(i,this.left+n,this.right-this.lineWidths[o])),h.top+=this.top+t+n,h.left=a.leftForLtr(a.x(r),h.width),r+=h.width+n}else{let o=0,r=(0,s.a0)(i,this.top+t+n,this.bottom-this.columnSizes[o].height);for(const h of e)h.col!==o&&(o=h.col,r=(0,s.a0)(i,this.top+t+n,this.bottom-this.columnSizes[o].height)),h.top=r,h.left+=this.left+n,h.left=a.leftForLtr(a.x(h.left),h.width),r+=h.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;(0,s.W)(t,this),this._draw(),(0,s.Y)(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:a}=t,r=s.d.color,h=(0,s.ax)(t.rtl,this.left,this.width),l=(0,s.Z)(a.font),{color:c,padding:d}=a,u=l.size,g=u/2;let p;this.drawTitle(),n.textAlign=h.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;const{boxWidth:f,boxHeight:m,itemHeight:x}=ii(a,u),b=this.isHorizontal(),_=this._computeTitleHeight();p=b?{x:(0,s.a0)(o,this.left+d,this.right-i[0]),y:this.top+d+_,line:0}:{x:this.left+d,y:(0,s.a0)(o,this.top+_+d,this.bottom-e[0].height),line:0},(0,s.ay)(this.ctx,t.textDirection);const y=x+d;this.legendItems.forEach(((v,k)=>{n.strokeStyle=v.fontColor||c,n.fillStyle=v.fontColor||c;const w=n.measureText(v.text).width,M=h.textAlign(v.textAlign||(v.textAlign=a.textAlign)),D=f+g+w;let S=p.x,P=p.y;h.setWidth(this.width),b?k>0&&S+D+d>this.right&&(P=p.y+=y,p.line++,S=p.x=(0,s.a0)(o,this.left+d,this.right-i[p.line])):k>0&&P+y>this.bottom&&(S=p.x=S+e[p.line].width+d,p.line++,P=p.y=(0,s.a0)(o,this.top+_+d,this.bottom-e[p.line].height));!function(t,e,i){if(isNaN(f)||f<=0||isNaN(m)||m<0)return;n.save();const o=(0,s.v)(i.lineWidth,1);if(n.fillStyle=(0,s.v)(i.fillStyle,r),n.lineCap=(0,s.v)(i.lineCap,"butt"),n.lineDashOffset=(0,s.v)(i.lineDashOffset,0),n.lineJoin=(0,s.v)(i.lineJoin,"miter"),n.lineWidth=o,n.strokeStyle=(0,s.v)(i.strokeStyle,r),n.setLineDash((0,s.v)(i.lineDash,[])),a.usePointStyle){const a={radius:f*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:o},r=h.xPlus(t,f/2),l=e+g;(0,s.ar)(n,a,r,l)}else{const a=e+Math.max((u-m)/2,0),r=h.leftForLtr(t,f),l=(0,s.au)(i.borderRadius);n.beginPath(),Object.values(l).some((t=>0!==t))?(0,s.as)(n,{x:r,y:a,w:f,h:m,radius:l}):n.rect(r,a,f,m),n.fill(),0!==o&&n.stroke()}n.restore()}(h.x(S),P,v),S=(0,s.az)(M,S+f+g,b?S+D:this.right,t.rtl),function(t,e,i){(0,s.X)(n,i.text,t,e+x/2,l,{strikethrough:i.hidden,textAlign:h.textAlign(i.textAlign)})}(h.x(S),P,v),b?p.x+=D+d:p.y+=y})),(0,s.aA)(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=(0,s.Z)(e.font),n=(0,s.C)(e.padding);if(!e.display)return;const o=(0,s.ax)(t.rtl,this.left,this.width),a=this.ctx,r=e.position,h=i.size/2,l=n.top+h;let c,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),c=this.top+l,d=(0,s.a0)(t.align,d,this.right-u);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);c=l+(0,s.a0)(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const g=(0,s.a0)(r,d,d+u);a.textAlign=o.textAlign((0,s.$)(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,(0,s.X)(a,e.text,g,c,i)}_computeTitleHeight(){const t=this.options.title,e=(0,s.Z)(t.font),i=(0,s.C)(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if((0,s.ah)(t,this.left,this.right)&&(0,s.ah)(e,this.top,this.bottom))for(o=this.legendHitBoxes,i=0;it.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const r=t.controller.getStyle(i?0:void 0),h=(0,s.C)(r.borderWidth);return{text:e[t.index].label,fillStyle:r.backgroundColor,fontColor:a,hidden:!t.visible,lineCap:r.borderCapStyle,lineDash:r.borderDash,lineDashOffset:r.borderDashOffset,lineJoin:r.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:r.borderColor,pointStyle:n||r.pointStyle,rotation:r.rotation,textAlign:o||r.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 oi extends Dt{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 n=(0,s.b)(i.text)?i.text.length:1;this._padding=(0,s.C)(i.padding);const o=n*(0,s.Z)(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:a}=this,r=a.align;let h,l,c,d=0;return this.isHorizontal()?(l=(0,s.a0)(r,i,o),c=e+t,h=o-i):("left"===a.position?(l=i+t,c=(0,s.a0)(r,n,e),d=-.5*s.P):(l=o-t,c=(0,s.a0)(r,e,n),d=.5*s.P),h=n-e),{titleX:l,titleY:c,maxWidth:h,rotation:d}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=(0,s.Z)(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:r,rotation:h}=this._drawArgs(n);(0,s.X)(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:h,textAlign:(0,s.$)(e.align),textBaseline:"middle",translation:[o,a]})}}var ai={id:"title",_element:oi,start(t,e,i){!function(t,e){const i=new oi({ctx:t.ctx,options:e,chart:t});ht.configure(t,i,e),ht.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;ht.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;ht.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 ri=new WeakMap;var hi={id:"subtitle",start(t,e,i){const s=new oi({ctx:t.ctx,options:i,chart:t});ht.configure(t,s,i),ht.addBox(t,s),ri.set(t,s)},stop(t){ht.removeBox(t,ri.get(t)),ri.delete(t)},beforeUpdate(t,e,i){const s=ri.get(t);ht.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 li={average(t){if(!t.length)return!1;let e,i,s=0,n=0,o=0;for(e=0,i=t.length;e-1?t.split("\n"):t}function ui(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function gi(t,e){const i=t.chart.ctx,{body:n,footer:o,title:a}=t,{boxWidth:r,boxHeight:h}=e,l=(0,s.Z)(e.bodyFont),c=(0,s.Z)(e.titleFont),d=(0,s.Z)(e.footerFont),u=a.length,g=o.length,p=n.length,f=(0,s.C)(e.padding);let m=f.height,x=0,b=n.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(b+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b){m+=p*(e.displayColors?Math.max(h,l.lineHeight):l.lineHeight)+(b-p)*l.lineHeight+(b-1)*e.bodySpacing}g&&(m+=e.footerMarginTop+g*d.lineHeight+(g-1)*e.footerSpacing);let _=0;const y=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=c.string,(0,s.D)(t.title,y),i.font=l.string,(0,s.D)(t.beforeBody.concat(t.afterBody),y),_=e.displayColors?r+2+e.boxPadding:0,(0,s.D)(n,(t=>{(0,s.D)(t.before,y),(0,s.D)(t.lines,y),(0,s.D)(t.after,y)})),_=0,i.font=d.string,(0,s.D)(t.footer,y),i.restore(),x+=f.width,{width:x,height:m}}function pi(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:h}}=t;let l="center";return"center"===s?l=n<=(r+h)/2?"left":"right":n<=o/2?l="left":n>=a-o/2&&(l="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(l,t,e,i)&&(l="center"),l}function fi(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||pi(t,e,i,s),yAlign:s}}function mi(t,e,i,n){const{caretSize:o,caretPadding:a,cornerRadius:r}=t,{xAlign:h,yAlign:l}=i,c=o+a,{topLeft:d,topRight:u,bottomLeft:g,bottomRight:p}=(0,s.au)(r);let f=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,h);const m=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,c);return"center"===l?"left"===h?f+=c:"right"===h&&(f-=c):"left"===h?f-=Math.max(d,g)+o:"right"===h&&(f+=Math.max(u,p)+o),{x:(0,s.w)(f,0,n.width-e.width),y:(0,s.w)(m,0,n.height-e.height)}}function xi(t,e,i){const n=(0,s.C)(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function bi(t){return ci([],di(t))}function _i(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class yi extends Dt{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,n=new l(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,(0,s.h)(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),n=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let a=[];return a=ci(a,di(s)),a=ci(a,di(n)),a=ci(a,di(o)),a}getBeforeBody(t,e){return bi(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,n=[];return(0,s.D)(t,(t=>{const e={before:[],lines:[],after:[]},s=_i(i,t);ci(e.before,di(s.beforeLabel.call(this,t))),ci(e.lines,s.label.call(this,t)),ci(e.after,di(s.afterLabel.call(this,t))),n.push(e)})),n}getAfterBody(t,e){return bi(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),n=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let a=[];return a=ci(a,di(s)),a=ci(a,di(n)),a=ci(a,di(o)),a}_createItems(t){const e=this._active,i=this.chart.data,n=[],o=[],a=[];let r,h,l=[];for(r=0,h=e.length;rt.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),(0,s.D)(l,(e=>{const i=_i(t.callbacks,e);n.push(i.labelColor.call(this,e)),o.push(i.labelPointStyle.call(this,e)),a.push(i.labelTextColor.call(this,e))})),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=li[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=gi(this,i),a=Object.assign({},t,e),r=fi(this.chart,i,a),h=mi(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:h.x,y:h.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:h,topRight:l,bottomLeft:c,bottomRight:d}=(0,s.au)(r),{x:u,y:g}=t,{width:p,height:f}=e;let m,x,b,_,y,v;return"center"===o?(y=g+f/2,"left"===n?(m=u,x=m-a,_=y+a,v=y-a):(m=u+p,x=m+a,_=y-a,v=y+a),b=m):(x="left"===n?u+Math.max(h,c)+a:"right"===n?u+p-Math.max(l,d)-a:this.caretX,"top"===o?(_=g,y=_-a,m=x-a,b=x+a):(_=g+f,y=_+a,m=x+a,b=x-a),v=_),{x1:m,x2:x,x3:b,y1:_,y2:y,y3:v}}drawTitle(t,e,i){const n=this.title,o=n.length;let a,r,h;if(o){const l=(0,s.ax)(i.rtl,this.x,this.width);for(t.x=xi(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",a=(0,s.Z)(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,h=0;h0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,(0,s.as)(t,{x:e,y:f,w:l,h:h,radius:r}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),(0,s.as)(t,{x:i,y:f+1,w:l-2,h:h-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,f,l,h),t.strokeRect(e,f,l,h),t.fillStyle=a.backgroundColor,t.fillRect(i,f+1,l-2,h-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:h,boxWidth:l,boxPadding:c}=i,d=(0,s.Z)(i.bodyFont);let u=d.lineHeight,g=0;const p=(0,s.ax)(i.rtl,this.x,this.width),f=function(i){e.fillText(i,p.x(t.x+g),t.y+u/2),t.y+=u+o},m=p.textAlign(a);let x,b,_,y,v,k,w;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=xi(this,m,i),e.fillStyle=i.bodyColor,(0,s.D)(this.beforeBody,f),g=r&&"right"!==m?"center"===a?l/2+c:l+2+c:0,y=0,k=n.length;y0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=li[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=gi(this,t),a=Object.assign({},i,this._size),r=fi(e,t,a),h=mi(t,a,r,e);s._to===h.x&&n._to===h.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,h))}}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const a=(0,s.C)(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),(0,s.ay)(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),(0,s.aA)(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),o=!(0,s.af)(i,n),a=this._positionChanged(n,e);(o||a)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),h=e||!(0,s.af)(a,o)||r;return h&&(this._active=a,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),h}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=li[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}yi.positioners=li;var vi={id:"tooltip",_element:yi,positioners:li,afterInit(t,e,i){i&&(t.tooltip=new yi({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:s.aB,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"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},ki=Object.freeze({__proto__:null,Decimation:Ve,Filler:ei,Legend:ni,SubTitle:hi,Title:ai,Tooltip:vi});function wi(t,e,i,s){const n=t.indexOf(e);if(-1===n)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 n!==t.lastIndexOf(e)?i:n}class Mi extends Ft{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((0,s.k)(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:(0,s.w)(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:wi(i,t,(0,s.v)(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 n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=t;o<=e;o++)s.push({value:o});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.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 Di(t,e,{horizontal:i,minRotation:n}){const o=(0,s.t)(n),a=(i?Math.sin(o):Math.cos(o))||.001,r=.75*e*(""+t).length;return Math.min(e/a,r)}Mi.id="category",Mi.defaults={ticks:{callback:Mi.prototype.getLabelForValue}};class Si extends Ft{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(0,s.k)(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:n,max:o}=this;const a=t=>n=e?n:t,r=t=>o=i?o:t;if(t){const t=(0,s.s)(n),e=(0,s.s)(o);t<0&&e<0?r(0):t>0&&e>0&&a(0)}if(n===o){let e=1;(o>=Number.MAX_SAFE_INTEGER||n<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*o)),r(o+e),t||a(n-e)}this.min=n,this.max=o}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.${this.id}.ticks.stepSize: ${s} would result generating up to ${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 n=function(t,e){const i=[],{bounds:n,step:o,min:a,max:r,precision:h,count:l,maxTicks:c,maxDigits:d,includeBounds:u}=t,g=o||1,p=c-1,{min:f,max:m}=e,x=!(0,s.k)(a),b=!(0,s.k)(r),_=!(0,s.k)(l),y=(m-f)/(d+1);let v,k,w,M,D=(0,s.aE)((m-f)/p/g)*g;if(D<1e-14&&!x&&!b)return[{value:f},{value:m}];M=Math.ceil(m/D)-Math.floor(f/D),M>p&&(D=(0,s.aE)(M*D/p/g)*g),(0,s.k)(h)||(v=Math.pow(10,h),D=Math.ceil(D*v)/v),"ticks"===n?(k=Math.floor(f/D)*D,w=Math.ceil(m/D)*D):(k=f,w=m),x&&b&&o&&(0,s.aF)((r-a)/o,D/1e3)?(M=Math.round(Math.min((r-a)/D,c)),D=(r-a)/M,k=a,w=r):_?(k=x?a:k,w=b?r:w,M=l-1,D=(w-k)/M):(M=(w-k)/D,M=(0,s.aG)(M,Math.round(M),D/1e3)?Math.round(M):Math.ceil(M));const S=Math.max((0,s.aH)(D),(0,s.aH)(k));v=Math.pow(10,(0,s.k)(h)?S:h),k=Math.round(k*v)/v,w=Math.round(w*v)/v;let P=0;for(x&&(u&&k!==a?(i.push({value:a}),k0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=(0,s.g)(t)?Math.max(0,t):null,this.max=(0,s.g)(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,n=this.max;const o=e=>i=t?i:e,a=t=>n=e?n:t,r=(t,e)=>Math.pow(10,Math.floor((0,s.L)(t))+e);i===n&&(i<=0?(o(1),a(10)):(o(r(i,-1)),a(r(n,1)))),i<=0&&o(r(n,-1)),n<=0&&a(r(i,1)),this._zero&&this.min!==this._suggestedMin&&i===r(this.min,0)&&o(r(i,-1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor((0,s.L)(e.max)),n=Math.ceil(e.max/Math.pow(10,i)),o=[];let a=(0,s.N)(t.min,Math.pow(10,Math.floor((0,s.L)(e.min)))),r=Math.floor((0,s.L)(a)),h=Math.floor(a/Math.pow(10,r)),l=r<0?Math.pow(10,Math.abs(r)):1;do{o.push({value:a,major:Ci(a)}),++h,10===h&&(h=1,++r,l=r>=0?1:l),a=Math.round(h*Math.pow(10,r)*l)/l}while(rn?{start:e-i,end:e}:{start:e,end:e+i}}function Ti(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=Object.assign({},e),n=[],o=[],a=t._pointLabels.length,r=t.options.pointLabels,h=r.centerPointLabels?s.P/a:0;for(let u=0;ue.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.starte.b&&(h=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+h))}function Ri(t){return 0===t||180===t?"center":t<180?"left":"right"}function zi(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function Fi(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function Ii(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,s.T);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s{const i=(0,s.O)(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?Ti(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){const e=s.T/(this._pointLabels.length||1),i=this.options.startAngle||0;return(0,s.aw)(t*e+(0,s.t)(i))}getDistanceFromCenterForValue(t){if((0,s.k)(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((0,s.k)(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=0;o--){const e=n.setContext(t.getPointLabelContext(o)),a=(0,s.Z)(e.font),{x:r,y:h,textAlign:l,left:c,top:d,right:u,bottom:g}=t._pointLabelItems[o],{backdropColor:p}=e;if(!(0,s.k)(p)){const t=(0,s.C)(e.backdropPadding);i.fillStyle=p,i.fillRect(c-t.left,d-t.top,u-c+t.width,g-d+t.height)}(0,s.X)(i,t._pointLabels[o],r,h+a.lineHeight/2,a,{color:e.color,textAlign:l,textBaseline:"middle"})}}(this,o),n.display&&this.ticks.forEach(((t,e)=>{if(0!==e){r=this.getDistanceFromCenterForValue(t.value);!function(t,e,i,s){const n=t.ctx,o=e.circular,{color:a,lineWidth:r}=e;!o&&!s||!a||!r||i<0||(n.save(),n.strokeStyle=a,n.lineWidth=r,n.setLineDash(e.borderDash),n.lineDashOffset=e.borderDashOffset,n.beginPath(),Ii(t,i,o,s),n.closePath(),n.stroke(),n.restore())}(this,n.setContext(this.getContext(e-1)),r,o)}})),i.display){for(t.save(),a=o-1;a>=0;a--){const s=i.setContext(this.getPointLabelContext(a)),{color:n,lineWidth:o}=s;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,r=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),h=this.getPointPosition(a,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(h.x,h.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((n,r)=>{if(0===r&&!e.reverse)return;const h=i.setContext(this.getContext(r)),l=(0,s.Z)(h.font);if(o=this.getDistanceFromCenterForValue(this.ticks[r].value),h.showLabelBackdrop){t.font=l.string,a=t.measureText(n.label).width,t.fillStyle=h.backdropColor;const e=(0,s.C)(h.backdropPadding);t.fillRect(-a/2-e.left,-o-l.size/2-e.top,a+e.width,l.size+e.height)}(0,s.X)(t,n.label,0,-o,l,{color:h.color})})),t.restore()}drawTitle(){}}Vi.id="radialLinear",Vi.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Pt.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}},Vi.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},Vi.descriptors={angleLines:{_fallback:"grid"}};const Bi={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}},Hi=Object.keys(Bi);function Wi(t,e){return t-e}function Ni(t,e){if((0,s.k)(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:a}=t._parseOpts;let r=e;return"function"===typeof n&&(r=n(r)),(0,s.g)(r)||(r="string"===typeof n?i.parse(r,n):i.parse(r)),null===r?null:(o&&(r="week"!==o||!(0,s.q)(a)&&!0!==a?i.startOf(r,o):i.startOf(r,"isoWeek",a)),+r)}function ji(t,e,i,s){const n=Hi.length;for(let o=Hi.indexOf(t);o=e?i[n]:i[o]]=!0}}else t[e]=!0}function Ui(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a=0&&(e[h].major=!0);return e}(t,s,n,i):s}class Yi extends Ft{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={}),n=this._adapter=new W._date(t.adapters.date);(0,s.a9)(i.displayFormats,n.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:Ni(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:n,max:o,minDefined:a,maxDefined:r}=this.getUserBounds();function h(t){a||isNaN(t.min)||(n=Math.min(n,t.min)),r||isNaN(t.max)||(o=Math.max(o,t.max))}a&&r||(h(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||h(this.getMinMax(!1))),n=(0,s.g)(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=(0,s.g)(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_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,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,a=this.max,r=(0,s.aJ)(n,o,a);return this._unit=e.unit||(i.autoSkip?ji(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):function(t,e,i,s,n){for(let o=Hi.length-1;o>=Hi.indexOf(i);o--){const i=Hi[o];if(Bi[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return Hi[i?Hi.indexOf(i):0]}(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=Hi.indexOf(t)+1,i=Hi.length;e1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);const p="data"===n.ticks.source&&this.getDataTimestamps();for(d=g,u=0;dt-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,n){const o=this.options,a=o.time.displayFormats,r=this._unit,h=this._majorUnit,l=r&&a[r],c=h&&a[h],d=i[e],u=h&&c&&d&&d.major,g=this._adapter.format(t,n||(u?c:l)),p=o.ticks.callback;return p?(0,s.O)(p,[g,e,i],this):g}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a: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=t[h].pos&&e<=t[l].pos&&({lo:h,hi:l}=(0,s.x)(t,"pos",e)),({pos:n,time:a}=t[h]),({pos:o,time:r}=t[l])):(e>=t[h].time&&e<=t[l].time&&({lo:h,hi:l}=(0,s.x)(t,"time",e)),({time:n,pos:a}=t[h]),({time:o,pos:r}=t[l]));const c=o-n;return c?a+(r-a)*(e-n)/c:a}Yi.id="time",Yi.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class Zi extends Yi{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=Xi(e,this.min),this._tableRange=Xi(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,h,l;for(o=0,a=t.length;o=e&&h<=i&&s.push(h);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o