diff --git a/THIRD_PARTY.txt b/THIRD_PARTY.txt index 5adf0db2..ce65f355 100644 --- a/THIRD_PARTY.txt +++ b/THIRD_PARTY.txt @@ -314,7 +314,7 @@ https://cdnjs.cloudflare.com/ajax/libs/bxslider/4.2.15/jquery.bxslider.min.js https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.bundle.min.js https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.css https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.9.1/chart.min.js -https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.3.0/chart.min.js +https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.3.2/chart.min.js https://cdnjs.cloudflare.com/ajax/libs/chosen/1.8.7/chosen.jquery.min.js https://cdnjs.cloudflare.com/ajax/libs/clappr/0.4.7/clappr.min.js https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js diff --git a/modules/internal/targets.js b/modules/internal/targets.js index 070d9ccf..26356110 100644 --- a/modules/internal/targets.js +++ b/modules/internal/targets.js @@ -171,7 +171,7 @@ targets.setLastVersion = function (type, version) { if (type.startsWith('/bxslider/4.')) return '4.2.15'; if (type.startsWith('/Chart.js/2.')) return '2.9.4'; if (type.startsWith('/Chart.js/3.')) return '3.9.1'; - if (type.startsWith('/Chart.js/4.')) return '4.3.0'; + if (type.startsWith('/Chart.js/4.')) return '4.3.2'; if (type.startsWith('/clappr/0.') || type.startsWith('/clappr/latest/')) return '0.4.7'; if (type.startsWith('/chosen/1.')) return '1.8.7'; if (type.startsWith('/clipboard.js/1.')) return '1.7.1'; diff --git a/pages/updates/updates.html b/pages/updates/updates.html index 9484fd8a..73de5792 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -28,6 +28,7 @@

