1import{n as oo}from"./stimulus-helpers-CGP3z6VC-2.js";import{N as ao,j as ro}from"./helpers-CNc8ab6c-2.js";import lo from"./ez-base-controller-BogAYNRD-2.js";function ce(t){return t+.5|0}var gt=(t,e,i)=>Math.max(Math.min(t,i),e);function qt(t){return gt(ce(t*2.55),0,255)}function bt(t){return gt(ce(t*255),0,255)}function ct(t){return gt(ce(t/2.55)/100,0,1)}function Ei(t){return gt(ce(t*100),0,100)}var Q={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},ni=[..."0123456789ABCDEF"],co=t=>ni[t&15],ho=t=>ni[(t&240)>>4]+ni[t&15],ge=t=>(t&240)>>4===(t&15),uo=t=>ge(t.r)&&ge(t.g)&&ge(t.b)&&ge(t.a);function fo(t){var e=t.length,i;return t[0]==="#"&&(e===4||e===5?i={r:255&Q[t[1]]*17,g:255&Q[t[2]]*17,b:255&Q[t[3]]*17,a:e===5?Q[t[4]]*17:255}:(e===7||e===9)&&(i={r:Q[t[1]]<<4|Q[t[2]],g:Q[t[3]]<<4|Q[t[4]],b:Q[t[5]]<<4|Q[t[6]],a:e===9?Q[t[7]]<<4|Q[t[8]]:255})),i}var go=(t,e)=>t<255?e(t):"";function po(t){var e=uo(t)?co:ho;return t?"#"+e(t.r)+e(t.g)+e(t.b)+go(t.a,e):void 0}var mo=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function nn(t,e,i){const s=e*Math.min(i,1-i),n=(o,a=(o+t/30)%12)=>i-s*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function bo(t,e,i){const s=(n,o=(n+t/60)%6)=>i-i*e*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function xo(t,e,i){const s=nn(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function _o(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}function mi(t){const i=t.r/255,s=t.g/255,n=t.b/255,o=Math.max(i,s,n),a=Math.min(i,s,n),r=(o+a)/2;let l,c,h;return o!==a&&(h=o-a,c=r>.5?h/(2-o-a):h/(o+a),l=_o(i,s,n,h,o),l=l*60+.5),[l|0,c||0,r]}function bi(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(bt)}function xi(t,e,i){return bi(nn,t,e,i)}function yo(t,e,i){return bi(xo,t,e,i)}function vo(t,e,i){return bi(bo,t,e,i)}function on(t){return(t%360+360)%360}function Mo(t){const e=mo.exec(t);let i=255,s;if(!e)return;e[5]!==s&&(i=e[6]?qt(+e[5]):bt(+e[5]));const n=on(+e[2]),o=+e[3]/100,a=+e[4]/100;return e[1]==="hwb"?s=yo(n,o,a):e[1]==="hsv"?s=vo(n,o,a):s=xi(n,o,a),{r:s[0],g:s[1],b:s[2],a:i}}function ko(t,e){var i=mi(t);i[0]=on(i[0]+e),i=xi(i),t.r=i[0],t.g=i[1],t.b=i[2]}function wo(t){if(!t)return;const e=mi(t),i=e[0],s=Ei(e[1]),n=Ei(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${ct(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}var Ii={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"},Fi={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 So(){const t={},e=Object.keys(Fi),i=Object.keys(Ii);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,Ii[o]);o=parseInt(Fi[a],16),t[r]=[o>>16&255,o>>8&255,o&255]}return t}var pe;function Po(t){pe||(pe=So(),pe.transparent=[0,0,0,0]);const e=pe[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}var Co=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Do(t){const e=Co.exec(t);let i=255,s,n,o;if(e){if(e[7]!==s){const a=+e[7];i=e[8]?qt(a):gt(a*255,0,255)}return s=+e[1],n=+e[3],o=+e[5],s=255&(e[2]?qt(s):gt(s,0,255)),n=255&(e[4]?qt(n):gt(n,0,255)),o=255&(e[6]?qt(o):gt(o,0,255)),{r:s,g:n,b:o,a:i}}}function Ao(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${ct(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}var Ye=t=>t<=.0031308?t*12.92:Math.pow(t,1/2.4)*1.055-.055,It=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);
1function Oo(t,e,i){const s=It(ct(t.r)),n=It(ct(t.g)),o=It(ct(t.b));return{r:bt(Ye(s+i*(It(ct(e.r))-s))),g:bt(Ye(n+i*(It(ct(e.g))-n))),b:bt(Ye(o+i*(It(ct(e.b))-o))),a:t.a+i*(e.a-t.a)}}function me(t,e,i){if(t){let s=mi(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,e===0?360:1)),s=xi(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function an(t,e){return t&&Object.assign(e||{},t)}function zi(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=bt(t[3]))):(e=an(t,{r:0,g:0,b:0,a:1}),e.a=bt(e.a)),e}function To(t){return t.charAt(0)==="r"?Do(t):Mo(t)}var rn=class oi{constructor(e){if(e instanceof oi)return e;const i=typeof e;let s;i==="object"?s=zi(e):i==="string"&&(s=fo(e)||Po(e)||To(e)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var e=an(this._rgb);return e&&(e.a=ct(e.a)),e}set rgb(e){this._rgb=zi(e)}rgbString(){return this._valid?Ao(this._rgb):void 0}hexString(){return this._valid?po(this._rgb):void 0}hslString(){return this._valid?wo(this._rgb):void 0}mix(e,i){if(e){const s=this.rgb,n=e.rgb;let o;const a=i===o?.5:i,r=2*a-1,l=s.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=a*s.a+(1-a)*n.a,this.rgb=s}return this}interpolate(e,i){return e&&(this._rgb=Oo(this._rgb,e._rgb,i)),this}clone(){return new oi(this.rgb)}alpha(e){return this._rgb.a=bt(e),this}clearer(e){const i=this._rgb;return i.a*=1-e,this}greyscale(){const e=this._rgb;return e.r=e.g=e.b=ce(e.r*.3+e.g*.59+e.b*.11),this}opaquer(e){const i=this._rgb;return i.a*=1+e,this}negate(){const e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return me(this._rgb,2,e),this}darken(e){return me(this._rgb,2,-e),this}saturate(e){return me(this._rgb,1,e),this}desaturate(e){return me(this._rgb,1,-e),this}rotate(e){return ko(this._rgb,e),this}};function at(){}var Lo=(()=>{let t=0;return()=>t++})();function D(t){return t==null}function I(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function A(t){return t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function W(t){return(typeof t=="number"||t instanceof Number)&&isFinite(+t)}function Z(t,e){return W(t)?t:e}function P(t,e){return typeof t>"u"?e:t}var Ro=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100:+t/e,ln=(t,e)=>typeof t=="string"&&t.endsWith("%")?parseFloat(t)/100*e:+t;function E(t,e,i){if(t&&typeof t.call=="function")return t.apply(i,e)}function L(t,e,i,s){let n,o,a;if(I(t))if(o=t.length,s)for(n=o-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;n<o;n++)e.call(i,t[n],n);else if(A(t))for(a=Object.keys(t),o=a.length,n=0;n<o;n++)e.call(i,t[a[n]],a[n])}function Oe(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function Te(t){if(I(t))return t.map(Te);if(A(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=Te(t[i[n]]);return e}return t}function cn(t){return["__proto__","prototype","constructor"].indexOf(t)===-1}function Eo(t,e,i,s){if(!cn(t))return;const n=e[t],o=i[t];A(n)&&A(o)?se(n,o,s):e[t]=Te(o)}function se(t,e,i){const s=I(e)?e:[e],n=s.length;if(!A(t))return t;i=i||{};const o=i.merger||Eo;let a;for(let r=0;r<n;++r){if(a=s[r],!A(a))continue;const l=Object.keys(a);for(let c=0,h=l.length;c<h;++c)o(l[c],t,a,i)}return t}function Qt(t,e){return se(t,e,{merger:Io})}function Io(t,e,i){if(!cn(t))return;const s=e[t],n=i[t];A(s)&&A(n)?Qt(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Te(n))}var Bi={"":t=>t,x:t=>t.x,y:t=>t.y};function Fo(t){const e=t.split("."),i=[];let s="";for(const n of e)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function zo(t){const e=Fo(t);return i=>{for(const s of e){if(s==="")break;i=i&&i[s]}return i}}function xt(t,e){return(Bi[e]||(Bi[e]=zo(e)))(t)}function _i(t){return t.charAt(0).toUpperCase()+t.slice(1)}var ne=t=>typeof t<"u",_t=t=>typeof t=="function",Vi=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function Bo(t){return t.type==="mouseup"||t.type==="click"||t.type==="contextmenu"}var z=Math.PI,F=2*z,Vo=F+z,Le=Number.POSITIVE_INFINITY,Wo=z/180,N=z/2,kt=z/4,Wi=z*2/3,pt=Math.log10,st=Math.sign;function te(t,e,i){return Math.abs(t-e)<i}function Ni(t){const e=Math.round(t);t=te(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(pt(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function No(t){const 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===(i|0)&&e.push(i),e.sort((n,o)=>n-o).pop(),e}function Ho(t){return typeof t=="symbol"||typeof t=="object"&&t!==null&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}function Bt(t){return!Ho(t)&&!isNaN(parseFloat(t))&&isFinite(t)}
1function jo(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function hn(t,e,i){let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function tt(t){return t*(z/180)}function yi(t){return t*(180/z)}function Hi(t){if(!W(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function dn(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*z&&(o+=F),{angle:o,distance:n}}function ai(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $o(t,e){return(t-e+Vo)%F-z}function J(t){return(t%F+F)%F}function oe(t,e,i,s){const n=J(t),o=J(e),a=J(i),r=J(o-n),l=J(a-n),c=J(n-o),h=J(n-a);return n===o||n===a||s&&o===a||r>l&&c<h}function j(t,e,i){return Math.max(e,Math.min(i,t))}function Yo(t){return j(t,-32768,32767)}function ht(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function vi(t,e,i){i=i||(a=>t[a]<e);let s=t.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,i(o)?n=o:s=o;return{lo:n,hi:s}}var dt=(t,e,i,s)=>vi(t,i,s?n=>{const o=t[n][e];return o<i||o===i&&t[n+1][e]===i}:n=>t[n][e]<i),Uo=(t,e,i)=>vi(t,i,s=>t[s][e]>=i);function Xo(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}var un=["push","pop","shift","splice","unshift"];function Ko(t,e){if(t._chartjs){t._chartjs.listeners.push(e);return}Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),un.forEach(i=>{const s="_onData"+_i(i),n=t[i];Object.defineProperty(t,i,{configurable:!0,enumerable:!1,value(...o){const a=n.apply(this,o);return t._chartjs.listeners.forEach(r=>{typeof r[s]=="function"&&r[s](...o)}),a}})})}function ji(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);n!==-1&&s.splice(n,1),!(s.length>0)&&(un.forEach(o=>{delete t[o]}),delete t._chartjs)}function fn(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}var gn=(function(){return typeof window>"u"?function(t){return t()}:window.requestAnimationFrame})();function pn(t,e){let i=[],s=!1;return function(...n){i=n,s||(s=!0,gn.call(window,()=>{s=!1,t.apply(e,i)}))}}function qo(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}var Mi=t=>t==="start"?"left":t==="end"?"right":"center",U=(t,e,i)=>t==="start"?e:t==="end"?i:(e+i)/2,Go=(t,e,i,s)=>t===(s?"left":"right")?i:t==="center"?(e+i)/2:e;function mn(t,e,i){const s=e.length;let n=0,o=s;if(t._sorted){const{iScale:a,vScale:r,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,h=a.axis,{min:d,max:u,minDefined:f,maxDefined:g}=a.getUserBounds();if(f){if(n=Math.min(dt(l,h,d).lo,i?s:dt(e,h,a.getPixelForValue(d)).lo),c){const m=l.slice(0,n+1).reverse().findIndex(p=>!D(p[r.axis]));n-=Math.max(0,m)}n=j(n,0,s-1)}if(g){let m=Math.max(dt(l,a.axis,u,!0).hi+1,i?0:dt(e,h,a.getPixelForValue(u),!0).hi+1);if(c){const p=l.slice(m-1).findIndex(b=>!D(b[r.axis]));m+=Math.max(0,p)}o=j(m,n,s)-n}else o=s-n}return{start:n,count:o}}function bn(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}var be=t=>t===0||t===1,$i=(t,e,i)=>-(Math.pow(2,10*(t-=1))*Math.sin((t-e)*F/i)),Yi=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*F/i)+1,ee={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>-Math.cos(t*N)+1,easeOutSine:t=>Math.sin(t*N),easeInOutSine:t=>-.5*(Math.cos(z*t)-1),easeInExpo:t=>t===0?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>t===1?1:-Math.pow(2,-10*t)+1,easeInOutExpo:t=>be(t)?t:t<.5?.5*Math.pow(2,10*(t*2-1)):.5*(-Math.pow(2,-10*(t*2-1))+2),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>be(t)?t:$i(t,.075,.3),easeOutElastic:t=>be(t)?t:Yi(t,.075,.3),easeInOutElastic(t){return be(t)?t:t<.5?.5*$i(t*2,.1125,.45):.5+.5*Yi(t*2-1,.1125,.45)},easeInBack(t){return t*t*((1.70158+1)*t-1.70158)},easeOutBack(t){return(t-=1)*t*((1.70158+1)*t+1.70158)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:t=>1-ee.easeOutBounce(1-t),easeOutBounce(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:t=>t<.5?ee.easeInBounce(t*2)*.5:ee.easeOutBounce(t*2-1)*.5+.5};function ki(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Ui(t){return ki(t)?t:new rn(t)}function Ue(t){return ki(t)?t:new rn(t).saturate(.5).darken(.1).hexString()}var Zo=["x","y","borderWidth","radius","tension"],Jo=["color","borderColor","backgroundColor"];function Qo(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:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),t.set("animations",{colors:{type:"color",properties:Jo},numbers:{type:"number",properties:Zo}}),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:e=>e|0}}}})}function ta(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Xi=new Map;function ea(t,e){e=e||{};const i=t+JSON.stringify(e);let s=Xi.get(i);return s||(s=new Intl.NumberFormat(t,e),Xi.set(i,s)),s}function he(t,e,i){return ea(e,i).format(t)}var xn={values(t){return I(t)?t:""+t},numeric(t,e,i){if(t===0)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const c=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=ia(t,i)}const a=pt(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),he(t,s,l)},logarithmic(t,e,i){if(t===0)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(pt(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?xn.numeric.call(this,t,e,i):""}};function ia(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t)),i}var Be={formatters:xn};function sa(t){t.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:(e,i)=>i.lineWidth,tickColor:(e,i)=>i.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:Be.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:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}var Tt=Object.create(null),ri=Object.create(null);function ie(t,e){if(!e)return t;const i=e.split(".");for(let s=0,n=i.length;s<n;++s){const o=i[s];t=t[o]||(t[o]=Object.create(null))}return t}function Xe(t,e,i){return typeof e=="string"?se(ie(t,e),i):se(ie(t,""),e)}var na=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=i=>i.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={}
1,this.hoverBackgroundColor=(i,s)=>Ue(s.backgroundColor),this.hoverBorderColor=(i,s)=>Ue(s.borderColor),this.hoverColor=(i,s)=>Ue(s.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 Xe(this,t,e)}get(t){return ie(this,t)}describe(t,e){return Xe(ri,t,e)}override(t,e){return Xe(Tt,t,e)}route(t,e,i,s){const n=ie(this,t),o=ie(this,i),a="_"+e;Object.defineProperties(n,{[a]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const r=this[a],l=o[s];return A(r)?Object.assign({},l,r):P(r,l)},set(r){this[a]=r}}})}apply(t){t.forEach(e=>e(this))}},B=new na({_scriptable:t=>!t.startsWith("on"),_indexable:t=>t!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Qo,ta,sa]);function oa(t){return!t||D(t.size)||D(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Re(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function aa(t,e,i,s){s=s||{};let n=s.data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(n=s.data={},o=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let a=0;const r=i.length;let l,c,h,d,u;for(l=0;l<r;l++)if(d=i[l],d!=null&&!I(d))a=Re(t,n,o,a,d);else if(I(d))for(c=0,h=d.length;c<h;c++)u=d[c],u!=null&&!I(u)&&(a=Re(t,n,o,a,u));t.restore();const f=o.length/2;if(f>i.length){for(l=0;l<f;l++)delete n[o[l]];o.splice(0,f)}return a}function wt(t,e,i){const s=t.currentDevicePixelRatio,n=i!==0?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function Ki(t,e){!e&&!t||(e=e||t.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function li(t,e,i,s){_n(t,e,i,s,null)}function _n(t,e,i,s,n){let o,a,r,l,c,h,d,u;const f=e.pointStyle,g=e.rotation,m=e.radius;let p=(g||0)*Wo;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){t.save(),t.translate(i,s),t.rotate(p),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),t.restore();return}if(!(isNaN(m)||m<=0)){switch(t.beginPath(),f){default:n?t.ellipse(i,s,n/2,m,0,0,F):t.arc(i,s,m,0,F),t.closePath();break;case"triangle":h=n?n/2:m,t.moveTo(i+Math.sin(p)*h,s-Math.cos(p)*m),p+=Wi,t.lineTo(i+Math.sin(p)*h,s-Math.cos(p)*m),p+=Wi,t.lineTo(i+Math.sin(p)*h,s-Math.cos(p)*m),t.closePath();break;case"rectRounded":c=m*.516,l=m-c,a=Math.cos(p+kt)*l,d=Math.cos(p+kt)*(n?n/2-c:l),r=Math.sin(p+kt)*l,u=Math.sin(p+kt)*(n?n/2-c:l),t.arc(i-d,s-r,c,p-z,p-N),t.arc(i+u,s-a,c,p-N,p),t.arc(i+d,s+r,c,p,p+N),t.arc(i-u,s+a,c,p+N,p+z),t.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*m,h=n?n/2:l,t.rect(i-h,s-l,2*h,2*l);break}p+=kt;case"rectRot":d=Math.cos(p)*(n?n/2:m),a=Math.cos(p)*m,r=Math.sin(p)*m,u=Math.sin(p)*(n?n/2:m),t.moveTo(i-d,s-r),t.lineTo(i+u,s-a),t.lineTo(i+d,s+r),t.lineTo(i-u,s+a),t.closePath();break;case"crossRot":p+=kt;case"cross":d=Math.cos(p)*(n?n/2:m),a=Math.cos(p)*m,r=Math.sin(p)*m,u=Math.sin(p)*(n?n/2:m),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"star":d=Math.cos(p)*(n?n/2:m),a=Math.cos(p)*m,r=Math.sin(p)*m,u=Math.sin(p)*(n?n/2:m),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a),p+=kt,d=Math.cos(p)*(n?n/2:m),a=Math.cos(p)*m,r=Math.sin(p)*m,u=Math.sin(p)*(n?n/2:m),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"line":a=n?n/2:Math.cos(p)*m,r=Math.sin(p)*m,t.moveTo(i-a,s-r),t.lineTo(i+a,s+r);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(p)*(n?n/2:m),s+Math.sin(p)*m);break;case!1:t.closePath();break}t.fill(),e.borderWidth>0&&t.stroke()}}function ut(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 We(t){t.restore()}function ra(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if(n==="middle"){const o=(e.x+i.x)/2;t.lineTo(o,e.y),t.lineTo(o,i.y)}else n==="after"!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}
1function la(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 ca(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),D(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}function ha(t,e,i,s,n){if(n.strikethrough||n.underline){const o=t.measureText(s),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,c=i+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(a,h),t.lineTo(r,h),t.stroke()}}function da(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Lt(t,e,i,s,n,o={}){const a=I(e)?e:[e],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(t.save(),t.font=n.string,ca(t,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&da(t,o.backdrop),r&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),D(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(c,i,s,o.maxWidth)),t.fillText(c,i,s,o.maxWidth),ha(t,i,s,c,o),s+=Number(n.lineHeight);t.restore()}function ae(t,e){const{x:i,y:s,w:n,h:o,radius:a}=e;t.arc(i+a.topLeft,s+a.topLeft,a.topLeft,1.5*z,z,!0),t.lineTo(i,s+o-a.bottomLeft),t.arc(i+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,z,N,!0),t.lineTo(i+n-a.bottomRight,s+o),t.arc(i+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,N,0,!0),t.lineTo(i+n,s+a.topRight),t.arc(i+n-a.topRight,s+a.topRight,a.topRight,0,-N,!0),t.lineTo(i+a.topLeft,s)}var ua=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,fa=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function ga(t,e){const i=(""+t).match(ua);if(!i||i[1]==="normal")return e*1.2;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100;break}return e*t}var pa=t=>+t||0;function wi(t,e){const i={},s=A(e),n=s?Object.keys(e):e,o=A(t)?s?a=>P(t[a],t[e[a]]):a=>t[a]:()=>t;for(const a of n)i[a]=pa(o(a));return i}function yn(t){return wi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function At(t){return wi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function K(t){const e=yn(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function H(t,e){t=t||{},e=e||B.font;let i=P(t.size,e.size);typeof i=="string"&&(i=parseInt(i,10));let s=P(t.style,e.style);s&&!(""+s).match(fa)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:P(t.family,e.family),lineHeight:ga(P(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:P(t.weight,e.weight),string:""};return n.string=oa(n),n}function Gt(t,e,i,s){let n=!0,o,a,r;for(o=0,a=t.length;o<a;++o)if(r=t[o],r!==void 0&&(e!==void 0&&typeof r=="function"&&(r=r(e),n=!1),i!==void 0&&I(r)&&(r=r[i%r.length],n=!1),r!==void 0))return s&&!n&&(s.cacheable=!1),r}function ma(t,e,i){const{min:s,max:n}=t,o=ln(e,(n-s)/2),a=(r,l)=>i&&r===0?0:r+l;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function yt(t,e){return Object.assign(Object.create(t),e)}function Si(t,e=[""],i,s,n=()=>t[0]){const o=i||t;return typeof s>"u"&&(s=wn("_fallback",t)),new Proxy({[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>Si([a,...t],e,o,s)},{deleteProperty(a,r){return delete a[r],delete a._keys,delete t[0][r],!0},get(a,r){return Mn(a,r,()=>wa(r,e,t,a))},getOwnPropertyDescriptor(a,r){return Reflect.getOwnPropertyDescriptor(a._scopes[0],r)},getPrototypeOf(){return Reflect.getPrototypeOf(t[0])},has(a,r){return Gi(a).includes(r)},ownKeys(a){return Gi(a)},set(a,r,l){const c=a._storage||(a._storage=n());return a[r]=c[r]=l,delete a._keys,!0}})}function Vt(t,e,i,s){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:vn(t,s),setContext:o=>Vt(t,o,i,s),override:o=>Vt(t.override(o),e,i,s)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete t[a],!0},get(o,a,r){return Mn(o,a,()=>xa(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(t,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,a)},getPrototypeOf(){return Reflect.getPrototypeOf(t)},has(o,a){return Reflect.has(t,a)},ownKeys(){return Reflect.ownKeys(t)},set(o,a,r){return t[a]=r,delete o[a],!0}})}function vn(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:_t(i)?i:()=>i,isIndexable:_t(s)?s:()=>s}}var ba=(t,e)=>t?t+_i(e):e,Pi=(t,e)=>A(e)&&t!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function Mn(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||e==="constructor")return t[e];const s=i();return t[e]=s,s}function xa(t,e,i){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=t;let r=s[e];return _t(r)&&a.isScriptable(e)&&(r=_a(e,r,t,i)),I(r)&&r.length&&(r=ya(e,r,t,a.isIndexable)),Pi(e,r)&&(r=Vt(r,n,o&&o[e],a)),r}
1function _a(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||s);return r.delete(t),Pi(t,l)&&(l=Ci(n._scopes,n,t,l)),l}function ya(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=i;if(typeof o.index<"u"&&s(t))return e[o.index%e.length];if(A(e[0])){const l=e,c=n._scopes.filter(h=>h!==l);e=[];for(const h of l){const d=Ci(c,n,t,h);e.push(Vt(d,o,a&&a[t],r))}}return e}function kn(t,e,i){return _t(t)?t(e,i):t}var va=(t,e)=>t===!0?e:typeof t=="string"?xt(e,t):void 0;function Ma(t,e,i,s,n){for(const o of e){const a=va(i,o);if(a){t.add(a);const r=kn(a._fallback,i,n);if(typeof r<"u"&&r!==i&&r!==s)return r}else if(a===!1&&typeof s<"u"&&i!==s)return null}return!1}function Ci(t,e,i,s){const n=e._rootScopes,o=kn(e._fallback,i,s),a=[...t,...n],r=new Set;r.add(s);let l=qi(r,a,i,o||i,s);return l===null||typeof o<"u"&&o!==i&&(l=qi(r,a,o,l,s),l===null)?!1:Si(Array.from(r),[""],n,o,()=>ka(e,i,s))}function qi(t,e,i,s,n){for(;i;)i=Ma(t,e,i,s,n);return i}function ka(t,e,i){const s=t._getTarget();e in s||(s[e]={});const n=s[e];return I(n)&&A(i)?i:n||{}}function wa(t,e,i,s){let n;for(const o of e)if(n=wn(ba(o,t),i),typeof n<"u")return Pi(t,n)?Ci(i,s,t,n):n}function wn(t,e){for(const i of e){if(!i)continue;const s=i[t];if(typeof s<"u")return s}}function Gi(t){let e=t._keys;return e||(e=t._keys=Sa(t._scopes)),e}function Sa(t){const e=new Set;for(const i of t)for(const s of Object.keys(i).filter(n=>!n.startsWith("_")))e.add(s);return Array.from(e)}function Sn(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(s);let r,l,c,h;for(r=0,l=s;r<l;++r)c=r+i,h=e[c],a[r]={r:n.parse(xt(h,o),c)};return a}var Pa=Number.EPSILON||1e-14,Wt=(t,e)=>e<t.length&&!t[e].skip&&t[e],Pn=t=>t==="x"?"y":"x";function Ca(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=ai(o,n),l=ai(a,o);let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=s*c,u=s*h;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function Da(t,e,i){const s=t.length;let n,o,a,r,l,c=Wt(t,0);for(let h=0;h<s-1;++h)if(l=c,c=Wt(t,h+1),!(!l||!c)){if(te(e[h],0,Pa)){i[h]=i[h+1]=0;continue}n=i[h]/e[h],o=i[h+1]/e[h],r=Math.pow(n,2)+Math.pow(o,2),!(r<=9)&&(a=3/Math.sqrt(r),i[h]=n*a*e[h],i[h+1]=o*a*e[h])}}
1function Aa(t,e,i="x"){const s=Pn(i),n=t.length;let o,a,r,l=Wt(t,0);for(let c=0;c<n;++c){if(a=r,r=l,l=Wt(t,c+1),!r)continue;const h=r[i],d=r[s];a&&(o=(h-a[i])/3,r[`cp1${i}`]=h-o,r[`cp1${s}`]=d-o*e[c]),l&&(o=(l[i]-h)/3,r[`cp2${i}`]=h+o,r[`cp2${s}`]=d+o*e[c])}}function Oa(t,e="x"){const i=Pn(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,c=Wt(t,0);for(a=0;a<s;++a)if(r=l,l=c,c=Wt(t,a+1),!!l){if(c){const h=c[e]-l[e];n[a]=h!==0?(c[i]-l[i])/h:0}o[a]=r?c?st(n[a-1])!==st(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}Da(t,n,o),Aa(t,o,e)}function xe(t,e,i){return Math.max(Math.min(t,i),e)}function Ta(t,e){let i,s,n,o,a,r=ut(t[0],e);for(i=0,s=t.length;i<s;++i)a=o,o=r,r=i<s-1&&ut(t[i+1],e),o&&(n=t[i],a&&(n.cp1x=xe(n.cp1x,e.left,e.right),n.cp1y=xe(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=xe(n.cp2x,e.left,e.right),n.cp2y=xe(n.cp2y,e.top,e.bottom)))}function La(t,e,i,s,n){let o,a,r,l;if(e.spanGaps&&(t=t.filter(c=>!c.skip)),e.cubicInterpolationMode==="monotone")Oa(t,n);else{let c=s?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=Ca(c,r,t[Math.min(o+1,a-(s?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,c=r}e.capBezierPoints&&Ta(t,i)}function Di(){return typeof window<"u"&&typeof document<"u"}function Ai(t){let e=t.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function Ee(t,e,i){let s;return typeof t=="string"?(s=parseInt(t,10),t.indexOf("%")!==-1&&(s=s/100*e.parentNode[i])):s=t,s}var Ne=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function Ra(t,e){return Ne(t).getPropertyValue(e)}var Ea=["top","right","bottom","left"];function Ot(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=Ea[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}var Ia=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function Fa(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let a=!1,r,l;if(Ia(n,o,t.target))r=n,l=o;else{const c=e.getBoundingClientRect();r=s.clientX-c.left,l=s.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function Ct(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=Ne(i),o=n.boxSizing==="border-box",a=Ot(n,"padding"),r=Ot(n,"border","width"),{x:l,y:c,box:h}=Fa(t,i),d=a.left+(h&&r.left),u=a.top+(h&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((c-u)/g*i.height/s)}}function za(t,e,i){let s,n;if(e===void 0||i===void 0){const o=t&&Ai(t);if(!o)e=t.clientWidth,i=t.clientHeight;else{const a=o.getBoundingClientRect(),r=Ne(o),l=Ot(r,"border","width"),c=Ot(r,"padding");e=a.width-c.width-l.width,i=a.height-c.height-l.height,s=Ee(r.maxWidth,o,"clientWidth"),n=Ee(r.maxHeight,o,"clientHeight")}}return{width:e,height:i,maxWidth:s||Le,maxHeight:n||Le}}var _e=t=>Math.round(t*10)/10;function Ba(t,e,i,s){const n=Ne(t),o=Ot(n,"margin"),a=Ee(n.maxWidth,t,"clientWidth")||Le,r=Ee(n.maxHeight,t,"clientHeight")||Le,l=za(t,e,i);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const d=Ot(n,"border","width"),u=Ot(n,"padding");c-=u.width+d.width,h-=u.height+d.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=_e(Math.min(c,a,l.maxWidth)),h=_e(Math.min(h,r,l.maxHeight)),c&&!h&&(h=_e(c/2)),(e!==void 0||i!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=_e(Math.floor(h*s))),{width:c,height:h}}function Zi(t,e,i){const s=e||1,n=Math.floor(t.height*s),o=Math.floor(t.width*s);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o?(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0):!1}var Va=(function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Di()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t})();function Ji(t,e){const i=Ra(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}
1function Dt(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Wa(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:s==="middle"?i<.5?t.y:e.y:s==="after"?i<1?t.y:e.y:i>0?e.y:t.y}}function Na(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=Dt(t,n,i),r=Dt(n,o,i),l=Dt(o,e,i);return Dt(Dt(a,r,i),Dt(r,l,i),i)}var Ha=function(t,e){return{x(i){return t+t+e-i},setWidth(i){e=i},textAlign(i){return i==="center"?i:i==="right"?"left":"right"},xPlus(i,s){return i-s},leftForLtr(i,s){return i-s}}},ja=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function zt(t,e,i){return t?Ha(e,i):ja()}function Cn(t,e){let i,s;(e==="ltr"||e==="rtl")&&(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Dn(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function An(t){return t==="angle"?{between:oe,compare:$o,normalize:J}:{between:ht,compare:(e,i)=>e-i,normalize:e=>e}}function Qi({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i===0,style:n}}function $a(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=An(s),l=e.length;let{start:c,end:h,loop:d}=t,u,f;if(d){for(c+=l,h+=l,u=0,f=l;u<f&&a(r(e[c%l][s]),n,o);++u)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:d,style:t.style}}function On(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:c}=An(s),{start:h,end:d,loop:u,style:f}=$a(t,e,i),g=[];let m=!1,p=null,b,x,v;const y=()=>l(n,v,b)&&r(n,v)!==0,_=()=>r(o,b)===0||l(o,v,b),k=()=>m||y(),M=()=>!m||_();for(let w=h,S=h;w<=d;++w)x=e[w%a],!x.skip&&(b=c(x[s]),b!==v&&(m=l(b,n,o),p===null&&k()&&(p=r(b,n)===0?w:S),p!==null&&M()&&(g.push(Qi({start:p,end:w,loop:u,count:a,style:f})),p=null),S=w,v=b));return p!==null&&g.push(Qi({start:p,end:d,loop:u,count:a,style:f})),g}function Tn(t,e){const i=[],s=t.segments;for(let n=0;n<s.length;n++){const o=On(s[n],t.points,e);o.length&&i.push(...o)}return i}function Ya(t,e,i,s){let n=0,o=e-1;if(i&&!s)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(o+=n);o>n&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}function Ua(t,e,i,s){const n=t.length,o=[];let a=e,r=t[e],l;for(l=e+1;l<=i;++l){const c=t[l%n];c.skip||c.stop?r.skip||(s=!1,o.push({start:e%n,end:(l-1)%n,loop:s}),e=a=c.stop?l:null):(a=l,r.skip&&(e=l)),r=c}return a!==null&&o.push({start:e%n,end:a%n,loop:s}),o}function Xa(t,e){const i=t.points,s=t.options.spanGaps,n=i.length;if(!n)return[];const o=!!t._loop,{start:a,end:r}=Ya(i,n,o,s);return s===!0?ts(t,[{start:a,end:r,loop:o}],i,e):ts(t,Ua(i,a,r<a?r+n:r,!!t._fullLoop&&a===0&&r===n-1),i,e)}function ts(t,e,i,s){return!s||!s.setContext||!i?e:Ka(t,e,i,s)}function Ka(t,e,i,s){const n=t._chart.getContext(),o=es(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=i.length,c=[];let h=o,d=e[0].start,u=d;function f(g,m,p,b){const x=r?-1:1;if(g!==m){for(g+=l;i[g%l].skip;)g-=x;for(;i[m%l].skip;)m+=x;g%l!==m%l&&(c.push({start:g%l,end:m%l,loop:p,style:b}),h=b,d=m%l)}}for(const g of e){d=r?d:g.start;let m=i[d%l],p;for(u=d+1;u<=g.end;u++){const b=i[u%l];p=es(s.setContext(yt(n,{type:"segment",p0:m,p1:b,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),qa(p,h)&&f(d,u-1,g.loop,h),m=b,h=p}d<u-1&&f(d,u-1,g.loop,h)}return c}function es(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function qa(t,e){if(!e)return!1;const i=[],s=function(n,o){return ki(o)?(i.includes(o)||i.push(o),i.indexOf(o)):o};return JSON.stringify(t,s)!==JSON.stringify(e,s)}function ye(t,e,i){return t.options.clip?t[i]:e[i]}function Ga(t,e){const{xScale:i,yScale:s}=t;return i&&s?{left:ye(i,e,"left"),right:ye(i,e,"right"),top:ye(s,e,"top"),bottom:ye(s,e,"bottom")}:e}function Ln(t,e){const i=e._clip;if(i.disabled)return!1;const s=Ga(e,t.chartArea);
1return{left:i.left===!1?0:s.left-(i.left===!0?0:i.left),right:i.right===!1?t.width:s.right+(i.right===!0?0:i.right),top:i.top===!1?0:s.top-(i.top===!0?0:i.top),bottom:i.bottom===!1?t.height:s.bottom+(i.bottom===!0?0:i.bottom)}}var Za=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach(a=>a({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=gn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o=n.length-1,a=!1,r;for(;o>=0;--o)r=n[o],r._active?(r._total>i.duration&&(i.duration=r._total),r.tick(t),a=!0):(n[o]=n[n.length-1],n.pop());a&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length}),this._lastDate=t,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,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},rt=new Za,is="transparent",Ja={boolean(t,e,i){return i>.5?e:t},color(t,e,i){const s=Ui(t||is),n=s.valid&&Ui(e||is);
1return n&&n.valid?n.mix(s,i).hexString():e},number(t,e,i){return t+(e-t)*i}},Qa=class{constructor(t,e,i,s){const n=e[i];s=Gt([t.to,s,n,t.from]);const o=Gt([t.from,n,s]);this._active=!0,this._fn=t.fn||Ja[t.type||typeof o],this._easing=ee[t.easing]||ee.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Gt([t.to,e,s,t.from]),this._from=Gt([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e<i),!this._active){this._target[s]=a,this._notify(!0);return}if(e<0){this._target[s]=n;return}r=e/i%2,r=o&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}},Rn=class{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!A(t))return;const e=Object.keys(B.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach(s=>{const n=t[s];if(!A(n))return;const o={};for(const a of e)o[a]=n[a];(I(n.properties)&&n.properties||[s]).forEach(a=>{(a===s||!i.has(a))&&i.set(a,o)})})}_animateOptions(t,e){const i=e.options,s=er(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&tr(t.options.$animations,i).then(()=>{t.options=i},()=>{}),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if(l.charAt(0)==="$")continue;if(l==="options"){s.push(...this._animateOptions(t,e));continue}const c=e[l];let h=n[l];const d=i.get(l);if(h)if(d&&h.active()){h.update(d,c,a);continue}else h.cancel();if(!d||!d.duration){t[l]=c;continue}n[l]=h=new Qa(d,t,l,c),s.push(h)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const i=this._createAnimations(t,e);if(i.length)return rt.add(this._chart,i),!0}};function tr(t,e){const i=[],s=Object.keys(e);for(let n=0;n<s.length;n++){const o=t[s[n]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}function er(t,e){if(!e)return;let i=t.options;if(!i){t.options=e;return}return i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}})),i}function ss(t,e){const i=t&&t.options||{},s=i.reverse,n=i.min===void 0?e:0,o=i.max===void 0?e:0;return{start:s?o:n,end:s?n:o}}function ir(t,e,i){if(i===!1)return!1;const s=ss(t,i),n=ss(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function sr(t){let e,i,s,n;return A(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:t===!1}}function En(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n<o;++n)i.push(s[n].index);return i}function ns(t,e,i,s={}){const n=t.keys,o=s.mode==="single";let a,r,l,c;if(e===null)return;let h=!1;for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===i){if(h=!0,s.all)continue;break}c=t.values[l],W(c)&&(o||e===0||st(e)===st(c))&&(e+=c)}return!h&&!s.all?0:e}function nr(t,e){const{iScale:i,vScale:s}=e,n=i.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,c,h;for(l=0,c=a.length;l<c;++l)h=a[l],r[l]={[n]:h,[o]:t[h]};return r}function Ke(t,e){const i=t&&t.options.stacked;return i||i===void 0&&e.stack!==void 0}function or(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}function ar(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}function rr(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function os(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const o=t[n.index];if(i&&o>0||!i&&o<0)return n.index}return null}function as(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,c=a.axis,h=or(o,a,s),d=e.length;let u;for(let f=0;f<d;++f){const g=e[f],{[l]:m,[c]:p}=g,b=g._stacks||(g._stacks={});u=b[c]=rr(n,h,m),u[r]=p,u._top=os(u,a,!0,s.type),u._bottom=os(u,a,!1,s.type);const x=u._visualValues||(u._visualValues={});x[r]=p}}function qe(t,e){const i=t.scales;return Object.keys(i).filter(s=>i[s].axis===e).shift()}function lr(t,e){return yt(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function cr(t,e,i){return yt(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}function $t(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;
1if(s){e=e||t._parsed;for(const n of e){const o=n._stacks;if(!o||o[s]===void 0||o[s][i]===void 0)return;delete o[s][i],o[s]._visualValues!==void 0&&o[s]._visualValues[i]!==void 0&&delete o[s]._visualValues[i]}}}var Ge=t=>t==="reset"||t==="none",rs=(t,e)=>e?t:Object.assign({},t),hr=(t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:En(i,!0),values:null},vt=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ke(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&&$t(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(h,d,u,f)=>h==="x"?d:h==="r"?f:u,n=e.xAxisID=P(i.xAxisID,qe(t,"x")),o=e.yAxisID=P(i.yAxisID,qe(t,"y")),a=e.rAxisID=P(i.rAxisID,qe(t,"r")),r=e.indexAxis,l=e.iAxisID=s(r,n,o,a),c=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ji(this._data,this),t._stacked&&$t(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(A(e)){const s=this._cachedMeta;this._data=nr(e,s)}else if(i!==e){if(i){ji(i,this);const s=this._cachedMeta;$t(s),s._parsed=[]}e&&Object.isExtensible(e)&&Ko(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 s=!1;this._dataCheck();const n=e._stacked;e._stacked=Ke(e.vScale,e),e.stack!==i.stack&&(s=!0,$t(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&(as(this,e._parsed),e._stacked=Ke(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:s}=this,{iScale:n,_stacked:o}=i,a=n.axis;let r=t===0&&e===s.length?!0:i._sorted,l=t>0&&i._parsed[t-1],c,h,d;if(this._parsing===!1)i._parsed=s,i._sorted=!0,d=s;else{I(s[t])?d=this.parseArrayData(i,s,t,e):A(s[t])?d=this.parseObjectData(i,s,t,e):d=this.parsePrimitiveData(i,s,t,e);const u=()=>h[a]===null||l&&h[a]<l[a];for(c=0;c<e;++c)i._parsed[c+t]=h=d[c],r&&(u()&&(r=!1),l=h);i._sorted=r}o&&as(this,d)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:o}=t,a=n.axis,r=o.axis,l=n.getLabels(),c=n===o,h=new Array(s);let d,u,f;for(d=0,u=s;d<u;++d)f=d+i,h[d]={[a]:c||n.parse(l[f],f),[r]:o.parse(e[f],f)};return h}parseArrayData(t,e,i,s){const{xScale:n,yScale:o}=t,a=new Array(s);let r,l,c,h;for(r=0,l=s;r<l;++r)c=r+i,h=e[c],a[r]={x:n.parse(h[0],c),y:o.parse(h[1],c)};return a}parseObjectData(t,e,i,s){const{xScale:n,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let c,h,d,u;for(c=0,h=s;c<h;++c)d=c+i,u=e[d],l[c]={x:n.parse(xt(u,a),d),y:o.parse(xt(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,o=e[t.axis];return ns({keys:En(s,!0),values:e._stacks[t.axis]._visualValues},o,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let o=n===null?NaN:n;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,o=ns(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,o=s.length,a=this._getOtherScale(t),r=hr(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=ar(a);let d,u;function f(){u=s[d];const g=u[a.axis];return!W(u[t.axis])||c>g||h<g}for(d=0;d<o&&!(!f()&&(this.updateRangeFromParsed(l,t,u,r),n));++d);if(n){for(d=o-1;d>=0;--d)if(!f()){this.updateRangeFromParsed(l,t,u,r);break}}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s][t.axis],W(o)&&i.push(o);return i}getMaxOverflow(){return!1}
vendor: 5,880 bytes, line 1
1getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=sr(P(this.options.clip,ir(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,n,a,r),c=a;c<a+r;++c){const h=s[c];h.hidden||(h.active&&l?o.push(h):h.draw(t,n))}for(c=0;c<o.length;++c)o[c].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const o=this._cachedMeta.data[t];n=o.$context||(o.$context=cr(this.getContext(),t,o)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=lr(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}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=e==="active",n=this._cachedDataOpts,o=t+"-"+e,a=n[o],r=this.enableOptionSharing&&ne(i);if(a)return rs(a,r);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(B.elements[t]),f=()=>this.getContext(i,s,e),g=l.resolveNamedOptions(d,u,f,h);return g.$shared&&(g.$shared=r,n[o]=Object.freeze(rs(g,r))),g}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(s.options.animation!==!1){const c=this.chart.config,h=c.datasetAnimationScopeKeys(this._type,e),d=c.getOptionScopes(this.getDataset(),h);r=c.createResolver(d,this.getContext(t,i,e))}const l=new Rn(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ge(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){Ge(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ge(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[a,r,l]of this._syncList)this[a](r,l);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,o=t+e;let a;const r=l=>{for(l.length+=e,a=l.length-1;a>=o;a--)l[a]=l[a-e]};for(r(n),a=t;a<o;++a)n[a]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&$t(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const 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]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};function dr(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let n=0,o=i.length;n<o;n++)s=s.concat(i[n].controller.getAllParsedValues(t));t._cache.$bar=fn(s.sort((n,o)=>n-o))}return t._cache.$bar}function ur(t){const e=t.iScale,i=dr(e,t.type);let s=e._length,n,o,a,r;const l=()=>{a===32767||a===-32768||(ne(r)&&(s=Math.min(s,Math.abs(a-r)||s)),r=a)};for(n=0,o=i.length;n<o;++n)a=e.getPixelForValue(i[n]),l();for(r=void 0,n=0,o=e.ticks.length;n<o;++n)a=e.getPixelForTick(n),l();return s}function fr(t,e,i,s){const n=i.barThickness;let o,a;return D(n)?(o=e.min*i.categoryPercentage,a=i.barPercentage):(o=n*s,a=1),{chunk:o/s,ratio:a,start:e.pixels[t]-o/2}}function gr(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;a===null&&(a=o-(r===null?e.end-e.start:r-o)),r===null&&(r=o+o-a);const c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/s,ratio:i.barPercentage,start:c}}function pr(t,e,i,s){const n=i.parse(t[0],s),o=i.parse(t[1],s),a=Math.min(n,o),r=Math.max(n,o);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function In(t,e,i,s){return I(t)?pr(t,e,i,s):e[i.axis]=i.parse(t,s),e}function ls(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let c,h,d,u;for(c=i,h=i+s;c<h;++c)u=e[c],d={}
1,d[n.axis]=r||n.parse(a[c],c),l.push(In(u,d,o,c));return l}function Ze(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function mr(t,e,i){return t!==0?st(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}function br(t){let e,i,s,n,o;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",o="start"):(n="start",o="end"),{start:i,end:s,reverse:e,top:n,bottom:o}}function xr(t,e,i,s){let n=e.borderSkipped;const o={};if(!n){t.borderSkipped=o;return}if(n===!0){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:r,reverse:l,top:c,bottom:h}=br(t);n==="middle"&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=c:(i._bottom||0)===s?n=h:(o[cs(h,a,r,l)]=!0,n=c)),o[cs(n,a,r,l)]=!0,t.borderSkipped=o}function cs(t,e,i,s){return s?(t=_r(t,e,i),t=hs(t,i,e)):t=hs(t,e,i),t}function _r(t,e,i){return t===e?i:t===i?e:t}function hs(t,e,i){return t==="start"?e:t==="end"?i:t}function yr(t,{inflateAmount:e},i){t.inflateAmount=e==="auto"?i===1?.33:0:e}var vr=class extends vt{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 ls(t,e,i,s)}parseArrayData(t,e,i,s){return ls(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=n.axis==="x"?a:r,c=o.axis==="x"?a:r,h=[];let d,u,f,g;for(d=i,u=i+s;d<u;++d)g=e[d],f={},f[n.axis]=n.parse(xt(g,l),d),h.push(In(xt(g,c),f,o,d));return h}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const{iScale:e,vScale:i}=this._cachedMeta,s=this.getParsed(t),n=s._custom,o=Ze(n)?"["+n.start+", "+n.end+"]":""+i.getLabelForValue(s[i.axis]);return{label:""+e.getLabelForValue(s[e.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const n=s==="reset",{index:o,_cachedMeta:{vScale:a}}=this,r=a.getBasePixel(),l=a.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,s);for(let u=e;u<e+i;u++){const f=this.getParsed(u),g=n||D(f[a.axis])?{base:r,head:r}:this._calculateBarValuePixels(u),m=this._calculateBarIndexPixels(u,c),p=(f._stacks||{})[a.axis],b={horizontal:l,base:g.base,enableBorderRadius:!p||Ze(f._custom)||o===p._top||o===p._bottom,x:l?g.head:m.center,y:l?m.center:g.head,height:l?m.size:Math.abs(g.size),width:l?Math.abs(g.size):m.size};d&&(b.options=h||this.resolveDataElementOptions(u,t[u].active?"active":s));const x=b.options||t[u].options;xr(b,x,p,o),yr(b,x,c.ratio),this.updateElement(t[u],u,b,s)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(c=>c.controller.options.grouped),n=i.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(e),r=a&&a[i.axis],l=c=>{const h=c._parsed.find(u=>u[i.axis]===r),d=h&&h[c.vScale.axis];if(D(d)||isNaN(d))return!0};for(const c of s)if(!(e!==void 0&&l(c))&&((n===!1||o.indexOf(c.stack)===-1||n===void 0&&c.stack===void 0)&&o.push(c.stack),c.index===t))break;return o.length||o.push(void 0),o}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=e!==void 0?s.indexOf(e):-1;return n===-1?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n<o;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const a=t.barThickness;return{min:a||ur(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:s},options:{base:n,minBarLength:o}}=this,a=n||0,r=this.getParsed(t),l=r._custom,c=Ze(l);
1let h=r[e.axis],d=0,u=i?this.applyStack(e,r,i):h,f,g;u!==h&&(d=u-h,u=h),c&&(h=l.barStart,u=l.barEnd-l.barStart,h!==0&&st(h)!==st(l.barEnd)&&(d=0),d+=h);const m=!D(n)&&!c?n:d;let p=e.getPixelForValue(m);if(this.chart.getDataVisibility(t)?f=e.getPixelForValue(d+u):f=p,g=f-p,Math.abs(g)<o){g=mr(g,e,a)*o,h===a&&(p-=g/2);const b=e.getPixelForDecimal(0),x=e.getPixelForDecimal(1);p=Math.max(Math.min(p,Math.max(b,x)),Math.min(b,x)),f=p+g,i&&!c&&(r._stacks[e.axis]._visualValues[s]=e.getValueForPixel(f)-e.getValueForPixel(p))}if(p===e.getPixelForValue(a)){const b=st(g)*e.getLineWidthForValue(a)/2;p+=b,g-=b}return{size:g,base:p,head:f,center:f+g/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,n=s.skipNull,o=P(s.maxBarThickness,1/0);let a,r;if(e.grouped){const l=n?this._getStackCount(t):e.stackCount,c=s.barThickness==="flex"?gr(t,e,s,l):fr(t,e,s,l),h=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0);a=c.start+c.chunk*h+c.chunk/2,r=Math.min(o,c.chunk*c.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),r=Math.min(o,e.min*e.ratio);return{base:a-r/2,head:a+r/2,center:a,size:r}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)this.getParsed(n)[e.axis]!==null&&!i[n].hidden&&i[n].draw(this._ctx)}},Mr=class extends vt{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){const n=super.parsePrimitiveData(t,e,i,s);for(let o=0;o<n.length;o++)n[o]._custom=this.resolveDataElementOptions(o+i).radius;return n}parseArrayData(t,e,i,s){const n=super.parseArrayData(t,e,i,s);for(let o=0;o<n.length;o++){const a=e[i+o];n[o]._custom=P(a[2],this.resolveDataElementOptions(o+i).radius)}return n}parseObjectData(t,e,i,s){const n=super.parseObjectData(t,e,i,s);for(let o=0;o<n.length;o++){const a=e[i+o];n[o]._custom=P(a&&a.r&&+a.r,this.resolveDataElementOptions(o+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y),l=o._custom;return{label:i[t]||"",value:"("+a+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n=s==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,s),c=o.axis,h=a.axis;for(let d=e;d<e+i;d++){const u=t[d],f=!n&&this.getParsed(d),g={},m=g[c]=n?o.getPixelForDecimal(.5):o.getPixelForValue(f[c]),p=g[h]=n?a.getBasePixel():a.getPixelForValue(f[h]);g.skip=isNaN(m)||isNaN(p),l&&(g.options=r||this.resolveDataElementOptions(d,u.active?"active":s),n&&(g.options.radius=0)),this.updateElement(u,d,g,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const n=s.radius;return e!=="active"&&(s.radius=0),s.radius+=P(i&&i._custom,n),s}};function kr(t,e,i){let s=1,n=1,o=0,a=0;if(e<F){const r=t,l=r+e,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(v,y,_)=>oe(v,r,l,!0)?1:Math.max(y,y*i,_,_*i),g=(v,y,_)=>oe(v,r,l,!0)?-1:Math.min(y,y*i,_,_*i),m=f(0,c,d),p=f(N,h,u),b=g(z,c,d),x=g(z+N,h,u);s=(m-b)/2,n=(p-x)/2,o=-(m+b)/2,a=-(p+x)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}var Oi=class extends vt{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=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((n,o)=>{const a=t.getDatasetMeta(0).controller.getStyle(o);return{text:n,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:s,lineWidth:a.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}return[]}}
1,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(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let n=r=>+i[r];if(A(i[t])){const{key:r="value"}=this._parsing;n=l=>+xt(i[l],r)}let o,a;for(o=t,a=t+e;o<a;++o)s._parsed[o]=n(o)}}_getRotation(){return tt(this.options.rotation-90)}_getCircumference(){return tt(this.options.circumference)}_getRotationExtents(){let t=F,e=-F;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,n=s._getRotation(),o=s._getCircumference();t=Math.min(t,n),e=Math.max(e,n+o)}return{rotation:t,circumference:e-t}}update(t){const{chartArea:e}=this.chart,i=this._cachedMeta,s=i.data,n=this.getMaxBorderWidth()+this.getMaxOffset(s)+this.options.spacing,o=Math.max((Math.min(e.width,e.height)-n)/2,0),a=Math.min(Ro(this.options.cutout,o),1),r=this._getRingWeight(this.index),{circumference:l,rotation:c}=this._getRotationExtents(),{ratioX:h,ratioY:d,offsetX:u,offsetY:f}=kr(c,l,a),g=(e.width-n)/h,m=(e.height-n)/d,p=Math.max(Math.min(g,m)/2,0),b=ln(this.options.radius,p),x=(b-Math.max(b*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=u*b,this.offsetY=f*b,i.total=this.calculateTotal(),this.outerRadius=b-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*r,0),this.updateElements(s,0,s.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/F)}updateElements(t,e,i,s){const n=s==="reset",o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,c=(a.top+a.bottom)/2,h=n&&r.animateScale,d=h?0:this.innerRadius,u=h?0:this.outerRadius,{sharedOptions:f,includeOptions:g}=this._getSharedOptions(e,s);let m=this._getRotation(),p;for(p=0;p<e;++p)m+=this._circumference(p,n);for(p=e;p<e+i;++p){const b=this._circumference(p,n),x=t[p],v={x:l+this.offsetX,y:c+this.offsetY,startAngle:m,endAngle:m+b,circumference:b,outerRadius:u,innerRadius:d};g&&(v.options=f||this.resolveDataElementOptions(p,x.active?"active":s)),m+=b,this.updateElement(x,p,v,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i=0,s;for(s=0;s<e.length;s++){const n=t._parsed[s];n!==null&&!isNaN(n)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(n))}return i}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?F*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=he(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t){for(s=0,n=i.data.datasets.length;s<n;++s)if(i.isDatasetVisible(s)){o=i.getDatasetMeta(s),t=o.data,a=o.controller;break}}if(!t)return 0;for(s=0,n=t.length;s<n;++s)r=a.resolveDataElementOptions(s),r.borderAlign!=="inner"&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const n=this.resolveDataElementOptions(i);e=Math.max(e,n.offset||0,n.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(P(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}},wr=class extends vt{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){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=mn(e,s,o);this._drawStart=a,this._drawCount=r,bn(e)&&(a=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(s,a,r,t)}updateElements(t,e,i,s){const n=s==="reset",{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,s),d=o.axis,u=a.axis,{spanGaps:f,segment:g}=this.options,m=Bt(f)?f:Number.POSITIVE_INFINITY,p=this.chart._animationsDisabled||n||s==="none",b=e+i,x=t.length;let v=e>0&&this.getParsed(e-1);for(let y=0;y<x;++y){const _=t[y],k=p?_:{};
vendor: 4,144 bytes, line 1
1if(y<e||y>=b){k.skip=!0;continue}const M=this.getParsed(y),w=D(M[u]),S=k[d]=o.getPixelForValue(M[d],y),C=k[u]=n||w?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,M,r):M[u],y);k.skip=isNaN(S)||isNaN(C)||w,k.stop=y>0&&Math.abs(M[d]-v[d])>m,g&&(k.parsed=M,k.raw=l.data[y]),h&&(k.options=c||this.resolveDataElementOptions(y,_.active?"active":s)),p||this.updateElement(_,y,k,s),v=M}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},Fn=class extends vt{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(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((n,o)=>{const a=t.getDatasetMeta(0).controller.getStyle(o);return{text:n,fillStyle:a.backgroundColor,strokeStyle:a.borderColor,fontColor:s,lineWidth:a.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}})}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){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=he(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return Sn.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{const n=this.getParsed(s).r;!isNaN(n)&&this.chart.getDataVisibility(s)&&(n<e.min&&(e.min=n),n>e.max&&(e.max=n))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n=s==="reset",o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,c=r.yCenter,h=r.getIndexAngle(0)-.5*z;let d=h,u;const f=360/this.countVisibleElements();for(u=0;u<e;++u)d+=this._computeAngle(u,s,f);for(u=e;u<e+i;u++){const g=t[u];let m=d,p=d+this._computeAngle(u,s,f),b=o.getDataVisibility(u)?r.getDistanceFromCenterForValue(this.getParsed(u).r):0;d=p,n&&(a.animateScale&&(b=0),a.animateRotate&&(m=p=h));const x={x:l,y:c,innerRadius:0,outerRadius:b,startAngle:m,endAngle:p,options:this.resolveDataElementOptions(u,g.active?"active":s)};this.updateElement(g,u,x,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?tt(this.resolveDataElementOptions(t,e).angle||i):0}},Sr=class extends Oi{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},Pr=class extends vt{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return Sn.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,t!=="resize"){const o=this.resolveDatasetElementOptions(t);
1this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:n.length===s.length,options:o};this.updateElement(i,void 0,a,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o=s==="reset";for(let a=e;a<e+i;a++){const r=t[a],l=this.resolveDataElementOptions(a,r.active?"active":s),c=n.getPointPositionForValue(a,this.getParsed(a).r),h=o?n.xCenter:c.x,d=o?n.yCenter:c.y,u={x:h,y:d,angle:c.angle,skip:isNaN(h)||isNaN(d),options:l};this.updateElement(r,a,u,s)}}},Cr=class extends vt{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){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y);return{label:i[t]||"",value:"("+a+", "+r+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:n,count:o}=mn(e,i,s);if(this._drawStart=n,this._drawCount=o,bn(e)&&(n=0,o=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;const l=this.resolveDatasetElementOptions(t);l.segment=this.options.segment,this.updateElement(a,void 0,{animated:!s,options:l},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,s){const n=s==="reset",{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,s),h=this.getSharedOptions(c),d=this.includeOptions(s,h),u=o.axis,f=a.axis,{spanGaps:g,segment:m}=this.options,p=Bt(g)?g:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||n||s==="none";let x=e>0&&this.getParsed(e-1);for(let v=e;v<e+i;++v){const y=t[v],_=this.getParsed(v),k=b?y:{},M=D(_[f]),w=k[u]=o.getPixelForValue(_[u],v),S=k[f]=n||M?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,_,r):_[f],v);k.skip=isNaN(w)||isNaN(S)||M,k.stop=v>0&&Math.abs(_[u]-x[u])>p,m&&(k.parsed=_,k.raw=l.data[v]),d&&(k.options=h||this.resolveDataElementOptions(v,y.active?"active":s)),b||this.updateElement(y,v,k,s),x=_}this.updateSharedOptions(h,s,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let r=e.length-1;r>=0;--r)a=Math.max(a,e[r].size(this.resolveDataElementOptions(r))/2);return a>0&&a}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}},Dr=Object.freeze({__proto__:null,BarController:vr,BubbleController:Mr,DoughnutController:Oi,LineController:wr,PieController:Sr,PolarAreaController:Fn,RadarController:Pr,ScatterController:Cr});function St(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Ar=class zn{static override(e){Object.assign(zn.prototype,e)}options;constructor(e){this.options=e||{}}init(){}formats(){return St()}parse(){return St()}format(){return St()}add(){return St()}diff(){return St()}startOf(){return St()}endOf(){return St()}},Or={_date:Ar};function Tr(t,e,i,s){const{controller:n,data:o,_sorted:a}=t,r=n._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(r&&e===r.axis&&e!=="r"&&a&&o.length){const c=r._reversePixels?Uo:dt;if(s){if(n._sharedOptions){const h=o[0],d=typeof h.getRange=="function"&&h.getRange(e);if(d){const u=c(o,e,i-d),f=c(o,e,i+d);return{lo:u.lo,hi:f.hi}}}}else{const h=c(o,e,i);if(l){const{vScale:d}=n._cachedMeta,{_parsed:u}=t,f=u.slice(0,h.lo+1).reverse().findIndex(m=>!D(m[d.axis]));h.lo-=Math.max(0,f);const g=u.slice(h.hi).findIndex(m=>!D(m[d.axis]));h.hi+=Math.max(0,g)}return h}}return{lo:0,hi:o.length-1}}function de(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let r=0,l=o.length;r<l;++r){const{index:c,data:h}=o[r],{lo:d,hi:u}=Tr(o[r],e,a,n);for(let f=d;f<=u;++f){const g=h[f];g.skip||s(g,c,f)}}}function Lr(t){const e=t.indexOf("x")!==-1,i=t.indexOf("y")!==-1;return function(s,n){const o=e?Math.abs(s.x-n.x):0,a=i?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Je(t,e,i,s,n){const o=[];return!n&&!t.isPointInArea(e)||de(t,i,e,function(r,l,c){!n&&!ut(r,t.chartArea,0)||r.inRange(e.x,e.y,s)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function Rr(t,e,i,s){let n=[];function o(a,r,l){const{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],s),{angle:d}=dn(a,{x:e.x,y:e.y});oe(d,c,h)&&n.push({element:a,datasetIndex:r,index:l})}return de(t,i,e,o),n}function Er(t,e,i,s,n,o){let a=[];const r=Lr(i);let l=Number.POSITIVE_INFINITY;function c(h,d,u){const f=h.inRange(e.x,e.y,n);if(s&&!f)return;const g=h.getCenterPoint(n);if(!(o||t.isPointInArea(g))&&!f)return;const m=r(e,g);m<l?(a=[{element:h,datasetIndex:d,index:u}],l=m):m===l&&a.push({element:h,datasetIndex:d,index:u})}return de(t,i,e,c),a}function Qe(t,e,i,s,n,o){return!o&&!t.isPointInArea(e)?[]:i==="r"&&!s?Rr(t,e,i,n):Er(t,e,i,s,n,o)}function ds(t,e,i,s,n){const o=[],a=i==="x"?"inXRange":"inYRange";let r=!1;return de(t,i,e,(l,c,h)=>
1{l[a]&&l[a](e[i],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(e.x,e.y,n))}),s&&!r?[]:o}var Ir={evaluateInteractionItems:de,modes:{index(t,e,i,s){const n=Ct(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Je(t,n,o,s,a):Qe(t,n,o,!1,s,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(t,e,i,s){const n=Ct(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Je(t,n,o,s,a):Qe(t,n,o,!1,s,a);if(r.length>0){const l=r[0].datasetIndex,c=t.getDatasetMeta(l).data;r=[];for(let h=0;h<c.length;++h)r.push({element:c[h],datasetIndex:l,index:h})}return r},point(t,e,i,s){return Je(t,Ct(e,t),i.axis||"xy",s,i.includeInvisible||!1)},nearest(t,e,i,s){const n=Ct(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return Qe(t,n,o,i.intersect,s,a)},x(t,e,i,s){return ds(t,Ct(e,t),"x",i.intersect,s)},y(t,e,i,s){return ds(t,Ct(e,t),"y",i.intersect,s)}}},Bn=["left","top","right","bottom"];function Yt(t,e){return t.filter(i=>i.pos===e)}function us(t,e){return t.filter(i=>Bn.indexOf(i.pos)===-1&&i.box.axis===e)}function Ut(t,e){return t.sort((i,s)=>{const n=e?s:i,o=e?i:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Fr(t){const e=[];let i,s,n,o,a,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],{position:o,options:{stack:a,stackWeight:r=1}}=n,e.push({index:i,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return e}function zr(t){const e={};for(const i of t){const{stack:s,pos:n,stackWeight:o}=i;if(!s||!Bn.includes(n))continue;const a=e[s]||(e[s]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return e}function Br(t,e){const i=zr(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:l}=r.box,c=i[r.stack],h=c&&r.stackWeight/c.weight;r.horizontal?(r.width=h?h*s:l&&e.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:l&&e.availableHeight)}return i}function Vr(t){const e=Fr(t),i=Ut(e.filter(c=>c.box.fullSize),!0),s=Ut(Yt(e,"left"),!0),n=Ut(Yt(e,"right")),o=Ut(Yt(e,"top"),!0),a=Ut(Yt(e,"bottom")),r=us(e,"x"),l=us(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Yt(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function fs(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function Vn(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 Wr(t,e,i,s){const{pos:n,box:o}=i,a=t.maxPadding;if(!A(n)){i.size&&(t[n]-=i.size);const d=s[i.stack]||{size:0,count:1};d.size=Math.max(d.size,i.horizontal?o.height:o.width),i.size=d.size/d.count,t[n]+=i.size}o.getPadding&&Vn(a,o.getPadding());const r=Math.max(0,e.outerWidth-fs(a,t,"left","right")),l=Math.max(0,e.outerHeight-fs(a,t,"top","bottom")),c=r!==t.w,h=l!==t.h;return t.w=r,t.h=l,i.horizontal?{same:c,other:h}:{same:h,other:c}}function Nr(t){const e=t.maxPadding;function i(s){const n=Math.max(e[s]-t[s],0);return t[s]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}function Hr(t,e){const i=e.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(e[a],i[a])}),o}return s(t?["left","right"]:["top","bottom"])}function Zt(t,e,i,s){const n=[];let o,a,r,l,c,h;for(o=0,a=t.length,c=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,Hr(r.horizontal,e));const{same:d,other:u}=Wr(e,i,r,s);c|=d&&n.length,h=h||u,l.fullSize||n.push(r)}return c&&Zt(n,e,i,s)||h}function ve(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function gs(t,e,i,s){const n=i.padding;let{x:o,y:a}=e;for(const r of t){const l=r.box,c=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/c.weight||1;if(r.horizontal){const d=e.w*h,u=c.size||l.height;ne(c.start)&&(a=c.start),l.fullSize?ve(l,n.left,a,i.outerWidth-n.right-n.left,u):ve(l,e.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom}else{const d=e.h*h,u=c.size||l.width;ne(c.start)&&(o=c.start),l.fullSize?ve(l,o,n.top,u,i.outerHeight-n.bottom-n.top):ve(l,o,e.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}e.x=o,e.y=a}
1var X={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(i){e.draw(i)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;i!==-1&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const n=K(t.options.layout.padding),o=Math.max(e-n.width,0),a=Math.max(i-n.height,0),r=Vr(t.boxes),l=r.vertical,c=r.horizontal;L(t.boxes,m=>{typeof m.beforeLayout=="function"&&m.beforeLayout()});const h=l.reduce((m,p)=>p.box.options&&p.box.options.display===!1?m:m+1,0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);Vn(u,K(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=Br(l.concat(c),d);Zt(r.fullSize,f,d,g),Zt(l,f,d,g),Zt(c,f,d,g)&&Zt(l,f,d,g),Nr(f),gs(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,gs(r.rightAndBottom,f,d,g),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},L(r.chartArea,m=>{const p=m.box;Object.assign(p,t.chartArea),p.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},Wn=class{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){}},jr=class extends Wn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},De="$chartjs",$r={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ps=t=>t===null||t==="";function Yr(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[De]={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",ps(n)){const o=Ji(t,"width");o!==void 0&&(t.width=o)}if(ps(s))if(t.style.height==="")t.height=t.width/(e||2);else{const o=Ji(t,"height");o!==void 0&&(t.height=o)}return t}var Nn=Va?{passive:!0}:!1;function Ur(t,e,i){t&&t.addEventListener(e,i,Nn)}function Xr(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,Nn)}function Kr(t,e){const i=$r[t.type]||t.type,{x:s,y:n}=Ct(t,e);return{type:i,chart:e,native:t,x:s!==void 0?s:null,y:n!==void 0?n:null}}function Ie(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function qr(t,e,i){const s=t.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||Ie(r.addedNodes,s),a=a&&!Ie(r.removedNodes,s);a&&i()});return n.observe(document,{childList:!0,subtree:!0}),n}function Gr(t,e,i){const s=t.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||Ie(r.removedNodes,s),a=a&&!Ie(r.addedNodes,s);a&&i()});return n.observe(document,{childList:!0,subtree:!0}),n}var re=new Map,ms=0;function Hn(){const t=window.devicePixelRatio;t!==ms&&(ms=t,re.forEach((e,i)=>{i.currentDevicePixelRatio!==t&&e()}))}function Zr(t,e){re.size||window.addEventListener("resize",Hn),re.set(t,e)}function Jr(t){re.delete(t),re.size||window.removeEventListener("resize",Hn)}function Qr(t,e,i){const s=t.canvas,n=s&&Ai(s);if(!n)return;const o=pn((r,l)=>{const c=n.clientWidth;i(r,l),c<n.clientWidth&&i()},window),a=new ResizeObserver(r=>{const l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),Zr(t,o),a}function ti(t,e,i){i&&i.disconnect(),e==="resize"&&Jr(t)}function tl(t,e,i){const s=t.canvas,n=pn(o=>{t.ctx!==null&&i(Kr(o,t))},t);return Ur(s,e,n),n}var el=class extends Wn{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Yr(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[De])return!1;const i=e[De].initial;["height","width"].forEach(n=>{const o=i[n];D(o)?e.removeAttribute(n):e.setAttribute(n,o)});const s=i.style||{};
1return Object.keys(s).forEach(n=>{e.style[n]=s[n]}),e.width=e.width,delete e[De],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={});s[e]=({attach:qr,detach:Gr,resize:Qr}[e]||tl)(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];s&&(({attach:ti,detach:ti,resize:ti}[e]||Xr)(t,e,s),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Ba(t,e,i,s)}isAttached(t){const e=t&&Ai(t);return!!(e&&e.isConnected)}};function il(t){return!Di()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?jr:el}var ft=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Bt(this.x)&&Bt(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach(n=>{s[n]=i[n]&&i[n].active()?i[n]._to:this[n]}),s}};function sl(t,e){const i=t.options.ticks,s=nl(t),n=Math.min(i.maxTicksLimit||s,s),o=i.major.enabled?al(e):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return rl(e,c,o,a/n),c;const h=ol(o,e,n);if(a>0){let d,u;const f=a>1?Math.round((l-r)/(a-1)):null;for(Me(e,c,h,D(f)?0:r-f,r),d=0,u=a-1;d<u;d++)Me(e,c,h,o[d],o[d+1]);return Me(e,c,h,l,D(f)?e.length:l+f),c}return Me(e,c,h),c}function nl(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}function ol(t,e,i){const s=ll(t),n=e.length/i;if(!s)return Math.max(n,1);const o=No(s);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>n)return l}return Math.max(n,1)}function al(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}function rl(t,e,i,s){let n=0,o=i[0],a;for(s=Math.ceil(s),a=0;a<t.length;a++)a===o&&(e.push(t[a]),n++,o=i[n*s])}function Me(t,e,i,s,n){const o=P(s,0),a=Math.min(P(n,t.length),t.length);let r=0,l,c,h;for(i=Math.ceil(i),n&&(l=n-s,i=l/Math.floor(l/i)),h=o;h<0;)r++,h=Math.round(o+r*i);for(c=Math.max(o,0);c<a;c++)c===h&&(e.push(t[c]),r++,h=Math.round(o+r*i))}function ll(t){const 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}var cl=t=>t==="left"?"right":t==="right"?"left":t,bs=(t,e,i)=>e==="top"||e==="left"?t[e]+i:t[e]-i,xs=(t,e)=>Math.min(e||t,t);function _s(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;o<n;o+=s)i.push(t[Math.floor(o)]);return i}function hl(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l=t.getPixelForTick(n),c;if(!(i&&(s===1?c=Math.max(l-o,a-l):e===0?c=(t.getPixelForTick(1)-l)/2:c=(l-t.getPixelForTick(n-1))/2,l+=n<e?c:-c,l<o-r||l>a+r)))return l}function dl(t,e){L(t,i=>{const s=i.gc,n=s.length/2;let o;if(n>e){for(o=0;o<n;++o)delete i.data[s[o]];s.splice(0,n)}})}function Xt(t){return t.drawTicks?t.tickLength:0}function ys(t,e){if(!t.display)return 0;const i=H(t.font,e),s=K(t.padding);return(I(t.text)?t.text.length:1)*i.lineHeight+s.height}function ul(t,e){return yt(t,{scale:e,type:"scale"})}function fl(t,e,i){return yt(t,{tick:i,index:e,type:"tick"})}function gl(t,e,i){let s=Mi(t);return(i&&e!=="right"||!i&&e==="right")&&(s=cl(s)),s}function pl(t,e,i,s){const{top:n,left:o,bottom:a,right:r,chart:l}=t,{chartArea:c,scales:h}=l;let d=0,u,f,g;const m=a-n,p=r-o;if(t.isHorizontal()){if(f=U(s,o,r),A(i)){const b=Object.keys(i)[0],x=i[b];g=h[b].getPixelForValue(x)+m-e}else i==="center"?g=(c.bottom+c.top)/2+m-e:g=bs(t,i,e);u=r-o}else{if(A(i)){const b=Object.keys(i)[0],x=i[b];f=h[b].getPixelForValue(x)-p+e}else i==="center"?f=(c.left+c.right)/2-p+e:f=bs(t,i,e);g=U(s,a,n),d=i==="left"?-N:N}return{titleX:f,titleY:g,maxWidth:u,rotation:d}}var ue=class jn extends ft{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.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(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,i){return e}getUserBounds(){let{_userMin:e,_userMax:i,_suggestedMin:s,_suggestedMax:n}=this;return e=Z(e,Number.POSITIVE_INFINITY),i=Z(i,Number.NEGATIVE_INFINITY),s=Z(s,Number.POSITIVE_INFINITY),n=Z(n,Number.NEGATIVE_INFINITY),{min:Z(e,s
vendor: 4,408 bytes, line 1
1),max:Z(i,n),minDefined:W(e),maxDefined:W(i)}}getMinMax(e){let{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),a;if(n&&o)return{min:i,max:s};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,e),n||(i=Math.min(i,a.min)),o||(s=Math.max(s,a.max));return i=o&&i>s?s:i,s=n&&i>s?i:s,{min:Z(i,Z(s,i)),max:Z(s,Z(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){E(this.options.beforeUpdate,[this])}update(e,i,s){const{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=i,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ma(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?_s(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=sl(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,i,s;this.isHorizontal()?(i=this.left,s=this.right):(i=this.top,s=this.bottom,e=!e),this._startPixel=i,this._endPixel=s,this._reversePixels=e,this._length=s-i,this._alignToPixels=this.options.alignToPixels}afterUpdate(){E(this.options.afterUpdate,[this])}beforeSetDimensions(){E(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(){E(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),E(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){E(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const i=this.options.ticks;let s,n,o;for(s=0,n=e.length;s<n;s++)o=e[s],o.label=E(i.callback,[o.value,s,e],this)}afterTickToLabelConversion(){E(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){E(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,i=e.ticks,s=xs(this.ticks.length,e.ticks.maxTicksLimit),n=i.minRotation||0,o=i.maxRotation;let a=n,r,l,c;if(!this._isVisible()||!i.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=j(this.chart.width-d,0,this.maxWidth);r=e.offset?this.maxWidth/s:f/(s-1),d+6>r&&(r=f/(s-(e.offset?.5:1)),l=this.maxHeight-Xt(e.grid)-i.padding-ys(e.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=yi(Math.min(Math.asin(j((h.highest.height+6)/r,-1,1)),Math.asin(j(l/c,-1,1))-Math.asin(j(u/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){E(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){E(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:i,options:{ticks:s,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=ys(n,i.options.font);if(r?(e.width=this.maxWidth,e.height=Xt(o)+l):(e.height=this.maxHeight,e.width=Xt(
1o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,g=tt(this.labelRotation),m=Math.cos(g),p=Math.sin(g);if(r){const b=s.mirror?0:p*d.width+m*u.height;e.height=Math.min(this.maxHeight,e.height+b+f)}else{const b=s.mirror?0:m*d.width+p*u.height;e.width=Math.min(this.maxWidth,e.width+b+f)}this._calculatePadding(c,h,p,m)}}this._handleMargins(),r?(this.width=this._length=i.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=i.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,i,s,n){const{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=n*e.width,f=s*i.height):(u=s*e.height,f=n*i.width):o==="start"?f=i.width:o==="end"?u=e.width:o!=="inner"&&(u=e.width/2,f=i.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=i.height/2,d=e.height/2;o==="start"?(h=0,d=e.height):o==="end"&&(h=i.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_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:e,position:i}=this.options;return i==="top"||i==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let i,s;for(i=0,s=e.length;i<s;i++)D(e[i].label)&&(e.splice(i,1),s--,i--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const i=this.options.ticks.sampleSize;let s=this.ticks;i<s.length&&(s=_s(s,i)),this._labelSizes=e=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,i,s){const{ctx:n,_longestTextCache:o}=this,a=[],r=[],l=Math.floor(i/xs(i,s));let c=0,h=0,d,u,f,g,m,p,b,x,v,y,_;for(d=0;d<i;d+=l){if(g=e[d].label,m=this._resolveTickFontOptions(d),n.font=p=m.string,b=o[p]=o[p]||{data:{},gc:[]},x=m.lineHeight,v=y=0,!D(g)&&!I(g))v=Re(n,b.data,b.gc,v,g),y=x;else if(I(g))for(u=0,f=g.length;u<f;++u)_=g[u],!D(_)&&!I(_)&&(v=Re(n,b.data,b.gc,v,_),y+=x);a.push(v),r.push(y),c=Math.max(v,c),h=Math.max(y,h)}dl(o,i);const k=a.indexOf(c),M=r.indexOf(h),w=S=>({width:a[S]||0,height:r[S]||0});return{first:w(0),last:w(i-1),widest:w(k),highest:w(M),widths:a,heights:r}}getLabelForValue(e){return e}getPixelForValue(e,i){return NaN}getValueForPixel(e){}getPixelForTick(e){const i=this.ticks;return e<0||e>i.length-1?null:this.getPixelForValue(i[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const i=this._startPixel+e*this._length;return Yo(this._alignToPixels?wt(this.chart,i,0):i)}getDecimalForPixel(e){const i=(e-this._startPixel)/this._length;return this._reversePixels?1-i:i}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:i}=this;return e<0&&i<0?i:e>0&&i>0?e:0}getContext(e){const i=this.ticks||[];if(e>=0&&e<i.length){const s=i[e];return s.$context||(s.$context=fl(this.getContext(),e,s))}return this.$context||(this.$context=ul(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,i=tt(this.labelRotation),s=Math.abs(Math.cos(i)),n=Math.abs(Math.sin(i)),o=this._getLabelSizes(),a=e.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*s>r*n?r/s:l/n:l*n<r*s?l/s:r/n}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const i=this.axis,s=this.chart,n=this.options,{grid:o,position:a,border:r}=n,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),d=Xt(o),u=[],f=r.setContext(this.getContext()),g=f.display?f.width:0,m=g/2,p=function(O){return wt(s,O,g)};let b,x,v,y,_,k,M,w,S,C,T,R;if(a==="top")b=p(this.bottom),k=this.bottom-d,w=b-m,C=p(e.top)+m,R=e.bottom;else if(a==="bottom")b=p(this.top),C=e.top,R=p(e.bottom)-m,k=b+m,w=this.top+d;else if(a==="left")b=p(this.right),_=this.right-d,M=b-m,S=p(e.left)+m,T=e.right;else if(a==="right")b=p(this.left),S=e.left,T=p(e.right)-m,_=b+m,M=this.left+d;else if(i==="x"){if(a==="center")b=p((e.top+e.bottom)/2+.5);else if(A(a)){const O=Object.keys(a)[0],V=a[O];b=p(this.chart.scales[O].getPixelForValue(V))}C=e.top,R=e.bottom,k=b+m,w=k+d}else if(i==="y"){if(a==="center")b=p((e.left+e.right)/2);else if(A(a)){const O=Object.keys(a)[0],V=a[O];b=p(this.chart.scales[O].getPixelForValue(V))}_=b-m,M=_-d,S=e.left,T=e.right}const nt=P(n.ticks.maxTicksLimit,h),$=Math.max(1,Math.ceil(h/nt));for(x=0;x<h;x+=$){const O=this.getContext(x),V=o.setContext(O),ot=r.setContext(O),Y=V.lineWidth,$e=V.color,Rt=ot.dash||[],fe=ot.dashOffset,Et=V.tickWidth,Nt=V.tickColor,Mt=V.tickBorderDash||[],Ht=V.tickBorderDashOffset;v=hl(this,x,l),v!==void 0&&(y=wt(s,v,Y),c?_=M=S=T=y:k=w=C=R=y,u.push({tx1:_,ty1:k,tx2:M,ty2:w,x1:S,y1:C,x2:T,
1y2:R,width:Y,color:$e,borderDash:Rt,borderDashOffset:fe,tickWidth:Et,tickColor:Nt,tickBorderDash:Mt,tickBorderDashOffset:Ht}))}return this._ticksLength=h,this._borderValue=b,u}_computeLabelItems(e){const i=this.axis,s=this.options,{position:n,ticks:o}=s,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=Xt(s.grid),f=u+h,g=d?-h:f,m=-tt(this.labelRotation),p=[];let b,x,v,y,_,k,M,w,S,C,T,R,nt="middle";if(n==="top")k=this.bottom-g,M=this._getXAxisLabelAlignment();else if(n==="bottom")k=this.top+g,M=this._getXAxisLabelAlignment();else if(n==="left"){const O=this._getYAxisLabelAlignment(u);M=O.textAlign,_=O.x}else if(n==="right"){const O=this._getYAxisLabelAlignment(u);M=O.textAlign,_=O.x}else if(i==="x"){if(n==="center")k=(e.top+e.bottom)/2+f;else if(A(n)){const O=Object.keys(n)[0],V=n[O];k=this.chart.scales[O].getPixelForValue(V)+f}M=this._getXAxisLabelAlignment()}else if(i==="y"){if(n==="center")_=(e.left+e.right)/2-f;else if(A(n)){const O=Object.keys(n)[0],V=n[O];_=this.chart.scales[O].getPixelForValue(V)}M=this._getYAxisLabelAlignment(u).textAlign}i==="y"&&(l==="start"?nt="top":l==="end"&&(nt="bottom"));const $=this._getLabelSizes();for(b=0,x=r.length;b<x;++b){v=r[b],y=v.label;const O=o.setContext(this.getContext(b));w=this.getPixelForTick(b)+o.labelOffset,S=this._resolveTickFontOptions(b),C=S.lineHeight,T=I(y)?y.length:1;const V=T/2,ot=O.color,Y=O.textStrokeColor,$e=O.textStrokeWidth;let Rt=M;a?(_=w,M==="inner"&&(b===x-1?Rt=this.options.reverse?"left":"right":b===0?Rt=this.options.reverse?"right":"left":Rt="center"),n==="top"?c==="near"||m!==0?R=-T*C+C/2:c==="center"?R=-$.highest.height/2-V*C+C:R=-$.highest.height+C/2:c==="near"||m!==0?R=C/2:c==="center"?R=$.highest.height/2-V*C:R=$.highest.height-T*C,d&&(R*=-1),m!==0&&!O.showLabelBackdrop&&(_+=C/2*Math.sin(m))):(k=w,R=(1-T)*C/2);let fe;if(O.showLabelBackdrop){const Et=K(O.backdropPadding),Nt=$.heights[b],Mt=$.widths[b];let Ht=R-Et.top,jt=0-Et.left;switch(nt){case"middle":Ht-=Nt/2;break;case"bottom":Ht-=Nt;break}switch(M){case"center":jt-=Mt/2;break;case"right":jt-=Mt;break;case"inner":b===x-1?jt-=Mt:b>0&&(jt-=Mt/2);break}fe={left:jt,top:Ht,width:Mt+Et.width,height:Nt+Et.height,color:O.backdropColor}}p.push({label:y,font:S,textOffset:R,options:{rotation:m,color:ot,strokeColor:Y,strokeWidth:$e,textAlign:Rt,textBaseline:nt,translation:[_,k],backdrop:fe}})}return p}_getXAxisLabelAlignment(){const{position:e,ticks:i}=this.options;if(-tt(this.labelRotation))return e==="top"?"left":"right";let s="center";return i.align==="start"?s="left":i.align==="end"?s="right":i.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(e){const{position:i,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,a=this._getLabelSizes(),r=e+o,l=a.widest.width;let c,h;return i==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-r,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):i==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+r,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,i=this.options.position;if(i==="left"||i==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};
1if(i==="top"||i==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:i},left:s,top:n,width:o,height:a}=this;i&&(e.save(),e.fillStyle=i,e.fillRect(s,n,o,a),e.restore())}getLineWidthForValue(e){const i=this.options.grid;if(!this._isVisible()||!i.display)return 0;const s=this.ticks.findIndex(n=>n.value===e);return s>=0?i.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const i=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let o,a;const r=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(i.display)for(o=0,a=n.length;o<a;++o){const l=n[o];i.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),i.drawTicks&&r({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:i,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),a=s.display?o.width:0;if(!a)return;const r=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,d,u;this.isHorizontal()?(c=wt(e,this.left,a)-a/2,h=wt(e,this.right,r)+r/2,d=u=l):(d=wt(e,this.top,a)-a/2,u=wt(e,this.bottom,r)+r/2,c=h=l),i.save(),i.lineWidth=o.width,i.strokeStyle=o.color,i.beginPath(),i.moveTo(c,d),i.lineTo(h,u),i.stroke(),i.restore()}drawLabels(e){if(!this.options.ticks.display)return;const i=this.ctx,s=this._computeLabelArea();s&&Ve(i,s);const n=this.getLabelItems(e);for(const o of n){const a=o.options,r=o.font,l=o.label,c=o.textOffset;Lt(i,l,0,c,r,a)}s&&We(i)}drawTitle(){const{ctx:e,options:{position:i,title:s,reverse:n}}=this;if(!s.display)return;const o=H(s.font),a=K(s.padding),r=s.align;let l=o.lineHeight/2;i==="bottom"||i==="center"||A(i)?(l+=a.bottom,I(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=a.top;const{titleX:c,titleY:h,maxWidth:d,rotation:u}=pl(this,l,i,r);Lt(e,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:u,textAlign:gl(r,i,n),textBaseline:"middle",translation:[c,h]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,i=e.ticks&&e.ticks.z||0,s=P(e.grid&&e.grid.z,-1),n=P(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==jn.prototype.draw?[{z:i,draw:o=>{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:i,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){const i=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,a;for(o=0,a=i.length;o<a;++o){const r=i[o];r[s]===this.id&&(!e||r.type===e)&&n.push(r)}return n}_resolveTickFontOptions(e){return H(this.options.ticks.setContext(this.getContext(e)).font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}},ke=class{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){const e=Object.getPrototypeOf(t);let i;xl(e)&&(i=this.register(e));const s=this.items,n=t.id,o=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,ml(t,o,i),this.override&&B.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in B[s]&&(delete B[s][i],this.override&&delete Tt[i])}};function ml(t,e,i){const s=se(Object.create(null),[i?B.get(i):{},B.get(e),t.defaults]);B.set(e,s),t.defaultRoutes&&bl(e,t.defaultRoutes),t.descriptors&&B.describe(e,t.descriptors)}function bl(t,e){Object.keys(e).forEach(i=>{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");B.route(o,n,l,r)})}function xl(t){return"id"in t&&"defaults"in t}var _l=class{constructor(){this.controllers=new ke(vt,"datasets",!0),this.elements=new ke(ft,"elements"),this.plugins=new ke(Object,"plugins"),this.scales=new ke(ue,"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")}
1removeControllers(...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(s=>{const n=i||this._getRegistryForType(s);i||n.isForType(s)||n===this.plugins&&s.id?this._exec(t,n,s):L(s,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,e,i){const s=_i(t);E(i["before"+s],[],i),e[t](i),E(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}},it=new _l,yl=class{constructor(){this._init=[]}notify(t,e,i,s){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(n,t,e,i);return e==="afterDestroy"&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const n of t){const o=n.plugin,a=o[i];if(E(a,[e,s,n.options],o)===!1&&s.cancelable)return!1}return!0}invalidate(){D(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=P(i.options&&i.options.plugins,{}),n=vl(i);return s===!1&&!e?[]:kl(t,n,s,e)}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(n,o)=>n.filter(a=>!o.some(r=>a.plugin.id===r.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};function vl(t){const e={},i=[],s=Object.keys(it.plugins.items);for(let o=0;o<s.length;o++)i.push(it.getPlugin(s[o]));const n=t.plugins||[];for(let o=0;o<n.length;o++){const a=n[o];i.indexOf(a)===-1&&(i.push(a),e[a.id]=!0)}return{plugins:i,localIds:e}}function Ml(t,e){return!e&&t===!1?null:t===!0?{}:t}function kl(t,{plugins:e,localIds:i},s,n){const o=[],a=t.getContext();for(const r of e){const l=r.id,c=Ml(s[l],n);c!==null&&o.push({plugin:r,options:wl(t.config,{plugin:r,local:i[l]},c,a)})}return o}function wl(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(s,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ci(t,e){const i=B.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Sl(t,e){let i=t;return t==="_index_"?i=e:t==="_value_"&&(i=e==="x"?"y":"x"),i}function Pl(t,e){return t===e?"_index_":"_value_"}function vs(t){if(t==="x"||t==="y"||t==="r")return t}function Cl(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function hi(t,...e){if(vs(t))return t;for(const i of e){const s=i.axis||Cl(i.position)||t.length>1&&vs(t[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Ms(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function Dl(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter(s=>s.xAxisID===t||s.yAxisID===t);if(i.length)return Ms(t,"x",i[0])||Ms(t,"y",i[0])}return{}}function Al(t,e){const i=Tt[t.type]||{scales:{}},s=e.scales||{},n=ci(t.type,e),o=Object.create(null);return Object.keys(s).forEach(a=>{const r=s[a];if(!A(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=hi(a,r,Dl(a,t),B.scales[r.type]),c=Pl(l,n),h=i.scales||{};o[a]=Qt(Object.create(null),[{axis:l},r,h[l],h[c]])}),t.data.datasets.forEach(a=>{const r=a.type||t.type,l=a.indexAxis||ci(r,e),c=(Tt[r]||{}).scales||{};Object.keys(c).forEach(h=>{const d=Sl(h,l),u=a[d+"AxisID"]||d;o[u]=o[u]||Object.create(null),Qt(o[u],[{axis:d},s[u],c[h]])})}),Object.keys(o).forEach(a=>{const r=o[a];Qt(r,[B.scales[r.type],B.scale])}),o}function $n(t){const e=t.options||(t.options={});e.plugins=P(e.plugins,{}),e.scales=Al(t,e)}function Yn(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function Ol(t){return t=t||{},t.data=Yn(t.data),$n(t),t}var ks=new Map,Un=new Set;function we(t,e){let i=ks.get(t);
1return i||(i=e(),ks.set(t,i),Un.add(i)),i}var Kt=(t,e,i)=>{const s=xt(e,i);s!==void 0&&t.add(s)},Tl=class{constructor(t){this._config=Ol(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=Yn(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(),$n(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return we(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return we(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return we(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,i=this.type;return we(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach(c=>{t&&(r.add(t),c.forEach(h=>Kt(r,t,h))),c.forEach(h=>Kt(r,s,h)),c.forEach(h=>Kt(r,Tt[n]||{},h)),c.forEach(h=>Kt(r,B,h)),c.forEach(h=>Kt(r,ri,h))});const l=Array.from(r);return l.length===0&&l.push(Object.create(null)),Un.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,Tt[e]||{},B.datasets[e]||{},{type:e},B,ri]}resolveNamedOptions(t,e,i,s=[""]){const n={$shared:!0},{resolver:o,subPrefixes:a}=ws(this._resolverCache,t,s);let r=o;if(Rl(o,e)){n.$shared=!1,i=_t(i)?i():i;const l=this.createResolver(t,i,a);r=Vt(o,i,l)}for(const l of e)n[l]=r[l];return n}createResolver(t,e,i=[""],s){const{resolver:n}=ws(this._resolverCache,t,i);return A(e)?Vt(n,e,void 0,s):n}};function ws(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);return o||(o={resolver:Si(e,i),subPrefixes:i.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}var Ll=t=>A(t)&&Object.getOwnPropertyNames(t).some(e=>_t(t[e]));function Rl(t,e){const{isScriptable:i,isIndexable:s}=vn(t);for(const n of e){const o=i(n),a=s(n),r=(a||o)&&t[n];if(o&&(_t(r)||Ll(r))||a&&I(r))return!0}return!1}var El="4.4.9",Il=["top","bottom","left","right","chartArea"];function Ss(t,e){return t==="top"||t==="bottom"||Il.indexOf(t)===-1&&e==="x"}function Ps(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function Cs(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),E(i&&i.onComplete,[t],e)}function Fl(t){const e=t.chart,i=e.options.animation;E(i&&i.onProgress,[t],e)}function Xn(t){return Di()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}var Ae={},Ds=t=>{const e=Xn(t);return Object.values(Ae).filter(i=>i.canvas===e).pop()};function zl(t,e,i){const s=Object.keys(t);for(const n of s){const o=+n;if(o>=e){const a=t[n];delete t[n],(i>0||o>e)&&(t[o+i]=a)}}}function Bl(t,e,i,s){return!i||t.type==="mouseout"?null:s?e:t}var Ti=class{static defaults=B;static instances=Ae;static overrides=Tt;static registry=it;static version=El;static getChart=Ds;static register(...t){it.add(...t),As()}static unregister(...t){it.remove(...t),As()}constructor(t,e){const i=this.config=new Tl(e),s=Xn(t),n=Ds(s);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||il(s)),this.platform.updateConfig(i);const a=this.platform.acquireContext(s,o.aspectRatio),r=a&&a.canvas,l=r&&r.height,c=r&&r.width;if(this.id=Lo(),this.ctx=a,this.canvas=r,this.width=c,this.height=l,this._options=o,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 yl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=qo(h=>this.update(h),o.resizeDelay||0),this._dataChanges=[],Ae[this.id]=this,!a||!r){console.error("Failed to create chart: can't acquire context from the given item");return}rt.listen(this,"complete",Cs),rt.listen(this,"progress",Fl),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:n}=this;return D(t)?e&&n?n: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 it}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Zi(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ki(this.canvas,this.ctx),this}stop(){return rt.stop(this),this}resize(t,e){rt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Zi(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),E(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){L(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let n=[];e&&(n=n.concat(Object.keys(e).map(o=>{const a=e[o],r=hi(o,a),l=r==="r",c=r==="x";return{options:a,dposition:l?"chartArea":c?"bottom":"left",dtype:l?"radialLinear":c?"category":"linear"}}))),L(n,o=>{const a=o.options,r=a.id,l=hi(r,a),c=P(a.type,o.dtype);(a.position===void 0||Ss(a.position,l)!==Ss(o.dposition))&&(a.position=o.dposition),s[r]=!0;let h=null;r in i&&i[r].type===c?h=i[r]:(h=new(it.getScale(c))({id:r,type:c,ctx:this.ctx,
1chart:this}),i[h.id]=h),h.init(a,t)}),L(s,(o,a)=>{o||delete i[a]}),L(i,o=>{X.configure(this,o,o.options),X.addBox(this,o)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,n)=>s.index-n.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Ps("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(n=>n===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const n=e[i];let o=this.getDatasetMeta(i);const a=n.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=a,o.indexAxis=n.indexAxis||ci(a,this.options),o.order=n.order||0,o.index=i,o.label=""+n.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const r=it.getController(a),{datasetElementType:l,dataElementType:c}=B.datasets[a];Object.assign(r,{dataElementType:it.getElement(c),datasetElementType:l&&it.getElement(l)}),o.controller=new r(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){L(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let l=0,c=this.data.datasets.length;l<c;l++){const{controller:h}=this.getDatasetMeta(l),d=!s&&n.indexOf(h)===-1;h.buildOrUpdateElements(d),o=Math.max(+h.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||L(n,l=>{l.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ps("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){L(this.scales,t=>{X.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options;(!Vi(new Set(Object.keys(this._listeners)),new Set(t.events))||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e)zl(t,s,i==="_removeElements"?-n:n)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=n=>new Set(t.filter(o=>o[0]===n).map((o,a)=>a+","+o.splice(1).join(","))),s=i(0);for(let n=1;n<e;n++)if(!Vi(s,i(n)))return;return Array.from(s).map(n=>n.split(",")).map(n=>({method:n[1],start:+n[2],count:+n[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;X.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],L(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,n)=>{s._idx=n}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,_t(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(rt.has(this)?this.attached&&!rt.running(this)&&rt.start(this):(this.draw(),Cs({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:i,height:s}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(i,s)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;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){const e=this._sortedMetasets,i=[];let s,n;for(s=0,n=e.length;s<n;++s){const o=e[s];(!t||o.visible)&&i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Ln(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&Ve(e,s),t.controller.draw(),s&&We(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return ut(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Ir.modes[e];return typeof n=="function"?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter(n=>n&&n._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=yt(null,{chart:this,type:"chart"}))}
1getVisibleDatasetCount(){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 s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);ne(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update(a=>a.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),rt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ki(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Ae[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 t=this._listeners,e=this.platform,i=(n,o)=>{e.addEventListener(this,n,o),t[n]=o},s=(n,o,a)=>{n.offsetX=o,n.offsetY=a,this._eventHandler(n)};L(this.options.events,n=>i(n,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(r,l)=>{e.addEventListener(this,r,l),t[r]=l},s=(r,l)=>{t[r]&&(e.removeEventListener(this,r,l),delete t[r])},n=(r,l)=>{this.canvas&&this.resize(r,l)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){L(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},L(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for(e==="dataset"&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){o=t[a];const l=o&&this.getDatasetMeta(o.datasetIndex).controller;l&&l[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map(({datasetIndex:s,index:n})=>{const o=this.getDatasetMeta(s);if(!o)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:o.data[n],index:n}});Oe(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 s=this.options.hover,n=(r,l)=>r.filter(c=>!l.some(h=>c.datasetIndex===h.datasetIndex&&c.index===h.index)),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=Bo(t),l=Bl(t,this._lastEvent,i,r);i&&(this._lastEvent=null,E(n.onHover,[t,a,this],this),r&&E(n.onClick,[t,a,this],this));const c=!Oe(a,s);return(c||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}};function As(){return L(Ti.instances,t=>t._plugins.invalidate())}function Vl(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=e;let c=n/r;t.beginPath(),t.arc(o,a,r,s-c,i+c),l>n?(c=n/l,t.arc(o,a,l,i+c,s-c,!0)):t.arc(o,a,n,i+N,s-N),t.closePath(),t.clip()}function Wl(t){return wi(t,["outerStart","outerEnd","innerStart","innerEnd"])}function Nl(t,e,i,s){const n=Wl(t.options.borderRadius),o=(i-e)/2,a=Math.min(o,s*e/2),r=l=>{const c=(i-Math.min(o,l))*s/2;return j(l,0,Math.min(o,c))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:j(n.innerStart,0,a),innerEnd:j(n.innerEnd,0,a)}}function Ft(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Fe(t,e,i,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=e,d=Math.max(e.outerRadius+s+i-c,0),u=h>0?h+s+i+c:0;let f=0;const g=n-l;if(s){const $=((h>0?h-s:0)+(d>0?d-s:0))/2;f=(g-($!==0?g*$/($+s):g))/2}
1const m=(g-Math.max(.001,g*d-i/z)/d)/2,p=l+m+f,b=n-m-f,{outerStart:x,outerEnd:v,innerStart:y,innerEnd:_}=Nl(e,u,d,b-p),k=d-x,M=d-v,w=p+x/k,S=b-v/M,C=u+y,T=u+_,R=p+y/C,nt=b-_/T;if(t.beginPath(),o){const $=(w+S)/2;if(t.arc(a,r,d,w,$),t.arc(a,r,d,$,S),v>0){const Y=Ft(M,S,a,r);t.arc(Y.x,Y.y,v,S,b+N)}const O=Ft(T,b,a,r);if(t.lineTo(O.x,O.y),_>0){const Y=Ft(T,nt,a,r);t.arc(Y.x,Y.y,_,b+N,nt+Math.PI)}const V=(b-_/u+(p+y/u))/2;if(t.arc(a,r,u,b-_/u,V,!0),t.arc(a,r,u,V,p+y/u,!0),y>0){const Y=Ft(C,R,a,r);t.arc(Y.x,Y.y,y,R+Math.PI,p-N)}const ot=Ft(k,p,a,r);if(t.lineTo(ot.x,ot.y),x>0){const Y=Ft(k,w,a,r);t.arc(Y.x,Y.y,x,p-N,w)}}else{t.moveTo(a,r);const $=Math.cos(w)*d+a,O=Math.sin(w)*d+r;t.lineTo($,O);const V=Math.cos(S)*d+a,ot=Math.sin(S)*d+r;t.lineTo(V,ot)}t.closePath()}function Hl(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){Fe(t,e,i,s,l,n);for(let c=0;c<o;++c)t.fill();isNaN(r)||(l=a+(r%F||F))}return Fe(t,e,i,s,l,n),t.fill(),l}function jl(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,f=l.borderAlign==="inner";if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=u,f?(t.lineWidth=c*2,t.lineJoin=h||"round"):(t.lineWidth=c,t.lineJoin=
1h||"bevel");let g=e.endAngle;if(o){Fe(t,e,i,s,g,n);for(let m=0;m<o;++m)t.stroke();isNaN(r)||(g=a+(r%F||F))}f&&Vl(t,e,g),o||(Fe(t,e,i,s,g,n),t.stroke())}var $l=class extends ft{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=>t!=="borderDash"};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){const{angle:s,distance:n}=dn(this.getProps(["x","y"],i),{x:t,y:e}),{startAngle:o,endAngle:a,innerRadius:r,outerRadius:l,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),h=(this.options.spacing+this.options.borderWidth)/2,d=P(c,a-o),u=oe(s,o,a)&&o!==a,f=d>=F||u,g=ht(n,r+h,l+h);return f&&g}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:l}=this.options,c=(s+n)/2,h=(o+a+l+r)/2;return{x:e+Math.cos(c)*h,y:i+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>F?Math.floor(i/F):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const r=s*(1-Math.sin(Math.min(z,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,Hl(t,this,r,n,o),jl(t,this,r,n,o),t.restore()}};function Kn(t,e,i=e){t.lineCap=P(i.borderCapStyle,e.borderCapStyle),t.setLineDash(P(i.borderDash,e.borderDash)),t.lineDashOffset=P(i.borderDashOffset,e.borderDashOffset),t.lineJoin=P(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=P(i.borderWidth,e.borderWidth),t.strokeStyle=P(i.borderColor,e.borderColor)}function Yl(t,e,i){t.lineTo(i.x,i.y)}function Ul(t){return t.stepped?ra:t.tension||t.cubicInterpolationMode==="monotone"?la:Yl}function qn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,l=Math.max(n,a),c=Math.min(o,r),h=n<a&&o<a||n>r&&o>r;
1return{count:s,start:l,loop:e.loop,ilen:c<l&&!h?s+c-l:c-l}}function Xl(t,e,i,s){const{points:n,options:o}=e,{count:a,start:r,loop:l,ilen:c}=qn(n,i,s),h=Ul(o);let{move:d=!0,reverse:u}=s||{},f,g,m;for(f=0;f<=c;++f)g=n[(r+(u?c-f:f))%a],!g.skip&&(d?(t.moveTo(g.x,g.y),d=!1):h(t,m,g,u,o.stepped),m=g);return l&&(g=n[(r+(u?c:0))%a],h(t,m,g,u,o.stepped)),!!l}function Kl(t,e,i,s){const n=e.points,{count:o,start:a,ilen:r}=qn(n,i,s),{move:l=!0,reverse:c}=s||{};let h=0,d=0,u,f,g,m,p,b;const x=y=>(a+(c?r-y:y))%o,v=()=>{m!==p&&(t.lineTo(h,p),t.lineTo(h,m),t.lineTo(h,b))};for(l&&(f=n[x(0)],t.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=n[x(u)],f.skip)continue;const y=f.x,_=f.y,k=y|0;k===g?(_<m?m=_:_>p&&(p=_),h=(d*h+y)/++d):(v(),t.lineTo(y,_),g=k,d=0,m=p=_),b=_}v()}function di(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!i?Kl:Xl}function ql(t){return t.stepped?Wa:t.tension||t.cubicInterpolationMode==="monotone"?Na:Dt}function Gl(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),Kn(t,e.options),t.stroke(n)}function Zl(t,e,i,s){const{segments:n,options:o}=e,a=di(e);for(const r of n)Kn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}var Jl=typeof Path2D=="function";function Ql(t,e,i,s){Jl&&!e.options.segment?Gl(t,e,i,s):Zl(t,e,i,s)}var He=class extends ft{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=>t!=="borderDash"&&t!=="fill"};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 s=i.spanGaps?this._loop:this._fullLoop;La(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Xa(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=Tn(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=ql(i);let l,c;for(l=0,c=o.length;l<c;++l){const{start:h,end:d}=o[l],u=n[h],f=n[d];if(u===f){a.push(u);continue}const g=r(u,f,Math.abs((s-u[e])/(f[e]-u[e])),i.stepped);g[e]=t[e],a.push(g)}return a.length===1?a[0]:a}pathSegment(t,e,i){return di(this)(t,this,e,i)}path(t,e,i){const s=this.segments,n=di(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)o&=n(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,s){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),Ql(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};function Os(t,e,i,s){const n=t.options,{[i]:o}=t.getProps([i],s);return Math.abs(e-o)<n.radius+n.hitRadius}var tc=class extends ft{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){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return Os(this,t,"x",e)}inYRange(t,e){return Os(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);const i=e&&t.borderWidth||0;return(e+i)*2}draw(t,e){const i=this.options;this.skip||i.radius<.1||!ut(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,li(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}};function Gn(t,e){const{x:i,y:s,base:n,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,c,h,d;return t.horizontal?(d=a/2,r=Math.min(i,n),l=Math.max(i,n),c=s-d,h=s+d):(d=o/2,r=i-d,l=i+d,c=Math.min(s,n),h=Math.max(s,n)),{left:r,top:c,right:l,bottom:h}}function mt(t,e,i,s){return t?0:j(e,i,s)}
1function ec(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,o=yn(s);return{t:mt(n.top,o.top,0,i),r:mt(n.right,o.right,0,e),b:mt(n.bottom,o.bottom,0,i),l:mt(n.left,o.left,0,e)}}function ic(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,o=At(n),a=Math.min(e,i),r=t.borderSkipped,l=s||A(n);return{topLeft:mt(!l||r.top||r.left,o.topLeft,0,a),topRight:mt(!l||r.top||r.right,o.topRight,0,a),bottomLeft:mt(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:mt(!l||r.bottom||r.right,o.bottomRight,0,a)}}function sc(t){const e=Gn(t),i=e.right-e.left,s=e.bottom-e.top,n=ec(t,i/2,s/2),o=ic(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:o},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function ei(t,e,i,s){const n=e===null,o=i===null,a=t&&!(n&&o)&&Gn(t,s);return a&&(n||ht(e,a.left,a.right))&&(o||ht(i,a.top,a.bottom))}function nc(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function oc(t,e){t.rect(e.x,e.y,e.w,e.h)}function ii(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-s,a=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+o,h:t.h+a,radius:t.radius}}var ac=class extends ft{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){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:n,outer:o}=sc(this),a=nc(o.radius)?ae:oc;t.save(),(o.w!==n.w||o.h!==n.h)&&(t.beginPath(),a(t,ii(o,e,n)),t.clip(),a(t,ii(n,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,ii(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return ei(this,t,e,i)}inXRange(t,e){return ei(this,t,null,e)}inYRange(t,e){return ei(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}},rc=Object.freeze({__proto__:null,ArcElement:$l,BarElement:ac,LineElement:He,PointElement:tc}),ui=["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)"],Ts=ui.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function Zn(t){return ui[t%ui.length]}function Jn(t){return Ts[t%Ts.length]}function lc(t,e){return t.borderColor=Zn(e),t.backgroundColor=Jn(e),++e}function cc(t,e){return t.backgroundColor=t.data.map(()=>Zn(e++)),e}function hc(t,e){return t.backgroundColor=t.data.map(()=>Jn(e++)),e}function dc(t){let e=0;return(i,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof Oi?e=cc(i,e):n instanceof Fn?e=hc(i,e):n&&(e=lc(i,e))}}function Ls(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}function uc(t){return t&&(t.borderColor||t.backgroundColor)}function fc(){return B.borderColor!=="rgba(0,0,0,0.1)"||B.backgroundColor!=="rgba(0,0,0,0.1)"}var gc={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:s},options:n}=t.config,{elements:o}=n,a=Ls(s)||uc(n)||o&&Ls(o)||fc();if(!i.forceOverride&&a)return;const r=dc(t);s.forEach(r)}};function pc(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const c=e+i-1;let h=e,d,u,f,g,m;for(a[l++]=t[h],d=0;d<o-2;d++){let p=0,b=0,x;const v=Math.floor((d+1)*r)+1+e,y=Math.min(Math.floor((d+2)*r)+1,i)+e,_=y-v;for(x=v;x<y;x++)p+=t[x].x,b+=t[x].y;p/=_,b/=_;const k=Math.floor(d*r)+1+e,M=Math.min(Math.floor((d+1)*r)+1,i)+e,{x:w,y:S}=t[h];for(f=g=-1,x=k;x<M;x++)g=.5*Math.abs((w-p)*(t[x].y-S)-(w-t[x].x)*(b-S)),g>f&&(f=g,u=t[x],m=x);a[l++]=u,h=m}return a[l++]=t[c],a}function mc(t,e,i,s){let n=0,o=0,a,r,l,c,h,d,u,f,g,m;const p=[],b=e+i-1,x=t[e].x,v=t[b].x-x;for(a=e;a<e+i;++a){r=t[a],l=(r.x-x)/v*s,c=r.y;const y=l|0;if(y===h)c<g?(g=c,d=a):c>
1m&&(m=c,u=a),n=(o*n+r.x)/++o;else{const _=a-1;if(!D(d)&&!D(u)){const k=Math.min(d,u),M=Math.max(d,u);k!==f&&k!==_&&p.push({...t[k],x:n}),M!==f&&M!==_&&p.push({...t[M],x:n})}a>0&&_!==f&&p.push(t[_]),p.push(r),h=y,o=0,g=m=c,d=u=f=a}}return p}function Qn(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function Rs(t){t.data.datasets.forEach(e=>{Qn(e)})}function bc(t,e){const i=e.length;let s=0,n;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(s=j(dt(e,o.axis,a).lo,0,i-1)),c?n=j(dt(e,o.axis,r).hi+1,s,i)-s:n=i-s,{start:s,count:n}}var xc={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled){Rs(t);return}const s=t.width;t.data.datasets.forEach((n,o)=>{const{_data:a,indexAxis:r}=n,l=t.getDatasetMeta(o),c=a||n.data;if(Gt([r,t.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const h=t.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||t.options.parsing)return;let{start:d,count:u}=bc(l,c);if(u<=(i.threshold||4*s)){Qn(n);return}D(a)&&(n._data=c,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let f;switch(i.algorithm){case"lttb":f=pc(c,d,u,s,i);break;case"min-max":f=mc(c,d,u,s);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}n._decimated=f})},destroy(t){Rs(t)}};function _c(t,e,i){const s=t.segments,n=t.points,o=e.points,a=[];for(const r of s){let{start:l,end:c}=r;c=Li(l,c,n);const h=fi(i,n[l],n[c],r.loop);if(!e.segments){a.push({source:r,target:h,start:n[l],end:n[c]});continue}const d=Tn(e,h);for(const u of d){const f=fi(i,o[u.start],o[u.end],u.loop),g=On(r,n,f);for(const m of g)a.push({source:m,target:u,start:{[i]:Es(h,f,"start",Math.max)},end:{[i]:Es(h,f,"end",Math.min)}})}}return a}function fi(t,e,i,s){if(s)return;let n=e[t],o=i[t];return t==="angle"&&(n=J(n),o=J(o)),{property:t,start:n,end:o}}function yc(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach(({start:a,end:r})=>{r=Li(a,r,n);const l=n[a],c=n[r];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):i!==null&&(o.push({x:i,y:l.y}),o.push({x:i,y:c.y}))}),o}function Li(t,e,i){for(;e>t;e--){const s=i[e];if(!isNaN(s.x)&&!isNaN(s.y))break}return e}function Es(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function to(t,e){let i=[],s=!1;return I(t)?(s=!0,i=t):i=yc(t,e),i.length?new He({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function Is(t){return t&&t.fill!==!1}function vc(t,e,i){let s=t[e].fill;const n=[e];let o;if(!i)return s;for(;s!==!1&&n.indexOf(s)===-1;){if(!W(s))return s;if(o=t[s],!o)return!1;if(o.visible)return s;n.push(s),s=o.fill}return!1}function Mc(t,e,i){const s=Pc(t);if(A(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return W(n)&&Math.floor(n)===n?kc(s[0],e,n,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function kc(t,e,i,s){return(t==="-"||t==="+")&&(i=e+i),i===e||i<0||i>=s?!1:i}function wc(t,e){let i=null;return t==="start"?i=e.bottom:t==="end"?i=e.top:A(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}function Sc(t,e,i){let s;return t==="start"?s=i:t==="end"?s=e.options.reverse?e.min:e.max:A(t)?s=t.value:s=e.getBaseValue(),s}function Pc(t){const e=t.options,i=e.fill;let s=P(i&&i.target,i);return s===void 0&&(s=!!e.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function Cc(t){const{scale:e,index:i,line:s}=t,n=[],o=s.segments,a=s.points,r=Dc(e,i);r.push(to({x:null,y:e.bottom},s));for(let l=0;l<o.length;l++){const c=o[l];for(let h=c.start;h<=c.end;h++)Ac(n,a[h],r)}return new He({points:n,options:{}})}function Dc(t,e){const i=[],s=t.getMatchingVisibleMetas("line");for(let n=0;n<s.length;n++){const o=s[n];if(o.index===e)break;o.hidden||i.unshift(o.dataset)}return i}function Ac(t,e,i){const s=[];for(let n=0;n<i.length;n++){const o=i[n],{first:a,last:r,point:l}=Oc(o,e,"x");if(!(!l||a&&r)){if(a)s.unshift(l);else if(t.push(l),!r)break}}t.push(...s)}function Oc(t,e,i){const s=t.interpolate(e,i);if(!s)return{};const n=s[i],o=t.segments,a=t.points;let r=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],d=a[h.start][i],u=a[h.end][i];if(ht(n,d,u)){r=n===d,l=n===u;break}}return{first:r,last:l,point:s}}var eo=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:n,radius:o}=this;return e=e||{start:0,end:F},t.arc(s,n,o,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,n=t.angle;return{x:e+Math.cos(n)*s,y:i+Math.sin(n)*s,angle:n}}};function Tc(t){const{chart:e,fill:i,line:s}=t;if(W(i))return Lc(e,i);if(i==="stack")return Cc(t);if(i==="shape")return!0;const n=Rc(t);return n instanceof eo?n:to(n,s)}function Lc(t,e){const i=t.getDatasetMeta(e);return i&&t.isDatasetVisible(e)?i.dataset:null}function Rc(t){return(t.scale||{}).getPointPositionForValue?Ic(t):Ec(t)}function Ec(t){const{scale:e={},fill:i}=t,s=wc(i,e);if(W(s)){const n=e.isHorizontal();return{x:n?s:null,y:n?null:s}}return null}function Ic(t){const{scale:e,fill:i}=t,s=e.options,n=e.getLabels().length,o=s.reverse?e.max:e.min,a=Sc(i,e,o),r=[];if(s.grid.circular){const l=e.getPointPositionForValue(0,o);return new eo({x:l.x,y:l.y,radius:e.getDistanceFromCenterForValue(a)})}for(let l=0;l<n;++l)r.push(e.getPointPositionForValue(l,a));return r}
1function si(t,e,i){const s=Tc(e),{chart:n,index:o,line:a,scale:r,axis:l}=e,c=a.options,h=c.fill,d=c.backgroundColor,{above:u=d,below:f=d}=h||{},g=Ln(n,n.getDatasetMeta(o));s&&a.points.length&&(Ve(t,i),Fc(t,{line:a,target:s,above:u,below:f,area:i,scale:r,axis:l,clip:g}),We(t))}function Fc(t,e){const{line:i,target:s,above:n,below:o,area:a,scale:r,clip:l}=e,c=i._loop?"angle":e.axis;t.save(),c==="x"&&o!==n&&(Fs(t,s,a.top),zs(t,{line:i,target:s,color:n,scale:r,property:c,clip:l}),t.restore(),t.save(),Fs(t,s,a.bottom)),zs(t,{line:i,target:s,color:o,scale:r,property:c,clip:l}),t.restore()}function Fs(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:l,end:c}=r,h=n[l],d=n[Li(l,c,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(h.x,i),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(d.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function zs(t,e){const{line:i,target:s,property:n,color:o,scale:a,clip:r}=e,l=_c(i,s,n);for(const{source:c,target:h,start:d,end:u}of l){const{style:{backgroundColor:f=o}={}}=c,g=s!==!0;t.save(),t.fillStyle=f,zc(t,a,r,g&&fi(n,d,u)),t.beginPath();const m=!!i.pathSegment(t,c);let p;if(g){m?t.closePath():Bs(t,s,u,n);const b=!!s.pathSegment(t,h,{move:m,reverse:!0});p=m&&b,p||Bs(t,s,d,n)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function zc(t,e,i,s){const n=e.chart.chartArea,{property:o,start:a,end:r}=s||{};if(o==="x"||o==="y"){let l,c,h,d;o==="x"?(l=a,c=n.top,h=r,d=n.bottom):(l=n.left,c=a,h=n.right,d=r),t.beginPath(),i&&(l=Math.max(l,i.left),h=Math.min(h,i.right),c=Math.max(c,i.top),d=Math.min(d,i.bottom)),t.rect(l,c,h-l,d-c),t.clip()}}function Bs(t,e,i,s){const n=e.interpolate(i,s);n&&t.lineTo(n.x,n.y)}var Bc={id:"filler",afterDatasetsUpdate(t,e,i){const s=(t.data.datasets||[]).length,n=[];let o,a,r,l;for(a=0;a<s;++a)o=t.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof He&&(l={visible:t.isDatasetVisible(a),index:a,fill:Mc(r,a,s),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<s;++a)l=n[a],!(!l||l.fill===!1)&&(l.fill=vc(n,a,i.propagate))},beforeDraw(t,e,i){const s=i.drawTime==="beforeDraw",n=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let a=n.length-1;a>=0;--a){const r=n[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),s&&r.fill&&si(t.ctx,r,o))}},beforeDatasetsDraw(t,e,i){if(i.drawTime!=="beforeDatasetsDraw")return;const s=t.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){const o=s[n].$filler;Is(o)&&si(t.ctx,o,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;!Is(s)||i.drawTime!=="beforeDatasetDraw"||si(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},Vs=(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)}},Vc=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index,Ws=class extends ft{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=E(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,s=H(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=Vs(i,n);let l,c;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(o,n,a,r)+10):(c=this.maxHeight,l=this._fitCols(o,s,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],c=s+a;let h=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-c;
1return this.legendItems.forEach((f,g)=>{const m=i+e/2+n.measureText(f.text).width;(g===0||l[l.length-1]+m+2*a>o)&&(h+=c,l[l.length-(g>0?0:1)]=0,u+=c,d++),r[g]={left:0,top:u,row:d,width:m,height:s},l[l.length-1]+=m+a}),h}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],c=o-t;let h=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach((m,p)=>{const{itemWidth:b,itemHeight:x}=Wc(i,e,n,m,s);p>0&&u+x+2*a>c&&(h+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[p]={left:f,top:u,col:g,width:b,height:x},d=Math.max(d,b),u+=x+a}),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=zt(n,this.left,this.width);if(this.isHorizontal()){let a=0,r=U(i,this.left+s,this.right-this.lineWidths[a]);for(const l of e)a!==l.row&&(a=l.row,r=U(i,this.left+s,this.right-this.lineWidths[a])),l.top+=this.top+t+s,l.left=o.leftForLtr(o.x(r),l.width),r+=l.width+s}else{let a=0,r=U(i,this.top+t+s,this.bottom-this.columnSizes[a].height);for(const l of e)l.col!==a&&(a=l.col,r=U(i,this.top+t+s,this.bottom-this.columnSizes[a].height)),l.top=r,l.left+=this.left+s,l.left=o.leftForLtr(o.x(l.left),l.width),r+=l.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Ve(t,this),this._draw(),We(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,a=B.color,r=zt(t.rtl,this.left,this.width),l=H(o.font),{padding:c}=o,h=l.size,d=h/2;let u;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=l.string;const{boxWidth:f,boxHeight:g,itemHeight:m}=Vs(o,h),p=function(_,k,M){if(isNaN(f)||f<=0||isNaN(g)||g<0)return;s.save();const w=P(M.lineWidth,1);if(s.fillStyle=P(M.fillStyle,a),s.lineCap=P(M.lineCap,"butt"),s.lineDashOffset=P(M.lineDashOffset,0),s.lineJoin=P(M.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=P(M.strokeStyle,a),s.setLineDash(P(M.lineDash,[])),o.usePointStyle)_n(s,{radius:g*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:w},r.xPlus(_,f/2),k+d,o.pointStyleWidth&&f);else{const S=k+Math.max((h-g)/2,0),C=r.leftForLtr(_,f),T=At(M.borderRadius);s.beginPath(),Object.values(T).some(R=>R!==0)?ae(s,{x:C,y:S,w:f,h:g,radius:T}):s.rect(C,S,f,g),s.fill(),w!==0&&s.stroke()}s.restore()},b=function(_,k,M){Lt(s,M.text,_,k+m/2,l,{strikethrough:M.hidden,textAlign:r.textAlign(M.textAlign)})},x=this.isHorizontal(),v=this._computeTitleHeight();x?u={x:U(n,this.left+c,this.right-i[0]),y:this.top+c+v,line:0}:u={x:this.left+c,y:U(n,this.top+v+c,this.bottom-e[0].height),line:0},Cn(this.ctx,t.textDirection);const y=m+c;this.legendItems.forEach((_,k)=>{s.strokeStyle=_.fontColor,s.fillStyle=_.fontColor;const M=s.measureText(_.text).width,w=r.textAlign(_.textAlign||(_.textAlign=o.textAlign)),S=f+d+M;let C=u.x,T=u.y;if(r.setWidth(this.width),x?k>0&&C+S+c>this.right&&(T=u.y+=y,u.line++,C=u.x=U(n,this.left+c,this.right-i[u.line])):k>0&&T+y>this.bottom&&(C=u.x=C+e[u.line].width+c,u.line++,T=u.y=U(n,this.top+v+c,this.bottom-e[u.line].height)),p(r.x(C),T,_),C=Go(w,C+f+d,x?C+S:this.right,t.rtl),b(r.x(C),T,_),x)u.x+=S+c;else if(typeof _.text!="string"){const R=l.lineHeight;u.y+=io(_,R)+c}else u.y+=y}),Dn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=H(e.font),s=K(e.padding);if(!e.display)return;const n=zt(t.rtl,this.left,this.width),o=this.ctx,a=e.position,r=i.size/2,l=s.top+r;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=U(t.align,h,this.right-d);else{const f=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);c=l+U(t.align,this.top,this.bottom-f-t.labels.padding-this._computeTitleHeight())}const u=U(a,h,h+d);o.textAlign=n.textAlign(Mi(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,Lt(o,e.text,u,c,i)}_computeTitleHeight(){const t=this.options.title,e=H(t.font),i=K(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(ht(t,this.left,this.right)&&ht(e,this.top,this.bottom)){for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(s=n[i],ht(t,s.left,s.left+s.width)&&ht(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){const e=this.options;if(!jc(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const s=this._hoveredItem,n=Vc(s,i);s&&!n&&E(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!n&&E(e.onHover,[t,i,this],this)}else i&&E(e.onClick,[t,i,this],this)}};function Wc(t,e,i,s,n){return{itemWidth:Nc(s,t,e,i),itemHeight:Hc(n,s,e.lineHeight)}}function Nc(t,e,i,s){let n=t.text;
1return n&&typeof n!="string"&&(n=n.reduce((o,a)=>o.length>a.length?o:a)),e+i.size/2+s.measureText(n).width}function Hc(t,e,i){let s=t;return typeof e.text!="string"&&(s=io(e,i)),s}function io(t,e){return e*(t.text?t.text.length:0)}function jc(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var $c={id:"legend",_element:Ws,start(t,e,i){const s=t.legend=new Ws({ctx:t.ctx,options:i,chart:t});X.configure(t,s,i),X.addBox(t,s)},stop(t){X.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;X.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,n=i.chart;n.isDatasetVisible(s)?(n.hide(s),e.hidden=!0):(n.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;
1return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(i?0:void 0),h=K(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.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)}}},Ri=class extends ft{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const s=I(i.text)?i.text.length:1;this._padding=K(i.padding);const n=s*H(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,a=o.align;let r=0,l,c,h;return this.isHorizontal()?(c=U(a,i,n),h=e+t,l=n-i):(o.position==="left"?(c=i+t,h=U(a,s,e),r=z*-.5):(c=n-t,h=U(a,e,s),r=z*.5),l=s-e),{titleX:c,titleY:h,maxWidth:l,rotation:r}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=H(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:a,rotation:r}=this._drawArgs(s);Lt(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:r,textAlign:Mi(e.align),textBaseline:"middle",translation:[n,o]})}};function Yc(t,e){const i=new Ri({ctx:t.ctx,options:e,chart:t});X.configure(t,i,e),X.addBox(t,i),t.titleBlock=i}var Uc={id:"title",_element:Ri,start(t,e,i){Yc(t,i)},stop(t){const e=t.titleBlock;X.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;X.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}},Se=new WeakMap,Xc={id:"subtitle",start(t,e,i){const s=new Ri({ctx:t.ctx,options:i,chart:t});X.configure(t,s,i),X.addBox(t,s),Se.set(t,s)},stop(t){X.removeBox(t,Se.get(t)),Se.delete(t)},beforeUpdate(t,e,i){const s=Se.get(t);X.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}},Jt={average(t){if(!t.length)return!1;let e,i,s=new Set,n=0,o=0;for(e=0,i=t.length;e<i;++e){const a=t[e].element;if(a&&a.hasValue()){const r=a.tooltipPosition();s.add(r.x),n+=r.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,r)=>a+r)/s.size,y:n/o}},nearest(t,e){if(!t.length)return!1;let i=e.x,s=e.y,n=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=t.length;o<a;++o){const l=t[o].element;if(l&&l.hasValue()){const c=ai(e,l.getCenterPoint());c<n&&(n=c,r=l)}}if(r){const l=r.tooltipPosition();i=l.x,s=l.y}return{x:i,y:s}}};function et(t,e){return e&&(I(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function lt(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(` 2`)>-1?t.split(` 3`):t}function Kc(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Ns(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=H(e.bodyFont),c=H(e.titleFont),h=H(e.footerFont),d=o.length,u=n.length,f=s.length,g=K(e.padding);let m=g.height,p=0,b=s.reduce((y,_)=>y+_.before.length+_.lines.length+_.after.length,0);if(b+=t.beforeBody.length+t.afterBody.length,d&&(m+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b){const y=e.displayColors?Math.max(r,l.lineHeight):l.lineHeight;m+=f*y+(b-f)*l.lineHeight+(b-1)*e.bodySpacing}u&&(m+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let x=0;const v=function(y){p=Math.max(p,i.measureText(y).width+x)};return i.save(),i.font=c.string,L(t.title,v),i.font=l.string,L(t.beforeBody.concat(t.afterBody),v),x=e.displayColors?a+2+e.boxPadding:0,L(s,y=>{L(y.before,v),L(y.lines,v),L(y.after,v)}
3),x=0,i.font=h.string,L(t.footer,v),i.restore(),p+=g.width,{width:p,height:m}}function qc(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}function Gc(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;if(t==="left"&&n+o+a>e.width||t==="right"&&n-o-a<0)return!0}function Zc(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),Gc(c,t,e,i)&&(c="center"),c}function Hs(t,e,i){const s=i.yAlign||e.yAlign||qc(t,i);return{xAlign:i.xAlign||e.xAlign||Zc(t,e,i,s),yAlign:s}}function Jc(t,e){let{x:i,width:s}=t;return e==="right"?i-=s:e==="center"&&(i-=s/2),i}function Qc(t,e,i){let{y:s,height:n}=t;return e==="top"?s+=i:e==="bottom"?s-=n+i:s-=n/2,s}function js(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=At(a);let g=Jc(e,r);const m=Qc(e,l,c);return l==="center"?r==="left"?g+=c:r==="right"&&(g-=c):r==="left"?g-=Math.max(h,u)+n:r==="right"&&(g+=Math.max(d,f)+n),{x:j(g,0,s.width-e.width),y:j(m,0,s.height-e.height)}}function Pe(t,e,i){const s=K(i.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-s.right:t.x+s.left}function $s(t){return et([],lt(t))}function th(t,e,i){return yt(t,{tooltip:e,tooltipItems:i,type:"tooltip"})}function Ys(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}var so={beforeTitle:at,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:at,beforeBody:at,beforeLabel:at,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return D(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:at,afterBody:at,beforeFooter:at,footer:at,afterFooter:at};function q(t,e,i,s){const n=t[e].call(i,s);return typeof n>"u"?so[e].call(i,s):n}var Us=class extends ft{static positioners=Jt;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(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new Rn(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=th(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:i}=e,s=q(i,"beforeTitle",this,t),n=q(i,"title",this,t),o=q(i,"afterTitle",this,t);let a=[];return a=et(a,lt(s)),a=et(a,lt(n)),a=et(a,lt(o)),a}getBeforeBody(t,e){return $s(q(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return L(t,n=>{const o={before:[],lines:[],after:[]},a=Ys(i,n);et(o.before,lt(q(a,"beforeLabel",this,n))),et(o.lines,q(a,"label",this,n)),et(o.after,lt(q(a,"afterLabel",this,n))),s.push(o)}),s}getAfterBody(t,e){return $s(q(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=q(i,"beforeFooter",this,t),n=q(i,"footer",this,t),o=q(i,"afterFooter",this,t);let a=[];return a=et(a,lt(s)),a=et(a,lt(n)),a=et(a,lt(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a=[],r,l;for(r=0,l=e.length;r<l;++r)a.push(Kc(this.chart,e[r]));return t.filter&&(a=a.filter((c,h,d)=>t.filter(c,h,d,i))),t.itemSort&&(a=a.sort((c,h)=>t.itemSort(c,h,i))),L(a,c=>{const h=Ys(t.callbacks,c);s.push(q(h,"labelColor",this,c)),n.push(q(h,"labelPointStyle",this,c)),o.push(q(h,"labelTextColor",this,c))}),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=a,a}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(!s.length)this.opacity!==0&&(n={opacity:0}
3);else{const a=Jt[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const r=this._size=Ns(this,i),l=Object.assign({},a,r),c=Hs(this.chart,i,l),h=js(i,l,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,n={opacity:1,x:h.x,y:h.y,width:r.width,height:r.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:c,bottomRight:h}=At(a),{x:d,y:u}=t,{width:f,height:g}=e;let m,p,b,x,v,y;return n==="center"?(v=u+g/2,s==="left"?(m=d,p=m-o,x=v+o,y=v-o):(m=d+f,p=m+o,x=v-o,y=v+o),b=m):(s==="left"?p=d+Math.max(r,c)+o:s==="right"?p=d+f-Math.max(l,h)-o:p=this.caretX,n==="top"?(x=u,v=x-o,m=p-o,b=p+o):(x=u+g,v=x+o,m=p+o,b=p-o),y=x),{x1:m,x2:p,x3:b,y1:x,y2:v,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=zt(i.rtl,this.x,this.width);for(t.x=Pe(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=H(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r<n;++r)e.fillText(s[r],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,r+1===n&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,n){const o=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:r,boxWidth:l}=n,c=H(n.bodyFont),h=Pe(this,"left",n),d=s.x(h),u=r<c.lineHeight?(c.lineHeight-r)/2:0,f=e.y+u;if(n.usePointStyle){const g={radius:Math.min(l,r)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=s.leftForLtr(d,l)+l/2,p=f+r/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,li(t,g,m,p),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,li(t,g,m,p)}else{t.lineWidth=A(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const g=s.leftForLtr(d,l),m=s.leftForLtr(s.xPlus(d,1),l-2),p=At(o.borderRadius);Object.values(p).some(b=>b!==0)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,ae(t,{x:g,y:f,w:l,h:r,radius:p}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),ae(t,{x:m,y:f+1,w:l-2,h:r-2,radius:p}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(g,f,l,r),t.strokeRect(g,f,l,r),t.fillStyle=o.backgroundColor,t.fillRect(m,f+1,l-2,r-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:c}=i,h=H(i.bodyFont);let d=h.lineHeight,u=0;const f=zt(i.rtl,this.x,this.width),g=function(M){e.fillText(M,f.x(t.x+u),t.y+d/2),t.y+=d+n},m=f.textAlign(o);let p,b,x,v,y,_,k;for(e.textAlign=o,e.textBaseline="middle",e.font=h.string,t.x=Pe(this,m,i),e.fillStyle=i.bodyColor,L(this.beforeBody,g),u=a&&m!=="right"?o==="center"?l/2+c:l+2+c:0,v=0,_=s.length;v<_;++v){for(p=s[v],b=this.labelTextColors[v],e.fillStyle=b,L(p.before,g),x=p.lines,a&&x.length&&(this._drawColorBox(e,t,v,f,i),d=Math.max(h.lineHeight,r)),y=0,k=x.length;y<k;++y)g(x[y]),d=h.lineHeight;L(p.after,g)}u=0,d=h.lineHeight,L(this.afterBody,g),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let o,a;if(n){const r=zt(i.rtl,this.x,this.width);for(t.x=Pe(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",o=H(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<n;++a)e.fillText(s[a],r.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:o}=this,{x:a,y:r}=t,{width:l,height:c}=i,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=At(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+h,r),o==="top"&&this.drawCaret(t,e,i,s),e.lineTo(a+l-d,r),e.quadraticCurveTo(a+l,r,a+l,r+d),o==="center"&&n==="right"&&this.drawCaret(t,e,i,s),e.lineTo(a+l,r+c-f),e.quadraticCurveTo(a+l,r+c,a+l-f,r+c),o==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(a+u,r+c),e.quadraticCurveTo(a,r+c,a,r+c-u),o==="center"&&n==="left"&&this.drawCaret(t,e,i,s),e.lineTo(a,r+h),e.quadraticCurveTo(a,r,a+h,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const o=Jt[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=Ns(this,t),r=Object.assign({},o,this._size),l=Hs(e,t,r),c=js(t,r,l,e);(s._to!==c.x||n._to!==c.y)&&(this.xAlign=l.xAlign,this.yAlign=l.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=K(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;
3e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),Cn(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Dn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map(({datasetIndex:a,index:r})=>{const l=this.chart.getDatasetMeta(a);if(!l)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:l.data[r],index:r}}),n=!Oe(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!Oe(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Jt[n.position].call(this,t,e);return o!==!1&&(i!==o.x||s!==o.y)}},eh={id:"tooltip",_element:Us,positioners:Jt,afterInit(t,e,i){i&&(t.tooltip=new Us({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:so},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},ih=Object.freeze({__proto__:null,Colors:gc,Decimation:xc,Filler:Bc,Legend:$c,SubTitle:Xc,Title:Uc,Tooltip:eh}),sh=(t,e,i,s)=>(typeof e=="string"?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i);function nh(t,e,i,s){const n=t.indexOf(e);return n===-1?sh(t,e,i,s):n!==t.lastIndexOf(e)?i:n}var oh=(t,e)=>t===null?null:j(Math.round(t),0,e);function Xs(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}var ah=class extends ue{static id="category";static defaults={ticks:{callback:Xs}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const i=this.getLabels();for(const{index:s,label:n}of e)i[s]===n&&i.splice(s,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(D(t))return null;const i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:nh(i,t,P(e,t),this._addedLabels),oh(e,i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=t===0&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let o=t;o<=e;o++)s.push({value:o});return s}getLabelForValue(t){return Xs.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const 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}};function rh(t,e){const i=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=t,f=o||1,g=h-1,{min:m,max:p}=e,b=!D(a),x=!D(r),v=!D(c),y=(p-m)/(d+1);let _=Ni((p-m)/g/f)*f,k,M,w,S;if(_<1e-14&&!b&&!x)return[{value:m},{value:p}];S=Math.ceil(p/_)-Math.floor(m/_),S>g&&(_=Ni(S*_/g/f)*f),D(l)||(k=Math.pow(10,l),_=Math.ceil(_*k)/k),n==="ticks"?(M=Math.floor(m/_)*_,w=Math.ceil(p/_)*_):(M=m,w=p),b&&x&&o&&jo((r-a)/o,_/1e3)?(S=Math.round(Math.min((r-a)
3/_,h)),_=(r-a)/S,M=a,w=r):v?(M=b?a:M,w=x?r:w,S=c-1,_=(w-M)/S):(S=(w-M)/_,te(S,Math.round(S),_/1e3)?S=Math.round(S):S=Math.ceil(S));const C=Math.max(Hi(_),Hi(M));k=Math.pow(10,D(l)?C:l),M=Math.round(M*k)/k,w=Math.round(w*k)/k;let T=0;for(b&&(u&&M!==a?(i.push({value:a}),M<a&&T++,te(Math.round((M+T*_)*k)/k,a,Ks(a,y,t))&&T++):M<a&&T++);T<S;++T){const R=Math.round((M+T*_)*k)/k;if(x&&R>r)break;i.push({value:R})}return x&&u&&w!==r?i.length&&te(i[i.length-1].value,r,Ks(r,y,t))?i[i.length-1].value=r:i.push({value:r}):(!x||w===r)&&i.push({value:w}),i}function Ks(t,e,{horizontal:i,minRotation:s}){const n=tt(s),o=(i?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}var ze=class extends ue{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 D(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:s,max:n}=this;const o=r=>s=e?s:r,a=r=>n=i?n:r;if(t){const r=st(s),l=st(n);r<0&&l<0?a(0):r>0&&l>0&&o(0)}if(s===n){let r=n===0?1:Math.abs(n*.05);a(n+r),t||o(s-r)}this.min=s,this.max=n}getTickLimit(){let{maxTicksLimit:t,stepSize:e}=this.options.ticks,i;return e?(i=Math.ceil(this.max/e)-Math.floor(this.min/e)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${e} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),t=t||11),t&&(i=Math.min(t,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s=rh({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},this._range||this);return t.bounds==="ticks"&&hn(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return he(t,this.chart.options.locale,this.options.ticks.format)}},lh=class extends ze{static id="linear";static defaults={ticks:{callback:Be.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=W(t)?t:0,this.max=W(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=tt(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},le=t=>Math.floor(pt(t)),Pt=(t,e)=>Math.pow(10,le(t)+e);function qs(t){return t/Math.pow(10,le(t))===1}function Gs(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s);return Math.ceil(e/s)-n}function ch(t,e){let i=le(e-t);for(;Gs(t,e,i)>10;)i++;for(;Gs(t,e,i)<10;)i--;return Math.min(i,le(t))}function hh(t,{min:e,max:i}){e=Z(t.min,e);const s=[],n=le(e);let o=ch(e,i),a=o<0?Math.pow(10,Math.abs(o)):1;const r=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((e-l)*a)/a,h=Math.floor((e-l)/r/10)*r*10;let d=Math.floor((c-h)/Math.pow(10,o)),u=Z(t.min,Math.round((l+h+d*Math.pow(10,o))*a)/a);for(;u<i;)s.push({value:u,major:qs(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+h+d*Math.pow(10,o))*a)/a;const f=Z(t.max,u);return s.push({value:f,major:qs(f),significand:d}),s}var dh=class extends ue{static id="logarithmic";static defaults={ticks:{callback:Be.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){const i=ze.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return W(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=W(t)?Math.max(0,t):null,this.max=W(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!W(this._userMin)&&(this.min=t===Pt(this.min,0)?Pt(this.min,-1):Pt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=a=>i=t?i:a,o=a=>s=e?s:a;
3i===s&&(i<=0?(n(1),o(10)):(n(Pt(i,-1)),o(Pt(s,1)))),i<=0&&n(Pt(s,-1)),s<=0&&o(Pt(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=hh({min:this._userMin,max:this._userMax},this);return t.bounds==="ticks"&&hn(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 t===void 0?"0":he(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=pt(t),this._valueRange=pt(this.max)-pt(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(pt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function gi(t){const e=t.ticks;if(e.display&&t.display){const i=K(e.backdropPadding);return P(e.font&&e.font.size,B.font.size)+i.height}return 0}function uh(t,e,i){return i=I(i)?i:[i],{w:aa(t,e.string,i),h:i.length*e.lineHeight}}function Zs(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:t<s||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function fh(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],n=[],o=t._pointLabels.length,a=t.options.pointLabels,r=a.centerPointLabels?z/o:0;for(let l=0;l<o;l++){const c=a.setContext(t.getPointLabelContext(l));n[l]=c.padding;const h=t.getPointPosition(l,t.drawingArea+n[l],r),d=H(c.font),u=uh(t.ctx,d,t._pointLabels[l]);s[l]=u;const f=J(t.getIndexAngle(l)+r),g=Math.round(yi(f));gh(i,e,f,Zs(g,h.x,u.w,0,180),Zs(g,h.y,u.h,90,270))}t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=bh(t,s,n)}function gh(t,e,i,s,n){const o=Math.abs(Math.sin(i)),a=Math.abs(Math.cos(i));let r=0,l=0;s.start<e.l?(r=(e.l-s.start)/o,t.l=Math.min(t.l,e.l-r)):s.end>e.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.start<e.t?(l=(e.t-n.start)/a,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function ph(t,e,i){const s=t.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=i,l=t.getPointPosition(e,s+n+a,o),c=Math.round(yi(J(l.angle+N))),h=yh(l.y,r.h,c),d=xh(c),u=_h(l.x,r.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+r.w,bottom:h+r.h}}function mh(t,e){if(!e)return!0;const{left:i,top:s,right:n,bottom:o}=t;return!(ut({x:i,y:s},e)||ut({x:i,y:o},e)||ut({x:n,y:s},e)||ut({x:n,y:o},e))}function bh(t,e,i){const s=[],n=t._pointLabels.length,o=t.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:gi(o)/2,additionalAngle:a?z/n:0};let c;for(let h=0;h<n;h++){l.padding=i[h],l.size=e[h];const d=ph(t,h,l);s.push(d),r==="auto"&&(d.visible=mh(d,c),d.visible&&(c=d))}return s}function xh(t){return t===0||t===180?"center":t<180?"left":"right"}function _h(t,e,i){return i==="right"?t-=e:i==="center"&&(t-=e/2),t}function yh(t,e,i){return i===90||i===270?t-=e/2:(i>270||i<90)&&(t-=e),t}
3function vh(t,e,i){const{left:s,top:n,right:o,bottom:a}=i,{backdropColor:r}=e;if(!D(r)){const l=At(e.borderRadius),c=K(e.backdropPadding);t.fillStyle=r;const h=s-c.left,d=n-c.top,u=o-s+c.width,f=a-n+c.height;Object.values(l).some(g=>g!==0)?(t.beginPath(),ae(t,{x:h,y:d,w:u,h:f,radius:l}),t.fill()):t.fillRect(h,d,u,f)}}function Mh(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let n=e-1;n>=0;n--){const o=t._pointLabelItems[n];if(!o.visible)continue;const a=s.setContext(t.getPointLabelContext(n));vh(i,a,o);const r=H(a.font),{x:l,y:c,textAlign:h}=o;Lt(i,t._pointLabels[n],l,c+r.lineHeight/2,r,{color:a.color,textAlign:h,textBaseline:"middle"})}}function no(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,F);else{let o=t.getPointPosition(0,e);n.moveTo(o.x,o.y);for(let a=1;a<s;a++)o=t.getPointPosition(a,e),n.lineTo(o.x,o.y)}}function kh(t,e,i,s,n){const o=t.ctx,a=e.circular,{color:r,lineWidth:l}=e;!a&&!s||!r||!l||i<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),no(t,i,a,s),o.closePath(),o.stroke(),o.restore())}function wh(t,e,i){return yt(t,{label:i,index:e,type:"pointLabel"})}var Sh=class extends ze{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:Be.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return 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(){const t=this._padding=K(gi(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(){const{min:t,max:e}=this.getMinMax(!1);this.min=W(t)&&!isNaN(t)?t:0,this.max=W(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/gi(this.options))}generateTickLabels(t){ze.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{const s=E(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?fh(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){const e=F/(this._pointLabels.length||1),i=this.options.startAngle||0;return J(t*e+tt(i))}getDistanceFromCenterForValue(t){if(D(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(D(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return wh(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-N+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),no(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:n}=e,o=this._pointLabels.length;let a,r,l;if(e.pointLabels.display&&Mh(this,o),s.display&&this.ticks.forEach((c,h)=>{if(h!==0||h===0&&this.min<0){r=this.getDistanceFromCenterForValue(c.value);const d=this.getContext(h),u=s.setContext(d),f=n.setContext(d);kh(this,u,r,o,f)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const c=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=c;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,r=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(a,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}
3t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,r)=>{if(r===0&&this.min>=0&&!e.reverse)return;const l=i.setContext(this.getContext(r)),c=H(l.font);if(n=this.getDistanceFromCenterForValue(this.ticks[r].value),l.showLabelBackdrop){t.font=c.string,o=t.measureText(a.label).width,t.fillStyle=l.backdropColor;const h=K(l.backdropPadding);t.fillRect(-o/2-h.left,-n-c.size/2-h.top,o+h.width,c.size+h.height)}Lt(t,a.label,0,-n,c,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),t.restore()}drawTitle(){}},je={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}},G=Object.keys(je);function Js(t,e){return t-e}function Qs(t,e){if(D(e))return null;const i=t._adapter,{parser:s,round:n,isoWeekday:o}=t._parseOpts;let a=e;return typeof s=="function"&&(a=s(a)),W(a)||(a=typeof s=="string"?i.parse(a,s):i.parse(a)),a===null?null:(n&&(a=n==="week"&&(Bt(o)||o===!0)?i.startOf(a,"isoWeek",o):i.startOf(a,n)),+a)}function tn(t,e,i,s){const n=G.length;for(let o=G.indexOf(t);o<n-1;++o){const a=je[G[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((i-e)/(r*a.size))<=s)return G[o]}return G[n-1]}function Ph(t,e,i,s,n){for(let o=G.length-1;o>=G.indexOf(i);o--){const a=G[o];if(je[a].common&&t._adapter.diff(n,s,a)>=e-1)return a}return G[i?G.indexOf(i):0]}function Ch(t){for(let e=G.indexOf(t)+1,i=G.length;e<i;++e)if(je[G[e]].common)return G[e]}function en(t,e,i){if(!i)t[e]=!0;else if(i.length){const{lo:s,hi:n}=vi(i,e),o=i[s]>=e?i[s]:i[n];t[o]=!0}}function Dh(t,e,i,s){const n=t._adapter,o=+n.startOf(e[0].value,s),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=i[r],l>=0&&(e[l].major=!0);return e}function sn(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],n[r]=a,s.push({value:r,major:!1});return o===0||!i?s:Dh(t,s,n,i)}var pi=class extends ue{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={}){const i=t.time||(t.time={}),s=this._adapter=new Or._date(t.adapters.date);s.init(e),Qt(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 t===void 0?null:Qs(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:o,maxDefined:a}=this.getUserBounds();function r(l){!o&&!isNaN(l.min)&&(s=Math.min(s,l.min)),!a&&!isNaN(l.max)&&(n=Math.max(n,l.max))}(!o||!a)&&(r(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&r(this.getMinMax(!1))),s=W(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=W(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=this.max,a=Xo(s,n,o);return this._unit=e.unit||(i.autoSkip?tn(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):Ph(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:Ch(this._unit),this.initOffsets(s),t.reverse&&a.reverse(),sn(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,s,n;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,n=this.getDecimalForValue(t[t.length-1]),t.length===1?i=n:i=(n-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;e=j(e,0,o),i=j(i,0,o),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||tn(n.minUnit,e,i,this._getLabelCapacity(e)),a=P(s.ticks.stepSize,1),r=o==="week"?n.isoWeekday:!1,l=Bt(r)||r===!0,c={};let h=e,d,u;if(l&&(h=+t.startOf(h,"isoWeek",r)),h=+t.startOf(h,l?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const f=s.ticks.source==="data"&&this.getDataTimestamps();for(d=h,u=0;d<i;d=+t.add(d,a,o),u++)en(c,d,f);return(d===i||s.bounds==="ticks"||u===1)&&en(c,d,f),Object.keys(c).sort(Js).map(g=>+g)}
3getLabelForValue(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 i=this.options.time.displayFormats,s=this._unit,n=e||i[s];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.ticks.callback;if(o)return E(o,[t,e,i],this);const a=n.time.displayFormats,r=this._unit,l=this._majorUnit,c=r&&a[r],h=l&&a[l],d=i[e],u=l&&h&&d&&d.major;return this._adapter.format(t,s||(u?h:c))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=tt(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*n+a*o,h:i*o+a*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,sn(this,[t],this._majorUnit),s),o=this._getLabelSize(n),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Qs(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return fn(t.sort(Js))}};function Ce(t,e,i){let s=0,n=t.length-1,o,a,r,l;i?(e>=t[s].pos&&e<=t[n].pos&&({lo:s,hi:n}=dt(t,"pos",e)),{pos:o,time:r}=t[s],{pos:a,time:l}=t[n]):(e>=t[s].time&&e<=t[n].time&&({lo:s,hi:n}=dt(t,"time",e)),{time:o,pos:r}=t[s],{time:a,pos:l}=t[n]);const c=a-o;return c?r+(l-r)*(e-o)/c:r}var Ah=class extends pi{static id="timeseries";static defaults=pi.defaults;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,s=[],n=[];let o,a,r,l,c;for(o=0,a=t.length;o<a;++o)l=t[o],l>=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;
3++o)c=s[o+1],r=s[o-1],l=s[o],Math.round((c+r)/2)!==l&&n.push({time:l,pos:o/(a-1)});return n}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return(!i.includes(t)||!i.length)&&i.splice(0,0,t),(!i.includes(e)||i.length===1)&&i.push(e),i.sort((s,n)=>s-n)}_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)}},Oh=Object.freeze({__proto__:null,CategoryScale:ah,LinearScale:lh,LogarithmicScale:dh,RadialLinearScale:Sh,TimeScale:pi,TimeSeriesScale:Ah}),Th=[Dr,rc,ih,Oh];Ti.register(...Th);var Lh=Ti,Rh=({charge:t,rate:e,usage:i,cost:s})=>` 4 <td>${t}</td> 5 <td>${e}</td> 6 <td>${i}</td> 7 <td>${s}</td> 8`,Eh=class extends lo{constructor(...t){super(...t),this.chart=null,this.connect=()=>{this.apiPathValue&&this.displayApiUsage()},this.displayApiUsage=async()=>{this.element.classList.add("has-spinner"),this.element.classList.remove("has-errors"),this.hasErrorsTarget&&this.errorsTarget.remove(),this.chart||this.drawChart();const{status:e,data:i}=await this.fetchData(this.monthTarget.value);if(e===200){const s=i;this.updateChart(s.usage),this.fillTable(s.costs),this.updateTotal(s.total)}else{const s=i;this.handleErrors(s.errors)}this.element.classList.remove("has-spinner")},this.fetchData=async e=>{const i=new URL(this.apiPathValue,window.location.origin);i.searchParams.set("month",e);const s=await fetch(i),{status:n}=s;return{status:n,data:await s.json()}},this.drawChart=()=>{this.chart=new Lh(this.chartCanvasTarget,{type:"bar",data:{datasets:[]},options:{aspectRatio:2.5,elements:{bar:{borderSkipped:!0}},plugins:{legend:{display:!1},tooltip:{enabled:!1,position:"nearest",xAlign:"center",yAlign:"top",external:this.updateTooltip}},scales:{x:{grid:{display:!1},title:{display:!0,text:this.xAxisLabelValue,color:"#0e2332",font:{weight:"bold",size:16}}},y:{title:{display:!0,color:"#0e2332",font:{weight:"bold",size:16},text:this.yAxisLabelValue}}}}})},this.updateChart=e=>{this.chart.data={labels:e.map(i=>i.date),datasets:[{label:this.callsLabelValue,data:e.map(i=>i.calls),backgroundColor:"#4878f1",hoverBackgroundColor:"#4878f1",barPercentage:1},{label:this.downloadsLabelValue,data:e.map(i=>i.downloads),backgroundColor:"#52c648",hoverBackgroundColor:"#52c648",barPercentage:1}]},this.chart.options.scales.x.ticks={callback:i=>new Date(e[i].date).getUTCDate()},this.chart.update()},this.fillTable=e=>{if(!this.hasCostsTarget)return;const i=document.createDocumentFragment();e.forEach(s=>{const n=document.createElement("TR");n.innerHTML=Rh(s),i.appendChild(n)}),this.costsTarget.innerHTML="",this.costsTarget.appendChild(i)},this.updateTotal=e=>{this.hasTotalTarget&&(this.totalTarget.textContent=e)},this.handleErrors=e=>{this.element.classList.add("has-errors");const i=document.createElement("DIV");i.dataset.apiUsageTarget="errors",i.classList.add("api-usage__errors"),e.forEach(s=>{i.innerHTML+=ro(this.errorTemplateTarget,{error:s})}),ao(this.element,i)},this.updateTooltip=({tooltip:e})=>{if(window.innerWidth<=1100)return;const{caretX:i,caretY:s,opacity:n,dataPoints:o}=e,a=this.tooltipText(o[0].raw,o[0].dataset.label);this.tooltipTarget.setAttribute("style",`--x: ${i}px; --y: ${s}px`),n?this.tooltipTarget.classList.add("is-active"):this.tooltipTarget.classList.remove("is-active"),this.tooltipContentTarget.textContent=a}}static{this.targets=["month","chart","chartCanvas","costs","total","errorTemplate","errors","tooltip","tooltipContent"]}static{this.values={apiPath:String,callLabel:String,callsLabel:String,downloadLabel:String,downloadsLabel:String,xAxisLabel:String,yAxisLabel:String}}tooltipText(t,e){let i=e;if(t===1)switch(e){case this.callsLabelValue:i=this.callLabelValue;break;case this.downloadsLabelValue:i=this.downloadLabelValue;break;default:break}return`${t} ${i}`}};oo({name:"api-usage",import:Eh});export{Eh as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.