From 7afee86d63e37dcfc52457b65e2acbd91429dee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Senart?= Date: Wed, 4 Jan 2023 09:49:04 +0100 Subject: [PATCH] [#29] [Bug] Showing 1% increase ratio instead of 100% expected --- CHANGELOG.md | 8 ++++++++ dist/gazpar-card.js | 8 ++++---- package.json | 2 +- src/gazpar-card.js | 2 +- tests/attributes.json | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e368ae..7d65e1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.10] - 2023-01-04 + +## Changed +[#30](https://github.com/ssenart/lovelace-gazpar-card/issues/30): [Change] Gazpar icon has been resized. + +### Fixed +[#29](https://github.com/ssenart/lovelace-gazpar-card/issues/29): [Bug] Showing 1% increase ratio instead of 100% expected. + ## [1.3.9] - 2022-12-16 ## Changed diff --git a/dist/gazpar-card.js b/dist/gazpar-card.js index 70f16c1..921bd43 100644 --- a/dist/gazpar-card.js +++ b/dist/gazpar-card.js @@ -1,5 +1,5 @@ /*! For license information please see gazpar-card.js.LICENSE.txt */ -(()=>{var t={790:function(t){t.exports=function(){"use strict";function t(){}const e=function(){let t=0;return function(){return t++}}();function i(t){return null==t}function s(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function n(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const o=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function r(t,e){return o(t)?t:e}function a(t,e){return void 0===t?e:t}const h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:t/e,l=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function c(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function d(t,e,i,o){let r,a,h;if(s(t))if(a=t.length,o)for(r=a-1;r>=0;r--)e.call(i,t[r],r);else for(r=0;rt,x:t=>t.x,y:t=>t.y};function x(t,e){const i=b[e]||(b[e]=function(t){const e=_(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function _(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function v(t){return t.charAt(0).toUpperCase()+t.slice(1)}const w=t=>void 0!==t,C=t=>"function"==typeof t,k=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function M(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const D=Math.PI,E=2*D,S=E+D,P=Number.POSITIVE_INFINITY,I=D/180,O=D/2,B=D/4,R=2*D/3,T=Math.log10,L=Math.sign;function H(t){const e=Math.round(t);t=F(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(T(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function z(t){const e=[],i=Math.sqrt(t);let s;for(s=1;st-e)).pop(),e}function Q(t){return!isNaN(parseFloat(t))&&isFinite(t)}function F(t,e,i){return Math.abs(t-e)=t}function W(t,e,i){let s,n,o;for(s=0,n=t.length;sh&&l=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function tt(t,e,i){i=i||(i=>t[i]1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const et=(t,e,i,s)=>tt(t,i,s?s=>t[s][e]<=i:s=>t[s][e]tt(t,i,(s=>t[s][e]>=i));function st(t,e,i){let s=0,n=t.length;for(;ss&&t[n-1]>i;)n--;return s>0||n{const i="_onData"+v(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function rt(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(nt.forEach((e=>{delete t[e]})),delete t._chartjs)}function at(t){const e=new Set;let i,s;for(i=0,s=t.length;iArray.prototype.slice.call(t));let n=!1,o=[];return function(...i){o=s(i),n||(n=!0,ht.call(window,(()=>{n=!1,t.apply(e,o)})))}}function ct(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const dt=t=>"start"===t?"left":"end"===t?"right":"center",ut=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,gt=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;function ft(t,e,i){const s=e.length;let n=0,o=s;if(t._sorted){const{iScale:r,_parsed:a}=t,h=r.axis,{min:l,max:c,minDefined:d,maxDefined:u}=r.getUserBounds();d&&(n=K(Math.min(et(a,r.axis,l).lo,i?s:et(e,h,r.getPixelForValue(l)).lo),0,s-1)),o=u?K(Math.max(et(a,r.axis,c,!0).hi+1,i?0:et(e,h,r.getPixelForValue(c),!0).hi+1),n,s)-n:s-n}return{start:n,count:o}}function pt(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}var mt=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=ht.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,r=n.length-1,a=!1;for(;r>=0;--r)o=n[r],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),a=!0):(n[r]=n[n.length-1],n.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};function At(t){return t+.5|0}const yt=(t,e,i)=>Math.max(Math.min(t,i),e);function bt(t){return yt(At(2.55*t),0,255)}function xt(t){return yt(At(255*t),0,255)}function _t(t){return yt(At(t/2.55)/100,0,1)}function vt(t){return yt(At(100*t),0,100)}const wt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Ct=[..."0123456789ABCDEF"],kt=t=>Ct[15&t],Mt=t=>Ct[(240&t)>>4]+Ct[15&t],Dt=t=>(240&t)>>4==(15&t);const Et=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function St(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Pt(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function It(t,e,i){const s=St(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function Ot(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),r=(n+o)/2;let a,h,l;return n!==o&&(l=n-o,h=r>.5?l/(2-n-o):l/(n+o),a=function(t,e,i,s,n){return t===n?(e-i)/s+(et<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,$t=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Wt(t,e,i){if(t){let s=Ot(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=Rt(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function Nt(t,e){return t?Object.assign(e||{},t):t}function Vt(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=xt(t[3]))):(e=Nt(t,{r:0,g:0,b:0,a:1})).a=xt(e.a),e}function jt(t){return"r"===t.charAt(0)?function(t){const e=Qt.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?bt(t):yt(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?bt(i):yt(i,0,255)),s=255&(e[4]?bt(s):yt(s,0,255)),n=255&(e[6]?bt(n):yt(n,0,255)),{r:i,g:s,b:n,a:o}}}(t):function(t){const e=Et.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?bt(+e[5]):xt(+e[5]));const n=Tt(+e[2]),o=+e[3]/100,r=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Bt(It,t,e,i)}(n,o,r):"hsv"===e[1]?function(t,e,i){return Bt(Pt,t,e,i)}(n,o,r):Rt(n,o,r),{r:i[0],g:i[1],b:i[2],a:s}}(t)}class Gt{constructor(t){if(t instanceof Gt)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=Vt(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*wt[s[1]],g:255&17*wt[s[2]],b:255&17*wt[s[3]],a:5===o?17*wt[s[4]]:255}:7!==o&&9!==o||(n={r:wt[s[1]]<<4|wt[s[2]],g:wt[s[3]]<<4|wt[s[4]],b:wt[s[5]]<<4|wt[s[6]],a:9===o?wt[s[7]]<<4|wt[s[8]]:255})),i=n||function(t){zt||(zt=function(){const t={},e=Object.keys(Ht),i=Object.keys(Lt);let s,n,o,r,a;for(s=0;s>16&255,o>>8&255,255&o]}return t}(),zt.transparent=[0,0,0,0]);const e=zt[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||jt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Nt(this._rgb);return t&&(t.a=_t(t.a)),t}set rgb(t){this._rgb=Vt(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${_t(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?function(t){var e=(t=>Dt(t.r)&&Dt(t.g)&&Dt(t.b)&&Dt(t.a))(t)?kt:Mt;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=Ot(t),i=e[0],s=vt(e[1]),n=vt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${_t(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,r=2*o-1,a=i.a-s.a,h=((r*a==-1?r:(r+a)/(1+r*a))+1)/2;n=1-h,i.r=255&h*i.r+n*s.r+.5,i.g=255&h*i.g+n*s.g+.5,i.b=255&h*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=$t(_t(t.r)),n=$t(_t(t.g)),o=$t(_t(t.b));return{r:xt(Ft(s+i*($t(_t(e.r))-s))),g:xt(Ft(n+i*($t(_t(e.g))-n))),b:xt(Ft(o+i*($t(_t(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Gt(this.rgb)}alpha(t){return this._rgb.a=xt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=At(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Wt(this._rgb,2,t),this}darken(t){return Wt(this._rgb,2,-t),this}saturate(t){return Wt(this._rgb,1,t),this}desaturate(t){return Wt(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Ot(t);i[0]=Tt(i[0]+e),i=Rt(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Ut(t){return new Gt(t)}function Yt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Xt(t){return Yt(t)?t:Ut(t)}function Jt(t){return Yt(t)?t:Ut(t).saturate(.5).darken(.1).hexString()}const Kt=Object.create(null),Zt=Object.create(null);function qt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;et.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>Jt(e.backgroundColor),this.hoverBorderColor=(t,e)=>Jt(e.borderColor),this.hoverColor=(t,e)=>Jt(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return te(this,t,e)}get(t){return qt(this,t)}describe(t,e){return te(Zt,t,e)}override(t,e){return te(Kt,t,e)}route(t,e,i,s){const o=qt(this,t),r=qt(this,i),h="_"+e;Object.defineProperties(o,{[h]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[h],e=r[s];return n(t)?Object.assign({},e,t):a(t,e)},set(t){this[h]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function ie(){return"undefined"!=typeof window&&"undefined"!=typeof document}function se(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function ne(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const oe=t=>window.getComputedStyle(t,null);function re(t,e){return oe(t).getPropertyValue(e)}const ae=["top","right","bottom","left"];function he(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=ae[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function le(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=oe(i),o="border-box"===n.boxSizing,r=he(n,"padding"),a=he(n,"border","width"),{x:h,y:l,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let r,a,h=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(n,o,t.target))r=n,a=o;else{const t=e.getBoundingClientRect();r=s.clientX-t.left,a=s.clientY-t.top,h=!0}return{x:r,y:a,box:h}}(t,i),d=r.left+(c&&a.left),u=r.top+(c&&a.top);let{width:g,height:f}=e;return o&&(g-=r.width+a.width,f-=r.height+a.height),{x:Math.round((h-d)/g*i.width/s),y:Math.round((l-u)/f*i.height/s)}}const ce=t=>Math.round(10*t)/10;function de(t,e,i,s){const n=oe(t),o=he(n,"margin"),r=ne(n.maxWidth,t,"clientWidth")||P,a=ne(n.maxHeight,t,"clientHeight")||P,h=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=se(t);if(o){const t=o.getBoundingClientRect(),r=oe(o),a=he(r,"border","width"),h=he(r,"padding");e=t.width-h.width-a.width,i=t.height-h.height-a.height,s=ne(r.maxWidth,o,"clientWidth"),n=ne(r.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||P,maxHeight:n||P}}(t,e,i);let{width:l,height:c}=h;if("content-box"===n.boxSizing){const t=he(n,"border","width"),e=he(n,"padding");l-=e.width+t.width,c-=e.height+t.height}return l=Math.max(0,l-o.width),c=Math.max(0,s?Math.floor(l/s):c-o.height),l=ce(Math.min(l,r,h.maxWidth)),c=ce(Math.min(c,a,h.maxHeight)),l&&!c&&(c=ce(l/2)),{width:l,height:c}}function ue(t,e,i){const s=e||1,n=Math.floor(t.height*s),o=Math.floor(t.width*s);t.height=n/s,t.width=o/s;const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||r.height!==n||r.width!==o)&&(t.currentDevicePixelRatio=s,r.height=n,r.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const ge=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function fe(t,e){const i=re(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function pe(t){return!t||i(t.size)||i(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function me(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function Ae(t,e,i,n){let o=(n=n||{}).data=n.data||{},r=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},r=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let a=0;const h=i.length;let l,c,d,u,g;for(l=0;li.length){for(l=0;l0&&t.stroke()}}function ve(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.xe.top-i&&t.y0&&""!==a.strokeColor;let c,d;for(t.save(),t.font=r.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),i(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,a),c=0;ct[0])){w(s)||(s=$e("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:n,override:n=>Pe([n,...t],e,i,s)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>Te(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=$e(Be(o,t),i),w(n))return Re(t,n)?Qe(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>We(t).includes(e),ownKeys:t=>We(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function Ie(t,e,i,o){const r={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Oe(t,o),setContext:e=>Ie(t,e,i,o),override:s=>Ie(t.override(s),e,i,o)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Te(t,e,(()=>function(t,e,i){const{_proxy:o,_context:r,_subProxy:a,_descriptors:h}=t;let l=o[e];return C(l)&&h.isScriptable(e)&&(l=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);return a.add(t),e=e(o,r||s),a.delete(t),Re(t,e)&&(e=Qe(n._scopes,n,t,e)),e}(e,l,t,i)),s(l)&&l.length&&(l=function(t,e,i,s){const{_proxy:o,_context:r,_subProxy:a,_descriptors:h}=i;if(w(r.index)&&s(t))e=e[r.index%e.length];else if(n(e[0])){const i=e,s=o._scopes.filter((t=>t!==i));e=[];for(const n of i){const i=Qe(s,o,t,n);e.push(Ie(i,r,a&&a[t],h))}}return e}(e,l,t,h.isIndexable)),Re(e,l)&&(l=Ie(l,r,a&&a[e],h)),l}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Oe(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:C(i)?i:()=>i,isIndexable:C(s)?s:()=>s}}const Be=(t,e)=>t?t+v(e):e,Re=(t,e)=>n(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Te(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const s=i();return t[e]=s,s}function Le(t,e,i){return C(t)?t(e,i):t}const He=(t,e)=>!0===t?e:"string"==typeof t?x(e,t):void 0;function ze(t,e,i,s,n){for(const o of e){const e=He(i,o);if(e){t.add(e);const o=Le(e._fallback,i,n);if(w(o)&&o!==i&&o!==s)return o}else if(!1===e&&w(s)&&i!==s)return null}return!1}function Qe(t,e,i,o){const r=e._rootScopes,a=Le(e._fallback,i,o),h=[...t,...r],l=new Set;l.add(o);let c=Fe(l,h,i,a||i,o);return null!==c&&(!w(a)||a===i||(c=Fe(l,h,a,c,o),null!==c))&&Pe(Array.from(l),[""],r,a,(()=>function(t,e,i){const o=t._getTarget();e in o||(o[e]={});const r=o[e];return s(r)&&n(i)?i:r}(e,i,o)))}function Fe(t,e,i,s,n){for(;i;)i=ze(t,e,i,s,n);return i}function $e(t,e){for(const i of e){if(!i)continue;const e=i[t];if(w(e))return e}}function We(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function Ne(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,r=new Array(s);let a,h,l,c;for(a=0,h=s;ae"x"===t?"y":"x";function Ue(t,e,i,s){const n=t.skip?e:t,o=e,r=i.skip?e:i,a=U(o,n),h=U(r,o);let l=a/(a+h),c=h/(a+h);l=isNaN(l)?0:l,c=isNaN(c)?0:c;const d=s*l,u=s*c;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+u*(r.x-n.x),y:o.y+u*(r.y-n.y)}}}function Ye(t,e="x"){const i=Ge(e),s=t.length,n=Array(s).fill(0),o=Array(s);let r,a,h,l=je(t,0);for(r=0;r!t.skip))),"monotone"===e.cubicInterpolationMode)Ye(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,r=t.length;o0===t||1===t,Ze=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*E/i),qe=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*E/i)+1,ti={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*O),easeOutSine:t=>Math.sin(t*O),easeInOutSine:t=>-.5*(Math.cos(D*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>Ke(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Ke(t)?t:Ze(t,.075,.3),easeOutElastic:t=>Ke(t)?t:qe(t,.075,.3),easeInOutElastic(t){const e=.1125;return Ke(t)?t:t<.5?.5*Ze(2*t,e,.45):.5+.5*qe(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-ti.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*ti.easeInBounce(2*t):.5*ti.easeOutBounce(2*t-1)+.5};function ei(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function ii(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function si(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},r=ei(t,n,i),a=ei(n,o,i),h=ei(o,e,i),l=ei(r,a,i),c=ei(a,h,i);return ei(l,c,i)}const ni=new Map;function oi(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=ni.get(i);return s||(s=new Intl.NumberFormat(t,e),ni.set(i,s)),s}(e,i).format(t)}const ri=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),ai=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function hi(t,e){const i=(""+t).match(ri);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function li(t,e){const i={},s=n(e),o=s?Object.keys(e):e,r=n(t)?s?i=>a(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=+r(t)||0;return i}function ci(t){return li(t,{top:"y",right:"x",bottom:"y",left:"x"})}function di(t){return li(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ui(t){const e=ci(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function gi(t,e){t=t||{},e=e||ee.font;let i=a(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=a(t.style,e.style);s&&!(""+s).match(ai)&&(console.warn('Invalid font style specified: "'+s+'"'),s="");const n={family:a(t.family,e.family),lineHeight:hi(a(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:a(t.weight,e.weight),string:""};return n.string=pe(n),n}function fi(t,e,i,n){let o,r,a,h=!0;for(o=0,r=t.length;oi&&0===t?0:t+e;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function mi(t,e){return Object.assign(Object.create(t),e)}function Ai(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function yi(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function bi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function xi(t){return"angle"===t?{between:J,compare:Y,normalize:X}:{between:q,compare:(t,e)=>t-e,normalize:t=>t}}function _i({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function vi(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,r=e.length,{compare:a,between:h,normalize:l}=xi(s),{start:c,end:d,loop:u,style:g}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:r,normalize:a}=xi(s),h=e.length;let l,c,{start:d,end:u,loop:g}=t;if(g){for(d+=h,u+=h,l=0,c=h;ln&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);return function(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const n=t._chart.getContext(),o=ki(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,h=i.length,l=[];let c=o,d=e[0].start,u=d;function g(t,e,s,n){const o=a?-1:1;if(t!==e){for(t+=h;i[t%h].skip;)t-=o;for(;i[e%h].skip;)e+=o;t%h!=e%h&&(l.push({start:t%h,end:e%h,loop:s,style:n}),c=n,d=e%h)}}for(const t of e){d=a?d:t.start;let e,o=i[d%h];for(u=d+1;u<=t.end;u++){const a=i[u%h];e=ki(s.setContext(mi(n,{type:"segment",p0:o,p1:a,p0DataIndex:(u-1)%h,p1DataIndex:u%h,datasetIndex:r}))),Mi(e,c)&&g(d,u-1,t.loop,c),o=a,c=e}d{t[r](e[i],n)&&(o.push({element:t,datasetIndex:s,index:h}),a=a||t.inRange(e.x,e.y,n))})),s&&!a?[]:o}var Bi={evaluateInteractionItems:Si,modes:{index(t,e,i,s){const n=le(e,t),o=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?Pi(t,n,o,s,r):Ii(t,n,o,!1,s,r),h=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&h.push({element:i,datasetIndex:t.index,index:e})})),h):[]},dataset(t,e,i,s){const n=le(e,t),o=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?Pi(t,n,o,s,r):Ii(t,n,o,!1,s,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;tPi(t,le(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=le(e,t),o=i.axis||"xy",r=i.includeInvisible||!1;return Ii(t,n,o,i.intersect,s,r)},x:(t,e,i,s)=>Oi(t,le(e,t),"x",i.intersect,s),y:(t,e,i,s)=>Oi(t,le(e,t),"y",i.intersect,s)}};const Ri=["left","top","right","bottom"];function Ti(t,e){return t.filter((t=>t.pos===e))}function Li(t,e){return t.filter((t=>-1===Ri.indexOf(t.pos)&&t.box.axis===e))}function Hi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function zi(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function Qi(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 Fi(t,e,i,s){const{pos:o,box:r}=i,a=t.maxPadding;if(!n(o)){i.size&&(t[o]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?r.height:r.width),i.size=e.size/e.count,t[o]+=i.size}r.getPadding&&Qi(a,r.getPadding());const h=Math.max(0,e.outerWidth-zi(a,t,"left","right")),l=Math.max(0,e.outerHeight-zi(a,t,"top","bottom")),c=h!==t.w,d=l!==t.h;return t.w=h,t.h=l,i.horizontal?{same:c,other:d}:{same:d,other:c}}function $i(t,e){const i=e.maxPadding;return function(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}(t?["left","right"]:["top","bottom"])}function Wi(t,e,i,s){const n=[];let o,r,a,h,l,c;for(o=0,r=t.length,l=0;ot.box.fullSize)),!0),s=Hi(Ti(e,"left"),!0),n=Hi(Ti(e,"right")),o=Hi(Ti(e,"top"),!0),r=Hi(Ti(e,"bottom")),a=Li(e,"x"),h=Li(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(h).concat(r).concat(a),chartArea:Ti(e,"chartArea"),vertical:s.concat(n).concat(h),horizontal:o.concat(r).concat(a)}}(t.boxes),h=a.vertical,l=a.horizontal;d(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=h.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/c,hBoxMaxHeight:r/2}),g=Object.assign({},n);Qi(g,ui(s));const f=Object.assign({maxPadding:g,w:o,h:r,x:n.left,y:n.top},n),p=function(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Ri.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,r,a;for(o=0,r=t.length;o{const i=e.box;Object.assign(i,t.chartArea),i.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})}))}};class Gi{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Ui extends Gi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Yi={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Xi=t=>null===t||""===t,Ji=!!ge&&{passive:!0};function Ki(t,e,i){t.canvas.removeEventListener(e,i,Ji)}function Zi(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function qi(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Zi(i.addedNodes,s),e=e&&!Zi(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function ts(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Zi(i.removedNodes,s),e=e&&!Zi(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const es=new Map;let is=0;function ss(){const t=window.devicePixelRatio;t!==is&&(is=t,es.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ns(t,e,i){const s=t.canvas,n=s&&se(s);if(!n)return;const o=lt(((t,e)=>{const s=n.clientWidth;i(t,e),s{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)}));return r.observe(n),function(t,e){es.size||window.addEventListener("resize",ss),es.set(t,e)}(t,o),r}function os(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){es.delete(t),es.size||window.removeEventListener("resize",ss)}(t)}function rs(t,e,i){const s=t.canvas,n=lt((e=>{null!==t.ctx&&i(function(t,e){const i=Yi[t.type]||t.type,{x:s,y:n}=le(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,Ji)}(s,e,n),n}class as extends Gi{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t.$chartjs={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Xi(n)){const e=fe(t,"width");void 0!==e&&(t.width=e)}if(Xi(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=fe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const s=e.$chartjs.initial;["height","width"].forEach((t=>{const n=s[t];i(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=s.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:qi,detach:ts,resize:ns}[e]||rs;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];s&&(({attach:os,detach:os,resize:os}[e]||Ki)(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return de(t,e,i,s)}isAttached(t){const e=se(t);return!(!e||!e.isConnected)}}function hs(t){return!ie()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Ui:as}var ls=Object.freeze({__proto__:null,_detectPlatform:hs,BasePlatform:Gi,BasicPlatform:Ui,DomPlatform:as});const cs="transparent",ds={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Xt(t||cs),n=s.valid&&Xt(e||cs);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class us{constructor(t,e,i,s){const n=e[i];s=fi([t.to,s,n,t.from]);const o=fi([t.from,n,s]);this._active=!0,this._fn=t.fn||ds[t.type||typeof o],this._easing=ti[t.easing]||ti.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=fi([t.to,e,s,t.from]),this._from=fi([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,r=this._to;let a;if(this._active=n!==r&&(o||e1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(n,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),ee.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),ee.describe("animations",{_fallback:"animation"}),ee.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}});class fs{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!n(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((i=>{const o=t[i];if(!n(o))return;const r={};for(const t of gs)r[t]=o[t];(s(o.properties)&&o.properties||[i]).forEach((t=>{t!==i&&e.has(t)||e.set(t,r)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(i)return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i;t.options=e}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const h=o[a];if("$"===h.charAt(0))continue;if("options"===h){s.push(...this._animateOptions(t,e));continue}const l=e[h];let c=n[h];const d=i.get(h);if(c){if(d&&c.active()){c.update(d,l,r);continue}c.cancel()}d&&d.duration?(n[h]=c=new us(d,t,h,l),s.push(c)):t[h]=l}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(mt.add(this._chart,i),!0):void 0}}function ps(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function ms(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n0||!i&&e<0)return n.index}return null}function _s(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:r,index:a}=s,h=o.axis,l=r.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,r,s),d=e.length;let u;for(let t=0;ti[t].axis===e)).shift()}function ws(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i]}}}const Cs=t=>"reset"===t||"none"===t,ks=(t,e)=>e?t:Object.assign({},t);class Ms{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.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=ys(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&ws(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=a(i.xAxisID,vs(t,"x")),o=e.yAxisID=a(i.yAxisID,vs(t,"y")),r=e.rAxisID=a(i.rAxisID,vs(t,"r")),h=e.indexAxis,l=e.iAxisID=s(h,n,o,r),c=e.vAxisID=s(h,o,n,r);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&rt(this._data,this),t._stacked&&ws(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(n(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,n,o;for(s=0,n=e.length;s0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=o,i._sorted=!0,d=o;else{d=s(o[t])?this.parseArrayData(i,o,t,e):n(o[t])?this.parseObjectData(i,o,t,e):this.parsePrimitiveData(i,o,t,e);const r=()=>null===c[h]||g&&c[h]t&&!e.hidden&&e._stacked&&{keys:ms(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(a);let u,g;function f(){g=s[u];const e=g[a.axis];return!o(g[t.axis])||c>e||d=0;--u)if(!f()){this.updateRangeFromParsed(l,t,g,h);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,r;for(s=0,n=e.length;s=0&&tthis.getContext(i,s)),c);return g.$shared&&(g.$shared=a,n[o]=Object.freeze(ks(g,a))),g}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,r=n[o];if(r)return r;let a;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);a=s.createResolver(o,this.getContext(t,i,e))}const h=new fs(s,a&&a.animations);return a&&a._cacheable&&(n[o]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Cs(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){Cs(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Cs(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n{for(t.length+=e,r=t.length-1;r>=o;r--)t[r]=t[r-e]};for(a(n),r=t;r{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}Ds.defaults={},Ds.defaultRoutes=void 0;const Es={values:t=>s(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t)),i}(t,i)}const r=T(Math.abs(o)),a=Math.max(Math.min(-1*Math.floor(r),20),0),h={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(h,this.options.ticks.format),oi(t,s,h)},logarithmic(t,e,i){if(0===t)return"0";const s=t/Math.pow(10,Math.floor(T(t)));return 1===s||2===s||5===s?Es.numeric.call(this,t,e,i):""}};var Ss={formatters:Es};function Ps(t,e){const s=t.options.ticks,n=s.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),o=s.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;in)return function(t,e,i,s){let n,o=0,r=i[0];for(s=Math.ceil(s),n=0;nn)return e}return Math.max(n,1)}(o,e,n);if(r>0){let t,s;const n=r>1?Math.round((h-a)/(r-1)):null;for(Is(e,l,c,i(n)?0:a-n,a),t=0,s=r-1;te.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ss.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),ee.route("scale.ticks","color","","color"),ee.route("scale.grid","color","","borderColor"),ee.route("scale.grid","borderColor","","borderColor"),ee.route("scale.title","color","","color"),ee.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),ee.describe("scales",{_fallback:"scale"}),ee.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const Os=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Bs(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;or+a)))return l}function Ts(t){return t.drawTicks?t.tickLength:0}function Ls(t,e){if(!t.display)return 0;const i=gi(t.font,e),n=ui(t.padding);return(s(t.text)?t.text.length:1)*i.lineHeight+n.height}function Hs(t,e,i){let s=dt(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class zs extends Ds{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=r(t,Number.POSITIVE_INFINITY),e=r(e,Number.NEGATIVE_INFINITY),i=r(i,Number.POSITIVE_INFINITY),s=r(s,Number.NEGATIVE_INFINITY),{min:r(t,i),max:r(e,s),minDefined:o(t),maxDefined:o(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,h=a.length;rs?s:i,s=n&&i>s?i:s,{min:r(i,r(s,i)),max:r(s,r(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){c(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,r=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=pi(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const l=this._getLabelSizes(),c=l.widest.width,d=l.highest.height,u=K(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),r=this.maxHeight-Ts(t.grid)-e.padding-Ls(t.title,this.chart.options.font),a=Math.sqrt(c*c+d*d),h=V(Math.min(Math.asin(K((l.highest.height+6)/o,-1,1)),Math.asin(K(r/a,-1,1))-Math.asin(K(d/a,-1,1)))),h=Math.max(s,Math.min(n,h))),this.labelRotation=h}afterCalculateLabelRotation(){c(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){c(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),r=this.isHorizontal();if(o){const o=Ls(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=Ts(n)+o):(t.height=this.maxHeight,t.width=Ts(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),a=2*i.padding,h=N(this.labelRotation),l=Math.cos(h),c=Math.sin(h);if(r){const e=i.mirror?0:c*n.width+l*o.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:l*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,s,c,l)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:r}=this.options,a=0!==this.labelRotation,h="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;a?h?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-r+o)*this.width/(this.width-r),0),this.paddingRight=Math.max((d-l+o)*this.width/(this.width-l),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){c(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,s;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,s=t.length;e{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n({width:r[t]||0,height:a[t]||0});return{first:C(0),last:C(e-1),widest:C(v),highest:C(w),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Z(this._alignToPixels?ye(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&tr*s?r/i:a/s:a*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:o,position:r}=s,h=o.offset,l=this.isHorizontal(),c=this.ticks.length+(h?1:0),d=Ts(o),u=[],g=o.setContext(this.getContext()),f=g.drawBorder?g.borderWidth:0,p=f/2,m=function(t){return ye(i,t,f)};let A,y,b,x,_,v,w,C,k,M,D,E;if("top"===r)A=m(this.bottom),v=this.bottom-d,C=A-p,M=m(t.top)+p,E=t.bottom;else if("bottom"===r)A=m(this.top),M=t.top,E=m(t.bottom)-p,v=A+p,C=this.top+d;else if("left"===r)A=m(this.right),_=this.right-d,w=A-p,k=m(t.left)+p,D=t.right;else if("right"===r)A=m(this.left),k=t.left,D=m(t.right)-p,_=A+p,w=this.left+d;else if("x"===e){if("center"===r)A=m((t.top+t.bottom)/2+.5);else if(n(r)){const t=Object.keys(r)[0],e=r[t];A=m(this.chart.scales[t].getPixelForValue(e))}M=t.top,E=t.bottom,v=A+p,C=v+d}else if("y"===e){if("center"===r)A=m((t.left+t.right)/2);else if(n(r)){const t=Object.keys(r)[0],e=r[t];A=m(this.chart.scales[t].getPixelForValue(e))}_=A-p,w=_-d,k=t.left,D=t.right}const S=a(s.ticks.maxTicksLimit,c),P=Math.max(1,Math.ceil(c/S));for(y=0;ye.value===t));return i>=0?e.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const r=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),r=e[i].split("."),a=r.pop(),h=r.join(".");ee.route(o,n,h,a)}))}(e,t.defaultRoutes),t.descriptors&&ee.describe(e,t.descriptors)}(t,o,i),this.override&&ee.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ee[s]&&(delete ee[s][i],this.override&&delete Kt[i])}}var Fs=new class{constructor(){this.controllers=new Qs(Ms,"datasets",!0),this.elements=new Qs(Ds,"elements"),this.plugins=new Qs(Object,"plugins"),this.scales=new Qs(zs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):d(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=v(t);c(i["before"+s],[],i),e[t](i),c(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;et.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Ws(t,e){return e||!1!==t?!0===t?{}:t:null}function Ns(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),r=t.getOptionScopes(s,o);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Vs(t,e){const i=ee.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function js(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function Gs(t){const e=t.options||(t.options={});e.plugins=a(e.plugins,{}),e.scales=function(t,e){const i=Kt[t.type]||{scales:{}},s=e.scales||{},o=Vs(t.type,e),r=Object.create(null),a=Object.create(null);return Object.keys(s).forEach((t=>{const e=s[t];if(!n(e))return console.error(`Invalid scale configuration for scale: ${t}`);if(e._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const h=js(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(h,o),c=i.scales||{};r[h]=r[h]||t,a[t]=A(Object.create(null),[{axis:h},e,c[h],c[l]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||Vs(n,e),h=(Kt[n]||{}).scales||{};Object.keys(h).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,o),n=i[e+"AxisID"]||r[e]||e;a[n]=a[n]||Object.create(null),A(a[n],[{axis:e},s[n],h[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];A(e,[ee.scales[e.type],ee.scale])})),a}(t,e)}function Us(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Ys=new Map,Xs=new Set;function Js(t,e){let i=Ys.get(t);return i||(i=e(),Ys.set(t,i),Xs.add(i)),i}const Ks=(t,e,i)=>{const s=x(e,i);void 0!==s&&t.add(s)};class Zs{constructor(t){this._config=function(t){return(t=t||{}).data=Us(t.data),Gs(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Us(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Gs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Js(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Js(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Js(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Js(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),r=o.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>Ks(a,t,e)))),e.forEach((t=>Ks(a,s,t))),e.forEach((t=>Ks(a,Kt[n]||{},t))),e.forEach((t=>Ks(a,ee,t))),e.forEach((t=>Ks(a,Zt,t)))}));const h=Array.from(a);return 0===h.length&&h.push(Object.create(null)),Xs.has(e)&&o.set(e,h),h}chartOptionScopes(){const{options:t,type:e}=this;return[t,Kt[e]||{},ee.datasets[e]||{},{type:e},ee,Zt]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=qs(this._resolverCache,t,n);let h=r;(function(t,e){const{isScriptable:i,isIndexable:n}=Oe(t);for(const o of e){const e=i(o),r=n(o),a=(r||e)&&t[o];if(e&&(C(a)||tn(a))||r&&s(a))return!0}return!1})(r,e)&&(o.$shared=!1,h=Ie(r,i=C(i)?i():i,this.createResolver(t,i,a)));for(const t of e)o[t]=h[t];return o}createResolver(t,e,i=[""],s){const{resolver:o}=qs(this._resolverCache,t,i);return n(e)?Ie(o,e,void 0,s):o}}function qs(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);return o||(o={resolver:Pe(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)),o}const tn=t=>n(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||C(t[i])),!1),en=["top","bottom","left","right","chartArea"];function sn(t,e){return"top"===t||"bottom"===t||-1===en.indexOf(t)&&"x"===e}function nn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function on(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),c(i&&i.onComplete,[t],e)}function rn(t){const e=t.chart,i=e.options.animation;c(i&&i.onProgress,[t],e)}function an(t){return ie()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const hn={},ln=t=>{const e=an(t);return Object.values(hn).filter((t=>t.canvas===e)).pop()};function cn(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class dn{constructor(t,i){const s=this.config=new Zs(i),n=an(t),o=ln(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||hs(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),h=a&&a.canvas,l=h&&h.height,c=h&&h.width;this.id=e(),this.ctx=a,this.canvas=h,this.width=c,this.height=l,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new $s,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ct((t=>this.update(t)),r.resizeDelay||0),this._dataChanges=[],hn[this.id]=this,a&&h?(mt.listen(this,"complete",on),mt.listen(this,"progress",rn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return i(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ue(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return be(this.canvas,this.ctx),this}stop(){return mt.stop(this),this}resize(t,e){mt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ue(this,r,!0)&&(this.notifyPlugins("resize",{size:o}),c(i.onResize,[this,o],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){d(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=js(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),d(n,(e=>{const n=e.options,o=n.id,r=js(o,n),h=a(n.type,e.dtype);void 0!==n.position&&sn(n.position,r)===sn(e.dposition)||(n.position=e.dposition),s[o]=!0;let l=null;o in i&&i[o].type===h?l=i[o]:(l=new(Fs.getScale(h))({id:o,type:h,ctx:this.ctx,chart:this}),i[l.id]=l),l.init(n,t)})),d(s,((t,e)=>{t||delete i[e]})),d(i,(t=>{ji.configure(this,t,t.options),ji.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(nn("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){d(this.scales,(t=>{ji.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);k(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e)cn(t,s,"_removeElements"===i?-n:n)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=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}))return;ji.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],d(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,n=this.chartArea,o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(s&&we(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),s&&Ce(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return ve(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Bi.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=mi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);w(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),mt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};d(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():o()}unbindEvents(){d(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},d(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,r,a;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),r=0,a=t.length;r{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!u(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),r=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,r=this._getActiveElements(t,s,i,o),a=M(t),h=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,c(n.onHover,[t,r,this],this),a&&c(n.onClick,[t,r,this],this));const l=!u(r,s);return(l||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=h,l}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}const un=()=>d(dn.instances,(t=>t._plugins.invalidate())),gn=!0;function fn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}Object.defineProperties(dn,{defaults:{enumerable:gn,value:ee},instances:{enumerable:gn,value:hn},overrides:{enumerable:gn,value:Kt},registry:{enumerable:gn,value:Fs},version:{enumerable:gn,value:"3.9.1"},getChart:{enumerable:gn,value:ln},register:{enumerable:gn,value:(...t)=>{Fs.add(...t),un()}},unregister:{enumerable:gn,value:(...t)=>{Fs.remove(...t),un()}}});class pn{constructor(t){this.options=t||{}}init(t){}formats(){return fn()}parse(t,e){return fn()}format(t,e){return fn()}add(t,e,i){return fn()}diff(t,e,i){return fn()}startOf(t,e,i){return fn()}endOf(t,e){return fn()}}pn.override=function(t){Object.assign(pn.prototype,t)};var mn={_date:pn};function An(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;et-e)))}return t._cache.$bar}(e,t.type);let s,n,o,r,a=e._length;const h=()=>{32767!==o&&-32768!==o&&(w(r)&&(a=Math.min(a,Math.abs(o-r)||a)),r=o)};for(s=0,n=i.length;sMath.abs(a)&&(h=a,l=r),e[i.axis]=l,e._custom={barStart:h,barEnd:l,start:n,end:o,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function bn(t,e,i,s){const n=t.iScale,o=t.vScale,r=n.getLabels(),a=n===o,h=[];let l,c,d,u;for(l=i,c=i+s;lt.x,i="left",s="right"):(e=t.baset.controller.options.grouped)),o=s.options.stacked,r=[],a=t=>{const s=t.controller.getParsed(e),n=s&&s[t.vScale.axis];if(i(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!a(i))&&((!1===o||-1===r.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&r.push(i.stack),i.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n=i?1:-1)}(d,e,r)*o,u===r&&(m-=d/2);const t=e.getPixelForDecimal(0),i=e.getPixelForDecimal(1),s=Math.min(t,i),n=Math.max(t,i);m=Math.max(Math.min(m,n),s),c=m+d}if(m===e.getPixelForValue(r)){const t=L(d)*e.getLineWidthForValue(r)/2;m+=t,d-=t}return{size:d,base:m,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const s=e.scale,n=this.options,o=n.skipNull,r=a(n.maxBarThickness,1/0);let h,l;if(e.grouped){const s=o?this._getStackCount(t):e.stackCount,a="flex"===n.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let r=t>0?n[t-1]:null,a=t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:s}=e,n=this.getParsed(t),o=i.getLabelForValue(n.x),r=s.getLabelForValue(n.y),a=n._custom;return{label:e.label,value:"("+o+", "+r+(a?", "+a:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:h}=this._getSharedOptions(e,s),l=o.axis,c=r.axis;for(let d=e;d""}}}};class Dn extends Ms{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let o,r,a=t=>+i[t];if(n(i[t])){const{key:t="value"}=this._parsing;a=e=>+x(i[e],t)}for(o=t,r=t+e;oJ(t,a,h,!0)?1:Math.max(e,e*i,s,s*i),f=(t,e,s)=>J(t,a,h,!0)?-1:Math.min(e,e*i,s,s*i),p=g(0,l,d),m=g(O,c,u),A=f(D,l,d),y=f(D+O,c,u);s=(p-A)/2,n=(m-y)/2,o=-(p+A)/2,r=-(m+y)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}(u,d,a),A=(i.width-o)/g,y=(i.height-o)/f,b=Math.max(Math.min(A,y)/2,0),x=l(this.options.radius,b),_=(x-Math.max(x*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*x,this.offsetY=m*x,s.total=this.calculateTotal(),this.outerRadius=x-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/E)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,r=o.chartArea,a=o.options.animation,h=(r.left+r.right)/2,l=(r.top+r.bottom)/2,c=n&&a.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:g,includeOptions:f}=this._getSharedOptions(e,s);let p,m=this._getRotation();for(p=0;p0&&!isNaN(t)?E*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=oi(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,r,a;if(!t)for(s=0,n=i.data.datasets.length;s"spacing"!==t,_indexable:t=>"spacing"!==t},Dn.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return s(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class En extends Ms{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:r,count:a}=ft(e,s,o);this._drawStart=r,this._drawCount=a,pt(e)&&(r=0,a=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:h},t),this.updateElements(s,r,a,t)}updateElements(t,e,s,n){const o="reset"===n,{iScale:r,vScale:a,_stacked:h,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,n),u=r.axis,g=a.axis,{spanGaps:f,segment:p}=this.options,m=Q(f)?f:Number.POSITIVE_INFINITY,A=this.chart._animationsDisabled||o||"none"===n;let y=e>0&&this.getParsed(e-1);for(let f=e;f0&&Math.abs(s[u]-y[u])>m,p&&(b.parsed=s,b.raw=l.data[f]),d&&(b.options=c||this.resolveDataElementOptions(f,e.active?"active":n)),A||this.updateElement(e,f,b,n),y=s}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}En.id="line",En.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},En.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Sn extends Ms{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=oi(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return Ne.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,r=o.options.animation,a=this._cachedMeta.rScale,h=a.xCenter,l=a.yCenter,c=a.getIndexAngle(0)-.5*D;let d,u=c;const g=360/this.countVisibleElements();for(d=0;d{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?N(this.resolveDataElementOptions(t,e).angle||i):0}}Sn.id="polarArea",Sn.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},Sn.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class Pn extends Dn{}Pn.id="pie",Pn.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class In extends Ms{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return Ne.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let r=e;r0&&this.getParsed(e-1);for(let c=e;c0&&Math.abs(s[g]-b[g])>A,m&&(p.parsed=s,p.raw=l.data[c]),u&&(p.options=d||this.resolveDataElementOptions(c,e.active?"active":n)),y||this.updateElement(e,c,p,n),b=s}this.updateSharedOptions(d,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}}On.id="scatter",On.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1},On.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var Bn=Object.freeze({__proto__:null,BarController:kn,BubbleController:Mn,DoughnutController:Dn,LineController:En,PolarAreaController:Sn,PieController:Pn,RadarController:In,ScatterController:On});function Rn(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:h}=e;let l=n/a;t.beginPath(),t.arc(o,r,a,s-l,i+l),h>n?(l=n/h,t.arc(o,r,h,i+l,s-l,!0)):t.arc(o,r,n,i+O,s-O),t.closePath(),t.clip()}function Tn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Ln(t,e,i,s,n,o){const{x:r,y:a,startAngle:h,pixelMargin:l,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-l,0),u=c>0?c+s+i+l:0;let g=0;const f=n-h;if(s){const t=((c>0?c-s:0)+(d>0?d-s:0))/2;g=(f-(0!==t?f*t/(t+s):f))/2}const p=(f-Math.max(.001,f*d-i/D)/d)/2,m=h+p+g,A=n-p-g,{outerStart:y,outerEnd:b,innerStart:x,innerEnd:_}=function(t,e,i,s){const n=li(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),o=(i-e)/2,r=Math.min(o,s*e/2),a=t=>{const e=(i-Math.min(o,t))*s/2;return K(t,0,Math.min(o,e))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:K(n.innerStart,0,r),innerEnd:K(n.innerEnd,0,r)}}(e,u,d,A-m),v=d-y,w=d-b,C=m+y/v,k=A-b/w,M=u+x,E=u+_,S=m+x/M,P=A-_/E;if(t.beginPath(),o){if(t.arc(r,a,d,C,k),b>0){const e=Tn(w,k,r,a);t.arc(e.x,e.y,b,k,A+O)}const e=Tn(E,A,r,a);if(t.lineTo(e.x,e.y),_>0){const e=Tn(E,P,r,a);t.arc(e.x,e.y,_,A+O,P+Math.PI)}if(t.arc(r,a,u,A-_/u,m+x/u,!0),x>0){const e=Tn(M,S,r,a);t.arc(e.x,e.y,x,S+Math.PI,m-O)}const i=Tn(v,m,r,a);if(t.lineTo(i.x,i.y),y>0){const e=Tn(v,C,r,a);t.arc(e.x,e.y,y,m-O,C)}}else{t.moveTo(r,a);const e=Math.cos(C)*d+r,i=Math.sin(C)*d+a;t.lineTo(e,i);const s=Math.cos(k)*d+r,n=Math.sin(k)*d+a;t.lineTo(s,n)}t.closePath()}class Hn extends Ds{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:n,distance:o}=G(s,{x:t,y:e}),{startAngle:r,endAngle:h,innerRadius:l,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=this.options.spacing/2,g=a(d,h-r)>=E||J(n,r,h),f=q(o,l+u,c+u);return g&&f}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:a,spacing:h}=this.options,l=(s+n)/2,c=(o+r+h+a)/2;return{x:e+Math.cos(l)*c,y:i+Math.sin(l)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>E?Math.floor(i/E):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let r=0;if(s){r=s/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*r,Math.sin(e)*r),this.circumference>=D&&(r=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const a=function(t,e,i,s,n){const{fullCircles:o,startAngle:r,circumference:a}=e;let h=e.endAngle;if(o){Ln(t,e,i,s,r+E,n);for(let e=0;ea&&o>a;return{count:s,start:h,loop:e.loop,ilen:l(r+(l?a-t:t))%o,b=()=>{g!==f&&(t.lineTo(m,f),t.lineTo(m,g),t.lineTo(m,p))};for(h&&(d=n[y(0)],t.moveTo(d.x,d.y)),c=0;c<=a;++c){if(d=n[y(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(if&&(f=i),m=(A*m+e)/++A):(b(),t.lineTo(e,i),u=s,A=0,g=f=i),p=i}b()}function Nn(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?$n:Wn}Hn.id="arc",Hn.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0},Hn.defaultRoutes={backgroundColor:"backgroundColor"};const Vn="function"==typeof Path2D;class jn extends Ds{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Je(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ci(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=wi(this,{property:e,start:s,end:s});if(!o.length)return;const r=[],a=function(t){return t.stepped?ii:t.tension||"monotone"===t.cubicInterpolationMode?si:ei}(i);let h,l;for(h=0,l=o.length;h"borderDash"!==t&&"fill"!==t};class Un extends Ds{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2){io(t)}))}var no={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,s)=>{if(!s.enabled)return void so(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:r,indexAxis:a}=e,h=t.getDatasetMeta(o),l=r||e.data;if("y"===fi([a,t.options.indexAxis]))return;if(!h.controller.supportsDecimation)return;const c=t.scales[h.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let d,{start:u,count:g}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:r,max:a,minDefined:h,maxDefined:l}=o.getUserBounds();return h&&(n=K(et(e,o.axis,r).lo,0,i-1)),s=l?K(et(e,o.axis,a).hi+1,n,i)-n:i-n,{start:n,count:s}}(h,l);if(g<=(s.threshold||4*n))io(e);else{switch(i(r)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),s.algorithm){case"lttb":d=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(o-2);let h=0;const l=e+i-1;let c,d,u,g,f,p=e;for(r[h++]=t[p],c=0;cu&&(u=g,d=t[s],f=s);r[h++]=d,p=f}return r[h++]=t[l],r}(l,u,g,n,s);break;case"min-max":d=function(t,e,s,n){let o,r,a,h,l,c,d,u,g,f,p=0,m=0;const A=[],y=e+s-1,b=t[e].x,x=t[y].x-b;for(o=e;of&&(f=h,d=o),p=(m*p+r.x)/++m;else{const s=o-1;if(!i(c)&&!i(d)){const e=Math.min(c,d),i=Math.max(c,d);e!==u&&e!==s&&A.push({...t[e],x:p}),i!==u&&i!==s&&A.push({...t[i],x:p})}o>0&&s!==u&&A.push(t[s]),A.push(r),l=e,m=0,g=f=h,c=d=u=o}}return A}(l,u,g,n);break;default:throw new Error(`Unsupported decimation algorithm '${s.algorithm}'`)}e._decimated=d}}))},destroy(t){so(t)}};function oo(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=X(n),o=X(o)),{property:t,start:n,end:o}}function ro(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function ao(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function ho(t,e){let i=[],n=!1;return s(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=ro(t,e,n);const r=n[t],a=n[e];null!==s?(o.push({x:r.x,y:s}),o.push({x:a.x,y:s})):null!==i&&(o.push({x:i,y:r.y}),o.push({x:i,y:a.y}))})),o}(t,e),i.length?new jn({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function lo(t){return t&&!1!==t.fill}function co(t,e,i){let s=t[e].fill;const n=[e];let r;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!o(s))return s;if(r=t[s],!r)return!1;if(r.visible)return s;n.push(s),s=r.fill}return!1}function uo(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=a(i&&i.target,i);return void 0===s&&(s=!!e.backgroundColor),!1!==s&&null!==s&&(!0===s?"origin":s)}(t);if(n(s))return!isNaN(s.value)&&s;let r=parseFloat(s);return o(r)&&Math.floor(r)===r?function(t,e,i,s){return"-"!==t&&"+"!==t||(i=e+i),!(i===e||i<0||i>=s)&&i}(s[0],e,r,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function go(t,e,i){const s=[];for(let n=0;n=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&Ao(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;lo(i)&&Ao(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;lo(s)&&"beforeDatasetDraw"===i.drawTime&&Ao(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const wo=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class Co extends Ds{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=c(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=gi(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=wo(i,n);let h,l;e.font=s.string,this.isHorizontal()?(h=this.maxWidth,l=this._fitRows(o,n,r,a)+10):(l=this.maxHeight,h=this._fitCols(o,n,r,a)+10),this.width=Math.min(h,t.maxWidth||this.maxWidth),this.height=Math.min(l,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],h=this.lineWidths=[0],l=s+r;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-l;return this.legendItems.forEach(((t,g)=>{const f=i+e/2+n.measureText(t.text).width;(0===g||h[h.length-1]+f+2*r>o)&&(c+=l,h[h.length-(g>0?0:1)]=0,u+=l,d++),a[g]={left:0,top:u,row:d,width:f,height:s},h[h.length-1]+=f+r})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],h=this.columnSizes=[],l=o-t;let c=r,d=0,u=0,g=0,f=0;return this.legendItems.forEach(((t,o)=>{const p=i+e/2+n.measureText(t.text).width;o>0&&u+s+2*r>l&&(c+=d+r,h.push({width:d,height:u}),g+=d+r,f++,d=u=0),a[o]={left:g,top:u,col:f,width:p,height:s},d=Math.max(d,p),u+=s+r})),c+=d,h.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=Ai(n,this.left,this.width);if(this.isHorizontal()){let n=0,r=ut(i,this.left+s,this.right-this.lineWidths[n]);for(const a of e)n!==a.row&&(n=a.row,r=ut(i,this.left+s,this.right-this.lineWidths[n])),a.top+=this.top+t+s,a.left=o.leftForLtr(o.x(r),a.width),r+=a.width+s}else{let n=0,r=ut(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const a of e)a.col!==n&&(n=a.col,r=ut(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),a.top=r,a.left+=this.left+s,a.left=o.leftForLtr(o.x(a.left),a.width),r+=a.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;we(t,this),this._draw(),Ce(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,r=ee.color,h=Ai(t.rtl,this.left,this.width),l=gi(o.font),{color:c,padding:d}=o,u=l.size,g=u/2;let f;this.drawTitle(),s.textAlign=h.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:p,boxHeight:m,itemHeight:A}=wo(o,u),y=this.isHorizontal(),b=this._computeTitleHeight();f=y?{x:ut(n,this.left+d,this.right-i[0]),y:this.top+d+b,line:0}:{x:this.left+d,y:ut(n,this.top+b+d,this.bottom-e[0].height),line:0},yi(this.ctx,t.textDirection);const x=A+d;this.legendItems.forEach(((_,v)=>{s.strokeStyle=_.fontColor||c,s.fillStyle=_.fontColor||c;const w=s.measureText(_.text).width,C=h.textAlign(_.textAlign||(_.textAlign=o.textAlign)),k=p+g+w;let M=f.x,D=f.y;h.setWidth(this.width),y?v>0&&M+k+d>this.right&&(D=f.y+=x,f.line++,M=f.x=ut(n,this.left+d,this.right-i[f.line])):v>0&&D+x>this.bottom&&(M=f.x=M+e[f.line].width+d,f.line++,D=f.y=ut(n,this.top+b+d,this.bottom-e[f.line].height)),function(t,e,i){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;s.save();const n=a(i.lineWidth,1);if(s.fillStyle=a(i.fillStyle,r),s.lineCap=a(i.lineCap,"butt"),s.lineDashOffset=a(i.lineDashOffset,0),s.lineJoin=a(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=a(i.strokeStyle,r),s.setLineDash(a(i.lineDash,[])),o.usePointStyle){const r={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},a=h.xPlus(t,p/2);_e(s,r,a,e+g,o.pointStyleWidth&&p)}else{const o=e+Math.max((u-m)/2,0),r=h.leftForLtr(t,p),a=di(i.borderRadius);s.beginPath(),Object.values(a).some((t=>0!==t))?Se(s,{x:r,y:o,w:p,h:m,radius:a}):s.rect(r,o,p,m),s.fill(),0!==n&&s.stroke()}s.restore()}(h.x(M),D,_),M=gt(C,M+p+g,y?M+k:this.right,t.rtl),function(t,e,i){De(s,i.text,t,e+A/2,l,{strikethrough:i.hidden,textAlign:h.textAlign(i.textAlign)})}(h.x(M),D,_),y?f.x+=k+d:f.y+=x})),bi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=gi(e.font),s=ui(e.padding);if(!e.display)return;const n=Ai(t.rtl,this.left,this.width),o=this.ctx,r=e.position,a=i.size/2,h=s.top+a;let l,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+h,c=ut(t.align,c,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);l=h+ut(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=ut(r,c,c+d);o.textAlign=n.textAlign(dt(r)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,De(o,e.text,u,l,i)}_computeTitleHeight(){const t=this.options.title,e=gi(t.font),i=ui(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(q(t,this.left,this.right)&&q(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;it.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const r=t.controller.getStyle(i?0:void 0),a=ui(r.borderWidth);return{text:e[t.index].label,fillStyle:r.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:r.borderCapStyle,lineDash:r.borderDash,lineDashOffset:r.borderDashOffset,lineJoin:r.borderJoinStyle,lineWidth:(a.width+a.height)/4,strokeStyle:r.borderColor,pointStyle:s||r.pointStyle,rotation:r.rotation,textAlign:n||r.textAlign,borderRadius:0,datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Mo extends Ds{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=s(i.text)?i.text.length:1;this._padding=ui(i.padding);const o=n*gi(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,r=o.align;let a,h,l,c=0;return this.isHorizontal()?(h=ut(r,i,n),l=e+t,a=n-i):("left"===o.position?(h=i+t,l=ut(r,s,e),c=-.5*D):(h=n-t,l=ut(r,e,s),c=.5*D),a=s-e),{titleX:h,titleY:l,maxWidth:a,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=gi(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:r,rotation:a}=this._drawArgs(s);De(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:dt(e.align),textBaseline:"middle",translation:[n,o]})}}var Do={id:"title",_element:Mo,start(t,e,i){!function(t,e){const i=new Mo({ctx:t.ctx,options:e,chart:t});ji.configure(t,i,e),ji.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;ji.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;ji.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Eo=new WeakMap;var So={id:"subtitle",start(t,e,i){const s=new Mo({ctx:t.ctx,options:i,chart:t});ji.configure(t,s,i),ji.addBox(t,s),Eo.set(t,s)},stop(t){ji.removeBox(t,Eo.get(t)),Eo.delete(t)},beforeUpdate(t,e,i){const s=Eo.get(t);ji.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Po={average(t){if(!t.length)return!1;let e,i,s=0,n=0,o=0;for(e=0,i=t.length;e-1?t.split("\n"):t}function Bo(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:t,label:r,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Ro(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:r,boxHeight:a}=e,h=gi(e.bodyFont),l=gi(e.titleFont),c=gi(e.footerFont),u=o.length,g=n.length,f=s.length,p=ui(e.padding);let m=p.height,A=0,y=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);y+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*l.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),y&&(m+=f*(e.displayColors?Math.max(a,h.lineHeight):h.lineHeight)+(y-f)*h.lineHeight+(y-1)*e.bodySpacing),g&&(m+=e.footerMarginTop+g*c.lineHeight+(g-1)*e.footerSpacing);let b=0;const x=function(t){A=Math.max(A,i.measureText(t).width+b)};return i.save(),i.font=l.string,d(t.title,x),i.font=h.string,d(t.beforeBody.concat(t.afterBody),x),b=e.displayColors?r+2+e.boxPadding:0,d(s,(t=>{d(t.before,x),d(t.lines,x),d(t.after,x)})),b=0,i.font=c.string,d(t.footer,x),i.restore(),A+=p.width,{width:A,height:m}}function To(t,e,i,s){const{x:n,width:o}=i,{width:r,chartArea:{left:a,right:h}}=t;let l="center";return"center"===s?l=n<=(a+h)/2?"left":"right":n<=o/2?l="left":n>=r-o/2&&(l="right"),function(t,e,i,s){const{x:n,width:o}=s,r=i.caretSize+i.caretPadding;return"left"===t&&n+o+r>e.width||"right"===t&&n-o-r<0||void 0}(l,t,e,i)&&(l="center"),l}function Lo(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||To(t,e,i,s),yAlign:s}}function Ho(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=t,{xAlign:a,yAlign:h}=i,l=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:g}=di(r);let f=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,a);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,h,l);return"center"===h?"left"===a?f+=l:"right"===a&&(f-=l):"left"===a?f-=Math.max(c,u)+n:"right"===a&&(f+=Math.max(d,g)+n),{x:K(f,0,s.width-e.width),y:K(p,0,s.height-e.height)}}function zo(t,e,i){const s=ui(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function Qo(t){return Io([],Oo(t))}function Fo(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class $o extends Ds{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new fs(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=mi(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"}))}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),n=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let r=[];return r=Io(r,Oo(s)),r=Io(r,Oo(n)),r=Io(r,Oo(o)),r}getBeforeBody(t,e){return Qo(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return d(t,(t=>{const e={before:[],lines:[],after:[]},n=Fo(i,t);Io(e.before,Oo(n.beforeLabel.call(this,t))),Io(e.lines,n.label.call(this,t)),Io(e.after,Oo(n.afterLabel.call(this,t))),s.push(e)})),s}getAfterBody(t,e){return Qo(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),n=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let r=[];return r=Io(r,Oo(s)),r=Io(r,Oo(n)),r=Io(r,Oo(o)),r}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let r,a,h=[];for(r=0,a=e.length;rt.filter(e,s,n,i)))),t.itemSort&&(h=h.sort(((e,s)=>t.itemSort(e,s,i)))),d(h,(e=>{const i=Fo(t.callbacks,e);s.push(i.labelColor.call(this,e)),n.push(i.labelPointStyle.call(this,e)),o.push(i.labelTextColor.call(this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=h,h}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Po[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Ro(this,i),r=Object.assign({},t,e),a=Lo(this.chart,i,r),h=Ho(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,n={opacity:1,x:h.x,y:h.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:r}=i,{topLeft:a,topRight:h,bottomLeft:l,bottomRight:c}=di(r),{x:d,y:u}=t,{width:g,height:f}=e;let p,m,A,y,b,x;return"center"===n?(b=u+f/2,"left"===s?(p=d,m=p-o,y=b+o,x=b-o):(p=d+g,m=p+o,y=b-o,x=b+o),A=p):(m="left"===s?d+Math.max(a,l)+o:"right"===s?d+g-Math.max(h,c)-o:this.caretX,"top"===n?(y=u,b=y-o,p=m-o,A=m+o):(y=u+f,b=y+o,p=m+o,A=m-o),x=y),{x1:p,x2:m,x3:A,y1:y,y2:b,y3:x}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,r,a;if(n){const h=Ai(i.rtl,this.x,this.width);for(t.x=zo(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",o=gi(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,a=0;a0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Se(t,{x:e,y:p,w:l,h,radius:a}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Se(t,{x:i,y:p+1,w:l-2,h:h-2,radius:a}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,p,l,h),t.strokeRect(e,p,l,h),t.fillStyle=r.backgroundColor,t.fillRect(i,p+1,l-2,h-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:r,boxHeight:a,boxWidth:h,boxPadding:l}=i,c=gi(i.bodyFont);let u=c.lineHeight,g=0;const f=Ai(i.rtl,this.x,this.width),p=function(i){e.fillText(i,f.x(t.x+g),t.y+u/2),t.y+=u+n},m=f.textAlign(o);let A,y,b,x,_,v,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=zo(this,m,i),e.fillStyle=i.bodyColor,d(this.beforeBody,p),g=r&&"right"!==m?"center"===o?h/2+l:h+2+l:0,x=0,v=s.length;x0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Po[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Ro(this,t),r=Object.assign({},i,this._size),a=Lo(e,t,r),h=Ho(t,r,a,e);s._to===h.x&&n._to===h.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ui(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),yi(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),bi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!u(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),r=this._positionChanged(o,t),a=e||!u(o,n)||r;return a&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Po[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}$o.positioners=Po;var Wo={id:"tooltip",_element:$o,positioners:Po,afterInit(t,e,i){i&&(t.tooltip=new $o({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;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",i))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:t,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},No=Object.freeze({__proto__:null,Decimation:no,Filler:vo,Legend:ko,SubTitle:So,Title:Do,Tooltip:Wo});class Vo extends zs{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(i(t))return null;const s=this.getLabels();return((t,e)=>null===t?null:K(Math.round(t),0,e))(e=isFinite(e)&&s[e]===t?e:function(t,e,i,s){const n=t.indexOf(e);return-1===n?((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s):n!==t.lastIndexOf(e)?i:n}(s,t,a(e,t),this._addedLabels),s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function jo(t,e,{horizontal:i,minRotation:s}){const n=N(s),o=(i?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+t).length;return Math.min(e/o,r)}Vo.id="category",Vo.defaults={ticks:{callback:Vo.prototype.getLabelForValue}};class Go extends zs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return i(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=e?s:t,r=t=>n=i?n:t;if(t){const t=L(s),e=L(n);t<0&&e<0?r(0):t>0&&e>0&&o(0)}if(s===n){let e=1;(n>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*n)),r(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n=function(t,e){const s=[],{bounds:n,step:o,min:r,max:a,precision:h,count:l,maxTicks:c,maxDigits:d,includeBounds:u}=t,g=o||1,f=c-1,{min:p,max:m}=e,A=!i(r),y=!i(a),b=!i(l),x=(m-p)/(d+1);let _,v,w,C,k=H((m-p)/f/g)*g;if(k<1e-14&&!A&&!y)return[{value:p},{value:m}];C=Math.ceil(m/k)-Math.floor(p/k),C>f&&(k=H(C*k/f/g)*g),i(h)||(_=Math.pow(10,h),k=Math.ceil(k*_)/_),"ticks"===n?(v=Math.floor(p/k)*k,w=Math.ceil(m/k)*k):(v=p,w=m),A&&y&&o&&$((a-r)/o,k/1e3)?(C=Math.round(Math.min((a-r)/k,c)),k=(a-r)/C,v=r,w=a):b?(v=A?r:v,w=y?a:w,C=l-1,k=(w-v)/C):(C=(w-v)/k,C=F(C,Math.round(C),k/1e3)?Math.round(C):Math.ceil(C));const M=Math.max(j(k),j(v));_=Math.pow(10,i(h)?M:h),v=Math.round(v*_)/_,w=Math.round(w*_)/_;let D=0;for(A&&(u&&v!==r?(s.push({value:r}),v0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=o(t)?Math.max(0,t):null,this.max=o(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t,r=(t,e)=>Math.pow(10,Math.floor(T(t))+e);i===s&&(i<=0?(n(1),o(10)):(n(r(i,-1)),o(r(s,1)))),i<=0&&n(r(s,-1)),s<=0&&o(r(i,1)),this._zero&&this.min!==this._suggestedMin&&i===r(this.min,0)&&n(r(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor(T(e.max)),s=Math.ceil(e.max/Math.pow(10,i)),n=[];let o=r(t.min,Math.pow(10,Math.floor(T(e.min)))),a=Math.floor(T(o)),h=Math.floor(o/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do{n.push({value:o,major:Yo(o)}),++h,10===h&&(h=1,++a,l=a>=0?1:l),o=Math.round(h*Math.pow(10,a)*l)/l}while(an?{start:e-i,end:e}:{start:e,end:e+i}}function Zo(t,e,i,s,n){const o=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,h=0;s.starte.r&&(a=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+a)),n.starte.b&&(h=(n.end-e.b)/r,t.b=Math.max(t.b,e.b+h))}function qo(t){return 0===t||180===t?"center":t<180?"left":"right"}function tr(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function er(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function ir(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,E);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;o{const i=c(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?function(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],r=t._pointLabels.length,a=t.options.pointLabels,h=a.centerPointLabels?D/r:0;for(let u=0;u=0&&t=0;o--){const e=n.setContext(t.getPointLabelContext(o)),r=gi(e.font),{x:a,y:h,textAlign:l,left:c,top:d,right:u,bottom:g}=t._pointLabelItems[o],{backdropColor:f}=e;if(!i(f)){const t=di(e.borderRadius),i=ui(e.backdropPadding);s.fillStyle=f;const n=c-i.left,o=d-i.top,r=u-c+i.width,a=g-d+i.height;Object.values(t).some((t=>0!==t))?(s.beginPath(),Se(s,{x:n,y:o,w:r,h:a,radius:t}),s.fill()):s.fillRect(n,o,r,a)}De(s,t._pointLabels[o],a,h+r.lineHeight/2,r,{color:e.color,textAlign:l,textBaseline:"middle"})}}(this,o),n.display&&this.ticks.forEach(((t,e)=>{0!==e&&(a=this.getDistanceFromCenterForValue(t.value),function(t,e,i,s){const n=t.ctx,o=e.circular,{color:r,lineWidth:a}=e;!o&&!s||!r||!a||i<0||(n.save(),n.strokeStyle=r,n.lineWidth=a,n.setLineDash(e.borderDash),n.lineDashOffset=e.borderDashOffset,n.beginPath(),ir(t,i,o,s),n.closePath(),n.stroke(),n.restore())}(this,n.setContext(this.getContext(e-1)),a,o))})),s.display){for(t.save(),r=o-1;r>=0;r--){const i=s.setContext(this.getPointLabelContext(r)),{color:n,lineWidth:o}=i;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(i.borderDash),t.lineDashOffset=i.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),h=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(h.x,h.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,r)=>{if(0===r&&!e.reverse)return;const a=i.setContext(this.getContext(r)),h=gi(a.font);if(n=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=h.string,o=t.measureText(s.label).width,t.fillStyle=a.backdropColor;const e=ui(a.backdropPadding);t.fillRect(-o/2-e.left,-n-h.size/2-e.top,o+e.width,h.size+e.height)}De(t,s.label,0,-n,h,{color:a.color})})),t.restore()}drawTitle(){}}sr.id="radialLinear",sr.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ss.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}},sr.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},sr.descriptors={angleLines:{_fallback:"grid"}};const nr={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}},or=Object.keys(nr);function rr(t,e){return t-e}function ar(t,e){if(i(e))return null;const s=t._adapter,{parser:n,round:r,isoWeekday:a}=t._parseOpts;let h=e;return"function"==typeof n&&(h=n(h)),o(h)||(h="string"==typeof n?s.parse(h,n):s.parse(h)),null===h?null:(r&&(h="week"!==r||!Q(a)&&!0!==a?s.startOf(h,r):s.startOf(h,"isoWeek",a)),+h)}function hr(t,e,i,s){const n=or.length;for(let o=or.indexOf(t);o=e?i[s]:i[n]]=!0}}else t[e]=!0}function cr(t,e,i){const s=[],n={},o=e.length;let r,a;for(r=0;r=0&&(e[h].major=!0);return e}(t,s,n,i):s}class dr extends zs{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){const i=t.time||(t.time={}),s=this._adapter=new mn._date(t.adapters.date);s.init(e),A(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:ar(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:r,maxDefined:a}=this.getUserBounds();function h(t){r||isNaN(t.min)||(s=Math.min(s,t.min)),a||isNaN(t.max)||(n=Math.max(n,t.max))}r&&a||(h(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||h(this.getMinMax(!1))),s=o(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=o(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=st(s,n,this.max);return this._unit=e.unit||(i.autoSkip?hr(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=or.length-1;o>=or.indexOf(i);o--){const i=or[o];if(nr[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return or[i?or.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=or.indexOf(t)+1,i=or.length;e+t.value)))}initOffsets(t){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=K(s,0,o),n=K(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||hr(n.minUnit,e,i,this._getLabelCapacity(e)),r=a(n.stepSize,1),h="week"===o&&n.isoWeekday,l=Q(h)||!0===h,c={};let d,u,g=e;if(l&&(g=+t.startOf(g,"isoWeek",h)),g=+t.startOf(g,l?"day":o),t.diff(i,e,o)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+o);const f="data"===s.ticks.source&&this.getDataTimestamps();for(d=g,u=0;dt-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.time.displayFormats,r=this._unit,a=this._majorUnit,h=r&&o[r],l=a&&o[a],d=i[e],u=a&&l&&d&&d.major,g=this._adapter.format(t,s||(u?l:h)),f=n.ticks.callback;return f?c(f,[g,e,i],this):g}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[a].pos&&e<=t[h].pos&&({lo:a,hi:h}=et(t,"pos",e)),({pos:s,time:o}=t[a]),({pos:n,time:r}=t[h])):(e>=t[a].time&&e<=t[h].time&&({lo:a,hi:h}=et(t,"time",e)),({time:s,pos:o}=t[a]),({time:n,pos:r}=t[h]));const l=n-s;return l?o+(r-o)*(e-s)/l:o}dr.id="time",dr.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class gr extends dr{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=ur(e,this.min),this._tableRange=ur(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,r,a,h,l;for(o=0,r=t.length;o=e&&h<=i&&s.push(h);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,r=s.length;o{"use strict";i.d(e,{oi:()=>st,iv:()=>h,dy:()=>z});const s=window,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),r=new WeakMap;class a{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&r.set(e,t))}return t}toString(){return this.cssText}}const h=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new a(i,t,o)},l=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,o))(e)})(t):t;var c;const d=window,u=d.trustedTypes,g=u?u.emptyScript:"",f=d.reactiveElementPolyfillSupport,p={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},m=(t,e)=>e!==t&&(e==e||t==t),A={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:m};class y extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),t}static createProperty(t,e=A){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||A}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{n?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=s.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=A){var s;const n=this.constructor._$Ep(t,i);if(void 0!==n&&!0===i.reflect){const o=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:p).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,n=s._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=s.getPropertyOptions(n),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:p;this._$El=n,this[n]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||m)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var b;y.finalized=!0,y.elementProperties=new Map,y.elementStyles=[],y.shadowRootOptions={mode:"open"},null==f||f({ReactiveElement:y}),(null!==(c=d.reactiveElementVersions)&&void 0!==c?c:d.reactiveElementVersions=[]).push("1.4.2");const x=window,_=x.trustedTypes,v=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,w=`lit$${(Math.random()+"").slice(9)}$`,C="?"+w,k=`<${C}>`,M=document,D=(t="")=>M.createComment(t),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,S=Array.isArray,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,O=/>/g,B=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),R=/'/g,T=/"/g,L=/^(?:script|style|textarea|title)$/i,H=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),z=H(1),Q=(H(2),Symbol.for("lit-noChange")),F=Symbol.for("lit-nothing"),$=new WeakMap,W=M.createTreeWalker(M,129,null,!1),N=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"":"",r=P;for(let e=0;e"===h[0]?(r=null!=n?n:P,l=-1):void 0===h[1]?l=-2:(l=r.lastIndex-h[2].length,a=h[1],r=void 0===h[3]?B:'"'===h[3]?T:R):r===T||r===R?r=B:r===I||r===O?r=P:(r=B,n=void 0);const d=r===B&&t[e+1].startsWith("/>")?" ":"";o+=r===P?i+k:l>=0?(s.push(a),i.slice(0,l)+"$lit$"+i.slice(l)+w+d):i+w+(-2===l?(s.push(void 0),e):d)}const a=o+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==v?v.createHTML(a):a,s]};class V{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,a=this.parts,[h,l]=N(t,e);if(this.el=V.createElement(h,i),W.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=W.nextNode())&&a.length0){s.textContent=_?_.emptyScript:"";for(let i=0;iS(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==F&&E(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.p(i);else{const t=new G(n,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=$.get(t.strings);return void 0===e&&$.set(t.strings,e=new V(t)),e}k(t){S(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new U(this.O(D()),this.O(D()),this,this.options)):i=e[s],i._$AI(n),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=F}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=j(this,t,e,0),o=!E(t)||t!==this._$AH&&t!==Q,o&&(this._$AH=t);else{const s=t;let r,a;for(t=n[0],r=0;r{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let r=o._$litPart$;if(void 0===r){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=r=new U(e.insertBefore(D(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return Q}}st.finalized=!0,st._$litElement$=!0,null===(et=globalThis.litElementHydrateSupport)||void 0===et||et.call(globalThis,{LitElement:st});const nt=globalThis.litElementPolyfillSupport;null==nt||nt({LitElement:st}),(null!==(it=globalThis.litElementVersions)&&void 0!==it?it:globalThis.litElementVersions=[]).push("3.2.2")},225:(t,e,i)=>{"use strict";i.r(e),i.d(e,{GazparCardEditor:()=>n});var s=i(897);!customElements.get("ha-switch")&&customElements.get("paper-toggle-button")&&customElements.define("ha-switch",customElements.get("paper-toggle-button"));class n extends s.oi{setConfig(t){this._config={...t}}static get properties(){return{hass:{},_config:{}}}get _title(){return this._config.title||"GrDF data"}get _entity(){return this._config.entity||"sensor.gazpar"}get _pricePerKWh(){return this._config.pricePerKWh||0}get _showIcon(){return!1!==this._config.showIcon}get _showCost(){return!1!==this._config.showCost}get _showTitle(){return!1!==this._config.showTitle}get _showMainBar(){return!1!==this._config.showMainBar}get _showError(){return!1!==this._config.showError}get _showVersion(){return!1!==this._config.showVersion}get _showDailyHistory(){return!1!==this._config.showDailyHistory}get _showMonthlyHistory(){return!1!==this._config.showMonthlyHistory}get _showHistoryHeader(){return!1!==this._config.showHistoryHeader}get _showEnergyHistory(){return!1!==this._config.showEnergyHistory}get _showVolumeHistory(){return!1!==this._config.showVolumeHistory}get _showCostHistory(){return!1!==this._config.showCostHistory}get _showTrendRatioHistory(){return!1!==this._config.showTrendRatioHistory}get _showDailyEnergyHistoryChart(){return!1!==this._config.showDailyEnergyHistoryChart}get _showDailyCostHistoryChart(){return!1!==this._config.showDailyCostHistoryChart}get _showWeeklyEnergyHistoryChart(){return!1!==this._config.showWeeklyEnergyHistoryChart}get _showWeeklyCostHistoryChart(){return!1!==this._config.showWeeklyCostHistoryChart}get _showMonthlyEnergyHistoryChart(){return!1!==this._config.showMonthlyEnergyHistoryChart}get _showMonthlyCostHistoryChart(){return!1!==this._config.showMonthlyCostHistoryChart}get _showYearlyEnergyHistoryChart(){return!1!==this._config.showYearlyEnergyHistoryChart}get _showYearlyCostHistoryChart(){return!1!==this._config.showYearlyCostHistoryChart}firstUpdated(){window.loadCardHelpers().then((t=>{t.importMoreInfoControl&&t.importMoreInfoControl("fan")}))}render(){return this.hass?s.dy` +(()=>{var t={790:function(t){t.exports=function(){"use strict";function t(){}const e=function(){let t=0;return function(){return t++}}();function i(t){return null==t}function s(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function n(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const o=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function r(t,e){return o(t)?t:e}function a(t,e){return void 0===t?e:t}const h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:t/e,l=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function c(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function d(t,e,i,o){let r,a,h;if(s(t))if(a=t.length,o)for(r=a-1;r>=0;r--)e.call(i,t[r],r);else for(r=0;rt,x:t=>t.x,y:t=>t.y};function v(t,e){const i=x[e]||(x[e]=function(t){const e=_(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function _(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}const A=t=>void 0!==t,k=t=>"function"==typeof t,M=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function C(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const S=Math.PI,D=2*S,P=D+S,E=Number.POSITIVE_INFINITY,I=S/180,T=S/2,O=S/4,R=2*S/3,L=Math.log10,z=Math.sign;function H(t){const e=Math.round(t);t=F(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(L(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function B(t){const e=[],i=Math.sqrt(t);let s;for(s=1;st-e)).pop(),e}function N(t){return!isNaN(parseFloat(t))&&isFinite(t)}function F(t,e,i){return Math.abs(t-e)=t}function V(t,e,i){let s,n,o;for(s=0,n=t.length;sh&&l=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function tt(t,e,i){i=i||(i=>t[i]1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const et=(t,e,i,s)=>tt(t,i,s?s=>t[s][e]<=i:s=>t[s][e]tt(t,i,(s=>t[s][e]>=i));function st(t,e,i){let s=0,n=t.length;for(;ss&&t[n-1]>i;)n--;return s>0||n{const i="_onData"+w(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function rt(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(nt.forEach((e=>{delete t[e]})),delete t._chartjs)}function at(t){const e=new Set;let i,s;for(i=0,s=t.length;iArray.prototype.slice.call(t));let n=!1,o=[];return function(...i){o=s(i),n||(n=!0,ht.call(window,(()=>{n=!1,t.apply(e,o)})))}}function ct(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const dt=t=>"start"===t?"left":"end"===t?"right":"center",ut=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,gt=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;function pt(t,e,i){const s=e.length;let n=0,o=s;if(t._sorted){const{iScale:r,_parsed:a}=t,h=r.axis,{min:l,max:c,minDefined:d,maxDefined:u}=r.getUserBounds();d&&(n=q(Math.min(et(a,r.axis,l).lo,i?s:et(e,h,r.getPixelForValue(l)).lo),0,s-1)),o=u?q(Math.max(et(a,r.axis,c,!0).hi+1,i?0:et(e,h,r.getPixelForValue(c),!0).hi+1),n,s)-n:s-n}return{start:n,count:o}}function ft(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}var mt=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=ht.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,r=n.length-1,a=!1;for(;r>=0;--r)o=n[r],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),a=!0):(n[r]=n[n.length-1],n.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};function yt(t){return t+.5|0}const bt=(t,e,i)=>Math.max(Math.min(t,i),e);function xt(t){return bt(yt(2.55*t),0,255)}function vt(t){return bt(yt(255*t),0,255)}function _t(t){return bt(yt(t/2.55)/100,0,1)}function wt(t){return bt(yt(100*t),0,100)}const At={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},kt=[..."0123456789ABCDEF"],Mt=t=>kt[15&t],Ct=t=>kt[(240&t)>>4]+kt[15&t],St=t=>(240&t)>>4==(15&t);const Dt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Pt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Et(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function It(t,e,i){const s=Pt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function Tt(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),r=(n+o)/2;let a,h,l;return n!==o&&(l=n-o,h=r>.5?l/(2-n-o):l/(n+o),a=function(t,e,i,s,n){return t===n?(e-i)/s+(et<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Wt=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Vt(t,e,i){if(t){let s=Tt(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=Rt(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function jt(t,e){return t?Object.assign(e||{},t):t}function $t(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=vt(t[3]))):(e=jt(t,{r:0,g:0,b:0,a:1})).a=vt(e.a),e}function Yt(t){return"r"===t.charAt(0)?function(t){const e=Nt.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?xt(t):bt(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?xt(i):bt(i,0,255)),s=255&(e[4]?xt(s):bt(s,0,255)),n=255&(e[6]?xt(n):bt(n,0,255)),{r:i,g:s,b:n,a:o}}}(t):function(t){const e=Dt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?xt(+e[5]):vt(+e[5]));const n=Lt(+e[2]),o=+e[3]/100,r=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Ot(It,t,e,i)}(n,o,r):"hsv"===e[1]?function(t,e,i){return Ot(Et,t,e,i)}(n,o,r):Rt(n,o,r),{r:i[0],g:i[1],b:i[2],a:s}}(t)}class Gt{constructor(t){if(t instanceof Gt)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=$t(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*At[s[1]],g:255&17*At[s[2]],b:255&17*At[s[3]],a:5===o?17*At[s[4]]:255}:7!==o&&9!==o||(n={r:At[s[1]]<<4|At[s[2]],g:At[s[3]]<<4|At[s[4]],b:At[s[5]]<<4|At[s[6]],a:9===o?At[s[7]]<<4|At[s[8]]:255})),i=n||function(t){Bt||(Bt=function(){const t={},e=Object.keys(Ht),i=Object.keys(zt);let s,n,o,r,a;for(s=0;s>16&255,o>>8&255,255&o]}return t}(),Bt.transparent=[0,0,0,0]);const e=Bt[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}(t)||Yt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=jt(this._rgb);return t&&(t.a=_t(t.a)),t}set rgb(t){this._rgb=$t(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${_t(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?function(t){var e=(t=>St(t.r)&&St(t.g)&&St(t.b)&&St(t.a))(t)?Mt:Ct;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=Tt(t),i=e[0],s=wt(e[1]),n=wt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${_t(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,r=2*o-1,a=i.a-s.a,h=((r*a==-1?r:(r+a)/(1+r*a))+1)/2;n=1-h,i.r=255&h*i.r+n*s.r+.5,i.g=255&h*i.g+n*s.g+.5,i.b=255&h*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=Wt(_t(t.r)),n=Wt(_t(t.g)),o=Wt(_t(t.b));return{r:vt(Ft(s+i*(Wt(_t(e.r))-s))),g:vt(Ft(n+i*(Wt(_t(e.g))-n))),b:vt(Ft(o+i*(Wt(_t(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Gt(this.rgb)}alpha(t){return this._rgb.a=vt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=yt(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Vt(this._rgb,2,t),this}darken(t){return Vt(this._rgb,2,-t),this}saturate(t){return Vt(this._rgb,1,t),this}desaturate(t){return Vt(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Tt(t);i[0]=Lt(i[0]+e),i=Rt(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Ut(t){return new Gt(t)}function Qt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Xt(t){return Qt(t)?t:Ut(t)}function Jt(t){return Qt(t)?t:Ut(t).saturate(.5).darken(.1).hexString()}const qt=Object.create(null),Kt=Object.create(null);function Zt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;et.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>Jt(e.backgroundColor),this.hoverBorderColor=(t,e)=>Jt(e.borderColor),this.hoverColor=(t,e)=>Jt(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return te(this,t,e)}get(t){return Zt(this,t)}describe(t,e){return te(Kt,t,e)}override(t,e){return te(qt,t,e)}route(t,e,i,s){const o=Zt(this,t),r=Zt(this,i),h="_"+e;Object.defineProperties(o,{[h]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[h],e=r[s];return n(t)?Object.assign({},e,t):a(t,e)},set(t){this[h]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function ie(){return"undefined"!=typeof window&&"undefined"!=typeof document}function se(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function ne(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const oe=t=>window.getComputedStyle(t,null);function re(t,e){return oe(t).getPropertyValue(e)}const ae=["top","right","bottom","left"];function he(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=ae[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function le(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=oe(i),o="border-box"===n.boxSizing,r=he(n,"padding"),a=he(n,"border","width"),{x:h,y:l,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let r,a,h=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(n,o,t.target))r=n,a=o;else{const t=e.getBoundingClientRect();r=s.clientX-t.left,a=s.clientY-t.top,h=!0}return{x:r,y:a,box:h}}(t,i),d=r.left+(c&&a.left),u=r.top+(c&&a.top);let{width:g,height:p}=e;return o&&(g-=r.width+a.width,p-=r.height+a.height),{x:Math.round((h-d)/g*i.width/s),y:Math.round((l-u)/p*i.height/s)}}const ce=t=>Math.round(10*t)/10;function de(t,e,i,s){const n=oe(t),o=he(n,"margin"),r=ne(n.maxWidth,t,"clientWidth")||E,a=ne(n.maxHeight,t,"clientHeight")||E,h=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=se(t);if(o){const t=o.getBoundingClientRect(),r=oe(o),a=he(r,"border","width"),h=he(r,"padding");e=t.width-h.width-a.width,i=t.height-h.height-a.height,s=ne(r.maxWidth,o,"clientWidth"),n=ne(r.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||E,maxHeight:n||E}}(t,e,i);let{width:l,height:c}=h;if("content-box"===n.boxSizing){const t=he(n,"border","width"),e=he(n,"padding");l-=e.width+t.width,c-=e.height+t.height}return l=Math.max(0,l-o.width),c=Math.max(0,s?Math.floor(l/s):c-o.height),l=ce(Math.min(l,r,h.maxWidth)),c=ce(Math.min(c,a,h.maxHeight)),l&&!c&&(c=ce(l/2)),{width:l,height:c}}function ue(t,e,i){const s=e||1,n=Math.floor(t.height*s),o=Math.floor(t.width*s);t.height=n/s,t.width=o/s;const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||r.height!==n||r.width!==o)&&(t.currentDevicePixelRatio=s,r.height=n,r.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const ge=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function pe(t,e){const i=re(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function fe(t){return!t||i(t.size)||i(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function me(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function ye(t,e,i,n){let o=(n=n||{}).data=n.data||{},r=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},r=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let a=0;const h=i.length;let l,c,d,u,g;for(l=0;li.length){for(l=0;l0&&t.stroke()}}function we(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.xe.top-i&&t.y0&&""!==a.strokeColor;let c,d;for(t.save(),t.font=r.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),i(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,a),c=0;ct[0])){A(s)||(s=We("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:n,override:n=>Ee([n,...t],e,i,s)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>Le(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=We(Oe(o,t),i),A(n))return Re(t,n)?Ne(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>Ve(t).includes(e),ownKeys:t=>Ve(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function Ie(t,e,i,o){const r={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Te(t,o),setContext:e=>Ie(t,e,i,o),override:s=>Ie(t.override(s),e,i,o)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Le(t,e,(()=>function(t,e,i){const{_proxy:o,_context:r,_subProxy:a,_descriptors:h}=t;let l=o[e];return k(l)&&h.isScriptable(e)&&(l=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);return a.add(t),e=e(o,r||s),a.delete(t),Re(t,e)&&(e=Ne(n._scopes,n,t,e)),e}(e,l,t,i)),s(l)&&l.length&&(l=function(t,e,i,s){const{_proxy:o,_context:r,_subProxy:a,_descriptors:h}=i;if(A(r.index)&&s(t))e=e[r.index%e.length];else if(n(e[0])){const i=e,s=o._scopes.filter((t=>t!==i));e=[];for(const n of i){const i=Ne(s,o,t,n);e.push(Ie(i,r,a&&a[t],h))}}return e}(e,l,t,h.isIndexable)),Re(e,l)&&(l=Ie(l,r,a&&a[e],h)),l}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Te(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:k(i)?i:()=>i,isIndexable:k(s)?s:()=>s}}const Oe=(t,e)=>t?t+w(e):e,Re=(t,e)=>n(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Le(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const s=i();return t[e]=s,s}function ze(t,e,i){return k(t)?t(e,i):t}const He=(t,e)=>!0===t?e:"string"==typeof t?v(e,t):void 0;function Be(t,e,i,s,n){for(const o of e){const e=He(i,o);if(e){t.add(e);const o=ze(e._fallback,i,n);if(A(o)&&o!==i&&o!==s)return o}else if(!1===e&&A(s)&&i!==s)return null}return!1}function Ne(t,e,i,o){const r=e._rootScopes,a=ze(e._fallback,i,o),h=[...t,...r],l=new Set;l.add(o);let c=Fe(l,h,i,a||i,o);return null!==c&&(!A(a)||a===i||(c=Fe(l,h,a,c,o),null!==c))&&Ee(Array.from(l),[""],r,a,(()=>function(t,e,i){const o=t._getTarget();e in o||(o[e]={});const r=o[e];return s(r)&&n(i)?i:r}(e,i,o)))}function Fe(t,e,i,s,n){for(;i;)i=Be(t,e,i,s,n);return i}function We(t,e){for(const i of e){if(!i)continue;const e=i[t];if(A(e))return e}}function Ve(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function je(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,r=new Array(s);let a,h,l,c;for(a=0,h=s;ae"x"===t?"y":"x";function Ue(t,e,i,s){const n=t.skip?e:t,o=e,r=i.skip?e:i,a=U(o,n),h=U(r,o);let l=a/(a+h),c=h/(a+h);l=isNaN(l)?0:l,c=isNaN(c)?0:c;const d=s*l,u=s*c;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+u*(r.x-n.x),y:o.y+u*(r.y-n.y)}}}function Qe(t,e="x"){const i=Ge(e),s=t.length,n=Array(s).fill(0),o=Array(s);let r,a,h,l=Ye(t,0);for(r=0;r!t.skip))),"monotone"===e.cubicInterpolationMode)Qe(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,r=t.length;o0===t||1===t,Ke=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*D/i),Ze=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*D/i)+1,ti={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*T),easeOutSine:t=>Math.sin(t*T),easeInOutSine:t=>-.5*(Math.cos(S*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>qe(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>qe(t)?t:Ke(t,.075,.3),easeOutElastic:t=>qe(t)?t:Ze(t,.075,.3),easeInOutElastic(t){const e=.1125;return qe(t)?t:t<.5?.5*Ke(2*t,e,.45):.5+.5*Ze(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-ti.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*ti.easeInBounce(2*t):.5*ti.easeOutBounce(2*t-1)+.5};function ei(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function ii(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function si(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},r=ei(t,n,i),a=ei(n,o,i),h=ei(o,e,i),l=ei(r,a,i),c=ei(a,h,i);return ei(l,c,i)}const ni=new Map;function oi(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=ni.get(i);return s||(s=new Intl.NumberFormat(t,e),ni.set(i,s)),s}(e,i).format(t)}const ri=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),ai=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function hi(t,e){const i=(""+t).match(ri);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function li(t,e){const i={},s=n(e),o=s?Object.keys(e):e,r=n(t)?s?i=>a(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=+r(t)||0;return i}function ci(t){return li(t,{top:"y",right:"x",bottom:"y",left:"x"})}function di(t){return li(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ui(t){const e=ci(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function gi(t,e){t=t||{},e=e||ee.font;let i=a(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=a(t.style,e.style);s&&!(""+s).match(ai)&&(console.warn('Invalid font style specified: "'+s+'"'),s="");const n={family:a(t.family,e.family),lineHeight:hi(a(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:a(t.weight,e.weight),string:""};return n.string=fe(n),n}function pi(t,e,i,n){let o,r,a,h=!0;for(o=0,r=t.length;oi&&0===t?0:t+e;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function mi(t,e){return Object.assign(Object.create(t),e)}function yi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function bi(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function xi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function vi(t){return"angle"===t?{between:J,compare:Q,normalize:X}:{between:Z,compare:(t,e)=>t-e,normalize:t=>t}}function _i({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function wi(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,r=e.length,{compare:a,between:h,normalize:l}=vi(s),{start:c,end:d,loop:u,style:g}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:r,normalize:a}=vi(s),h=e.length;let l,c,{start:d,end:u,loop:g}=t;if(g){for(d+=h,u+=h,l=0,c=h;ln&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);return function(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const n=t._chart.getContext(),o=Mi(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,h=i.length,l=[];let c=o,d=e[0].start,u=d;function g(t,e,s,n){const o=a?-1:1;if(t!==e){for(t+=h;i[t%h].skip;)t-=o;for(;i[e%h].skip;)e+=o;t%h!=e%h&&(l.push({start:t%h,end:e%h,loop:s,style:n}),c=n,d=e%h)}}for(const t of e){d=a?d:t.start;let e,o=i[d%h];for(u=d+1;u<=t.end;u++){const a=i[u%h];e=Mi(s.setContext(mi(n,{type:"segment",p0:o,p1:a,p0DataIndex:(u-1)%h,p1DataIndex:u%h,datasetIndex:r}))),Ci(e,c)&&g(d,u-1,t.loop,c),o=a,c=e}d{t[r](e[i],n)&&(o.push({element:t,datasetIndex:s,index:h}),a=a||t.inRange(e.x,e.y,n))})),s&&!a?[]:o}var Oi={evaluateInteractionItems:Pi,modes:{index(t,e,i,s){const n=le(e,t),o=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?Ei(t,n,o,s,r):Ii(t,n,o,!1,s,r),h=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&h.push({element:i,datasetIndex:t.index,index:e})})),h):[]},dataset(t,e,i,s){const n=le(e,t),o=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?Ei(t,n,o,s,r):Ii(t,n,o,!1,s,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;tEi(t,le(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=le(e,t),o=i.axis||"xy",r=i.includeInvisible||!1;return Ii(t,n,o,i.intersect,s,r)},x:(t,e,i,s)=>Ti(t,le(e,t),"x",i.intersect,s),y:(t,e,i,s)=>Ti(t,le(e,t),"y",i.intersect,s)}};const Ri=["left","top","right","bottom"];function Li(t,e){return t.filter((t=>t.pos===e))}function zi(t,e){return t.filter((t=>-1===Ri.indexOf(t.pos)&&t.box.axis===e))}function Hi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function Bi(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function Ni(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 Fi(t,e,i,s){const{pos:o,box:r}=i,a=t.maxPadding;if(!n(o)){i.size&&(t[o]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?r.height:r.width),i.size=e.size/e.count,t[o]+=i.size}r.getPadding&&Ni(a,r.getPadding());const h=Math.max(0,e.outerWidth-Bi(a,t,"left","right")),l=Math.max(0,e.outerHeight-Bi(a,t,"top","bottom")),c=h!==t.w,d=l!==t.h;return t.w=h,t.h=l,i.horizontal?{same:c,other:d}:{same:d,other:c}}function Wi(t,e){const i=e.maxPadding;return function(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}(t?["left","right"]:["top","bottom"])}function Vi(t,e,i,s){const n=[];let o,r,a,h,l,c;for(o=0,r=t.length,l=0;ot.box.fullSize)),!0),s=Hi(Li(e,"left"),!0),n=Hi(Li(e,"right")),o=Hi(Li(e,"top"),!0),r=Hi(Li(e,"bottom")),a=zi(e,"x"),h=zi(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(h).concat(r).concat(a),chartArea:Li(e,"chartArea"),vertical:s.concat(n).concat(h),horizontal:o.concat(r).concat(a)}}(t.boxes),h=a.vertical,l=a.horizontal;d(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=h.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,u=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/c,hBoxMaxHeight:r/2}),g=Object.assign({},n);Ni(g,ui(s));const p=Object.assign({maxPadding:g,w:o,h:r,x:n.left,y:n.top},n),f=function(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Ri.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,r,a;for(o=0,r=t.length;o{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Gi{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Ui extends Gi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Qi={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Xi=t=>null===t||""===t,Ji=!!ge&&{passive:!0};function qi(t,e,i){t.canvas.removeEventListener(e,i,Ji)}function Ki(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function Zi(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Ki(i.addedNodes,s),e=e&&!Ki(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function ts(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Ki(i.removedNodes,s),e=e&&!Ki(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const es=new Map;let is=0;function ss(){const t=window.devicePixelRatio;t!==is&&(is=t,es.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ns(t,e,i){const s=t.canvas,n=s&&se(s);if(!n)return;const o=lt(((t,e)=>{const s=n.clientWidth;i(t,e),s{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)}));return r.observe(n),function(t,e){es.size||window.addEventListener("resize",ss),es.set(t,e)}(t,o),r}function os(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){es.delete(t),es.size||window.removeEventListener("resize",ss)}(t)}function rs(t,e,i){const s=t.canvas,n=lt((e=>{null!==t.ctx&&i(function(t,e){const i=Qi[t.type]||t.type,{x:s,y:n}=le(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,Ji)}(s,e,n),n}class as extends Gi{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t.$chartjs={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Xi(n)){const e=pe(t,"width");void 0!==e&&(t.width=e)}if(Xi(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=pe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const s=e.$chartjs.initial;["height","width"].forEach((t=>{const n=s[t];i(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=s.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:Zi,detach:ts,resize:ns}[e]||rs;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];s&&(({attach:os,detach:os,resize:os}[e]||qi)(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return de(t,e,i,s)}isAttached(t){const e=se(t);return!(!e||!e.isConnected)}}function hs(t){return!ie()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Ui:as}var ls=Object.freeze({__proto__:null,_detectPlatform:hs,BasePlatform:Gi,BasicPlatform:Ui,DomPlatform:as});const cs="transparent",ds={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Xt(t||cs),n=s.valid&&Xt(e||cs);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class us{constructor(t,e,i,s){const n=e[i];s=pi([t.to,s,n,t.from]);const o=pi([t.from,n,s]);this._active=!0,this._fn=t.fn||ds[t.type||typeof o],this._easing=ti[t.easing]||ti.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=pi([t.to,e,s,t.from]),this._from=pi([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,r=this._to;let a;if(this._active=n!==r&&(o||e1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[s]=this._fn(n,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),ee.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),ee.describe("animations",{_fallback:"animation"}),ee.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}});class ps{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!n(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((i=>{const o=t[i];if(!n(o))return;const r={};for(const t of gs)r[t]=o[t];(s(o.properties)&&o.properties||[i]).forEach((t=>{t!==i&&e.has(t)||e.set(t,r)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(i)return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i;t.options=e}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),r=Date.now();let a;for(a=o.length-1;a>=0;--a){const h=o[a];if("$"===h.charAt(0))continue;if("options"===h){s.push(...this._animateOptions(t,e));continue}const l=e[h];let c=n[h];const d=i.get(h);if(c){if(d&&c.active()){c.update(d,l,r);continue}c.cancel()}d&&d.duration?(n[h]=c=new us(d,t,h,l),s.push(c)):t[h]=l}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(mt.add(this._chart,i),!0):void 0}}function fs(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function ms(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n0||!i&&e<0)return n.index}return null}function _s(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:r,index:a}=s,h=o.axis,l=r.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,r,s),d=e.length;let u;for(let t=0;ti[t].axis===e)).shift()}function As(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i]}}}const ks=t=>"reset"===t||"none"===t,Ms=(t,e)=>e?t:Object.assign({},t);class Cs{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.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=bs(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&As(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=a(i.xAxisID,ws(t,"x")),o=e.yAxisID=a(i.yAxisID,ws(t,"y")),r=e.rAxisID=a(i.rAxisID,ws(t,"r")),h=e.indexAxis,l=e.iAxisID=s(h,n,o,r),c=e.vAxisID=s(h,o,n,r);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&rt(this._data,this),t._stacked&&As(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(n(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,n,o;for(s=0,n=e.length;s0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=o,i._sorted=!0,d=o;else{d=s(o[t])?this.parseArrayData(i,o,t,e):n(o[t])?this.parseObjectData(i,o,t,e):this.parsePrimitiveData(i,o,t,e);const r=()=>null===c[h]||g&&c[h]t&&!e.hidden&&e._stacked&&{keys:ms(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(a);let u,g;function p(){g=s[u];const e=g[a.axis];return!o(g[t.axis])||c>e||d=0;--u)if(!p()){this.updateRangeFromParsed(l,t,g,h);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,r;for(s=0,n=e.length;s=0&&tthis.getContext(i,s)),c);return g.$shared&&(g.$shared=a,n[o]=Object.freeze(Ms(g,a))),g}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,r=n[o];if(r)return r;let a;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);a=s.createResolver(o,this.getContext(t,i,e))}const h=new ps(s,a&&a.animations);return a&&a._cacheable&&(n[o]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ks(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){ks(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!ks(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n{for(t.length+=e,r=t.length-1;r>=o;r--)t[r]=t[r-e]};for(a(n),r=t;r{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}Ss.defaults={},Ss.defaultRoutes=void 0;const Ds={values:t=>s(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t)),i}(t,i)}const r=L(Math.abs(o)),a=Math.max(Math.min(-1*Math.floor(r),20),0),h={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(h,this.options.ticks.format),oi(t,s,h)},logarithmic(t,e,i){if(0===t)return"0";const s=t/Math.pow(10,Math.floor(L(t)));return 1===s||2===s||5===s?Ds.numeric.call(this,t,e,i):""}};var Ps={formatters:Ds};function Es(t,e){const s=t.options.ticks,n=s.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),o=s.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;in)return function(t,e,i,s){let n,o=0,r=i[0];for(s=Math.ceil(s),n=0;nn)return e}return Math.max(n,1)}(o,e,n);if(r>0){let t,s;const n=r>1?Math.round((h-a)/(r-1)):null;for(Is(e,l,c,i(n)?0:a-n,a),t=0,s=r-1;te.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Ps.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),ee.route("scale.ticks","color","","color"),ee.route("scale.grid","color","","borderColor"),ee.route("scale.grid","borderColor","","borderColor"),ee.route("scale.title","color","","color"),ee.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),ee.describe("scales",{_fallback:"scale"}),ee.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const Ts=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Os(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;or+a)))return l}function Ls(t){return t.drawTicks?t.tickLength:0}function zs(t,e){if(!t.display)return 0;const i=gi(t.font,e),n=ui(t.padding);return(s(t.text)?t.text.length:1)*i.lineHeight+n.height}function Hs(t,e,i){let s=dt(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class Bs extends Ss{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=r(t,Number.POSITIVE_INFINITY),e=r(e,Number.NEGATIVE_INFINITY),i=r(i,Number.POSITIVE_INFINITY),s=r(s,Number.NEGATIVE_INFINITY),{min:r(t,i),max:r(e,s),minDefined:o(t),maxDefined:o(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,h=a.length;rs?s:i,s=n&&i>s?i:s,{min:r(i,r(s,i)),max:r(s,r(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){c(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,r=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=fi(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const l=this._getLabelSizes(),c=l.widest.width,d=l.highest.height,u=q(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),r=this.maxHeight-Ls(t.grid)-e.padding-zs(t.title,this.chart.options.font),a=Math.sqrt(c*c+d*d),h=$(Math.min(Math.asin(q((l.highest.height+6)/o,-1,1)),Math.asin(q(r/a,-1,1))-Math.asin(q(d/a,-1,1)))),h=Math.max(s,Math.min(n,h))),this.labelRotation=h}afterCalculateLabelRotation(){c(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){c(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),r=this.isHorizontal();if(o){const o=zs(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=Ls(n)+o):(t.height=this.maxHeight,t.width=Ls(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),a=2*i.padding,h=j(this.labelRotation),l=Math.cos(h),c=Math.sin(h);if(r){const e=i.mirror?0:c*n.width+l*o.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:l*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,s,c,l)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:r}=this.options,a=0!==this.labelRotation,h="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,l=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;a?h?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-r+o)*this.width/(this.width-r),0),this.paddingRight=Math.max((d-l+o)*this.width/(this.width-l),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){c(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,s;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,s=t.length;e{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n({width:r[t]||0,height:a[t]||0});return{first:k(0),last:k(e-1),widest:k(w),highest:k(A),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return K(this._alignToPixels?be(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&tr*s?r/i:a/s:a*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:o,position:r}=s,h=o.offset,l=this.isHorizontal(),c=this.ticks.length+(h?1:0),d=Ls(o),u=[],g=o.setContext(this.getContext()),p=g.drawBorder?g.borderWidth:0,f=p/2,m=function(t){return be(i,t,p)};let y,b,x,v,_,w,A,k,M,C,S,D;if("top"===r)y=m(this.bottom),w=this.bottom-d,k=y-f,C=m(t.top)+f,D=t.bottom;else if("bottom"===r)y=m(this.top),C=t.top,D=m(t.bottom)-f,w=y+f,k=this.top+d;else if("left"===r)y=m(this.right),_=this.right-d,A=y-f,M=m(t.left)+f,S=t.right;else if("right"===r)y=m(this.left),M=t.left,S=m(t.right)-f,_=y+f,A=this.left+d;else if("x"===e){if("center"===r)y=m((t.top+t.bottom)/2+.5);else if(n(r)){const t=Object.keys(r)[0],e=r[t];y=m(this.chart.scales[t].getPixelForValue(e))}C=t.top,D=t.bottom,w=y+f,k=w+d}else if("y"===e){if("center"===r)y=m((t.left+t.right)/2);else if(n(r)){const t=Object.keys(r)[0],e=r[t];y=m(this.chart.scales[t].getPixelForValue(e))}_=y-f,A=_-d,M=t.left,S=t.right}const P=a(s.ticks.maxTicksLimit,c),E=Math.max(1,Math.ceil(c/P));for(b=0;be.value===t));return i>=0?e.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const r=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),r=e[i].split("."),a=r.pop(),h=r.join(".");ee.route(o,n,h,a)}))}(e,t.defaultRoutes),t.descriptors&&ee.describe(e,t.descriptors)}(t,o,i),this.override&&ee.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ee[s]&&(delete ee[s][i],this.override&&delete qt[i])}}var Fs=new class{constructor(){this.controllers=new Ns(Cs,"datasets",!0),this.elements=new Ns(Ss,"elements"),this.plugins=new Ns(Object,"plugins"),this.scales=new Ns(Bs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):d(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=w(t);c(i["before"+s],[],i),e[t](i),c(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;et.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Vs(t,e){return e||!1!==t?!0===t?{}:t:null}function js(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),r=t.getOptionScopes(s,o);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function $s(t,e){const i=ee.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Ys(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function Gs(t){const e=t.options||(t.options={});e.plugins=a(e.plugins,{}),e.scales=function(t,e){const i=qt[t.type]||{scales:{}},s=e.scales||{},o=$s(t.type,e),r=Object.create(null),a=Object.create(null);return Object.keys(s).forEach((t=>{const e=s[t];if(!n(e))return console.error(`Invalid scale configuration for scale: ${t}`);if(e._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const h=Ys(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(h,o),c=i.scales||{};r[h]=r[h]||t,a[t]=y(Object.create(null),[{axis:h},e,c[h],c[l]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||$s(n,e),h=(qt[n]||{}).scales||{};Object.keys(h).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,o),n=i[e+"AxisID"]||r[e]||e;a[n]=a[n]||Object.create(null),y(a[n],[{axis:e},s[n],h[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];y(e,[ee.scales[e.type],ee.scale])})),a}(t,e)}function Us(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Qs=new Map,Xs=new Set;function Js(t,e){let i=Qs.get(t);return i||(i=e(),Qs.set(t,i),Xs.add(i)),i}const qs=(t,e,i)=>{const s=v(e,i);void 0!==s&&t.add(s)};class Ks{constructor(t){this._config=function(t){return(t=t||{}).data=Us(t.data),Gs(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Us(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Gs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Js(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Js(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Js(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Js(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),r=o.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>qs(a,t,e)))),e.forEach((t=>qs(a,s,t))),e.forEach((t=>qs(a,qt[n]||{},t))),e.forEach((t=>qs(a,ee,t))),e.forEach((t=>qs(a,Kt,t)))}));const h=Array.from(a);return 0===h.length&&h.push(Object.create(null)),Xs.has(e)&&o.set(e,h),h}chartOptionScopes(){const{options:t,type:e}=this;return[t,qt[e]||{},ee.datasets[e]||{},{type:e},ee,Kt]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Zs(this._resolverCache,t,n);let h=r;(function(t,e){const{isScriptable:i,isIndexable:n}=Te(t);for(const o of e){const e=i(o),r=n(o),a=(r||e)&&t[o];if(e&&(k(a)||tn(a))||r&&s(a))return!0}return!1})(r,e)&&(o.$shared=!1,h=Ie(r,i=k(i)?i():i,this.createResolver(t,i,a)));for(const t of e)o[t]=h[t];return o}createResolver(t,e,i=[""],s){const{resolver:o}=Zs(this._resolverCache,t,i);return n(e)?Ie(o,e,void 0,s):o}}function Zs(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);return o||(o={resolver:Ee(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)),o}const tn=t=>n(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||k(t[i])),!1),en=["top","bottom","left","right","chartArea"];function sn(t,e){return"top"===t||"bottom"===t||-1===en.indexOf(t)&&"x"===e}function nn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function on(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),c(i&&i.onComplete,[t],e)}function rn(t){const e=t.chart,i=e.options.animation;c(i&&i.onProgress,[t],e)}function an(t){return ie()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const hn={},ln=t=>{const e=an(t);return Object.values(hn).filter((t=>t.canvas===e)).pop()};function cn(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class dn{constructor(t,i){const s=this.config=new Ks(i),n=an(t),o=ln(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||hs(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),h=a&&a.canvas,l=h&&h.height,c=h&&h.width;this.id=e(),this.ctx=a,this.canvas=h,this.width=c,this.height=l,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Ws,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ct((t=>this.update(t)),r.resizeDelay||0),this._dataChanges=[],hn[this.id]=this,a&&h?(mt.listen(this,"complete",on),mt.listen(this,"progress",rn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return i(t)?e&&o?o:n?s/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ue(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return xe(this.canvas,this.ctx),this}stop(){return mt.stop(this),this}resize(t,e){mt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ue(this,r,!0)&&(this.notifyPlugins("resize",{size:o}),c(i.onResize,[this,o],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){d(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=Ys(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),d(n,(e=>{const n=e.options,o=n.id,r=Ys(o,n),h=a(n.type,e.dtype);void 0!==n.position&&sn(n.position,r)===sn(e.dposition)||(n.position=e.dposition),s[o]=!0;let l=null;o in i&&i[o].type===h?l=i[o]:(l=new(Fs.getScale(h))({id:o,type:h,ctx:this.ctx,chart:this}),i[l.id]=l),l.init(n,t)})),d(s,((t,e)=>{t||delete i[e]})),d(i,(t=>{Yi.configure(this,t,t.options),Yi.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(nn("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){d(this.scales,(t=>{Yi.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);M(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e)cn(t,s,"_removeElements"===i?-n:n)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=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}))return;Yi.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],d(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,n=this.chartArea,o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(s&&Ae(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),s&&ke(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return we(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Oi.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=mi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);A(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),mt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};d(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():o()}unbindEvents(){d(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},d(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,r,a;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),r=0,a=t.length;r{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!u(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),r=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,r=this._getActiveElements(t,s,i,o),a=C(t),h=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,c(n.onHover,[t,r,this],this),a&&c(n.onClick,[t,r,this],this));const l=!u(r,s);return(l||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=h,l}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}const un=()=>d(dn.instances,(t=>t._plugins.invalidate())),gn=!0;function pn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}Object.defineProperties(dn,{defaults:{enumerable:gn,value:ee},instances:{enumerable:gn,value:hn},overrides:{enumerable:gn,value:qt},registry:{enumerable:gn,value:Fs},version:{enumerable:gn,value:"3.9.1"},getChart:{enumerable:gn,value:ln},register:{enumerable:gn,value:(...t)=>{Fs.add(...t),un()}},unregister:{enumerable:gn,value:(...t)=>{Fs.remove(...t),un()}}});class fn{constructor(t){this.options=t||{}}init(t){}formats(){return pn()}parse(t,e){return pn()}format(t,e){return pn()}add(t,e,i){return pn()}diff(t,e,i){return pn()}startOf(t,e,i){return pn()}endOf(t,e){return pn()}}fn.override=function(t){Object.assign(fn.prototype,t)};var mn={_date:fn};function yn(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;et-e)))}return t._cache.$bar}(e,t.type);let s,n,o,r,a=e._length;const h=()=>{32767!==o&&-32768!==o&&(A(r)&&(a=Math.min(a,Math.abs(o-r)||a)),r=o)};for(s=0,n=i.length;sMath.abs(a)&&(h=a,l=r),e[i.axis]=l,e._custom={barStart:h,barEnd:l,start:n,end:o,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function xn(t,e,i,s){const n=t.iScale,o=t.vScale,r=n.getLabels(),a=n===o,h=[];let l,c,d,u;for(l=i,c=i+s;lt.x,i="left",s="right"):(e=t.baset.controller.options.grouped)),o=s.options.stacked,r=[],a=t=>{const s=t.controller.getParsed(e),n=s&&s[t.vScale.axis];if(i(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!a(i))&&((!1===o||-1===r.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&r.push(i.stack),i.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n=i?1:-1)}(d,e,r)*o,u===r&&(m-=d/2);const t=e.getPixelForDecimal(0),i=e.getPixelForDecimal(1),s=Math.min(t,i),n=Math.max(t,i);m=Math.max(Math.min(m,n),s),c=m+d}if(m===e.getPixelForValue(r)){const t=z(d)*e.getLineWidthForValue(r)/2;m+=t,d-=t}return{size:d,base:m,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const s=e.scale,n=this.options,o=n.skipNull,r=a(n.maxBarThickness,1/0);let h,l;if(e.grouped){const s=o?this._getStackCount(t):e.stackCount,a="flex"===n.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let r=t>0?n[t-1]:null,a=t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:s}=e,n=this.getParsed(t),o=i.getLabelForValue(n.x),r=s.getLabelForValue(n.y),a=n._custom;return{label:e.label,value:"("+o+", "+r+(a?", "+a:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:h}=this._getSharedOptions(e,s),l=o.axis,c=r.axis;for(let d=e;d""}}}};class Sn extends Cs{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let o,r,a=t=>+i[t];if(n(i[t])){const{key:t="value"}=this._parsing;a=e=>+v(i[e],t)}for(o=t,r=t+e;oJ(t,a,h,!0)?1:Math.max(e,e*i,s,s*i),p=(t,e,s)=>J(t,a,h,!0)?-1:Math.min(e,e*i,s,s*i),f=g(0,l,d),m=g(T,c,u),y=p(S,l,d),b=p(S+T,c,u);s=(f-y)/2,n=(m-b)/2,o=-(f+y)/2,r=-(m+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}(u,d,a),y=(i.width-o)/g,b=(i.height-o)/p,x=Math.max(Math.min(y,b)/2,0),v=l(this.options.radius,x),_=(v-Math.max(v*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*v,this.offsetY=m*v,s.total=this.calculateTotal(),this.outerRadius=v-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*c,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/D)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,r=o.chartArea,a=o.options.animation,h=(r.left+r.right)/2,l=(r.top+r.bottom)/2,c=n&&a.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:g,includeOptions:p}=this._getSharedOptions(e,s);let f,m=this._getRotation();for(f=0;f0&&!isNaN(t)?D*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=oi(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,r,a;if(!t)for(s=0,n=i.data.datasets.length;s"spacing"!==t,_indexable:t=>"spacing"!==t},Sn.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return s(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class Dn extends Cs{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:r,count:a}=pt(e,s,o);this._drawStart=r,this._drawCount=a,ft(e)&&(r=0,a=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:h},t),this.updateElements(s,r,a,t)}updateElements(t,e,s,n){const o="reset"===n,{iScale:r,vScale:a,_stacked:h,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,n),u=r.axis,g=a.axis,{spanGaps:p,segment:f}=this.options,m=N(p)?p:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||o||"none"===n;let b=e>0&&this.getParsed(e-1);for(let p=e;p0&&Math.abs(s[u]-b[u])>m,f&&(x.parsed=s,x.raw=l.data[p]),d&&(x.options=c||this.resolveDataElementOptions(p,e.active?"active":n)),y||this.updateElement(e,p,x,n),b=s}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Dn.id="line",Dn.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},Dn.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Pn extends Cs{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=oi(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return je.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,r=o.options.animation,a=this._cachedMeta.rScale,h=a.xCenter,l=a.yCenter,c=a.getIndexAngle(0)-.5*S;let d,u=c;const g=360/this.countVisibleElements();for(d=0;d{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?j(this.resolveDataElementOptions(t,e).angle||i):0}}Pn.id="polarArea",Pn.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},Pn.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class En extends Sn{}En.id="pie",En.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class In extends Cs{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return je.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let r=e;r0&&this.getParsed(e-1);for(let c=e;c0&&Math.abs(s[g]-x[g])>y,m&&(f.parsed=s,f.raw=l.data[c]),u&&(f.options=d||this.resolveDataElementOptions(c,e.active?"active":n)),b||this.updateElement(e,c,f,n),x=s}this.updateSharedOptions(d,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}}Tn.id="scatter",Tn.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1},Tn.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var On=Object.freeze({__proto__:null,BarController:Mn,BubbleController:Cn,DoughnutController:Sn,LineController:Dn,PolarAreaController:Pn,PieController:En,RadarController:In,ScatterController:Tn});function Rn(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:h}=e;let l=n/a;t.beginPath(),t.arc(o,r,a,s-l,i+l),h>n?(l=n/h,t.arc(o,r,h,i+l,s-l,!0)):t.arc(o,r,n,i+T,s-T),t.closePath(),t.clip()}function Ln(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function zn(t,e,i,s,n,o){const{x:r,y:a,startAngle:h,pixelMargin:l,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-l,0),u=c>0?c+s+i+l:0;let g=0;const p=n-h;if(s){const t=((c>0?c-s:0)+(d>0?d-s:0))/2;g=(p-(0!==t?p*t/(t+s):p))/2}const f=(p-Math.max(.001,p*d-i/S)/d)/2,m=h+f+g,y=n-f-g,{outerStart:b,outerEnd:x,innerStart:v,innerEnd:_}=function(t,e,i,s){const n=li(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),o=(i-e)/2,r=Math.min(o,s*e/2),a=t=>{const e=(i-Math.min(o,t))*s/2;return q(t,0,Math.min(o,e))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:q(n.innerStart,0,r),innerEnd:q(n.innerEnd,0,r)}}(e,u,d,y-m),w=d-b,A=d-x,k=m+b/w,M=y-x/A,C=u+v,D=u+_,P=m+v/C,E=y-_/D;if(t.beginPath(),o){if(t.arc(r,a,d,k,M),x>0){const e=Ln(A,M,r,a);t.arc(e.x,e.y,x,M,y+T)}const e=Ln(D,y,r,a);if(t.lineTo(e.x,e.y),_>0){const e=Ln(D,E,r,a);t.arc(e.x,e.y,_,y+T,E+Math.PI)}if(t.arc(r,a,u,y-_/u,m+v/u,!0),v>0){const e=Ln(C,P,r,a);t.arc(e.x,e.y,v,P+Math.PI,m-T)}const i=Ln(w,m,r,a);if(t.lineTo(i.x,i.y),b>0){const e=Ln(w,k,r,a);t.arc(e.x,e.y,b,m-T,k)}}else{t.moveTo(r,a);const e=Math.cos(k)*d+r,i=Math.sin(k)*d+a;t.lineTo(e,i);const s=Math.cos(M)*d+r,n=Math.sin(M)*d+a;t.lineTo(s,n)}t.closePath()}class Hn extends Ss{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:n,distance:o}=G(s,{x:t,y:e}),{startAngle:r,endAngle:h,innerRadius:l,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=this.options.spacing/2,g=a(d,h-r)>=D||J(n,r,h),p=Z(o,l+u,c+u);return g&&p}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:a,spacing:h}=this.options,l=(s+n)/2,c=(o+r+h+a)/2;return{x:e+Math.cos(l)*c,y:i+Math.sin(l)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>D?Math.floor(i/D):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let r=0;if(s){r=s/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*r,Math.sin(e)*r),this.circumference>=S&&(r=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const a=function(t,e,i,s,n){const{fullCircles:o,startAngle:r,circumference:a}=e;let h=e.endAngle;if(o){zn(t,e,i,s,r+D,n);for(let e=0;ea&&o>a;return{count:s,start:h,loop:e.loop,ilen:l(r+(l?a-t:t))%o,x=()=>{g!==p&&(t.lineTo(m,p),t.lineTo(m,g),t.lineTo(m,f))};for(h&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=a;++c){if(d=n[b(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(ip&&(p=i),m=(y*m+e)/++y):(x(),t.lineTo(e,i),u=s,y=0,g=p=i),f=i}x()}function jn(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?Wn:Vn}Hn.id="arc",Hn.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0},Hn.defaultRoutes={backgroundColor:"backgroundColor"};const $n="function"==typeof Path2D;class Yn extends Ss{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;Je(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=ki(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=Ai(this,{property:e,start:s,end:s});if(!o.length)return;const r=[],a=function(t){return t.stepped?ii:t.tension||"monotone"===t.cubicInterpolationMode?si:ei}(i);let h,l;for(h=0,l=o.length;h"borderDash"!==t&&"fill"!==t};class Un extends Ss{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2){io(t)}))}var no={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,s)=>{if(!s.enabled)return void so(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:r,indexAxis:a}=e,h=t.getDatasetMeta(o),l=r||e.data;if("y"===pi([a,t.options.indexAxis]))return;if(!h.controller.supportsDecimation)return;const c=t.scales[h.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let d,{start:u,count:g}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:r,max:a,minDefined:h,maxDefined:l}=o.getUserBounds();return h&&(n=q(et(e,o.axis,r).lo,0,i-1)),s=l?q(et(e,o.axis,a).hi+1,n,i)-n:i-n,{start:n,count:s}}(h,l);if(g<=(s.threshold||4*n))io(e);else{switch(i(r)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),s.algorithm){case"lttb":d=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(o-2);let h=0;const l=e+i-1;let c,d,u,g,p,f=e;for(r[h++]=t[f],c=0;cu&&(u=g,d=t[s],p=s);r[h++]=d,f=p}return r[h++]=t[l],r}(l,u,g,n,s);break;case"min-max":d=function(t,e,s,n){let o,r,a,h,l,c,d,u,g,p,f=0,m=0;const y=[],b=e+s-1,x=t[e].x,v=t[b].x-x;for(o=e;op&&(p=h,d=o),f=(m*f+r.x)/++m;else{const s=o-1;if(!i(c)&&!i(d)){const e=Math.min(c,d),i=Math.max(c,d);e!==u&&e!==s&&y.push({...t[e],x:f}),i!==u&&i!==s&&y.push({...t[i],x:f})}o>0&&s!==u&&y.push(t[s]),y.push(r),l=e,m=0,g=p=h,c=d=u=o}}return y}(l,u,g,n);break;default:throw new Error(`Unsupported decimation algorithm '${s.algorithm}'`)}e._decimated=d}}))},destroy(t){so(t)}};function oo(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=X(n),o=X(o)),{property:t,start:n,end:o}}function ro(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function ao(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function ho(t,e){let i=[],n=!1;return s(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=ro(t,e,n);const r=n[t],a=n[e];null!==s?(o.push({x:r.x,y:s}),o.push({x:a.x,y:s})):null!==i&&(o.push({x:i,y:r.y}),o.push({x:i,y:a.y}))})),o}(t,e),i.length?new Yn({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function lo(t){return t&&!1!==t.fill}function co(t,e,i){let s=t[e].fill;const n=[e];let r;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!o(s))return s;if(r=t[s],!r)return!1;if(r.visible)return s;n.push(s),s=r.fill}return!1}function uo(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=a(i&&i.target,i);return void 0===s&&(s=!!e.backgroundColor),!1!==s&&null!==s&&(!0===s?"origin":s)}(t);if(n(s))return!isNaN(s.value)&&s;let r=parseFloat(s);return o(r)&&Math.floor(r)===r?function(t,e,i,s){return"-"!==t&&"+"!==t||(i=e+i),!(i===e||i<0||i>=s)&&i}(s[0],e,r,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function go(t,e,i){const s=[];for(let n=0;n=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&yo(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;lo(i)&&yo(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;lo(s)&&"beforeDatasetDraw"===i.drawTime&&yo(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Ao=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class ko extends Ss{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=c(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=gi(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=Ao(i,n);let h,l;e.font=s.string,this.isHorizontal()?(h=this.maxWidth,l=this._fitRows(o,n,r,a)+10):(l=this.maxHeight,h=this._fitCols(o,n,r,a)+10),this.width=Math.min(h,t.maxWidth||this.maxWidth),this.height=Math.min(l,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],h=this.lineWidths=[0],l=s+r;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-l;return this.legendItems.forEach(((t,g)=>{const p=i+e/2+n.measureText(t.text).width;(0===g||h[h.length-1]+p+2*r>o)&&(c+=l,h[h.length-(g>0?0:1)]=0,u+=l,d++),a[g]={left:0,top:u,row:d,width:p,height:s},h[h.length-1]+=p+r})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],h=this.columnSizes=[],l=o-t;let c=r,d=0,u=0,g=0,p=0;return this.legendItems.forEach(((t,o)=>{const f=i+e/2+n.measureText(t.text).width;o>0&&u+s+2*r>l&&(c+=d+r,h.push({width:d,height:u}),g+=d+r,p++,d=u=0),a[o]={left:g,top:u,col:p,width:f,height:s},d=Math.max(d,f),u+=s+r})),c+=d,h.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=yi(n,this.left,this.width);if(this.isHorizontal()){let n=0,r=ut(i,this.left+s,this.right-this.lineWidths[n]);for(const a of e)n!==a.row&&(n=a.row,r=ut(i,this.left+s,this.right-this.lineWidths[n])),a.top+=this.top+t+s,a.left=o.leftForLtr(o.x(r),a.width),r+=a.width+s}else{let n=0,r=ut(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const a of e)a.col!==n&&(n=a.col,r=ut(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),a.top=r,a.left+=this.left+s,a.left=o.leftForLtr(o.x(a.left),a.width),r+=a.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Ae(t,this),this._draw(),ke(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,r=ee.color,h=yi(t.rtl,this.left,this.width),l=gi(o.font),{color:c,padding:d}=o,u=l.size,g=u/2;let p;this.drawTitle(),s.textAlign=h.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:f,boxHeight:m,itemHeight:y}=Ao(o,u),b=this.isHorizontal(),x=this._computeTitleHeight();p=b?{x:ut(n,this.left+d,this.right-i[0]),y:this.top+d+x,line:0}:{x:this.left+d,y:ut(n,this.top+x+d,this.bottom-e[0].height),line:0},bi(this.ctx,t.textDirection);const v=y+d;this.legendItems.forEach(((_,w)=>{s.strokeStyle=_.fontColor||c,s.fillStyle=_.fontColor||c;const A=s.measureText(_.text).width,k=h.textAlign(_.textAlign||(_.textAlign=o.textAlign)),M=f+g+A;let C=p.x,S=p.y;h.setWidth(this.width),b?w>0&&C+M+d>this.right&&(S=p.y+=v,p.line++,C=p.x=ut(n,this.left+d,this.right-i[p.line])):w>0&&S+v>this.bottom&&(C=p.x=C+e[p.line].width+d,p.line++,S=p.y=ut(n,this.top+x+d,this.bottom-e[p.line].height)),function(t,e,i){if(isNaN(f)||f<=0||isNaN(m)||m<0)return;s.save();const n=a(i.lineWidth,1);if(s.fillStyle=a(i.fillStyle,r),s.lineCap=a(i.lineCap,"butt"),s.lineDashOffset=a(i.lineDashOffset,0),s.lineJoin=a(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=a(i.strokeStyle,r),s.setLineDash(a(i.lineDash,[])),o.usePointStyle){const r={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},a=h.xPlus(t,f/2);_e(s,r,a,e+g,o.pointStyleWidth&&f)}else{const o=e+Math.max((u-m)/2,0),r=h.leftForLtr(t,f),a=di(i.borderRadius);s.beginPath(),Object.values(a).some((t=>0!==t))?Pe(s,{x:r,y:o,w:f,h:m,radius:a}):s.rect(r,o,f,m),s.fill(),0!==n&&s.stroke()}s.restore()}(h.x(C),S,_),C=gt(k,C+f+g,b?C+M:this.right,t.rtl),function(t,e,i){Se(s,i.text,t,e+y/2,l,{strikethrough:i.hidden,textAlign:h.textAlign(i.textAlign)})}(h.x(C),S,_),b?p.x+=M+d:p.y+=v})),xi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=gi(e.font),s=ui(e.padding);if(!e.display)return;const n=yi(t.rtl,this.left,this.width),o=this.ctx,r=e.position,a=i.size/2,h=s.top+a;let l,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),l=this.top+h,c=ut(t.align,c,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);l=h+ut(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=ut(r,c,c+d);o.textAlign=n.textAlign(dt(r)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,Se(o,e.text,u,l,i)}_computeTitleHeight(){const t=this.options.title,e=gi(t.font),i=ui(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(Z(t,this.left,this.right)&&Z(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;it.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const r=t.controller.getStyle(i?0:void 0),a=ui(r.borderWidth);return{text:e[t.index].label,fillStyle:r.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:r.borderCapStyle,lineDash:r.borderDash,lineDashOffset:r.borderDashOffset,lineJoin:r.borderJoinStyle,lineWidth:(a.width+a.height)/4,strokeStyle:r.borderColor,pointStyle:s||r.pointStyle,rotation:r.rotation,textAlign:n||r.textAlign,borderRadius:0,datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Co extends Ss{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=s(i.text)?i.text.length:1;this._padding=ui(i.padding);const o=n*gi(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,r=o.align;let a,h,l,c=0;return this.isHorizontal()?(h=ut(r,i,n),l=e+t,a=n-i):("left"===o.position?(h=i+t,l=ut(r,s,e),c=-.5*S):(h=n-t,l=ut(r,e,s),c=.5*S),a=s-e),{titleX:h,titleY:l,maxWidth:a,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=gi(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:r,rotation:a}=this._drawArgs(s);Se(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:dt(e.align),textBaseline:"middle",translation:[n,o]})}}var So={id:"title",_element:Co,start(t,e,i){!function(t,e){const i=new Co({ctx:t.ctx,options:e,chart:t});Yi.configure(t,i,e),Yi.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Yi.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;Yi.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Do=new WeakMap;var Po={id:"subtitle",start(t,e,i){const s=new Co({ctx:t.ctx,options:i,chart:t});Yi.configure(t,s,i),Yi.addBox(t,s),Do.set(t,s)},stop(t){Yi.removeBox(t,Do.get(t)),Do.delete(t)},beforeUpdate(t,e,i){const s=Do.get(t);Yi.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Eo={average(t){if(!t.length)return!1;let e,i,s=0,n=0,o=0;for(e=0,i=t.length;e-1?t.split("\n"):t}function Oo(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:t,label:r,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Ro(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:r,boxHeight:a}=e,h=gi(e.bodyFont),l=gi(e.titleFont),c=gi(e.footerFont),u=o.length,g=n.length,p=s.length,f=ui(e.padding);let m=f.height,y=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);b+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*l.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),b&&(m+=p*(e.displayColors?Math.max(a,h.lineHeight):h.lineHeight)+(b-p)*h.lineHeight+(b-1)*e.bodySpacing),g&&(m+=e.footerMarginTop+g*c.lineHeight+(g-1)*e.footerSpacing);let x=0;const v=function(t){y=Math.max(y,i.measureText(t).width+x)};return i.save(),i.font=l.string,d(t.title,v),i.font=h.string,d(t.beforeBody.concat(t.afterBody),v),x=e.displayColors?r+2+e.boxPadding:0,d(s,(t=>{d(t.before,v),d(t.lines,v),d(t.after,v)})),x=0,i.font=c.string,d(t.footer,v),i.restore(),y+=f.width,{width:y,height:m}}function Lo(t,e,i,s){const{x:n,width:o}=i,{width:r,chartArea:{left:a,right:h}}=t;let l="center";return"center"===s?l=n<=(a+h)/2?"left":"right":n<=o/2?l="left":n>=r-o/2&&(l="right"),function(t,e,i,s){const{x:n,width:o}=s,r=i.caretSize+i.caretPadding;return"left"===t&&n+o+r>e.width||"right"===t&&n-o-r<0||void 0}(l,t,e,i)&&(l="center"),l}function zo(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||Lo(t,e,i,s),yAlign:s}}function Ho(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=t,{xAlign:a,yAlign:h}=i,l=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:g}=di(r);let p=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,a);const f=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,h,l);return"center"===h?"left"===a?p+=l:"right"===a&&(p-=l):"left"===a?p-=Math.max(c,u)+n:"right"===a&&(p+=Math.max(d,g)+n),{x:q(p,0,s.width-e.width),y:q(f,0,s.height-e.height)}}function Bo(t,e,i){const s=ui(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function No(t){return Io([],To(t))}function Fo(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class Wo extends Ss{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new ps(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=mi(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"}))}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),n=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let r=[];return r=Io(r,To(s)),r=Io(r,To(n)),r=Io(r,To(o)),r}getBeforeBody(t,e){return No(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return d(t,(t=>{const e={before:[],lines:[],after:[]},n=Fo(i,t);Io(e.before,To(n.beforeLabel.call(this,t))),Io(e.lines,n.label.call(this,t)),Io(e.after,To(n.afterLabel.call(this,t))),s.push(e)})),s}getAfterBody(t,e){return No(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),n=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let r=[];return r=Io(r,To(s)),r=Io(r,To(n)),r=Io(r,To(o)),r}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let r,a,h=[];for(r=0,a=e.length;rt.filter(e,s,n,i)))),t.itemSort&&(h=h.sort(((e,s)=>t.itemSort(e,s,i)))),d(h,(e=>{const i=Fo(t.callbacks,e);s.push(i.labelColor.call(this,e)),n.push(i.labelPointStyle.call(this,e)),o.push(i.labelTextColor.call(this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=h,h}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Eo[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Ro(this,i),r=Object.assign({},t,e),a=zo(this.chart,i,r),h=Ho(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,n={opacity:1,x:h.x,y:h.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:r}=i,{topLeft:a,topRight:h,bottomLeft:l,bottomRight:c}=di(r),{x:d,y:u}=t,{width:g,height:p}=e;let f,m,y,b,x,v;return"center"===n?(x=u+p/2,"left"===s?(f=d,m=f-o,b=x+o,v=x-o):(f=d+g,m=f+o,b=x-o,v=x+o),y=f):(m="left"===s?d+Math.max(a,l)+o:"right"===s?d+g-Math.max(h,c)-o:this.caretX,"top"===n?(b=u,x=b-o,f=m-o,y=m+o):(b=u+p,x=b+o,f=m+o,y=m-o),v=b),{x1:f,x2:m,x3:y,y1:b,y2:x,y3:v}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,r,a;if(n){const h=yi(i.rtl,this.x,this.width);for(t.x=Bo(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",o=gi(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,a=0;a0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Pe(t,{x:e,y:f,w:l,h,radius:a}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Pe(t,{x:i,y:f+1,w:l-2,h:h-2,radius:a}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,f,l,h),t.strokeRect(e,f,l,h),t.fillStyle=r.backgroundColor,t.fillRect(i,f+1,l-2,h-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:r,boxHeight:a,boxWidth:h,boxPadding:l}=i,c=gi(i.bodyFont);let u=c.lineHeight,g=0;const p=yi(i.rtl,this.x,this.width),f=function(i){e.fillText(i,p.x(t.x+g),t.y+u/2),t.y+=u+n},m=p.textAlign(o);let y,b,x,v,_,w,A;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Bo(this,m,i),e.fillStyle=i.bodyColor,d(this.beforeBody,f),g=r&&"right"!==m?"center"===o?h/2+l:h+2+l:0,v=0,w=s.length;v0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Eo[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Ro(this,t),r=Object.assign({},i,this._size),a=zo(e,t,r),h=Ho(t,r,a,e);s._to===h.x&&n._to===h.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ui(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),bi(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),xi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!u(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),r=this._positionChanged(o,t),a=e||!u(o,n)||r;return a&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Eo[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}Wo.positioners=Eo;var Vo={id:"tooltip",_element:Wo,positioners:Eo,afterInit(t,e,i){i&&(t.tooltip=new Wo({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;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",i))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:t,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},jo=Object.freeze({__proto__:null,Decimation:no,Filler:wo,Legend:Mo,SubTitle:Po,Title:So,Tooltip:Vo});class $o extends Bs{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(i(t))return null;const s=this.getLabels();return((t,e)=>null===t?null:q(Math.round(t),0,e))(e=isFinite(e)&&s[e]===t?e:function(t,e,i,s){const n=t.indexOf(e);return-1===n?((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s):n!==t.lastIndexOf(e)?i:n}(s,t,a(e,t),this._addedLabels),s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&te.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Yo(t,e,{horizontal:i,minRotation:s}){const n=j(s),o=(i?Math.sin(n):Math.cos(n))||.001,r=.75*e*(""+t).length;return Math.min(e/o,r)}$o.id="category",$o.defaults={ticks:{callback:$o.prototype.getLabelForValue}};class Go extends Bs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return i(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=e?s:t,r=t=>n=i?n:t;if(t){const t=z(s),e=z(n);t<0&&e<0?r(0):t>0&&e>0&&o(0)}if(s===n){let e=1;(n>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*n)),r(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n=function(t,e){const s=[],{bounds:n,step:o,min:r,max:a,precision:h,count:l,maxTicks:c,maxDigits:d,includeBounds:u}=t,g=o||1,p=c-1,{min:f,max:m}=e,y=!i(r),b=!i(a),x=!i(l),v=(m-f)/(d+1);let _,w,A,k,M=H((m-f)/p/g)*g;if(M<1e-14&&!y&&!b)return[{value:f},{value:m}];k=Math.ceil(m/M)-Math.floor(f/M),k>p&&(M=H(k*M/p/g)*g),i(h)||(_=Math.pow(10,h),M=Math.ceil(M*_)/_),"ticks"===n?(w=Math.floor(f/M)*M,A=Math.ceil(m/M)*M):(w=f,A=m),y&&b&&o&&W((a-r)/o,M/1e3)?(k=Math.round(Math.min((a-r)/M,c)),M=(a-r)/k,w=r,A=a):x?(w=y?r:w,A=b?a:A,k=l-1,M=(A-w)/k):(k=(A-w)/M,k=F(k,Math.round(k),M/1e3)?Math.round(k):Math.ceil(k));const C=Math.max(Y(M),Y(w));_=Math.pow(10,i(h)?C:h),w=Math.round(w*_)/_,A=Math.round(A*_)/_;let S=0;for(y&&(u&&w!==r?(s.push({value:r}),w0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=o(t)?Math.max(0,t):null,this.max=o(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t,r=(t,e)=>Math.pow(10,Math.floor(L(t))+e);i===s&&(i<=0?(n(1),o(10)):(n(r(i,-1)),o(r(s,1)))),i<=0&&n(r(s,-1)),s<=0&&o(r(i,1)),this._zero&&this.min!==this._suggestedMin&&i===r(this.min,0)&&n(r(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor(L(e.max)),s=Math.ceil(e.max/Math.pow(10,i)),n=[];let o=r(t.min,Math.pow(10,Math.floor(L(e.min)))),a=Math.floor(L(o)),h=Math.floor(o/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do{n.push({value:o,major:Qo(o)}),++h,10===h&&(h=1,++a,l=a>=0?1:l),o=Math.round(h*Math.pow(10,a)*l)/l}while(an?{start:e-i,end:e}:{start:e,end:e+i}}function Ko(t,e,i,s,n){const o=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,h=0;s.starte.r&&(a=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+a)),n.starte.b&&(h=(n.end-e.b)/r,t.b=Math.max(t.b,e.b+h))}function Zo(t){return 0===t||180===t?"center":t<180?"left":"right"}function tr(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function er(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function ir(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,D);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;o{const i=c(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?function(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],r=t._pointLabels.length,a=t.options.pointLabels,h=a.centerPointLabels?S/r:0;for(let u=0;u=0&&t=0;o--){const e=n.setContext(t.getPointLabelContext(o)),r=gi(e.font),{x:a,y:h,textAlign:l,left:c,top:d,right:u,bottom:g}=t._pointLabelItems[o],{backdropColor:p}=e;if(!i(p)){const t=di(e.borderRadius),i=ui(e.backdropPadding);s.fillStyle=p;const n=c-i.left,o=d-i.top,r=u-c+i.width,a=g-d+i.height;Object.values(t).some((t=>0!==t))?(s.beginPath(),Pe(s,{x:n,y:o,w:r,h:a,radius:t}),s.fill()):s.fillRect(n,o,r,a)}Se(s,t._pointLabels[o],a,h+r.lineHeight/2,r,{color:e.color,textAlign:l,textBaseline:"middle"})}}(this,o),n.display&&this.ticks.forEach(((t,e)=>{0!==e&&(a=this.getDistanceFromCenterForValue(t.value),function(t,e,i,s){const n=t.ctx,o=e.circular,{color:r,lineWidth:a}=e;!o&&!s||!r||!a||i<0||(n.save(),n.strokeStyle=r,n.lineWidth=a,n.setLineDash(e.borderDash),n.lineDashOffset=e.borderDashOffset,n.beginPath(),ir(t,i,o,s),n.closePath(),n.stroke(),n.restore())}(this,n.setContext(this.getContext(e-1)),a,o))})),s.display){for(t.save(),r=o-1;r>=0;r--){const i=s.setContext(this.getPointLabelContext(r)),{color:n,lineWidth:o}=i;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(i.borderDash),t.lineDashOffset=i.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),h=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(h.x,h.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,r)=>{if(0===r&&!e.reverse)return;const a=i.setContext(this.getContext(r)),h=gi(a.font);if(n=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=h.string,o=t.measureText(s.label).width,t.fillStyle=a.backdropColor;const e=ui(a.backdropPadding);t.fillRect(-o/2-e.left,-n-h.size/2-e.top,o+e.width,h.size+e.height)}Se(t,s.label,0,-n,h,{color:a.color})})),t.restore()}drawTitle(){}}sr.id="radialLinear",sr.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ps.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}},sr.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},sr.descriptors={angleLines:{_fallback:"grid"}};const nr={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}},or=Object.keys(nr);function rr(t,e){return t-e}function ar(t,e){if(i(e))return null;const s=t._adapter,{parser:n,round:r,isoWeekday:a}=t._parseOpts;let h=e;return"function"==typeof n&&(h=n(h)),o(h)||(h="string"==typeof n?s.parse(h,n):s.parse(h)),null===h?null:(r&&(h="week"!==r||!N(a)&&!0!==a?s.startOf(h,r):s.startOf(h,"isoWeek",a)),+h)}function hr(t,e,i,s){const n=or.length;for(let o=or.indexOf(t);o=e?i[s]:i[n]]=!0}}else t[e]=!0}function cr(t,e,i){const s=[],n={},o=e.length;let r,a;for(r=0;r=0&&(e[h].major=!0);return e}(t,s,n,i):s}class dr extends Bs{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){const i=t.time||(t.time={}),s=this._adapter=new mn._date(t.adapters.date);s.init(e),y(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:ar(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:r,maxDefined:a}=this.getUserBounds();function h(t){r||isNaN(t.min)||(s=Math.min(s,t.min)),a||isNaN(t.max)||(n=Math.max(n,t.max))}r&&a||(h(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||h(this.getMinMax(!1))),s=o(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=o(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=st(s,n,this.max);return this._unit=e.unit||(i.autoSkip?hr(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=or.length-1;o>=or.indexOf(i);o--){const i=or[o];if(nr[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return or[i?or.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=or.indexOf(t)+1,i=or.length;e+t.value)))}initOffsets(t){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=q(s,0,o),n=q(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||hr(n.minUnit,e,i,this._getLabelCapacity(e)),r=a(n.stepSize,1),h="week"===o&&n.isoWeekday,l=N(h)||!0===h,c={};let d,u,g=e;if(l&&(g=+t.startOf(g,"isoWeek",h)),g=+t.startOf(g,l?"day":o),t.diff(i,e,o)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+o);const p="data"===s.ticks.source&&this.getDataTimestamps();for(d=g,u=0;dt-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.time.displayFormats,r=this._unit,a=this._majorUnit,h=r&&o[r],l=a&&o[a],d=i[e],u=a&&l&&d&&d.major,g=this._adapter.format(t,s||(u?l:h)),p=n.ticks.callback;return p?c(p,[g,e,i],this):g}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[a].pos&&e<=t[h].pos&&({lo:a,hi:h}=et(t,"pos",e)),({pos:s,time:o}=t[a]),({pos:n,time:r}=t[h])):(e>=t[a].time&&e<=t[h].time&&({lo:a,hi:h}=et(t,"time",e)),({time:s,pos:o}=t[a]),({time:n,pos:r}=t[h]));const l=n-s;return l?o+(r-o)*(e-s)/l:o}dr.id="time",dr.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class gr extends dr{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=ur(e,this.min),this._tableRange=ur(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,r,a,h,l;for(o=0,r=t.length;o=e&&h<=i&&s.push(h);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,r=s.length;o{"use strict";i.d(e,{oi:()=>st,iv:()=>h,dy:()=>B});const s=window,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),r=new WeakMap;class a{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=r.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&r.set(e,t))}return t}toString(){return this.cssText}}const h=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new a(i,t,o)},l=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,o))(e)})(t):t;var c;const d=window,u=d.trustedTypes,g=u?u.emptyScript:"",p=d.reactiveElementPolyfillSupport,f={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},m=(t,e)=>e!==t&&(e==e||t==t),y={attribute:!0,type:String,converter:f,reflect:!1,hasChanged:m};class b extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Ep(i,e);void 0!==s&&(this._$Ev.set(s,i),t.push(s))})),t}static createProperty(t,e=y){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||y}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{n?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),n=s.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=y){var s;const n=this.constructor._$Ep(t,i);if(void 0!==n&&!0===i.reflect){const o=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:f).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,n=s._$Ev.get(t);if(void 0!==n&&this._$El!==n){const t=s.getPropertyOptions(n),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:f;this._$El=n,this[n]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||m)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var x;b.finalized=!0,b.elementProperties=new Map,b.elementStyles=[],b.shadowRootOptions={mode:"open"},null==p||p({ReactiveElement:b}),(null!==(c=d.reactiveElementVersions)&&void 0!==c?c:d.reactiveElementVersions=[]).push("1.4.2");const v=window,_=v.trustedTypes,w=_?_.createPolicy("lit-html",{createHTML:t=>t}):void 0,A=`lit$${(Math.random()+"").slice(9)}$`,k="?"+A,M=`<${k}>`,C=document,S=(t="")=>C.createComment(t),D=t=>null===t||"object"!=typeof t&&"function"!=typeof t,P=Array.isArray,E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,I=/-->/g,T=/>/g,O=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),R=/'/g,L=/"/g,z=/^(?:script|style|textarea|title)$/i,H=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),B=H(1),N=(H(2),Symbol.for("lit-noChange")),F=Symbol.for("lit-nothing"),W=new WeakMap,V=C.createTreeWalker(C,129,null,!1),j=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"":"",r=E;for(let e=0;e"===h[0]?(r=null!=n?n:E,l=-1):void 0===h[1]?l=-2:(l=r.lastIndex-h[2].length,a=h[1],r=void 0===h[3]?O:'"'===h[3]?L:R):r===L||r===R?r=O:r===I||r===T?r=E:(r=O,n=void 0);const d=r===O&&t[e+1].startsWith("/>")?" ":"";o+=r===E?i+M:l>=0?(s.push(a),i.slice(0,l)+"$lit$"+i.slice(l)+A+d):i+A+(-2===l?(s.push(void 0),e):d)}const a=o+(t[i]||"")+(2===e?"":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==w?w.createHTML(a):a,s]};class ${constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,a=this.parts,[h,l]=j(t,e);if(this.el=$.createElement(h,i),V.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=V.nextNode())&&a.length0){s.textContent=_?_.emptyScript:"";for(let i=0;iP(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.k(t):this.g(t)}O(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}g(t){this._$AH!==F&&D(this._$AH)?this._$AA.nextSibling.data=t:this.T(C.createTextNode(t)),this._$AH=t}$(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=$.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.p(i);else{const t=new G(n,this),e=t.v(this.options);t.p(i),this.T(e),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new $(t)),e}k(t){P(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new U(this.O(S()),this.O(S()),this,this.options)):i=e[s],i._$AI(n),s++;s2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=F}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=Y(this,t,e,0),o=!D(t)||t!==this._$AH&&t!==N,o&&(this._$AH=t);else{const s=t;let r,a;for(t=n[0],r=0;r{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let r=o._$litPart$;if(void 0===r){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=r=new U(e.insertBefore(S(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return N}}st.finalized=!0,st._$litElement$=!0,null===(et=globalThis.litElementHydrateSupport)||void 0===et||et.call(globalThis,{LitElement:st});const nt=globalThis.litElementPolyfillSupport;null==nt||nt({LitElement:st}),(null!==(it=globalThis.litElementVersions)&&void 0!==it?it:globalThis.litElementVersions=[]).push("3.2.2")},225:(t,e,i)=>{"use strict";i.r(e),i.d(e,{GazparCardEditor:()=>n});var s=i(897);!customElements.get("ha-switch")&&customElements.get("paper-toggle-button")&&customElements.define("ha-switch",customElements.get("paper-toggle-button"));class n extends s.oi{setConfig(t){this._config={...t}}static get properties(){return{hass:{},_config:{}}}get _title(){return this._config.title||"GrDF data"}get _entity(){return this._config.entity||"sensor.gazpar"}get _pricePerKWh(){return this._config.pricePerKWh||0}get _showIcon(){return!1!==this._config.showIcon}get _showCost(){return!1!==this._config.showCost}get _showTitle(){return!1!==this._config.showTitle}get _showMainBar(){return!1!==this._config.showMainBar}get _showError(){return!1!==this._config.showError}get _showVersion(){return!1!==this._config.showVersion}get _showDailyHistory(){return!1!==this._config.showDailyHistory}get _showMonthlyHistory(){return!1!==this._config.showMonthlyHistory}get _showHistoryHeader(){return!1!==this._config.showHistoryHeader}get _showEnergyHistory(){return!1!==this._config.showEnergyHistory}get _showVolumeHistory(){return!1!==this._config.showVolumeHistory}get _showCostHistory(){return!1!==this._config.showCostHistory}get _showTrendRatioHistory(){return!1!==this._config.showTrendRatioHistory}get _showDailyEnergyHistoryChart(){return!1!==this._config.showDailyEnergyHistoryChart}get _showDailyCostHistoryChart(){return!1!==this._config.showDailyCostHistoryChart}get _showWeeklyEnergyHistoryChart(){return!1!==this._config.showWeeklyEnergyHistoryChart}get _showWeeklyCostHistoryChart(){return!1!==this._config.showWeeklyCostHistoryChart}get _showMonthlyEnergyHistoryChart(){return!1!==this._config.showMonthlyEnergyHistoryChart}get _showMonthlyCostHistoryChart(){return!1!==this._config.showMonthlyCostHistoryChart}get _showYearlyEnergyHistoryChart(){return!1!==this._config.showYearlyEnergyHistoryChart}get _showYearlyCostHistoryChart(){return!1!==this._config.showYearlyCostHistoryChart}firstUpdated(){window.loadCardHelpers().then((t=>{t.importMoreInfoControl&&t.importMoreInfoControl("fan")}))}render(){return this.hass?s.dy`
@@ -157,12 +157,12 @@
- `}sortDescDailyData(t){return t.sort(((t,e)=>Date.parseDate(e.time_period)-Date.parseDate(t.time_period)))}sortDescWeeklyData(t){return t.sort(((t,e)=>Date.parseWeekPeriod(e.time_period)-Date.parseWeekPeriod(t.time_period)))}sortDescMonthlyData(t){return t.sort(((t,e)=>Date.parseMonthPeriod(e.time_period)-Date.parseMonthPeriod(t.time_period)))}static rightPaddingDailyArray(t,e){var i=Date.today();t.length>0&&(i=Date.parseDate(t[t.length-1].time_period));for(var s=0;s0&&(i=Date.parseDate(t[t.length-1].time_period));for(var s=0;s0&&(i=Date.parseMonthPeriod(t[t.length-1].time_period));for(var s=0;s=0&&null!=n&&n>0){var o=100*(s-n)/n;t[i].ratio=o}else t[i].ratio=null!=s&&0==s&&null!=n&&0==n?0:null!=s&&s>0&&null!=n&&0==n?1:null}}_showDetails(t){const e=new Event("hass-more-info",{bubbles:!0,cancelable:!1,composed:!0});return e.detail={entityId:t},this.dispatchEvent(e),e}renderMainBar(e,i){if(!0===this.config.showMainBar)return t.dy` + `}sortDescDailyData(t){return t.sort(((t,e)=>Date.parseDate(e.time_period)-Date.parseDate(t.time_period)))}sortDescWeeklyData(t){return t.sort(((t,e)=>Date.parseWeekPeriod(e.time_period)-Date.parseWeekPeriod(t.time_period)))}sortDescMonthlyData(t){return t.sort(((t,e)=>Date.parseMonthPeriod(e.time_period)-Date.parseMonthPeriod(t.time_period)))}static rightPaddingDailyArray(t,e){var i=Date.today();t.length>0&&(i=Date.parseDate(t[t.length-1].time_period));for(var s=0;s0&&(i=Date.parseDate(t[t.length-1].time_period));for(var s=0;s0&&(i=Date.parseMonthPeriod(t[t.length-1].time_period));for(var s=0;s=0&&null!=n&&n>0){var o=100*(s-n)/n;t[i].ratio=o}else t[i].ratio=null!=s&&0==s&&null!=n&&0==n?0:null!=s&&s>0&&null!=n&&0==n?100:null}}_showDetails(t){const e=new Event("hass-more-info",{bubbles:!0,cancelable:!1,composed:!0});return e.detail={entityId:t},this.dispatchEvent(e),e}renderMainBar(e,i){if(!0===this.config.showMainBar)return t.dy`
${this.config.showIcon?t.dy`
- +
`:t.dy``}
${null!=e&&e.length>0?a.formatNumber(e[0].energy_kwh,1):"N/A"}${i}
@@ -190,7 +190,7 @@
`}renderVersion(){if(!0===this.config.showVersion)return t.dy`
- Gazpar Card Version ${"1.3.9"} + Gazpar Card Version ${"1.3.10-alpha.0"}
`}renderDailyHistory(e,i,s){if(s.showDailyHistory&&null!=e&&e.length>0){var n=s.asOfDate?Date.parseDate(s.asOfDate):Date.today(),o=e.slice().reverse().filter((t=>Date.parseDate(t.time_period)>=n.addDays(-7)));if(o.length>0)for(var r=Date.parseDate(o[o.length-1].time_period).addDays(1);o.length<7;)o.push({time_period:r.formatDate(),volume_m3:null,energy_kwh:null}),r=r.addDays(1);return t.dy`
diff --git a/package.json b/package.json index 33ba54f..33a7097 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lovelace-gazpar-card", - "version": "1.3.9", + "version": "1.3.10-alpha.0", "compatibleIntegrationVersion": "1.3.4", "description": "GrDF Gazpar meter lovelace card for Home Assistant.", "main": "index.js", diff --git a/src/gazpar-card.js b/src/gazpar-card.js index 634d246..107d867 100644 --- a/src/gazpar-card.js +++ b/src/gazpar-card.js @@ -428,7 +428,7 @@ export class GazparCard extends LitElement { } else if (currentPeriodEnergy != null && currentPeriodEnergy > 0 && previousPeriodEnergy != null && previousPeriodEnergy == 0) { - data[i].ratio = 1 + data[i].ratio = 100 } else { diff --git a/tests/attributes.json b/tests/attributes.json index 3e76895..6c7abcd 100644 --- a/tests/attributes.json +++ b/tests/attributes.json @@ -1,6 +1,6 @@ { "attribution": "Data provided by GrDF", - "version": "1.3.0", + "version": "1.3.4", "username": "toto.titi@tata.com", "pce": "123456789101112", "unit_of_measurement": "kWh",