mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-23 06:34:54 +03:00
1 line
195 KiB
JavaScript
1 line
195 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,function(){"use strict";var s=Object.freeze({__proto__:null,get Colors(){return hr},get Decimation(){return ur},get Filler(){return Sr},get Legend(){return Or},get SubTitle(){return Er},get Title(){return Tr},get Tooltip(){return Yr}});function t(){}const F=(()=>{let t=0;return()=>t++})();function P(t){return null==t}function O(t){return!(!Array.isArray||!Array.isArray(t))||"[object"===(t=Object.prototype.toString.call(t)).slice(0,7)&&"Array]"===t.slice(-6)}function A(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function p(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function u(t,e){return p(t)?t:e}function T(t,e){return void 0===t?e:t}const V=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,B=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function k(t,e,i,s){let a,r,n;if(O(t))if(r=t.length,s)for(a=r-1;0<=a;a--)e.call(i,t[a],a);else for(a=0;a<r;a++)e.call(i,t[a],a);else if(A(t))for(n=Object.keys(t),r=n.length,a=0;a<r;a++)e.call(i,t[n[a]],n[a])}function W(t,e){let i,s,a,r;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(a=t[i],r=e[i],a.datasetIndex!==r.datasetIndex||a.index!==r.index)return!1;return!0}function N(e){if(O(e))return e.map(N);if(A(e)){var i=Object.create(null),s=Object.keys(e),a=s.length;let t=0;for(;t<a;++t)i[s[t]]=N(e[s[t]]);return i}return e}function H(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function j(t,e,i,s){var a;H(t)&&(a=e[t],i=i[t],A(a)&&A(i)?Y(a,i,s):e[t]=N(i))}function Y(i,t,s){var e=O(t)?t:[t],a=e.length;if(A(i)){var r,n=(s=s||{}).merger||j;for(let t=0;t<a;++t)if(A(r=e[t])){const O=Object.keys(r);for(let t=0,e=O.length;t<e;++t)n(O[t],i,r,s)}}return i}function $(t,e){return Y(t,e,{merger:U})}function U(t,e,i){var s;H(t)&&(s=e[t],i=i[t],A(s)&&A(i)?$(s,i):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=N(i)))}const X={"":t=>t,x:t=>t.x,y:t=>t.y};function q(t){var e=t.split("."),i=[];let s="";for(const t of e)s+=t,s=s.endsWith("\\")?s.slice(0,-1)+".":(i.push(s),"");return i}function f(t,e){return(X[e]||(X[e]=function(){const i=q(e);return t=>{for(const e of i){if(""===e)break;t=t&&t[e]}return t}}()))(t)}function K(t){return t.charAt(0).toUpperCase()+t.slice(1)}const G=t=>void 0!==t,g=t=>"function"==typeof t,Z=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function J(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const S=Math.PI,v=2*S,Q=v+S,tt=Number.POSITIVE_INFINITY,et=S/180,D=S/2,it=S/4,st=2*S/3,o=Math.log10,_=Math.sign;function at(t,e,i){return Math.abs(t-e)<i}function rt(t){var e=Math.round(t),e=(t=at(t,e,t/1e3)?e:t,Math.pow(10,Math.floor(o(t)))),t=t/e;return(t<=1?1:t<=2?2:t<=5?5:10)*e}function nt(t){var e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort((t,e)=>t-e).pop(),e}function ot(t){return!isNaN(parseFloat(t))&&isFinite(t)}function lt(t,e){var i=Math.round(t);return i-e<=t&&t<=i+e}function ht(t,e,i){let s,a,r;for(s=0,a=t.length;s<a;s++)r=t[s][i],isNaN(r)||(e.min=Math.min(e.min,r),e.max=Math.max(e.max,r))}function L(t){return t*(S/180)}function ct(t){return t*(180/S)}function dt(i){if(p(i)){let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}}function ut(t,e){var i=e.x-t.x,e=e.y-t.y,t=Math.sqrt(i*i+e*e);let s=Math.atan2(e,i);return s<-.5*S&&(s+=v),{angle:s,distance:t}}function gt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ft(t,e){return(t-e+Q)%v-S}function y(t){return(t%v+v)%v}function pt(t,e,i,s){var t=y(t),e=y(e),i=y(i),a=y(e-t),r=y(i-t),n=y(t-e),o=y(t-i);return t===e||t===i||s&&e===i||r<a&&n<o}function C(t,e,i){return Math.max(e,Math.min(i,t))}function mt(t){return C(t,-32768,32767)}function c(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function bt(e,i,t){t=t||(t=>e[t]<i);let s,a=e.length-1,r=0;for(;1<a-r;)t(s=r+a>>1)?r=s:a=s;return{lo:r,hi:a}}const m=(i,s,a,t)=>bt(i,a,t?t=>{var e=i[t][s];return e<a||e===a&&i[t+1][s]===a}:t=>i[t][s]<a),xt=(e,i,s)=>bt(e,s,t=>e[t][i]>=s);function vt(t,e,i){let s=0,a=t.length;for(;s<a&&t[s]<e;)s++;for(;a>s&&t[a-1]>i;)a--;return 0<s||a<t.length?t.slice(s,a):t}const _t=["push","pop","shift","splice","unshift"];function yt(a,t){a._chartjs?a._chartjs.listeners.push(t):(Object.defineProperty(a,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),_t.forEach(t=>{const i="_onData"+K(t),s=a[t];Object.defineProperty(a,t,{configurable:!0,enumerable:!1,value(...e){var t=s.apply(this,e);return a._chartjs.listeners.forEach(t=>{"function"==typeof t[i]&&t[i](...e)}),t}})}))}function Mt(e,t){var i=e._chartjs;i&&(-1!==(t=(i=i.listeners).indexOf(t))&&i.splice(t,1),0<i.length||(_t.forEach(t=>{delete e[t]}),delete e._chartjs))}function wt(t){var e=new Set(t);return e.size===t.length?t:Array.from(e)}const kt="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function St(e,i){let s,a=!1;return function(...t){s=t,a||(a=!0,kt.call(window,()=>{a=!1,e.apply(i,s)}))}}function Pt(e,i){let s;return function(...t){return i?(clearTimeout(s),s=setTimeout(e,i,t)):e.apply(this,t),i}}const Dt=t=>"start"===t?"left":"end"===t?"right":"center",E=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,Ct=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;function Ot(t,e,i){var s,a,r,n,o,l,h=e.length;let c=0,d=h;return t._sorted&&({iScale:t,_parsed:s}=t,a=t.axis,{min:r,max:n,minDefined:o,maxDefined:l}=t.getUserBounds(),o&&(c=C(Math.min(m(s,a,r).lo,i?h:m(e,a,t.getPixelForValue(r)).lo),0,h-1)),d=l?C(Math.max(m(s,t.axis,n,!0).hi+1,i?0:m(e,a,t.getPixelForValue(n),!0).hi+1),c,h)-c:h-c),{start:c,count:d}}function At(t){var{xScale:e,yScale:i,_scaleRanges:s}=t,a={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};return s?(e=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max,Object.assign(s,a),e):(t._scaleRanges=a,!0)}var r=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,i,s,t){const a=i.listeners[t],r=i.duration;a.forEach(t=>t({chart:e,initial:i.initial,numSteps:r,currentStep:Math.min(s-i.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=kt.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(n=Date.now()){let o=0;this._charts.forEach((s,a)=>{if(s.running&&s.items.length){var r=s.items;let t,e=r.length-1,i=!1;for(;0<=e;--e)(t=r[e])._active?(t._total>s.duration&&(s.duration=t._total),t.tick(n),i=!0):(r[e]=r[r.length-1],r.pop());i&&(a.draw(),this._notify(a,s,n,"progress")),r.length||(s.running=!1,this._notify(a,s,n,"complete"),s.initial=!1),o+=r.length}}),this._lastDate=n,0===o&&(this._running=!1)}_getAnims(t){var e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return 0<this._getAnims(t).items.length}start(t){t=this._charts.get(t);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((t,e)=>Math.max(t,e._duration),0),this._refresh())}running(t){return!!this._running&&!!((t=this._charts.get(t))&&t.running&&t.items.length)}stop(e){var i=this._charts.get(e);if(i&&i.items.length){var s=i.items;let t=s.length-1;for(;0<=t;--t)s[t].cancel();i.items=[],this._notify(e,i,Date.now(),"complete")}}remove(t){return this._charts.delete(t)}};function Tt(t){return t+.5|0}const Lt=(t,e,i)=>Math.max(Math.min(t,i),e);function Et(t){return Lt(Tt(2.55*t),0,255)}function Rt(t){return Lt(Tt(255*t),0,255)}function n(t){return Lt(Tt(t/2.55)/100,0,1)}function It(t){return Lt(Tt(100*t),0,100)}const l={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},zt=[..."0123456789ABCDEF"],Ft=t=>zt[15&t],Vt=t=>zt[(240&t)>>4]+zt[15&t],Bt=t=>(240&t)>>4==(15&t);const Wt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Nt(i,t,s){const a=t*Math.min(s,1-s),e=(t,e=(t+i/30)%12)=>s-a*Math.max(Math.min(e-3,9-e,1),-1);return[e(0),e(8),e(4)]}function Ht(i,s,a){var t=(t,e=(t+i/60)%6)=>a-a*s*Math.max(Math.min(e,4-e,1),0);return[t(5),t(3),t(1)]}function jt(t,e,i){var s=Nt(t,1,.5);let a;for(1<e+i&&(e*=a=1/(e+i),i*=a),a=0;a<3;a++)s[a]*=1-e-i,s[a]+=e;return s}function Yt(t){var e=t.r/255,i=t.g/255,t=t.b/255,s=Math.max(e,i,t),a=Math.min(e,i,t),r=(s+a)/2;let n,o,l;return s!==a&&(l=s-a,o=.5<r?l/(2-s-a):l/(s+a),n=60*(n=(a=i,i=t,(t=e)===s?(a-i)/l+(a<i?6:0):a===s?(i-t)/l+2:(t-a)/l+4))+.5),[0|n,o||0,r]}function $t(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Rt)}function Ut(t,e,i){return $t(Nt,t,e,i)}function Xt(t){return(t%360+360)%360}const qt={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Kt={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Gt;const Zt=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,Jt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Qt=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function te(e,i,s){if(e){let t=Yt(e);t[i]=Math.max(0,Math.min(t[i]+t[i]*s,0===i?360:1)),t=Ut(t),e.r=t[0],e.g=t[1],e.b=t[2]}}function ee(t,e){return t&&Object.assign(e||{},t)}function ie(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?3<=t.length&&(e={r:t[0],g:t[1],b:t[2],a:255},3<t.length)&&(e.a=Rt(t[3])):(e=ee(t,{r:0,g:0,b:0,a:1})).a=Rt(e.a),e}function se(t){return("r"===t.charAt(0)?function(t){var e=Zt.exec(t);let i,s,a,r=255;if(e){if(void 0!==e[7]){const t=+e[7];r=e[8]?Et(t):Lt(255*t,0,255)}return i=+e[1],s=+e[3],a=+e[5],{r:255&(e[2]?Et(i):Lt(i,0,255)),g:255&(e[4]?Et(s):Lt(s,0,255)),b:255&(e[6]?Et(a):Lt(a,0,255)),a:r}}}:function(t){var e,i,s,t=Wt.exec(t);let a,r=255;if(t)return void 0!==t[5]&&(r=(t[6]?Et:Rt)(+t[5])),e=Xt(+t[2]),i=+t[3]/100,s=+t[4]/100,{r:(a="hwb"===t[1]?$t(jt,e,i,s):"hsv"===t[1]?$t(Ht,e,i,s):Ut(e,i,s))[0],g:a[1],b:a[2],a:r}})(t)}class ae{constructor(t){if(t instanceof ae)return t;var e,i,s=typeof t;let a;"object"==s?a=ie(t):"string"==s&&(i=(s=t).length,"#"===s[0]&&(4===i||5===i?e={r:255&17*l[s[1]],g:255&17*l[s[2]],b:255&17*l[s[3]],a:5===i?17*l[s[4]]:255}:7!==i&&9!==i||(e={r:l[s[1]]<<4|l[s[2]],g:l[s[3]]<<4|l[s[4]],b:l[s[5]]<<4|l[s[6]],a:9===i?l[s[7]]<<4|l[s[8]]:255})),a=e||(i=t,Gt||((Gt=function(){var t={},e=Object.keys(Kt),i=Object.keys(qt);let s,a,r,n,o;for(s=0;s<e.length;s++){for(n=o=e[s],a=0;a<i.length;a++)r=i[a],o=o.replace(r,qt[r]);r=parseInt(Kt[n],16),t[o]=[r>>16&255,r>>8&255,255&r]}return t}()).transparent=[0,0,0,0]),(i=Gt[i.toLowerCase()])&&{r:i[0],g:i[1],b:i[2],a:4===i.length?i[3]:255})||se(t)),this._rgb=a,this._valid=!!a}get valid(){return this._valid}get rgb(){var t=ee(this._rgb);return t&&(t.a=n(t.a)),t}set rgb(t){this._rgb=ie(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${n(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid&&(t=this._rgb,e=t,e=Bt(e.r)&&Bt(e.g)&&Bt(e.b)&&Bt(e.a)?Ft:Vt,t)?"#"+e(t.r)+e(t.g)+e(t.b)+((t=t.a)<255?e(t):""):void 0;var t,e}hslString(){if(this._valid){var t,e,i,s=this._rgb;if(s)return t=(i=Yt(s))[0],e=It(i[1]),i=It(i[2]),s.a<255?`hsla(${t}, ${e}%, ${i}%, ${n(s.a)})`:`hsl(${t}, ${e}%, ${i}%)`}}mix(t,e){var i,s,a;return t&&(i=this.rgb,t=t.rgb,a=i.a-t.a,i.r=255&(s=(1+((s=2*(e=void 0===e?.5:e)-1)*a==-1?s:(s+a)/(1+s*a)))/2)*i.r+(a=1-s)*t.r+.5,i.g=255&s*i.g+a*t.g+.5,i.b=255&s*i.b+a*t.b+.5,i.a=e*i.a+(1-e)*t.a,this.rgb=i),this}interpolate(t,e){return t&&(this._rgb=(i=this._rgb,t=t._rgb,e=e,s=Qt(n(i.r)),a=Qt(n(i.g)),r=Qt(n(i.b)),{r:Rt(Jt(s+e*(Qt(n(t.r))-s))),g:Rt(Jt(a+e*(Qt(n(t.g))-a))),b:Rt(Jt(r+e*(Qt(n(t.b))-r))),a:i.a+e*(t.a-i.a)})),this;var i,s,a,r}clone(){return new ae(this.rgb)}alpha(t){return this._rgb.a=Rt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){var t=this._rgb,e=Tt(.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(){var t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return te(this._rgb,2,t),this}darken(t){return te(this._rgb,2,-t),this}saturate(t){return te(this._rgb,1,t),this}desaturate(t){return te(this._rgb,1,-t),this}rotate(t){return e=this._rgb,t=t,(i=Yt(e))[0]=Xt(i[0]+t),i=Ut(i),e.r=i[0],e.g=i[1],e.b=i[2],this;var e,i}}function re(t){return!(!t||"object"!=typeof t||"[object CanvasPattern]"!==(t=t.toString())&&"[object CanvasGradient]"!==t)}function ne(t){return re(t)?t:new ae(t)}function oe(t){return re(t)?t:new ae(t).saturate(.5).darken(.1).hexString()}const le=["x","y","borderWidth","radius","tension"],he=["color","borderColor","backgroundColor"],ce=new Map;function de(t,e,a){return function(t,e){e=a||{};var i=t+JSON.stringify(e);let s=ce.get(i);return s||(s=new Intl.NumberFormat(t,e),ce.set(i,s)),s}(e).format(t)}const ue={values:t=>O(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";var s=this.chart.options.locale;let a,r=t;if(1<i.length){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||1e15<e)&&(a="scientific"),r=function(t){let e=3<i.length?i[2].value-i[1].value:i[1].value-i[0].value;return e=1<=Math.abs(e)&&t!==Math.floor(t)?t-Math.floor(t):e}(t)}var n=o(Math.abs(r)),n=isNaN(n)?1:Math.max(Math.min(-1*Math.floor(n),20),0),n={notation:a,minimumFractionDigits:n,maximumFractionDigits:n};return Object.assign(n,this.options.ticks.format),de(t,s,n)},logarithmic(t,e,i){var s;return 0===t?"0":(s=i[e].significand||t/Math.pow(10,Math.floor(o(t))),[1,2,3,5,10,15].includes(s)||e>.8*i.length?ue.numeric.call(this,t,e,i):"")}};var ge={formatters:ue};const fe=Object.create(null),pe=Object.create(null);function me(i,t){if(t){var s=t.split(".");for(let t=0,e=s.length;t<e;++t){var a=s[t];i=i[a]||(i[a]=Object.create(null))}}return i}function be(t,e,i){return"string"==typeof e?Y(me(t,e),i):Y(me(t,""),e)}var R=new class{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>oe(e.backgroundColor),this.hoverBorderColor=(t,e)=>oe(e.borderColor),this.hoverColor=(t,e)=>oe(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),this.apply(e)}set(t,e){return be(this,t,e)}get(t){return me(this,t)}describe(t,e){return be(pe,t,e)}override(t,e){return be(fe,t,e)}route(t,e,i,s){const a=me(this,t),r=me(this,i),n="_"+e;Object.defineProperties(a,{[n]:{value:a[e],writable:!0},[e]:{enumerable:!0,get(){var t=this[n],e=r[s];return A(t)?Object.assign({},e,t):T(t,e)},set(t){this[n]=t}}})}apply(t){t.forEach(t=>t(this))}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:he},numbers:{type:"number",properties:le}}),t.describe("animations",{_fallback:"animation"}),t.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}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width: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:ge.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function xe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ve(t){let e=t.parentNode;return e=e&&"[object ShadowRoot]"===e.toString()?e.host:e}function _e(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 ye=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function Me(t,e){return ye(t).getPropertyValue(e)}const we=["top","right","bottom","left"];function ke(e,i,s){var a={};s=s?"-"+s:"";for(let t=0;t<4;t++){var r=we[t];a[r]=parseFloat(e[i+"-"+r+s])||0}return a.width=a.left+a.right,a.height=a.top+a.bottom,a}function Se(t,e){if("native"in t)return t;var{canvas:i,currentDevicePixelRatio:s}=e,a=ye(i),r="border-box"===a.boxSizing,n=ke(a,"padding"),a=ke(a,"border","width"),{x:t,y:o,box:l}=function(t,e){var i,s=t.touches,s=s&&s.length?s[0]:t,{offsetX:a,offsetY:r}=s;let n,o,l=!1;if(i=r,t=t.target,!(0<a||0<i)||t&&t.shadowRoot){const t=e.getBoundingClientRect();n=s.clientX-t.left,o=s.clientY-t.top,l=!0}else n=a,o=r;return{x:n,y:o,box:l}}(t,i),h=n.left+(l&&a.left),l=n.top+(l&&a.top);let{width:c,height:d}=e;return r&&(c-=n.width+a.width,d-=n.height+a.height),{x:Math.round((t-h)/c*i.width/s),y:Math.round((o-l)/d*i.height/s)}}const Pe=t=>Math.round(10*t)/10;function De(t,e,i,s){var a=ye(t),r=ke(a,"margin"),n=_e(a.maxWidth,t,"clientWidth")||tt,o=_e(a.maxHeight,t,"clientHeight")||tt,t=function(t,e,i){let s,a;if(void 0===e||void 0===i){var r=ve(t);if(r){const t=r.getBoundingClientRect(),n=ye(r),o=ke(n,"border","width"),l=ke(n,"padding");e=t.width-l.width-o.width,i=t.height-l.height-o.height,s=_e(n.maxWidth,r,"clientWidth"),a=_e(n.maxHeight,r,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||tt,maxHeight:a||tt}}(t,e,i);let{width:l,height:h}=t;if("content-box"===a.boxSizing){const t=ke(a,"border","width"),e=ke(a,"padding");l-=e.width+t.width,h-=e.height+t.height}return l=Math.max(0,l-r.width),h=Math.max(0,s?l/s:h-r.height),l=Pe(Math.min(l,n,t.maxWidth)),h=Pe(Math.min(h,o,t.maxHeight)),l&&!h&&(h=Pe(l/2)),(void 0!==e||void 0!==i)&&s&&t.height&&h>t.height&&(h=t.height,l=Pe(Math.floor(h*s))),{width:l,height:h}}function Ce(t,e,i){var e=e||1,s=Math.floor(t.height*e),a=Math.floor(t.width*e),r=(t.height=Math.floor(t.height),t.width=Math.floor(t.width),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!==e||r.height!==s||r.width!==a)&&(t.currentDevicePixelRatio=e,r.height=s,r.width=a,t.ctx.setTransform(e,0,0,e,0,0),!0)}var Oe=function(){let t=!1;try{var e={get passive(){return!(t=!0)}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function Ae(t,e){t=Me(t,e),e=t&&t.match(/^(\d+)(\.\d+)?px$/);return e?+e[1]:void 0}function Te(t){return!t||P(t.size)||P(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Le(t,e,i,s,a){let r=e[a];return r||(r=e[a]=t.measureText(a).width,i.push(a)),s=r>s?r:s}function Ee(t,e,i,s){let a=(s=s||{}).data=s.data||{},r=s.garbageCollect=s.garbageCollect||[],n=(s.font!==e&&(a=s.data={},r=s.garbageCollect=[],s.font=e),t.save(),t.font=e,0);var o=i.length;let l,h,c,d,u;for(l=0;l<o;l++)if(null==(d=i[l])||O(d)){if(O(d))for(h=0,c=d.length;h<c;h++)null==(u=d[h])||O(u)||(n=Le(t,a,r,n,u))}else n=Le(t,a,r,n,d);t.restore();var g=r.length/2;if(g>i.length){for(l=0;l<g;l++)delete a[r[l]];r.splice(0,g)}return n}function Re(t,e,i){t=t.currentDevicePixelRatio,i=0!==i?Math.max(i/2,.5):0;return Math.round((e-i)*t)/t+i}function Ie(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function ze(t,e,i,s){Fe(t,e,i,s,null)}function Fe(t,e,i,s,a){let r,n,o,l,h,c,d,u;var g=e.pointStyle,f=e.rotation,p=e.radius;let m=(f||0)*et;if(g&&"object"==typeof g&&("[object HTMLImageElement]"===(r=g.toString())||"[object HTMLCanvasElement]"===r))t.save(),t.translate(i,s),t.rotate(m),t.drawImage(g,-g.width/2,-g.height/2,g.width,g.height),t.restore();else if(!(isNaN(p)||p<=0)){switch(t.beginPath(),g){default:a?t.ellipse(i,s,a/2,p,0,0,v):t.arc(i,s,p,0,v),t.closePath();break;case"triangle":c=a?a/2:p,t.moveTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=st,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=st,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),t.closePath();break;case"rectRounded":h=.516*p,l=p-h,n=Math.cos(m+it)*l,d=Math.cos(m+it)*(a?a/2-h:l),o=Math.sin(m+it)*l,u=Math.sin(m+it)*(a?a/2-h:l),t.arc(i-d,s-o,h,m-S,m-D),t.arc(i+u,s-n,h,m-D,m),t.arc(i+d,s+o,h,m,m+D),t.arc(i-u,s+n,h,m+D,m+S),t.closePath();break;case"rect":if(!f){l=Math.SQRT1_2*p,c=a?a/2:l,t.rect(i-c,s-l,2*c,2*l);break}m+=it;case"rectRot":d=Math.cos(m)*(a?a/2:p),n=Math.cos(m)*p,o=Math.sin(m)*p,u=Math.sin(m)*(a?a/2:p),t.moveTo(i-d,s-o),t.lineTo(i+u,s-n),t.lineTo(i+d,s+o),t.lineTo(i-u,s+n),t.closePath();break;case"crossRot":m+=it;case"cross":d=Math.cos(m)*(a?a/2:p),n=Math.cos(m)*p,o=Math.sin(m)*p,u=Math.sin(m)*(a?a/2:p),t.moveTo(i-d,s-o),t.lineTo(i+d,s+o),t.moveTo(i+u,s-n),t.lineTo(i-u,s+n);break;case"star":d=Math.cos(m)*(a?a/2:p),n=Math.cos(m)*p,o=Math.sin(m)*p,u=Math.sin(m)*(a?a/2:p),t.moveTo(i-d,s-o),t.lineTo(i+d,s+o),t.moveTo(i+u,s-n),t.lineTo(i-u,s+n),m+=it,d=Math.cos(m)*(a?a/2:p),n=Math.cos(m)*p,o=Math.sin(m)*p,u=Math.sin(m)*(a?a/2:p),t.moveTo(i-d,s-o),t.lineTo(i+d,s+o),t.moveTo(i+u,s-n),t.lineTo(i-u,s+n);break;case"line":n=a?a/2:Math.cos(m)*p,o=Math.sin(m)*p,t.moveTo(i-n,s-o),t.lineTo(i+n,s+o);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(m)*(a?a/2:p),s+Math.sin(m)*p);break;case!1:t.closePath()}t.fill(),0<e.borderWidth&&t.stroke()}}function M(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Ve(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Be(t){t.restore()}function We(t,e,i,s,a){if(!e)return t.lineTo(i.x,i.y);if("middle"===a){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===a!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Ne(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function He(t,e,i,s,a,r={}){var n,o,l,h,c,d,u,g,f=O(e)?e:[e],p=0<r.strokeWidth&&""!==r.strokeColor;let m,b;for(t.save(),t.font=a.string,e=t,(g=r).translation&&e.translate(g.translation[0],g.translation[1]),P(g.rotation)||e.rotate(g.rotation),g.color&&(e.fillStyle=g.color),g.textAlign&&(e.textAlign=g.textAlign),g.textBaseline&&(e.textBaseline=g.textBaseline),m=0;m<f.length;++m)b=f[m],r.backdrop&&(c=t,d=r.backdrop,u=void 0,u=c.fillStyle,c.fillStyle=d.color,c.fillRect(d.left,d.top,d.width,d.height),c.fillStyle=u),p&&(r.strokeColor&&(t.strokeStyle=r.strokeColor),P(r.strokeWidth)||(t.lineWidth=r.strokeWidth),t.strokeText(b,i,s,r.maxWidth)),t.fillText(b,i,s,r.maxWidth),d=t,c=i,u=s,n=b,h=l=void 0,((o=r).strikethrough||o.underline)&&(l=c-(n=d.measureText(n)).actualBoundingBoxLeft,c=c+n.actualBoundingBoxRight,h=u-n.actualBoundingBoxAscent,u=u+n.actualBoundingBoxDescent,n=o.strikethrough?(h+u)/2:u,d.strokeStyle=d.fillStyle,d.beginPath(),d.lineWidth=o.decorationWidth||2,d.moveTo(l,n),d.lineTo(c,n),d.stroke()),s+=Number(a.lineHeight);t.restore()}function je(t,e){var{x:e,y:i,w:s,h:a,radius:r}=e;t.arc(e+r.topLeft,i+r.topLeft,r.topLeft,-D,S,!0),t.lineTo(e,i+a-r.bottomLeft),t.arc(e+r.bottomLeft,i+a-r.bottomLeft,r.bottomLeft,S,D,!0),t.lineTo(e+s-r.bottomRight,i+a),t.arc(e+s-r.bottomRight,i+a-r.bottomRight,r.bottomRight,D,0,!0),t.lineTo(e+s,i+r.topRight),t.arc(e+s-r.topRight,i+r.topRight,r.topRight,0,-D,!0),t.lineTo(e+r.topLeft,i)}function Ye(o,l=[""],t,e,a=()=>o[0]){const i=t||o;void 0===e&&(e=ti("_fallback",o));t={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:o,_rootScopes:i,_fallback:e,_getTarget:a,override:t=>Ye([t,...o],l,i,e)};return new Proxy(t,{deleteProperty:(t,e)=>(delete t[e],delete t._keys,delete o[0][e],!0),get:(r,n)=>Ke(r,n,()=>{var t,e=n,i=o,s=r;for(const a of l)if(t=ti(Xe(a,e),i),void 0!==t)return qe(e,t)?Je(i,s,e,t):t}),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(o[0]),has:(t,e)=>ei(t).includes(e),ownKeys:t=>ei(t),set(t,e,i){var s=t._storage||(t._storage=a());return t[e]=s[e]=i,delete t._keys,!0}})}function $e(s,e,i,a){var t={_cacheable:!1,_proxy:s,_context:e,_subProxy:i,_stack:new Set,_descriptors:Ue(s,a),setContext:t=>$e(s,t,i,a),override:t=>$e(s.override(t),e,i,a)};return new Proxy(t,{deleteProperty:(t,e)=>(delete t[e],delete s[e],!0),get:(o,h,c)=>Ke(o,h,()=>{{var l=o,e=h,i=c,{_proxy:s,_context:a,_subProxy:r,_descriptors:n}=l;let t=s[e];return O(t=g(t)&&n.isScriptable(e)?function(t,e,i){var{_proxy:s,_context:a,_subProxy:r,_stack:n}=l;if(n.has(t))throw new Error("Recursion detected: "+Array.from(n).join("->")+"->"+t);n.add(t);let o=e(a,r||i);return n.delete(t),o=qe(t,o)?Je(s._scopes,s,t,o):o}(e,t,i):t)&&t.length&&(t=function(t,e,i,s){var{_proxy:a,_context:r,_subProxy:n,_descriptors:o}=i;if(void 0!==r.index&&s(t))return e[r.index%e.length];if(A(e[0])){const i=e,s=a._scopes.filter(t=>t!==i);e=[];for(const A of i){const i=Je(s,a,t,A);e.push($e(i,r,n&&n[t],o))}}return e}(e,t,l,n.isIndexable)),t=qe(e,t)?$e(t,a,r&&r[e],n):t}}),getOwnPropertyDescriptor:(t,e)=>t._descriptors.allKeys?Reflect.has(s,e)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,e),getPrototypeOf:()=>Reflect.getPrototypeOf(s),has:(t,e)=>Reflect.has(s,e),ownKeys:()=>Reflect.ownKeys(s),set:(t,e,i)=>(s[e]=i,delete t[e],!0)})}function Ue(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:a=e.allKeys}=t;return{allKeys:a,scriptable:i,indexable:s,isScriptable:g(i)?i:()=>i,isIndexable:g(s)?s:()=>s}}const Xe=(t,e)=>t?t+K(e):e,qe=(t,e)=>A(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Ke(t,e,i){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:(i=i(),t[e]=i)}function Ge(t,e,i){return g(t)?t(e,i):t}function Ze(t,e,i,s,a){for(const o of e){r=i,n=o;const e=!0===r?n:"string"==typeof r?f(n,r):void 0;if(e){t.add(e);n=Ge(e._fallback,i,a);if(void 0!==n&&n!==i&&n!==s)return n}else if(!1===e&&void 0!==s&&i!==s)return null}var r,n;return!1}function Je(t,s,a,r){var e=s._rootScopes,i=Ge(s._fallback,a,r),t=[...t,...e],n=new Set,o=(n.add(r),Qe(n,t,a,i||a,r));return null!==o&&(void 0===i||i===a||null!==(o=Qe(n,t,i,o,r)))&&Ye(Array.from(n),[""],e,i,()=>{return t=a,e=r,i=s._getTarget(),t in i||(i[t]={}),O(i=i[t])&&A(e)?e:i||{};var t,e,i})}function Qe(t,e,i,s,a){for(;i;)i=Ze(t,e,i,s,a);return i}function ti(t,e){for(const i of e)if(i){const e=i[t];if(void 0!==e)return e}}function ei(t){let e=t._keys;return e=e||(t._keys=function(t){var 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))}function ii(t,e,i,s){var a=t["iScale"],{key:r="r"}=this._parsing,n=new Array(s);let o,l,h,c;for(o=0,l=s;o<l;++o)c=e[h=o+i],n[o]={r:a.parse(f(c,r),h)};return n}const si=Number.EPSILON||1e-14,ai=(t,e)=>e<t.length&&!t[e].skip&&t[e],ri=t=>"x"===t?"y":"x";function ni(t,e,i,s){var t=t.skip?e:t,a=e,e=i.skip?e:i,i=gt(a,t),r=gt(e,a),n=i/(i+r),i=r/(i+r),r=s*(isNaN(n)?0:n),n=s*(isNaN(i)?0:i);return{previous:{x:a.x-r*(e.x-t.x),y:a.y-r*(e.y-t.y)},next:{x:a.x+n*(e.x-t.x),y:a.y+n*(e.y-t.y)}}}function oi(t,r="x"){var e=ri(r),i=t.length,o=Array(i).fill(0),l=Array(i);let s,a,n,h=ai(t,0);for(s=0;s<i;++s)if(a=n,n=h,h=ai(t,s+1),n){if(h){const t=h[r]-n[r];o[s]=0!=t?(h[e]-n[e])/t:0}l[s]=a?h?_(o[s-1])!==_(o[s])?0:(o[s-1]+o[s])/2:o[s-1]:o[s]}{var c=t,d=o,u=l,g=c.length;let e,i,s,a,r,n=ai(c,0);for(let t=0;t<g-1;++t)r=n,n=ai(c,t+1),r&&n&&(at(d[t],0,si)?u[t]=u[t+1]=0:(e=u[t]/d[t],i=u[t+1]/d[t],(a=Math.pow(e,2)+Math.pow(i,2))<=9||(s=3/Math.sqrt(a),u[t]=e*s*d[t],u[t+1]=i*s*d[t])))}{var[f,p,m="x"]=[t,l,r];const b=ri(m),x=f.length;let e,i,s,a=ai(f,0);for(let t=0;t<x;++t)if(i=s,s=a,a=ai(f,t+1),s){const x=s[m],v=s[b];i&&(e=(x-i[m])/3,s["cp1"+m]=x-e,s["cp1"+b]=v-e*p[t]),a&&(e=(a[m]-x)/3,s["cp2"+m]=x+e,s["cp2"+b]=v+e*p[t])}}}function li(t,e,i){return Math.max(Math.min(t,i),e)}function hi(n,e,o,i,t){let s,a,r,l;if(e.spanGaps&&(n=n.filter(t=>!t.skip)),"monotone"===e.cubicInterpolationMode)oi(n,t);else{let t=i?n[n.length-1]:n[0];for(s=0,a=n.length;s<a;++s)r=n[s],l=ni(t,r,n[Math.min(s+1,a-(i?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,t=r}if(e.capBezierPoints){var h=n,c=o;let t,e,i,s,a,r=M(h[0],c);for(t=0,e=h.length;t<e;++t)a=s,s=r,r=t<e-1&&M(h[t+1],c),s&&(i=h[t],a&&(i.cp1x=li(i.cp1x,c.left,c.right),i.cp1y=li(i.cp1y,c.top,c.bottom)),r)&&(i.cp2x=li(i.cp2x,c.left,c.right),i.cp2y=li(i.cp2y,c.top,c.bottom))}}const ci=t=>0===t||1===t,di=(t,e,i)=>-Math.pow(2,10*--t)*Math.sin((t-e)*v/i),ui=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*v/i)+1,gi={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*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*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*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*D),easeOutSine:t=>Math.sin(t*D),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=>ci(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>1<=t?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1- --t*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ci(t)?t:di(t,.075,.3),easeOutElastic:t=>ci(t)?t:ui(t,.075,.3),easeInOutElastic(t){return ci(t)?t:t<.5?.5*di(2*t,.1125,.45):.5+.5*ui(2*t-1,.1125,.45)},easeInBack(t){return t*t*(2.70158*t-1.70158)},easeOutBack(t){return--t*t*(2.70158*t+1.70158)+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-gi.easeOutBounce(1-t),easeOutBounce(t){var 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*gi.easeInBounce(2*t):.5*gi.easeOutBounce(2*t-1)+.5};function fi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function pi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:("middle"===s?i<.5?t:e:"after"===s?i<1?t:e:0<i?e:t).y}}function mi(t,e,i,s){var a={x:t.cp2x,y:t.cp2y},r={x:e.cp1x,y:e.cp1y},t=fi(t,a,i),a=fi(a,r,i),r=fi(r,e,i),e=fi(t,a,i),t=fi(a,r,i);return fi(e,t,i)}const bi=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,xi=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function vi(t,e){var i=(""+t).match(bi);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}const _i=t=>+t||0;function yi(e,i){var t={},s=A(i),a=s?Object.keys(i):i,r=A(e)?s?t=>T(e[t],e[i[t]]):t=>e[t]:()=>e;for(const e of a)t[e]=_i(r(e));return t}function Mi(t){return yi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function wi(t){return yi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function I(t){t=Mi(t);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function z(t,e){e=e||R.font;let i=T((t=t||{}).size,e.size),s=("string"==typeof i&&(i=parseInt(i,10)),T(t.style,e.style));s&&!(""+s).match(xi)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);t={family:T(t.family,e.family),lineHeight:vi(T(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:T(t.weight,e.weight),string:""};return t.string=Te(t),t}function ki(t,e,i,s){let a,r,n,o=!0;for(a=0,r=t.length;a<r;++a)if(void 0!==(n=t[a])&&(void 0!==e&&"function"==typeof n&&(n=n(e),o=!1),void 0!==i&&O(n)&&(n=n[i%n.length],o=!1),void 0!==n))return s&&!o&&(s.cacheable=!1),n}function Si(t,e,i){var{min:t,max:s}=t,e=B(e,(s-t)/2),a=(t,e)=>i&&0===t?0:t+e;return{min:a(t,-Math.abs(e)),max:a(s,e)}}function Pi(t,e){return Object.assign(Object.create(t),e)}function Di(t,e,i){return t?(s=e,a=i,{x:t=>s+s+a-t,setWidth(t){a=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t};var s,a}function Ci(t,e){var i,s;"ltr"!==e&&"rtl"!==e||(s=[(i=t.canvas.style).getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Oi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Ai(t){return"angle"===t?{between:pt,compare:ft,normalize:y}:{between:c,compare:(t,e)=>t-e,normalize:t=>t}}function Ti({start:t,end:e,count:i,loop:s,style:a}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:a}}function Li(t,i,g){if(!g)return[t];const{property:s,start:a,end:r}=g,n=i.length,{compare:o,between:l,normalize:h}=Ai(s),{start:c,end:d,loop:u,style:f}=function(t,e){var{property:i,start:s,end:a}=g,{between:r,normalize:n}=Ai(i),o=e.length;let l,h,{start:c,end:d,loop:u}=t;if(u){for(c+=o,d+=o,l=0,h=o;l<h&&r(n(e[c%o][i]),s,a);++l)c--,d--;c%=o,d%=o}return d<c&&(d+=o),{start:c,end:d,loop:u,style:t.style}}(t,i),p=[];let m,b,x,v,_=null;for(let t=c,e=c;t<=d;++t)(b=i[t%n]).skip||(m=h(b[s]))!==x&&(v=l(m,a,r),null===(_=null===_&&(v||l(a,x,m)&&0!==o(a,x))?0===o(m,a)?t:e:_)||v&&0!==o(r,m)&&!l(r,x,m)||(p.push(Ti({start:_,end:t,loop:u,count:n,style:f})),_=null),e=t,x=m);return null!==_&&p.push(Ti({start:_,end:d,loop:u,count:n,style:f})),p}function Ei(e,i){var s=[],a=e.segments;for(let t=0;t<a.length;t++){var r=Li(a[t],e.points,i);r.length&&s.push(...r)}return s}function Ri(t,e){var i,s,a,r=t.points,n=t.options.spanGaps,o=r.length;return o?({start:s,end:a}=function(t,e,i){let s=0,a=e-1;if(i&&!n)for(;s<e&&!t[s].skip;)s++;for(;s<e&&t[s].skip;)s++;for(s%=e,i&&(a+=s);a>s&&t[a%e].skip;)a--;return a%=e,{start:s,end:a}}(r,o,i=!!t._loop),Ii(t,!0===n?[{start:s,end:a,loop:i}]:function(t,e,i,s){var a=t.length,r=[];let n,o=e,l=t[e];for(n=e+1;n<=i;++n){const i=t[n%a];i.skip||i.stop?l.skip||(s=!1,r.push({start:e%a,end:(n-1)%a,loop:s}),e=o=i.stop?n:null):(o=n,l.skip&&(e=n)),l=i}return null!==o&&r.push({start:e%a,end:o%a,loop:s}),r}(r,s,a<s?a+o:a,!!t._fullLoop&&0===s&&a===o-1),r,e)):[]}function Ii(t,e,s,a){if(a&&a.setContext&&s){var o=t,t=e,l=s,h=a;const d=o._chart.getContext(),u=zi(o.options),{_datasetIndex:g,options:{spanGaps:f}}=o,p=l.length,m=[];let r=u,n=t[0].start,i=n;function c(t,e,i,s){var a=f?-1:1;if(t!==e){for(t+=p;l[t%p].skip;)t-=a;for(;l[e%p].skip;)e+=a;t%p!=e%p&&(m.push({start:t%p,end:e%p,loop:i,style:s}),r=s,n=e%p)}}for(const o of t){n=f?n:o.start;let t,e=l[n%p];for(i=n+1;i<=o.end;i++){const f=l[i%p];(function(t,e){if(!e)return;function i(t,e){return re(e)?(s.includes(e)||s.push(e),s.indexOf(e)):e}const s=[];return JSON.stringify(t,i)!==JSON.stringify(e,i)})(t=zi(h.setContext(Pi(d,{type:"segment",p0:e,p1:f,p0DataIndex:(i-1)%p,p1DataIndex:i%p,datasetIndex:g}))),r)&&c(n,i-1,o.loop,r),e=f,r=t}n<i-1&&c(n,i-1,o.loop,r)}return m}return e}function zi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}var Fi=Object.freeze({__proto__:null,HALF_PI:D,INFINITY:tt,PI:S,PITAU:Q,QUARTER_PI:it,RAD_PER_DEG:et,TAU:v,TWO_THIRDS_PI:st,_addGrace:Si,_alignPixel:Re,_alignStartEnd:E,_angleBetween:pt,_angleDiff:ft,_arrayUnique:wt,_attachContext:$e,_bezierCurveTo:Ne,_bezierInterpolation:mi,_boundSegment:Li,_boundSegments:Ei,_capitalize:K,_computeSegments:Ri,_createResolver:Ye,_decimalPlaces:dt,_deprecated:function(t,e,i,s){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+s+'" instead')},_descriptors:Ue,_elementsEqual:W,_factorize:nt,_filterBetween:vt,_getParentNode:ve,_getStartAndCountOfVisiblePoints:Ot,_int16Range:mt,_isBetween:c,_isClickEvent:J,_isDomSupported:xe,_isPointInArea:M,_limitValue:C,_longestText:Ee,_lookup:bt,_lookupByKey:m,_measureText:Le,_merger:j,_mergerIf:U,_normalizeAngle:y,_parseObjectDataRadialScale:ii,_pointInLine:fi,_readValueToProps:yi,_rlookupByKey:xt,_scaleRangesChanged:At,_setMinAndMaxByKey:ht,_splitKey:q,_steppedInterpolation:pi,_steppedLineTo:We,_textX:Ct,_toLeftRightCenter:Dt,_updateBezierControlPoints:hi,addRoundedRectPath:je,almostEquals:at,almostWhole:lt,callback:d,clearCanvas:Ie,clipArea:Ve,clone:N,color:ne,createContext:Pi,debounce:Pt,defined:G,distanceBetweenPoints:gt,drawPoint:ze,drawPointLegend:Fe,each:k,easingEffects:gi,finiteOrDefault:u,fontString:function(t,e,i){return e+" "+t+"px "+i},formatNumber:de,getAngleFromPoint:ut,getHoverColor:oe,getMaximumSize:De,getRelativePosition:Se,getRtlAdapter:Di,getStyle:Me,isArray:O,isFinite:p,isFunction:g,isNullOrUndef:P,isNumber:ot,isObject:A,isPatternOrGradient:re,listenArrayEvents:yt,log10:o,merge:Y,mergeIf:$,niceNum:rt,noop:t,overrideTextDirection:Ci,readUsedSize:Ae,renderText:He,requestAnimFrame:kt,resolve:ki,resolveObjectKey:f,restoreTextDirection:Oi,retinaScale:Ce,setsEqual:Z,sign:_,splineCurve:ni,splineCurveMonotone:oi,supportsEventListenerOptions:Oe,throttled:St,toDegrees:ct,toDimension:B,toFont:z,toFontString:Te,toLineHeight:vi,toPadding:I,toPercentage:V,toRadians:L,toTRBL:Mi,toTRBLCorners:wi,uid:F,unclipArea:Be,unlistenArrayEvents:Mt,valueOrDefault:T});function Vi(t,i,s,a,r){var n=t.getSortedVisibleDatasetMetas(),o=s[i];for(let t=0,e=n.length;t<e;++t){const{index:s,data:l}=n[t],{lo:h,hi:c}=function(t,e,i,s){const{controller:a,data:r,_sorted:n}=t,o=a._cachedMeta.iScale;if(o&&e===o.axis&&"r"!==e&&n&&r.length){const t=o._reversePixels?xt:m;if(!s)return t(r,e,i);if(a._sharedOptions){const s=r[0],a="function"==typeof s.getRange&&s.getRange(e);if(a){const s=t(r,e,i-a),n=t(r,e,i+a);return{lo:s.lo,hi:n.hi}}}}return{lo:0,hi:r.length-1}}(n[t],i,o,r);for(let t=h;t<=c;++t){const i=l[t];i.skip||a(i,s,t)}}}function Bi(s,a,t,r,n){const o=[];return(n||s.isPointInArea(a))&&Vi(s,t,a,function(t,e,i){(n||M(t,s.chartArea,0))&&t.inRange(a.x,a.y,r)&&o.push({element:t,datasetIndex:e,index:i})},!0),o}function Wi(t,e,i,s,a,o){{if(o||t.isPointInArea(e)){if("r"!==i||s){var l=t,h=e,c=i,d=s,u=a,g=o;let r=[];const m=function(t){const s=-1!==t.indexOf("x"),a=-1!==t.indexOf("y");return function(t,e){var i=s?Math.abs(t.x-e.x):0,t=a?Math.abs(t.y-e.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(t,2))}}(c);let n=Number.POSITIVE_INFINITY;return Vi(l,c,h,function(t,e,i){var s,a=t.inRange(h.x,h.y,u);(!d||a)&&(s=t.getCenterPoint(u),g||l.isPointInArea(s)||a)&&((a=m(h,s))<n?(r=[{element:t,datasetIndex:e,index:i}],n=a):a===n&&r.push({element:t,datasetIndex:e,index:i}))}),r}{var f=e,p=a;let n=[];return Vi(t,i,f,function(t,e,i){var{startAngle:s,endAngle:a}=t.getProps(["startAngle","endAngle"],p),r=ut(t,{x:f.x,y:f.y})["angle"];pt(r,s,a)&&n.push({element:t,datasetIndex:e,index:i})}),n}}return[]}}function Ni(t,s,a,e,r){const n=[],o="x"===a?"inXRange":"inYRange";let l=!1;return Vi(t,a,s,(t,e,i)=>{t[o](s[a],r)&&(n.push({element:t,datasetIndex:e,index:i}),l=l||t.inRange(s.x,s.y,r))}),e&&!l?[]:n}var Hi={evaluateInteractionItems:Vi,modes:{index(t,e,i,s){const a=Se(e,t),r=i.axis||"x",n=i.includeInvisible||!1,o=i.intersect?Bi(t,a,r,s,n):Wi(t,a,r,!1,s,n),l=[];return o.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{var e=o[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})}),l):[]},dataset(t,e,i,s){var e=Se(e,t),a=i.axis||"xy",r=i.includeInvisible||!1;let n=i.intersect?Bi(t,e,a,s,r):Wi(t,e,a,!1,s,r);if(0<n.length){const e=n[0].datasetIndex,i=t.getDatasetMeta(e).data;n=[];for(let t=0;t<i.length;++t)n.push({element:i[t],datasetIndex:e,index:t})}return n},point:(t,e,i,s)=>Bi(t,Se(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){var e=Se(e,t),a=i.axis||"xy",r=i.includeInvisible||!1;return Wi(t,e,a,i.intersect,s,r)},x:(t,e,i,s)=>Ni(t,Se(e,t),"x",i.intersect,s),y:(t,e,i,s)=>Ni(t,Se(e,t),"y",i.intersect,s)}};const ji=["left","top","right","bottom"];function Yi(t,e){return t.filter(t=>t.pos===e)}function $i(t,e){return t.filter(t=>-1===ji.indexOf(t.pos)&&t.box.axis===e)}function Ui(t,s){return t.sort((t,e)=>{var i=s?e:t,t=s?t:e;return i.weight===t.weight?i.index-t.index:i.weight-t.weight})}function Xi(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 Ki(t,e,i,s){var a=[];let r,n,o,l,h,c;for(r=0,n=t.length,h=0;r<n;++r){o=t[r],(l=o.box).update(o.width||e.w,o.height||e.h,function(t,e){const i=e.maxPadding;{const s={left:0,top:0,right:0,bottom:0};return(t=t?["left","right"]:["top","bottom"]).forEach(t=>{s[t]=Math.max(e[t],i[t])}),s}}(o.horizontal,e));const{same:n,other:d}=function(t,e,i,s){var{pos:a,box:r}=i,n=t.maxPadding;if(!A(a)){i.size&&(t[a]-=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[a]+=i.size}return r.getPadding&&qi(n,r.getPadding()),s=Math.max(0,e.outerWidth-Xi(n,t,"left","right")),a=Math.max(0,e.outerHeight-Xi(n,t,"top","bottom")),r=s!==t.w,e=a!==t.h,t.w=s,t.h=a,i.horizontal?{same:r,other:e}:{same:e,other:r}}(e,i,o,s);h|=n&&a.length,c=c||d,l.fullSize||a.push(o)}return h&&Ki(a,e,i,s)||c}function Gi(t,e,i,s,a){t.top=i,t.left=e,t.right=e+s,t.bottom=i+a,t.width=s,t.height=a}function Zi(t,e,i,s){var a=i.padding;let{x:r,y:n}=e;for(const o of t){const t=o.box,l=s[o.stack]||{count:1,placed:0,weight:1},h=o.stackWeight/l.weight||1;if(o.horizontal){const s=e.w*h,r=l.size||t.height;G(l.start)&&(n=l.start),t.fullSize?Gi(t,a.left,n,i.outerWidth-a.right-a.left,r):Gi(t,e.left+l.placed,n,s,r),l.start=n,l.placed+=s,n=t.bottom}else{const s=e.h*h,n=l.size||t.width;G(l.start)&&(r=l.start),t.fullSize?Gi(t,r,a.top,n,i.outerHeight-a.bottom-a.top):Gi(t,r,e.top+l.placed,n,s),l.start=r,l.placed+=s,r=t.right}}e.x=r,e.y=n}var a={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){e=t.boxes?t.boxes.indexOf(e):-1;-1!==e&&t.boxes.splice(e,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(e,t,i,s){if(e){var a,r,n=I(e.options.layout.padding),o=Math.max(t-n.width,0),l=Math.max(i-n.height,0),h=(c=function(t){var e=[];let i,s,a,r,n,o;for(i=0,s=(t||[]).length;i<s;++i)({position:r,options:{stack:n,stackWeight:o=1}}=a=t[i]),e.push({index:i,box:a,pos:r,horizontal:a.isHorizontal(),weight:a.weight,stack:n&&r+n,stackWeight:o});return e}(e.boxes),h=Ui(c.filter(t=>t.box.fullSize),!0),d=Ui(Yi(c,"left"),!0),u=Ui(Yi(c,"right")),f=Ui(Yi(c,"top"),!0),a=Ui(Yi(c,"bottom")),r=$i(c,"x"),g=$i(c,"y"),{fullSize:h,leftAndTop:d.concat(f),rightAndBottom:u.concat(g).concat(a).concat(r),chartArea:Yi(c,"chartArea"),vertical:d.concat(u).concat(g),horizontal:f.concat(a).concat(r)}),c=h.vertical,d=h.horizontal,u=(k(e.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}),c.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1),g=Object.freeze({outerWidth:t,outerHeight:i,padding:n,availableWidth:o,availableHeight:l,vBoxMaxWidth:o/2/u,hBoxMaxHeight:l/2}),f=Object.assign({},n);qi(f,I(s));const b=Object.assign({maxPadding:f,w:o,h:l,x:n.left,y:n.top},n),x=function(t,e){var i=function(t){var e,i={};for(const s of t){const{stack:t,pos:a,stackWeight:r}=s;t&&ji.includes(a)&&((e=i[t]||(i[t]={count:0,placed:0,weight:0,size:0})).count++,e.weight+=r)}return i}(t),{vBoxMaxWidth:s,hBoxMaxHeight:a}=e;let r,n,o;for(r=0,n=t.length;r<n;++r){const n=(o=t[r]).box["fullSize"],l=i[o.stack],h=l&&o.stackWeight/l.weight;o.horizontal?(o.width=h?h*s:n&&e.availableWidth,o.height=a):(o.width=s,o.height=h?h*a:n&&e.availableHeight)}return i}(c.concat(d),g);Ki(h.fullSize,b,g,x),Ki(c,b,g,x),Ki(d,b,g,x)&&Ki(c,b,g,x);{var p=b;const v=p.maxPadding;function m(t){var e=Math.max(v[t]-p[t],0);return p[t]+=e,e}p.y+=m("top"),p.x+=m("left"),m("right"),m("bottom")}Zi(h.leftAndTop,b,g,x),b.x+=b.w,b.y+=b.h,Zi(h.rightAndBottom,b,g,x),e.chartArea={left:b.left,top:b.top,right:b.left+b.w,bottom:b.top+b.h,height:b.h,width:b.w},k(h.chartArea,t=>{t=t.box;Object.assign(t,e.chartArea),t.update(b.w,b.h,{left:0,top:0,right:0,bottom:0})})}}};class Ji{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 Qi extends Ji{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ts="$chartjs",es={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},is=t=>null===t||""===t,ss=!!Oe&&{passive:!0};function as(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function rs(t,e,i){const s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(const i of t)e=e||as(i.addedNodes,s),e=e&&!as(i.removedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}function ns(t,e,i){const s=t.canvas,a=new MutationObserver(t=>{let e=!1;for(const i of t)e=e||as(i.removedNodes,s),e=e&&!as(i.addedNodes,s);e&&i()});return a.observe(document,{childList:!0,subtree:!0}),a}const os=new Map;let ls=0;function hs(){const i=window.devicePixelRatio;i!==ls&&(ls=i,os.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function cs(t,e,s){const i=t.canvas,a=i&&ve(i);if(a){const n=St((t,e)=>{var i=a.clientWidth;s(t,e),i<a.clientWidth&&s()},window),o=new ResizeObserver(t=>{var t=t[0],e=t.contentRect.width,t=t.contentRect.height;0===e&&0===t||n(e,t)});return o.observe(a),t=t,r=n,os.size||window.addEventListener("resize",hs),os.set(t,r),o;var r}}function ds(t,e,i){i&&i.disconnect(),"resize"===e&&(i=t,os.delete(i),os.size||window.removeEventListener("resize",hs))}function us(e,t,i){var s=e.canvas,a=St(t=>{null!==e.ctx&&i(function(t,e){var i=es[t.type]||t.type,{x:s,y:a}=Se(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==a?a:null}}(t,e))},e);return s.addEventListener(t,a,ss),a}class gs extends Ji{acquireContext(t,e){var i=t&&t.getContext&&t.getContext("2d");{if(i&&i.canvas===t){var s=e,e=t.style,a=t.getAttribute("height"),r=t.getAttribute("width");if(t[ts]={initial:{height:a,width:r,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",is(r)){const s=Ae(t,"width");void 0!==s&&(t.width=s)}if(is(a))if(""===t.style.height)t.height=t.width/(s||2);else{const s=Ae(t,"height");void 0!==s&&(t.height=s)}return i}return null}}releaseContext(t){const i=t.canvas;if(!i[ts])return!1;const s=i[ts].initial,e=(["height","width"].forEach(t=>{var e=s[t];P(e)?i.removeAttribute(t):i.setAttribute(t,e)}),s.style||{});return Object.keys(e).forEach(t=>{i.style[t]=e[t]}),i.width=i.width,delete i[ts],!0}addEventListener(t,e,i){this.removeEventListener(t,e);var s=t.$proxies||(t.$proxies={}),a={attach:rs,detach:ns,resize:cs}[e]||us;s[e]=a(t,e,i)}removeEventListener(t,e){var i=t.$proxies||(t.$proxies={}),s=i[e];s&&(({attach:ds,detach:ds,resize:ds}[e]||function(t,e,i){t.canvas.removeEventListener(e,i,ss)})(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return De(t,e,i,s)}isAttached(t){t=ve(t);return!(!t||!t.isConnected)}}function fs(t){return!xe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Qi:gs}Oe=Object.freeze({__proto__:null,BasePlatform:Ji,BasicPlatform:Qi,DomPlatform:gs,_detectPlatform:fs});const ps="transparent",ms={boolean:(t,e,i)=>.5<i?e:t,color(t,e,i){var t=ne(t||ps),s=t.valid&&ne(e||ps);return s&&s.valid?s.mix(t,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class bs{constructor(t,e,i,s){var a=e[i],a=(s=ki([t.to,s,a,t.from]),ki([t.from,a,s]));this._active=!0,this._fn=t.fn||ms[t.type||typeof a],this._easing=gi[t.easing]||gi.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=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){var s,a,r;this._active&&(this._notify(!1),s=this._target[this._prop],a=i-this._start,r=this._duration-a,this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=a,this._loop=!!t.loop,this._to=ki([t.to,e,s,t.from]),this._from=ki([t.from,s,e]))}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){var t=t-this._start,e=this._duration,i=this._prop,s=this._from,a=this._loop,r=this._to;this._active=s!==r&&(a||t<e),this._active?t<0?this._target[i]=s:(t=t/e%2,t=this._easing(Math.min(1,Math.max(0,a&&1<t?2-t:t))),this._target[i]=this._fn(s,r,t)):(this._target[i]=r,this._notify(!0))}wait(){const i=this._promises||(this._promises=[]);return new Promise((t,e)=>{i.push({res:t,rej:e})})}_notify(t){var e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class xs{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(s){if(A(s)){const a=Object.keys(R.animation),r=this._properties;Object.getOwnPropertyNames(s).forEach(e=>{var t=s[e];if(A(t)){const i={};for(const s of a)i[s]=t[s];(O(t.properties)&&t.properties||[e]).forEach(t=>{t!==e&&r.has(t)||r.set(t,i)})}})}}_animateOptions(t,e){const i=e.options,s=function(e,i){if(i){let t=e.options;if(t)return t.$shared&&(e.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t;e.options=i}}(t,i);return s?(e=this._createAnimations(s,i),i.$shared&&function(e,t){var i=[],s=Object.keys(t);for(let t=0;t<s.length;t++){var a=e[s[t]];a&&a.active()&&i.push(a.wait())}return Promise.all(i)}(t.options.$animations,i).then(()=>{t.options=i},()=>{}),e):[]}_createAnimations(e,i){var s=this._properties,a=[],r=e.$animations||(e.$animations={}),t=Object.keys(i),n=Date.now();let o;for(o=t.length-1;0<=o;--o){var l=t[o];if("$"!==l.charAt(0))if("options"===l)a.push(...this._animateOptions(e,i));else{var h=i[l];let t=r[l];var c=s.get(l);if(t){if(c&&t.active()){t.update(c,h,n);continue}t.cancel()}c&&c.duration?(r[l]=t=new bs(c,e,l,h),a.push(t)):e[l]=h}}return a}update(t,e){var i;if(0!==this._properties.size)return(i=this._createAnimations(t,e)).length?(r.add(this._chart,i),!0):void 0;Object.assign(t,e)}}function vs(t,e){var t=t&&t.options||{},i=t.reverse,s=void 0===t.min?e:0,t=void 0===t.max?e:0;return{start:i?t:s,end:i?s:t}}function _s(t,e){var i=[],s=t._getSortedDatasetMetas(e);let a,r;for(a=0,r=s.length;a<r;++a)i.push(s[a].index);return i}function ys(t,e,i,s={}){var a=t.keys,r="single"===s.mode;let n,o,l,h;if(null!==e){for(n=0,o=a.length;n<o;++n){if((l=+a[n])===i){if(s.all)continue;break}p(h=t.values[l])&&(r||0===e||_(e)===_(h))&&(e+=h)}return e}}function Ms(t,e){t=t&&t.options.stacked;return t||void 0===t&&void 0!==e.stack}function ws(t,e,i,s){for(const a of e.getMatchingVisibleMetas(s).reverse()){const e=t[a.index];if(i&&0<e||!i&&e<0)return a.index}return null}function ks(t,e){const{chart:i,_cachedMeta:s}=t,a=i._stacks||(i._stacks={}),{iScale:r,vScale:n,index:o}=s,l=r.axis,h=n.axis,c=`${r.id}.${n.id}.`+(s.stack||s.type),d=e.length;var u,g,f;for(let t=0;t<d;++t){const i=e[t],{[l]:r,[h]:d}=i;(g=(i._stacks||(i._stacks={}))[h]=(f=r,(u=(u=a)[g=c]||(u[g]={}))[f]||(u[f]={})))[o]=d,g._top=ws(g,n,!0,s.type),g._bottom=ws(g,n,!1,s.type),(g._visualValues||(g._visualValues={}))[o]=d}}function Ss(t,e){const i=t.scales;return Object.keys(i).filter(t=>i[t].axis===e).shift()}function Ps(t,e){var 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],void 0!==e[s]._visualValues&&void 0!==e[s]._visualValues[i]&&delete e[s]._visualValues[i]}}}const Ds=t=>"reset"===t||"none"===t,Cs=(t,e)=>e?t:Object.assign({},t);class Os{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){var t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ms(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ps(this._cachedMeta),this.index=t}linkScales(){var t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,a=e.xAxisID=T(i.xAxisID,Ss(t,"x")),r=e.yAxisID=T(i.yAxisID,Ss(t,"y")),i=e.rAxisID=T(i.rAxisID,Ss(t,"r")),t=e.indexAxis,n=e.iAxisID=s(t,a,r,i),s=e.vAxisID=s(t,r,a,i);e.xScale=this.getScaleForId(a),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(i),e.iScale=this.getScaleForId(n),e.vScale=this.getScaleForId(s)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){var e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){var t=this._cachedMeta;this._data&&Mt(this._data,this),t._stacked&&Ps(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(A(e))this._data=function(t){var e=Object.keys(t),i=new Array(e.length);let s,a,r;for(s=0,a=e.length;s<a;++s)r=e[s],i[s]={x:r,y:t[r]};return i}(e);else if(i!==e){if(i){Mt(i,this);const t=this._cachedMeta;Ps(t),t._parsed=[]}e&&Object.isExtensible(e)&&yt(e,this),this._syncList=[],this._data=e}}addElements(){var t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){var e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();var a=e._stacked;e._stacked=Ms(e.vScale,e),e.stack!==i.stack&&(s=!0,Ps(e),e.stack=i.stack),this._resyncElements(t),!s&&a===e._stacked||ks(this,e._parsed)}configure(){var t=this.chart.config,e=t.datasetScopeKeys(this._type),e=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(e,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:a,_stacked:r}=i,n=a.axis;let o,l,h,c=0===t&&e===s.length||i._sorted,d=0<t&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,h=s;else{h=O(s[t])?this.parseArrayData(i,s,t,e):A(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const a=()=>null===l[n]||d&&l[n]<d[n];for(o=0;o<e;++o)i._parsed[o+t]=l=h[o],c&&(a()&&(c=!1),d=l);i._sorted=c}r&&ks(this,h)}parsePrimitiveData(t,e,i,s){var{iScale:a,vScale:r}=t,n=a.axis,o=r.axis,l=a.getLabels(),h=a===r,c=new Array(s);let d,u,g;for(d=0,u=s;d<u;++d)g=d+i,c[d]={[n]:h||a.parse(l[g],g),[o]:r.parse(e[g],g)};return c}parseArrayData(t,e,i,s){var{xScale:a,yScale:r}=t,n=new Array(s);let o,l,h,c;for(o=0,l=s;o<l;++o)c=e[h=o+i],n[o]={x:a.parse(c[0],h),y:r.parse(c[1],h)};return n}parseObjectData(t,e,i,s){var{xScale:a,yScale:r}=t,{xAxisKey:n="x",yAxisKey:o="y"}=this._parsing,l=new Array(s);let h,c,d,u;for(h=0,c=s;h<c;++h)u=e[d=h+i],l[h]={x:a.parse(f(u,n),d),y:r.parse(f(u,o),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){var s=this.chart,a=this._cachedMeta,r=e[t.axis];return ys({keys:_s(s,!0),values:e._stacks[t.axis]._visualValues},r,a.index,{mode:i})}updateRangeFromParsed(t,e,i,s){var a=i[e.axis];let r=null===a?NaN:a;i=s&&i._stacks[e.axis];s&&i&&(s.values=i,r=ys(s,a,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(e,t){const i=this._cachedMeta,s=i._parsed,a=i._sorted&&e===i.iScale,r=s.length,n=this._getOtherScale(e),o=(d=this.chart,t&&!i.hidden&&i._stacked&&{keys:_s(d,!0),values:null}),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:c}=function(){var{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}();var d;let u,g;function f(){var t=(g=s[u])[n.axis];return!p(g[e.axis])||h>t||c<t}for(u=0;u<r&&(f()||(this.updateRangeFromParsed(l,e,g,o),!a));++u);if(a)for(u=r-1;0<=u;--u)if(!f()){this.updateRangeFromParsed(l,e,g,o);break}return l}getAllParsedValues(t){var e=this._cachedMeta._parsed,i=[];let s,a,r;for(s=0,a=e.length;s<a;++s)p(r=e[s][t.axis])&&i.push(r);return i}getMaxOverflow(){return!1}getLabelAndValue(t){var e=this._cachedMeta,i=e.iScale,e=e.vScale,t=this.getParsed(t);return{label:i?""+i.getLabelForValue(t[i.axis]):"",value:e?""+e.getLabelForValue(t[e.axis]):""}}_update(t){var e,i=this._cachedMeta;this.update(t||"default"),i._clip=function(t){let e,i,s,a;return A(t)?(e=t.top,i=t.right,s=t.bottom,a=t.left):e=i=s=a=t,{top:e,right:i,bottom:s,left:a,disabled:!1===t}}(T(this.options.clip,(t=i.xScale,i=i.yScale,!1!==(e=this.getMaxOverflow())&&(t=vs(t,e),{top:(i=vs(i,e)).end,right:t.end,bottom:i.start,left:t.start}))))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],a=e.chartArea,r=[],n=this._drawStart||0,o=this._drawCount||s.length-n,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,a,n,o),h=n;h<n+o;++h){const e=s[h];e.hidden||(e.active&&l?r.push(e):e.draw(t,a))}for(h=0;h<r.length;++h)r[h].draw(t,a)}getStyle(t,e){e=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(e):this.resolveDataElementOptions(t||0,e)}getContext(t,e,i){var s,a=this.getDataset();let r;if(0<=t&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];(r=e.$context||(e.$context=Pi(this.getContext(),{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"}))).parsed=this.getParsed(t),r.raw=a.data[t],r.index=r.dataIndex=t}else(r=this.$context||(this.$context=(t=this.chart.getContext(),s=this.index,Pi(t,{active:!1,dataset:void 0,datasetIndex:s,index:s,mode:"default",type:"dataset"})))).dataset=a,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s="active"===e,a=this._cachedDataOpts,r=t+"-"+e,n=a[r],o=this.enableOptionSharing&&G(i);var l,h,c;return n?Cs(n,o):(h=(c=this.chart.config).datasetElementScopeKeys(this._type,t),l=s?[t+"Hover","hover",t,""]:[t,""],h=c.getOptionScopes(this.getDataset(),h),t=Object.keys(R.elements[t]),(c=c.resolveNamedOptions(h,t,()=>this.getContext(i,s,e),l)).$shared&&(c.$shared=o,a[r]=Object.freeze(Cs(c,o))),c)}_resolveAnimations(t,e,i){const s=this.chart,a=this._cachedDataOpts,r="animation-"+e,n=a[r];if(n)return n;let o;if(!1!==s.options.animation){const s=this.chart.config,a=s.datasetAnimationScopeKeys(this._type,e),r=s.getOptionScopes(this.getDataset(),a);o=s.createResolver(r,this.getContext(t,i,e))}t=new xs(s,o&&o.animations);return o&&o._cacheable&&(a[r]=Object.freeze(t)),t}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ds(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){var t=this.resolveDataElementOptions(t,e),i=this._sharedOptions,s=this.getSharedOptions(t),i=this.includeOptions(e,s)||s!==i;return this.updateSharedOptions(s,e,t),{sharedOptions:s,includeOptions:i}}updateElement(t,e,i,s){Ds(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ds(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;var a=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(a)||a})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];var s=i.length,a=e.length,r=Math.min(a,s);r&&this.parse(0,r),s<a?this._insertElements(s,a-s,t):a<s&&this._removeElements(a,s-a)}_insertElements(t,e,i=!0){const s=this._cachedMeta,a=s.data,r=t+e;let n;var o=t=>{for(t.length+=e,n=t.length-1;n>=r;n--)t[n]=t[n-e]};for(o(a),n=t;n<r;++n)a[n]=new this.dataElementType;this._parsing&&o(s._parsed),this.parse(t,e),i&&this.updateElements(a,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){var i,s=this._cachedMeta;this._parsing&&(i=s._parsed.splice(t,e),s._stacked)&&Ps(s,i),s.data.splice(t,e)}_sync(t){var e,i,s;this._parsing?this._syncList.push(t):([e,i,s]=t,this[e](i,s)),this.chart._dataChanges.push([this.index,...t])}_onDataPush(){var t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);e=arguments.length-2;e&&this._sync(["_insertElements",t,e])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class e{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){var{x:t,y:e}=this.getProps(["x","y"],t);return{x:t,y:e}}hasValue(){return ot(this.x)&&ot(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]}),s}}function As(t,e,i,s,a){var r=T(s,0),n=Math.min(T(a,t.length),t.length);let o,l,h,c=0;for(i=Math.ceil(i),a&&(i=(o=a-s)/Math.floor(o/i)),h=r;h<0;)c++,h=Math.round(r+c*i);for(l=Math.max(r,0);l<n;l++)l===h&&(e.push(t[l]),c++,h=Math.round(r+c*i))}const Ts=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,Ls=(t,e)=>Math.min(e||t,t);function Es(t,e){var i=[],s=t.length/e,a=t.length;let r=0;for(;r<a;r+=s)i.push(t[Math.floor(r)]);return i}function Rs(t){return t.drawTicks?t.tickLength:0}function Is(t,e){var i;return t.display?(e=z(t.font,e),i=I(t.padding),(O(t.text)?t.text.length:1)*e.lineHeight+i.height):0}class zs extends e{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(){var{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this,t=u(t,Number.POSITIVE_INFINITY),e=u(e,Number.NEGATIVE_INFINITY),i=u(i,Number.POSITIVE_INFINITY),s=u(s,Number.NEGATIVE_INFINITY);return{min:u(t,i),max:u(e,s),minDefined:p(t),maxDefined:p(e)}}getMinMax(i){let s,{min:a,max:r,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:a,max:r};var l=this.getMatchingVisibleMetas();for(let t=0,e=l.length;t<e;++t)s=l[t].controller.getMinMax(this,i),n||(a=Math.min(a,s.min)),o||(r=Math.max(r,s.max));return a=o&&a>r?r:a,r=n&&a>r?a:r,{min:u(a,u(r,a)),max:u(r,u(a,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){var t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){d(this.options.beforeUpdate,[this])}update(t,e,i){var{beginAtZero:s,grace:a,ticks:r}=this.options,n=r.sampleSize,t=(this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Si(this,a,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks(),n<this.ticks.length);this._convertTicksToLabels(t?Es(this.ticks,n):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||"auto"===r.source)&&(this.ticks=function(t,s){const e=t.options.ticks,i=(c=(t=t).options.offset,d=t._tickSize(),c=t._length/d+(c?0:1),t=t._maxLength/d,Math.floor(Math.min(c,t))),a=Math.min(e.maxTicksLimit||i,i),r=e.major.enabled?function(t){var e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}(s):[],n=r.length,o=r[0],l=r[n-1],h=[];var c,d;if(a<n){var u=s;var g=h;var f=r;var p=n/a;let t,e=0,i=f[0];for(p=Math.ceil(p),t=0;t<u.length;t++)t===i&&(g.push(u[t]),e++,i=f[e*p])}else{var m=function(t,i,e){var t=function(t){var e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),s=i.length/e;if(t){var a=nt(t);for(let t=0,e=a.length-1;t<e;t++){const i=a[t];if(i>s)return i}}return Math.max(s,1)}(r,s,a);if(0<n){let t,e;const i=1<n?Math.round((l-o)/(n-1)):null;for(As(s,h,m,P(i)?0:o-i,o),t=0,e=n-1;t<e;t++)As(s,h,m,r[t],r[t+1]);As(s,h,m,l,P(i)?s.length:l+i)}else As(s,h,m)}return h}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),t&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){d(this.options.afterUpdate,[this])}beforeSetDimensions(){d(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){d(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),d(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){d(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){var e=this.options.ticks;let i,s,a;for(i=0,s=t.length;i<s;i++)(a=t[i]).label=d(e.callback,[a.value,i,t],this)}afterTickToLabelConversion(){d(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){d(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){var t,e,i,s,a=this.options,r=a.ticks,n=Ls(this.ticks.length,a.ticks.maxTicksLimit),o=r.minRotation||0,l=r.maxRotation;let h,c,d,u=o;!this._isVisible()||!r.display||l<=o||n<=1||!this.isHorizontal()?this.labelRotation=o:(e=(t=this._getLabelSizes()).widest.width,i=t.highest.height,s=C(this.chart.width-e,0,this.maxWidth),(a.offset?this.maxWidth/n:s/(n-1))<e+6&&(h=s/(n-(a.offset?.5:1)),c=this.maxHeight-Rs(a.grid)-r.padding-Is(a.title,this.chart.options.font),d=Math.sqrt(e*e+i*i),u=ct(Math.min(Math.asin(C((t.highest.height+6)/h,-1,1)),Math.asin(C(c/d,-1,1))-Math.asin(C(i/d,-1,1)))),u=Math.max(o,Math.min(l,u))),this.labelRotation=u)}afterCalculateLabelRotation(){d(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){d(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:a}}=this,r=this._isVisible(),n=this.isHorizontal();if(r){const r=Is(s,e.options.font);if(n?(t.width=this.maxWidth,t.height=Rs(a)+r):(t.height=this.maxHeight,t.width=Rs(a)+r),i.display&&this.ticks.length){const{first:e,last:s,widest:a,highest:r}=this._getLabelSizes(),o=2*i.padding,l=L(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(n){const e=i.mirror?0:c*a.width+h*r.height;t.height=Math.min(this.maxHeight,t.height+e+o)}else{const e=i.mirror?0:h*a.width+c*r.height;t.width=Math.min(this.maxWidth,t.width+e+o)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),n?(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(i,s,a,r){const{ticks:{align:n,padding:o},position:l}=this.options,h=0!==this.labelRotation,c="top"!==l&&"x"===this.axis;if(this.isHorizontal()){const l=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let t=0,e=0;h?e=c?(t=r*i.width,a*s.height):(t=a*i.height,r*s.width):"start"===n?e=s.width:"end"===n?t=i.width:"inner"!==n&&(t=i.width/2,e=s.width/2),this.paddingLeft=Math.max((t-l+o)*this.width/(this.width-l),0),this.paddingRight=Math.max((e-d+o)*this.width/(this.width-d),0)}else{let t=s.height/2,e=i.height/2;"start"===n?(t=0,e=i.height):"end"===n&&(t=s.height,e=0),this.paddingTop=t+o,this.paddingBottom=e+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(){d(this.options.afterFit,[this])}isHorizontal(){var{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)P(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){var i=this.options.ticks.sampleSize;let t=this.ticks;i<t.length&&(t=Es(t,i)),this._labelSizes=e=this._computeLabelSizes(t,t.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(t,e,i){const{ctx:s,_longestTextCache:a}=this,r=[],n=[],o=Math.floor(e/Ls(e,i));let l,h,c,d,u,g,f,p,m,b,x,v=0,_=0;for(l=0;l<e;l+=o){if(d=t[l].label,u=this._resolveTickFontOptions(l),s.font=g=u.string,f=a[g]=a[g]||{data:{},gc:[]},p=u.lineHeight,m=b=0,P(d)||O(d)){if(O(d))for(h=0,c=d.length;h<c;++h)P(x=d[h])||O(x)||(m=Le(s,f.data,f.gc,m,x),b+=p)}else m=Le(s,f.data,f.gc,m,d),b=p;r.push(m),n.push(b),v=Math.max(m,v),_=Math.max(b,_)}y=e,k(a,t=>{var e=t.gc,i=e.length/2;let s;if(y<i){for(s=0;s<i;++s)delete t.data[e[s]];e.splice(0,i)}});var y,i=r.indexOf(v),M=n.indexOf(_),w=t=>({width:r[t]||0,height:n[t]||0});return{first:w(0),last:w(e-1),widest:w(i),highest:w(M),widths:r,heights:n}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);t=this._startPixel+t*this._length;return mt(this._alignToPixels?Re(this.chart,t,0):t)}getDecimalForPixel(t){t=(t-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){var{min:t,max:e}=this;return t<0&&e<0?e:0<t&&0<e?t:0}getContext(t){var e=this.ticks||[];return 0<=t&&t<e.length?(e=e[t]).$context||(e.$context=Pi(this.getContext(),{tick:e,index:t,type:"tick"})):this.$context||(this.$context=Pi(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){var t=this.options.ticks,e=L(this.labelRotation),i=Math.abs(Math.cos(e)),e=Math.abs(Math.sin(e)),s=this._getLabelSizes(),t=t.autoSkipPadding||0,a=s?s.widest.width+t:0,s=s?s.highest.height+t:0;return this.isHorizontal()?a*e<s*i?a/i:s/e:s*e<a*i?s/i:a/e}_isVisible(){var t=this.options.display;return"auto"!==t?!!t:0<this.getMatchingVisibleMetas().length}_computeGridLineItems(t){function e(t){return Re(s,t,f)}const i=this.axis,s=this.chart,a=this.options,{grid:r,position:n,border:o}=a,l=r.offset,h=this.isHorizontal(),c=this.ticks.length+(l?1:0),d=Rs(r),u=[],g=o.setContext(this.getContext()),f=g.display?g.width:0,p=f/2;let m,b,x,v,_,y,M,w,k,S,P,D;if("top"===n)m=e(this.bottom),y=this.bottom-d,w=m-p,S=e(t.top)+p,D=t.bottom;else if("bottom"===n)m=e(this.top),S=t.top,D=e(t.bottom)-p,y=m+p,w=this.top+d;else if("left"===n)m=e(this.right),_=this.right-d,M=m-p,k=e(t.left)+p,P=t.right;else if("right"===n)m=e(this.left),k=t.left,P=e(t.right)-p,_=m+p,M=this.left+d;else if("x"===i){if("center"===n)m=e((t.top+t.bottom)/2+.5);else if(A(n)){const t=Object.keys(n)[0],i=n[t];m=e(this.chart.scales[t].getPixelForValue(i))}S=t.top,D=t.bottom,y=m+p,w=y+d}else if("y"===i){if("center"===n)m=e((t.left+t.right)/2);else if(A(n)){const t=Object.keys(n)[0],i=n[t];m=e(this.chart.scales[t].getPixelForValue(i))}_=m-p,M=_-d,k=t.left,P=t.right}var t=T(a.ticks.maxTicksLimit,c),C=Math.max(1,Math.ceil(c/t));for(b=0;b<c;b+=C){const t=this.getContext(b),i=r.setContext(t),a=o.setContext(t),A=i.lineWidth,n=i.color,T=a.dash||[],c=a.dashOffset,d=i.tickWidth,g=i.tickColor,f=i.tickBorderDash||[],p=i.tickBorderDashOffset;void 0!==(x=function(t,e,i){var s=t.ticks.length,a=Math.min(e,s-1),r=t._startPixel,n=t._endPixel;let o,l=t.getPixelForTick(a);if(!(i&&(o=1===s?Math.max(l-r,n-l):0===e?(t.getPixelForTick(1)-l)/2:(l-t.getPixelForTick(a-1))/2,(l+=a<e?o:-o)<r-1e-6||l>n+1e-6)))return l}(this,b,l))&&(v=Re(s,x,A),h?_=M=k=P=v:y=w=S=D=v,u.push({tx1:_,ty1:y,tx2:M,ty2:w,x1:k,y1:S,x2:P,y2:D,width:A,color:n,borderDash:T,borderDashOffset:c,tickWidth:d,tickColor:g,tickBorderDash:f,tickBorderDashOffset:p}))}return this._ticksLength=c,this._borderValue=m,u}_computeLabelItems(s){const a=this.axis,r=this.options,{position:n,ticks:e}=r,o=this.isHorizontal(),l=this.ticks,{align:h,crossAlign:c,padding:t,mirror:d}=e,i=Rs(r.grid),u=i+t,g=d?-t:u,f=-L(this.labelRotation),p=[];let m,b,x,v,_,y,M,w,k,S,P,D="middle";if("top"===n)_=this.bottom-g,y=this._getXAxisLabelAlignment();else if("bottom"===n)_=this.top+g,y=this._getXAxisLabelAlignment();else if("left"===n){const s=this._getYAxisLabelAlignment(i);y=s.textAlign,v=s.x}else if("right"===n){const s=this._getYAxisLabelAlignment(i);y=s.textAlign,v=s.x}else if("x"===a){if("center"===n)_=(s.top+s.bottom)/2+u;else if(A(n)){const s=Object.keys(n)[0],a=n[s];_=this.chart.scales[s].getPixelForValue(a)+u}y=this._getXAxisLabelAlignment()}else if("y"===a){if("center"===n)v=(s.left+s.right)/2-u;else if(A(n)){const s=Object.keys(n)[0],a=n[s];v=this.chart.scales[s].getPixelForValue(a)}y=this._getYAxisLabelAlignment(i).textAlign}"y"===a&&("start"===h?D="top":"end"===h&&(D="bottom"));var C=this._getLabelSizes();for(m=0,b=l.length;m<b;++m){x=l[m].label;const s=e.setContext(this.getContext(m)),a=(M=this.getPixelForTick(m)+e.labelOffset,k=(w=this._resolveTickFontOptions(m)).lineHeight,(S=O(x)?x.length:1)/2),r=s.color,A=s.textStrokeColor,h=s.textStrokeWidth;let i,t=y;if(o?(v=M,"inner"===y&&(t=m===b-1?this.options.reverse?"left":"right":0===m?this.options.reverse?"right":"left":"center"),P="top"===n?"near"===c||0!=f?-S*k+k/2:"center"===c?-C.highest.height/2-a*k+k:-C.highest.height+k/2:"near"===c||0!=f?k/2:"center"===c?C.highest.height/2-a*k:C.highest.height-S*k,d&&(P*=-1),0==f||s.showLabelBackdrop||(v+=k/2*Math.sin(f))):(_=M,P=(1-S)*k/2),s.showLabelBackdrop){const a=I(s.backdropPadding),r=C.heights[m],n=C.widths[m];let t=P-a.top,e=0-a.left;switch(D){case"middle":t-=r/2;break;case"bottom":t-=r}switch(y){case"center":e-=n/2;break;case"right":e-=n}i={left:e,top:t,width:n+a.width,height:r+a.height,color:s.backdropColor}}p.push({label:x,font:w,textOffset:P,options:{rotation:f,color:r,strokeColor:A,strokeWidth:h,textAlign:t,textBaseline:D,translation:[v,_],backdrop:i}})}return p}_getXAxisLabelAlignment(){var{position:t,ticks:e}=this.options;if(-L(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){var{position:e,ticks:{crossAlign:i,mirror:s,padding:a}}=this.options,t=t+a,r=this._getLabelSizes().widest.width;let n,o;return"left"===e?s?(o=this.right+a,"near"===i?n="left":"center"===i?(n="center",o+=r/2):(n="right",o+=r)):(o=this.right-t,"near"===i?n="right":"center"===i?(n="center",o-=r/2):(n="left",o=this.left)):"right"===e?s?(o=this.left+a,"near"===i?n="right":"center"===i?(n="center",o-=r/2):(n="left",o-=r)):(o=this.left+t,"near"===i?n="left":"center"===i?(n="center",o+=r/2):(n="right",o=this.right)):n="right",{textAlign:n,x:o}}_computeLabelArea(){var t,e;if(!this.options.ticks.mirror)return t=this.chart,"left"===(e=this.options.position)||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){var{ctx:t,options:{backgroundColor:e},left:i,top:s,width:a,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,a,r),t.restore())}getLineWidthForValue(e){var t,i=this.options.grid;return this._isVisible()&&i.display&&0<=(t=this.ticks.findIndex(t=>t.value===e))?i.setContext(this.getContext(t)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let a,r;var n=(t,e,i)=>{i.width&&i.color&&(s.save(),s.lineWidth=i.width,s.strokeStyle=i.color,s.setLineDash(i.borderDash||[]),s.lineDashOffset=i.borderDashOffset,s.beginPath(),s.moveTo(t.x,t.y),s.lineTo(e.x,e.y),s.stroke(),s.restore())};if(e.display)for(a=0,r=i.length;a<r;++a){const t=i[a];e.drawOnChartArea&&n({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&n({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){var{chart:a,ctx:r,options:{border:n,grid:o}}=this,l=n.setContext(this.getContext()),n=n.display?l.width:0;if(n){var o=o.setContext(this.getContext(0)).lineWidth,h=this._borderValue;let t,e,i,s;this.isHorizontal()?(t=Re(a,this.left,n)-n/2,e=Re(a,this.right,o)+o/2,i=s=h):(i=Re(a,this.top,n)-n/2,s=Re(a,this.bottom,o)+o/2,t=e=h),r.save(),r.lineWidth=l.width,r.strokeStyle=l.color,r.beginPath(),r.moveTo(t,i),r.lineTo(e,s),r.stroke(),r.restore()}}drawLabels(t){if(this.options.ticks.display){const e=this.ctx,i=this._computeLabelArea(),s=(i&&Ve(e,i),this.getLabelItems(t));for(const t of s){const i=t.options,s=t.font;He(e,t.label,0,t.textOffset,s,i)}i&&Be(e)}}drawTitle(){var{ctx:e,options:{position:i,title:s,reverse:a}}=this;if(s.display){var r=z(s.font),n=I(s.padding),o=s.align;let t=r.lineHeight/2;"bottom"===i||"center"===i||A(i)?(t+=n.bottom,O(s.text)&&(t+=r.lineHeight*(s.text.length-1))):t+=n.top;var{titleX:n,titleY:l,maxWidth:h,rotation:c}=function(t,e,i,s){var{top:a,left:r,bottom:n,right:o,chart:l}=t,{chartArea:l,scales:h}=l;let c,d,u,g=0;var f=n-a,p=o-r;if(t.isHorizontal()){if(d=E(s,r,o),A(i)){const t=Object.keys(i)[0],s=i[t];u=h[t].getPixelForValue(s)+f-e}else u="center"===i?(l.bottom+l.top)/2+f-e:Ts(t,i,e);c=o-r}else{if(A(i)){const t=Object.keys(i)[0],s=i[t];d=h[t].getPixelForValue(s)-p+e}else d="center"===i?(l.left+l.right)/2-p+e:Ts(t,i,e);u=E(s,n,a),g="left"===i?-D:D}return{titleX:d,titleY:u,maxWidth:c,rotation:g}}(this,t,i,o);He(e,s.text,0,0,r,{color:s.color,maxWidth:h,rotation:c,textAlign:function(t,e,i){let s=Dt(t);return s=i&&"right"!==e||!i&&"right"===e?"left"===(t=s)?"right":"right"===t?"left":t:s}(o,i,a),textBaseline:"middle",translation:[n,l]})}}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){var t=this.options,e=t.ticks&&t.ticks.z||0,i=T(t.grid&&t.grid.z,-1),t=T(t.border&&t.border.z,0);return this._isVisible()&&this.draw===zs.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:t,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){var e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let a,r;for(a=0,r=e.length;a<r;++a){const r=e[a];r[i]!==this.id||t&&r.type!==t||s.push(r)}return s}_resolveTickFontOptions(t){return z(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){var t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Fs{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){var e=Object.getPrototypeOf(t);let i;"id"in(n=e)&&"defaults"in n&&(i=this.register(e));var s,a,r,n=this.items,e=t.id,o=this.scope+"."+e;if(e)return e in n||(n[e]=t,n=t,e=o,s=i,s=Y(Object.create(null),[s?R.get(s):{},R.get(e),n.defaults]),R.set(e,s),n.defaultRoutes&&(a=e,r=n.defaultRoutes,Object.keys(r).forEach(t=>{var e=t.split("."),i=e.pop(),e=[a].concat(e).join("."),t=r[t].split("."),s=t.pop(),t=t.join(".");R.route(e,i,t,s)})),n.descriptors&&R.describe(e,n.descriptors),this.override&&R.override(t.id,t.overrides)),o;throw new Error("class does not have id: "+t)}get(t){return this.items[t]}unregister(t){var e=this.items,t=t.id,i=this.scope;t in e&&delete e[t],i&&t in R[i]&&(delete R[i][t],this.override)&&delete fe[t]}}var w=new class{constructor(){this.controllers=new Fs(Os,"datasets",!0),this.elements=new Fs(e,"elements"),this.plugins=new Fs(Object,"plugins"),this.scales=new Fs(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(i,t,s){[...t].forEach(t=>{var e=s||this._getRegistryForType(t);s||e.isForType(t)||e===this.plugins&&t.id?this._exec(i,e,t):k(t,t=>{var e=s||this._getRegistryForType(t);this._exec(i,e,t)})})}_exec(t,e,i){var s=K(t);d(i["before"+s],[],i),e[t](i),d(i["after"+s],[],i)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){var i=this._typedRegistries[t];if(i.isForType(e))return i}return this.plugins}_get(t,e,i){e=e.get(t);if(void 0===e)throw new Error('"'+t+'" is not a registered '+i+".");return e}};class Vs{constructor(){this._init=[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));s=s?this._descriptors(t).filter(s):this._descriptors(t),i=this._notify(s,t,e,i);return"afterDestroy"===e&&(this._notify(s,t,"stop"),this._notify(this._init,t,"uninstall")),i}_notify(t,e,i,s){s=s||{};for(const a of t){const t=a.plugin;if(!1===d(t[i],[e,s,a.options],t)&&s.cancelable)return!1}return!0}invalidate(){P(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){var e;return this._cache||(e=this._cache=this._createDescriptors(t),this._notifyStateChanges(t),e)}_createDescriptors(t,e){var i=t&&t.config,s=T(i.options&&i.options.plugins,{}),i=function(t){const e={},i=[],s=Object.keys(w.plugins.items);for(let t=0;t<s.length;t++)i.push(w.getPlugin(s[t]));var a=t.plugins||[];for(let t=0;t<a.length;t++){const s=a[t];-1===i.indexOf(s)&&(i.push(s),e[s.id]=!0)}return{plugins:i,localIds:e}}(i);if(!1!==s||e){var a,r,n,o,l,h,[c,{plugins:d,localIds:u},g,f]=[t,i,s,e],p=[],m=c.getContext();for(const b of d){const d=b.id,x=(h=g[d],f||!1!==h?!0===h?{}:h:null);null!==x&&p.push({plugin:b,options:([h,{plugin:a,local:r},n,o]=[c.config,{plugin:b,local:u[d]},x,m],l=void 0,l=h.pluginScopeKeys(a),n=h.getOptionScopes(n,l),r&&a.defaults&&n.push(a.defaults),h.createResolver(n,o,[""],{scriptable:!1,indexable:!1,allKeys:!0}))})}return p}return[]}_notifyStateChanges(t){var e=this._oldCache||[],i=this._cache,s=(t,i)=>t.filter(e=>!i.some(t=>e.plugin.id===t.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Bs(t,e){var i=R.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Ws(t){if("x"===t||"y"===t||"r"===t)return t}function Ns(t,...e){if(Ws(t))return t;for(const s of e){const e=s.axis||("top"===(i=s.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||1<t.length&&Ws(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Hs(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function js(t){var e=t.options||(t.options={});e.plugins=T(e.plugins,{}),e.scales=function(n,e){const r=fe[n.type]||{scales:{}},o=e.scales||{},l=Bs(n.type,e),h=Object.create(null);return Object.keys(o).forEach(t=>{var e=o[t];if(!A(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 i=Ns(t,e,function(e,t){if(t.data&&t.data.datasets){t=t.data.datasets.filter(t=>t.xAxisID===e||t.yAxisID===e);if(t.length)return Hs(e,"x",t[0])||Hs(e,"y",t[0])}return{}}(t,n),R.scales[e.type]),s=i===l?"_index_":"_value_",a=r.scales||{};h[t]=$(Object.create(null),[{axis:i},e,a[i],a[s]])}),n.data.datasets.forEach(s=>{const t=s.type||n.type,a=s.indexAxis||Bs(t,e),r=(fe[t]||{}).scales||{};Object.keys(r).forEach(t=>{var e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,a),i=s[e+"AxisID"]||e;h[i]=h[i]||Object.create(null),$(h[i],[{axis:e},o[i],r[t]])})}),Object.keys(h).forEach(t=>{t=h[t];$(t,[R.scales[t.type],R.scale])}),h}(t,e)}function Ys(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const $s=new Map,Us=new Set;function Xs(t,e){let i=$s.get(t);return i||(i=e(),$s.set(t,i),Us.add(i)),i}const qs=(t,e,i)=>{e=f(e,i);void 0!==e&&t.add(e)};class Ks{constructor(t){this._config=((t=(t=t)||{}).data=Ys(t.data),js(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=Ys(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){var t=this._config;this.clearCache(),js(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Xs(t,()=>[["datasets."+t,""]])}datasetAnimationScopeKeys(t,e){return Xs(t+".transition."+e,()=>[[`datasets.${t}.transitions.`+e,"transitions."+e],["datasets."+t,""]])}datasetElementScopeKeys(t,e){return Xs(t+"-"+e,()=>[[`datasets.${t}.elements.`+e,"datasets."+t,"elements."+e,""]])}pluginScopeKeys(t){const e=t.id;return Xs(this.type+"-plugin-"+e,()=>[["plugins."+e,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){var i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(e,t,i){const{options:s,type:a}=this,r=this._cachedScopes(e,i),n=r.get(t);if(n)return n;const o=new Set;t.forEach(t=>{e&&(o.add(e),t.forEach(t=>qs(o,e,t))),t.forEach(t=>qs(o,s,t)),t.forEach(t=>qs(o,fe[a]||{},t)),t.forEach(t=>qs(o,R,t)),t.forEach(t=>qs(o,pe,t))});i=Array.from(o);return 0===i.length&&i.push(Object.create(null)),Us.has(t)&&r.set(t,i),i}chartOptionScopes(){var{options:t,type:e}=this;return[t,fe[e]||{},R.datasets[e]||{},{type:e},R,pe]}resolveNamedOptions(t,e,i,s=[""]){var a={$shared:!0},{resolver:s,subPrefixes:r}=Gs(this._resolverCache,t,s);let n=s;!function(t,e){var{isScriptable:i,isIndexable:s}=Ue(t);for(const a of e){const e=i(a),r=s(a),n=(r||e)&&t[a];if(e&&(g(n)||Zs(n))||r&&O(n))return 1}}(s,e)||(a.$shared=!1,n=$e(s,i=g(i)?i():i,this.createResolver(t,i,r)));for(const t of e)a[t]=n[t];return a}createResolver(t,e,i=[""],s){t=Gs(this._resolverCache,t,i).resolver;return A(e)?$e(t,e,void 0,s):t}}function Gs(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));t=i.join();let a=s.get(t);return a||(a={resolver:Ye(e,i),subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},s.set(t,a)),a}const Zs=i=>A(i)&&Object.getOwnPropertyNames(i).reduce((t,e)=>t||g(i[e]),!1),Js=["top","bottom","left","right","chartArea"];function Qs(t,e){return"top"===t||"bottom"===t||-1===Js.indexOf(t)&&"x"===e}function ta(i,s){return function(t,e){return t[i]===e[i]?t[s]-e[s]:t[i]-e[i]}}function ea(t){var e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),d(i&&i.onComplete,[t],e)}function ia(t){var e=t.chart,i=e.options.animation;d(i&&i.onProgress,[t],e)}function sa(t){return xe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t=t&&t.canvas?t.canvas:t}const aa={},ra=t=>{const e=sa(t);return Object.values(aa).filter(t=>t.canvas===e).pop()};class i{static defaults=R;static instances=aa;static overrides=fe;static registry=w;static version="4.3.3";static getChart=ra;static register(...t){w.add(...t),na()}static unregister(...t){w.remove(...t),na()}constructor(t,e){var e=this.config=new Ks(e),t=sa(t),i=ra(t);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");var i=e.createResolver(e.chartOptionScopes(),this.getContext()),e=(this.platform=new(e.platform||fs(t)),this.platform.updateConfig(e),this.platform.acquireContext(t,i.aspectRatio)),t=e&&e.canvas,s=t&&t.height,a=t&&t.width;this.id=F(),this.ctx=e,this.canvas=t,this.width=a,this.height=s,this._options=i,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 Vs,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Pt(t=>this.update(t),i.resizeDelay||0),this._dataChanges=[],aa[this.id]=this,e&&t?(r.listen(this,"complete",ea),r.listen(this,"progress",ia),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){var{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:a}=this;return P(t)?e&&a?a:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return w}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ce(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ie(this.canvas,this.ctx),this}stop(){return r.stop(this),this}resize(t,e){r.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){var i=this.options,s=this.canvas,a=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(s,t,e,a),t=i.devicePixelRatio||this.platform.getDevicePixelRatio(),e=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,Ce(this,t,!0)&&(this.notifyPlugins("resize",{size:s}),d(i.onResize,[this,s],this),this.attached)&&this._doResize(e)&&this.render()}ensureScalesHaveIDs(){k(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){const n=this.options,s=n.scales,o=this.scales,l=Object.keys(o).reduce((t,e)=>(t[e]=!1,t),{});let t=[];k(t=s?t.concat(Object.keys(s).map(t=>{var e=s[t],t=Ns(t,e),i="r"===t,t="x"===t;return{options:e,dposition:i?"chartArea":t?"bottom":"left",dtype:i?"radialLinear":t?"category":"linear"}})):t,t=>{var e=t.options,i=e.id,s=Ns(i,e),a=T(e.type,t.dtype);void 0!==e.position&&Qs(e.position,s)===Qs(t.dposition)||(e.position=t.dposition),l[i]=!0;let r=null;i in o&&o[i].type===a?r=o[i]:(r=new(w.getScale(a))({id:i,type:a,ctx:this.ctx,chart:this}),o[r.id]=r),r.init(e,n)}),k(l,(t,e)=>{t||delete o[e]}),k(o,t=>{a.configure(this,t,t.options),a.addBox(this,t)})}_updateMetasets(){var t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((t,e)=>t.index-e.index),e<i){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(ta("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:i}}=this;t.length>i.length&&delete this._stacks,t.forEach((e,t)=>{0===i.filter(t=>t===e._dataset).length&&this._destroyDatasetMeta(t)})}buildOrUpdateControllers(){const e=[],i=this.data.datasets;let s,a;for(this._removeUnreferencedMetasets(),s=0,a=i.length;s<a;s++){const a=i[s];let t=this.getDatasetMeta(s);var r=a.type||this.config.type;if(t.type&&t.type!==r&&(this._destroyDatasetMeta(s),t=this.getDatasetMeta(s)),t.type=r,t.indexAxis=a.indexAxis||Bs(r,this.options),t.order=a.order||0,t.index=s,t.label=""+a.label,t.visible=this.isDatasetVisible(s),t.controller)t.controller.updateIndex(s),t.controller.linkScales();else{const i=w.getController(r),{datasetElementType:a,dataElementType:n}=R.datasets[r];Object.assign(i,{dataElementType:w.getElement(n),datasetElementType:a&&w.getElement(a)}),t.controller=new i(this,s),e.push(t.controller)}}return this._updateMetasets(),e}_resetElements(){k(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const s=this.config,a=(s.update(),this._options=s.createResolver(s.chartOptionScopes(),this.getContext())),r=this._animationsDisabled=!a.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1!==this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})){var n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let i=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const s=this.getDatasetMeta(t)["controller"],a=!r&&-1===n.indexOf(s);s.buildOrUpdateElements(a),i=Math.max(+s.getMaxOverflow(),i)}i=this._minPadding=a.layout.autoPadding?i:0,this._updateLayout(i),r||k(n,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ta("z","_idx"));var{_active:t,_lastEvent:e}=this;e?this._eventHandler(e,!0):t.length&&this._updateHoverStyles(t,t,!0),this.render()}}_updateScales(){k(this.scales,t=>{a.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){var t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);Z(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){var t,e,i,s,a=this["_hiddenIndices"];for({method:t,start:e,count:i}of this._getUniformDataChanges()||[]){r=void 0;n=void 0;o=void 0;s=void 0;var r=a;var n=e;var o="_removeElements"===t?-i:i;const l=Object.keys(r);for(const h of l){const l=+h;l>=n&&(s=r[h],delete r[h],0<o||l>n)&&(r[l+o]=s)}}}_getUniformDataChanges(){const t=this._dataChanges;if(t&&t.length){this._dataChanges=[];var e=this.data.datasets.length,i=e=>new Set(t.filter(t=>t[0]===e).map((t,e)=>e+","+t.splice(1).join(","))),s=i(0);for(let t=1;t<e;t++)if(!Z(s,i(t)))return;return Array.from(s).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}}_updateLayout(t){if(!1!==this.notifyPlugins("beforeLayout",{cancelable:!0})){a.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],k(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(i){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:i,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let t=0,e=this.data.datasets.length;t<e;++t)this._updateDataset(t,g(i)?i({datasetIndex:t}):i);this.notifyPlugins("afterDatasetsUpdate",{mode:i})}}_updateDataset(t,e){var i=this.getDatasetMeta(t),t={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",t)&&(i.controller._update(e),t.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",t))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(r.has(this)?this.attached&&!r.running(this)&&r.start(this):(this.draw(),ea({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resize(t,e),this._resizeBeforeDraw=null}if(this.clear(),!(this.width<=0||this.height<=0)&&!1!==this.notifyPlugins("beforeDraw",{cancelable:!0})){const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}}_getSortedDatasetMetas(t){var e=this._sortedMetasets,i=[];let s,a;for(s=0,a=e.length;s<a;++s){const a=e[s];t&&!a.visible||i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1!==this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})){var e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;0<=t;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}}_drawDataset(i){var t=this.ctx,e=i._clip,s=!e.disabled,a=function(){var{xScale:t,yScale:e}=i;if(t&&e)return{left:t.left,right:t.right,top:e.top,bottom:e.bottom}}()||this.chartArea,r={meta:i,index:i.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",r)&&(s&&Ve(t,{left:!1===e.left?0:a.left-e.left,right:!1===e.right?this.width:a.right+e.right,top:!1===e.top?0:a.top-e.top,bottom:!1===e.bottom?this.height:a.bottom+e.bottom}),i.controller.draw(),s&&Be(t),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return M(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){e=Hi.modes[e];return"function"==typeof e?e(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=Pi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){var e=this.data.datasets[t];return!!e&&("boolean"==typeof(t=this.getDatasetMeta(t)).hidden?!t.hidden:!e.hidden)}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(e,t,i){const s=i?"show":"hide",a=this.getDatasetMeta(e),r=a.controller._resolveAnimations(void 0,s);G(t)?(a.data[t].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),r.update(a,{visible:i}),this.update(t=>t.datasetIndex===e?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){var e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),r.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");var{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ie(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete aa[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const i=this._listeners,s=this.platform,e=(t,e)=>{s.addEventListener(this,t,e),i[t]=e},a=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};k(this.options.events,t=>e(t,a))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const i=this._responsiveListeners,s=this.platform,t=(t,e)=>{s.addEventListener(this,t,e),i[t]=e},e=(t,e)=>{i[t]&&(s.removeEventListener(this,t,e),delete i[t])},a=(t,e)=>{this.canvas&&this.resize(t,e)};let r;const n=()=>{e("attach",n),this.attached=!0,this.resize(),t("resize",a),t("detach",r)};r=()=>{this.attached=!1,e("resize",a),this._stop(),this._resize(0,0),t("attach",n)},(s.isAttached(this.canvas)?n:r)()}unbindEvents(){k(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},k(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){var s=i?"set":"remove";let a,r,n;for("dataset"===e&&this.getDatasetMeta(t[0].datasetIndex).controller["_"+s+"DatasetHoverStyle"](),r=0,n=t.length;r<n;++r){const e=(a=t[r])&&this.getDatasetMeta(a.datasetIndex).controller;e&&e[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){var e=this._active||[],t=t.map(({datasetIndex:t,index:e})=>{var i=this.getDatasetMeta(t);if(i)return{datasetIndex:t,element:i.data[e],index:e};throw new Error("No dataset found at index "+t)});W(t,e)||(this._active=t,this._lastEvent=null,this._updateHoverStyles(t,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(e){return 1===this._plugins._cache.filter(t=>t.plugin.id===e).length}_updateHoverStyles(t,e,i){var s=this.options.hover,a=(t,i)=>t.filter(e=>!i.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),r=a(e,t),i=i?t:a(t,e);r.length&&this.updateHoverStyle(r,s.mode,!1),i.length&&s.mode&&this.updateHoverStyle(i,s.mode,!0)}_eventHandler(e,t){var i={event:e,replay:t,cancelable:!0,inChartArea:this.isPointInArea(e)},s=t=>(t.options.events||this.options.events).includes(e.native.type);if(!1!==this.notifyPlugins("beforeEvent",i,s))return t=this._handleEvent(e,t,i.inChartArea),i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(t||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:a}=this,r=e,n=this._getActiveElements(t,s,i,r),o=J(t),l=(h=t,c=this._lastEvent,i&&"mouseout"!==h.type?o?c:h:null);i&&(this._lastEvent=null,d(a.onHover,[t,n,this],this),o)&&d(a.onClick,[t,n,this],this);var h,c=!W(n,s);return(c||e)&&(this._active=n,this._updateHoverStyles(n,s,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,s){return"mouseout"===t.type?[]:i?(i=this.options.hover,this.getElementsAtEventForMode(t,i.mode,i,s)):e}}function na(){k(i.instances,t=>t._plugins.invalidate())}function oa(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var la={_date:class $r{static override(t){Object.assign($r.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return oa()}parse(){return oa()}format(){return oa()}add(){return oa()}diff(){return oa()}startOf(){return oa()}endOf(){return oa()}}};function ha(i,s,a,r){if(O(i)){var n=i,o=s,l=a,h=r,c=l.parse(n[0],h),n=l.parse(n[1],h),h=Math.min(c,n),d=Math.max(c,n);let t=h,e=d;Math.abs(h)>Math.abs(d)&&(t=d,e=h),o[l.axis]=e,o._custom={barStart:t,barEnd:e,start:c,end:n,min:h,max:d}}else s[a.axis]=a.parse(i,r);return s}function ca(t,e,i,s){var a=t.iScale,r=t.vScale,n=a.getLabels(),o=a===r,l=[];let h,c,d,u;for(c=(h=i)+s;h<c;++h)u=e[h],(d={})[a.axis]=o||a.parse(n[h],h),l.push(ha(u,d,r,h));return l}function da(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function ua(t,e,i,s){return t=s?ga(t=t===e?i:t===i?e:t,i,e):ga(t,e,i)}function ga(t,e,i){return"start"===t?e:"end"===t?i:t}class fa extends Os{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(s){var t=s.data;if(t.labels.length&&t.datasets.length){const{pointStyle:a,color:r}=s.legend.options["labels"];return t.labels.map((t,e)=>{var i=s.getDatasetMeta(0).controller.getStyle(e);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,fontColor:r,lineWidth:i.borderWidth,pointStyle:a,hidden:!s.getDataVisibility(e),index:e}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(s,a){const r=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=r;else{let t,e,i=t=>+r[t];if(A(r[s])){const{key:s="value"}=this._parsing;i=t=>+f(r[t],s)}for(e=(t=s)+a;t<e;++t)n._parsed[t]=i(t)}}_getRotation(){return L(this.options.rotation-90)}_getCircumference(){return L(this.options.circumference)}_getRotationExtents(){let e=v,i=-v;for(let t=0;t<this.chart.data.datasets.length;++t){var s,a;this.chart.isDatasetVisible(t)&&this.chart.getDatasetMeta(t).type===this._type&&(s=(a=this.chart.getDatasetMeta(t).controller)._getRotation(),a=a._getCircumference(),e=Math.min(e,s),i=Math.max(i,s+a))}return{rotation:e,circumference:i-e}}update(t){var e=this.chart["chartArea"],i=this._cachedMeta,s=i.data,a=this.getMaxBorderWidth()+this.getMaxOffset(s)+this.options.spacing,r=Math.max((Math.min(e.width,e.height)-a)/2,0),r=Math.min(V(this.options.cutout,r),1),n=this._getRingWeight(this.index),{circumference:o,rotation:l}=this._getRotationExtents(),{ratioX:l,ratioY:o,offsetX:h,offsetY:c}=function(t,e,s){let i=1,a=1,r=0,n=0;if(e<v){const o=t,l=o+e,h=Math.cos(o),c=Math.sin(o),d=Math.cos(l),u=Math.sin(l),g=(t,e,i)=>pt(t,o,l,!0)?1:Math.max(e,e*s,i,i*s),f=(t,e,i)=>pt(t,o,l,!0)?-1:Math.min(e,e*s,i,i*s),p=g(0,h,d),m=g(D,c,u),b=f(S,h,d),x=f(S+D,c,u);i=(p-b)/2,a=(m-x)/2,r=-(p+b)/2,n=-(m+x)/2}return{ratioX:i,ratioY:a,offsetX:r,offsetY:n}}(l,o,r),l=(e.width-a)/l,e=(e.height-a)/o,a=Math.max(Math.min(l,e)/2,0),o=B(this.options.radius,a),l=(o-Math.max(o*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=h*o,this.offsetY=c*o,i.total=this.calculateTotal(),this.outerRadius=o-l*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-l*n,0),this.updateElements(s,0,s.length,t)}_circumference(t,e){var i=this.options,s=this._cachedMeta,a=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*a/v)}updateElements(t,e,i,s){const a="reset"===s,r=this.chart,n=r.chartArea,o=r.options.animation,l=(n.left+n.right)/2,h=(n.top+n.bottom)/2,c=a&&o.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;p<e;++p)m+=this._circumference(p,a);for(p=e;p<e+i;++p){const e=this._circumference(p,a),i=t[p],r={x:l+this.offsetX,y:h+this.offsetY,startAngle:m,endAngle:m+e,circumference:e,outerRadius:u,innerRadius:d};f&&(r.options=g||this.resolveDataElementOptions(p,i.active?"active":s)),m+=e,this.updateElement(i,p,r,s)}}calculateTotal(){var t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){var a=t._parsed[i];null===a||isNaN(a)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(a))}return s}calculateCircumference(t){var e=this._cachedMeta.total;return 0<e&&!isNaN(t)?v*(Math.abs(t)/e):0}getLabelAndValue(t){var e=this._cachedMeta,i=this.chart,s=i.data.labels||[],e=de(e._parsed[t],i.options.locale);return{label:s[t]||"",value:e}}getMaxBorderWidth(t){let e=0;var i=this.chart;let s,a,r,n,o;if(!t)for(s=0,a=i.data.datasets.length;s<a;++s)if(i.isDatasetVisible(s)){t=(r=i.getDatasetMeta(s)).data,n=r.controller;break}if(!t)return 0;for(s=0,a=t.length;s<a;++s)"inner"!==(o=n.resolveDataElementOptions(s)).borderAlign&&(e=Math.max(e,o.borderWidth||0,o.hoverBorderWidth||0));return e}getMaxOffset(i){let s=0;for(let t=0,e=i.length;t<e;++t){const i=this.resolveDataElementOptions(t);s=Math.max(s,i.offset||0,i.hoverOffset||0)}return s}_getRingWeightOffset(e){let i=0;for(let t=0;t<e;++t)this.chart.isDatasetVisible(t)&&(i+=this._getRingWeight(t));return i}_getRingWeight(t){return Math.max(T(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class pa extends Os{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(s){var t=s.data;if(t.labels.length&&t.datasets.length){const{pointStyle:a,color:r}=s.legend.options["labels"];return t.labels.map((t,e)=>{var i=s.getDatasetMeta(0).controller.getStyle(e);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,fontColor:r,lineWidth:i.borderWidth,pointStyle:a,hidden:!s.getDataVisibility(e),index:e}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){var e=this._cachedMeta,i=this.chart,s=i.data.labels||[],e=de(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:e}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){var e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,s={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,e)=>{var i=this.getParsed(e).r;!isNaN(i)&&this.chart.getDataVisibility(e)&&(i<s.min&&(s.min=i),i>s.max)&&(s.max=i)}),s}_updateRadius(){var t=this.chart,e=t.chartArea,i=t.options,e=Math.min(e.right-e.left,e.bottom-e.top),e=Math.max(e/2,0),i=(e-Math.max(i.cutoutPercentage?e/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=e-i*this.index,this.innerRadius=this.outerRadius-i}updateElements(s,a,t,r){var n="reset"===r,o=this.chart,l=o.options.animation,h=this._cachedMeta.rScale,c=h.xCenter,d=h.yCenter,u=h.getIndexAngle(0)-.5*S;let g,f=u;var p=360/this.countVisibleElements();for(g=0;g<a;++g)f+=this._computeAngle(g,r,p);for(g=a;g<a+t;g++){const a=s[g];let t=f,e=f+this._computeAngle(g,r,p),i=o.getDataVisibility(g)?h.getDistanceFromCenterForValue(this.getParsed(g).r):0;f=e,n&&(l.animateScale&&(i=0),l.animateRotate)&&(t=e=u);var m={x:c,y:d,innerRadius:0,outerRadius:i,startAngle:t,endAngle:e,options:this.resolveDataElementOptions(g,a.active?"active":r)};this.updateElement(a,g,m,r)}}countVisibleElements(){var t=this._cachedMeta;let i=0;return t.data.forEach((t,e)=>{!isNaN(this.getParsed(e).r)&&this.chart.getDataVisibility(e)&&i++}),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?L(this.resolveDataElementOptions(t,e).angle||i):0}}var ma=Object.freeze({__proto__:null,BarController:class extends Os{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return ca(t,e,i,s)}parseArrayData(t,e,i,s){return ca(t,e,i,s)}parseObjectData(t,e,i,s){var{iScale:a,vScale:r}=t,{xAxisKey:t="x",yAxisKey:n="y"}=this._parsing,o="x"===a.axis?t:n,l="x"===r.axis?t:n,h=[];let c,d,u,g;for(d=(c=i)+s;c<d;++c)g=e[c],(u={})[a.axis]=a.parse(f(g,o),c),h.push(ha(f(g,l),u,r,c));return h}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);s=i._custom;s&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,s.min),t.max=Math.max(t.max,s.max))}getMaxOverflow(){return 0}getLabelAndValue(t){var{iScale:e,vScale:i}=this._cachedMeta,t=this.getParsed(t),s=t._custom,s=da(s)?"["+s.start+", "+s.end+"]":""+i.getLabelForValue(t[i.axis]);return{label:""+e.getLabelForValue(t[e.axis]),value:s}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){var e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(e,i,s,a){var r="reset"===a,{index:n,_cachedMeta:{vScale:o}}=this,l=o.getBasePixel(),h=o.isHorizontal(),c=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(i,a);for(let t=i;t<i+s;t++){const i=this.getParsed(t),s=r||P(i[o.axis])?{base:l,head:l}:this._calculateBarValuePixels(t),w=this._calculateBarIndexPixels(t,c),k=(i._stacks||{})[o.axis],S={horizontal:h,base:s.base,enableBorderRadius:!k||da(i._custom)||n===k._top||n===k._bottom,x:h?s.head:w.center,y:h?w.center:s.head,height:h?w.size:Math.abs(s.size),width:h?Math.abs(s.size):w.size};u&&(S.options=d||this.resolveDataElementOptions(t,e[t].active?"active":a));var g=S.options||e[t].options;{f=void 0;p=void 0;m=void 0;b=void 0;x=void 0;v=void 0;_=void 0;y=void 0;M=void 0;var f=S;var p=g;var m=k;var b=n;let t=p.borderSkipped;var x,v,_,y,M,p={};t?!0===t?f.borderSkipped={top:!0,right:!0,bottom:!0,left:!0}:({start:x,end:v,reverse:_,top:y,bottom:M}=function(){let t,e,i,s,a;return i=f.horizontal?(t=f.base>f.x,e="left","right"):(t=f.base<f.y,e="bottom","top"),a=t?(s="end","start"):(s="start","end"),{start:e,end:i,reverse:t,top:s,bottom:a}}(),"middle"===t&&m&&(f.enableBorderRadius=!0,t=(m._top||0)===b?y:(m._bottom||0)===b?M:(p[ua(M,x,v,_)]=!0,y)),p[ua(t,x,v,_)]=!0,f.borderSkipped=p):f.borderSkipped=p}[m,b,M]=[S,g["inflateAmount"],c.ratio],m.inflateAmount="auto"===b?1===M?.33:0:b,this.updateElement(e[t],t,S,a)}}_getStacks(t,i){const e=this._cachedMeta["iScale"],s=e.getMatchingVisibleMetas(this._type).filter(t=>t.controller.options.grouped),a=e.options.stacked,r=[];for(const e of s)if((void 0===i||!(t=>{var e=t.controller.getParsed(i),e=e&&e[t.vScale.axis];if(P(e)||isNaN(e))return!0})(e))&&((!1===a||-1===r.indexOf(e.stack)||void 0===a&&void 0===e.stack)&&r.push(e.stack),e.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){t=this._getStacks(t,i),i=void 0!==e?t.indexOf(e):-1;return-1===i?t.length-1:i}_getRuler(){var t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let a,r;for(a=0,r=e.data.length;a<r;++a)s.push(i.getPixelForValue(this.getParsed(a)[i.axis],a));var n=t.barThickness;return{min:n||function(t){var e=t.iScale,i=function(s,t){if(!s._cache.$bar){var a=s.getMatchingVisibleMetas(t);let i=[];for(let t=0,e=a.length;t<e;t++)i=i.concat(a[t].controller.getAllParsedValues(s));s._cache.$bar=wt(i.sort((t,e)=>t-e))}return s._cache.$bar}(e,t.type);let s,a,r,n,o=e._length;var l=()=>{32767!==r&&-32768!==r&&(G(n)&&(o=Math.min(o,Math.abs(r-n)||o)),n=r)};for(s=0,a=i.length;s<a;++s)r=e.getPixelForValue(i[s]),l();for(n=void 0,s=0,a=e.ticks.length;s<a;++s)r=e.getPixelForTick(s),l();return o}(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:n?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:a,minBarLength:r}}=this,n=a||0,o=this.getParsed(t),l=o._custom,h=da(l);let c,d,u=o[e.axis],g=0,f=i?this.applyStack(e,o,i):u;f!==u&&(g=f-u,f=u),h&&(u=l.barStart,f=l.barEnd-l.barStart,0!==u&&_(u)!==_(l.barEnd)&&(g=0),g+=u);var p,m,b=P(a)||h?g:a;let x=e.getPixelForValue(b);if(c=this.chart.getDataVisibility(t)?e.getPixelForValue(g+f):x,d=c-x,Math.abs(d)<r){d=(b=d,p=e,m=n,(0!==b?_(b):(p.isHorizontal()?1:-1)*(p.min>=m?1:-1))*r),u===n&&(x-=d/2);const t=e.getPixelForDecimal(0),P=e.getPixelForDecimal(1),a=Math.min(t,P),l=Math.max(t,P);x=Math.max(Math.min(x,l),a),c=x+d,i&&!h&&(o._stacks[e.axis]._visualValues[s]=e.getValueForPixel(c)-e.getValueForPixel(x))}if(x===e.getPixelForValue(n)){const t=_(d)*e.getLineWidthForValue(n)/2;x+=t,d-=t}return{size:d,base:x,head:c,center:c+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,a=s.skipNull,r=T(s.maxBarThickness,1/0);let n,o;if(e.grouped){const i=a?this._getStackCount(t):e.stackCount,T=("flex"===s.barThickness?function(t,e,i,s){var a=e.pixels,r=a[t];let n=0<t?a[t-1]:null,o=t<a.length-1?a[t+1]:null;a=i.categoryPercentage,null===n&&(n=r-(null===o?e.end-e.start:o-r)),null===o&&(o=r+r-n),t=r-(r-Math.min(n,o))/2*a;return{chunk:Math.abs(o-n)/2*a/s,ratio:i.barPercentage,start:t}}:function(t,e,i,s){var a=i.barThickness;let r,n;return n=P(a)?(r=e.min*i.categoryPercentage,i.barPercentage):(r=a*s,1),{chunk:r/s,ratio:n,start:e.pixels[t]-r/2}})(t,e,s,i),l=this._getStackIndex(this.index,this._cachedMeta.stack,a?t:void 0);n=T.start+T.chunk*l+T.chunk/2,o=Math.min(r,T.chunk*T.ratio)}else n=i.getPixelForValue(this.getParsed(t)[i.axis],t),o=Math.min(r,e.min*e.ratio);return{base:n-o/2,head:n+o/2,center:n,size:o}}draw(){var t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let a=0;for(;a<s;++a)null!==this.getParsed(a)[e.axis]&&i[a].draw(this._ctx)}},BubbleController:class extends Os{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){var a=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<a.length;t++)a[t]._custom=this.resolveDataElementOptions(t+i).radius;return a}parseArrayData(t,e,i,s){var a=super.parseArrayData(t,e,i,s);for(let t=0;t<a.length;t++){const s=e[i+t];a[t]._custom=T(s[2],this.resolveDataElementOptions(t+i).radius)}return a}parseObjectData(t,e,i,s){var a=super.parseObjectData(t,e,i,s);for(let t=0;t<a.length;t++){const s=e[i+t];a[t]._custom=T(s&&s.r&&+s.r,this.resolveDataElementOptions(t+i).radius)}return a}getMaxOverflow(){var e=this._cachedMeta.data;let i=0;for(let t=e.length-1;0<=t;--t)i=Math.max(i,e[t].size(this.resolveDataElementOptions(t))/2);return 0<i&&i}getLabelAndValue(t){var e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:e,yScale:s}=e,a=this.getParsed(t),e=e.getLabelForValue(a.x),s=s.getLabelForValue(a.y),a=a._custom;return{label:i[t]||"",value:"("+e+", "+s+(a?", "+a:"")+")"}}update(t){var e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(e,i,s,a){var r="reset"===a,{iScale:n,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:h}=this._getSharedOptions(i,a),c=n.axis,d=o.axis;for(let t=i;t<i+s;t++){const i=e[t],s=!r&&this.getParsed(t),u={},g=u[c]=r?n.getPixelForDecimal(.5):n.getPixelForValue(s[c]),f=u[d]=r?o.getBasePixel():o.getPixelForValue(s[d]);u.skip=isNaN(g)||isNaN(f),h&&(u.options=l||this.resolveDataElementOptions(t,i.active?"active":a),r)&&(u.options.radius=0),this.updateElement(i,t,u,a)}}resolveDataElementOptions(t,e){var i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);t=(s=s.$shared?Object.assign({},s,{$shared:!1}):s).radius;return"active"!==e&&(s.radius=0),s.radius+=T(i&&i._custom,t),s}},DoughnutController:fa,LineController:class extends Os{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){var e=this._cachedMeta,{dataset:i,data:s=[],_dataset:a}=e,r=this.chart._animationsDisabled;let{start:n,count:o}=Ot(e,s,r);this._drawStart=n,this._drawCount=o,At(e)&&(n=0,o=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!a._decimated,i.points=s;e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0),e.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:e},t),this.updateElements(s,n,o,t)}updateElements(e,i,t,s){const a="reset"===s,{iScale:r,vScale:n,_stacked:o,_dataset:l}=this._cachedMeta,{sharedOptions:h,includeOptions:c}=this._getSharedOptions(i,s),d=r.axis,u=n.axis,{spanGaps:g,segment:f}=this.options,p=ot(g)?g:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||a||"none"===s,b=i+t,x=e.length;let v=0<i&&this.getParsed(i-1);for(let t=0;t<x;++t){const g=e[t],x=m?g:{};var _,y,M,w;t<i||t>=b?x.skip=!0:(y=P((_=this.getParsed(t))[u]),M=x[d]=r.getPixelForValue(_[d],t),w=x[u]=a||y?n.getBasePixel():n.getPixelForValue(o?this.applyStack(n,_,o):_[u],t),x.skip=isNaN(M)||isNaN(w)||y,x.stop=0<t&&Math.abs(_[d]-v[d])>p,f&&(x.parsed=_,x.raw=l.data[t]),c&&(x.options=h||this.resolveDataElementOptions(t,g.active?"active":s)),m||this.updateElement(g,t,x,s),v=_)}}getMaxOverflow(){var t,e=this._cachedMeta,i=e.dataset,i=i.options&&i.options.borderWidth||0,e=e.data||[];return e.length?(t=e[0].size(this.resolveDataElementOptions(0)),e=e[e.length-1].size(this.resolveDataElementOptions(e.length-1)),Math.max(i,t,e)/2):i}draw(){var t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends fa{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:pa,RadarController:class extends Os{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){var e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],a=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);var r={_loop:!0,_fullLoop:a.length===s.length,options:e};this.updateElement(i,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(e,i,s,a){var r=this._cachedMeta.rScale,n="reset"===a;for(let t=i;t<i+s;t++){const i=e[t],s=this.resolveDataElementOptions(t,i.active?"active":a),o=r.getPointPositionForValue(t,this.getParsed(t).r),l=n?r.xCenter:o.x,h=n?r.yCenter:o.y,c={x:l,y:h,angle:o.angle,skip:isNaN(l)||isNaN(h),options:s};this.updateElement(i,t,c,a)}}},ScatterController:class extends Os{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){var e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:e,yScale:s}=e,a=this.getParsed(t),e=e.getLabelForValue(a.x),s=s.getLabelForValue(a.y);return{label:i[t]||"",value:"("+e+", "+s+")"}}update(t){var e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:a,count:r}=Ot(e,i,s);if(this._drawStart=a,this._drawCount=r,At(e)&&(a=0,r=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:r}=e;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!r._decimated,a.points=i;var n=this.resolveDatasetElementOptions(t);n.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:n},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,a,r,t)}addElements(){var t=this.options["showLine"];!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(e,i,s,a){const r="reset"===a,{iScale:n,vScale:o,_stacked:l,_dataset:h}=this._cachedMeta,t=this.resolveDataElementOptions(i,a),c=this.getSharedOptions(t),d=this.includeOptions(a,c),u=n.axis,g=o.axis,{spanGaps:f,segment:p}=this.options,m=ot(f)?f:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||r||"none"===a;let x=0<i&&this.getParsed(i-1);for(let t=i;t<i+s;++t){const i=e[t],s=this.getParsed(t),f=b?i:{},v=P(s[g]),_=f[u]=n.getPixelForValue(s[u],t),y=f[g]=r||v?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,s,l):s[g],t);f.skip=isNaN(_)||isNaN(y)||v,f.stop=0<t&&Math.abs(s[u]-x[u])>m,p&&(f.parsed=s,f.raw=h.data[t]),d&&(f.options=c||this.resolveDataElementOptions(t,i.active?"active":a)),b||this.updateElement(i,t,f,a),x=s}this.updateSharedOptions(c,a,t)}getMaxOverflow(){var t,e,i=this._cachedMeta,s=i.data||[];if(this.options.showLine)return i=(i=i.dataset).options&&i.options.borderWidth||0,s.length?(t=s[0].size(this.resolveDataElementOptions(0)),e=s[s.length-1].size(this.resolveDataElementOptions(s.length-1)),Math.max(i,t,e)/2):i;{let e=0;for(let t=s.length-1;0<=t;--t)e=Math.max(e,s[t].size(this.resolveDataElementOptions(t))/2);return 0<e&&e}}}});function ba(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function xa(t,e,i,s,a,r){var{x:n,y:o,startAngle:l,pixelMargin:h,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-h,0),h=0<c?c+s+i+h:0;let u=0;var g=a-l;if(s){const t=((0<c?c-s:0)+(0<d?d-s:0))/2;u=(g-(0!=t?g*t/(t+s):g))/2}var c=(g-Math.max(.001,g*d-i/S)/d)/2,g=l+c+u,l=a-c-u,{outerStart:c,outerEnd:f,innerStart:p,innerEnd:m}=function(t,e,i,s){t=yi(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const a=(i-e)/2,r=Math.min(a,s*e/2),n=t=>{var e=(i-Math.min(a,t))*s/2;return C(t,0,Math.min(a,e))};return{outerStart:n(t.outerStart),outerEnd:n(t.outerEnd),innerStart:C(t.innerStart,0,r),innerEnd:C(t.innerEnd,0,r)}}(e,h,d,l-g),b=d-c,x=d-f,v=g+c/b,_=l-f/x,y=h+p,M=h+m,w=g+p/y,k=l-m/M;if(t.beginPath(),r){const e=(v+_)/2;if(t.arc(n,o,d,v,e),t.arc(n,o,d,e,_),0<f){const e=ba(x,_,n,o);t.arc(e.x,e.y,f,_,l+D)}const i=ba(M,l,n,o);if(t.lineTo(i.x,i.y),0<m){const e=ba(M,k,n,o);t.arc(e.x,e.y,m,l+D,k+Math.PI)}const s=(l-m/h+(g+p/h))/2;if(t.arc(n,o,h,l-m/h,s,!0),t.arc(n,o,h,s,g+p/h,!0),0<p){const e=ba(y,w,n,o);t.arc(e.x,e.y,p,w+Math.PI,g-D)}const a=ba(b,g,n,o);if(t.lineTo(a.x,a.y),0<c){const e=ba(b,v,n,o);t.arc(e.x,e.y,c,g-D,v)}}else{t.moveTo(n,o);const e=Math.cos(v)*d+n,i=Math.sin(v)*d+o,s=(t.lineTo(e,i),Math.cos(_)*d+n),a=Math.sin(_)*d+o;t.lineTo(s,a)}t.closePath()}function va(t,e,i=e){t.lineCap=T(i.borderCapStyle,e.borderCapStyle),t.setLineDash(T(i.borderDash,e.borderDash)),t.lineDashOffset=T(i.borderDashOffset,e.borderDashOffset),t.lineJoin=T(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=T(i.borderWidth,e.borderWidth),t.strokeStyle=T(i.borderColor,e.borderColor)}function _a(t,e,i){t.lineTo(i.x,i.y)}function ya(t,e,i={}){var t=t.length,{start:i=0,end:s=t-1}=i,{start:a,end:r}=e,n=Math.max(i,a),o=Math.min(s,r);return{count:t,start:n,loop:e.loop,ilen:o<n&&!(i<a&&s<a||r<i&&r<s)?t+o-n:o-n}}function Ma(t,e,i,s){const{points:a,options:r}=e,{count:n,start:o,loop:l,ilen:h}=ya(a,i,s),c=r.stepped?We:r.tension||"monotone"===r.cubicInterpolationMode?Ne:_a;let d,u,g,{move:f=!0,reverse:p}=s||{};for(d=0;d<=h;++d)(u=a[(o+(p?h-d:d))%n]).skip||(f?(t.moveTo(u.x,u.y),f=!1):c(t,g,u,p,r.stepped),g=u);return l&&(u=a[(o+(p?h:0))%n],c(t,g,u,p,r.stepped)),!!l}function wa(t,e,i,s){const a=e.points,{count:r,start:n,ilen:o}=ya(a,i,s),{move:l=!0,reverse:h}=s||{};let c,d,u,g,f,p,m=0,b=0;var x=t=>(n+(h?o-t:t))%r,v=()=>{g!==f&&(t.lineTo(m,f),t.lineTo(m,g),t.lineTo(m,p))};for(l&&(d=a[x(0)],t.moveTo(d.x,d.y)),c=0;c<=o;++c)if(!(d=a[x(c)]).skip){const e=d.x,i=d.y,s=0|e;s===u?(i<g?g=i:i>f&&(f=i),m=(b*m+e)/++b):(v(),t.lineTo(e,i),u=s,b=0,g=f=i),p=i}v()}function ka(t){var e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?Ma:wa}const Sa="function"==typeof Path2D;class Pa extends e{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){var i,s=this.options;!s.tension&&"monotone"!==s.cubicInterpolationMode||s.stepped||this._pointsUpdated||(i=s.spanGaps?this._loop:this._fullLoop,hi(this._points,s,t,i,e),this._pointsUpdated=!0)}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ri(this,this.options.segment))}first(){var t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){var t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(i,s){var a=this.options,r=i[s],n=this.points,o=Ei(this,{property:s,start:r,end:r});if(o.length){var l,h=[],c=a.stepped?pi:a.tension||"monotone"===a.cubicInterpolationMode?mi:fi;let e,t;for(e=0,t=o.length;e<t;++e){const{start:t,end:d}=o[e],u=n[t],g=n[d];u===g?h.push(u):((l=c(u,g,Math.abs((r-u[s])/(g[s]-u[s])),a.stepped))[s]=i[s],h.push(l))}return 1===h.length?h[0]:h}}pathSegment(t,e,i){return ka(this)(t,this,e,i)}path(t,e,i){var s=this.segments,a=ka(this);let r=this._loop;e=e||0,i=i||this.points.length-e;for(const n of s)r&=a(t,this,n,{start:e,end:e+i-1});return!!r}draw(t,e,i,s){var a,r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),r=t,a=this,i=i,s=s,(Sa&&!a.options.segment?function(t,e,i,s){let a=e._path;a||(a=e._path=new Path2D,e.path(a,i,s)&&a.closePath()),va(t,e.options),t.stroke(a)}:function(t,e,i,s){var{segments:a,options:r}=e,n=ka(e);for(const o of a)va(t,r,o.style),t.beginPath(),n(t,e,o,{start:i,end:i+s-1})&&t.closePath(),t.stroke()})(r,a,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Da(t,e,i,s){var a=t.options,{[i]:t}=t.getProps([i],s);return Math.abs(e-t)<a.radius+a.hitRadius}function Ca(t,e){var{x:e,y:i,base:s,width:a,height:r}=t.getProps(["x","y","base","width","height"],e);let n,o,l,h,c;return h=t.horizontal?(c=r/2,n=Math.min(e,s),o=Math.max(e,s),l=i-c,i+c):(c=a/2,n=e-c,o=e+c,l=Math.min(i,s),Math.max(i,s)),{left:n,top:l,right:o,bottom:h}}function Oa(t,e,i,s){return t?0:C(e,i,s)}function Aa(t,e,i,s){var a=null===e,r=null===i,t=t&&!(a&&r)&&Ca(t,s);return t&&(a||c(e,t.left,t.right))&&(r||c(i,t.top,t.bottom))}function Ta(t,e){t.rect(e.x,e.y,e.w,e.h)}function La(t,e,i={}){var s=t.x!==i.x?-e:0,a=t.y!==i.y?-e:0,r=(t.x+t.w!==i.x+i.w?e:0)-s,i=(t.y+t.h!==i.y+i.h?e:0)-a;return{x:t.x+s,y:t.y+a,w:t.w+r,h:t.h+i,radius:t.radius}}var Ea=Object.freeze({__proto__:null,ArcElement:class extends e{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){var{angle:t,distance:e}=ut(this.getProps(["x","y"],i),{x:t,y:e}),{startAngle:i,endAngle:s,innerRadius:a,outerRadius:r,circumference:n}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),o=(this.options.spacing+this.options.borderWidth)/2,n=T(n,s-i)>=v||pt(t,i,s),t=c(e,a+o,r+o);return n&&t}getCenterPoint(t){var{x:t,y:e,startAngle:i,endAngle:s,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:n,spacing:o}=this.options,i=(i+s)/2,s=(a+r+o+n)/2;return{x:t+Math.cos(i)*s,y:e+Math.sin(i)*s}}tooltipPosition(t){return this.getCenterPoint(t)}draw(e){var{options:i,circumference:s}=this,a=(i.offset||0)/4,r=(i.spacing||0)/2,n=i.circular;if(this.pixelMargin="inner"===i.borderAlign?.33:0,this.fullCircles=s>v?Math.floor(s/v):0,!(0===s||this.innerRadius<0||this.outerRadius<0)){e.save();var o=(this.startAngle+this.endAngle)/2,o=(e.translate(Math.cos(o)*a,Math.sin(o)*a),a*(1-Math.sin(Math.min(S,s||0))));e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor;{var l=e;a=this;s=o;i=r;var h=n;var{fullCircles:c,startAngle:d,circumference:u}=a;let t=a.endAngle;if(c){xa(l,a,s,i,t,h);for(let t=0;t<c;++t)l.fill();isNaN(u)||(t=d+(u%v||v))}xa(l,a,s,i,t,h),l.fill()}var g=e,d=this,u=o,a=r,s=n,{fullCircles:f,startAngle:i,circumference:h,options:o}=d,{borderWidth:r,borderJoinStyle:n,borderDash:p,borderDashOffset:m}=o,o="inner"===o.borderAlign;if(r){g.setLineDash(p||[]),g.lineDashOffset=m,o?(g.lineWidth=2*r,g.lineJoin=n||"round"):(g.lineWidth=r,g.lineJoin=n||"bevel");let t=d.endAngle;if(f){xa(g,d,u,a,t,s);for(let t=0;t<f;++t)g.stroke();isNaN(h)||(t=i+(h%v||v))}if(o){p=g;m=d;r=t;var{startAngle:m,pixelMargin:n,x:i,y:h,outerRadius:o,innerRadius:b}=m,x=n/o;p.beginPath(),p.arc(i,h,o,m-x,r+x),n<b?p.arc(i,h,b,r+(x=n/b),m-x,!0):p.arc(i,h,n,r+D,m-D),p.closePath(),p.clip()}f||(xa(g,d,u,a,t,s),g.stroke())}e.restore()}}},BarElement:class extends e{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){var e,i,s,a,r,n,o,{inflateAmount:l,options:{borderColor:h,backgroundColor:c}}=this,{inner:d,outer:u}=(s=Ca(e=this),a=s.right-s.left,r=s.bottom-s.top,u=a/2,n=r/2,o=(i=e).options.borderWidth,i=i.borderSkipped,o=Mi(o),n={t:Oa(i.top,o.top,0,n),r:Oa(i.right,o.right,0,u),b:Oa(i.bottom,o.bottom,0,n),l:Oa(i.left,o.left,0,u)},i=a/2,o=r/2,e=(u=e).getProps(["enableBorderRadius"]).enableBorderRadius,d=u.options.borderRadius,g=wi(d),i=Math.min(i,o),o=u.borderSkipped,e={topLeft:Oa(!(u=e||A(d))||o.top||o.left,g.topLeft,0,i),topRight:Oa(!u||o.top||o.right,g.topRight,0,i),bottomLeft:Oa(!u||o.bottom||o.left,g.bottomLeft,0,i),bottomRight:Oa(!u||o.bottom||o.right,g.bottomRight,0,i)},{outer:{x:s.left,y:s.top,w:a,h:r,radius:e},inner:{x:s.left+n.l,y:s.top+n.t,w:a-n.l-n.r,h:r-n.t-n.b,radius:{topLeft:Math.max(0,e.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,e.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,e.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,e.bottomRight-Math.max(n.b,n.r))}}}),g=(o=u.radius).topLeft||o.topRight||o.bottomLeft||o.bottomRight?je:Ta;t.save(),u.w===d.w&&u.h===d.h||(t.beginPath(),g(t,La(u,l,d)),t.clip(),g(t,La(d,-l,u)),t.fillStyle=h,t.fill("evenodd")),t.beginPath(),g(t,La(d,l)),t.fillStyle=c,t.fill(),t.restore()}inRange(t,e,i){return Aa(this,t,e,i)}inXRange(t,e){return Aa(this,t,null,e)}inYRange(t,e){return Aa(this,null,t,e)}getCenterPoint(t){var{x:t,y:e,base:i,horizontal:s}=this.getProps(["x","y","base","horizontal"],t);return{x:s?(t+i)/2:t,y:s?e:(e+i)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:Pa,PointElement:class extends e{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};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){var s=this.options,{x:i,y:a}=this.getProps(["x","y"],i);return Math.pow(t-i,2)+Math.pow(e-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return Da(this,t,"x",e)}inYRange(t,e){return Da(this,t,"y",e)}getCenterPoint(t){var{x:t,y:e}=this.getProps(["x","y"],t);return{x:t,y:e}}size(t){var e=(t=t||this.options||{}).radius||0;return 2*((e=Math.max(e,e&&t.hoverRadius||0))+(e&&t.borderWidth||0))}draw(t,e){var i=this.options;this.skip||i.radius<.1||!M(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,ze(t,i,this.x,this.y))}getRange(){var t=this.options||{};return t.radius+t.hitRadius}}});function Ra(t){var e=this.getLabels();return 0<=t&&t<e.length?e[t]:t}function Ia(t,e,{horizontal:i,minRotation:s}){s=L(s),i=(i?Math.sin(s):Math.cos(s))||.001;return Math.min(e/i,.75*e*(""+t).length)}class za 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 P(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const t=this.options["beginAtZero"],{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:a}=this;var r,n=t=>s=e?s:t,o=t=>a=i?a:t;if(t){const t=_(s),e=_(a);t<0&&e<0?o(0):0<t&&0<e&&n(0)}s===a&&(r=0===a?1:Math.abs(.05*a),o(a+r),t||n(s-r)),this.min=s,this.max=a}getTickLimit(){let t,{maxTicksLimit:e,stepSize:i}=this.options.ticks;return i?1e3<(t=Math.ceil(this.max/i)-Math.floor(this.min/i)+1)&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${t} ticks. Limiting to 1000.`),t=1e3):(t=this.computeTickLimit(),e=e||11),t=e?Math.min(e,t):t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){var t=this.options,e=t.ticks,i=this.getTickLimit(),i=function(t,e){var i=[],{bounds:s,step:a,min:r,max:n,precision:o,count:l,maxTicks:h,maxDigits:c,includeBounds:d}=t,u=a||1,g=h-1,{min:e,max:f}=e,p=!P(r),m=!P(n),b=!P(l),c=(f-e)/(c+1);let x,v,_,y,M=rt((f-e)/g/u)*u;if(M<1e-14&&!p&&!m)return[{value:e},{value:f}];(y=Math.ceil(f/M)-Math.floor(e/M))>g&&(M=rt(y*M/g/u)*u),P(o)||(x=Math.pow(10,o),M=Math.ceil(M*x)/x),_="ticks"===s?(v=Math.floor(e/M)*M,Math.ceil(f/M)*M):(v=e,f),p&&m&&a&<((n-r)/a,M/1e3)?(y=Math.round(Math.min((n-r)/M,h)),M=(n-r)/y,v=r,_=n):b?(v=p?r:v,_=m?n:_,y=l-1,M=(_-v)/y):y=at(y=(_-v)/M,Math.round(y),M/1e3)?Math.round(y):Math.ceil(y);g=Math.max(dt(M),dt(v));x=Math.pow(10,P(o)?g:o),v=Math.round(v*x)/x,_=Math.round(_*x)/x;let w=0;for(p&&(d&&v!==r?(i.push({value:r}),v<r&&w++,at(Math.round((v+w*M)*x)/x,r,Ia(r,c,t))&&w++):v<r&&w++);w<y;++w){const t=Math.round((v+w*M)*x)/x;if(m&&t>n)break;i.push({value:t})}return m&&d&&_!==n?i.length&&at(i[i.length-1].value,n,Ia(n,c,t))?i[i.length-1].value=n:i.push({value:n}):m&&_!==n||i.push({value:_}),i}({maxTicks:Math.max(2,i),bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&ht(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}configure(){var t=this.ticks;let e=this.min,i=this.max;super.configure(),this.options.offset&&t.length&&(t=(i-e)/Math.max(t.length-1,1)/2,e-=t,i+=t),this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return de(t,this.chart.options.locale,this.options.ticks.format)}}class Fa extends za{static id="linear";static defaults={ticks:{callback:ge.formatters.numeric}};determineDataLimits(){var{min:t,max:e}=this.getMinMax(!0);this.min=p(t)?t:0,this.max=p(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){var t=this.isHorizontal(),e=t?this.width:this.height,i=L(this.options.ticks.minRotation),t=(t?Math.sin(i):Math.cos(i))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,i.lineHeight/t))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const Va=t=>Math.floor(o(t)),Ba=(t,e)=>Math.pow(10,Va(t)+e);function Wa(t){return 1==t/Math.pow(10,Va(t))}function Na(t,e,i){i=Math.pow(10,i),t=Math.floor(t/i);return Math.ceil(e/i)-t}class Ha extends zs{static id="logarithmic";static defaults={ticks:{callback:ge.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){t=za.prototype.parse.apply(this,[t,e]);if(0!==t)return p(t)&&0<t?t:null;this._zero=!0}determineDataLimits(){var{min:t,max:e}=this.getMinMax(!0);this.min=p(t)?Math.max(0,t):null,this.max=p(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!p(this._userMin)&&(this.min=t===Ba(this.min,0)?Ba(this.min,-1):Ba(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:i}=this.getUserBounds();let s=this.min,a=this.max;var t=t=>s=e?s:t,r=t=>a=i?a:t;s===a&&(s<=0?(t(1),r(10)):(t(Ba(s,-1)),r(Ba(a,1)))),s<=0&&t(Ba(a,-1)),a<=0&&r(Ba(s,1)),this.min=s,this.max=a}buildTicks(){var t=this.options,e=function(t,{min:e,max:i}){e=u(t.min,e);var s=[],a=Va(e);let r=function(t,e){let i=Va(e-t);for(;10<Na(t,e,i);)i++;for(;Na(t,e,i)<10;)i--;return Math.min(i,Va(t))}(e,i),n=r<0?Math.pow(10,Math.abs(r)):1;var o=Math.pow(10,r),l=a>r?Math.pow(10,a):0,a=Math.round((e-l)*n)/n,h=Math.floor((e-l)/o/10)*o*10;let c=Math.floor((a-h)/Math.pow(10,r)),d=u(t.min,Math.round((l+h+c*Math.pow(10,r))*n)/n);for(;d<i;)s.push({value:d,major:Wa(d),significand:c}),10<=c?c=c<15?15:20:c++,20<=c&&(r++,c=2,n=0<=r?1:n),d=Math.round((l+h+c*Math.pow(10,r))*n)/n;return e=u(t.max,d),s.push({value:e,major:Wa(e),significand:c}),s}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&ht(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":de(t,this.chart.options.locale,this.options.ticks.format)}configure(){var t=this.min;super.configure(),this._startValue=o(t),this._valueRange=o(this.max)-o(t)}getPixelForValue(t){return null===(t=void 0!==t&&0!==t?t:this.min)||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(o(t)-this._startValue)/this._valueRange)}getValueForPixel(t){t=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+t*this._valueRange)}}function ja(t){var e=t.ticks;if(e.display&&t.display){const t=I(e.backdropPadding);return T(e.font&&e.font.size,R.font.size)+t.height}return 0}function Ya(t,e,i,s,a){return t===s||t===a?{start:e-i/2,end:e+i/2}:t<s||a<t?{start:e-i,end:e}:{start:e,end:e+i}}function $a(e){const i={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},s=Object.assign({},i),a=[],r=[],n=e._pointLabels.length,o=e.options.pointLabels,l=o.centerPointLabels?S/n:0;for(let t=0;t<n;t++){const n=o.setContext(e.getPointLabelContext(t));r[t]=n.padding;var h=e.getPointPosition(t,e.drawingArea+r[t],l),c=z(n.font),d=(d=e.ctx,c=c,u=O(u=e._pointLabels[t])?u:[u],{w:Ee(d,c.string,u),h:u.length*c.lineHeight}),u=(a[t]=d,y(e.getIndexAngle(t)+l)),c=Math.round(ct(u));{g=void 0;f=void 0;p=void 0;m=void 0;b=void 0;x=void 0;var g=s;var f=i;var p=u;var m=Ya(c,h.x,d.w,0,180);var b=Ya(c,h.y,d.h,90,270);var x=Math.abs(Math.sin(p)),p=Math.abs(Math.cos(p));let t=0,e=0;m.start<f.l?(t=(f.l-m.start)/x,g.l=Math.min(g.l,f.l-t)):m.end>f.r&&(t=(m.end-f.r)/x,g.r=Math.max(g.r,f.r+t)),b.start<f.t?(e=(f.t-b.start)/p,g.t=Math.min(g.t,f.t-e)):b.end>f.b&&(e=(b.end-f.b)/p,g.b=Math.max(g.b,f.b+e))}}var d,u;e.setCenterPoint(i.l-s.l,s.r-i.r,i.t-s.t,s.b-i.b),e._pointLabelItems=function(e,i,s){const a=[],r=e._pointLabels.length,t=e.options,{centerPointLabels:n,display:o}=t.pointLabels,l={extra:ja(t)/2,additionalAngle:n?S/r:0};let h;for(let t=0;t<r;t++){l.padding=s[t],l.size=i[t];const r=function(t,e,i){const s=t.drawingArea,{extra:a,additionalAngle:r,padding:n,size:o}=i,l=t.getPointPosition(e,s+a+n,r),h=Math.round(ct(y(l.angle+D))),c=function(t,e){return 90===h||270===h?t-=e/2:(270<h||h<90)&&(t-=e),t}(l.y,o.h),d=function(t){return 0===t||180===t?"center":t<180?"left":"right"}(h),u=function(t,e){return"right"===d?t-=e:"center"===d&&(t-=e/2),t}(l.x,o.w);return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+o.w,bottom:c+o.h}}(e,t,l);a.push(r),"auto"===o&&(r.visible=function(t,e){if(!e)return!0;var{left:t,top:i,right:s,bottom:a}=t;return!(M({x:t,y:i},e)||M({x:t,y:a},e)||M({x:s,y:i},e)||M({x:s,y:a},e))}(r,h),r.visible)&&(h=r)}return a}(e,a,r)}function Ua(e,i,t,s){var a=e["ctx"];if(t)a.arc(e.xCenter,e.yCenter,i,0,v);else{var r=e.getPointPosition(0,i);a.moveTo(r.x,r.y);for(let t=1;t<s;t++)r=e.getPointPosition(t,i),a.lineTo(r.x,r.y)}}class Xa extends za{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ge.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){var t=this._padding=I(ja(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){var{min:t,max:e}=this.getMinMax(!1);this.min=p(t)&&!isNaN(t)?t:0,this.max=p(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/ja(this.options))}generateTickLabels(t){za.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,e)=>{t=d(this.options.pointLabels.callback,[t,e],this);return t||0===t?t:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){var t=this.options;t.display&&t.pointLabels.display?$a(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return y(t*(v/(this._pointLabels.length||1))+L(this.options.startAngle||0))}getDistanceFromCenterForValue(t){var e;return P(t)?NaN:(e=this.drawingArea/(this.max-this.min),this.options.reverse?(this.max-t)*e:(t-this.min)*e)}getValueForDistanceFromCenter(t){return P(t)?NaN:(t=t/(this.drawingArea/(this.max-this.min)),this.options.reverse?this.max-t:this.min+t)}getPointLabelContext(t){var e=this._pointLabels||[];if(0<=t&&t<e.length)return e=e[t],Pi(this.getContext(),{label:e,index:t,type:"pointLabel"})}getPointPosition(t,e,i=0){t=this.getIndexAngle(t)-D+i;return{x:Math.cos(t)*e+this.xCenter,y:Math.sin(t)*e+this.yCenter,angle:t}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){var{left:t,top:e,right:i,bottom:s}=this._pointLabelItems[t];return{left:t,top:e,right:i,bottom:s}}drawBackground(){var t,{backgroundColor:e,grid:{circular:i}}=this.options;e&&((t=this.ctx).save(),t.beginPath(),Ua(this,this.getDistanceFromCenterForValue(this._endValue),i,this._pointLabels.length),t.closePath(),t.fillStyle=e,t.fill(),t.restore())}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:l,border:h}=e,c=this._pointLabels.length;let s,d,a;if(e.pointLabels.display){var r=this,n=c,{ctx:o,options:{pointLabels:u}}=r;for(let t=n-1;0<=t;t--){const n=r._pointLabelItems[t];if(n.visible){var g,f=u.setContext(r.getPointLabelContext(t)),p=(g=y=_=v=x=b=m=p=void 0,o),m=f,b=n,{left:x,top:v,right:_,bottom:y}=b;if(!P(g=m["backdropColor"])){const b=wi(m.borderRadius),P=I(m.backdropPadding);p.fillStyle=g;m=x-P.left,g=v-P.top,_=_-x+P.width,x=y-v+P.height;Object.values(b).some(t=>0!==t)?(p.beginPath(),je(p,{x:m,y:g,w:_,h:x,radius:b}),p.fill()):p.fillRect(m,g,_,x)}var b=z(f.font),{x:y,y:v,textAlign:p}=n;He(o,r._pointLabels[t],y,v+b.lineHeight/2,b,{color:f.color,textAlign:p,textBaseline:"middle"})}}}if(l.display&&this.ticks.forEach((t,e)=>{var i,s,a,r,n,o;0!==e&&(d=this.getDistanceFromCenterForValue(t.value),t=this.getContext(e),e=l.setContext(t),t=h.setContext(t),i=this,e=e,s=d,a=c,t=t,r=i.ctx,n=e.circular,{color:e,lineWidth:o}=e,!n&&!a||!e||!o||s<0||(r.save(),r.strokeStyle=e,r.lineWidth=o,r.setLineDash(t.dash),r.lineDashOffset=t.dashOffset,r.beginPath(),Ua(i,s,n,a),r.closePath(),r.stroke(),r.restore()))}),i.display){for(t.save(),s=c-1;0<=s;s--){const l=i.setContext(this.getPointLabelContext(s)),{color:h,lineWidth:c}=l;c&&h&&(t.lineWidth=c,t.strokeStyle=h,t.setLineDash(l.borderDash),t.lineDashOffset=l.borderDashOffset,d=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),a=this.getPointPosition(s,d),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(a.x,a.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const n=this.ctx,o=this.options,l=o.ticks;if(l.display){var t=this.getIndexAngle(0);let a,r;n.save(),n.translate(this.xCenter,this.yCenter),n.rotate(t),n.textAlign="center",n.textBaseline="middle",this.ticks.forEach((t,e)=>{if(0!==e||o.reverse){var i=l.setContext(this.getContext(e)),s=z(i.font);if(a=this.getDistanceFromCenterForValue(this.ticks[e].value),i.showLabelBackdrop){n.font=s.string,r=n.measureText(t.label).width,n.fillStyle=i.backdropColor;const o=I(i.backdropPadding);n.fillRect(-r/2-o.left,-a-s.size/2-o.top,r+o.width,s.size+o.height)}He(n,t.label,0,-a,s,{color:i.color,strokeColor:i.textStrokeColor,strokeWidth:i.textStrokeWidth})}}),n.restore()}}drawTitle(){}}const qa={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}},h=Object.keys(qa);function Ka(t,e){return t-e}function Ga(t,e){if(P(e))return null;var i=t._adapter,{parser:t,round:s,isoWeekday:a}=t._parseOpts;let r=e;return null===(r=p(r="function"==typeof t?t(r):r)?r:"string"==typeof t?i.parse(r,t):i.parse(r))?null:+(r=s?"week"!==s||!ot(a)&&!0!==a?i.startOf(r,s):i.startOf(r,"isoWeek",a):r)}function Za(e,i,s,a){const r=h.length;for(let t=h.indexOf(e);t<r-1;++t){const e=qa[h[t]],r=e.steps||Number.MAX_SAFE_INTEGER;if(e.common&&Math.ceil((s-i)/(r*e.size))<=a)return h[t]}return h[r-1]}function Ja(t,e,i){var s,a;i?i.length&&({lo:s,hi:a}=bt(i,e),t[i[s]>=e?i[s]:i[a]]=!0):t[e]=!0}function Qa(i,t,s){var a=[],r={},e=t.length;let n,o;for(n=0;n<e;++n)r[o=t[n]]=n,a.push({value:o,major:!1});if(0!==e&&s){var l=a,h=r,c=s,d=i._adapter,s=+d.startOf(l[0].value,c),u=l[l.length-1].value;let t,e;for(t=s;t<=u;t=+d.add(t,1,c))0<=(e=h[t])&&(l[e].major=!0);return l}return a}class tr extends zs{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};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={}){var i=t.time||(t.time={}),s=this._adapter=new la._date(t.adapters.date);s.init(e),$(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:Ga(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){var t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:a,minDefined:r,maxDefined:n}=this.getUserBounds();function o(t){r||isNaN(t.min)||(s=Math.min(s,t.min)),n||isNaN(t.max)||(a=Math.max(a,t.max))}r&&n||(o(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source)||o(this.getMinMax(!1)),s=p(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),a=p(a)&&!isNaN(a)?a:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,a-1),this.max=Math.max(s+1,a)}_getLabelBounds(){var 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(){var t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate(),a=("ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]),this.min),r=vt(s,a,this.max);return this._unit=e.unit||(i.autoSkip?Za(e.minUnit,this.min,this.max,this._getLabelCapacity(a)):function(e,i,s,a,r){for(let t=h.length-1;t>=h.indexOf(s);t--){const s=h[t];if(qa[s].common&&e._adapter.diff(r,a,s)>=i-1)return s}return h[s?h.indexOf(s):0]}(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(i){for(let t=h.indexOf(i)+1,e=h.length;t<e;++t)if(qa[h[t]].common)return h[t]}(this._unit):void 0,this.initOffsets(s),t.reverse&&r.reverse(),Qa(this,r,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e,i,s=0,a=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),a=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);t=t.length<3?.5:.25;s=C(s,0,t),a=C(a,0,t),this._offsets={start:s,end:a,factor:1/(s+1+a)}}_generate(){var t=this._adapter,e=this.min,i=this.max,s=this.options,a=s.time,r=a.unit||Za(a.minUnit,e,i,this._getLabelCapacity(e)),n=T(s.ticks.stepSize,1),a="week"===r&&a.isoWeekday,o=ot(a)||!0===a,l={};let h,c,d=e;if(o&&(d=+t.startOf(d,"isoWeek",a)),d=+t.startOf(d,o?"day":r),t.diff(i,e,r)>1e5*n)throw new Error(e+" and "+i+" are too far apart with stepSize of "+n+" "+r);var u="data"===s.ticks.source&&this.getDataTimestamps();for(h=d,c=0;h<i;h=+t.add(h,n,r),c++)Ja(l,h,u);return h!==i&&"ticks"!==s.bounds&&1!==c||Ja(l,h,u),Object.keys(l).sort(Ka).map(t=>+t)}getLabelForValue(t){var e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){var i=this.options.time.displayFormats,s=this._unit,e=e||i[s];return this._adapter.format(t,e)}_tickFormatFunction(t,e,i,s){var a,r=this.options,n=r.ticks.callback;return n?d(n,[t,e,i],this):(n=r.time.displayFormats,r=this._unit,a=this._majorUnit,r=r&&n[r],n=a&&n[a],i=i[e],e=a&&n&&i&&i.major,this._adapter.format(t,s||(e?n:r)))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)(s=t[e]).label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){var e=this._offsets,t=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+t)*e.factor)}getValueForPixel(t){var e=this._offsets,t=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+t*(this.max-this.min)}_getLabelSize(t){var e=this.options.ticks,t=this.ctx.measureText(t).width,e=L(this.isHorizontal()?e.maxRotation:e.minRotation),i=Math.cos(e),e=Math.sin(e),s=this._resolveTickFontOptions(0).size;return{w:t*i+s*e,h:t*e+s*i}}_getLabelCapacity(t){var e=this.options.time,i=e.displayFormats,e=i[e.unit]||i.millisecond,i=this._tickFormatFunction(t,0,Qa(this,[t],this._majorUnit),e),t=this._getLabelSize(i),e=Math.floor(this.isHorizontal()?this.width/t.w:this.height/t.h)-1;return 0<e?e:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;var s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){var t=this._cache.labels||[];let e,i;if(t.length)return t;var s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Ga(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return wt(t.sort(Ka))}}function er(t,e,i){let s,a,r,n,o=0,l=t.length-1;i?(e>=t[o].pos&&e<=t[l].pos&&({lo:o,hi:l}=m(t,"pos",e)),{pos:s,time:r}=t[o],{pos:a,time:n}=t[l]):(e>=t[o].time&&e<=t[l].time&&({lo:o,hi:l}=m(t,"time",e)),{time:s,pos:r}=t[o],{time:a,pos:n}=t[l]);i=a-s;return i?r+(n-r)*(e-s)/i:r}var ir=Object.freeze({__proto__:null,CategoryScale:class extends zs{static id="category";static defaults={ticks:{callback:Ra}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){var e=this._addedLabels;if(e.length){const t=this.getLabels();for(var{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){var i,s,a,r,n,o,l;return P(t)||(i=this.getLabels(),r=e=isFinite(e)&&i[e]===t?e:(s=i,a=T(e,t=t),r=this._addedLabels,-1===(l=s.indexOf(t))?(o=a,r=r,"string"==typeof(n=t)?(o=s.push(n)-1,r.unshift({index:o,label:n})):isNaN(n)&&(o=null),o):l!==s.lastIndexOf(t)?a:l),n=i.length-1,null===r)?null:C(Math.round(r),0,n)}determineDataLimits(){var{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(){var e=this.min,i=this.max,t=this.options.offset,s=[];let a=this.getLabels();a=0===e&&i===a.length-1?a:a.slice(e,i+1),this._valueRange=Math.max(a.length-(t?0:1),1),this._startValue=this.min-(t?.5:0);for(let t=e;t<=i;t++)s.push({value:t});return s}getLabelForValue(t){return Ra.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return null===(t="number"!=typeof t?this.parse(t):t)?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:Fa,LogarithmicScale:Ha,RadialLinearScale:Xa,TimeScale:tr,TimeSeriesScale:class extends tr{static id="timeseries";static defaults=tr.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){var t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=er(e,this.min),this._tableRange=er(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){var{min:e,max:i}=this,s=[],a=[];let r,n,o,l,h;for(r=0,n=t.length;r<n;++r)(l=t[r])>=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,n=s.length;r<n;++r)h=s[r+1],o=s[r-1],l=s[r],Math.round((h+o)/2)!==l&&a.push({time:l,pos:r/(n-1)});return a}_generate(){var t=this.min,e=this.max,i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort((t,e)=>t-e)}_getTimestampsForTable(){var t,e,i=this._cache.all||[];return i.length||(t=this.getDataTimestamps(),e=this.getLabelTimestamps(),i=t.length&&e.length?this.normalize(t.concat(e)):t.length?t:e,i=this._cache.all=i),i}getDecimalForValue(t){return(er(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){var e=this._offsets,t=this.getDecimalForPixel(t)/e.factor-e.end;return er(this._table,t*this._tableRange+this._minPos,!0)}}});const sr=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],ar=sr.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function rr(t){return sr[t%sr.length]}function nr(t){return ar[t%ar.length]}function or(r){let n=0;return(t,e)=>{var i,s,a,e=r.getDatasetMeta(e).controller;e instanceof fa?n=(s=t,a=n,s.backgroundColor=s.data.map(()=>rr(a++)),a):e instanceof pa?n=(s=t,i=n,s.backgroundColor=s.data.map(()=>nr(i++)),i):e&&(n=(e=t,t=n,e.borderColor=rr(t),e.backgroundColor=nr(t),++t))}}function lr(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return 1}var hr={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){var s,a,r;i.enabled&&({data:{datasets:s},options:a}=t.config,r=a["elements"],!i.forceOverride&&(lr(s)||a&&(a.borderColor||a.backgroundColor)||r&&lr(r))||(i=or(t),s.forEach(i)))}};function cr(t){var e;t._decimated&&(e=t._data,delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e}))}function dr(t){t.data.datasets.forEach(t=>{cr(t)})}var ur={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(o,t,M)=>{if(M.enabled){const l=o.width;o.data.datasets.forEach((e,t)=>{var{_data:i,indexAxis:s}=e,h=o.getDatasetMeta(t),a=i||e.data;if("y"!==ki([s,o.options.indexAxis])&&h.controller.supportsDecimation){t=o.scales[h.xAxisID];if(("linear"===t.type||"time"===t.type)&&!o.options.parsing){var{start:r,count:n}=function(t){var e=t.length;let i,s=0;var a=h["iScale"],{min:r,max:n,minDefined:o,maxDefined:l}=a.getUserBounds();return o&&(s=C(m(t,a.axis,r).lo,0,e-1)),i=l?C(m(t,a.axis,n).hi+1,s,e)-s:e-s,{start:s,count:i}}(a);if(n<=(M.threshold||4*l))cr(e);else{let t;switch(P(i)&&(e._data=a,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),M.algorithm){case"lttb":t=function(s,a,r,t){var e=M.samples||t;if(r<=e)return s.slice(a,a+r);var n=[],o=(r-2)/(e-2);let l=0;const h=a+r-1;let c,d,u,g,f,p=a;for(n[l++]=s[p],c=0;c<e-2;c++){let t,e=0,i=0;const h=Math.floor((c+1)*o)+1+a,_=Math.min(Math.floor((c+2)*o)+1,r)+a,y=_-h;for(t=h;t<_;t++)e+=s[t].x,i+=s[t].y;e/=y,i/=y;var m=Math.floor(c*o)+1+a,b=Math.min(Math.floor((c+1)*o)+1,r)+a,{x,y:v}=s[p];for(u=-1,t=m;t<b;t++)(g=.5*Math.abs((x-e)*(s[t].y-v)-(x-s[t].x)*(i-v)))>u&&(u=g,d=s[t],f=t);n[l++]=d,p=f}return n[l++]=s[h],n}(a,r,n,l);break;case"min-max":t=function(t,e,i,s){let a,r,n,o,l,h,c,d,u,g,f=0,p=0;var m=[],b=t[e].x,x=t[e+i-1].x-b;for(a=e;a<e+i;++a){n=((r=t[a]).x-b)/x*s,o=r.y;const e=0|n;if(e===l)o<u?(u=o,h=a):o>g&&(g=o,c=a),f=(p*f+r.x)/++p;else{const i=a-1;if(!P(h)&&!P(c)){const e=Math.min(h,c),P=Math.max(h,c);e!==d&&e!==i&&m.push({...t[e],x:f}),P!==d&&P!==i&&m.push({...t[P],x:f})}0<a&&i!==d&&m.push(t[i]),m.push(r),l=e,p=0,u=g=o,h=c=d=a}}return m}(a,r,n,l);break;default:throw new Error(`Unsupported decimation algorithm '${M.algorithm}'`)}e._decimated=t}}}})}else dr(o)},destroy(t){dr(t)}};function gr(i,s,a,t){if(!t){let t=s[i],e=a[i];return"angle"===i&&(t=y(t),e=y(e)),{property:i,start:t,end:e}}}function fr(t,e,i){for(;t<e;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function pr(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function mr(e,t){let i=[],s=!1;return(i=O(e)?(s=!0,e):function(t){const{x:i=null,y:s=null}=e||{},a=t.points,r=[];return t.segments.forEach(({start:t,end:e})=>{e=fr(t,e,a);t=a[t],e=a[e];null!==s?(r.push({x:t.x,y:s}),r.push({x:e.x,y:s})):null!==i&&(r.push({x:i,y:t.y}),r.push({x:i,y:e.y}))}),r}(t)).length?new Pa({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function br(t){return t&&!1!==t.fill}function xr(e,i,s){var a=[];for(let t=0;t<s.length;t++){var{first:r,last:n,point:o}=function(t,e,i){const s=t.interpolate(e,i);if(!s)return{};var a=s[i],r=t.segments,n=t.points;let o=!1,l=!1;for(let t=0;t<r.length;t++){const e=r[t],s=n[e.start][i],h=n[e.end][i];if(c(a,s,h)){o=a===s,l=a===h;break}}return{first:o,last:l,point:s}}(s[t],i,"x");if(!(!o||r&&n))if(r)a.unshift(o);else if(e.push(o),!n)break}e.push(...a)}class vr{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){var{x:s,y:a,radius:r}=this;return e=e||{start:0,end:v},t.arc(s,a,r,e.end,e.start,!0),!i.bounds}interpolate(t){var{x:e,y:i,radius:s}=this,t=t.angle;return{x:e+Math.cos(t)*s,y:i+Math.sin(t)*s,angle:t}}}function _r(t){var e,i,{chart:s,fill:a,line:r}=t;if(p(a))return e=a,(i=(s=s).getDatasetMeta(e))&&s.isDatasetVisible(e)?i.dataset:null;if("stack"!==a)return"shape"===a||((s=function(t){if((t.scale||{}).getPointPositionForValue){var e=t;const{scale:a,fill:r}=e,n=a.options,o=a.getLabels().length,l=n.reverse?a.max:a.min,h=(e=r,s=a,"start"===e?l:"end"===e?s.options.reverse?s.min:s.max:A(e)?e.value:s.getBaseValue()),c=[];if(n.grid.circular){const e=a.getPointPositionForValue(0,l);return new vr({x:e.x,y:e.y,radius:a.getDistanceFromCenterForValue(h)})}for(let t=0;t<o;++t)c.push(a.getPointPositionForValue(t,h));return c}var i=t,{scale:e={},fill:i}=i,s=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:A(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(p(s)){const i=e.isHorizontal();return{x:i?s:null,y:i?null:s}}return null}(t))instanceof vr?s:mr(s,r));{const{scale:n,index:o,line:l}=t,h=[],c=l.segments,d=l.points,u=function(t,e){var i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t<s.length;t++){var a=s[t];if(a.index===e)break;a.hidden||i.unshift(a.dataset)}return i}(n,o);u.push(mr({x:null,y:n.bottom},l));for(let t=0;t<c.length;t++){const n=c[t];for(let t=n.start;t<=n.end;t++)xr(h,d[t],u)}return new Pa({points:h,options:{}})}}function yr(t,e,i){var s,a=_r(e),{line:e,scale:r,axis:n}=e,o=e.options,l=o.fill,o=o.backgroundColor,{above:l=o,below:o=o}=l||{};a&&e.points.length&&(Ve(t,i),s=t,{line:a,target:l,above:o,below:i,area:r,scale:n}=e={line:e,target:a,above:l,below:o,area:i,scale:r,axis:n},e=a._loop?"angle":e.axis,s.save(),"x"===e&&i!==o&&(Mr(s,l,r.top),wr(s,{line:a,target:l,color:o,scale:n,property:e}),s.restore(),s.save(),Mr(s,l,r.bottom)),wr(s,{line:a,target:l,color:i,scale:n,property:e}),s.restore(),Be(t))}function Mr(t,e,i){const{segments:s,points:a}=e;let r=!0,n=!1;t.beginPath();for(const o of s){const{start:s,end:l}=o,h=a[s],c=a[fr(s,l,a)];r?(t.moveTo(h.x,h.y),r=!1):(t.lineTo(h.x,i),t.lineTo(h.x,h.y)),(n=!!e.pathSegment(t,o,{move:n}))?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function wr(e,i){const{line:s,target:a,property:r,color:n,scale:o}=i,l=function(t,e,i){const s=t.segments,a=t.points,r=e.points,n=[];for(const t of s){var{start:o,end:l}=t,l=fr(o,l,a),h=gr(i,a[o],a[l],t.loop);if(e.segments){var c=Ei(e,h);for(const e of c){const s=gr(i,r[e.start],r[e.end],e.loop),d=Li(t,a,s);for(const t of d)n.push({source:t,target:e,start:{[i]:pr(h,s,"start",Math.max)},end:{[i]:pr(h,s,"end",Math.min)}})}}else n.push({source:t,target:h,start:a[o],end:a[l]})}return n}(s,a,r);for(const{source:i,target:p,start:m,end:b}of l){const{style:{backgroundColor:l=n}={}}=i,x=!0!==a;e.save(),e.fillStyle=l,f=g=u=d=c=h=void 0;var h=e,c=o,d=x&&gr(r,m,b),{top:c,bottom:u}=c.chart.chartArea,{property:d,start:g,end:f}=d||{},d=("x"===d&&(h.beginPath(),h.rect(g,c,f-g,u-c),h.clip()),e.beginPath(),!!s.pathSegment(e,i));let t;if(x){d?e.closePath():kr(e,a,b,r);const i=!!a.pathSegment(e,p,{move:d,reverse:!0});(t=d&&i)||kr(e,a,m,r)}e.closePath(),e.fill(t?"evenodd":"nonzero"),e.restore()}}function kr(t,e,i,s){e=e.interpolate(i,s);e&&t.lineTo(e.x,e.y)}var Sr={id:"filler",afterDatasetsUpdate(t,e,i){var s,a,r,n,o,l,h=(t.data.datasets||[]).length,c=[];let d,u,g,f;for(u=0;u<h;++u)g=(d=t.getDatasetMeta(u)).dataset,f=null,g&&g.options&&g instanceof Pa&&(f={visible:t.isDatasetVisible(u),index:u,fill:(s=g,a=u,r=h,l=o=n=void 0,A(l=function(){var t=s.options,e=t.fill;let i=T(e&&e.target,e);return!1!==(i=void 0===i?!!t.backgroundColor:i)&&null!==i&&(!0===i?"origin":i)}())?!isNaN(l.value)&&l:p(o=parseFloat(l))&&Math.floor(o)===o?(n=l[0],o=o,!((o="-"!==n&&"+"!==n?o:a+o)===a||o<0||r<=o)&&o):0<=["origin","start","end","stack","shape"].indexOf(l)&&l),chart:t,axis:d.controller.options.indexAxis,scale:d.vScale,line:g}),d.$filler=f,c.push(f);for(u=0;u<h;++u)(f=c[u])&&!1!==f.fill&&(f.fill=function(t,e,i){let s=t[e].fill;var a,r=[e];if(!i)return s;for(;!1!==s&&-1===r.indexOf(s);){if(!p(s))return s;if(!(a=t[s]))return!1;if(a.visible)return s;r.push(s),s=a.fill}return!1}(c,u,i.propagate))},beforeDraw(e,t,i){var s="beforeDraw"===i.drawTime,a=e.getSortedVisibleDatasetMetas(),r=e.chartArea;for(let t=a.length-1;0<=t;--t){const i=a[t].$filler;i&&(i.line.updateControlPoints(r,i.axis),s)&&i.fill&&yr(e.ctx,i,r)}},beforeDatasetsDraw(e,t,i){if("beforeDatasetsDraw"===i.drawTime){var s=e.getSortedVisibleDatasetMetas();for(let t=s.length-1;0<=t;--t){const i=s[t].$filler;br(i)&&yr(e.ctx,i,e.chartArea)}}},beforeDatasetDraw(t,e,i){e=e.meta.$filler;br(e)&&"beforeDatasetDraw"===i.drawTime&&yr(t.ctx,e,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Pr=(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 Dr extends e{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const i=this.options.labels||{};let t=d(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(t=>i.filter(t,this.chart.data))),i.sort&&(t=t.sort((t,e)=>i.sort(t,e,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){var{options:i,ctx:s}=this;if(i.display){var a=i.labels,r=z(a.font),n=r.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Pr(a,n);let t,e;s.font=r.string,this.isHorizontal()?(t=this.maxWidth,e=this._fitRows(o,n,a,l)+10):(e=this.maxHeight,t=this._fitCols(o,r,a,l)+10),this.width=Math.min(t,i.maxWidth||this.maxWidth),this.height=Math.min(e,i.maxHeight||this.maxHeight)}else this.width=this.height=0}_fitRows(t,i,s,a){const{ctx:r,maxWidth:n,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],h=this.lineWidths=[0],c=a+o;let d=t,u=(r.textAlign="left",r.textBaseline="middle",-1),g=-c;return this.legendItems.forEach((t,e)=>{t=s+i/2+r.measureText(t.text).width;(0===e||h[h.length-1]+t+2*o>n)&&(d+=c,h[h.length-(0<e?0:1)]=0,g+=c,u++),l[e]={left:0,top:g,row:u,width:t,height:a},h[h.length-1]+=t+o}),d}_fitCols(t,o,l,h){const{ctx:c,maxHeight:e,options:{labels:{padding:d}}}=this,u=this.legendHitBoxes=[],g=this.columnSizes=[],f=e-t;let p=d,m=0,b=0,x=0,v=0;return this.legendItems.forEach((t,e)=>{n=l,i=o,s=c,a=t,r=h;var i,s,a,r,{itemWidth:t,itemHeight:n}={itemWidth:function(t,e,i){let s=a.text;return s&&"string"!=typeof s&&(s=s.reduce((t,e)=>t.length>e.length?t:e)),t+e.size/2+i.measureText(s).width}(n,i,s),itemHeight:function(t){let e=r;return e="string"!=typeof a.text?Cr(a,t):e}(i.lineHeight)};0<e&&b+n+2*d>f&&(p+=m+d,g.push({width:m,height:b}),x+=m+d,v++,m=b=0),u[e]={left:x,top:b,col:v,width:t,height:n},m=Math.max(m,t),b+=n+d}),p+=m,g.push({width:m,height:b}),p}adjustHitBoxes(){if(this.options.display){var i=this._computeTitleHeight(),{legendHitBoxes:s,options:{align:a,labels:{padding:r},rtl:t}}=this,n=Di(t,this.left,this.width);if(this.isHorizontal()){let t=0,e=E(a,this.left+r,this.right-this.lineWidths[t]);for(const o of s)t!==o.row&&(t=o.row,e=E(a,this.left+r,this.right-this.lineWidths[t])),o.top+=this.top+i+r,o.left=n.leftForLtr(n.x(e),o.width),e+=o.width+r}else{let t=0,e=E(a,this.top+i+r,this.bottom-this.columnSizes[t].height);for(const l of s)l.col!==t&&(t=l.col,e=E(a,this.top+i+r,this.bottom-this.columnSizes[t].height)),l.top=e,l.left+=this.left+r,l.left=n.leftForLtr(n.x(l.left),l.width),e+=l.height+r}}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){var t;this.options.display&&(Ve(t=this.ctx,this),this._draw(),Be(t))}_draw(){const{options:h,columnSizes:c,lineWidths:d,ctx:u}=this,{align:g,labels:f}=h,p=R.color,m=Di(h.rtl,this.left,this.width),b=z(f.font),x=f["padding"],v=b.size,_=v/2;let y;this.drawTitle(),u.textAlign=m.textAlign("left"),u.textBaseline="middle",u.lineWidth=.5,u.font=b.string;const{boxWidth:M,boxHeight:w,itemHeight:k}=Pr(f,v),S=this.isHorizontal(),P=this._computeTitleHeight(),D=(y=S?{x:E(g,this.left+x,this.right-d[0]),y:this.top+x+P,line:0}:{x:this.left+x,y:E(g,this.top+P+x,this.bottom-c[0].height),line:0},Ci(this.ctx,h.textDirection),k+x);this.legendItems.forEach((t,e)=>{u.strokeStyle=t.fontColor,u.fillStyle=t.fontColor;var i=u.measureText(t.text).width,s=m.textAlign(t.textAlign||(t.textAlign=f.textAlign)),i=M+_+i;let a=y.x,r=y.y;m.setWidth(this.width),S?0<e&&a+i+x>this.right&&(r=y.y+=D,y.line++,a=y.x=E(g,this.left+x,this.right-d[y.line])):0<e&&r+D>this.bottom&&(a=y.x=a+c[y.line].width+x,y.line++,r=y.y=E(g,this.top+P+x,this.bottom-c[y.line].height));var e=m.x(a),n=r,o=t;if(!(isNaN(M)||M<=0||isNaN(w)||w<0)){u.save();var l=T(o.lineWidth,1);if(u.fillStyle=T(o.fillStyle,p),u.lineCap=T(o.lineCap,"butt"),u.lineDashOffset=T(o.lineDashOffset,0),u.lineJoin=T(o.lineJoin,"miter"),u.lineWidth=l,u.strokeStyle=T(o.strokeStyle,p),u.setLineDash(T(o.lineDash,[])),f.usePointStyle){const p={radius:w*Math.SQRT2/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:l},T=m.xPlus(e,M/2);Fe(u,p,T,n+_,f.pointStyleWidth&&M)}else{const f=n+Math.max((v-w)/2,0),p=m.leftForLtr(e,M),T=wi(o.borderRadius);u.beginPath(),Object.values(T).some(t=>0!==t)?je(u,{x:p,y:f,w:M,h:w,radius:T}):u.rect(p,f,M,w),u.fill(),0!==l&&u.stroke()}u.restore()}if(a=Ct(s,a+M+_,S?a+i:this.right,h.rtl),n=m.x(a),e=r,o=t,He(u,o.text,n,e+k/2,b,{strikethrough:o.hidden,textAlign:m.textAlign(o.textAlign)}),S)y.x+=i+x;else if("string"!=typeof t.text){const h=b.lineHeight;y.y+=Cr(t,h)+x}else y.y+=D}),Oi(this.ctx,h.textDirection)}drawTitle(){const s=this.options,a=s.title,r=z(a.font),n=I(a.padding);if(a.display){var o=Di(s.rtl,this.left,this.width),l=this.ctx,h=a.position,c=r.size/2,c=n.top+c;let t,e=this.left,i=this.width;if(this.isHorizontal())i=Math.max(...this.lineWidths),t=this.top+c,e=E(s.align,e,this.right-i);else{const a=this.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);t=c+E(s.align,this.top,this.bottom-a-s.labels.padding-this._computeTitleHeight())}c=E(h,e,e+i);l.textAlign=o.textAlign(Dt(h)),l.textBaseline="middle",l.strokeStyle=a.color,l.fillStyle=a.color,l.font=r.string,He(l,a.text,c,t,r)}}_computeTitleHeight(){var t=this.options.title,e=z(t.font),i=I(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,a;if(c(t,this.left,this.right)&&c(e,this.top,this.bottom))for(a=this.legendHitBoxes,i=0;i<a.length;++i)if(c(t,(s=a[i]).left,s.left+s.width)&&c(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){var e,i,s,a=this.options;("mousemove"!==(e=t.type)&&"mouseout"!==e||!a.onHover&&!a.onLeave)&&(!a.onClick||"click"!==e&&"mouseup"!==e)||(e=this._getLegendItemAt(t.x,t.y),"mousemove"===t.type||"mouseout"===t.type?(s=null!==(i=this._hoveredItem)&&null!==e&&i.datasetIndex===e.datasetIndex&&i.index===e.index,i&&!s&&d(a.onLeave,[t,i,this],this),(this._hoveredItem=e)&&!s&&d(a.onHover,[t,e,this],this)):e&&d(a.onClick,[t,e,this],this))}}function Cr(t,e){return e*(t.text?t.text.length:0)}var Or={id:"legend",_element:Dr,start(t,e,i){var s=t.legend=new Dr({ctx:t.ctx,options:i,chart:t});a.configure(t,s,i),a.addBox(t,s)},stop(t){a.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){var s=t.legend;a.configure(t,s,i),s.options=i},afterUpdate(t){t=t.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){var s=e.datasetIndex,i=i.chart;i.isDatasetVisible(s)?(i.hide(s),e.hidden=!0):(i.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const s=t.data.datasets,{usePointStyle:a,pointStyle:r,textAlign:n,color:o,useBorderRadius:l,borderRadius:h}=t.legend.options["labels"];return t._getSortedDatasetMetas().map(t=>{var e=t.controller.getStyle(a?0:void 0),i=I(e.borderWidth);return{text:s[t.index].label,fillStyle:e.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:(i.width+i.height)/4,strokeStyle:e.borderColor,pointStyle:r||e.pointStyle,rotation:e.rotation,textAlign:n||e.textAlign,borderRadius:l&&(h||e.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Ar extends e{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){var i=this.options;this.left=0,this.top=0,i.display?(this.width=this.right=t,this.height=this.bottom=e,t=O(i.text)?i.text.length:1,this._padding=I(i.padding),e=t*z(i.font).lineHeight+this._padding.height,this.isHorizontal()?this.height=e:this.width=e):this.width=this.height=this.right=this.bottom=0}isHorizontal(){var t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){var{top:e,left:i,bottom:s,right:a,options:r}=this,n=r.align;let o,l,h,c=0;return o=this.isHorizontal()?(l=E(n,i,a),h=e+t,a-i):(c="left"===r.position?(l=i+t,h=E(n,s,e),-.5*S):(l=a-t,h=E(n,e,s),.5*S),s-e),{titleX:l,titleY:h,maxWidth:o,rotation:c}}draw(){var t,e,i,s,a,r=this.ctx,n=this.options;n.display&&(e=(t=z(n.font)).lineHeight/2+this._padding.top,{titleX:e,titleY:i,maxWidth:s,rotation:a}=this._drawArgs(e),He(r,n.text,0,0,t,{color:n.color,maxWidth:s,rotation:a,textAlign:Dt(n.align),textBaseline:"middle",translation:[e,i]}))}}var Tr={id:"title",_element:Ar,start(t,e,i){var s;t=t,i=i,s=new Ar({ctx:t.ctx,options:i,chart:t}),a.configure(t,s,i),a.addBox(t,s),t.titleBlock=s},stop(t){var e=t.titleBlock;a.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){var s=t.titleBlock;a.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 Lr=new WeakMap;var Er={id:"subtitle",start(t,e,i){var s=new Ar({ctx:t.ctx,options:i,chart:t});a.configure(t,s,i),a.addBox(t,s),Lr.set(t,s)},stop(t){a.removeBox(t,Lr.get(t)),Lr.delete(t)},beforeUpdate(t,e,i){var s=Lr.get(t);a.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 Rr={average(t){if(!t.length)return!1;let e,i,s=0,a=0,r=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s+=t.x,a+=t.y,++r}}return{x:s/r,y:a/r}},nearest(t,e){if(!t.length)return!1;let i,s,a,r=e.x,n=e.y,o=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=gt(e,s.getCenterPoint());t<o&&(o=t,a=s)}}if(a){const t=a.tooltipPosition();r=t.x,n=t.y}return{x:r,y:n}}};function b(t,e){return e&&(O(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Ir(t){return("string"==typeof t||t instanceof String)&&-1<t.indexOf("\n")?t.split("\n"):t}function zr(t,e){const i=t.chart.ctx,{body:s,footer:a,title:r}=t,{boxWidth:n,boxHeight:o}=e,l=z(e.bodyFont),h=z(e.titleFont),c=z(e.footerFont),d=r.length,u=a.length,g=s.length,f=I(e.padding);let p=f.height,m=0,b=s.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0),x=(b+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b&&(p+=g*(e.displayColors?Math.max(o,l.lineHeight):l.lineHeight)+(b-g)*l.lineHeight+(b-1)*e.bodySpacing),u&&(p+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing),0);function v(t){m=Math.max(m,i.measureText(t).width+x)}return i.save(),i.font=h.string,k(t.title,v),i.font=l.string,k(t.beforeBody.concat(t.afterBody),v),x=e.displayColors?n+2+e.boxPadding:0,k(s,t=>{k(t.before,v),k(t.lines,v),k(t.after,v)}),x=0,i.font=c.string,k(t.footer,v),i.restore(),{width:m+=f.width,height:p}}function Fr(i,t,s){var e=s.yAlign||t.yAlign||function(){var{y:t,height:e}=s;return t<e/2?"top":t>i.height-e/2?"bottom":"center"}();return{xAlign:s.xAlign||t.xAlign||function(a,r,n,t){var{x:e,width:i}=n,{width:s,chartArea:{left:o,right:l}}=a;let h="center";return"center"===t?h=e<=(o+l)/2?"left":"right":e<=i/2?h="left":s-i/2<=e&&(h="right"),h=function(t){var{x:e,width:i}=n,s=r.caretSize+r.caretPadding;return"left"===t&&e+i+s>a.width||"right"===t&&e-i-s<0}(h)?"center":h}(i,t,s,e),yAlign:e}}function Vr(t,i,e,s){var{caretSize:t,caretPadding:a,cornerRadius:r}=t,{xAlign:n,yAlign:o}=e,l=t+a,{topLeft:e,topRight:a,bottomLeft:r,bottomRight:h}=wi(r);let c=function(){let{x:t,width:e}=i;return"right"===n?t-=e:"center"===n&&(t-=e/2),t}();var d=function(){let{y:t,height:e}=i;return"top"===o?t+=l:t-="bottom"===o?e+l:e/2,t}();return"center"===o?"left"===n?c+=l:"right"===n&&(c-=l):"left"===n?c-=Math.max(e,r)+t:"right"===n&&(c+=Math.max(a,h)+t),{x:C(c,0,s.width-i.width),y:C(d,0,s.height-i.height)}}function Br(t,e,i){i=I(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.right:t.x+i.left}function Wr(t){return b([],Ir(t))}function Nr(t,e){e=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return e?t.override(e):t}const Hr={beforeTitle:t,title(t){if(0<t.length){var t=t[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&"dataset"===this.options.mode)return t.dataset.label||"";if(t.label)return t.label;if(0<i&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:t,beforeBody:t,beforeLabel:t,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");t=t.formattedValue;return P(t)||(e+=t),e},labelColor(t){t=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){t=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:t,afterBody:t,beforeFooter:t,footer:t,afterFooter:t};function x(t,e,i,s){t=t[e].call(i,s);return void 0===t?Hr[e].call(i,s):t}class jr extends e{static positioners=Rr;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,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(){var t,e=this._cachedAnimations;return e||(e=this.chart,e=(t=this.options.setContext(this.getContext())).enabled&&e.options.animation&&t.animations,t=new xs(this.chart,e),e._cacheable&&(this._cachedAnimations=Object.freeze(t)),t)}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),Pi(t,{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"})));var t}getTitle(t,e){var e=e["callbacks"],i=x(e,"beforeTitle",this,t),s=x(e,"title",this,t),e=x(e,"afterTitle",this,t),t=b([],Ir(i));return t=b(t,Ir(s)),b(t,Ir(e))}getBeforeBody(t,e){return Wr(x(e.callbacks,"beforeBody",this,t))}getBody(t,e){const s=e["callbacks"],a=[];return k(t,t=>{var e={before:[],lines:[],after:[]},i=Nr(s,t);b(e.before,Ir(x(i,"beforeLabel",this,t))),b(e.lines,x(i,"label",this,t)),b(e.after,Ir(x(i,"afterLabel",this,t))),a.push(e)}),a}getAfterBody(t,e){return Wr(x(e.callbacks,"afterBody",this,t))}getFooter(t,e){var e=e["callbacks"],i=x(e,"beforeFooter",this,t),s=x(e,"footer",this,t),e=x(e,"afterFooter",this,t),t=b([],Ir(i));return t=b(t,Ir(s)),b(t,Ir(e))}_createItems(s){const t=this._active,a=this.chart.data,i=[],r=[],n=[];let e,o,l=[];for(e=0,o=t.length;e<o;++e)l.push(function(t,e){var{element:e,datasetIndex:i,index:s}=e,a=t.getDatasetMeta(i).controller,{label:r,value:n}=a.getLabelAndValue(s);return{chart:t,label:r,parsed:a.getParsed(s),raw:t.data.datasets[i].data[s],formattedValue:n,dataset:a.getDataset(),dataIndex:s,datasetIndex:i,element:e}}(this.chart,t[e]));return s.filter&&(l=l.filter((t,e,i)=>s.filter(t,e,i,a))),k(l=s.itemSort?l.sort((t,e)=>s.itemSort(t,e,a)):l,t=>{var e=Nr(s.callbacks,t);i.push(x(e,"labelColor",this,t)),r.push(x(e,"labelPointStyle",this,t)),n.push(x(e,"labelTextColor",this,t))}),this.labelColors=i,this.labelPointStyles=r,this.labelTextColors=n,this.dataPoints=l}update(t,e){var i=this.options.setContext(this.getContext()),s=this._active;let a,r=[];if(s.length){const t=Rr[i.position].call(this,s,this._eventPosition),e=(r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i),this._size=zr(this,i)),n=Object.assign({},t,e),o=Fr(this.chart,i,n),l=Vr(i,n,o,this.chart);this.xAlign=o.xAlign,this.yAlign=o.yAlign,a={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(a={opacity:0});this._tooltipItems=r,this.$context=void 0,a&&this._resolveAnimations().update(this,a),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){t=this.getCaretPosition(t,i,s);e.lineTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineTo(t.x3,t.y3)}getCaretPosition(t,e,i){var{xAlign:s,yAlign:a}=this,{caretSize:i,cornerRadius:r}=i,{topLeft:r,topRight:n,bottomLeft:o,bottomRight:l}=wi(r),{x:t,y:h}=t,{width:e,height:c}=e;let d,u,g,f,p,m;return"center"===a?(p=h+c/2,m="left"===s?(d=t,u=d-i,f=p+i,p-i):(d=t+e,u=d+i,f=p-i,p+i),g=d):(u="left"===s?t+Math.max(r,o)+i:"right"===s?t+e-Math.max(n,l)-i:this.caretX,g="top"===a?(f=h,p=f-i,d=u-i,u+i):(f=h+c,p=f+i,d=u+i,u-i),m=f),{x1:d,x2:u,x3:g,y1:f,y2:p,y3:m}}drawTitle(t,e,i){var s=this.title,a=s.length;let r,n,o;if(a){var l=Di(i.rtl,this.x,this.width);for(t.x=Br(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",r=z(i.titleFont),n=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,o=0;o<a;++o)e.fillText(s[o],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+n,o+1===a&&(t.y+=i.titleMarginBottom-n)}}_drawColorBox(t,e,i,s,a){const r=this.labelColors[i],n=this.labelPointStyles[i],{boxHeight:o,boxWidth:l}=a,h=z(a.bodyFont),c=Br(this,"left",a),d=s.x(c),u=o<h.lineHeight?(h.lineHeight-o)/2:0,g=e.y+u;if(a.usePointStyle){const e={radius:Math.min(l,o)/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:1},i=s.leftForLtr(d,l)+l/2,A=g+o/2;t.strokeStyle=a.multiKeyBackground,t.fillStyle=a.multiKeyBackground,ze(t,e,i,A),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,ze(t,e,i,A)}else{t.lineWidth=A(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const e=s.leftForLtr(d,l),i=s.leftForLtr(s.xPlus(d,1),l-2),n=wi(r.borderRadius);Object.values(n).some(t=>0!==t)?(t.beginPath(),t.fillStyle=a.multiKeyBackground,je(t,{x:e,y:g,w:l,h:o,radius:n}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),je(t,{x:i,y:g+1,w:l-2,h:o-2,radius:n}),t.fill()):(t.fillStyle=a.multiKeyBackground,t.fillRect(e,g,l,o),t.strokeRect(e,g,l,o),t.fillStyle=r.backgroundColor,t.fillRect(i,g+1,l-2,o-2))}t.fillStyle=this.labelTextColors[i]}drawBody(e,i,t){const s=this["body"],{bodySpacing:a,bodyAlign:r,displayColors:n,boxHeight:o,boxWidth:l,boxPadding:h}=t,c=z(t.bodyFont);let d=c.lineHeight,u=0;function g(t){i.fillText(t,f.x(e.x+u),e.y+d/2),e.y+=d+a}const f=Di(t.rtl,this.x,this.width),p=f.textAlign(r);let m,b,x,v,_,y,M;for(i.textAlign=r,i.textBaseline="middle",i.font=c.string,e.x=Br(this,p,t),i.fillStyle=t.bodyColor,k(this.beforeBody,g),u=n&&"right"!==p?"center"===r?l/2+h:l+2+h:0,v=0,y=s.length;v<y;++v){for(m=s[v],b=this.labelTextColors[v],i.fillStyle=b,k(m.before,g),x=m.lines,n&&x.length&&(this._drawColorBox(i,e,v,f,t),d=Math.max(c.lineHeight,o)),_=0,M=x.length;_<M;++_)g(x[_]),d=c.lineHeight;k(m.after,g)}u=0,d=c.lineHeight,k(this.afterBody,g),e.y-=a}drawFooter(t,e,i){var s=this.footer,a=s.length;let r,n;if(a){var o=Di(i.rtl,this.x,this.width);for(t.x=Br(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=o.textAlign(i.footerAlign),e.textBaseline="middle",r=z(i.footerFont),e.fillStyle=i.footerColor,e.font=r.string,n=0;n<a;++n)e.fillText(s[n],o.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){var{xAlign:a,yAlign:r}=this,{x:n,y:o}=t,{width:l,height:h}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:g}=wi(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(n+c,o),"top"===r&&this.drawCaret(t,e,i,s),e.lineTo(n+l-d,o),e.quadraticCurveTo(n+l,o,n+l,o+d),"center"===r&&"right"===a&&this.drawCaret(t,e,i,s),e.lineTo(n+l,o+h-g),e.quadraticCurveTo(n+l,o+h,n+l-g,o+h),"bottom"===r&&this.drawCaret(t,e,i,s),e.lineTo(n+u,o+h),e.quadraticCurveTo(n,o+h,n,o+h-u),"center"===r&&"left"===a&&this.drawCaret(t,e,i,s),e.lineTo(n,o+c),e.quadraticCurveTo(n,o,n+c,o),e.closePath(),e.fill(),0<s.borderWidth&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,a=i&&i.y;if(s||a){const i=Rr[t.position].call(this,this._active,this._eventPosition);var r,n;i&&(r=this._size=zr(this,t),n=Vr(t,n=Object.assign({},i,this._size),t=Fr(e,t,n),e),s._to===n.x&&a._to===n.y||(this.xAlign=t.xAlign,this.yAlign=t.yAlign,this.width=r.width,this.height=r.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,n)))}}_willRender(){return!!this.opacity}draw(t){var e,i,s,a,r=this.options.setContext(this.getContext()),n=this.opacity;n&&(this._updateAnimationTarget(r),e={width:this.width,height:this.height},i={x:this.x,y:this.y},n=Math.abs(n)<.001?0:n,s=I(r.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length,r.enabled)&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(i,t,e,r),Ci(t,r.textDirection),i.y+=s.top,this.drawTitle(i,t,r),this.drawBody(i,t,r),this.drawFooter(i,t,r),Oi(t,r.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){var i=this._active,t=t.map(({datasetIndex:t,index:e})=>{var i=this.chart.getDatasetMeta(t);if(i)return{datasetIndex:t,element:i.data[e],index:e};throw new Error("Cannot find a dataset at index "+t)}),i=!W(i,t),s=this._positionChanged(t,e);(i||s)&&(this._active=t,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;var s=this.options,a=this._active||[],i=this._getActiveElements(t,a,e,i),r=this._positionChanged(i,t),a=e||!W(i,a)||r;return a&&(this._active=i,s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e)),a}_getActiveElements(t,e,i,s){var a=this.options;return"mouseout"===t.type?[]:s?(s=this.chart.getElementsAtEventForMode(t,a.mode,a,i),a.reverse&&s.reverse(),s):e}_positionChanged(t,e){var{caretX:i,caretY:s,options:a}=this,a=Rr[a.position].call(this,t,e);return!1!==a&&(i!==a.x||s!==a.y)}}var Yr={id:"tooltip",_element:jr,positioners:Rr,afterInit(t,e,i){i&&(t.tooltip=new jr({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){var e,i=t.tooltip;i&&i._willRender()&&!(e={tooltip:i})!==t.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})&&(i.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",e))},afterEvent(t,e){var i;t.tooltip&&(i=e.replay,t.tooltip.handleEvent(e.event,i,e.inChartArea))&&(e.changed=!0)},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Hr},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};return i.register(ma,ir,Ea,s),i.helpers={...Fi},i._adapters=la,i.Animation=bs,i.Animations=xs,i.animator=r,i.controllers=w.controllers.items,i.DatasetController=Os,i.Element=e,i.elements=Ea,i.Interaction=Hi,i.layouts=a,i.platforms=Oe,i.Scale=zs,i.Ticks=ge,Object.assign(i,ma,ir,Ea,s,Oe),i.Chart=i,"undefined"!=typeof window&&(window.Chart=i),i}) |