diff --git a/resources/Chart.js/4.3.0/chart.min.jsm b/resources/Chart.js/4.3.0/chart.min.jsm deleted file mode 100644 index 71bc22ef..00000000 --- a/resources/Chart.js/4.3.0/chart.min.jsm +++ /dev/null @@ -1 +0,0 @@ -import{r as requestAnimFrame,a as resolve,e as effects,c as color,i as isObject,d as defaults,b as isArray,v as valueOrDefault,u as unlistenArrayEvents,l as listenArrayEvents,f as resolveObjectKey,g as isNumberFinite,h as defined,s as sign,j as createContext,k as isNullOrUndef,_ as _arrayUnique,t as toRadians,m as toPercentage,n as toDimension,T as TAU,o as formatNumber,p as _angleBetween,H as HALF_PI,P as PI,q as _getStartAndCountOfVisiblePoints,w as _scaleRangesChanged,x as isNumber,y as _parseObjectDataRadialScale,z as getRelativePosition,A as _rlookupByKey,B as _lookupByKey,C as _isPointInArea,D as getAngleFromPoint,E as toPadding,F as each,G as getMaximumSize,I as _getParentNode,J as readUsedSize,K as supportsEventListenerOptions,L as throttled,M as _isDomSupported,N as _factorize,O as finiteOrDefault,Q as callback,R as _addGrace,S as _limitValue,U as toDegrees,V as _measureText,W as _int16Range,X as _alignPixel,Y as clipArea,Z as renderText,$ as unclipArea,a0 as toFont,a1 as _toLeftRightCenter,a2 as _alignStartEnd,a3 as overrides,a4 as merge,a5 as _capitalize,a6 as descriptors,a7 as isFunction,a8 as _attachContext,a9 as _createResolver,aa as _descriptors,ab as mergeIf,ac as uid,ad as debounce,ae as retinaScale,af as clearCanvas,ag as setsEqual,ah as _elementsEqual,ai as _isClickEvent,aj as _isBetween,ak as _readValueToProps,al as _updateBezierControlPoints,am as _computeSegments,an as _boundSegments,ao as _steppedInterpolation,ap as _bezierInterpolation,aq as _pointInLine,ar as _steppedLineTo,as as _bezierCurveTo,at as drawPoint,au as addRoundedRectPath,av as toTRBL,aw as toTRBLCorners,ax as _boundSegment,ay as _normalizeAngle,az as getRtlAdapter,aA as overrideTextDirection,aB as _textX,aC as restoreTextDirection,aD as drawPointLegend,aE as distanceBetweenPoints,aF as noop,aG as _setMinAndMaxByKey,aH as niceNum,aI as almostWhole,aJ as almostEquals,aK as _decimalPlaces,aL as Ticks,aM as log10,aN as _longestText,aO as _filterBetween,aP as _lookup}from"./chunks/helpers.segment.js";import"@kurkle/color";class Animator{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,i,a,t){const s=i.listeners[t],n=i.duration;s.forEach(t=>t({chart:e,initial:i.initial,numSteps:n,currentStep:Math.min(a-i.start,n)}))}_refresh(){this._request||(this._running=!0,this._request=requestAnimFrame.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(r=Date.now()){let o=0;this._charts.forEach((a,s)=>{if(a.running&&a.items.length){const n=a.items;let t=n.length-1,e=!1,i;for(;0<=t;--t)(i=n[t])._active?(i._total>a.duration&&(a.duration=i._total),i.tick(r),e=!0):(n[t]=n[n.length-1],n.pop());e&&(s.draw(),this._notify(s,a,r,"progress")),n.length||(a.running=!1,this._notify(s,a,r,"complete"),a.initial=!1),o+=n.length}}),this._lastDate=r,0===o&&(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 0Math.max(t,e._duration),0),this._refresh())}running(t){if(!this._running)return!1;t=this._charts.get(t);return!!(t&&t.running&&t.items.length)}stop(e){const i=this._charts.get(e);if(i&&i.items.length){const a=i.items;let t=a.length-1;for(;0<=t;--t)a[t].cancel();i.items=[],this._notify(e,i,Date.now(),"complete")}}remove(t){return this._charts.delete(t)}}var animator=new Animator;const transparent="transparent",interpolators={boolean(t,e,i){return.5{i.push({res:t,rej:e})})}_notify(t){var e=t?"res":"rej";const i=this._promises||[];for(let t=0;t{const t=s[e];if(isObject(t)){const i={};for(const a of n)i[a]=t[a];(isArray(t.properties)&&t.properties||[e]).forEach(t=>{t!==e&&r.has(t)||r.set(t,i)})}})}}_animateOptions(t,e){const i=e.options;e=resolveTargetOptions(t,i);if(!e)return[];e=this._createAnimations(e,i);return i.$shared&&awaitAll(t.options.$animations,i).then(()=>{t.options=i},()=>{}),e}_createAnimations(e,i){const a=this._properties,s=[],n=e.$animations||(e.$animations={});var t=Object.keys(i),r=Date.now();let o;for(o=t.length-1;0<=o;--o){const d=t[o];if("$"!==d.charAt(0))if("options"===d)s.push(...this._animateOptions(e,i));else{var l=i[d];let t=n[d];var h=a.get(d);if(t){if(h&&t.active()){t.update(h,l,r);continue}t.cancel()}h&&h.duration?(n[d]=t=new Animation(h,e,d,l),s.push(t)):e[d]=l}}return s}update(t,e){{if(0!==this._properties.size)return(t=this._createAnimations(t,e)).length?(animator.add(this._chart,t),!0):void 0;Object.assign(t,e)}}}function awaitAll(e,t){const i=[];var a=Object.keys(t);for(let t=0;ti[t].axis===e).shift()}function createDatasetContext(t,e){return createContext(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function createDataContext(t,e,i){return createContext(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}function clearStacks(t,e){var i=t.controller.index,a=t.vScale&&t.vScale.axis;if(a)for(const s of e=e||t._parsed){const n=s._stacks;if(!n||void 0===n[a]||void 0===n[a][i])return;delete n[a][i],void 0!==n[a]._visualValues&&void 0!==n[a]._visualValues[i]&&delete n[a]._visualValues[i]}}const isDirectUpdateMode=t=>"reset"===t||"none"===t,cloneIfNotShared=(t,e)=>e?t:Object.assign({},t),createStack=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:getSortedDatasetIndices(i,!0),values:null};class DatasetController{static defaults={};static datasetElementType=null;static dataElementType=null;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.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=isStacked(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&clearStacks(this._cachedMeta),this.index=t}linkScales(){var t=this.chart;const e=this._cachedMeta;var i=this.getDataset(),a=(t,e,i,a)=>"x"===t?e:"r"===t?a:i,s=e.xAxisID=valueOrDefault(i.xAxisID,getFirstScaleId(t,"x")),n=e.yAxisID=valueOrDefault(i.yAxisID,getFirstScaleId(t,"y")),i=e.rAxisID=valueOrDefault(i.rAxisID,getFirstScaleId(t,"r")),t=e.indexAxis,r=e.iAxisID=a(t,s,n,i),a=e.vAxisID=a(t,n,s,i);e.xScale=this.getScaleForId(s),e.yScale=this.getScaleForId(n),e.rScale=this.getScaleForId(i),e.iScale=this.getScaleForId(r),e.vScale=this.getScaleForId(a)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){var e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){var t=this._cachedMeta;this._data&&unlistenArrayEvents(this._data,this),t._stacked&&clearStacks(t)}_dataCheck(){const t=this.getDataset();var e=t.data||(t.data=[]),i=this._data;if(isObject(e))this._data=convertObjectDataToArray(e);else if(i!==e){if(i){unlistenArrayEvents(i,this);const a=this._cachedMeta;clearStacks(a),a._parsed=[]}e&&Object.isExtensible(e)&&listenArrayEvents(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta;var i=this.getDataset();let a=!1;this._dataCheck();var s=e._stacked;e._stacked=isStacked(e.vScale,e),e.stack!==i.stack&&(a=!0,clearStacks(e),e.stack=i.stack),this._resyncElements(t),!a&&s===e._stacked||updateStacks(this,e._parsed)}configure(){const t=this.chart.config;var e=t.datasetScopeKeys(this._type),e=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(e,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:a}=this;var{iScale:s,_stacked:n}=i;const r=s.axis;let o=0===t&&e===a.length||i._sorted,l=0t||dthis.getContext(i,a,e),h);return d.$shared&&(d.$shared=o,s[n]=Object.freeze(cloneIfNotShared(d,o))),d}_resolveAnimations(t,e,i){var a=this.chart;const s=this._cachedDataOpts;var n="animation-"+e,r=s[n];if(r)return r;let o;if(!1!==a.options.animation){const l=this.chart.config;r=l.datasetAnimationScopeKeys(this._type,e),r=l.getOptionScopes(this.getDataset(),r);o=l.createResolver(r,this.getContext(t,i,e))}r=new Animations(a,o&&o.animations);return o&&o._cacheable&&(s[n]=Object.freeze(r)),r}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||isDirectUpdateMode(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){var t=this.resolveDataElementOptions(t,e),i=this._sharedOptions,a=this.getSharedOptions(t),i=this.includeOptions(e,a)||a!==i;return this.updateSharedOptions(a,e,t),{sharedOptions:a,includeOptions:i}}updateElement(t,e,i,a){isDirectUpdateMode(a)?Object.assign(t,i):this._resolveAnimations(e,a).update(t,i)}updateSharedOptions(t,e,i){t&&!isDirectUpdateMode(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,a){t.active=a;var s=this.getStyle(e,a);this._resolveAnimations(e,i,a).update(t,{options:!a&&this.getSharedOptions(s)||s})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){var e,i,a,s=this._data,n=this._cachedMeta.data;for([e,i,a]of this._syncList)this[e](i,a);this._syncList=[];var n=n.length,s=s.length,r=Math.min(s,n);r&&this.parse(0,r),n{for(t.length+=e,r=t.length-1;r>=n;r--)t[r]=t[r-e]};for(o(s),r=t;rt-e))}return a._cache.$bar}function computeMinSampleSize(t){const e=t.iScale;var i=getAllScaleValues(e,t.type);let a=e._length,s,n,r,o;var l=()=>{32767!==r&&-32768!==r&&(defined(o)&&(a=Math.min(a,Math.abs(r-o)||a)),o=r)};for(s=0,n=i.length;sMath.abs(n)&&(r=n,o=a),e[i.axis]=o,e._custom={barStart:r,barEnd:o,start:s,end:t,min:a,max:n}}function parseValue(t,e,i,a){return isArray(t)?parseFloatBar(t,e,i,a):e[i.axis]=i.parse(t,a),e}function parseArrayOrPrimitive(t,e,i,a){const s=t.iScale;var n=t.vScale,r=s.getLabels(),o=s===n;const l=[];let h,d,c,u;for(d=(h=i)+a;h=i?1:-1)}function borderProps(t){let e,i,a,s,n;return a=t.horizontal?(e=t.base>t.x,i="left","right"):(e=t.baset.controller.options.grouped),s=e.options.stacked;const n=[];for(const r of a)if((void 0===i||!(t=>{var e=t.controller.getParsed(i),e=e&&e[t.vScale.axis];if(isNullOrUndef(e)||isNaN(e))return!0})(r))&&((!1===s||-1===n.indexOf(r.stack)||void 0===s&&void 0===r.stack)&&n.push(r.stack),r.index===t))break;return n.length||n.push(void 0),n}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const a=this._getStacks(t,i);t=void 0!==e?a.indexOf(e):-1;return-1===t?a.length-1:t}_getRuler(){var t=this.options,e=this._cachedMeta;const i=e.iScale,a=[];let s,n;for(s=0,n=e.data.length;s_angleBetween(t,u,g,!0)?1:Math.max(e,e*a,i,i*a),d=(t,e,i)=>_angleBetween(t,u,g,!0)?-1:Math.min(e,e*a,i,i*a),c=h(0,t,o),h=h(HALF_PI,e,l),t=d(PI,t,o),o=d(PI+HALF_PI,e,l);i=(c-t)/2,s=(h-o)/2,n=-(c+t)/2,r=-(h+o)/2}return{ratioX:i,ratioY:s,offsetX:n,offsetY:r}}class DoughnutController extends DatasetController{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(s){const t=s.data;if(t.labels.length&&t.datasets.length){const{pointStyle:n,color:r}=s.legend.options["labels"];return t.labels.map((t,e)=>{const i=s.getDatasetMeta(0);var a=i.controller.getStyle(e);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:n,hidden:!s.getDataVisibility(e),index:e}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};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(a,s){const n=this.getDataset().data,r=this._cachedMeta;if(!1===this._parsing)r._parsed=n;else{let t=t=>+n[t];if(isObject(n[a])){const{key:o="value"}=this._parsing;t=t=>+resolveObjectKey(n[t],o)}let e,i;for(i=(e=a)+s;e=v?M.skip=!0:(_=this.getParsed(t),y=isNullOrUndef(_[u]),k=M[c]=n.getPixelForValue(_[c],t),S=M[u]=s||y?r.getBasePixel():r.getPixelForValue(o?this.applyStack(r,_,o):_[u],t),M.skip=isNaN(k)||isNaN(S)||y,M.stop=0f,p&&(M.parsed=_,M.raw=l.data[t]),d&&(M.options=h||this.resolveDataElementOptions(t,D.active?"active":a)),m||this.updateElement(D,t,M,a),b=_)}}getMaxOverflow(){var t=this._cachedMeta,e=t.dataset,e=e.options&&e.options.borderWidth||0;const i=t.data||[];if(!i.length)return e;var t=i[0].size(this.resolveDataElementOptions(0)),a=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(e,t,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class PolarAreaController extends DatasetController{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(s){const t=s.data;if(t.labels.length&&t.datasets.length){const{pointStyle:n,color:r}=s.legend.options["labels"];return t.labels.map((t,e)=>{const i=s.getDatasetMeta(0);var a=i.controller.getStyle(e);return{text:t,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:r,lineWidth:a.borderWidth,pointStyle:n,hidden:!s.getDataVisibility(e),index:e}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){var e=this._cachedMeta,i=this.chart,a=i.data.labels||[],e=formatNumber(e._parsed[t].r,i.options.locale);return{label:a[t]||"",value:e}}parseObjectData(t,e,i,a){return _parseObjectDataRadialScale.bind(this)(t,e,i,a)}update(t){var e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,a={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,e)=>{var i=this.getParsed(e).r;!isNaN(i)&&this.chart.getDataVisibility(e)&&(ia.max&&(a.max=i))}),a}_updateRadius(){const t=this.chart;var e=t.chartArea,i=t.options,e=Math.min(e.right-e.left,e.bottom-e.top),e=Math.max(e/2,0),i=(e-Math.max(i.cutoutPercentage?e/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=e-i*this.index,this.innerRadius=this.outerRadius-i}updateElements(a,t,e,s){var n="reset"===s;const r=this.chart;var o=r.options.animation;const l=this._cachedMeta.rScale;var h=l.xCenter,d=l.yCenter,c=l.getIndexAngle(0)-.5*PI;let u=c,g;var p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(e).r)&&this.chart.getDataVisibility(e)&&i++}),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?toRadians(this.resolveDataElementOptions(t,e).angle||i):0}}class PieController extends DoughnutController{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class RadarController extends DatasetController{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale;var i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,a){return _parseObjectDataRadialScale.bind(this)(t,e,i,a)}update(t){const e=this._cachedMeta,i=e.dataset;var a=e.data||[],s=e.iScale.getLabels();if(i.points=a,"resize"!==t){const n=this.resolveDatasetElementOptions(t);this.options.showLine||(n.borderWidth=0);s={_loop:!0,_fullLoop:s.length===a.length,options:n};this.updateElement(i,void 0,s,t)}this.updateElements(a,0,a.length,t)}updateElements(e,i,a,s){const n=this._cachedMeta.rScale;var r="reset"===s;for(let t=i;tm,f&&(D.parsed=_,D.raw=h.data[t]),c&&(D.options=d||this.resolveDataElementOptions(t,b.active?"active":s)),v||this.updateElement(b,t,D,s),x=_}this.updateSharedOptions(d,s,t)}getMaxOverflow(){var t=this._cachedMeta;const i=t.data||[];if(!this.options.showLine){let e=0;for(let t=i.length-1;0<=t;--t)e=Math.max(e,i[t].size(this.resolveDataElementOptions(t))/2);return 0{t[o](a[s],n)&&(r.push({element:t,datasetIndex:e,index:i}),l=l||t.inRange(a.x,a.y,n))}),e&&!l?[]:r}var Interaction={evaluateInteractionItems:evaluateInteractionItems,modes:{index(t,e,i,a){var e=getRelativePosition(e,t),s=i.axis||"x",n=i.includeInvisible||!1;const r=i.intersect?getIntersectItems(t,e,s,a,n):getNearestItems(t,e,s,!1,a,n),o=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{var e=r[0].index,i=t.data[e];i&&!i.skip&&o.push({element:i,datasetIndex:t.index,index:e})}),o):[]},dataset(t,e,i,a){var e=getRelativePosition(e,t),s=i.axis||"xy",n=i.includeInvisible||!1;let r=i.intersect?getIntersectItems(t,e,s,a,n):getNearestItems(t,e,s,!1,a,n);if(0t.pos===e)}function filterDynamicPositionByAxis(t,e){return t.filter(t=>-1===STATIC_POSITIONS.indexOf(t.pos)&&t.box.axis===e)}function sortByWeight(t,a){return t.sort((t,e)=>{var i=a?e:t,t=a?t:e;return i.weight===t.weight?i.index-t.index:i.weight-t.weight})}function wrapBoxes(t){const e=[];let i,a,s,n,r,o;for(i=0,a=(t||[]).length;it.box.fullSize),!0);const i=sortByWeight(filterByPosition(e,"left"),!0),a=sortByWeight(filterByPosition(e,"right")),s=sortByWeight(filterByPosition(e,"top"),!0);var n=sortByWeight(filterByPosition(e,"bottom")),r=filterDynamicPositionByAxis(e,"x"),o=filterDynamicPositionByAxis(e,"y");return{fullSize:t,leftAndTop:i.concat(s),rightAndBottom:a.concat(o).concat(n).concat(r),chartArea:filterByPosition(e,"chartArea"),vertical:i.concat(a).concat(o),horizontal:s.concat(n).concat(r)}}function getCombinedMax(t,e,i,a){return Math.max(t[i],e[i])+Math.max(t[a],e[a])}function updateMaxPadding(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function updateDims(t,e,i,a){const{pos:s,box:n}=i;var r=t.maxPadding;if(!isObject(s)){i.size&&(t[s]-=i.size);const l=a[i.stack]||{size:0,count:1};l.size=Math.max(l.size,i.horizontal?n.height:n.width),i.size=l.size/l.count,t[s]+=i.size}n.getPadding&&updateMaxPadding(r,n.getPadding());var a=Math.max(0,e.outerWidth-getCombinedMax(r,t,"left","right")),e=Math.max(0,e.outerHeight-getCombinedMax(r,t,"top","bottom")),r=a!==t.w,o=e!==t.h;return t.w=a,t.h=e,i.horizontal?{same:r,other:o}:{same:o,other:r}}function handleMaxPadding(i){const a=i.maxPadding;function t(t){var e=Math.max(a[t]-i[t],0);return i[t]+=e,e}i.y+=t("top"),i.x+=t("left"),t("right"),t("bottom")}function getMargins(t,i){const a=i.maxPadding;function e(t){const e={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{e[t]=Math.max(i[t],a[t])}),e}return e(t?["left","right"]:["top","bottom"])}function fitBoxes(t,e,i,a){const s=[];let n,r,o,l,h,d;for(n=0,r=t.length,h=0;n{"function"==typeof t.beforeLayout&&t.beforeLayout()}),d.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1),t=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:n,availableHeight:r,vBoxMaxWidth:n/2/h,hBoxMaxHeight:r/2}),e=Object.assign({},s);updateMaxPadding(e,toPadding(a));const c=Object.assign({maxPadding:e,w:n,h:r,x:s.left,y:s.top},s);h=setLayoutDims(d.concat(l),t);fitBoxes(o.fullSize,c,t,h),fitBoxes(d,c,t,h),fitBoxes(l,c,t,h)&&fitBoxes(d,c,t,h),handleMaxPadding(c),placeBoxes(o.leftAndTop,c,t,h),c.x+=c.w,c.y+=c.h,placeBoxes(o.rightAndBottom,c,t,h),i.chartArea={left:c.left,top:c.top,right:c.left+c.w,bottom:c.top+c.h,height:c.h,width:c.w},each(o.chartArea,t=>{const e=t.box;Object.assign(e,i.chartArea),e.update(c.w,c.h,{left:0,top:0,right:0,bottom:0})})}}};class BasePlatform{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,a){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,a?Math.floor(e/a):i)}}isAttached(t){return!0}updateConfig(t){}}class BasicPlatform extends BasePlatform{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const EXPANDO_KEY="$chartjs",EVENT_TYPES={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=t=>null===t||""===t;function initCanvas(t,e){const i=t.style;var a=t.getAttribute("height"),s=t.getAttribute("width");return t[EXPANDO_KEY]={initial:{height:a,width:s,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",isNullOrEmpty(s)&&void 0!==(s=readUsedSize(t,"width"))&&(t.width=s),isNullOrEmpty(a)&&(""===t.style.height?t.height=t.width/(e||2):void 0!==(s=readUsedSize(t,"height"))&&(t.height=s)),t}const eventListenerOptions=!!supportsEventListenerOptions&&{passive:!0};function addListener(t,e,i){t.addEventListener(e,i,eventListenerOptions)}function removeListener(t,e,i){t.canvas.removeEventListener(e,i,eventListenerOptions)}function fromNativeEvent(t,e){var i=EVENT_TYPES[t.type]||t.type,{x:a,y:s}=getRelativePosition(t,e);return{type:i,chart:e,native:t,x:void 0!==a?a:null,y:void 0!==s?s:null}}function nodeListContains(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function createAttachObserver(t,e,a){const s=t.canvas,i=new MutationObserver(t=>{let e=!1;for(const i of t)e=(e=e||nodeListContains(i.addedNodes,s))&&!nodeListContains(i.removedNodes,s);e&&a()});return i.observe(document,{childList:!0,subtree:!0}),i}function createDetachObserver(t,e,a){const s=t.canvas,i=new MutationObserver(t=>{let e=!1;for(const i of t)e=(e=e||nodeListContains(i.removedNodes,s))&&!nodeListContains(i.addedNodes,s);e&&a()});return i.observe(document,{childList:!0,subtree:!0}),i}const drpListeningCharts=new Map;let oldDevicePixelRatio=0;function onWindowResize(){const i=window.devicePixelRatio;i!==oldDevicePixelRatio&&(oldDevicePixelRatio=i,drpListeningCharts.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function listenDevicePixelRatioChanges(t,e){drpListeningCharts.size||window.addEventListener("resize",onWindowResize),drpListeningCharts.set(t,e)}function unlistenDevicePixelRatioChanges(t){drpListeningCharts.delete(t),drpListeningCharts.size||window.removeEventListener("resize",onWindowResize)}function createResizeObserver(t,e,a){var i=t.canvas;const s=i&&_getParentNode(i);if(s){const n=throttled((t,e)=>{var i=s.clientWidth;a(t,e),i{var t=t[0],e=t.contentRect.width,t=t.contentRect.height;0===e&&0===t||n(e,t)});return r.observe(s),listenDevicePixelRatioChanges(t,n),r}}function releaseObserver(t,e,i){i&&i.disconnect(),"resize"===e&&unlistenDevicePixelRatioChanges(t)}function createProxyAndListen(e,t,i){var a=e.canvas,s=throttled(t=>{null!==e.ctx&&i(fromNativeEvent(t,e))},e);return addListener(a,t,s),s}class DomPlatform extends BasePlatform{acquireContext(t,e){var i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(initCanvas(t,e),i):null}releaseContext(t){const i=t.canvas;if(!i[EXPANDO_KEY])return!1;const a=i[EXPANDO_KEY].initial,e=(["height","width"].forEach(t=>{var e=a[t];isNullOrUndef(e)?i.removeAttribute(t):i.setAttribute(t,e)}),a.style||{});return Object.keys(e).forEach(t=>{i.style[t]=e[t]}),i.width=i.width,delete i[EXPANDO_KEY],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const a=t.$proxies||(t.$proxies={});const s={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[e]||createProxyAndListen;a[e]=s(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={});var a=i[e];if(a){const s={attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[e]||removeListener;s(t,e,a),i[e]=void 0}}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,a){return getMaximumSize(t,e,i,a)}isAttached(t){t=_getParentNode(t);return!(!t||!t.isConnected)}}function _detectPlatform(t){return!_isDomSupported()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?BasicPlatform:DomPlatform}class Element{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){var{x:t,y:e}=this.getProps(["x","y"],t);return{x:t,y:e}}hasValue(){return isNumber(this.x)&&isNumber(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const a={};return t.forEach(t=>{a[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),a}}function autoSkip(i,a){var s=i.options.ticks,i=determineMaxTicks(i),i=Math.min(s.maxTicksLimit||i,i),n=s.major.enabled?getMajorIndices(a):[],s=n.length,r=n[0],o=n[s-1],l=[];if(i"left"===t?"right":"right"===t?"left":t,offsetFromEdge=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,getTicksLimit=(t,e)=>Math.min(e||t,t);function sample(t,e){const i=[];var a=t.length/e,s=t.length;let n=0;for(;nr+1e-6)))return o}function garbageCollect(t,s){each(t,t=>{const e=t.gc;var i=e.length/2;let a;if(ss?s:a,s=n&&a>s?a:s,{min:finiteOrDefault(a,finiteOrDefault(s,a)),max:finiteOrDefault(s,finiteOrDefault(a,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){var t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){callback(this.options.beforeUpdate,[this])}update(t,e,i){var{beginAtZero:a,grace:s,ticks:n}=this.options,r=n.sampleSize,t=(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=_addGrace(this,s,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks(),r({width:n[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(i),highest:k(y),widths:n,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);t=this._startPixel+t*this._length;return _int16Range(this._alignToPixels?_alignPixel(this.chart,t,0):t)}getDecimalForPixel(t){t=(t-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){var{min:t,max:e}=this;return t<0&&e<0?e:0t.value===e);return 0<=a?t.setContext(this.getContext(a)).lineWidth:0}drawGrid(t){var e=this.options.grid;const a=this.ctx;var i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let s,n;var r=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(e.display)for(s=0,n=i.length;s{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:t,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){var e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID";const a=[];let s,n;for(s=0,n=e.length;s{const e=t.split(".");var i=e.pop(),a=[r].concat(e).join(".");const s=o[t].split(".");var t=s.pop(),n=s.join(".");defaults.route(a,i,n,t)})}function isIChartComponent(t){return"id"in t&&"defaults"in t}class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"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(i,t,a){[...t].forEach(t=>{const e=a||this._getRegistryForType(t);a||e.isForType(t)||e===this.plugins&&t.id?this._exec(i,e,t):each(t,t=>{var e=a||this._getRegistryForType(t);this._exec(i,e,t)})})}_exec(t,e,i){var a=_capitalize(t);callback(i["before"+a],[],i),e[t](i),callback(i["after"+a],[],i)}_getRegistryForType(e){for(let t=0;tt.filter(e=>!i.some(t=>e.plugin.id===t.plugin.id));this._notify(a(e,i),t,"stop"),this._notify(a(i,e),t,"start")}}function allPlugins(t){const e={},i=[];var a=Object.keys(registry.plugins.items);for(let t=0;tt.xAxisID===e||t.yAxisID===e);if(t.length)return getAxisFromDataset(e,"x",t[0])||getAxisFromDataset(e,"y",t[0])}return{}}function mergeScaleConfig(r,e){const n=overrides[r.type]||{scales:{}},o=e.scales||{},l=getIndexAxis(r.type,e),h=Object.create(null);return Object.keys(o).forEach(t=>{var e=o[t];if(!isObject(e))return console.error("Invalid scale configuration for scale: "+t);if(e._proxy)return console.warn("Ignoring resolver passed as options for scale: "+t);var i=determineAxis(t,e,retrieveAxisFromDatasets(t,r),defaults.scales[e.type]),a=getDefaultScaleIDFromAxis(i,l),s=n.scales||{};h[t]=mergeIf(Object.create(null),[{axis:i},e,s[i],s[a]])}),r.data.datasets.forEach(a=>{var t=a.type||r.type;const s=a.indexAxis||getIndexAxis(t,e),n=(overrides[t]||{}).scales||{};Object.keys(n).forEach(t=>{var e=getAxisFromDefaultScaleID(t,s),i=a[e+"AxisID"]||e;h[i]=h[i]||Object.create(null),mergeIf(h[i],[{axis:e},o[i],n[t]])})}),Object.keys(h).forEach(t=>{t=h[t];mergeIf(t,[defaults.scales[t.type],defaults.scale])}),h}function initOptions(t){const e=t.options||(t.options={});e.plugins=valueOrDefault(e.plugins,{}),e.scales=mergeScaleConfig(t,e)}function initData(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}function initConfig(t){return(t=t||{}).data=initData(t.data),initOptions(t),t}const keyCache=new Map,keysCached=new Set;function cachedKeys(t,e){let i=keyCache.get(t);return i||(i=e(),keyCache.set(t,i),keysCached.add(i)),i}const addIfFound=(t,e,i)=>{e=resolveObjectKey(e,i);void 0!==e&&t.add(e)};class Config{constructor(t){this._config=initConfig(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=initData(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){var t=this._config;this.clearCache(),initOptions(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return cachedKeys(t,()=>[["datasets."+t,""]])}datasetAnimationScopeKeys(t,e){return cachedKeys(t+".transition."+e,()=>[[`datasets.${t}.transitions.`+e,"transitions."+e],["datasets."+t,""]])}datasetElementScopeKeys(t,e){return cachedKeys(t+"-"+e,()=>[[`datasets.${t}.elements.`+e,"datasets."+t,"elements."+e,""]])}pluginScopeKeys(t){const e=t.id;return cachedKeys(this.type+"-plugin-"+e,()=>[["plugins."+e,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let a=i.get(t);return a&&!e||(a=new Map,i.set(t,a)),a}getOptionScopes(e,t,i){const{options:a,type:s}=this,n=this._cachedScopes(e,i);i=n.get(t);if(i)return i;const r=new Set,o=(t.forEach(t=>{e&&(r.add(e),t.forEach(t=>addIfFound(r,e,t))),t.forEach(t=>addIfFound(r,a,t)),t.forEach(t=>addIfFound(r,overrides[s]||{},t)),t.forEach(t=>addIfFound(r,defaults,t)),t.forEach(t=>addIfFound(r,descriptors,t))}),Array.from(r));return 0===o.length&&o.push(Object.create(null)),keysCached.has(t)&&n.set(t,o),o}chartOptionScopes(){var{options:t,type:e}=this;return[t,overrides[e]||{},defaults.datasets[e]||{},{type:e},defaults,descriptors]}resolveNamedOptions(t,e,i,a=[""]){const s={$shared:!0};var{resolver:a,subPrefixes:n}=getResolver(this._resolverCache,t,a);let r=a;needContext(a,e)&&(s.$shared=!1,i=isFunction(i)?i():i,t=this.createResolver(t,i,n),r=_attachContext(a,i,t));for(const o of e)s[o]=r[o];return s}createResolver(t,e,i=[""],a){t=getResolver(this._resolverCache,t,i).resolver;return isObject(e)?_attachContext(t,e,void 0,a):t}}function getResolver(t,e,i){let a=t.get(e);a||(a=new Map,t.set(e,a));t=i.join();let s=a.get(t);return s||(e=_createResolver(e,i),s={resolver:e,subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},a.set(t,s)),s}const hasFunction=i=>isObject(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||isFunction(i[e]),!1);function needContext(t,e){const{isScriptable:i,isIndexable:a}=_descriptors(t);for(const o of e){var s=i(o),n=a(o),r=(n||s)&&t[o];if(s&&(isFunction(r)||hasFunction(r))||n&&isArray(r))return!0}return!1}var version="4.3.0";const KNOWN_POSITIONS=["top","bottom","left","right","chartArea"];function positionIsHorizontal(t,e){return"top"===t||"bottom"===t||-1===KNOWN_POSITIONS.indexOf(t)&&"x"===e}function compare2Level(i,a){return function(t,e){return t[i]===e[i]?t[a]-e[a]:t[i]-e[i]}}function onAnimationsComplete(t){const e=t.chart;var i=e.options.animation;e.notifyPlugins("afterRender"),callback(i&&i.onComplete,[t],e)}function onAnimationProgress(t){var e=t.chart,i=e.options.animation;callback(i&&i.onProgress,[t],e)}function getCanvas(t){return _isDomSupported()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t=t&&t.canvas?t.canvas:t}const instances={},getChart=t=>{const e=getCanvas(t);return Object.values(instances).filter(t=>t.canvas===e).pop()};function moveNumericKeys(t,e,i){for(const n of Object.keys(t)){var a,s=+n;e<=s&&(a=t[n],delete t[n],(0this.update(t),t.resizeDelay||0),this._dataChanges=[],instances[this.id]=this,e&&a?(animator.listen(this,"complete",onAnimationsComplete),animator.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){var{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:a,_aspectRatio:s}=this;return isNullOrUndef(t)?e&&s?s:a?i/a: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}get registry(){return registry}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return clearCanvas(this.canvas,this.ctx),this}stop(){return animator.stop(this),this}resize(t,e){animator.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){var i=this.options,a=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(a,t,e,s),t=i.devicePixelRatio||this.platform.getDevicePixelRatio(),e=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,retinaScale(this,t,!0)&&(this.notifyPlugins("resize",{size:a}),callback(i.onResize,[this,a],this),this.attached&&this._doResize(e)&&this.render())}ensureScalesHaveIDs(){var t=this.options.scales||{};each(t,(t,e)=>{t.id=e})}buildOrUpdateScales(){const o=this.options,a=o.scales,l=this.scales,h=Object.keys(l).reduce((t,e)=>(t[e]=!1,t),{});let t=[];a&&(t=t.concat(Object.keys(a).map(t=>{var e=a[t],t=determineAxis(t,e),i="r"===t,t="x"===t;return{options:e,dposition:i?"chartArea":t?"bottom":"left",dtype:i?"radialLinear":t?"category":"linear"}}))),each(t,t=>{const e=t.options;var i=e.id,a=determineAxis(i,e),s=valueOrDefault(e.type,t.dtype);void 0!==e.position&&positionIsHorizontal(e.position,a)===positionIsHorizontal(t.dposition)||(e.position=t.dposition),h[i]=!0;let n=null;if(i in l&&l[i].type===s)n=l[i];else{const r=registry.getScale(s);n=new r({id:i,type:s,ctx:this.ctx,chart:this}),l[n.id]=n}n.init(e,o)}),each(h,(t,e)=>{t||delete l[e]}),each(l,t=>{layouts.configure(this,t,t.options),layouts.addBox(this,t)})}_updateMetasets(){const t=this._metasets;var e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),ei.length&&delete this._stacks,t.forEach((e,t)=>{0===i.filter(t=>t===e._dataset).length&&this._destroyDatasetMeta(t)})}buildOrUpdateControllers(){const e=[];var i=this.data.datasets;let a,t;for(this._removeUnreferencedMetasets(),a=0,t=i.length;a{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();var a=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!a.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1!==this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})){const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let t=0,e=this.data.datasets.length;t{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(compare2Level("z","_idx"));var{_active:a,_lastEvent:t}=this;t?this._eventHandler(t,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}}_updateScales(){each(this.scales,t=>{layouts.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){var t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);setsEqual(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){var t,e,i,a=this["_hiddenIndices"];for({method:t,start:e,count:i}of this._getUniformDataChanges()||[]){var s="_removeElements"===t?-i:i;moveNumericKeys(a,e,s)}}_getUniformDataChanges(){const t=this._dataChanges;if(t&&t.length){this._dataChanges=[];var e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),a=i(0);for(let t=1;tt.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}}_updateLayout(t){if(!1!==this.notifyPlugins("beforeLayout",{cancelable:!0})){layouts.update(this,this.width,this.height,t);t=this.chartArea;const e=t.width<=0||t.height<=0;this._layers=[],each(this.boxes,t=>{e&&"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(i){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:i,cancelable:!0})){for(let t=0,e=this.data.datasets.length;tt&&t._dataset===e).pop();return a||(a={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(a)),a}getContext(){return this.$context||(this.$context=createContext(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){var e=this.data.datasets[t];if(!e)return!1;t=this.getDatasetMeta(t);return"boolean"==typeof t.hidden?!t.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(e,t,i){const a=i?"show":"hide",s=this.getDatasetMeta(e),n=s.controller._resolveAnimations(void 0,a);defined(t)?(s.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),n.update(s,{visible:i}),this.update(t=>t.datasetIndex===e?a: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(),animator.remove(this),t=0,e=this.data.datasets.length;t{a.addEventListener(this,t,e),i[t]=e},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};each(this.options.events,t=>e(t,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const i=this._responsiveListeners,a=this.platform,t=(t,e)=>{a.addEventListener(this,t,e),i[t]=e},e=(t,e)=>{i[t]&&(a.removeEventListener(this,t,e),delete i[t])},s=(t,e)=>{this.canvas&&this.resize(t,e)};let n;const r=()=>{e("attach",r),this.attached=!0,this.resize(),t("resize",s),t("detach",n)};n=()=>{this.attached=!1,e("resize",s),this._stop(),this._resize(0,0),t("attach",r)},(a.isAttached(this.canvas)?r:n)()}unbindEvents(){each(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},each(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){var a=i?"set":"remove";let s,n,r,o;for("dataset"===e&&(s=this.getDatasetMeta(t[0].datasetIndex)).controller["_"+a+"DatasetHoverStyle"](),r=0,o=t.length;r{var i=this.getDatasetMeta(t);if(i)return{datasetIndex:t,element:i.data[e],index:e};throw new Error("No dataset found at index "+t)});_elementsEqual(t,e)||(this._active=t,this._lastEvent=null,this._updateHoverStyles(t,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(e){return 1===this._plugins._cache.filter(t=>t.plugin.id===e).length}_updateHoverStyles(t,e,i){var a=this.options.hover,s=(t,i)=>t.filter(e=>!i.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),n=s(e,t),i=i?t:s(t,e);n.length&&this.updateHoverStyle(n,a.mode,!1),i.length&&a.mode&&this.updateHoverStyle(i,a.mode,!0)}_eventHandler(e,t){const i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)};var a=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1!==this.notifyPlugins("beforeEvent",i,a))return t=this._handleEvent(e,t,i.inChartArea),i.cancelable=!1,this.notifyPlugins("afterEvent",i,a),(t||i.changed)&&this.render(),this}_handleEvent(t,e,i){var{_active:a=[],options:s}=this,n=this._getActiveElements(t,a,i,e),r=_isClickEvent(t),o=determineLastEvent(t,this._lastEvent,i,r),i=(i&&(this._lastEvent=null,callback(s.onHover,[t,n,this],this),r&&callback(s.onClick,[t,n,this],this)),!_elementsEqual(n,a));return(i||e)&&(this._active=n,this._updateHoverStyles(n,a,e)),this._lastEvent=o,i}_getActiveElements(t,e,i,a){if("mouseout"===t.type)return[];if(!i)return e;i=this.options.hover;return this.getElementsAtEventForMode(t,i.mode,i,a)}}function invalidatePlugins(){return each(Chart.instances,t=>t._plugins.invalidate())}function clipArc(t,e,i){var{startAngle:e,pixelMargin:a,x:s,y:n,outerRadius:r,innerRadius:o}=e,l=a/r;t.beginPath(),t.arc(s,n,r,e-l,i+l),a{var e=(i-Math.min(s,t))*a/2;return _limitValue(t,0,Math.min(s,e))};return{outerStart:n(t.outerStart),outerEnd:n(t.outerEnd),innerStart:_limitValue(t.innerStart,0,e),innerEnd:_limitValue(t.innerEnd,0,e)}}function rThetaToXY(t,e,i,a){return{x:i+t*Math.cos(e),y:a+t*Math.sin(e)}}function pathArc(t,e,i,a,s,n){var{x:r,y:o,startAngle:l,pixelMargin:h,innerRadius:d}=e,c=Math.max(e.outerRadius+a+i-h,0),h=0"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;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){var a=this.getProps(["x","y"],i),{angle:a,distance:t}=getAngleFromPoint(a,{x:t,y:e}),{startAngle:e,endAngle:i,innerRadius:s,outerRadius:n,circumference:r}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),o=(this.options.spacing+this.options.borderWidth)/2,r=valueOrDefault(r,i-e),r=TAU<=r||_angleBetween(a,e,i),a=_isBetween(t,s+o,n+o);return r&&a}getCenterPoint(t){var{x:t,y:e,startAngle:i,endAngle:a,innerRadius:s,outerRadius:n}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:o}=this.options,i=(i+a)/2,a=(s+n+o+r)/2;return{x:t+Math.cos(i)*a,y:e+Math.sin(i)*a}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){var e,{options:i,circumference:a}=this,s=(i.offset||0)/4,n=(i.spacing||0)/2,r=i.circular;this.pixelMargin="inner"===i.borderAlign?.33:0,this.fullCircles=TAU(r+(h?o-t:t))%n,k=()=>{f!==m&&(t.lineTo(d,m),t.lineTo(d,f),t.lineTo(d,v))};for(l&&(g=s[y(0)],t.moveTo(g.x,g.y)),u=0;u<=o;++u)(g=s[y(u)]).skip||(x=g.x,b=g.y,(_=0|x)===p?(bm&&(m=b),d=(c*d+x)/++c):(k(),t.lineTo(x,b),p=_,c=0,f=m=b),v=b);k()}function _getSegmentMethod(t){var e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?fastPathSegment:pathSegment}function _getInterpolationMethod(t){return t.stepped?_steppedInterpolation:t.tension||"monotone"===t.cubicInterpolationMode?_bezierInterpolation:_pointInLine}function strokePathWithCache(t,e,i,a){let s=e._path;s||(s=e._path=new Path2D,e.path(s,i,a)&&s.closePath()),setStyle(t,e.options),t.stroke(s)}function strokePathDirect(t,e,i,a){var{segments:s,options:n}=e;const r=_getSegmentMethod(e);for(const o of s)setStyle(t,n,o.style),t.beginPath(),r(t,e,o,{start:i,end:i+a-1})&&t.closePath(),t.stroke()}const usePath2D="function"==typeof Path2D;function draw(t,e,i,a){(usePath2D&&!e.options.segment?strokePathWithCache:strokePathDirect)(t,e,i,a)}class LineElement extends Element{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};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){var i,a=this.options;!a.tension&&"monotone"!==a.cubicInterpolationMode||a.stepped||this._pointsUpdated||(i=a.spanGaps?this._loop:this._fullLoop,_updateBezierControlPoints(this._points,a,t,i,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=_computeSegments(this,this.options.segment))}first(){var t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){var t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(i,a){var s=this.options,n=i[a],r=this.points,o=_boundSegments(this,{property:a,start:n,end:n});if(o.length){const c=[],u=_getInterpolationMethod(s);let t,e;for(t=0,e=o.length;tt.replace("rgb(","rgba(").replace(")",", 0.5)"));function getBorderColor(t){return BORDER_COLORS[t%BORDER_COLORS.length]}function getBackgroundColor(t){return BACKGROUND_COLORS[t%BACKGROUND_COLORS.length]}function colorizeDefaultDataset(t,e){return t.borderColor=getBorderColor(e),t.backgroundColor=getBackgroundColor(e),++e}function colorizeDoughnutDataset(t,e){return t.backgroundColor=t.data.map(()=>getBorderColor(e++)),e}function colorizePolarAreaDataset(t,e){return t.backgroundColor=t.data.map(()=>getBackgroundColor(e++)),e}function getColorizer(i){let a=0;return(t,e)=>{e=i.getDatasetMeta(e).controller;e instanceof DoughnutController?a=colorizeDoughnutDataset(t,a):e instanceof PolarAreaController?a=colorizePolarAreaDataset(t,a):e&&(a=colorizeDefaultDataset(t,a))}}function containsColorsDefinitions(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}function containsColorsDefinition(t){return t&&(t.borderColor||t.backgroundColor)}var plugin_colors={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(i.enabled){const{data:{datasets:s},options:n}=t.config;var a=n["elements"];!i.forceOverride&&(containsColorsDefinitions(s)||containsColorsDefinition(n)||a&&containsColorsDefinitions(a))||(i=getColorizer(t),s.forEach(i))}}};function lttbDecimation(a,s,n,t,e){var i=e.samples||t;if(n<=i)return a.slice(s,s+n);const r=[];var o=(n-2)/(i-2);let l=0;e=s+n-1;let h=s,d,c,u,g,p;for(r[l++]=a[h],d=0;du&&(u=g,c=a[i],p=i);r[l++]=c,h=p}return r[l++]=a[e],r}function minMaxDecimation(t,e,i,a){let s=0,n=0,r,o,l,h,d,c,u,g,p,f;const m=[];var v=t[e].x,x=t[e+i-1].x-v;for(r=e;rf&&(f=h,u=r),s=(n*s+o.x)/++n):(b=r-1,isNullOrUndef(c)||isNullOrUndef(u)||(_=Math.min(c,u),y=Math.max(c,u),_!==g&&_!==b&&m.push({...t[_],x:s}),y!==g&&y!==b&&m.push({...t[y],x:s})),0{cleanDecimatedDataset(t)})}function getStartAndCountOfVisiblePointsSimplified(t,e){var i=e.length;let a=0,s;const n=t["iScale"];var{min:t,max:r,minDefined:o,maxDefined:l}=n.getUserBounds();return o&&(a=_limitValue(_lookupByKey(e,n.axis,t).lo,0,i-1)),s=l?_limitValue(_lookupByKey(e,n.axis,r).hi+1,a,i)-a:i-a,{start:a,count:s}}var plugin_decimation={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(o,t,l)=>{if(l.enabled){const h=o.width;o.data.datasets.forEach((e,t)=>{var{_data:i,indexAxis:a}=e,t=o.getDatasetMeta(t),s=i||e.data;if("y"!==resolve([a,o.options.indexAxis])&&t.controller.supportsDecimation){a=o.scales[t.xAxisID];if(("linear"===a.type||"time"===a.type)&&!o.options.parsing){var{start:n,count:r}=getStartAndCountOfVisiblePointsSimplified(t,s);if(r<=(l.threshold||4*h))cleanDecimatedDataset(e);else{isNullOrUndef(i)&&(e._data=s,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}}));let t;switch(l.algorithm){case"lttb":t=lttbDecimation(s,n,r,h,l);break;case"min-max":t=minMaxDecimation(s,n,r,h);break;default:throw new Error(`Unsupported decimation algorithm '${l.algorithm}'`)}e._decimated=t}}}})}else cleanDecimatedData(o)},destroy(t){cleanDecimatedData(t)}};function _segments(t,e,i){var a=t.segments,s=t.points,n=e.points;const r=[];for(const c of a){var{start:o,end:l}=c,l=_findSegmentEnd(o,l,s),h=_getBounds(i,s[o],s[l],c.loop);if(e.segments)for(const u of _boundSegments(e,h)){var d=_getBounds(i,n[u.start],n[u.end],u.loop);for(const g of _boundSegment(c,s,d))r.push({source:g,target:u,start:{[i]:_getEdge(h,d,"start",Math.max)},end:{[i]:_getEdge(h,d,"end",Math.min)}})}else r.push({source:c,target:h,start:s[o],end:s[l]})}return r}function _getBounds(i,a,s,t){if(!t){let t=a[i],e=s[i];return"angle"===i&&(t=_normalizeAngle(t),e=_normalizeAngle(e)),{property:i,start:t,end:e}}}function _pointsFromSegments(t,e){const{x:i=null,y:a=null}=t||{},s=e.points,n=[];return e.segments.forEach(({start:t,end:e})=>{e=_findSegmentEnd(t,e,s);t=s[t],e=s[e];null!==a?(n.push({x:t.x,y:a}),n.push({x:e.x,y:a})):null!==i&&(n.push({x:i,y:t.y}),n.push({x:i,y:e.y}))}),n}function _findSegmentEnd(t,e,i){for(;t{let{boxHeight:i=e,boxWidth:a=e}=t;return t.usePointStyle&&(i=Math.min(i,e),a=t.pointStyleWidth||Math.min(a,e)),{boxWidth:a,boxHeight:i,itemHeight:Math.max(e,i)}},itemsEqual=(t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Legend extends Element{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 i=this.options.labels||{};let t=callback(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(t=>i.filter(t,this.chart.data))),i.sort&&(t=t.sort((t,e)=>i.sort(t,e,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:i,ctx:a}=this;if(i.display){var s=i.labels,n=toFont(s.font),r=n.size,o=this._computeTitleHeight(),{boxWidth:s,itemHeight:l}=getBoxSize(s,r);let t,e;a.font=n.string,this.isHorizontal()?(t=this.maxWidth,e=this._fitRows(o,r,s,l)+10):(e=this.maxHeight,t=this._fitCols(o,n,s,l)+10),this.width=Math.min(t,i.maxWidth||this.maxWidth),this.height=Math.min(e,i.maxHeight||this.maxHeight)}else this.width=this.height=0}_fitRows(t,i,a,s){const{ctx:n,maxWidth:r,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],h=this.lineWidths=[0],d=s+o;let c=t,u=(n.textAlign="left",n.textBaseline="middle",-1),g=-d;return this.legendItems.forEach((t,e)=>{t=a+i/2+n.measureText(t.text).width;(0===e||h[h.length-1]+t+2*o>r)&&(c+=d,h[h.length-(0{var{itemWidth:t,itemHeight:i}=calculateItemSize(s,a,r,t,n);0d&&(c+=u+o,h.push({width:u,height:g}),p+=u+o,f++,u=g=0),l[e]={left:p,top:g,col:f,width:t,height:i},u=Math.max(u,t),g+=i+o}),c+=u,h.push({width:u,height:g}),c}adjustHitBoxes(){if(this.options.display){var i=this._computeTitleHeight(),{legendHitBoxes:a,options:{align:s,labels:{padding:n},rtl:t}}=this;const r=getRtlAdapter(t,this.left,this.width);if(this.isHorizontal()){let t=0,e=_alignStartEnd(s,this.left+n,this.right-this.lineWidths[t]);for(const o of a)t!==o.row&&(t=o.row,e=_alignStartEnd(s,this.left+n,this.right-this.lineWidths[t])),o.top+=this.top+i+n,o.left=r.leftForLtr(r.x(e),o.width),e+=o.width+n}else{let t=0,e=_alignStartEnd(s,this.top+i+n,this.bottom-this.columnSizes[t].height);for(const l of a)l.col!==t&&(t=l.col,e=_alignStartEnd(s,this.top+i+n,this.bottom-this.columnSizes[t].height)),l.top=e,l.left+=this.left+n,l.left=r.leftForLtr(r.x(l.left),l.width),e+=l.height+n}}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){var t;this.options.display&&(t=this.ctx,clipArea(t,this),this._draw(),unclipArea(t))}_draw(){const{options:u,columnSizes:g,lineWidths:p,ctx:f}=this,{align:m,labels:v}=u,x=defaults.color,b=getRtlAdapter(u.rtl,this.left,this.width),_=toFont(v.font),y=v["padding"],k=_.size,S=k/2;let D;this.drawTitle(),f.textAlign=b.textAlign("left"),f.textBaseline="middle",f.lineWidth=.5,f.font=_.string;const{boxWidth:M,boxHeight:P,itemHeight:w}=getBoxSize(v,k),A=this.isHorizontal(),C=this._computeTitleHeight(),O=(D=A?{x:_alignStartEnd(m,this.left+y,this.right-p[0]),y:this.top+y+C,line:0}:{x:this.left+y,y:_alignStartEnd(m,this.top+C+y,this.bottom-g[0].height),line:0},overrideTextDirection(this.ctx,u.textDirection),w+y);this.legendItems.forEach((t,e)=>{f.strokeStyle=t.fontColor,f.fillStyle=t.fontColor;var i=f.measureText(t.text).width,a=b.textAlign(t.textAlign||(t.textAlign=v.textAlign)),i=M+S+i;let s=D.x,n=D.y;b.setWidth(this.width),A?0this.right&&(n=D.y+=O,D.line++,s=D.x=_alignStartEnd(m,this.left+y,this.right-p[D.line])):0this.bottom&&(s=D.x=s+g[D.line].width+y,D.line++,n=D.y=_alignStartEnd(m,this.top+C+y,this.bottom-g[D.line].height));var r,o,l,h,d,c,e=b.x(s);e=e,h=n,d=t,isNaN(M)||M<=0||isNaN(P)||P<0||(f.save(),r=valueOrDefault(d.lineWidth,1),f.fillStyle=valueOrDefault(d.fillStyle,x),f.lineCap=valueOrDefault(d.lineCap,"butt"),f.lineDashOffset=valueOrDefault(d.lineDashOffset,0),f.lineJoin=valueOrDefault(d.lineJoin,"miter"),f.lineWidth=r,f.strokeStyle=valueOrDefault(d.strokeStyle,x),f.setLineDash(valueOrDefault(d.lineDash,[])),v.usePointStyle?(o={radius:P*Math.SQRT2/2,pointStyle:d.pointStyle,rotation:d.rotation,borderWidth:r},l=b.xPlus(e,M/2),c=h+S,drawPointLegend(f,o,l,c,v.pointStyleWidth&&M)):(o=h+Math.max((k-P)/2,0),l=b.leftForLtr(e,M),c=toTRBLCorners(d.borderRadius),f.beginPath(),Object.values(c).some(t=>0!==t)?addRoundedRectPath(f,{x:l,y:o,w:M,h:P,radius:c}):f.rect(l,o,M,P),f.fill(),0!==r&&f.stroke()),f.restore()),s=_textX(a,s+M+S,A?s+i:this.right,u.rtl),h=b.x(s),e=n,d=t,renderText(f,d.text,h,e+w/2,_,{strikethrough:d.hidden,textAlign:b.textAlign(d.textAlign)}),A?D.x+=i+y:"string"!=typeof t.text?(c=_.lineHeight,D.y+=calculateLegendItemHeight(t,c)):D.y+=O}),restoreTextDirection(this.ctx,u.textDirection)}drawTitle(){var a=this.options,s=a.title,n=toFont(s.font),r=toPadding(s.padding);if(s.display){const h=getRtlAdapter(a.rtl,this.left,this.width),d=this.ctx;var o=s.position,l=n.size/2,r=r.top+l;let t,e=this.left,i=this.width;this.isHorizontal()?(i=Math.max(...this.lineWidths),t=this.top+r,e=_alignStartEnd(a.align,e,this.right-i)):(l=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0),t=r+_alignStartEnd(a.align,this.top,this.bottom-l-a.labels.padding-this._computeTitleHeight()));r=_alignStartEnd(o,e,e+i);d.textAlign=h.textAlign(_toLeftRightCenter(o)),d.textBaseline="middle",d.strokeStyle=s.color,d.fillStyle=s.color,d.font=n.string,renderText(d,s.text,r,t,n)}}_computeTitleHeight(){var t=this.options.title,e=toFont(t.font),i=toPadding(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,a,s;if(_isBetween(t,this.left,this.right)&&_isBetween(e,this.top,this.bottom))for(s=this.legendHitBoxes,i=0;it.length>e.length?t:e)),e+i.size/2+a.measureText(s).width}function calculateItemHeight(t,e,i){let a=t;return a="string"!=typeof e.text?calculateLegendItemHeight(e,i):a}function calculateLegendItemHeight(t,e){return e*(t.text?t.text.length+.5:0)}function isListened(t,e){return!("mousemove"!==t&&"mouseout"!==t||!e.onHover&&!e.onLeave)||!(!e.onClick||"click"!==t&&"mouseup"!==t)}var plugin_legend={id:"legend",_element:Legend,start(t,e,i){var a=t.legend=new Legend({ctx:t.ctx,options:i,chart:t});layouts.configure(t,a,i),layouts.addBox(t,a)},stop(t){layouts.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const a=t.legend;layouts.configure(t,a,i),a.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){var a=e.datasetIndex;const s=i.chart;s.isDatasetVisible(a)?(s.hide(a),e.hidden=!0):(s.show(a),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const a=t.data.datasets,{usePointStyle:s,pointStyle:n,textAlign:r,color:o,useBorderRadius:l,borderRadius:h}=t.legend.options["labels"];return t._getSortedDatasetMetas().map(t=>{var e=t.controller.getStyle(s?0:void 0),i=toPadding(e.borderWidth);return{text:a[t.index].label,fillStyle:e.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:(i.width+i.height)/4,strokeStyle:e.borderColor,pointStyle:n||e.pointStyle,rotation:e.rotation,textAlign:r||e.textAlign,borderRadius:l&&(h||e.borderRadius),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 Title extends Element{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){var i=this.options;this.left=0,this.top=0,i.display?(this.width=this.right=t,this.height=this.bottom=e,t=isArray(i.text)?i.text.length:1,this._padding=toPadding(i.padding),e=t*toFont(i.font).lineHeight+this._padding.height,this.isHorizontal()?this.height=e:this.width=e):this.width=this.height=this.right=this.bottom=0}isHorizontal(){var t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){var{top:e,left:i,bottom:a,right:s,options:n}=this,r=n.align;let o=0,l,h,d;return l=this.isHorizontal()?(h=_alignStartEnd(r,i,s),d=e+t,s-i):(o="left"===n.position?(h=i+t,d=_alignStartEnd(r,a,e),-.5*PI):(h=s-t,d=_alignStartEnd(r,e,a),.5*PI),a-e),{titleX:h,titleY:d,maxWidth:l,rotation:o}}draw(){var t,e,i,a,s,n=this.ctx,r=this.options;r.display&&(e=(t=toFont(r.font)).lineHeight/2+this._padding.top,{titleX:e,titleY:i,maxWidth:a,rotation:s}=this._drawArgs(e),renderText(n,r.text,0,0,t,{color:r.color,maxWidth:a,rotation:s,textAlign:_toLeftRightCenter(r.align),textBaseline:"middle",translation:[e,i]}))}}function createTitle(t,e){var i=new Title({ctx:t.ctx,options:e,chart:t});layouts.configure(t,i,e),layouts.addBox(t,i),t.titleBlock=i}var plugin_title={id:"title",_element:Title,start(t,e,i){createTitle(t,i)},stop(t){var e=t.titleBlock;layouts.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const a=t.titleBlock;layouts.configure(t,a,i),a.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 map=new WeakMap;var plugin_subtitle={id:"subtitle",start(t,e,i){var a=new Title({ctx:t.ctx,options:i,chart:t});layouts.configure(t,a,i),layouts.addBox(t,a),map.set(t,a)},stop(t){layouts.removeBox(t,map.get(t)),map.delete(t)},beforeUpdate(t,e,i){const a=map.get(t);layouts.configure(t,a,i),a.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 positioners={average(t){if(!t.length)return!1;let e,i,a=0,s=0,n=0;for(e=0,i=t.length;et+e.before.length+e.lines.length+e.after.length,0);v+=t.beforeBody.length+t.afterBody.length,c&&(f+=c*h.lineHeight+(c-1)*e.titleSpacing+e.titleMarginBottom),v&&(c=e.displayColors?Math.max(o,l.lineHeight):l.lineHeight,f+=g*c+(v-g)*l.lineHeight+(v-1)*e.bodySpacing),u&&(f+=e.footerMarginTop+u*d.lineHeight+(u-1)*e.footerSpacing);let x=0;function b(t){m=Math.max(m,i.measureText(t).width+x)}return i.save(),i.font=h.string,each(t.title,b),i.font=l.string,each(t.beforeBody.concat(t.afterBody),b),x=e.displayColors?r+2+e.boxPadding:0,each(a,t=>{each(t.before,b),each(t.lines,b),each(t.after,b)}),x=0,i.font=d.string,each(t.footer,b),i.restore(),{width:m+=p.width,height:f}}function determineYAlign(t,e){var{y:e,height:i}=e;return et.height-i/2?"bottom":"center"}function doesNotFitWithAlign(t,e,i,a){var{x:a,width:s}=a,i=i.caretSize+i.caretPadding;return"left"===t&&a+s+i>e.width||("right"===t&&a-s-i<0||void 0)}function determineXAlign(t,e,i,a){var{x:s,width:n}=i,{width:r,chartArea:{left:o,right:l}}=t;let h="center";return"center"===a?h=s<=(o+l)/2?"left":"right":s<=n/2?h="left":r-n/2<=s&&(h="right"),h=doesNotFitWithAlign(h,t,e,i)?"center":h}function determineAlignment(t,e,i){var a=i.yAlign||e.yAlign||determineYAlign(t,i);return{xAlign:i.xAlign||e.xAlign||determineXAlign(t,e,i,a),yAlign:a}}function alignX(t,e){let{x:i,width:a}=t;return"right"===e?i-=a:"center"===e&&(i-=a/2),i}function alignY(t,e,i){let{y:a,height:s}=t;return"top"===e?a+=i:a-="bottom"===e?s+i:s/2,a}function getBackgroundPoint(t,e,i,a){var{caretSize:t,caretPadding:s,cornerRadius:n}=t,{xAlign:i,yAlign:r}=i,s=t+s,{topLeft:n,topRight:o,bottomLeft:l,bottomRight:h}=toTRBLCorners(n);let d=alignX(e,i);var c=alignY(e,r,s);return"center"===r?"left"===i?d+=s:"right"===i&&(d-=s):"left"===i?d-=Math.max(n,l)+t:"right"===i&&(d+=Math.max(o,h)+t),{x:_limitValue(d,0,a.width-e.width),y:_limitValue(c,0,a.height-e.height)}}function getAlignedX(t,e,i){i=toPadding(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.right:t.x+i.left}function getBeforeAfterBodyLines(t){return pushOrConcat([],splitNewlines(t))}function createTooltipContext(t,e,i){return createContext(t,{tooltip:e,tooltipItems:i,type:"tooltip"})}function overrideCallbacks(t,e){e=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return e?t.override(e):t}const defaultCallbacks={beforeTitle:noop,title(t){if(0{var e={before:[],lines:[],after:[]},i=overrideCallbacks(a,t);pushOrConcat(e.before,splitNewlines(invokeCallbackWithFallback(i,"beforeLabel",this,t))),pushOrConcat(e.lines,invokeCallbackWithFallback(i,"label",this,t)),pushOrConcat(e.after,splitNewlines(invokeCallbackWithFallback(i,"afterLabel",this,t))),s.push(e)}),s}getAfterBody(t,e){return getBeforeAfterBodyLines(invokeCallbackWithFallback(e.callbacks,"afterBody",this,t))}getFooter(t,e){var e=e["callbacks"],i=invokeCallbackWithFallback(e,"beforeFooter",this,t),a=invokeCallbackWithFallback(e,"footer",this,t),e=invokeCallbackWithFallback(e,"afterFooter",this,t),t=pushOrConcat([],splitNewlines(i));return t=pushOrConcat(t,splitNewlines(a)),pushOrConcat(t,splitNewlines(e))}_createItems(a){var t=this._active;const s=this.chart.data,i=[],n=[],r=[];let e=[],o,l;for(o=0,l=t.length;oa.filter(t,e,i,s))),a.itemSort&&(e=e.sort((t,e)=>a.itemSort(t,e,s))),each(e,t=>{var e=overrideCallbacks(a.callbacks,t);i.push(invokeCallbackWithFallback(e,"labelColor",this,t)),n.push(invokeCallbackWithFallback(e,"labelPointStyle",this,t)),r.push(invokeCallbackWithFallback(e,"labelTextColor",this,t))}),this.labelColors=i,this.labelPointStyles=n,this.labelTextColors=r,this.dataPoints=e}update(t,e){const i=this.options.setContext(this.getContext());var a,s,n,r=this._active;let o,l=[];r.length?(r=positioners[i.position].call(this,r,this._eventPosition),l=this._createItems(i),this.title=this.getTitle(l,i),this.beforeBody=this.getBeforeBody(l,i),this.body=this.getBody(l,i),this.afterBody=this.getAfterBody(l,i),this.footer=this.getFooter(l,i),a=this._size=getTooltipSize(this,i),n=Object.assign({},r,a),s=determineAlignment(this.chart,i,n),n=getBackgroundPoint(i,n,s,this.chart),this.xAlign=s.xAlign,this.yAlign=s.yAlign,o={opacity:1,x:n.x,y:n.y,width:a.width,height:a.height,caretX:r.x,caretY:r.y}):0!==this.opacity&&(o={opacity:0}),this._tooltipItems=l,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,a){t=this.getCaretPosition(t,i,a);e.lineTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineTo(t.x3,t.y3)}getCaretPosition(t,e,i){var{xAlign:a,yAlign:s}=this,{caretSize:i,cornerRadius:n}=i,{topLeft:n,topRight:r,bottomLeft:o,bottomRight:l}=toTRBLCorners(n),{x:t,y:h}=t,{width:e,height:d}=e;let c,u,g,p,f,m;return"center"===s?(f=h+d/2,m="left"===a?(c=t,u=c-i,p=f+i,f-i):(c=t+e,u=c+i,p=f-i,f+i),g=c):(u="left"===a?t+Math.max(n,o)+i:"right"===a?t+e-Math.max(r,l)-i:this.caretX,g="top"===s?(p=h,f=p-i,c=u-i,u+i):(p=h+d,f=p+i,c=u+i,u-i),m=p),{x1:c,x2:u,x3:g,y1:p,y2:f,y3:m}}drawTitle(t,e,i){var a=this.title,s=a.length;let n,r,o;if(s){const l=getRtlAdapter(i.rtl,this.x,this.width);for(t.x=getAlignedX(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",n=toFont(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=n.string,o=0;o0!==t)?(t.beginPath(),t.fillStyle=s.multiKeyBackground,addRoundedRectPath(t,{x:d,y:e,w:h,h:l,radius:n}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),addRoundedRectPath(t,{x:o,y:e+1,w:h-2,h:l-2,radius:n}),t.fill()):(t.fillStyle=s.multiKeyBackground,t.fillRect(d,e,h,l),t.strokeRect(d,e,h,l),t.fillStyle=r.backgroundColor,t.fillRect(o,e+1,h-2,l-2))),t.fillStyle=this.labelTextColors[i]}drawBody(e,i,t){var a=this["body"];const{bodySpacing:s,bodyAlign:n,displayColors:r,boxHeight:o,boxWidth:l,boxPadding:h}=t;var d=toFont(t.bodyFont);let c=d.lineHeight,u=0;const g=getRtlAdapter(t.rtl,this.x,this.width);function p(t){i.fillText(t,g.x(e.x+u),e.y+c/2),e.y+=c+s}var f=g.textAlign(n);let m,v,x,b,_,y,k;for(i.textAlign=n,i.textBaseline="middle",i.font=d.string,e.x=getAlignedX(this,f,t),i.fillStyle=t.bodyColor,each(this.beforeBody,p),u=r&&"right"!==f?"center"===n?l/2+h:l+2+h:0,b=0,y=a.length;b{var i=this.chart.getDatasetMeta(t);if(i)return{datasetIndex:t,element:i.data[e],index:e};throw new Error("Cannot find a dataset at index "+t)}),i=!_elementsEqual(i,t),a=this._positionChanged(t,e);(i||a)&&(this._active=t,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;var a=this.options,s=this._active||[],i=this._getActiveElements(t,s,e,i),n=this._positionChanged(i,t),s=e||!_elementsEqual(i,s)||n;return s&&(this._active=i,(a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),s}_getActiveElements(t,e,i,a){var s=this.options;if("mouseout"===t.type)return[];if(!a)return e;const n=this.chart.getElementsAtEventForMode(t,s.mode,s,i);return s.reverse&&n.reverse(),n}_positionChanged(t,e){var{caretX:i,caretY:a,options:s}=this,s=positioners[s.position].call(this,t,e);return!1!==s&&(i!==s.x||a!==s.y)}}var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners:positioners,afterInit(t,e,i){i&&(t.tooltip=new Tooltip({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;var i;e&&e._willRender()&&(!(i={tooltip:e})!==t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0})&&(e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)))},afterEvent(t,e){var i;t.tooltip&&(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:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},plugins=Object.freeze({__proto__:null,Colors:plugin_colors,Decimation:plugin_decimation,Filler:index,Legend:plugin_legend,SubTitle:plugin_subtitle,Title:plugin_title,Tooltip:plugin_tooltip});const addIfString=(t,e,i,a)=>("string"==typeof e?(i=t.push(e)-1,a.unshift({index:i,label:e})):isNaN(e)&&(i=null),i);function findOrAddLabel(t,e,i,a){var s=t.indexOf(e);return-1===s?addIfString(t,e,i,a):s!==t.lastIndexOf(e)?i:s}const validIndex=(t,e)=>null===t?null:_limitValue(Math.round(t),0,e);function _getLabelForValue(t){var e=this.getLabels();return 0<=t&&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 generateTicks$1(t,e){const i=[];var{bounds:a,step:s,min:n,max:r,precision:o,count:l,maxTicks:h,maxDigits:d,includeBounds:c}=t,u=s||1,g=h-1,{min:e,max:p}=e,f=!isNullOrUndef(n),m=!isNullOrUndef(r),v=!isNullOrUndef(l),d=(p-e)/(d+1);let x=niceNum((p-e)/g/u)*u,b,_,y,k;if(x<1e-14&&!f&&!m)return[{value:e},{value:p}];(k=Math.ceil(p/x)-Math.floor(e/x))>g&&(x=niceNum(k*x/g/u)*u),isNullOrUndef(o)||(b=Math.pow(10,o),x=Math.ceil(x*b)/b),y="ticks"===a?(_=Math.floor(e/x)*x,Math.ceil(p/x)*x):(_=e,p),f&&m&&s&&almostWhole((r-n)/s,x/1e3)?(k=Math.round(Math.min((r-n)/x,h)),x=(r-n)/k,_=n,y=r):v?(_=f?n:_,y=m?r:y,k=l-1,x=(y-_)/k):(k=(y-_)/x,k=almostEquals(k,Math.round(k),x/1e3)?Math.round(k):Math.ceil(k));g=Math.max(_decimalPlaces(x),_decimalPlaces(_));b=Math.pow(10,isNullOrUndef(o)?g:o),_=Math.round(_*b)/b,y=Math.round(y*b)/b;let S=0;for(f&&(c&&_!==n?(i.push({value:n}),_a=e?a:t,l=t=>s=i?s:t;t&&(r=sign(a),n=sign(s),r<0&&n<0?l(0):0Math.floor(log10(t)),changeExponent=(t,e)=>Math.pow(10,log10Floor(t)+e);function isMajor(t){return 1==t/Math.pow(10,log10Floor(t))}function steps(t,e,i){i=Math.pow(10,i),t=Math.floor(t/i);return Math.ceil(e/i)-t}function startExp(t,e){var i=e-t;let a=log10Floor(i);for(;10n?Math.pow(10,s):0,s=Math.round((e-l)*r)/r,h=Math.floor((e-l)/o/10)*o*10;let d=Math.floor((s-h)/Math.pow(10,n)),c=finiteOrDefault(t.min,Math.round((l+h+d*Math.pow(10,n))*r)/r);for(;ca=e?a:t,n=t=>s=i?s:t;a===s&&(a<=0?(t(1),n(10)):(t(changeExponent(a,-1)),n(changeExponent(s,1)))),a<=0&&t(changeExponent(s,-1)),s<=0&&n(changeExponent(a,1)),this.min=a,this.max=s}buildTicks(){var t=this.options;const e=generateTicks({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&_setMinAndMaxByKey(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":formatNumber(t,this.chart.options.locale,this.options.ticks.format)}configure(){var t=this.min;super.configure(),this._startValue=log10(t),this._valueRange=log10(this.max)-log10(t)}getPixelForValue(t){return null===(t=void 0!==t&&0!==t?t:this.min)||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(log10(t)-this._startValue)/this._valueRange)}getValueForPixel(t){t=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+t*this._valueRange)}}function getTickBackdropHeight(t){var e=t.ticks;return e.display&&t.display?(t=toPadding(e.backdropPadding),valueOrDefault(e.font&&e.font.size,defaults.font.size)+t.height):0}function measureLabelSize(t,e,i){return i=isArray(i)?i:[i],{w:_longestText(t,e.string,i),h:i.length*e.lineHeight}}function determineLimits(t,e,i,a,s){return t===a||t===s?{start:e-i/2,end:e+i/2}:te.r&&(r=(a.end-e.r)/n,t.r=Math.max(t.r,e.r+r)),s.starte.b&&(o=(s.end-e.b)/i,t.b=Math.max(t.b,e.b+o))}function createPointLabelItem(t,e,i){var a=t.drawingArea,{extra:i,additionalAngle:s,padding:n,size:r}=i,t=t.getPointPosition(e,a+i+n,s),e=Math.round(toDegrees(_normalizeAngle(t.angle+HALF_PI))),a=yForAngle(t.y,r.h,e),i=getTextAlignForAngle(e),n=leftForTextAlign(t.x,r.w,i);return{visible:!0,x:t.x,y:a,textAlign:i,left:n,top:a,right:n+r.w,bottom:a+r.h}}function isNotOverlapped(t,e){if(!e)return!0;var{left:t,top:i,right:a,bottom:s}=t;return!(_isPointInArea({x:t,y:i},e)||_isPointInArea({x:t,y:s},e)||_isPointInArea({x:a,y:i},e)||_isPointInArea({x:a,y:s},e))}function buildPointLabelItems(e,i,a){const s=[];var n=e._pointLabels.length,t=e.options,{centerPointLabels:r,display:o}=t.pointLabels;const l={extra:getTickBackdropHeight(t)/2,additionalAngle:r?PI/n:0};let h;for(let t=0;t0!==t)?(t.beginPath(),addRoundedRectPath(t,{x:l,y:s,w:r,h:i,radius:a}),t.fill()):t.fillRect(l,s,r,i))}function drawPointLabels(e,i){const{ctx:a,options:{pointLabels:s}}=e;for(let t=i-1;0<=t;t--){var n,r,o,l,h=e._pointLabelItems[t];h.visible&&(drawPointLabelBox(a,n=s.setContext(e.getPointLabelContext(t)),h),r=toFont(n.font),{x:h,y:o,textAlign:l}=h,renderText(a,e._pointLabels[t],h,o+r.lineHeight/2,r,{color:n.color,textAlign:l,textBaseline:"middle"}))}}function pathRadiusLine(e,i,t,a){const s=e["ctx"];if(t)s.arc(e.xCenter,e.yCenter,i,0,TAU);else{var n=e.getPointPosition(0,i);s.moveTo(n.x,n.y);for(let t=1;t{t=callback(this.options.pointLabels.callback,[t,e],this);return t||0===t?t:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){var t=this.options;t.display&&t.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,a){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-a)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,a))}getIndexAngle(t){var e=TAU/(this._pointLabels.length||1),i=this.options.startAngle||0;return _normalizeAngle(t*e+toRadians(i))}getDistanceFromCenterForValue(t){if(isNullOrUndef(t))return NaN;var e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(isNullOrUndef(t))return NaN;t/=this.drawingArea/(this.max-this.min);return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(t){var e=this._pointLabels||[];if(0<=t&&t{0!==e&&(o=this.getDistanceFromCenterForValue(t.value),t=this.getContext(e),e=a.setContext(t),t=s.setContext(t),drawRadiusLine(this,e,o,n,t))}),i.display){for(t.save(),r=n-1;0<=r;r--){var h=i.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:c}=h;c&&d&&(t.lineWidth=c,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,o=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(r,o),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const r=this.ctx,o=this.options,l=o.ticks;if(l.display){var t=this.getIndexAngle(0);let s,n;r.save(),r.translate(this.xCenter,this.yCenter),r.rotate(t),r.textAlign="center",r.textBaseline="middle",this.ticks.forEach((t,e)=>{var i,a;0===e&&!o.reverse||(i=l.setContext(this.getContext(e)),a=toFont(i.font),s=this.getDistanceFromCenterForValue(this.ticks[e].value),i.showLabelBackdrop&&(r.font=a.string,n=r.measureText(t.label).width,r.fillStyle=i.backdropColor,e=toPadding(i.backdropPadding),r.fillRect(-n/2-e.left,-s-a.size/2-e.top,n+e.width,a.size+e.height)),renderText(r,t.label,0,-s,a,{color:i.color}))}),r.restore()}}drawTitle(){}}const INTERVALS={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}},UNITS=Object.keys(INTERVALS);function sorter(t,e){return t-e}function parse(t,e){if(isNullOrUndef(e))return null;const i=t._adapter,{parser:a,round:s,isoWeekday:n}=t._parseOpts;let r=e;return"function"==typeof a&&(r=a(r)),null===(r=isNumberFinite(r)?r:"string"==typeof a?i.parse(r,a):i.parse(r))?null:+(r=s?"week"!==s||!isNumber(n)&&!0!==n?i.startOf(r,s):i.startOf(r,"isoWeek",n):r)}function determineUnitForAutoTicks(e,i,a,s){var n=UNITS.length;for(let t=UNITS.indexOf(e);t=UNITS.indexOf(a);t--){var r=UNITS[t];if(INTERVALS[r].common&&e._adapter.diff(n,s,r)>=i-1)return r}return UNITS[a?UNITS.indexOf(a):0]}function determineMajorUnit(i){for(let t=UNITS.indexOf(i)+1,e=UNITS.length;t=e?i[a]:i[s]]=!0):t[e]=!0}function setMajorTicks(t,e,i,a){const s=t._adapter;var t=+s.startOf(e[0].value,a),n=e[e.length-1].value;let r,o;for(r=t;r<=n;r=+s.add(r,1,a))0<=(o=i[r])&&(e[o].major=!0);return e}function ticksFromTimestamps(t,e,i){const a=[],s={};var n=e.length;let r,o;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,i=0;this.options.offset&&t.length&&(a=this.getDecimalForValue(t[0]),e=1===t.length?1-a:(this.getDecimalForValue(t[1])-a)/2,a=this.getDecimalForValue(t[t.length-1]),i=1===t.length?a:(a-this.getDecimalForValue(t[t.length-2]))/2);var a=t.length<3?.5:.25;e=_limitValue(e,0,a),i=_limitValue(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter;var e=this.min,i=this.max,a=this.options,s=a.time,n=s.unit||determineUnitForAutoTicks(s.minUnit,e,i,this._getLabelCapacity(e)),r=valueOrDefault(a.ticks.stepSize,1),s="week"===n&&s.isoWeekday,o=isNumber(s)||!0===s,l={};let h=e,d,c;if(o&&(h=+t.startOf(h,"isoWeek",s)),h=+t.startOf(h,o?"day":n),t.diff(i,e,n)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+n);var u="data"===a.ticks.source&&this.getDataTimestamps();for(d=h,c=0;dt-e).map(t=>+t)}getLabelForValue(t){const e=this._adapter;var i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){var i=this.options.time.displayFormats,a=this._unit,e=e||i[a];return this._adapter.format(t,e)}_tickFormatFunction(t,e,i,a){var s=this.options,n=s.ticks.callback;if(n)return callback(n,[t,e,i],this);var n=s.time.displayFormats,s=this._unit,r=this._majorUnit,s=s&&n[s],n=r&&n[r],i=i[e],e=r&&n&&i&&i.major;return this._adapter.format(t,a||(e?n:s))}generateTickLabels(t){let e,i,a;for(e=0,i=t.length;e=t[a].pos&&e<=t[s].pos&&({lo:a,hi:s}=_lookupByKey(t,"pos",e)),{pos:n,time:o}=t[a],{pos:r,time:l}=t[s]):(e>=t[a].time&&e<=t[s].time&&({lo:a,hi:s}=_lookupByKey(t,"time",e)),{time:n,pos:o}=t[a],{time:r,pos:l}=t[s]);i=r-n;return i?o+(l-o)*(e-n)/i:o}class TimeSeriesScale extends TimeScale{static id="timeseries";static defaults=TimeScale.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){var t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=interpolate(e,this.min),this._tableRange=interpolate(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){var{min:e,max:i}=this;const a=[],s=[];let n,r,o,l,h;for(n=0,r=t.length;n=e&&l<=i&&a.push(l);if(a.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(n=0,r=a.length;nt({chart:e,initial:i.initial,numSteps:s,currentStep:Math.min(a-i.start,s)}))}_refresh(){this._request||(this._running=!0,this._request=requestAnimFrame.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(n=Date.now()){let o=0;this._charts.forEach((i,a)=>{if(i.running&&i.items.length){var s,r=i.items;let t=r.length-1,e=!1;for(;0<=t;--t)(s=r[t])._active?(s._total>i.duration&&(i.duration=s._total),s.tick(n),e=!0):(r[t]=r[r.length-1],r.pop());e&&(a.draw(),this._notify(a,i,n,"progress")),r.length||(i.running=!1,this._notify(a,i,n,"complete"),i.initial=!1),o+=r.length}}),this._lastDate=n,0===o&&(this._running=!1)}_getAnims(t){var 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 0Math.max(t,e._duration),0),this._refresh())}running(t){return!!this._running&&!!((t=this._charts.get(t))&&t.running&&t.items.length)}stop(e){var i=this._charts.get(e);if(i&&i.items.length){var a=i.items;let t=a.length-1;for(;0<=t;--t)a[t].cancel();i.items=[],this._notify(e,i,Date.now(),"complete")}}remove(t){return this._charts.delete(t)}}var animator=new Animator;const transparent="transparent",interpolators={boolean(t,e,i){return.5{i.push({res:t,rej:e})})}_notify(t){var e=t?"res":"rej",i=this._promises||[];for(let t=0;t{var t=s[e];if(isObject(t)){const i={};for(const a of r)i[a]=t[a];(isArray(t.properties)&&t.properties||[e]).forEach(t=>{t!==e&&n.has(t)||n.set(t,i)})}})}}_animateOptions(t,e){const i=e.options;var e=resolveTargetOptions(t,i);return e?(e=this._createAnimations(e,i),i.$shared&&awaitAll(t.options.$animations,i).then(()=>{t.options=i},()=>{}),e):[]}_createAnimations(e,i){var a=this._properties,s=[],r=e.$animations||(e.$animations={}),t=Object.keys(i),n=Date.now();let o;for(o=t.length-1;0<=o;--o){var l=t[o];if("$"!==l.charAt(0))if("options"===l)s.push(...this._animateOptions(e,i));else{var h=i[l];let t=r[l];var d=a.get(l);if(t){if(d&&t.active()){t.update(d,h,n);continue}t.cancel()}d&&d.duration?(r[l]=t=new Animation(d,e,l,h),s.push(t)):e[l]=h}}return s}update(t,e){var i;if(0!==this._properties.size)return(i=this._createAnimations(t,e)).length?(animator.add(this._chart,i),!0):void 0;Object.assign(t,e)}}function awaitAll(e,t){var i=[],a=Object.keys(t);for(let t=0;ti[t].axis===e).shift()}function createDatasetContext(t,e){return createContext(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function createDataContext(t,e,i){return createContext(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}function clearStacks(t,e){var i=t.controller.index,a=t.vScale&&t.vScale.axis;if(a)for(const r of e=e||t._parsed){var s=r._stacks;if(!s||void 0===s[a]||void 0===s[a][i])return;delete s[a][i],void 0!==s[a]._visualValues&&void 0!==s[a]._visualValues[i]&&delete s[a]._visualValues[i]}}const isDirectUpdateMode=t=>"reset"===t||"none"===t,cloneIfNotShared=(t,e)=>e?t:Object.assign({},t),createStack=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:getSortedDatasetIndices(i,!0),values:null};class DatasetController{static defaults={};static datasetElementType=null;static dataElementType=null;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.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){var t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=isStacked(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&clearStacks(this._cachedMeta),this.index=t}linkScales(){var t=this.chart,e=this._cachedMeta,i=this.getDataset(),a=(t,e,i,a)=>"x"===t?e:"r"===t?a:i,s=e.xAxisID=valueOrDefault(i.xAxisID,getFirstScaleId(t,"x")),r=e.yAxisID=valueOrDefault(i.yAxisID,getFirstScaleId(t,"y")),i=e.rAxisID=valueOrDefault(i.rAxisID,getFirstScaleId(t,"r")),t=e.indexAxis,n=e.iAxisID=a(t,s,r,i),a=e.vAxisID=a(t,r,s,i);e.xScale=this.getScaleForId(s),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(i),e.iScale=this.getScaleForId(n),e.vScale=this.getScaleForId(a)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){var e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){var t=this._cachedMeta;this._data&&unlistenArrayEvents(this._data,this),t._stacked&&clearStacks(t)}_dataCheck(){var t=this.getDataset(),t=t.data||(t.data=[]),e=this._data;isObject(t)?this._data=convertObjectDataToArray(t):e!==t&&(e&&(unlistenArrayEvents(e,this),clearStacks(e=this._cachedMeta),e._parsed=[]),t&&Object.isExtensible(t)&&listenArrayEvents(t,this),this._syncList=[],this._data=t)}addElements(){var t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){var e=this._cachedMeta,i=this.getDataset();let a=!1;this._dataCheck();var s=e._stacked;e._stacked=isStacked(e.vScale,e),e.stack!==i.stack&&(a=!0,clearStacks(e),e.stack=i.stack),this._resyncElements(t),!a&&s===e._stacked||updateStacks(this,e._parsed)}configure(){var t=this.chart.config,e=t.datasetScopeKeys(this._type),e=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(e,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){var{_cachedMeta:i,_data:a}=this,{iScale:s,_stacked:r}=i;const n=s.axis;let o=0===t&&e===a.length||i._sorted,l=0t||dthis.getContext(i,a,e),s)).$shared&&(l.$shared=h,n[o]=Object.freeze(cloneIfNotShared(l,h))),l)}_resolveAnimations(t,e,i){var a,s=this.chart,r=this._cachedDataOpts,n="animation-"+e,o=r[n];if(o)return o;let l;!1!==s.options.animation&&(a=(o=this.chart.config).datasetAnimationScopeKeys(this._type,e),a=o.getOptionScopes(this.getDataset(),a),l=o.createResolver(a,this.getContext(t,i,e)));o=new Animations(s,l&&l.animations);return l&&l._cacheable&&(r[n]=Object.freeze(o)),o}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||isDirectUpdateMode(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){var t=this.resolveDataElementOptions(t,e),i=this._sharedOptions,a=this.getSharedOptions(t),i=this.includeOptions(e,a)||a!==i;return this.updateSharedOptions(a,e,t),{sharedOptions:a,includeOptions:i}}updateElement(t,e,i,a){isDirectUpdateMode(a)?Object.assign(t,i):this._resolveAnimations(e,a).update(t,i)}updateSharedOptions(t,e,i){t&&!isDirectUpdateMode(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,a){t.active=a;var s=this.getStyle(e,a);this._resolveAnimations(e,i,a).update(t,{options:!a&&this.getSharedOptions(s)||s})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){var e,i,a,s=this._data,r=this._cachedMeta.data;for([e,i,a]of this._syncList)this[e](i,a);this._syncList=[];var r=r.length,s=s.length,n=Math.min(s,r);n&&this.parse(0,n),r{for(t.length+=e,n=t.length-1;n>=r;n--)t[n]=t[n-e]};for(o(s),n=t;nt-e))}return a._cache.$bar}function computeMinSampleSize(t){var e=t.iScale,i=getAllScaleValues(e,t.type);let a=e._length,s,r,n,o;var l=()=>{32767!==n&&-32768!==n&&(defined(o)&&(a=Math.min(a,Math.abs(n-o)||a)),o=n)};for(s=0,r=i.length;sMath.abs(r)&&(n=r,o=a),e[i.axis]=o,e._custom={barStart:n,barEnd:o,start:s,end:t,min:a,max:r}}function parseValue(t,e,i,a){return isArray(t)?parseFloatBar(t,e,i,a):e[i.axis]=i.parse(t,a),e}function parseArrayOrPrimitive(t,e,i,a){var s=t.iScale,r=t.vScale,n=s.getLabels(),o=s===r,l=[];let h,d,c,u;for(d=(h=i)+a;h=i?1:-1)}function borderProps(t){let e,i,a,s,r;return a=t.horizontal?(e=t.base>t.x,i="left","right"):(e=t.baset.controller.options.grouped),s=e.options.stacked,r=[];for(const n of a)if((void 0===i||!(t=>{var e=t.controller.getParsed(i),e=e&&e[t.vScale.axis];if(isNullOrUndef(e)||isNaN(e))return!0})(n))&&((!1===s||-1===r.indexOf(n.stack)||void 0===s&&void 0===n.stack)&&r.push(n.stack),n.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){t=this._getStacks(t,i),i=void 0!==e?t.indexOf(e):-1;return-1===i?t.length-1:i}_getRuler(){var t=this.options,e=this._cachedMeta,i=e.iScale,a=[];let s,r;for(s=0,r=e.data.length;s_angleBetween(t,u,g,!0)?1:Math.max(e,e*a,i,i*a),d=(t,e,i)=>_angleBetween(t,u,g,!0)?-1:Math.min(e,e*a,i,i*a),c=h(0,t,o),h=h(HALF_PI,e,l),t=d(PI,t,o),o=d(PI+HALF_PI,e,l);i=(c-t)/2,s=(h-o)/2,r=-(c+t)/2,n=-(h+o)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:n}}class DoughnutController extends DatasetController{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(a){var t=a.data;if(t.labels.length&&t.datasets.length){const{pointStyle:s,color:r}=a.legend.options["labels"];return t.labels.map((t,e)=>{var i=a.getDatasetMeta(0).controller.getStyle(e);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,fontColor:r,lineWidth:i.borderWidth,pointStyle:s,hidden:!a.getDataVisibility(e),index:e}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};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(a,s){const r=this.getDataset().data;var n=this._cachedMeta;if(!1===this._parsing)n._parsed=r;else{let t=t=>+r[t];if(isObject(r[a])){const{key:o="value"}=this._parsing;t=t=>+resolveObjectKey(r[t],o)}let e,i;for(i=(e=a)+s;e=v?M.skip=!0:(_=this.getParsed(t),y=isNullOrUndef(_[u]),k=M[c]=r.getPixelForValue(_[c],t),S=M[u]=s||y?n.getBasePixel():n.getPixelForValue(o?this.applyStack(n,_,o):_[u],t),M.skip=isNaN(k)||isNaN(S)||y,M.stop=0f,p&&(M.parsed=_,M.raw=l.data[t]),d&&(M.options=h||this.resolveDataElementOptions(t,D.active?"active":a)),m||this.updateElement(D,t,M,a),b=_)}}getMaxOverflow(){var t,e=this._cachedMeta,i=e.dataset,i=i.options&&i.options.borderWidth||0,e=e.data||[];return e.length?(t=e[0].size(this.resolveDataElementOptions(0)),e=e[e.length-1].size(this.resolveDataElementOptions(e.length-1)),Math.max(i,t,e)/2):i}draw(){var t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}class PolarAreaController extends DatasetController{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(a){var t=a.data;if(t.labels.length&&t.datasets.length){const{pointStyle:s,color:r}=a.legend.options["labels"];return t.labels.map((t,e)=>{var i=a.getDatasetMeta(0).controller.getStyle(e);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,fontColor:r,lineWidth:i.borderWidth,pointStyle:s,hidden:!a.getDataVisibility(e),index:e}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){var e=this._cachedMeta,i=this.chart,a=i.data.labels||[],e=formatNumber(e._parsed[t].r,i.options.locale);return{label:a[t]||"",value:e}}parseObjectData(t,e,i,a){return _parseObjectDataRadialScale.bind(this)(t,e,i,a)}update(t){var e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){var t=this._cachedMeta;const a={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,e)=>{var i=this.getParsed(e).r;!isNaN(i)&&this.chart.getDataVisibility(e)&&(ia.max)&&(a.max=i)}),a}_updateRadius(){var t=this.chart,e=t.chartArea,i=t.options,e=Math.min(e.right-e.left,e.bottom-e.top),e=Math.max(e/2,0),i=(e-Math.max(i.cutoutPercentage?e/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=e-i*this.index,this.innerRadius=this.outerRadius-i}updateElements(a,t,e,s){var r="reset"===s,n=this.chart,o=n.options.animation,l=this._cachedMeta.rScale,h=l.xCenter,d=l.yCenter,c=l.getIndexAngle(0)-.5*PI;let u=c,g;var p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(e).r)&&this.chart.getDataVisibility(e)&&i++}),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?toRadians(this.resolveDataElementOptions(t,e).angle||i):0}}class PieController extends DoughnutController{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}class RadarController extends DatasetController{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){var e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,a){return _parseObjectDataRadialScale.bind(this)(t,e,i,a)}update(t){var e,i=this._cachedMeta,a=i.dataset,s=i.data||[],i=i.iScale.getLabels();a.points=s,"resize"!==t&&(e=this.resolveDatasetElementOptions(t),this.options.showLine||(e.borderWidth=0),i={_loop:!0,_fullLoop:i.length===s.length,options:e},this.updateElement(a,void 0,i,t)),this.updateElements(s,0,s.length,t)}updateElements(e,i,a,s){var r=this._cachedMeta.rScale,n="reset"===s;for(let t=i;tm,f&&(y.parsed=_,y.raw=h.data[t]),c&&(y.options=d||this.resolveDataElementOptions(t,b.active?"active":s)),v||this.updateElement(b,t,y,s),x=_}this.updateSharedOptions(d,s,t)}getMaxOverflow(){var t,e,i=this._cachedMeta,a=i.data||[];if(this.options.showLine)return i=(i=i.dataset).options&&i.options.borderWidth||0,a.length?(t=a[0].size(this.resolveDataElementOptions(0)),e=a[a.length-1].size(this.resolveDataElementOptions(a.length-1)),Math.max(i,t,e)/2):i;{let e=0;for(let t=a.length-1;0<=t;--t)e=Math.max(e,a[t].size(this.resolveDataElementOptions(t))/2);return 0{t[o](a[s],r)&&(n.push({element:t,datasetIndex:e,index:i}),l=l||t.inRange(a.x,a.y,r))}),e&&!l?[]:n}var Interaction={evaluateInteractionItems:evaluateInteractionItems,modes:{index(t,e,i,a){var e=getRelativePosition(e,t),s=i.axis||"x",r=i.includeInvisible||!1;const n=i.intersect?getIntersectItems(t,e,s,a,r):getNearestItems(t,e,s,!1,a,r),o=[];return n.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{var e=n[0].index,i=t.data[e];i&&!i.skip&&o.push({element:i,datasetIndex:t.index,index:e})}),o):[]},dataset(t,e,i,a){var e=getRelativePosition(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let n=i.intersect?getIntersectItems(t,e,s,a,r):getNearestItems(t,e,s,!1,a,r);if(0t.pos===e)}function filterDynamicPositionByAxis(t,e){return t.filter(t=>-1===STATIC_POSITIONS.indexOf(t.pos)&&t.box.axis===e)}function sortByWeight(t,a){return t.sort((t,e)=>{var i=a?e:t,t=a?t:e;return i.weight===t.weight?i.index-t.index:i.weight-t.weight})}function wrapBoxes(t){var e=[];let i,a,s,r,n,o;for(i=0,a=(t||[]).length;it.box.fullSize),!0),i=sortByWeight(filterByPosition(t,"left"),!0),a=sortByWeight(filterByPosition(t,"right")),s=sortByWeight(filterByPosition(t,"top"),!0),r=sortByWeight(filterByPosition(t,"bottom")),n=filterDynamicPositionByAxis(t,"x"),o=filterDynamicPositionByAxis(t,"y");return{fullSize:e,leftAndTop:i.concat(s),rightAndBottom:a.concat(o).concat(r).concat(n),chartArea:filterByPosition(t,"chartArea"),vertical:i.concat(a).concat(o),horizontal:s.concat(r).concat(n)}}function getCombinedMax(t,e,i,a){return Math.max(t[i],e[i])+Math.max(t[a],e[a])}function updateMaxPadding(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function updateDims(t,e,i,a){var{pos:s,box:r}=i,n=t.maxPadding,a=(isObject(s)||(i.size&&(t[s]-=i.size),(a=a[i.stack]||{size:0,count:1}).size=Math.max(a.size,i.horizontal?r.height:r.width),i.size=a.size/a.count,t[s]+=i.size),r.getPadding&&updateMaxPadding(n,r.getPadding()),Math.max(0,e.outerWidth-getCombinedMax(n,t,"left","right"))),s=Math.max(0,e.outerHeight-getCombinedMax(n,t,"top","bottom")),r=a!==t.w,e=s!==t.h;return t.w=a,t.h=s,i.horizontal?{same:r,other:e}:{same:e,other:r}}function handleMaxPadding(i){const a=i.maxPadding;function t(t){var e=Math.max(a[t]-i[t],0);return i[t]+=e,e}i.y+=t("top"),i.x+=t("left"),t("right"),t("bottom")}function getMargins(t,i){const a=i.maxPadding;function e(t){const e={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{e[t]=Math.max(i[t],a[t])}),e}return e(t?["left","right"]:["top","bottom"])}function fitBoxes(t,e,i,a){var s=[];let r,n,o,l,h,d;for(r=0,n=t.length,h=0;r{"function"==typeof t.beforeLayout&&t.beforeLayout()}),l.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1),t=Object.freeze({outerWidth:t,outerHeight:i,padding:s,availableWidth:r,availableHeight:n,vBoxMaxWidth:r/2/d,hBoxMaxHeight:n/2}),i=Object.assign({},s);updateMaxPadding(i,toPadding(a));const c=Object.assign({maxPadding:i,w:r,h:n,x:s.left,y:s.top},s);d=setLayoutDims(l.concat(h),t);fitBoxes(o.fullSize,c,t,d),fitBoxes(l,c,t,d),fitBoxes(h,c,t,d)&&fitBoxes(l,c,t,d),handleMaxPadding(c),placeBoxes(o.leftAndTop,c,t,d),c.x+=c.w,c.y+=c.h,placeBoxes(o.rightAndBottom,c,t,d),e.chartArea={left:c.left,top:c.top,right:c.left+c.w,bottom:c.top+c.h,height:c.h,width:c.w},each(o.chartArea,t=>{t=t.box;Object.assign(t,e.chartArea),t.update(c.w,c.h,{left:0,top:0,right:0,bottom:0})})}}};class BasePlatform{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,a){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,a?Math.floor(e/a):i)}}isAttached(t){return!0}updateConfig(t){}}class BasicPlatform extends BasePlatform{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const EXPANDO_KEY="$chartjs",EVENT_TYPES={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=t=>null===t||""===t;function initCanvas(t,e){var i=t.style,a=t.getAttribute("height"),s=t.getAttribute("width");return t[EXPANDO_KEY]={initial:{height:a,width:s,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",isNullOrEmpty(s)&&void 0!==(i=readUsedSize(t,"width"))&&(t.width=i),isNullOrEmpty(a)&&(""===t.style.height?t.height=t.width/(e||2):void 0!==(s=readUsedSize(t,"height"))&&(t.height=s)),t}const eventListenerOptions=!!supportsEventListenerOptions&&{passive:!0};function addListener(t,e,i){t.addEventListener(e,i,eventListenerOptions)}function removeListener(t,e,i){t.canvas.removeEventListener(e,i,eventListenerOptions)}function fromNativeEvent(t,e){var i=EVENT_TYPES[t.type]||t.type,{x:a,y:s}=getRelativePosition(t,e);return{type:i,chart:e,native:t,x:void 0!==a?a:null,y:void 0!==s?s:null}}function nodeListContains(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function createAttachObserver(t,e,a){const s=t.canvas;t=new MutationObserver(t=>{let e=!1;for(const i of t)e=(e=e||nodeListContains(i.addedNodes,s))&&!nodeListContains(i.removedNodes,s);e&&a()});return t.observe(document,{childList:!0,subtree:!0}),t}function createDetachObserver(t,e,a){const s=t.canvas;t=new MutationObserver(t=>{let e=!1;for(const i of t)e=(e=e||nodeListContains(i.removedNodes,s))&&!nodeListContains(i.addedNodes,s);e&&a()});return t.observe(document,{childList:!0,subtree:!0}),t}const drpListeningCharts=new Map;let oldDevicePixelRatio=0;function onWindowResize(){const i=window.devicePixelRatio;i!==oldDevicePixelRatio&&(oldDevicePixelRatio=i,drpListeningCharts.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function listenDevicePixelRatioChanges(t,e){drpListeningCharts.size||window.addEventListener("resize",onWindowResize),drpListeningCharts.set(t,e)}function unlistenDevicePixelRatioChanges(t){drpListeningCharts.delete(t),drpListeningCharts.size||window.removeEventListener("resize",onWindowResize)}function createResizeObserver(t,e,a){var i=t.canvas;const s=i&&_getParentNode(i);if(s){const r=throttled((t,e)=>{var i=s.clientWidth;a(t,e),i{var t=t[0],e=t.contentRect.width,t=t.contentRect.height;0===e&&0===t||r(e,t)});return i.observe(s),listenDevicePixelRatioChanges(t,r),i}}function releaseObserver(t,e,i){i&&i.disconnect(),"resize"===e&&unlistenDevicePixelRatioChanges(t)}function createProxyAndListen(e,t,i){var a=e.canvas,s=throttled(t=>{null!==e.ctx&&i(fromNativeEvent(t,e))},e);return addListener(a,t,s),s}class DomPlatform extends BasePlatform{acquireContext(t,e){var i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(initCanvas(t,e),i):null}releaseContext(t){const i=t.canvas;if(!i[EXPANDO_KEY])return!1;const a=i[EXPANDO_KEY].initial,e=(["height","width"].forEach(t=>{var e=a[t];isNullOrUndef(e)?i.removeAttribute(t):i.setAttribute(t,e)}),a.style||{});return Object.keys(e).forEach(t=>{i.style[t]=e[t]}),i.width=i.width,delete i[EXPANDO_KEY],!0}addEventListener(t,e,i){this.removeEventListener(t,e);var a=t.$proxies||(t.$proxies={}),s={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[e]||createProxyAndListen;a[e]=s(t,e,i)}removeEventListener(t,e){var i=t.$proxies||(t.$proxies={}),a=i[e];a&&(({attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[e]||removeListener)(t,e,a),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,a){return getMaximumSize(t,e,i,a)}isAttached(t){t=_getParentNode(t);return!(!t||!t.isConnected)}}function _detectPlatform(t){return!_isDomSupported()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?BasicPlatform:DomPlatform}class Element{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){var{x:t,y:e}=this.getProps(["x","y"],t);return{x:t,y:e}}hasValue(){return isNumber(this.x)&&isNumber(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const a={};return t.forEach(t=>{a[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),a}}function autoSkip(i,a){var s=i.options.ticks,i=determineMaxTicks(i),i=Math.min(s.maxTicksLimit||i,i),r=s.major.enabled?getMajorIndices(a):[],s=r.length,n=r[0],o=r[s-1],l=[];if(i"left"===t?"right":"right"===t?"left":t,offsetFromEdge=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,getTicksLimit=(t,e)=>Math.min(e||t,t);function sample(t,e){var i=[],a=t.length/e,s=t.length;let r=0;for(;rn+1e-6)))return o}function garbageCollect(t,s){each(t,t=>{var e=t.gc,i=e.length/2;let a;if(ss?s:a,s=r&&a>s?a:s,{min:finiteOrDefault(a,finiteOrDefault(s,a)),max:finiteOrDefault(s,finiteOrDefault(a,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){var t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){callback(this.options.beforeUpdate,[this])}update(t,e,i){var{beginAtZero:a,grace:s,ticks:r}=this.options,n=r.sampleSize,t=(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=_addGrace(this,s,a),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks(),n({width:r[t]||0,height:n[t]||0});return{first:k(0),last:k(e-1),widest:k(i),highest:k(y),widths:r,heights:n}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);t=this._startPixel+t*this._length;return _int16Range(this._alignToPixels?_alignPixel(this.chart,t,0):t)}getDecimalForPixel(t){t=(t-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){var{min:t,max:e}=this;return t<0&&e<0?e:0t.value===e))?i.setContext(this.getContext(t)).lineWidth:0}drawGrid(t){var e=this.options.grid;const a=this.ctx;var i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let s,r;var n=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(e.display)for(s=0,r=i.length;s{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:t,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){var e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",a=[];let s,r;for(s=0,r=e.length;s{var e=t.split("."),i=e.pop(),e=[s].concat(e).join("."),t=r[t].split("."),a=t.pop(),t=t.join(".");defaults.route(e,i,t,a)})}function isIChartComponent(t){return"id"in t&&"defaults"in t}class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"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(i,t,a){[...t].forEach(t=>{var e=a||this._getRegistryForType(t);a||e.isForType(t)||e===this.plugins&&t.id?this._exec(i,e,t):each(t,t=>{var e=a||this._getRegistryForType(t);this._exec(i,e,t)})})}_exec(t,e,i){var a=_capitalize(t);callback(i["before"+a],[],i),e[t](i),callback(i["after"+a],[],i)}_getRegistryForType(e){for(let t=0;tt.filter(e=>!i.some(t=>e.plugin.id===t.plugin.id));this._notify(a(e,i),t,"stop"),this._notify(a(i,e),t,"start")}}function allPlugins(t){var e={},i=[],a=Object.keys(registry.plugins.items);for(let t=0;tt.xAxisID===e||t.yAxisID===e);if(t.length)return getAxisFromDataset(e,"x",t[0])||getAxisFromDataset(e,"y",t[0])}return{}}function mergeScaleConfig(n,e){const r=overrides[n.type]||{scales:{}},o=e.scales||{},l=getIndexAxis(n.type,e),h=Object.create(null);return Object.keys(o).forEach(t=>{var e,i,a,s=o[t];return isObject(s)?s._proxy?console.warn("Ignoring resolver passed as options for scale: "+t):(i=getDefaultScaleIDFromAxis(e=determineAxis(t,s,retrieveAxisFromDatasets(t,n),defaults.scales[s.type]),l),a=r.scales||{},void(h[t]=mergeIf(Object.create(null),[{axis:e},s,a[e],a[i]]))):console.error("Invalid scale configuration for scale: "+t)}),n.data.datasets.forEach(a=>{var t=a.type||n.type;const s=a.indexAxis||getIndexAxis(t,e),r=(overrides[t]||{}).scales||{};Object.keys(r).forEach(t=>{var e=getAxisFromDefaultScaleID(t,s),i=a[e+"AxisID"]||e;h[i]=h[i]||Object.create(null),mergeIf(h[i],[{axis:e},o[i],r[t]])})}),Object.keys(h).forEach(t=>{t=h[t];mergeIf(t,[defaults.scales[t.type],defaults.scale])}),h}function initOptions(t){var e=t.options||(t.options={});e.plugins=valueOrDefault(e.plugins,{}),e.scales=mergeScaleConfig(t,e)}function initData(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}function initConfig(t){return(t=t||{}).data=initData(t.data),initOptions(t),t}const keyCache=new Map,keysCached=new Set;function cachedKeys(t,e){let i=keyCache.get(t);return i||(i=e(),keyCache.set(t,i),keysCached.add(i)),i}const addIfFound=(t,e,i)=>{e=resolveObjectKey(e,i);void 0!==e&&t.add(e)};class Config{constructor(t){this._config=initConfig(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=initData(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){var t=this._config;this.clearCache(),initOptions(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return cachedKeys(t,()=>[["datasets."+t,""]])}datasetAnimationScopeKeys(t,e){return cachedKeys(t+".transition."+e,()=>[[`datasets.${t}.transitions.`+e,"transitions."+e],["datasets."+t,""]])}datasetElementScopeKeys(t,e){return cachedKeys(t+"-"+e,()=>[[`datasets.${t}.elements.`+e,"datasets."+t,"elements."+e,""]])}pluginScopeKeys(t){const e=t.id;return cachedKeys(this.type+"-plugin-"+e,()=>[["plugins."+e,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){var i=this._scopeCache;let a=i.get(t);return a&&!e||(a=new Map,i.set(t,a)),a}getOptionScopes(e,t,i){const{options:a,type:s}=this;var i=this._cachedScopes(e,i),r=i.get(t);if(r)return r;const n=new Set;t.forEach(t=>{e&&(n.add(e),t.forEach(t=>addIfFound(n,e,t))),t.forEach(t=>addIfFound(n,a,t)),t.forEach(t=>addIfFound(n,overrides[s]||{},t)),t.forEach(t=>addIfFound(n,defaults,t)),t.forEach(t=>addIfFound(n,descriptors,t))});r=Array.from(n);return 0===r.length&&r.push(Object.create(null)),keysCached.has(t)&&i.set(t,r),r}chartOptionScopes(){var{options:t,type:e}=this;return[t,overrides[e]||{},defaults.datasets[e]||{},{type:e},defaults,descriptors]}resolveNamedOptions(t,e,i,a=[""]){var s={$shared:!0},{resolver:a,subPrefixes:r}=getResolver(this._resolverCache,t,a);let n=a;needContext(a,e)&&(s.$shared=!1,i=isFunction(i)?i():i,t=this.createResolver(t,i,r),n=_attachContext(a,i,t));for(const o of e)s[o]=n[o];return s}createResolver(t,e,i=[""],a){t=getResolver(this._resolverCache,t,i).resolver;return isObject(e)?_attachContext(t,e,void 0,a):t}}function getResolver(t,e,i){let a=t.get(e);a||(a=new Map,t.set(e,a));t=i.join();let s=a.get(t);return s||(e=_createResolver(e,i),s={resolver:e,subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},a.set(t,s)),s}const hasFunction=i=>isObject(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||isFunction(i[e]),!1);function needContext(t,e){var{isScriptable:i,isIndexable:a}=_descriptors(t);for(const o of e){var s=i(o),r=a(o),n=(r||s)&&t[o];if(s&&(isFunction(n)||hasFunction(n))||r&&isArray(n))return!0}return!1}var version="4.3.2";const KNOWN_POSITIONS=["top","bottom","left","right","chartArea"];function positionIsHorizontal(t,e){return"top"===t||"bottom"===t||-1===KNOWN_POSITIONS.indexOf(t)&&"x"===e}function compare2Level(i,a){return function(t,e){return t[i]===e[i]?t[a]-e[a]:t[i]-e[i]}}function onAnimationsComplete(t){var e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),callback(i&&i.onComplete,[t],e)}function onAnimationProgress(t){var e=t.chart,i=e.options.animation;callback(i&&i.onProgress,[t],e)}function getCanvas(t){return _isDomSupported()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t=t&&t.canvas?t.canvas:t}const instances={},getChart=t=>{const e=getCanvas(t);return Object.values(instances).filter(t=>t.canvas===e).pop()};function moveNumericKeys(t,e,i){for(const r of Object.keys(t)){var a,s=+r;e<=s&&(a=t[r],delete t[r],0this.update(t),i.resizeDelay||0),this._dataChanges=[],instances[this.id]=this,e&&t?(animator.listen(this,"complete",onAnimationsComplete),animator.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){var{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:a,_aspectRatio:s}=this;return isNullOrUndef(t)?e&&s?s:a?i/a: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}get registry(){return registry}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return clearCanvas(this.canvas,this.ctx),this}stop(){return animator.stop(this),this}resize(t,e){animator.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){var i=this.options,a=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(a,t,e,s),t=i.devicePixelRatio||this.platform.getDevicePixelRatio(),e=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,retinaScale(this,t,!0)&&(this.notifyPlugins("resize",{size:a}),callback(i.onResize,[this,a],this),this.attached)&&this._doResize(e)&&this.render()}ensureScalesHaveIDs(){var t=this.options.scales||{};each(t,(t,e)=>{t.id=e})}buildOrUpdateScales(){const n=this.options,a=n.scales,o=this.scales,l=Object.keys(o).reduce((t,e)=>(t[e]=!1,t),{});let t=[];a&&(t=t.concat(Object.keys(a).map(t=>{var e=a[t],t=determineAxis(t,e),i="r"===t,t="x"===t;return{options:e,dposition:i?"chartArea":t?"bottom":"left",dtype:i?"radialLinear":t?"category":"linear"}}))),each(t,t=>{var e=t.options,i=e.id,a=determineAxis(i,e),s=valueOrDefault(e.type,t.dtype);void 0!==e.position&&positionIsHorizontal(e.position,a)===positionIsHorizontal(t.dposition)||(e.position=t.dposition),l[i]=!0;let r=null;i in o&&o[i].type===s?r=o[i]:(a=registry.getScale(s),r=new a({id:i,type:s,ctx:this.ctx,chart:this}),o[r.id]=r),r.init(e,n)}),each(l,(t,e)=>{t||delete o[e]}),each(o,t=>{layouts.configure(this,t,t.options),layouts.addBox(this,t)})}_updateMetasets(){var t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),ei.length&&delete this._stacks,t.forEach((e,t)=>{0===i.filter(t=>t===e._dataset).length&&this._destroyDatasetMeta(t)})}buildOrUpdateControllers(){var e=[],i=this.data.datasets;let a,t;for(this._removeUnreferencedMetasets(),a=0,t=i.length;a{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){var e=this.config,e=(e.update(),this._options=e.createResolver(e.chartOptionScopes(),this.getContext())),a=this._animationsDisabled=!e.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1!==this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})){var s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let t=0,e=this.data.datasets.length;t{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(compare2Level("z","_idx"));var{_active:e,_lastEvent:t}=this;t?this._eventHandler(t,!0):e.length&&this._updateHoverStyles(e,e,!0),this.render()}}_updateScales(){each(this.scales,t=>{layouts.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){var t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);setsEqual(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){var t,e,i,a=this["_hiddenIndices"];for({method:t,start:e,count:i}of this._getUniformDataChanges()||[]){var s="_removeElements"===t?-i:i;moveNumericKeys(a,e,s)}}_getUniformDataChanges(){const t=this._dataChanges;if(t&&t.length){this._dataChanges=[];var e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),a=i(0);for(let t=1;tt.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}}_updateLayout(t){if(!1!==this.notifyPlugins("beforeLayout",{cancelable:!0})){layouts.update(this,this.width,this.height,t);t=this.chartArea;const e=t.width<=0||t.height<=0;this._layers=[],each(this.boxes,t=>{e&&"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(i){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:i,cancelable:!0})){for(let t=0,e=this.data.datasets.length;tt&&t._dataset===e).pop();return a||(a={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(a)),a}getContext(){return this.$context||(this.$context=createContext(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){var e=this.data.datasets[t];return!!e&&("boolean"==typeof(t=this.getDatasetMeta(t)).hidden?!t.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(e,t,i){const a=i?"show":"hide";var s=this.getDatasetMeta(e),r=s.controller._resolveAnimations(void 0,a);defined(t)?(s.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),r.update(s,{visible:i}),this.update(t=>t.datasetIndex===e?a:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){var e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),animator.remove(this),t=0,e=this.data.datasets.length;t{a.addEventListener(this,t,e),i[t]=e},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};each(this.options.events,t=>e(t,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const i=this._responsiveListeners,a=this.platform,t=(t,e)=>{a.addEventListener(this,t,e),i[t]=e},e=(t,e)=>{i[t]&&(a.removeEventListener(this,t,e),delete i[t])},s=(t,e)=>{this.canvas&&this.resize(t,e)};let r;const n=()=>{e("attach",n),this.attached=!0,this.resize(),t("resize",s),t("detach",r)};r=()=>{this.attached=!1,e("resize",s),this._stop(),this._resize(0,0),t("attach",n)},(a.isAttached(this.canvas)?n:r)()}unbindEvents(){each(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},each(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){var a=i?"set":"remove";let s,r,n;for("dataset"===e&&this.getDatasetMeta(t[0].datasetIndex).controller["_"+a+"DatasetHoverStyle"](),r=0,n=t.length;r{var i=this.getDatasetMeta(t);if(i)return{datasetIndex:t,element:i.data[e],index:e};throw new Error("No dataset found at index "+t)});_elementsEqual(t,e)||(this._active=t,this._lastEvent=null,this._updateHoverStyles(t,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(e){return 1===this._plugins._cache.filter(t=>t.plugin.id===e).length}_updateHoverStyles(t,e,i){var a=this.options.hover,s=(t,i)=>t.filter(e=>!i.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),r=s(e,t),i=i?t:s(t,e);r.length&&this.updateHoverStyle(r,a.mode,!1),i.length&&a.mode&&this.updateHoverStyle(i,a.mode,!0)}_eventHandler(e,t){var i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},a=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1!==this.notifyPlugins("beforeEvent",i,a))return t=this._handleEvent(e,t,i.inChartArea),i.cancelable=!1,this.notifyPlugins("afterEvent",i,a),(t||i.changed)&&this.render(),this}_handleEvent(t,e,i){var{_active:a=[],options:s}=this,r=this._getActiveElements(t,a,i,e),n=_isClickEvent(t),o=determineLastEvent(t,this._lastEvent,i,n),i=(i&&(this._lastEvent=null,callback(s.onHover,[t,r,this],this),n)&&callback(s.onClick,[t,r,this],this),!_elementsEqual(r,a));return(i||e)&&(this._active=r,this._updateHoverStyles(r,a,e)),this._lastEvent=o,i}_getActiveElements(t,e,i,a){return"mouseout"===t.type?[]:i?(i=this.options.hover,this.getElementsAtEventForMode(t,i.mode,i,a)):e}}function invalidatePlugins(){return each(Chart.instances,t=>t._plugins.invalidate())}function clipArc(t,e,i){var{startAngle:e,pixelMargin:a,x:s,y:r,outerRadius:n,innerRadius:o}=e,l=a/n;t.beginPath(),t.arc(s,r,n,e-l,i+l),a{var e=(i-Math.min(s,t))*a/2;return _limitValue(t,0,Math.min(s,e))};return{outerStart:r(t.outerStart),outerEnd:r(t.outerEnd),innerStart:_limitValue(t.innerStart,0,e),innerEnd:_limitValue(t.innerEnd,0,e)}}function rThetaToXY(t,e,i,a){return{x:i+t*Math.cos(e),y:a+t*Math.sin(e)}}function pathArc(t,e,i,a,s,r){var{x:n,y:o,startAngle:l,pixelMargin:h,innerRadius:d}=e,c=Math.max(e.outerRadius+a+i-h,0),h=0"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;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){var a=this.getProps(["x","y"],i),{angle:a,distance:t}=getAngleFromPoint(a,{x:t,y:e}),{startAngle:e,endAngle:i,innerRadius:s,outerRadius:r,circumference:n}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),o=(this.options.spacing+this.options.borderWidth)/2,n=valueOrDefault(n,i-e),n=TAU<=n||_angleBetween(a,e,i),a=_isBetween(t,s+o,r+o);return n&&a}getCenterPoint(t){var{x:t,y:e,startAngle:i,endAngle:a,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:n,spacing:o}=this.options,i=(i+a)/2,a=(s+r+o+n)/2;return{x:t+Math.cos(i)*a,y:e+Math.sin(i)*a}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){var e,{options:i,circumference:a}=this,s=(i.offset||0)/4,r=(i.spacing||0)/2,n=i.circular;this.pixelMargin="inner"===i.borderAlign?.33:0,this.fullCircles=TAU(n+(h?o-t:t))%r,k=()=>{f!==m&&(t.lineTo(d,m),t.lineTo(d,f),t.lineTo(d,v))};for(l&&(g=s[y(0)],t.moveTo(g.x,g.y)),u=0;u<=o;++u)(g=s[y(u)]).skip||(x=g.x,b=g.y,(_=0|x)===p?(bm&&(m=b),d=(c*d+x)/++c):(k(),t.lineTo(x,b),p=_,c=0,f=m=b),v=b);k()}function _getSegmentMethod(t){var e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?fastPathSegment:pathSegment}function _getInterpolationMethod(t){return t.stepped?_steppedInterpolation:t.tension||"monotone"===t.cubicInterpolationMode?_bezierInterpolation:_pointInLine}function strokePathWithCache(t,e,i,a){let s=e._path;s||(s=e._path=new Path2D,e.path(s,i,a)&&s.closePath()),setStyle(t,e.options),t.stroke(s)}function strokePathDirect(t,e,i,a){var{segments:s,options:r}=e,n=_getSegmentMethod(e);for(const o of s)setStyle(t,r,o.style),t.beginPath(),n(t,e,o,{start:i,end:i+a-1})&&t.closePath(),t.stroke()}const usePath2D="function"==typeof Path2D;function draw(t,e,i,a){(usePath2D&&!e.options.segment?strokePathWithCache:strokePathDirect)(t,e,i,a)}class LineElement extends Element{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};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){var i,a=this.options;!a.tension&&"monotone"!==a.cubicInterpolationMode||a.stepped||this._pointsUpdated||(i=a.spanGaps?this._loop:this._fullLoop,_updateBezierControlPoints(this._points,a,t,i,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=_computeSegments(this,this.options.segment))}first(){var t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){var t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(i,a){var s=this.options,r=i[a],n=this.points,o=_boundSegments(this,{property:a,start:r,end:r});if(o.length){var l=[],h=_getInterpolationMethod(s);let t,e;for(t=0,e=o.length;tt.replace("rgb(","rgba(").replace(")",", 0.5)"));function getBorderColor(t){return BORDER_COLORS[t%BORDER_COLORS.length]}function getBackgroundColor(t){return BACKGROUND_COLORS[t%BACKGROUND_COLORS.length]}function colorizeDefaultDataset(t,e){return t.borderColor=getBorderColor(e),t.backgroundColor=getBackgroundColor(e),++e}function colorizeDoughnutDataset(t,e){return t.backgroundColor=t.data.map(()=>getBorderColor(e++)),e}function colorizePolarAreaDataset(t,e){return t.backgroundColor=t.data.map(()=>getBackgroundColor(e++)),e}function getColorizer(i){let a=0;return(t,e)=>{e=i.getDatasetMeta(e).controller;e instanceof DoughnutController?a=colorizeDoughnutDataset(t,a):e instanceof PolarAreaController?a=colorizePolarAreaDataset(t,a):e&&(a=colorizeDefaultDataset(t,a))}}function containsColorsDefinitions(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}function containsColorsDefinition(t){return t&&(t.borderColor||t.backgroundColor)}var plugin_colors={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){var a,s,r;i.enabled&&({data:{datasets:a},options:s}=t.config,r=s["elements"],!i.forceOverride&&(containsColorsDefinitions(a)||containsColorsDefinition(s)||r&&containsColorsDefinitions(r))||(i=getColorizer(t),a.forEach(i)))}};function lttbDecimation(a,s,r,t,e){var i=e.samples||t;if(r<=i)return a.slice(s,s+r);var n=[],o=(r-2)/(i-2);let l=0;e=s+r-1;let h=s,d,c,u,g,p;for(n[l++]=a[h],d=0;du&&(u=g,c=a[i],p=i);n[l++]=c,h=p}return n[l++]=a[e],n}function minMaxDecimation(t,e,i,a){let s=0,r=0,n,o,l,h,d,c,u,g,p,f;var m=[],v=t[e].x,x=t[e+i-1].x-v;for(n=e;nf&&(f=h,u=n),s=(r*s+o.x)/++r):(b=n-1,isNullOrUndef(c)||isNullOrUndef(u)||(_=Math.min(c,u),y=Math.max(c,u),_!==g&&_!==b&&m.push({...t[_],x:s}),y!==g&&y!==b&&m.push({...t[y],x:s})),0{cleanDecimatedDataset(t)})}function getStartAndCountOfVisiblePointsSimplified(t,e){var i=e.length;let a=0,s;var t=t["iScale"],{min:r,max:n,minDefined:o,maxDefined:l}=t.getUserBounds();return o&&(a=_limitValue(_lookupByKey(e,t.axis,r).lo,0,i-1)),s=l?_limitValue(_lookupByKey(e,t.axis,n).hi+1,a,i)-a:i-a,{start:a,count:s}}var plugin_decimation={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(o,t,l)=>{if(l.enabled){const h=o.width;o.data.datasets.forEach((e,t)=>{var{_data:i,indexAxis:a}=e,t=o.getDatasetMeta(t),s=i||e.data;if("y"!==resolve([a,o.options.indexAxis])&&t.controller.supportsDecimation){a=o.scales[t.xAxisID];if(("linear"===a.type||"time"===a.type)&&!o.options.parsing){var{start:r,count:n}=getStartAndCountOfVisiblePointsSimplified(t,s);if(n<=(l.threshold||4*h))cleanDecimatedDataset(e);else{isNullOrUndef(i)&&(e._data=s,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}}));let t;switch(l.algorithm){case"lttb":t=lttbDecimation(s,r,n,h,l);break;case"min-max":t=minMaxDecimation(s,r,n,h);break;default:throw new Error(`Unsupported decimation algorithm '${l.algorithm}'`)}e._decimated=t}}}})}else cleanDecimatedData(o)},destroy(t){cleanDecimatedData(t)}};function _segments(t,e,i){var a=t.segments,s=t.points,r=e.points,n=[];for(const c of a){var{start:o,end:l}=c,l=_findSegmentEnd(o,l,s),h=_getBounds(i,s[o],s[l],c.loop);if(e.segments)for(const u of _boundSegments(e,h)){var d=_getBounds(i,r[u.start],r[u.end],u.loop);for(const g of _boundSegment(c,s,d))n.push({source:g,target:u,start:{[i]:_getEdge(h,d,"start",Math.max)},end:{[i]:_getEdge(h,d,"end",Math.min)}})}else n.push({source:c,target:h,start:s[o],end:s[l]})}return n}function _getBounds(i,a,s,t){if(!t){let t=a[i],e=s[i];return"angle"===i&&(t=_normalizeAngle(t),e=_normalizeAngle(e)),{property:i,start:t,end:e}}}function _pointsFromSegments(t,e){const{x:i=null,y:a=null}=t||{},s=e.points,r=[];return e.segments.forEach(({start:t,end:e})=>{e=_findSegmentEnd(t,e,s);t=s[t],e=s[e];null!==a?(r.push({x:t.x,y:a}),r.push({x:e.x,y:a})):null!==i&&(r.push({x:i,y:t.y}),r.push({x:i,y:e.y}))}),r}function _findSegmentEnd(t,e,i){for(;t{let{boxHeight:i=e,boxWidth:a=e}=t;return t.usePointStyle&&(i=Math.min(i,e),a=t.pointStyleWidth||Math.min(a,e)),{boxWidth:a,boxHeight:i,itemHeight:Math.max(e,i)}},itemsEqual=(t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class Legend extends Element{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 i=this.options.labels||{};let t=callback(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(t=>i.filter(t,this.chart.data))),i.sort&&(t=t.sort((t,e)=>i.sort(t,e,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){var{options:i,ctx:a}=this;if(i.display){var s=i.labels,r=toFont(s.font),n=r.size,o=this._computeTitleHeight(),{boxWidth:s,itemHeight:l}=getBoxSize(s,n);let t,e;a.font=r.string,this.isHorizontal()?(t=this.maxWidth,e=this._fitRows(o,n,s,l)+10):(e=this.maxHeight,t=this._fitCols(o,r,s,l)+10),this.width=Math.min(t,i.maxWidth||this.maxWidth),this.height=Math.min(e,i.maxHeight||this.maxHeight)}else this.width=this.height=0}_fitRows(t,i,a,s){const{ctx:r,maxWidth:n,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],h=this.lineWidths=[0],d=s+o;let c=t,u=(r.textAlign="left",r.textBaseline="middle",-1),g=-d;return this.legendItems.forEach((t,e)=>{t=a+i/2+r.measureText(t.text).width;(0===e||h[h.length-1]+t+2*o>n)&&(c+=d,h[h.length-(0{var{itemWidth:t,itemHeight:i}=calculateItemSize(s,a,n,t,r);0d&&(c+=u+o,h.push({width:u,height:g}),p+=u+o,f++,u=g=0),l[e]={left:p,top:g,col:f,width:t,height:i},u=Math.max(u,t),g+=i+o}),c+=u,h.push({width:u,height:g}),c}adjustHitBoxes(){if(this.options.display){var i=this._computeTitleHeight(),{legendHitBoxes:a,options:{align:s,labels:{padding:r},rtl:t}}=this,n=getRtlAdapter(t,this.left,this.width);if(this.isHorizontal()){let t=0,e=_alignStartEnd(s,this.left+r,this.right-this.lineWidths[t]);for(const o of a)t!==o.row&&(t=o.row,e=_alignStartEnd(s,this.left+r,this.right-this.lineWidths[t])),o.top+=this.top+i+r,o.left=n.leftForLtr(n.x(e),o.width),e+=o.width+r}else{let t=0,e=_alignStartEnd(s,this.top+i+r,this.bottom-this.columnSizes[t].height);for(const l of a)l.col!==t&&(t=l.col,e=_alignStartEnd(s,this.top+i+r,this.bottom-this.columnSizes[t].height)),l.top=e,l.left+=this.left+r,l.left=n.leftForLtr(n.x(l.left),l.width),e+=l.height+r}}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){var t;this.options.display&&(t=this.ctx,clipArea(t,this),this._draw(),unclipArea(t))}_draw(){const{options:u,columnSizes:g,lineWidths:p,ctx:f}=this,{align:m,labels:v}=u,x=defaults.color,b=getRtlAdapter(u.rtl,this.left,this.width),_=toFont(v.font),y=v["padding"],k=_.size,S=k/2;let D;this.drawTitle(),f.textAlign=b.textAlign("left"),f.textBaseline="middle",f.lineWidth=.5,f.font=_.string;const{boxWidth:M,boxHeight:P,itemHeight:w}=getBoxSize(v,k),C=this.isHorizontal(),A=this._computeTitleHeight(),O=(D=C?{x:_alignStartEnd(m,this.left+y,this.right-p[0]),y:this.top+y+A,line:0}:{x:this.left+y,y:_alignStartEnd(m,this.top+A+y,this.bottom-g[0].height),line:0},overrideTextDirection(this.ctx,u.textDirection),w+y);this.legendItems.forEach((t,e)=>{f.strokeStyle=t.fontColor,f.fillStyle=t.fontColor;var i=f.measureText(t.text).width,a=b.textAlign(t.textAlign||(t.textAlign=v.textAlign)),i=M+S+i;let s=D.x,r=D.y;b.setWidth(this.width),C?0this.right&&(r=D.y+=O,D.line++,s=D.x=_alignStartEnd(m,this.left+y,this.right-p[D.line])):0this.bottom&&(s=D.x=s+g[D.line].width+y,D.line++,r=D.y=_alignStartEnd(m,this.top+A+y,this.bottom-g[D.line].height));var n,o,l,h,d,c,e=b.x(s);e=e,h=r,d=t,isNaN(M)||M<=0||isNaN(P)||P<0||(f.save(),n=valueOrDefault(d.lineWidth,1),f.fillStyle=valueOrDefault(d.fillStyle,x),f.lineCap=valueOrDefault(d.lineCap,"butt"),f.lineDashOffset=valueOrDefault(d.lineDashOffset,0),f.lineJoin=valueOrDefault(d.lineJoin,"miter"),f.lineWidth=n,f.strokeStyle=valueOrDefault(d.strokeStyle,x),f.setLineDash(valueOrDefault(d.lineDash,[])),v.usePointStyle?(o={radius:P*Math.SQRT2/2,pointStyle:d.pointStyle,rotation:d.rotation,borderWidth:n},l=b.xPlus(e,M/2),c=h+S,drawPointLegend(f,o,l,c,v.pointStyleWidth&&M)):(o=h+Math.max((k-P)/2,0),l=b.leftForLtr(e,M),c=toTRBLCorners(d.borderRadius),f.beginPath(),Object.values(c).some(t=>0!==t)?addRoundedRectPath(f,{x:l,y:o,w:M,h:P,radius:c}):f.rect(l,o,M,P),f.fill(),0!==n&&f.stroke()),f.restore()),s=_textX(a,s+M+S,C?s+i:this.right,u.rtl),h=b.x(s),e=r,d=t,renderText(f,d.text,h,e+w/2,_,{strikethrough:d.hidden,textAlign:b.textAlign(d.textAlign)}),C?D.x+=i+y:"string"!=typeof t.text?(c=_.lineHeight,D.y+=calculateLegendItemHeight(t,c)+y):D.y+=O}),restoreTextDirection(this.ctx,u.textDirection)}drawTitle(){var a=this.options,s=a.title,r=toFont(s.font),n=toPadding(s.padding);if(s.display){var o=getRtlAdapter(a.rtl,this.left,this.width),l=this.ctx,h=s.position,d=r.size/2,n=n.top+d;let t,e=this.left,i=this.width;this.isHorizontal()?(i=Math.max(...this.lineWidths),t=this.top+n,e=_alignStartEnd(a.align,e,this.right-i)):(d=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0),t=n+_alignStartEnd(a.align,this.top,this.bottom-d-a.labels.padding-this._computeTitleHeight()));n=_alignStartEnd(h,e,e+i);l.textAlign=o.textAlign(_toLeftRightCenter(h)),l.textBaseline="middle",l.strokeStyle=s.color,l.fillStyle=s.color,l.font=r.string,renderText(l,s.text,n,t,r)}}_computeTitleHeight(){var t=this.options.title,e=toFont(t.font),i=toPadding(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,a,s;if(_isBetween(t,this.left,this.right)&&_isBetween(e,this.top,this.bottom))for(s=this.legendHitBoxes,i=0;it.length>e.length?t:e)),e+i.size/2+a.measureText(s).width}function calculateItemHeight(t,e,i){let a=t;return a="string"!=typeof e.text?calculateLegendItemHeight(e,i):a}function calculateLegendItemHeight(t,e){return e*(t.text?t.text.length:0)}function isListened(t,e){return!("mousemove"!==t&&"mouseout"!==t||!e.onHover&&!e.onLeave)||!(!e.onClick||"click"!==t&&"mouseup"!==t)}var plugin_legend={id:"legend",_element:Legend,start(t,e,i){var a=t.legend=new Legend({ctx:t.ctx,options:i,chart:t});layouts.configure(t,a,i),layouts.addBox(t,a)},stop(t){layouts.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){var a=t.legend;layouts.configure(t,a,i),a.options=i},afterUpdate(t){t=t.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){var a=e.datasetIndex,i=i.chart;i.isDatasetVisible(a)?(i.hide(a),e.hidden=!0):(i.show(a),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const a=t.data.datasets,{usePointStyle:s,pointStyle:r,textAlign:n,color:o,useBorderRadius:l,borderRadius:h}=t.legend.options["labels"];return t._getSortedDatasetMetas().map(t=>{var e=t.controller.getStyle(s?0:void 0),i=toPadding(e.borderWidth);return{text:a[t.index].label,fillStyle:e.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:(i.width+i.height)/4,strokeStyle:e.borderColor,pointStyle:r||e.pointStyle,rotation:e.rotation,textAlign:n||e.textAlign,borderRadius:l&&(h||e.borderRadius),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 Title extends Element{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){var i=this.options;this.left=0,this.top=0,i.display?(this.width=this.right=t,this.height=this.bottom=e,t=isArray(i.text)?i.text.length:1,this._padding=toPadding(i.padding),e=t*toFont(i.font).lineHeight+this._padding.height,this.isHorizontal()?this.height=e:this.width=e):this.width=this.height=this.right=this.bottom=0}isHorizontal(){var t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){var{top:e,left:i,bottom:a,right:s,options:r}=this,n=r.align;let o=0,l,h,d;return l=this.isHorizontal()?(h=_alignStartEnd(n,i,s),d=e+t,s-i):(o="left"===r.position?(h=i+t,d=_alignStartEnd(n,a,e),-.5*PI):(h=s-t,d=_alignStartEnd(n,e,a),.5*PI),a-e),{titleX:h,titleY:d,maxWidth:l,rotation:o}}draw(){var t,e,i,a,s,r=this.ctx,n=this.options;n.display&&(e=(t=toFont(n.font)).lineHeight/2+this._padding.top,{titleX:e,titleY:i,maxWidth:a,rotation:s}=this._drawArgs(e),renderText(r,n.text,0,0,t,{color:n.color,maxWidth:a,rotation:s,textAlign:_toLeftRightCenter(n.align),textBaseline:"middle",translation:[e,i]}))}}function createTitle(t,e){var i=new Title({ctx:t.ctx,options:e,chart:t});layouts.configure(t,i,e),layouts.addBox(t,i),t.titleBlock=i}var plugin_title={id:"title",_element:Title,start(t,e,i){createTitle(t,i)},stop(t){var e=t.titleBlock;layouts.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){var a=t.titleBlock;layouts.configure(t,a,i),a.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 map=new WeakMap;var plugin_subtitle={id:"subtitle",start(t,e,i){var a=new Title({ctx:t.ctx,options:i,chart:t});layouts.configure(t,a,i),layouts.addBox(t,a),map.set(t,a)},stop(t){layouts.removeBox(t,map.get(t)),map.delete(t)},beforeUpdate(t,e,i){var a=map.get(t);layouts.configure(t,a,i),a.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 positioners={average(t){if(!t.length)return!1;let e,i,a=0,s=0,r=0;for(e=0,i=t.length;et+e.before.length+e.lines.length+e.after.length,0);f+=t.beforeBody.length+t.afterBody.length,r&&(g+=r*h.lineHeight+(r-1)*e.titleSpacing+e.titleMarginBottom),f&&(r=e.displayColors?Math.max(o,l.lineHeight):l.lineHeight,g+=c*r+(f-c)*l.lineHeight+(f-1)*e.bodySpacing),s&&(g+=e.footerMarginTop+s*d.lineHeight+(s-1)*e.footerSpacing);let m=0;function v(t){p=Math.max(p,i.measureText(t).width+m)}return i.save(),i.font=h.string,each(t.title,v),i.font=l.string,each(t.beforeBody.concat(t.afterBody),v),m=e.displayColors?n+2+e.boxPadding:0,each(a,t=>{each(t.before,v),each(t.lines,v),each(t.after,v)}),m=0,i.font=d.string,each(t.footer,v),i.restore(),{width:p+=u.width,height:g}}function determineYAlign(t,e){var{y:e,height:i}=e;return et.height-i/2?"bottom":"center"}function doesNotFitWithAlign(t,e,i,a){var{x:a,width:s}=a,i=i.caretSize+i.caretPadding;return"left"===t&&a+s+i>e.width||"right"===t&&a-s-i<0||void 0}function determineXAlign(t,e,i,a){var{x:s,width:r}=i,{width:n,chartArea:{left:o,right:l}}=t;let h="center";return"center"===a?h=s<=(o+l)/2?"left":"right":s<=r/2?h="left":n-r/2<=s&&(h="right"),h=doesNotFitWithAlign(h,t,e,i)?"center":h}function determineAlignment(t,e,i){var a=i.yAlign||e.yAlign||determineYAlign(t,i);return{xAlign:i.xAlign||e.xAlign||determineXAlign(t,e,i,a),yAlign:a}}function alignX(t,e){let{x:i,width:a}=t;return"right"===e?i-=a:"center"===e&&(i-=a/2),i}function alignY(t,e,i){let{y:a,height:s}=t;return"top"===e?a+=i:a-="bottom"===e?s+i:s/2,a}function getBackgroundPoint(t,e,i,a){var{caretSize:t,caretPadding:s,cornerRadius:r}=t,{xAlign:i,yAlign:n}=i,s=t+s,{topLeft:r,topRight:o,bottomLeft:l,bottomRight:h}=toTRBLCorners(r);let d=alignX(e,i);var c=alignY(e,n,s);return"center"===n?"left"===i?d+=s:"right"===i&&(d-=s):"left"===i?d-=Math.max(r,l)+t:"right"===i&&(d+=Math.max(o,h)+t),{x:_limitValue(d,0,a.width-e.width),y:_limitValue(c,0,a.height-e.height)}}function getAlignedX(t,e,i){i=toPadding(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.right:t.x+i.left}function getBeforeAfterBodyLines(t){return pushOrConcat([],splitNewlines(t))}function createTooltipContext(t,e,i){return createContext(t,{tooltip:e,tooltipItems:i,type:"tooltip"})}function overrideCallbacks(t,e){e=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return e?t.override(e):t}const defaultCallbacks={beforeTitle:noop,title(t){if(0{var e={before:[],lines:[],after:[]},i=overrideCallbacks(a,t);pushOrConcat(e.before,splitNewlines(invokeCallbackWithFallback(i,"beforeLabel",this,t))),pushOrConcat(e.lines,invokeCallbackWithFallback(i,"label",this,t)),pushOrConcat(e.after,splitNewlines(invokeCallbackWithFallback(i,"afterLabel",this,t))),s.push(e)}),s}getAfterBody(t,e){return getBeforeAfterBodyLines(invokeCallbackWithFallback(e.callbacks,"afterBody",this,t))}getFooter(t,e){var e=e["callbacks"],i=invokeCallbackWithFallback(e,"beforeFooter",this,t),a=invokeCallbackWithFallback(e,"footer",this,t),e=invokeCallbackWithFallback(e,"afterFooter",this,t),t=pushOrConcat([],splitNewlines(i));return t=pushOrConcat(t,splitNewlines(a)),pushOrConcat(t,splitNewlines(e))}_createItems(a){var t=this._active;const s=this.chart.data,i=[],r=[],n=[];let e=[],o,l;for(o=0,l=t.length;oa.filter(t,e,i,s))),a.itemSort&&(e=e.sort((t,e)=>a.itemSort(t,e,s))),each(e,t=>{var e=overrideCallbacks(a.callbacks,t);i.push(invokeCallbackWithFallback(e,"labelColor",this,t)),r.push(invokeCallbackWithFallback(e,"labelPointStyle",this,t)),n.push(invokeCallbackWithFallback(e,"labelTextColor",this,t))}),this.labelColors=i,this.labelPointStyles=r,this.labelTextColors=n,this.dataPoints=e}update(t,e){var i,a,s,r=this.options.setContext(this.getContext()),n=this._active;let o,l=[];n.length?(n=positioners[r.position].call(this,n,this._eventPosition),l=this._createItems(r),this.title=this.getTitle(l,r),this.beforeBody=this.getBeforeBody(l,r),this.body=this.getBody(l,r),this.afterBody=this.getAfterBody(l,r),this.footer=this.getFooter(l,r),i=this._size=getTooltipSize(this,r),s=getBackgroundPoint(r,a=Object.assign({},n,i),a=determineAlignment(this.chart,r,a),this.chart),this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:s.x,y:s.y,width:i.width,height:i.height,caretX:n.x,caretY:n.y}):0!==this.opacity&&(o={opacity:0}),this._tooltipItems=l,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,a){t=this.getCaretPosition(t,i,a);e.lineTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineTo(t.x3,t.y3)}getCaretPosition(t,e,i){var{xAlign:a,yAlign:s}=this,{caretSize:i,cornerRadius:r}=i,{topLeft:r,topRight:n,bottomLeft:o,bottomRight:l}=toTRBLCorners(r),{x:t,y:h}=t,{width:e,height:d}=e;let c,u,g,p,f,m;return"center"===s?(f=h+d/2,m="left"===a?(c=t,u=c-i,p=f+i,f-i):(c=t+e,u=c+i,p=f-i,f+i),g=c):(u="left"===a?t+Math.max(r,o)+i:"right"===a?t+e-Math.max(n,l)-i:this.caretX,g="top"===s?(p=h,f=p-i,c=u-i,u+i):(p=h+d,f=p+i,c=u+i,u-i),m=p),{x1:c,x2:u,x3:g,y1:p,y2:f,y3:m}}drawTitle(t,e,i){var a=this.title,s=a.length;let r,n,o;if(s){var l=getRtlAdapter(i.rtl,this.x,this.width);for(t.x=getAlignedX(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",r=toFont(i.titleFont),n=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,o=0;o0!==t)?(t.beginPath(),t.fillStyle=s.multiKeyBackground,addRoundedRectPath(t,{x:d,y:e,w:h,h:l,radius:r}),t.fill(),t.stroke(),t.fillStyle=n.backgroundColor,t.beginPath(),addRoundedRectPath(t,{x:o,y:e+1,w:h-2,h:l-2,radius:r}),t.fill()):(t.fillStyle=s.multiKeyBackground,t.fillRect(d,e,h,l),t.strokeRect(d,e,h,l),t.fillStyle=n.backgroundColor,t.fillRect(o,e+1,h-2,l-2))),t.fillStyle=this.labelTextColors[i]}drawBody(e,i,t){var a=this["body"];const{bodySpacing:s,bodyAlign:r,displayColors:n,boxHeight:o,boxWidth:l,boxPadding:h}=t;var d=toFont(t.bodyFont);let c=d.lineHeight,u=0;const g=getRtlAdapter(t.rtl,this.x,this.width);function p(t){i.fillText(t,g.x(e.x+u),e.y+c/2),e.y+=c+s}var f=g.textAlign(r);let m,v,x,b,_,y,k;for(i.textAlign=r,i.textBaseline="middle",i.font=d.string,e.x=getAlignedX(this,f,t),i.fillStyle=t.bodyColor,each(this.beforeBody,p),u=n&&"right"!==f?"center"===r?l/2+h:l+2+h:0,b=0,y=a.length;b{var i=this.chart.getDatasetMeta(t);if(i)return{datasetIndex:t,element:i.data[e],index:e};throw new Error("Cannot find a dataset at index "+t)}),i=!_elementsEqual(i,t),a=this._positionChanged(t,e);(i||a)&&(this._active=t,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;var a=this.options,s=this._active||[],i=this._getActiveElements(t,s,e,i),r=this._positionChanged(i,t),s=e||!_elementsEqual(i,s)||r;return s&&(this._active=i,a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e)),s}_getActiveElements(t,e,i,a){var s=this.options;return"mouseout"===t.type?[]:a?(a=this.chart.getElementsAtEventForMode(t,s.mode,s,i),s.reverse&&a.reverse(),a):e}_positionChanged(t,e){var{caretX:i,caretY:a,options:s}=this,s=positioners[s.position].call(this,t,e);return!1!==s&&(i!==s.x||a!==s.y)}}var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners:positioners,afterInit(t,e,i){i&&(t.tooltip=new Tooltip({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){var e,i=t.tooltip;i&&i._willRender()&&!(e={tooltip:i})!==t.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})&&(i.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",e))},afterEvent(t,e){var i;t.tooltip&&(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:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},plugins=Object.freeze({__proto__:null,Colors:plugin_colors,Decimation:plugin_decimation,Filler:index,Legend:plugin_legend,SubTitle:plugin_subtitle,Title:plugin_title,Tooltip:plugin_tooltip});const addIfString=(t,e,i,a)=>("string"==typeof e?(i=t.push(e)-1,a.unshift({index:i,label:e})):isNaN(e)&&(i=null),i);function findOrAddLabel(t,e,i,a){var s=t.indexOf(e);return-1===s?addIfString(t,e,i,a):s!==t.lastIndexOf(e)?i:s}const validIndex=(t,e)=>null===t?null:_limitValue(Math.round(t),0,e);function _getLabelForValue(t){var e=this.getLabels();return 0<=t&&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 generateTicks$1(t,e){var i=[],{bounds:a,step:s,min:r,max:n,precision:o,count:l,maxTicks:h,maxDigits:d,includeBounds:c}=t,u=s||1,g=h-1,{min:e,max:p}=e,f=!isNullOrUndef(r),m=!isNullOrUndef(n),v=!isNullOrUndef(l),d=(p-e)/(d+1);let x=niceNum((p-e)/g/u)*u,b,_,y,k;if(x<1e-14&&!f&&!m)return[{value:e},{value:p}];(k=Math.ceil(p/x)-Math.floor(e/x))>g&&(x=niceNum(k*x/g/u)*u),isNullOrUndef(o)||(b=Math.pow(10,o),x=Math.ceil(x*b)/b),y="ticks"===a?(_=Math.floor(e/x)*x,Math.ceil(p/x)*x):(_=e,p),f&&m&&s&&almostWhole((n-r)/s,x/1e3)?(k=Math.round(Math.min((n-r)/x,h)),x=(n-r)/k,_=r,y=n):v?(_=f?r:_,y=m?n:y,k=l-1,x=(y-_)/k):(k=(y-_)/x,k=almostEquals(k,Math.round(k),x/1e3)?Math.round(k):Math.ceil(k));g=Math.max(_decimalPlaces(x),_decimalPlaces(_));b=Math.pow(10,isNullOrUndef(o)?g:o),_=Math.round(_*b)/b,y=Math.round(y*b)/b;let S=0;for(f&&(c&&_!==r?(i.push({value:r}),_a=e?a:t,l=t=>s=i?s:t;t&&(n=sign(a),r=sign(s),n<0&&r<0?l(0):0Math.floor(log10(t)),changeExponent=(t,e)=>Math.pow(10,log10Floor(t)+e);function isMajor(t){return 1==t/Math.pow(10,log10Floor(t))}function steps(t,e,i){i=Math.pow(10,i),t=Math.floor(t/i);return Math.ceil(e/i)-t}function startExp(t,e){var i=e-t;let a=log10Floor(i);for(;10r?Math.pow(10,s):0,s=Math.round((e-l)*n)/n,h=Math.floor((e-l)/o/10)*o*10;let d=Math.floor((s-h)/Math.pow(10,r)),c=finiteOrDefault(t.min,Math.round((l+h+d*Math.pow(10,r))*n)/n);for(;ca=e?a:t,r=t=>s=i?s:t;a===s&&(a<=0?(t(1),r(10)):(t(changeExponent(a,-1)),r(changeExponent(s,1)))),a<=0&&t(changeExponent(s,-1)),s<=0&&r(changeExponent(a,1)),this.min=a,this.max=s}buildTicks(){var t=this.options,e=generateTicks({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&_setMinAndMaxByKey(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":formatNumber(t,this.chart.options.locale,this.options.ticks.format)}configure(){var t=this.min;super.configure(),this._startValue=log10(t),this._valueRange=log10(this.max)-log10(t)}getPixelForValue(t){return null===(t=void 0!==t&&0!==t?t:this.min)||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(log10(t)-this._startValue)/this._valueRange)}getValueForPixel(t){t=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+t*this._valueRange)}}function getTickBackdropHeight(t){var e=t.ticks;return e.display&&t.display?(t=toPadding(e.backdropPadding),valueOrDefault(e.font&&e.font.size,defaults.font.size)+t.height):0}function measureLabelSize(t,e,i){return i=isArray(i)?i:[i],{w:_longestText(t,e.string,i),h:i.length*e.lineHeight}}function determineLimits(t,e,i,a,s){return t===a||t===s?{start:e-i/2,end:e+i/2}:te.r&&(n=(a.end-e.r)/r,t.r=Math.max(t.r,e.r+n)),s.starte.b&&(o=(s.end-e.b)/i,t.b=Math.max(t.b,e.b+o))}function createPointLabelItem(t,e,i){var a=t.drawingArea,{extra:i,additionalAngle:s,padding:r,size:n}=i,t=t.getPointPosition(e,a+i+r,s),e=Math.round(toDegrees(_normalizeAngle(t.angle+HALF_PI))),a=yForAngle(t.y,n.h,e),i=getTextAlignForAngle(e),r=leftForTextAlign(t.x,n.w,i);return{visible:!0,x:t.x,y:a,textAlign:i,left:r,top:a,right:r+n.w,bottom:a+n.h}}function isNotOverlapped(t,e){var i,a,s;return!(e&&({left:t,top:i,right:a,bottom:s}=t,_isPointInArea({x:t,y:i},e)||_isPointInArea({x:t,y:s},e)||_isPointInArea({x:a,y:i},e)||_isPointInArea({x:a,y:s},e)))}function buildPointLabelItems(e,i,a){var s=[],r=e._pointLabels.length,t=e.options,{centerPointLabels:n,display:o}=t.pointLabels,l={extra:getTickBackdropHeight(t)/2,additionalAngle:n?PI/r:0};let h;for(let t=0;t0!==t)?(t.beginPath(),addRoundedRectPath(t,{x:l,y:s,w:n,h:i,radius:a}),t.fill()):t.fillRect(l,s,n,i))}function drawPointLabels(e,i){var{ctx:a,options:{pointLabels:s}}=e;for(let t=i-1;0<=t;t--){var r,n,o,l,h=e._pointLabelItems[t];h.visible&&(drawPointLabelBox(a,r=s.setContext(e.getPointLabelContext(t)),h),n=toFont(r.font),{x:h,y:o,textAlign:l}=h,renderText(a,e._pointLabels[t],h,o+n.lineHeight/2,n,{color:r.color,textAlign:l,textBaseline:"middle"}))}}function pathRadiusLine(e,i,t,a){var s=e["ctx"];if(t)s.arc(e.xCenter,e.yCenter,i,0,TAU);else{var r=e.getPointPosition(0,i);s.moveTo(r.x,r.y);for(let t=1;t{t=callback(this.options.pointLabels.callback,[t,e],this);return t||0===t?t:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){var t=this.options;t.display&&t.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,a){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-a)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,a))}getIndexAngle(t){var e=TAU/(this._pointLabels.length||1),i=this.options.startAngle||0;return _normalizeAngle(t*e+toRadians(i))}getDistanceFromCenterForValue(t){var e;return isNullOrUndef(t)?NaN:(e=this.drawingArea/(this.max-this.min),this.options.reverse?(this.max-t)*e:(t-this.min)*e)}getValueForDistanceFromCenter(t){return isNullOrUndef(t)?NaN:(t=t/(this.drawingArea/(this.max-this.min)),this.options.reverse?this.max-t:this.min+t)}getPointLabelContext(t){var e=this._pointLabels||[];if(0<=t&&t{0!==e&&(o=this.getDistanceFromCenterForValue(t.value),t=this.getContext(e),e=a.setContext(t),t=s.setContext(t),drawRadiusLine(this,e,o,r,t))}),i.display){for(t.save(),n=r-1;0<=n;n--){var h=i.setContext(this.getPointLabelContext(n)),{color:d,lineWidth:c}=h;c&&d&&(t.lineWidth=c,t.strokeStyle=d,t.setLineDash(h.borderDash),t.lineDashOffset=h.borderDashOffset,o=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),l=this.getPointPosition(n,o),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const n=this.ctx,o=this.options,l=o.ticks;if(l.display){var t=this.getIndexAngle(0);let s,r;n.save(),n.translate(this.xCenter,this.yCenter),n.rotate(t),n.textAlign="center",n.textBaseline="middle",this.ticks.forEach((t,e)=>{var i,a;0===e&&!o.reverse||(i=l.setContext(this.getContext(e)),a=toFont(i.font),s=this.getDistanceFromCenterForValue(this.ticks[e].value),i.showLabelBackdrop&&(n.font=a.string,r=n.measureText(t.label).width,n.fillStyle=i.backdropColor,e=toPadding(i.backdropPadding),n.fillRect(-r/2-e.left,-s-a.size/2-e.top,r+e.width,a.size+e.height)),renderText(n,t.label,0,-s,a,{color:i.color,strokeColor:i.textStrokeColor,strokeWidth:i.textStrokeWidth}))}),n.restore()}}drawTitle(){}}const INTERVALS={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}},UNITS=Object.keys(INTERVALS);function sorter(t,e){return t-e}function parse(t,e){if(isNullOrUndef(e))return null;var i=t._adapter,{parser:t,round:a,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof t&&(r=t(r)),null===(r=isNumberFinite(r)?r:"string"==typeof t?i.parse(r,t):i.parse(r))?null:+(r=a?"week"!==a||!isNumber(s)&&!0!==s?i.startOf(r,a):i.startOf(r,"isoWeek",s):r)}function determineUnitForAutoTicks(e,i,a,s){var r=UNITS.length;for(let t=UNITS.indexOf(e);t=UNITS.indexOf(a);t--){var n=UNITS[t];if(INTERVALS[n].common&&e._adapter.diff(r,s,n)>=i-1)return n}return UNITS[a?UNITS.indexOf(a):0]}function determineMajorUnit(i){for(let t=UNITS.indexOf(i)+1,e=UNITS.length;t=e?i[a]:i[s]]=!0):t[e]=!0}function setMajorTicks(t,e,i,a){var s=t._adapter,t=+s.startOf(e[0].value,a),r=e[e.length-1].value;let n,o;for(n=t;n<=r;n=+s.add(n,1,a))0<=(o=i[n])&&(e[o].major=!0);return e}function ticksFromTimestamps(t,e,i){var a=[],s={},r=e.length;let n,o;for(n=0;n+t.value))}initOffsets(t=[]){let e=0,i=0;this.options.offset&&t.length&&(a=this.getDecimalForValue(t[0]),e=1===t.length?1-a:(this.getDecimalForValue(t[1])-a)/2,a=this.getDecimalForValue(t[t.length-1]),i=1===t.length?a:(a-this.getDecimalForValue(t[t.length-2]))/2);var a=t.length<3?.5:.25;e=_limitValue(e,0,a),i=_limitValue(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){var t=this._adapter,e=this.min,i=this.max,a=this.options,s=a.time,r=s.unit||determineUnitForAutoTicks(s.minUnit,e,i,this._getLabelCapacity(e)),n=valueOrDefault(a.ticks.stepSize,1),s="week"===r&&s.isoWeekday,o=isNumber(s)||!0===s,l={};let h=e,d,c;if(o&&(h=+t.startOf(h,"isoWeek",s)),h=+t.startOf(h,o?"day":r),t.diff(i,e,r)>1e5*n)throw new Error(e+" and "+i+" are too far apart with stepSize of "+n+" "+r);var u="data"===a.ticks.source&&this.getDataTimestamps();for(d=h,c=0;d+t)}getLabelForValue(t){var e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){var i=this.options.time.displayFormats,a=this._unit,e=e||i[a];return this._adapter.format(t,e)}_tickFormatFunction(t,e,i,a){var s,r=this.options,n=r.ticks.callback;return n?callback(n,[t,e,i],this):(n=r.time.displayFormats,r=this._unit,s=this._majorUnit,r=r&&n[r],n=s&&n[s],i=i[e],e=s&&n&&i&&i.major,this._adapter.format(t,a||(e?n:r)))}generateTickLabels(t){let e,i,a;for(e=0,i=t.length;e=t[a].pos&&e<=t[s].pos&&({lo:a,hi:s}=_lookupByKey(t,"pos",e)),{pos:r,time:o}=t[a],{pos:n,time:l}=t[s]):(e>=t[a].time&&e<=t[s].time&&({lo:a,hi:s}=_lookupByKey(t,"time",e)),{time:r,pos:o}=t[a],{time:n,pos:l}=t[s]);i=n-r;return i?o+(l-o)*(e-r)/i:o}class TimeSeriesScale extends TimeScale{static id="timeseries";static defaults=TimeScale.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){var t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=interpolate(e,this.min),this._tableRange=interpolate(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){var{min:e,max:i}=this,a=[],s=[];let r,n,o,l,h;for(r=0,n=t.length;r=e&&l<=i&&a.push(l);if(a.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,n=a.length;rt-e)}_getTimestampsForTable(){let t=this._cache.all||[];var e,i;return t.length||(e=this.getDataTimestamps(),i=this.getLabelTimestamps(),t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t),t}getDecimalForValue(t){return(interpolate(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){var e=this._offsets,t=this.getDecimalForPixel(t)/e.factor-e.end;return interpolate(this._table,t*this._tableRange+this._minPos,!0)}}var scales=Object.freeze({__proto__:null,CategoryScale:CategoryScale,LinearScale:LinearScale,LogarithmicScale:LogarithmicScale,RadialLinearScale:RadialLinearScale,TimeScale:TimeScale,TimeSeriesScale:TimeSeriesScale});const registerables=[controllers,elements,plugins,scales];export{Animation,Animations,ArcElement,BarController,BarElement,BasePlatform,BasicPlatform,BubbleController,CategoryScale,Chart,plugin_colors as Colors,DatasetController,plugin_decimation as Decimation,DomPlatform,DoughnutController,Element,index as Filler,Interaction,plugin_legend as Legend,LineController,LineElement,LinearScale,LogarithmicScale,PieController,PointElement,PolarAreaController,RadarController,RadialLinearScale,Scale,ScatterController,plugin_subtitle as SubTitle,Ticks,TimeScale,TimeSeriesScale,plugin_title as Title,plugin_tooltip as Tooltip,adapters as _adapters,_detectPlatform,animator,controllers,defaults,elements,layouts,plugins,registerables,registry,scales}; \ No newline at end of file