var qi=Object.defineProperty;var Gi=(s,t,e)=>t in s?qi(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var k=(s,t,e)=>Gi(s,typeof t!="symbol"?t+"":t,e);/*! * @kurkle/color v0.3.4 * https://github.com/kurkle/color#readme * (c) 2024 Jukka Kurkela * Released under the MIT License */function Ut(s){return s+.5|0}const J=(s,t,e)=>Math.max(Math.min(s,e),t);function Lt(s){return J(Ut(s*2.55),0,255)}function et(s){return J(Ut(s*255),0,255)}function Z(s){return J(Ut(s/2.55)/100,0,1)}function es(s){return J(Ut(s*100),0,100)}const W={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},Ee=[..."0123456789ABCDEF"],Zi=s=>Ee[s&15],Qi=s=>Ee[(s&240)>>4]+Ee[s&15],qt=s=>(s&240)>>4===(s&15),Ji=s=>qt(s.r)&&qt(s.g)&&qt(s.b)&&qt(s.a);function tn(s){var t=s.length,e;return s[0]==="#"&&(t===4||t===5?e={r:255&W[s[1]]*17,g:255&W[s[2]]*17,b:255&W[s[3]]*17,a:t===5?W[s[4]]*17:255}:(t===7||t===9)&&(e={r:W[s[1]]<<4|W[s[2]],g:W[s[3]]<<4|W[s[4]],b:W[s[5]]<<4|W[s[6]],a:t===9?W[s[7]]<<4|W[s[8]]:255})),e}const en=(s,t)=>s<255?t(s):"";function sn(s){var t=Ji(s)?Zi:Qi;return s?"#"+t(s.r)+t(s.g)+t(s.b)+en(s.a,t):void 0}const nn=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function pi(s,t,e){const i=t*Math.min(e,1-e),n=(o,r=(o+s/30)%12)=>e-i*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function on(s,t,e){const i=(n,o=(n+s/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function rn(s,t,e){const i=pi(s,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)i[n]*=1-t-e,i[n]+=t;return i}function an(s,t,e,i,n){return s===n?(t-e)/i+(t.5?h/(2-o-r):h/(o+r),c=an(e,i,n,h,o),c=c*60+.5),[c|0,l||0,a]}function je(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(et)}function He(s,t,e){return je(pi,s,t,e)}function cn(s,t,e){return je(rn,s,t,e)}function ln(s,t,e){return je(on,s,t,e)}function mi(s){return(s%360+360)%360}function hn(s){const t=nn.exec(s);let e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Lt(+t[5]):et(+t[5]));const n=mi(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=cn(n,o,r):t[1]==="hsv"?i=ln(n,o,r):i=He(n,o,r),{r:i[0],g:i[1],b:i[2],a:e}}function fn(s,t){var e=Ve(s);e[0]=mi(e[0]+t),e=He(e),s.r=e[0],s.g=e[1],s.b=e[2]}function un(s){if(!s)return;const t=Ve(s),e=t[0],i=es(t[1]),n=es(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${Z(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}const ss={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"},is={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"};function dn(){const s={},t=Object.keys(is),e=Object.keys(ss);let i,n,o,r,a;for(i=0;i>16&255,o>>8&255,o&255]}return s}let Gt;function gn(s){Gt||(Gt=dn(),Gt.transparent=[0,0,0,0]);const t=Gt[s.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const pn=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function mn(s){const t=pn.exec(s);let e=255,i,n,o;if(t){if(t[7]!==i){const r=+t[7];e=t[8]?Lt(r):J(r*255,0,255)}return i=+t[1],n=+t[3],o=+t[5],i=255&(t[2]?Lt(i):J(i,0,255)),n=255&(t[4]?Lt(n):J(n,0,255)),o=255&(t[6]?Lt(o):J(o,0,255)),{r:i,g:n,b:o,a:e}}}function _n(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${Z(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}const ve=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,bt=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);function bn(s,t,e){const i=bt(Z(s.r)),n=bt(Z(s.g)),o=bt(Z(s.b));return{r:et(ve(i+e*(bt(Z(t.r))-i))),g:et(ve(n+e*(bt(Z(t.g))-n))),b:et(ve(o+e*(bt(Z(t.b))-o))),a:s.a+e*(t.a-s.a)}}function Zt(s,t,e){if(s){let i=Ve(s);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=He(i),s.r=i[0],s.g=i[1],s.b=i[2]}}function _i(s,t){return s&&Object.assign(t||{},s)}function ns(s){var t={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(t={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(t.a=et(s[3]))):(t=_i(s,{r:0,g:0,b:0,a:1}),t.a=et(t.a)),t}function xn(s){return s.charAt(0)==="r"?mn(s):hn(s)}class Bt{constructor(t){if(t instanceof Bt)return t;const e=typeof t;let i;e==="object"?i=ns(t):e==="string"&&(i=tn(t)||gn(t)||xn(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=_i(this._rgb);return t&&(t.a=Z(t.a)),t}set rgb(t){this._rgb=ns(t)}rgbString(){return this._valid?_n(this._rgb):void 0}hexString(){return this._valid?sn(this._rgb):void 0}hslString(){return this._valid?un(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,c=i.a-n.a,l=((a*c===-1?a:(a+c)/(1+a*c))+1)/2;o=1-l,i.r=255&l*i.r+o*n.r+.5,i.g=255&l*i.g+o*n.g+.5,i.b=255&l*i.b+o*n.b+.5,i.a=r*i.a+(1-r)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=bn(this._rgb,t._rgb,e)),this}clone(){return new Bt(this.rgb)}alpha(t){return this._rgb.a=et(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Ut(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Zt(this._rgb,2,t),this}darken(t){return Zt(this._rgb,2,-t),this}saturate(t){return Zt(this._rgb,1,t),this}desaturate(t){return Zt(this._rgb,1,-t),this}rotate(t){return fn(this._rgb,t),this}}/*! * Chart.js v4.4.8 * https://www.chartjs.org * (c) 2025 Chart.js Contributors * Released under the MIT License */const yn=(()=>{let s=0;return()=>s++})();function T(s){return s==null}function R(s){if(Array.isArray&&Array.isArray(s))return!0;const t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function S(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function B(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function U(s,t){return B(s)?s:t}function P(s,t){return typeof s>"u"?t:s}const vn=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;function E(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function N(s,t,e,i){let n,o,r;if(R(s))for(o=s.length,n=0;ns,x:s=>s.x,y:s=>s.y};function Mn(s){const t=s.split("."),e=[];let i="";for(const n of t)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function Sn(s){const t=Mn(s);return e=>{for(const i of t){if(i==="")break;e=e&&e[i]}return e}}function ue(s,t){return(rs[t]||(rs[t]=Sn(t)))(s)}function We(s){return s.charAt(0).toUpperCase()+s.slice(1)}const de=s=>typeof s<"u",st=s=>typeof s=="function",as=(s,t)=>{if(s.size!==t.size)return!1;for(const e of s)if(!t.has(e))return!1;return!0};function On(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}const j=Math.PI,q=2*j,Dn=q+j,ge=Number.POSITIVE_INFINITY,Pn=j/180,tt=j/2,ot=j/4,cs=j*2/3,xi=Math.log10,xt=Math.sign;function At(s,t,e){return Math.abs(s-t)n-o).pop(),t}function In(s){return typeof s=="symbol"||typeof s=="object"&&s!==null&&!(Symbol.toPrimitive in s||"toString"in s||"valueOf"in s)}function jt(s){return!In(s)&&!isNaN(parseFloat(s))&&isFinite(s)}function Cn(s,t){const e=Math.round(s);return e-t<=s&&e+t>=s}function Ln(s,t,e){let i,n,o;for(i=0,n=s.length;ic&&l=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function $e(s,t,e){e=e||(r=>s[r]1;)o=n+i>>1,e(o)?n=o:i=o;return{lo:n,hi:i}}const ut=(s,t,e,i)=>$e(s,e,i?n=>{const o=s[n][t];return os[n][t]$e(s,e,i=>s[i][t]>=e);function Nn(s,t,e){let i=0,n=s.length;for(;ii&&s[n-1]>e;)n--;return i>0||n{const i="_onData"+We(e),n=s[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value(...o){const r=n.apply(this,o);return s._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function us(s,t){const e=s._chartjs;if(!e)return;const i=e.listeners,n=i.indexOf(t);n!==-1&&i.splice(n,1),!(i.length>0)&&(ki.forEach(o=>{delete s[o]}),delete s._chartjs)}function Vn(s){const t=new Set(s);return t.size===s.length?s:Array.from(t)}const wi=function(){return typeof window>"u"?function(s){return s()}:window.requestAnimationFrame}();function Mi(s,t){let e=[],i=!1;return function(...n){e=n,i||(i=!0,wi.call(window,()=>{i=!1,s.apply(t,e)}))}}function jn(s,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(s,t,i)):s.apply(this,i),t}}const Hn=s=>s==="start"?"left":s==="end"?"right":"center",ds=(s,t,e)=>s==="start"?t:s==="end"?e:(t+e)/2;function Wn(s,t,e){const i=t.length;let n=0,o=i;if(s._sorted){const{iScale:r,vScale:a,_parsed:c}=s,l=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null,h=r.axis,{min:f,max:u,minDefined:d,maxDefined:m}=r.getUserBounds();if(d){if(n=Math.min(ut(c,h,f).lo,e?i:ut(t,h,r.getPixelForValue(f)).lo),l){const g=c.slice(0,n+1).reverse().findIndex(p=>!T(p[a.axis]));n-=Math.max(0,g)}n=X(n,0,i-1)}if(m){let g=Math.max(ut(c,r.axis,u,!0).hi+1,e?0:ut(t,h,r.getPixelForValue(u),!0).hi+1);if(l){const p=c.slice(g-1).findIndex(_=>!T(_[a.axis]));g+=Math.max(0,p)}o=X(g,n,i)-n}else o=i-n}return{start:n,count:o}}function $n(s){const{xScale:t,yScale:e,_scaleRanges:i}=s,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return s._scaleRanges=n,!0;const o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,n),o}const Qt=s=>s===0||s===1,gs=(s,t,e)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-t)*q/e)),ps=(s,t,e)=>Math.pow(2,-10*s)*Math.sin((s-t)*q/e)+1,zt={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*tt)+1,easeOutSine:s=>Math.sin(s*tt),easeInOutSine:s=>-.5*(Math.cos(j*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>Qt(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>Qt(s)?s:gs(s,.075,.3),easeOutElastic:s=>Qt(s)?s:ps(s,.075,.3),easeInOutElastic(s){return Qt(s)?s:s<.5?.5*gs(s*2,.1125,.45):.5+.5*ps(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let t=1.70158;return(s/=.5)<1?.5*(s*s*(((t*=1.525)+1)*s-t)):.5*((s-=2)*s*(((t*=1.525)+1)*s+t)+2)},easeInBounce:s=>1-zt.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?zt.easeInBounce(s*2)*.5:zt.easeOutBounce(s*2-1)*.5+.5};function Ue(s){if(s&&typeof s=="object"){const t=s.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ms(s){return Ue(s)?s:new Bt(s)}function ke(s){return Ue(s)?s:new Bt(s).saturate(.5).darken(.1).hexString()}const Un=["x","y","borderWidth","radius","tension"],Yn=["color","borderColor","backgroundColor"];function Kn(s){s.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),s.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),s.set("animations",{colors:{type:"color",properties:Yn},numbers:{type:"number",properties:Un}}),s.describe("animations",{_fallback:"animation"}),s.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=>t|0}}}})}function Xn(s){s.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const _s=new Map;function qn(s,t){t=t||{};const e=s+JSON.stringify(t);let i=_s.get(e);return i||(i=new Intl.NumberFormat(s,t),_s.set(e,i)),i}function Si(s,t,e){return qn(t,e).format(s)}const Gn={values(s){return R(s)?s:""+s},numeric(s,t,e){if(s===0)return"0";const i=this.chart.options.locale;let n,o=s;if(e.length>1){const l=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(l<1e-4||l>1e15)&&(n="scientific"),o=Zn(s,e)}const r=xi(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),c={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(c,this.options.ticks.format),Si(s,i,c)}};function Zn(s,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&s!==Math.floor(s)&&(e=s-Math.floor(s)),e}var Oi={formatters:Gn};function Qn(s){s.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,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:Oi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.route("scale.ticks","color","","color"),s.route("scale.grid","color","","borderColor"),s.route("scale.border","color","","borderColor"),s.route("scale.title","color","","color"),s.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),s.describe("scales",{_fallback:"scale"}),s.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const pt=Object.create(null),Fe=Object.create(null);function Rt(s,t){if(!t)return s;const e=t.split(".");for(let i=0,n=e.length;ii.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=(i,n)=>ke(n.backgroundColor),this.hoverBorderColor=(i,n)=>ke(n.borderColor),this.hoverColor=(i,n)=>ke(n.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 we(this,t,e)}get(t){return Rt(this,t)}describe(t,e){return we(Fe,t,e)}override(t,e){return we(pt,t,e)}route(t,e,i,n){const o=Rt(this,t),r=Rt(this,i),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const c=this[a],l=r[n];return S(c)?Object.assign({},l,c):P(c,l)},set(c){this[a]=c}}})}apply(t){t.forEach(e=>e(this))}}var F=new Jn({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Kn,Xn,Qn]);function to(s){return!s||T(s.size)||T(s.family)?null:(s.style?s.style+" ":"")+(s.weight?s.weight+" ":"")+s.size+"px "+s.family}function bs(s,t,e,i,n){let o=t[n];return o||(o=t[n]=s.measureText(n).width,e.push(n)),o>i&&(i=o),i}function rt(s,t,e){const i=s.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*i)/i+n}function xs(s,t){!t&&!s||(t=t||s.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,s.width,s.height),t.restore())}function eo(s,t,e,i){so(s,t,e,i)}function so(s,t,e,i,n){let o,r,a,c,l,h,f,u;const d=t.pointStyle,m=t.rotation,g=t.radius;let p=(m||0)*Pn;if(d&&typeof d=="object"&&(o=d.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){s.save(),s.translate(e,i),s.rotate(p),s.drawImage(d,-d.width/2,-d.height/2,d.width,d.height),s.restore();return}if(!(isNaN(g)||g<=0)){switch(s.beginPath(),d){default:s.arc(e,i,g,0,q),s.closePath();break;case"triangle":h=g,s.moveTo(e+Math.sin(p)*h,i-Math.cos(p)*g),p+=cs,s.lineTo(e+Math.sin(p)*h,i-Math.cos(p)*g),p+=cs,s.lineTo(e+Math.sin(p)*h,i-Math.cos(p)*g),s.closePath();break;case"rectRounded":l=g*.516,c=g-l,r=Math.cos(p+ot)*c,f=Math.cos(p+ot)*c,a=Math.sin(p+ot)*c,u=Math.sin(p+ot)*c,s.arc(e-f,i-a,l,p-j,p-tt),s.arc(e+u,i-r,l,p-tt,p),s.arc(e+f,i+a,l,p,p+tt),s.arc(e-u,i+r,l,p+tt,p+j),s.closePath();break;case"rect":if(!m){c=Math.SQRT1_2*g,h=c,s.rect(e-h,i-c,2*h,2*c);break}p+=ot;case"rectRot":f=Math.cos(p)*g,r=Math.cos(p)*g,a=Math.sin(p)*g,u=Math.sin(p)*g,s.moveTo(e-f,i-a),s.lineTo(e+u,i-r),s.lineTo(e+f,i+a),s.lineTo(e-u,i+r),s.closePath();break;case"crossRot":p+=ot;case"cross":f=Math.cos(p)*g,r=Math.cos(p)*g,a=Math.sin(p)*g,u=Math.sin(p)*g,s.moveTo(e-f,i-a),s.lineTo(e+f,i+a),s.moveTo(e+u,i-r),s.lineTo(e-u,i+r);break;case"star":f=Math.cos(p)*g,r=Math.cos(p)*g,a=Math.sin(p)*g,u=Math.sin(p)*g,s.moveTo(e-f,i-a),s.lineTo(e+f,i+a),s.moveTo(e+u,i-r),s.lineTo(e-u,i+r),p+=ot,f=Math.cos(p)*g,r=Math.cos(p)*g,a=Math.sin(p)*g,u=Math.sin(p)*g,s.moveTo(e-f,i-a),s.lineTo(e+f,i+a),s.moveTo(e+u,i-r),s.lineTo(e-u,i+r);break;case"line":r=Math.cos(p)*g,a=Math.sin(p)*g,s.moveTo(e-r,i-a),s.lineTo(e+r,i+a);break;case"dash":s.moveTo(e,i),s.lineTo(e+Math.cos(p)*g,i+Math.sin(p)*g);break;case!1:s.closePath();break}s.fill(),t.borderWidth>0&&s.stroke()}}function Ht(s,t,e){return e=e||.5,!t||s&&s.x>t.left-e&&s.xt.top-e&&s.y0&&o.strokeColor!=="";let c,l;for(s.save(),s.font=n.string,oo(s,o),c=0;c+s||0;function uo(s,t){const e={},i=S(t),n=i?Object.keys(t):t,o=S(s)?i?r=>P(s[r],s[t[r]]):r=>s[r]:()=>s;for(const r of n)e[r]=fo(o(r));return e}function go(s){return uo(s,{top:"y",right:"x",bottom:"y",left:"x"})}function Wt(s){const t=go(s);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Ae(s,t){s=s||{},t=t||F.font;let e=P(s.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=P(s.style,t.style);i&&!(""+i).match(lo)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);const n={family:P(s.family,t.family),lineHeight:ho(P(s.lineHeight,t.lineHeight),e),size:e,style:i,weight:P(s.weight,t.weight),string:""};return n.string=to(n),n}function Jt(s,t,e,i){let n,o,r;for(n=0,o=s.length;ne&&a===0?0:a+c;return{min:r(i,-Math.abs(o)),max:r(n,o)}}function wt(s,t){return Object.assign(Object.create(s),t)}function Xe(s,t=[""],e,i,n=()=>s[0]){const o=e||s;typeof i>"u"&&(i=Ii("_fallback",s));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:o,_fallback:i,_getTarget:n,override:a=>Xe([a,...s],t,o,i)};return new Proxy(r,{deleteProperty(a,c){return delete a[c],delete a._keys,delete s[0][c],!0},get(a,c){return Pi(a,c,()=>wo(c,t,s,a))},getOwnPropertyDescriptor(a,c){return Reflect.getOwnPropertyDescriptor(a._scopes[0],c)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(a,c){return ks(a).includes(c)},ownKeys(a){return ks(a)},set(a,c,l){const h=a._storage||(a._storage=n());return a[c]=h[c]=l,delete a._keys,!0}})}function yt(s,t,e,i){const n={_cacheable:!1,_proxy:s,_context:t,_subProxy:e,_stack:new Set,_descriptors:Di(s,i),setContext:o=>yt(s,o,e,i),override:o=>yt(s.override(o),t,e,i)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete s[r],!0},get(o,r,a){return Pi(o,r,()=>_o(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(s,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,r)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(o,r){return Reflect.has(s,r)},ownKeys(){return Reflect.ownKeys(s)},set(o,r,a){return s[r]=a,delete o[r],!0}})}function Di(s,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:n=t.allKeys}=s;return{allKeys:n,scriptable:e,indexable:i,isScriptable:st(e)?e:()=>e,isIndexable:st(i)?i:()=>i}}const mo=(s,t)=>s?s+We(t):t,qe=(s,t)=>S(t)&&s!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Pi(s,t,e){if(Object.prototype.hasOwnProperty.call(s,t)||t==="constructor")return s[t];const i=e();return s[t]=i,i}function _o(s,t,e){const{_proxy:i,_context:n,_subProxy:o,_descriptors:r}=s;let a=i[t];return st(a)&&r.isScriptable(t)&&(a=bo(t,a,s,e)),R(a)&&a.length&&(a=xo(t,a,s,r.isIndexable)),qe(t,a)&&(a=yt(a,n,o&&o[t],r)),a}function bo(s,t,e,i){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=e;if(a.has(s))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+s);a.add(s);let c=t(o,r||i);return a.delete(s),qe(s,c)&&(c=Ge(n._scopes,n,s,c)),c}function xo(s,t,e,i){const{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&i(s))return t[o.index%t.length];if(S(t[0])){const c=t,l=n._scopes.filter(h=>h!==c);t=[];for(const h of c){const f=Ge(l,n,s,h);t.push(yt(f,o,r&&r[s],a))}}return t}function Ti(s,t,e){return st(s)?s(t,e):s}const yo=(s,t)=>s===!0?t:typeof s=="string"?ue(t,s):void 0;function vo(s,t,e,i,n){for(const o of t){const r=yo(e,o);if(r){s.add(r);const a=Ti(r._fallback,e,n);if(typeof a<"u"&&a!==e&&a!==i)return a}else if(r===!1&&typeof i<"u"&&e!==i)return null}return!1}function Ge(s,t,e,i){const n=t._rootScopes,o=Ti(t._fallback,e,i),r=[...s,...n],a=new Set;a.add(i);let c=vs(a,r,e,o||e,i);return c===null||typeof o<"u"&&o!==e&&(c=vs(a,r,o,c,i),c===null)?!1:Xe(Array.from(a),[""],n,o,()=>ko(t,e,i))}function vs(s,t,e,i,n){for(;e;)e=vo(s,t,e,i,n);return e}function ko(s,t,e){const i=s._getTarget();t in i||(i[t]={});const n=i[t];return R(n)&&S(e)?e:n||{}}function wo(s,t,e,i){let n;for(const o of t)if(n=Ii(mo(o,s),e),typeof n<"u")return qe(s,n)?Ge(e,i,s,n):n}function Ii(s,t){for(const e of t){if(!e)continue;const i=e[s];if(typeof i<"u")return i}}function ks(s){let t=s._keys;return t||(t=s._keys=Mo(s._scopes)),t}function Mo(s){const t=new Set;for(const e of s)for(const i of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(i);return Array.from(t)}const So=Number.EPSILON||1e-14,vt=(s,t)=>ts==="x"?"y":"x";function Oo(s,t,e,i){const n=s.skip?t:s,o=t,r=e.skip?t:e,a=fs(o,n),c=fs(r,o);let l=a/(a+c),h=c/(a+c);l=isNaN(l)?0:l,h=isNaN(h)?0:h;const f=i*l,u=i*h;return{previous:{x:o.x-f*(r.x-n.x),y:o.y-f*(r.y-n.y)},next:{x:o.x+u*(r.x-n.x),y:o.y+u*(r.y-n.y)}}}function Do(s,t,e){const i=s.length;let n,o,r,a,c,l=vt(s,0);for(let h=0;h!l.skip)),t.cubicInterpolationMode==="monotone")To(s,n);else{let l=i?s[s.length-1]:s[0];for(o=0,r=s.length;os.ownerDocument.defaultView.getComputedStyle(s,null);function Lo(s,t){return be(s).getPropertyValue(t)}const Eo=["top","right","bottom","left"];function gt(s,t,e){const i={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Eo[n];i[o]=parseFloat(s[t+"-"+o+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const Fo=(s,t,e)=>(s>0||t>0)&&(!e||!e.shadowRoot);function Ao(s,t){const e=s.touches,i=e&&e.length?e[0]:s,{offsetX:n,offsetY:o}=i;let r=!1,a,c;if(Fo(n,o,s.target))a=n,c=o;else{const l=t.getBoundingClientRect();a=i.clientX-l.left,c=i.clientY-l.top,r=!0}return{x:a,y:c,box:r}}function ct(s,t){if("native"in s)return s;const{canvas:e,currentDevicePixelRatio:i}=t,n=be(e),o=n.boxSizing==="border-box",r=gt(n,"padding"),a=gt(n,"border","width"),{x:c,y:l,box:h}=Ao(s,e),f=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:d,height:m}=t;return o&&(d-=r.width+a.width,m-=r.height+a.height),{x:Math.round((c-f)/d*e.width/i),y:Math.round((l-u)/m*e.height/i)}}function zo(s,t,e){let i,n;if(t===void 0||e===void 0){const o=s&&Qe(s);if(!o)t=s.clientWidth,e=s.clientHeight;else{const r=o.getBoundingClientRect(),a=be(o),c=gt(a,"border","width"),l=gt(a,"padding");t=r.width-l.width-c.width,e=r.height-l.height-c.height,i=pe(a.maxWidth,o,"clientWidth"),n=pe(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:i||ge,maxHeight:n||ge}}const ee=s=>Math.round(s*10)/10;function Ro(s,t,e,i){const n=be(s),o=gt(n,"margin"),r=pe(n.maxWidth,s,"clientWidth")||ge,a=pe(n.maxHeight,s,"clientHeight")||ge,c=zo(s,t,e);let{width:l,height:h}=c;if(n.boxSizing==="content-box"){const u=gt(n,"border","width"),d=gt(n,"padding");l-=d.width+u.width,h-=d.height+u.height}return l=Math.max(0,l-o.width),h=Math.max(0,i?l/i:h-o.height),l=ee(Math.min(l,r,c.maxWidth)),h=ee(Math.min(h,a,c.maxHeight)),l&&!h&&(h=ee(l/2)),(t!==void 0||e!==void 0)&&i&&c.height&&h>c.height&&(h=c.height,l=ee(Math.floor(h*i))),{width:l,height:h}}function ws(s,t,e){const i=t||1,n=Math.floor(s.height*i),o=Math.floor(s.width*i);s.height=Math.floor(s.height),s.width=Math.floor(s.width);const r=s.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${s.height}px`,r.style.width=`${s.width}px`),s.currentDevicePixelRatio!==i||r.height!==n||r.width!==o?(s.currentDevicePixelRatio=i,r.height=n,r.width=o,s.ctx.setTransform(i,0,0,i,0,0),!0):!1}const No=function(){let s=!1;try{const t={get passive(){return s=!0,!1}};Ze()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return s}();function Ms(s,t){const e=Lo(s,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function lt(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:s.y+e*(t.y-s.y)}}function Bo(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:i==="middle"?e<.5?s.y:t.y:i==="after"?e<1?s.y:t.y:e>0?t.y:s.y}}function Vo(s,t,e,i){const n={x:s.cp2x,y:s.cp2y},o={x:t.cp1x,y:t.cp1y},r=lt(s,n,e),a=lt(n,o,e),c=lt(o,t,e),l=lt(r,a,e),h=lt(a,c,e);return lt(l,h,e)}function Li(s){return s==="angle"?{between:yi,compare:An,normalize:K}:{between:vi,compare:(t,e)=>t-e,normalize:t=>t}}function Ss({start:s,end:t,count:e,loop:i,style:n}){return{start:s%e,end:t%e,loop:i&&(t-s+1)%e===0,style:n}}function jo(s,t,e){const{property:i,start:n,end:o}=e,{between:r,normalize:a}=Li(i),c=t.length;let{start:l,end:h,loop:f}=s,u,d;if(f){for(l+=c,h+=c,u=0,d=c;uc(n,O,_)&&a(n,O)!==0,b=()=>a(o,_)===0||c(o,O,_),w=()=>g||D(),y=()=>!g||b();for(let v=h,M=h;v<=f;++v)x=t[v%r],!x.skip&&(_=l(x[i]),_!==O&&(g=c(_,n,o),p===null&&w()&&(p=a(_,n)===0?v:M),p!==null&&y()&&(m.push(Ss({start:p,end:v,loop:u,count:r,style:d})),p=null),M=v,O=_));return p!==null&&m.push(Ss({start:p,end:f,loop:u,count:r,style:d})),m}function Fi(s,t){const e=[],i=s.segments;for(let n=0;nn&&s[o%t].skip;)o--;return o%=t,{start:n,end:o}}function Wo(s,t,e,i){const n=s.length,o=[];let r=t,a=s[t],c;for(c=t+1;c<=e;++c){const l=s[c%n];l.skip||l.stop?a.skip||(i=!1,o.push({start:t%n,end:(c-1)%n,loop:i}),t=r=l.stop?c:null):(r=c,a.skip&&(t=c)),a=l}return r!==null&&o.push({start:t%n,end:r%n,loop:i}),o}function $o(s,t){const e=s.points,i=s.options.spanGaps,n=e.length;if(!n)return[];const o=!!s._loop,{start:r,end:a}=Ho(e,n,o,i);if(i===!0)return Os(s,[{start:r,end:a,loop:o}],e,t);const c=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=wi.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let r=o.length-1,a=!1,c;for(;r>=0;--r)c=o[r],c._active?(c._total>i.duration&&(i.duration=c._total),c.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var G=new Ko;const Ps="transparent",Xo={boolean(s,t,e){return e>.5?t:s},color(s,t,e){const i=ms(s||Ps),n=i.valid&&ms(t||Ps);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}};class qo{constructor(t,e,i,n){const o=e[i];n=Jt([t.to,n,o,t.from]);const r=Jt([t.from,o,n]);this._active=!0,this._fn=t.fn||Xo[t.type||typeof r],this._easing=zt[t.easing]||zt.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Jt([t.to,e,n,t.from]),this._from=Jt([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let c;if(this._active=o!==a&&(r||e1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[n]=this._fn(o,a,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let n=0;n{const o=t[n];if(!S(o))return;const r={};for(const a of e)r[a]=o[a];(R(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,e){const i=e.options,n=Qo(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&Zo(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let c;for(c=r.length-1;c>=0;--c){const l=r[c];if(l.charAt(0)==="$")continue;if(l==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[l];let f=o[l];const u=i.get(l);if(f)if(u&&f.active()){f.update(u,h,a);continue}else f.cancel();if(!u||!u.duration){t[l]=h;continue}o[l]=f=new qo(u,t,l,h),n.push(f)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return G.add(this._chart,i),!0}}function Zo(s,t){const e=[],i=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function Ls(s,t){const{chart:e,_cachedMeta:i}=s,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=i,c=o.axis,l=r.axis,h=sr(o,r,i),f=t.length;let u;for(let d=0;de[i].axis===t).shift()}function or(s,t){return wt(s,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function rr(s,t,e){return wt(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Dt(s,t){const e=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){t=t||s._parsed;for(const n of t){const o=n._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}const Oe=s=>s==="reset"||s==="none",Es=(s,t)=>t?s:Object.assign({},s),ar=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:Ai(e,!0),values:null};class Nt{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Me(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&&Dt(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(f,u,d,m)=>f==="x"?u:f==="r"?m:d,o=e.xAxisID=P(i.xAxisID,Se(t,"x")),r=e.yAxisID=P(i.yAxisID,Se(t,"y")),a=e.rAxisID=P(i.rAxisID,Se(t,"r")),c=e.indexAxis,l=e.iAxisID=n(c,o,r,a),h=e.vAxisID=n(c,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&us(this._data,this),t._stacked&&Dt(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(S(e)){const n=this._cachedMeta;this._data=er(e,n)}else if(i!==e){if(i){us(i,this);const n=this._cachedMeta;Dt(n),n._parsed=[]}e&&Object.isExtensible(e)&&Bn(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=Me(e.vScale,e),e.stack!==i.stack&&(n=!0,Dt(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Ls(this,e._parsed),e._stacked=Me(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:r}=i,a=o.axis;let c=t===0&&e===n.length?!0:i._sorted,l=t>0&&i._parsed[t-1],h,f,u;if(this._parsing===!1)i._parsed=n,i._sorted=!0,u=n;else{R(n[t])?u=this.parseArrayData(i,n,t,e):S(n[t])?u=this.parseObjectData(i,n,t,e):u=this.parsePrimitiveData(i,n,t,e);const d=()=>f[a]===null||l&&f[a]g||f=0;--u)if(!m()){this.updateRangeFromParsed(l,t,d,c);break}}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,r;for(n=0,o=e.length;n=0&&tthis.getContext(i,n,e),g=l.resolveNamedOptions(u,d,m,f);return g.$shared&&(g.$shared=c,o[r]=Object.freeze(Es(g,c))),g}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let c;if(n.options.animation!==!1){const h=this.chart.config,f=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),f);c=h.createResolver(u,this.getContext(t,i,e))}const l=new Go(n,c&&c.animations);return c&&c._cacheable&&(o[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Oe(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:r}}updateElement(t,e,i,n){Oe(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Oe(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,c,l]of this._syncList)this[a](c,l);this._syncList=[];const n=i.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o{for(l.length+=e,a=l.length-1;a>=r;a--)l[a]=l[a-e]};for(c(o),a=t;a0&&this.getParsed(e-1);for(let b=0;b=x){y.skip=!0;continue}const v=this.getParsed(b),M=T(v[d]),I=y[u]=r.getPixelForValue(v[u],b),C=y[d]=o||M?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,v,c):v[d],b);y.skip=isNaN(I)||isNaN(C)||M,y.stop=b>0&&Math.abs(v[u]-D[u])>p,g&&(y.parsed=v,y.raw=l.data[b]),f&&(y.options=h||this.resolveDataElementOptions(b,w.active?"active":n)),_||this.updateElement(w,b,y,n),D=v}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}k(De,"id","line"),k(De,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),k(De,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function at(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Je{constructor(t){k(this,"options");this.options=t||{}}static override(t){Object.assign(Je.prototype,t)}init(){}formats(){return at()}parse(){return at()}format(){return at()}add(){return at()}diff(){return at()}startOf(){return at()}endOf(){return at()}}var cr={_date:Je};function lr(s,t,e,i){const{controller:n,data:o,_sorted:r}=s,a=n._cachedMeta.iScale,c=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?Rn:ut;if(i){if(n._sharedOptions){const h=o[0],f=typeof h.getRange=="function"&&h.getRange(t);if(f){const u=l(o,t,e-f),d=l(o,t,e+f);return{lo:u.lo,hi:d.hi}}}}else{const h=l(o,t,e);if(c){const{vScale:f}=n._cachedMeta,{_parsed:u}=s,d=u.slice(0,h.lo+1).reverse().findIndex(g=>!T(g[f.axis]));h.lo-=Math.max(0,d);const m=u.slice(h.hi).findIndex(g=>!T(g[f.axis]));h.hi+=Math.max(0,m)}return h}}return{lo:0,hi:o.length-1}}function xe(s,t,e,i,n){const o=s.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,c=o.length;a{c[r]&&c[r](t[e],n)&&(o.push({element:c,datasetIndex:l,index:h}),a=a||c.inRange(t.x,t.y,n))}),i&&!a?[]:o}var dr={modes:{index(s,t,e,i){const n=ct(t,s),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?Pe(s,n,o,i,r):Te(s,n,o,!1,i,r),c=[];return a.length?(s.getSortedVisibleDatasetMetas().forEach(l=>{const h=a[0].index,f=l.data[h];f&&!f.skip&&c.push({element:f,datasetIndex:l.index,index:h})}),c):[]},dataset(s,t,e,i){const n=ct(t,s),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?Pe(s,n,o,i,r):Te(s,n,o,!1,i,r);if(a.length>0){const c=a[0].datasetIndex,l=s.getDatasetMeta(c).data;a=[];for(let h=0;he.pos===t)}function As(s,t){return s.filter(e=>zi.indexOf(e.pos)===-1&&e.box.axis===t)}function Tt(s,t){return s.sort((e,i)=>{const n=t?i:e,o=t?e:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function gr(s){const t=[];let e,i,n,o,r,a;for(e=0,i=(s||[]).length;el.box.fullSize),!0),i=Tt(Pt(t,"left"),!0),n=Tt(Pt(t,"right")),o=Tt(Pt(t,"top"),!0),r=Tt(Pt(t,"bottom")),a=As(t,"x"),c=As(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:n.concat(c).concat(r).concat(a),chartArea:Pt(t,"chartArea"),vertical:i.concat(n).concat(c),horizontal:o.concat(r).concat(a)}}function zs(s,t,e,i){return Math.max(s[e],t[e])+Math.max(s[i],t[i])}function Ri(s,t){s.top=Math.max(s.top,t.top),s.left=Math.max(s.left,t.left),s.bottom=Math.max(s.bottom,t.bottom),s.right=Math.max(s.right,t.right)}function br(s,t,e,i){const{pos:n,box:o}=e,r=s.maxPadding;if(!S(n)){e.size&&(s[n]-=e.size);const f=i[e.stack]||{size:0,count:1};f.size=Math.max(f.size,e.horizontal?o.height:o.width),e.size=f.size/f.count,s[n]+=e.size}o.getPadding&&Ri(r,o.getPadding());const a=Math.max(0,t.outerWidth-zs(r,s,"left","right")),c=Math.max(0,t.outerHeight-zs(r,s,"top","bottom")),l=a!==s.w,h=c!==s.h;return s.w=a,s.h=c,e.horizontal?{same:l,other:h}:{same:h,other:l}}function xr(s){const t=s.maxPadding;function e(i){const n=Math.max(t[i]-s[i],0);return s[i]+=n,n}s.y+=e("top"),s.x+=e("left"),e("right"),e("bottom")}function yr(s,t){const e=t.maxPadding;function i(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return i(s?["left","right"]:["top","bottom"])}function Et(s,t,e,i){const n=[];let o,r,a,c,l,h;for(o=0,r=s.length,l=0;o{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=c.reduce((g,p)=>p.box.options&&p.box.options.display===!1?g:g+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},n);Ri(u,Wt(i));const d=Object.assign({maxPadding:u,w:o,h:r,x:n.left,y:n.top},n),m=mr(c.concat(l),f);Et(a.fullSize,d,f,m),Et(c,d,f,m),Et(l,d,f,m)&&Et(c,d,f,m),xr(d),Rs(a.leftAndTop,d,f,m),d.x+=d.w,d.y+=d.h,Rs(a.rightAndBottom,d,f,m),s.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},N(a.chartArea,g=>{const p=g.box;Object.assign(p,s.chartArea),p.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};class Ni{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class vr extends Ni{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const le="$chartjs",kr={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ns=s=>s===null||s==="";function wr(s,t){const e=s.style,i=s.getAttribute("height"),n=s.getAttribute("width");if(s[le]={initial:{height:i,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ns(n)){const o=Ms(s,"width");o!==void 0&&(s.width=o)}if(Ns(i))if(s.style.height==="")s.height=s.width/(t||2);else{const o=Ms(s,"height");o!==void 0&&(s.height=o)}return s}const Bi=No?{passive:!0}:!1;function Mr(s,t,e){s&&s.addEventListener(t,e,Bi)}function Sr(s,t,e){s&&s.canvas&&s.canvas.removeEventListener(t,e,Bi)}function Or(s,t){const e=kr[s.type]||s.type,{x:i,y:n}=ct(s,t);return{type:e,chart:t,native:s,x:i!==void 0?i:null,y:n!==void 0?n:null}}function me(s,t){for(const e of s)if(e===t||e.contains(t))return!0}function Dr(s,t,e){const i=s.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||me(a.addedNodes,i),r=r&&!me(a.removedNodes,i);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function Pr(s,t,e){const i=s.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||me(a.removedNodes,i),r=r&&!me(a.addedNodes,i);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const $t=new Map;let Bs=0;function Vi(){const s=window.devicePixelRatio;s!==Bs&&(Bs=s,$t.forEach((t,e)=>{e.currentDevicePixelRatio!==s&&t()}))}function Tr(s,t){$t.size||window.addEventListener("resize",Vi),$t.set(s,t)}function Ir(s){$t.delete(s),$t.size||window.removeEventListener("resize",Vi)}function Cr(s,t,e){const i=s.canvas,n=i&&Qe(i);if(!n)return;const o=Mi((a,c)=>{const l=n.clientWidth;e(a,c),l{const c=a[0],l=c.contentRect.width,h=c.contentRect.height;l===0&&h===0||o(l,h)});return r.observe(n),Tr(s,o),r}function Ie(s,t,e){e&&e.disconnect(),t==="resize"&&Ir(s)}function Lr(s,t,e){const i=s.canvas,n=Mi(o=>{s.ctx!==null&&e(Or(o,s))},s);return Mr(i,t,n),n}class Er extends Ni{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(wr(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[le])return!1;const i=e[le].initial;["height","width"].forEach(o=>{const r=i[o];T(r)?e.removeAttribute(o):e.setAttribute(o,r)});const n=i.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[le],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:Dr,detach:Pr,resize:Cr}[e]||Lr;n[e]=r(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:Ie,detach:Ie,resize:Ie}[e]||Sr)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return Ro(t,e,i,n)}isAttached(t){const e=t&&Qe(t);return!!(e&&e.isConnected)}}function Fr(s){return!Ze()||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?vr:Er}class kt{constructor(){k(this,"x");k(this,"y");k(this,"active",!1);k(this,"options");k(this,"$animations")}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return jt(this.x)&&jt(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}}k(kt,"defaults",{}),k(kt,"defaultRoutes");function Ar(s,t){const e=s.options.ticks,i=zr(s),n=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Nr(t):[],r=o.length,a=o[0],c=o[r-1],l=[];if(r>n)return Br(t,l,o,r/n),l;const h=Rr(o,t,n);if(r>0){let f,u;const d=r>1?Math.round((c-a)/(r-1)):null;for(ne(t,l,h,T(d)?0:a-d,a),f=0,u=r-1;fn)return c}return Math.max(n,1)}function Nr(s){const t=[];let e,i;for(e=0,i=s.length;es==="left"?"right":s==="right"?"left":s,Vs=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e,js=(s,t)=>Math.min(t||s,s);function Hs(s,t){const e=[],i=s.length/t,n=s.length;let o=0;for(;or+a)))return c}function Wr(s,t){N(s,e=>{const i=e.gc,n=i.length/2;let o;if(n>t){for(o=0;oi?i:e,i=n&&e>i?e:i,{min:U(e,U(i,e)),max:U(i,U(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){E(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=po(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),f=h.widest.width,u=h.highest.height,d=X(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/i:d/(i-1),f+6>a&&(a=d/(i-(t.offset?.5:1)),c=this.maxHeight-It(t.grid)-e.padding-Ws(t.title,this.chart.options.font),l=Math.sqrt(f*f+u*u),r=En(Math.min(Math.asin(X((h.highest.height+6)/a,-1,1)),Math.asin(X(c/l,-1,1))-Math.asin(X(u/l,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){E(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){E(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const c=Ws(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=It(o)+c):(t.height=this.maxHeight,t.width=It(o)+c),i.display&&this.ticks.length){const{first:l,last:h,widest:f,highest:u}=this._getLabelSizes(),d=i.padding*2,m=ft(this.labelRotation),g=Math.cos(m),p=Math.sin(m);if(a){const _=i.mirror?0:p*f.width+g*u.height;t.height=Math.min(this.maxHeight,t.height+_+d)}else{const _=i.mirror?0:g*f.width+p*u.height;t.width=Math.min(this.maxWidth,t.width+_+d)}this._calculatePadding(l,h,p,g)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:r},position:a}=this.options,c=this.labelRotation!==0,l=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,d=0;c?l?(u=n*t.width,d=i*e.height):(u=i*t.height,d=n*e.width):o==="start"?d=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,d=e.width/2),this.paddingLeft=Math.max((u-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((d-f+r)*this.width/(this.width-f),0)}else{let h=e.height/2,f=t.height/2;o==="start"?(h=0,f=t.height):o==="end"&&(h=e.height,f=0),this.paddingTop=h+r,this.paddingBottom=f+r}}_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(){E(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:r[M]||0,height:a[M]||0});return{first:v(0),last:v(e-1),widest:v(w),highest:v(y),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return zn(this._alignToPixels?rt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*n?a/i:c/n:c*n0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:r,border:a}=n,c=o.offset,l=this.isHorizontal(),f=this.ticks.length+(c?1:0),u=It(o),d=[],m=a.setContext(this.getContext()),g=m.display?m.width:0,p=g/2,_=function(z){return rt(i,z,g)};let x,O,D,b,w,y,v,M,I,C,A,$;if(r==="top")x=_(this.bottom),y=this.bottom-u,M=x-p,C=_(t.top)+p,$=t.bottom;else if(r==="bottom")x=_(this.top),C=t.top,$=_(t.bottom)-p,y=x+p,M=this.top+u;else if(r==="left")x=_(this.right),w=this.right-u,v=x-p,I=_(t.left)+p,A=t.right;else if(r==="right")x=_(this.left),I=t.left,A=_(t.right)-p,w=x+p,v=this.left+u;else if(e==="x"){if(r==="center")x=_((t.top+t.bottom)/2+.5);else if(S(r)){const z=Object.keys(r)[0],H=r[z];x=_(this.chart.scales[z].getPixelForValue(H))}C=t.top,$=t.bottom,y=x+p,M=y+u}else if(e==="y"){if(r==="center")x=_((t.left+t.right)/2);else if(S(r)){const z=Object.keys(r)[0],H=r[z];x=_(this.chart.scales[z].getPixelForValue(H))}w=x-p,v=w-u,I=t.left,A=t.right}const Q=P(n.ticks.maxTicksLimit,f),L=Math.max(1,Math.ceil(f/Q));for(O=0;O0&&(nt-=it/2);break}Xt={left:nt,top:Ot,width:it+_t.width,height:St+_t.height,color:L.backdropColor}}p.push({label:D,font:M,textOffset:A,options:{rotation:g,color:H,strokeColor:Yt,strokeWidth:Kt,textAlign:mt,textBaseline:$,translation:[b,w],backdrop:Xt}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-ft(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,c=r.widest.width;let l,h;return e==="left"?n?(h=this.right+o,i==="near"?l="left":i==="center"?(l="center",h+=c/2):(l="right",h+=c)):(h=this.right-a,i==="near"?l="right":i==="center"?(l="center",h-=c/2):(l="left",h=this.left)):e==="right"?n?(h=this.left+o,i==="near"?l="right":i==="center"?(l="center",h-=c/2):(l="left",h-=c)):(h=this.left+a,i==="near"?l="left":i==="center"?(l="center",h+=c/2):(l="right",h=this.right)):l="right",{textAlign:l,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(c,l,h)=>{!h.width||!h.color||(i.save(),i.lineWidth=h.width,i.strokeStyle=h.color,i.setLineDash(h.borderDash||[]),i.lineDashOffset=h.borderDashOffset,i.beginPath(),i.moveTo(c.x,c.y),i.lineTo(l.x,l.y),i.stroke(),i.restore())};if(e.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,r;for(o=0,r=e.length;o{const i=e.split("."),n=i.pop(),o=[s].concat(i).join("."),r=t[e].split("."),a=r.pop(),c=r.join(".");F.route(o,n,c,a)})}function Gr(s){return"id"in s&&"defaults"in s}class Zr{constructor(){this.controllers=new oe(Nt,"datasets",!0),this.elements=new oe(kt,"elements"),this.plugins=new oe(Object,"plugins"),this.scales=new oe(Mt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(n=>{const o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):N(n,r=>{const a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,i){const n=We(t);E(i["before"+n],[],i),e[t](i),E(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(c=>a.plugin.id===c.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function Jr(s){const t={},e=[],i=Object.keys(Y.plugins.items);for(let o=0;o1&&$s(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function Us(s,t,e){if(e[t+"AxisID"]===s)return{axis:t}}function ra(s,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(e.length)return Us(s,"x",e[0])||Us(s,"y",e[0])}return{}}function aa(s,t){const e=pt[s.type]||{scales:{}},i=t.scales||{},n=ze(s.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{const a=i[r];if(!S(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const c=Re(r,a,ra(r,s),F.scales[a.type]),l=na(c,n),h=e.scales||{};o[r]=Ft(Object.create(null),[{axis:c},a,h[c],h[l]])}),s.data.datasets.forEach(r=>{const a=r.type||s.type,c=r.indexAxis||ze(a,t),h=(pt[a]||{}).scales||{};Object.keys(h).forEach(f=>{const u=ia(f,c),d=r[u+"AxisID"]||u;o[d]=o[d]||Object.create(null),Ft(o[d],[{axis:u},i[d],h[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];Ft(a,[F.scales[a.type],F.scale])}),o}function ji(s){const t=s.options||(s.options={});t.plugins=P(t.plugins,{}),t.scales=aa(s,t)}function Hi(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function ca(s){return s=s||{},s.data=Hi(s.data),ji(s),s}const Ys=new Map,Wi=new Set;function re(s,t){let e=Ys.get(s);return e||(e=t(),Ys.set(s,e),Wi.add(e)),e}const Ct=(s,t,e)=>{const i=ue(t,e);i!==void 0&&s.add(i)};class la{constructor(t){this._config=ca(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=Hi(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),ji(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return re(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return re(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return re(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return re(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return(!n||e)&&(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,r=this._cachedScopes(t,i),a=r.get(e);if(a)return a;const c=new Set;e.forEach(h=>{t&&(c.add(t),h.forEach(f=>Ct(c,t,f))),h.forEach(f=>Ct(c,n,f)),h.forEach(f=>Ct(c,pt[o]||{},f)),h.forEach(f=>Ct(c,F,f)),h.forEach(f=>Ct(c,Fe,f))});const l=Array.from(c);return l.length===0&&l.push(Object.create(null)),Wi.has(e)&&r.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,pt[e]||{},F.datasets[e]||{},{type:e},F,Fe]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Ks(this._resolverCache,t,n);let c=r;if(fa(r,e)){o.$shared=!1,i=st(i)?i():i;const l=this.createResolver(t,i,a);c=yt(r,i,l)}for(const l of e)o[l]=c[l];return o}createResolver(t,e,i=[""],n){const{resolver:o}=Ks(this._resolverCache,t,i);return S(e)?yt(o,e,void 0,n):o}}function Ks(s,t,e){let i=s.get(t);i||(i=new Map,s.set(t,i));const n=e.join();let o=i.get(n);return o||(o={resolver:Xe(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(n,o)),o}const ha=s=>S(s)&&Object.getOwnPropertyNames(s).some(t=>st(s[t]));function fa(s,t){const{isScriptable:e,isIndexable:i}=Di(s);for(const n of t){const o=e(n),r=i(n),a=(r||o)&&s[n];if(o&&(st(a)||ha(a))||r&&R(a))return!0}return!1}var ua="4.4.8";const da=["top","bottom","left","right","chartArea"];function Xs(s,t){return s==="top"||s==="bottom"||da.indexOf(s)===-1&&t==="x"}function qs(s,t){return function(e,i){return e[s]===i[s]?e[t]-i[t]:e[s]-i[s]}}function Gs(s){const t=s.chart,e=t.options.animation;t.notifyPlugins("afterRender"),E(e&&e.onComplete,[s],t)}function ga(s){const t=s.chart,e=t.options.animation;E(e&&e.onProgress,[s],t)}function $i(s){return Ze()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}const he={},Zs=s=>{const t=$i(s);return Object.values(he).filter(e=>e.canvas===t).pop()};function pa(s,t,e){const i=Object.keys(s);for(const n of i){const o=+n;if(o>=t){const r=s[n];delete s[n],(e>0||o>t)&&(s[o+e]=r)}}}function ma(s,t,e,i){return!e||s.type==="mouseout"?null:i?t:s}function ae(s,t,e){return s.options.clip?s[e]:t[e]}function _a(s,t){const{xScale:e,yScale:i}=s;return e&&i?{left:ae(e,t,"left"),right:ae(e,t,"right"),top:ae(i,t,"top"),bottom:ae(i,t,"bottom")}:t}class ht{static register(...t){Y.add(...t),Qs()}static unregister(...t){Y.remove(...t),Qs()}constructor(t,e){const i=this.config=new la(e),n=$i(t),o=Zs(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Fr(n)),this.platform.updateConfig(i);const a=this.platform.acquireContext(n,r.aspectRatio),c=a&&a.canvas,l=c&&c.height,h=c&&c.width;if(this.id=yn(),this.ctx=a,this.canvas=c,this.width=h,this.height=l,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Qr,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=jn(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],he[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}G.listen(this,"complete",Gs),G.listen(this,"progress",ga),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return T(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Y}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ws(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return xs(this.canvas,this.ctx),this}stop(){return G.stop(this),this}resize(t,e){G.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,ws(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),E(i.onResize,[this,r],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};N(e,(i,n)=>{i.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],c=Re(r,a),l=c==="r",h=c==="x";return{options:a,dposition:l?"chartArea":h?"bottom":"left",dtype:l?"radialLinear":h?"category":"linear"}}))),N(o,r=>{const a=r.options,c=a.id,l=Re(c,a),h=P(a.type,r.dtype);(a.position===void 0||Xs(a.position,l)!==Xs(r.dposition))&&(a.position=r.dposition),n[c]=!0;let f=null;if(c in i&&i[c].type===h)f=i[c];else{const u=Y.getScale(h);f=new u({id:c,type:h,ctx:this.ctx,chart:this}),i[f.id]=f}f.init(a,t)}),N(n,(r,a)=>{r||delete i[a]}),N(i,r=>{ie.configure(this,r,r.options),ie.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((n,o)=>n.index-o.index),i>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((i,n)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let l=0,h=this.data.datasets.length;l{l.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(qs("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){N(this.scales,t=>{ie.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!as(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){const r=i==="_removeElements"?-o:o;pa(t,n,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ie.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],N(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=_a(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&Ye(e,{left:i.left===!1?0:o.left-i.left,right:i.right===!1?this.width:o.right+i.right,top:i.top===!1?0:o.top-i.top,bottom:i.bottom===!1?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&Ke(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Ht(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const o=dr.modes[e];return typeof o=="function"?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter(o=>o&&o._dataset===e).pop();return n||(n={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(n)),n}getContext(){return this.$context||(this.$context=wt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){const i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);de(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),G.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};N(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(c,l)=>{e.addEventListener(this,c,l),t[c]=l},n=(c,l)=>{t[c]&&(e.removeEventListener(this,c,l),delete t[c])},o=(c,l)=>{this.canvas&&this.resize(c,l)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){N(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},N(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,r,a,c;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,c=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!os(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(c,l)=>c.filter(h=>!l.some(f=>h.datasetIndex===f.datasetIndex&&h.index===f.index)),r=o(e,t),a=i?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,i,r),c=On(t),l=ma(t,this._lastEvent,i,c);i&&(this._lastEvent=null,E(o.onHover,[t,a,this],this),c&&E(o.onClick,[t,a,this],this));const h=!os(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,n){if(t.type==="mouseout")return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}k(ht,"defaults",F),k(ht,"instances",he),k(ht,"overrides",pt),k(ht,"registry",Y),k(ht,"version",ua),k(ht,"getChart",Zs);function Qs(){return N(ht.instances,s=>s._plugins.invalidate())}function Ui(s,t,e=t){s.lineCap=P(e.borderCapStyle,t.borderCapStyle),s.setLineDash(P(e.borderDash,t.borderDash)),s.lineDashOffset=P(e.borderDashOffset,t.borderDashOffset),s.lineJoin=P(e.borderJoinStyle,t.borderJoinStyle),s.lineWidth=P(e.borderWidth,t.borderWidth),s.strokeStyle=P(e.borderColor,t.borderColor)}function ba(s,t,e){s.lineTo(e.x,e.y)}function xa(s){return s.stepped?io:s.tension||s.cubicInterpolationMode==="monotone"?no:ba}function Yi(s,t,e={}){const i=s.length,{start:n=0,end:o=i-1}=e,{start:r,end:a}=t,c=Math.max(n,r),l=Math.min(o,a),h=na&&o>a;return{count:i,start:c,loop:t.loop,ilen:l(r+(l?a-D:D))%o,O=()=>{g!==p&&(s.lineTo(h,p),s.lineTo(h,g),s.lineTo(h,_))};for(c&&(d=n[x(0)],s.moveTo(d.x,d.y)),u=0;u<=a;++u){if(d=n[x(u)],d.skip)continue;const D=d.x,b=d.y,w=D|0;w===m?(bp&&(p=b),h=(f*h+D)/++f):(O(),s.lineTo(D,b),m=w,f=0,g=p=b),_=b}O()}function Ne(s){const t=s.options,e=t.borderDash&&t.borderDash.length;return!s._decimated&&!s._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?va:ya}function ka(s){return s.stepped?Bo:s.tension||s.cubicInterpolationMode==="monotone"?Vo:lt}function wa(s,t,e,i){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,i)&&n.closePath()),Ui(s,t.options),s.stroke(n)}function Ma(s,t,e,i){const{segments:n,options:o}=t,r=Ne(t);for(const a of n)Ui(s,o,a.style),s.beginPath(),r(s,t,a,{start:e,end:e+i-1})&&s.closePath(),s.stroke()}const Sa=typeof Path2D=="function";function Oa(s,t,e,i){Sa&&!t.options.segment?wa(s,t,e,i):Ma(s,t,e,i)}class dt extends kt{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;Co(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=$o(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,r=Fi(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],c=ka(i);let l,h;for(l=0,h=r.length;lt!=="borderDash"&&t!=="fill"});function Js(s,t,e,i){const n=s.options,{[e]:o}=s.getProps([e],i);return Math.abs(t-o){a=ts(r,a,n);const c=n[r],l=n[a];i!==null?(o.push({x:c.x,y:i}),o.push({x:l.x,y:i})):e!==null&&(o.push({x:e,y:c.y}),o.push({x:e,y:l.y}))}),o}function ts(s,t,e){for(;t>s;t--){const i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function ti(s,t,e,i){return s&&t?i(s[e],t[e]):s?s[e]:t?t[e]:0}function Ki(s,t){let e=[],i=!1;return R(s)?(i=!0,e=s):e=Pa(s,t),e.length?new dt({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function ei(s){return s&&s.fill!==!1}function Ta(s,t,e){let n=s[t].fill;const o=[t];let r;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!B(n))return n;if(r=s[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function Ia(s,t,e){const i=Fa(s);if(S(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return B(n)&&Math.floor(n)===n?Ca(i[0],t,n,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Ca(s,t,e,i){return(s==="-"||s==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function La(s,t){let e=null;return s==="start"?e=t.bottom:s==="end"?e=t.top:S(s)?e=t.getPixelForValue(s.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Ea(s,t,e){let i;return s==="start"?i=e:s==="end"?i=t.options.reverse?t.min:t.max:S(s)?i=s.value:i=t.getBaseValue(),i}function Fa(s){const t=s.options,e=t.fill;let i=P(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function Aa(s){const{scale:t,index:e,line:i}=s,n=[],o=i.segments,r=i.points,a=za(t,e);a.push(Ki({x:null,y:t.bottom},i));for(let c=0;c=0;--r){const a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&Le(s.ctx,a,o))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){const o=i[n].$filler;ei(o)&&Le(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,t,e){const i=t.meta.$filler;!ei(i)||e.drawTime!=="beforeDatasetDraw"||Le(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Ya=(s,t,e,i)=>(typeof t=="string"?(e=s.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Ka(s,t,e,i){const n=s.indexOf(t);if(n===-1)return Ya(s,t,e,i);const o=s.lastIndexOf(t);return n!==o?e:n}const Xa=(s,t)=>s===null?null:X(Math.round(s),0,t);function oi(s){const t=this.getLabels();return s>=0&&se.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}k(ri,"id","category"),k(ri,"defaults",{ticks:{callback:oi}});function qa(s,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:c,count:l,maxTicks:h,maxDigits:f,includeBounds:u}=s,d=o||1,m=h-1,{min:g,max:p}=t,_=!T(r),x=!T(a),O=!T(l),D=(p-g)/(f+1);let b=ls((p-g)/m/d)*d,w,y,v,M;if(b<1e-14&&!_&&!x)return[{value:g},{value:p}];M=Math.ceil(p/b)-Math.floor(g/b),M>m&&(b=ls(M*b/m/d)*d),T(c)||(w=Math.pow(10,c),b=Math.ceil(b*w)/w),n==="ticks"?(y=Math.floor(g/b)*b,v=Math.ceil(p/b)*b):(y=g,v=p),_&&x&&o&&Cn((a-r)/o,b/1e3)?(M=Math.round(Math.min((a-r)/b,h)),b=(a-r)/M,y=r,v=a):O?(y=_?r:y,v=x?a:v,M=l-1,b=(v-y)/M):(M=(v-y)/b,At(M,Math.round(M),b/1e3)?M=Math.round(M):M=Math.ceil(M));const I=Math.max(hs(b),hs(y));w=Math.pow(10,T(c)?I:c),y=Math.round(y*w)/w,v=Math.round(v*w)/w;let C=0;for(_&&(u&&y!==r?(e.push({value:r}),ya)break;e.push({value:A})}return x&&u&&v!==a?e.length&&At(e[e.length-1].value,a,ai(a,D,s))?e[e.length-1].value=a:e.push({value:a}):(!x||v===a)&&e.push({value:v}),e}function ai(s,t,{horizontal:e,minRotation:i}){const n=ft(i),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+s).length;return Math.min(t/o,r)}class Ga extends Mt{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 T(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const r=c=>n=e?n:c,a=c=>o=i?o:c;if(t){const c=xt(n),l=xt(o);c<0&&l<0?a(0):c>0&&l>0&&r(0)}if(n===o){let c=o===0?1:Math.abs(o*.05);a(o+c),t||r(n-c)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:i}=t,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=qa(n,o);return t.bounds==="ticks"&&Ln(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Si(t,this.chart.options.locale,this.options.ticks.format)}}class ci extends Ga{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=B(t)?t:0,this.max=B(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=ft(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}k(ci,"id","linear"),k(ci,"defaults",{ticks:{callback:Oi.formatters.numeric}});const ye={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}},V=Object.keys(ye);function li(s,t){return s-t}function hi(s,t){if(T(t))return null;const e=s._adapter,{parser:i,round:n,isoWeekday:o}=s._parseOpts;let r=t;return typeof i=="function"&&(r=i(r)),B(r)||(r=typeof i=="string"?e.parse(r,i):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(jt(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function fi(s,t,e,i){const n=V.length;for(let o=V.indexOf(s);o=V.indexOf(e);o--){const r=V[o];if(ye[r].common&&s._adapter.diff(n,i,r)>=t-1)return r}return V[e?V.indexOf(e):0]}function Qa(s){for(let t=V.indexOf(s)+1,e=V.length;t=t?e[i]:e[n];s[o]=!0}}function Ja(s,t,e,i){const n=s._adapter,o=+n.startOf(t[0].value,i),r=t[t.length-1].value;let a,c;for(a=o;a<=r;a=+n.add(a,1,i))c=e[a],c>=0&&(t[c].major=!0);return t}function di(s,t,e){const i=[],n={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,i=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=X(e,0,r),i=X(i,0,r),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,r=o.unit||fi(o.minUnit,e,i,this._getLabelCapacity(e)),a=P(n.ticks.stepSize,1),c=r==="week"?o.isoWeekday:!1,l=jt(c)||c===!0,h={};let f=e,u,d;if(l&&(f=+t.startOf(f,"isoWeek",c)),f=+t.startOf(f,l?"day":r),t.diff(i,e,r)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+r);const m=n.ticks.source==="data"&&this.getDataTimestamps();for(u=f,d=0;u+g)}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,i,n){const o=this.options,r=o.ticks.callback;if(r)return E(r,[t,e,i],this);const a=o.time.displayFormats,c=this._unit,l=this._majorUnit,h=c&&a[c],f=l&&a[l],u=i[e],d=l&&f&&u&&u.major;return this._adapter.format(t,n||(d?f:h))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,i=n.length;e=s[i].pos&&t<=s[n].pos&&({lo:i,hi:n}=ut(s,"pos",t)),{pos:o,time:a}=s[i],{pos:r,time:c}=s[n]):(t>=s[i].time&&t<=s[n].time&&({lo:i,hi:n}=ut(s,"time",t)),{time:o,pos:a}=s[i],{time:r,pos:c}=s[n]);const l=r-o;return l?a+(c-a)*(t-o)/l:a}class gi extends _e{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=ce(e,this.min),this._tableRange=ce(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let r,a,c,l,h;for(r=0,a=t.length;r=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(ce(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return ce(this._table,i*this._tableRange+this._minPos,!0)}}k(gi,"id","timeseries"),k(gi,"defaults",_e.defaults);export{ht as C,De as L,Ce as P,dt as a,ci as b,ri as c,ec as i};