=t?1:-1)}function Xc(e){let i,t,s,n,o;return e.horizontal?(i=e.base>e.x,t="left",s="right"):(i=e.base{class e extends Rt{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,s,n,o){return So(t,s,n,o)}parseArrayData(t,s,n,o){return So(t,s,n,o)}parseObjectData(t,s,n,o){let{iScale:r,vScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,h=r.axis==="x"?l:c,f=a.axis==="x"?l:c,d=[],u,p,g,m;for(u=n,p=n+o;uf.controller.options.grouped),r=n.options.stacked,a=[],l=this._cachedMeta.controller.getParsed(s),c=l&&l[n.axis],h=f=>{let d=f._parsed.find(p=>p[n.axis]===c),u=d&&d[f.vScale.axis];if(T(u)||isNaN(u))return!0};for(let f of o)if(!(s!==void 0&&h(f))&&((r===!1||a.indexOf(f.stack)===-1||r===void 0&&f.stack===void 0)&&a.push(f.stack),f.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,s,n){let o=this._getStacks(t,n),r=s!==void 0?o.indexOf(s):-1;return r===-1?o.length-1:r}_getRuler(){let t=this.options,s=this._cachedMeta,n=s.iScale,o=[],r,a;for(r=0,a=s.data.length;r{class e extends Rt{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,s,n,o){let r=super.parsePrimitiveData(t,s,n,o);for(let a=0;a=0;--n)s=Math.max(s,t[n].size(this.resolveDataElementOptions(n))/2);return s>0&&s}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:o,yScale:r}=s,a=this.getParsed(t),l=o.getLabelForValue(a.x),c=r.getLabelForValue(a.y),h=a._custom;return{label:n[t]||"",value:"("+l+", "+c+(h?", "+h:"")+")"}}update(t){let s=this._cachedMeta.data;this.updateElements(s,0,s.length,t)}updateElements(t,s,n,o){let r=o==="reset",{iScale:a,vScale:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(s,o),f=a.axis,d=l.axis;for(let u=s;une(y,a,l,!0)?1:Math.max(M,M*t,_,_*t),p=(y,M,_)=>ne(y,a,l,!0)?-1:Math.min(M,M*t,_,_*t),g=u(0,c,f),m=u(V,h,d),b=p(F,c,f),x=p(F+V,h,d);s=(g-b)/2,n=(m-x)/2,o=-(g+b)/2,r=-(m+x)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:r}}var fn=(()=>{class e extends Rt{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){let s=t.data;if(s.labels.length&&s.datasets.length){let{labels:{pointStyle:n,color:o}}=t.legend.options;return s.labels.map((r,a)=>{let c=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:o,lineWidth:c.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}}};constructor(t,s){super(t,s),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,s){let n=this.getDataset().data,o=this._cachedMeta;if(this._parsing===!1)o._parsed=n;else{let r=c=>+n[c];if(A(n[t])){let{key:c="value"}=this._parsing;r=h=>+_t(n[h],c)}let a,l;for(a=t,l=t+s;a0&&!isNaN(t)?z*(Math.abs(t)/s):0}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart,o=n.data.labels||[],r=oe(s._parsed[t],n.options.locale);return{label:o[t]||"",value:r}}getMaxBorderWidth(t){let s=0,n=this.chart,o,r,a,l,c;if(!t){for(o=0,r=n.data.datasets.length;o{class e extends Rt{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){let s=this._cachedMeta,{dataset:n,data:o=[],_dataset:r}=s,a=this.chart._animationsDisabled,{start:l,count:c}=xs(s,o,a);this._drawStart=l,this._drawCount=c,bs(s)&&(l=0,c=o.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=o;let h=this.resolveDatasetElementOptions(t);this.options.showLine||(h.borderWidth=0),h.segment=this.options.segment,this.updateElement(n,void 0,{animated:!a,options:h},t),this.updateElements(o,l,c,t)}updateElements(t,s,n,o){let r=o==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:h}=this._cachedMeta,{sharedOptions:f,includeOptions:d}=this._getSharedOptions(s,o),u=a.axis,p=l.axis,{spanGaps:g,segment:m}=this.options,b=$t(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||r||o==="none",y=s+n,M=t.length,_=s>0&&this.getParsed(s-1);for(let v=0;v=y){w.skip=!0;continue}let k=this.getParsed(v),O=T(k[p]),P=w[u]=a.getPixelForValue(k[u],v),D=w[p]=r||O?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,k,c):k[p],v);w.skip=isNaN(P)||isNaN(D)||O,w.stop=v>0&&Math.abs(k[u]-_[u])>b,m&&(w.parsed=k,w.raw=h.data[v]),d&&(w.options=f||this.resolveDataElementOptions(v,S.active?"active":o)),x||this.updateElement(S,v,w,o),_=k}}getMaxOverflow(){let t=this._cachedMeta,s=t.dataset,n=s.options&&s.options.borderWidth||0,o=t.data||[];if(!o.length)return n;let r=o[0].size(this.resolveDataElementOptions(0)),a=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(n,r,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}return e})(),yr=(()=>{class e extends Rt{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){let s=t.data;if(s.labels.length&&s.datasets.length){let{labels:{pointStyle:n,color:o}}=t.legend.options;return s.labels.map((r,a)=>{let c=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:o,lineWidth:c.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,s,n){n.chart.toggleDataVisibility(s.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,s){super(t,s),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let s=this._cachedMeta,n=this.chart,o=n.data.labels||[],r=oe(s._parsed[t].r,n.options.locale);return{label:o[t]||"",value:r}}parseObjectData(t,s,n,o){return Ps.bind(this)(t,s,n,o)}update(t){let s=this._cachedMeta.data;this._updateRadius(),this.updateElements(s,0,s.length,t)}getMinMax(){let t=this._cachedMeta,s={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,o)=>{let r=this.getParsed(o).r;!isNaN(r)&&this.chart.getDataVisibility(o)&&(rs.max&&(s.max=r))}),s}_updateRadius(){let t=this.chart,s=t.chartArea,n=t.options,o=Math.min(s.right-s.left,s.bottom-s.top),r=Math.max(o/2,0),a=Math.max(n.cutoutPercentage?r/100*n.cutoutPercentage:1,0),l=(r-a)/t.getVisibleDatasetCount();this.outerRadius=r-l*this.index,this.innerRadius=this.outerRadius-l}updateElements(t,s,n,o){let r=o==="reset",a=this.chart,c=a.options.animation,h=this._cachedMeta.rScale,f=h.xCenter,d=h.yCenter,u=h.getIndexAngle(0)-.5*F,p=u,g,m=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(o).r)&&this.chart.getDataVisibility(o)&&s++}),s}_computeAngle(t,s,n){return this.chart.getDataVisibility(t)?nt(this.resolveDataElementOptions(t,s).angle||n):0}}return e})(),eh=(()=>{class e extends fn{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}return e})(),ih=(()=>{class e extends Rt{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){let s=this._cachedMeta.vScale,n=this.getParsed(t);return{label:s.getLabels()[t],value:""+s.getLabelForValue(n[s.axis])}}parseObjectData(t,s,n,o){return Ps.bind(this)(t,s,n,o)}update(t){let s=this._cachedMeta,n=s.dataset,o=s.data||[],r=s.iScale.getLabels();if(n.points=o,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let l={_loop:!0,_fullLoop:r.length===o.length,options:a};this.updateElement(n,void 0,l,t)}this.updateElements(o,0,o.length,t)}updateElements(t,s,n,o){let r=this._cachedMeta.rScale,a=o==="reset";for(let l=s;l{class e extends Rt{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){let s=this._cachedMeta,n=this.chart.data.labels||[],{xScale:o,yScale:r}=s,a=this.getParsed(t),l=o.getLabelForValue(a.x),c=r.getLabelForValue(a.y);return{label:n[t]||"",value:"("+l+", "+c+")"}}update(t){let s=this._cachedMeta,{data:n=[]}=s,o=this.chart._animationsDisabled,{start:r,count:a}=xs(s,n,o);if(this._drawStart=r,this._drawCount=a,bs(s)&&(r=0,a=n.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:l,_dataset:c}=s;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=n;let h=this.resolveDatasetElementOptions(t);h.segment=this.options.segment,this.updateElement(l,void 0,{animated:!o,options:h},t)}else this.datasetElementType&&(delete s.dataset,this.datasetElementType=!1);this.updateElements(n,r,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,s,n,o){let r=o==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:h}=this._cachedMeta,f=this.resolveDataElementOptions(s,o),d=this.getSharedOptions(f),u=this.includeOptions(o,d),p=a.axis,g=l.axis,{spanGaps:m,segment:b}=this.options,x=$t(m)?m:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||r||o==="none",M=s>0&&this.getParsed(s-1);for(let _=s;_0&&Math.abs(S[p]-M[p])>x,b&&(w.parsed=S,w.raw=h.data[_]),u&&(w.options=d||this.resolveDataElementOptions(_,v.active?"active":o)),y||this.updateElement(v,_,w,o),M=S}this.updateSharedOptions(d,o,f)}getMaxOverflow(){let t=this._cachedMeta,s=t.data||[];if(!this.options.showLine){let l=0;for(let c=s.length-1;c>=0;--c)l=Math.max(l,s[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}let n=t.dataset,o=n.options&&n.options.borderWidth||0;if(!s.length)return o;let r=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(o,r,a)/2}}return e})(),nh=Object.freeze({__proto__:null,BarController:Zc,BubbleController:Jc,DoughnutController:fn,LineController:th,PieController:eh,PolarAreaController:yr,RadarController:ih,ScatterController:sh});function Yt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Us=class e{static override(i){Object.assign(e.prototype,i)}options;constructor(i){this.options=i||{}}init(){}formats(){return Yt()}parse(){return Yt()}format(){return Yt()}add(){return Yt()}diff(){return Yt()}startOf(){return Yt()}endOf(){return Yt()}},oh={_date:Us};function rh(e,i,t,s){let{controller:n,data:o,_sorted:r}=e,a=n._cachedMeta.iScale;if(a&&i===a.axis&&i!=="r"&&r&&o.length){let l=a._reversePixels?Kn:ct;if(s){if(n._sharedOptions){let c=o[0],h=typeof c.getRange=="function"&&c.getRange(i);if(h){let f=l(o,i,t-h),d=l(o,i,t+h);return{lo:f.lo,hi:d.hi}}}}else return l(o,i,t)}return{lo:0,hi:o.length-1}}function He(e,i,t,s,n){let o=e.getSortedVisibleDatasetMetas(),r=t[i];for(let a=0,l=o.length;a{l[r]&&l[r](i[t],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(i.x,i.y,n))}),s&&!a?[]:o}var hh={evaluateInteractionItems:He,modes:{index(e,i,t,s){let n=Tt(i,e),o=t.axis||"x",r=t.includeInvisible||!1,a=t.intersect?zs(e,n,o,s,r):Bs(e,n,o,!1,s,r),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{let h=a[0].index,f=c.data[h];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:h})}),l):[]},dataset(e,i,t,s){let n=Tt(i,e),o=t.axis||"xy",r=t.includeInvisible||!1,a=t.intersect?zs(e,n,o,s,r):Bs(e,n,o,!1,s,r);if(a.length>0){let l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let h=0;ht.pos===i)}function Oo(e,i){return e.filter(t=>vr.indexOf(t.pos)===-1&&t.box.axis===i)}function Ee(e,i){return e.sort((t,s)=>{let n=i?s:t,o=i?t:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function fh(e){let i=[],t,s,n,o,r,a;for(t=0,s=(e||[]).length;tc.box.fullSize),!0),s=Ee(Ie(i,"left"),!0),n=Ee(Ie(i,"right")),o=Ee(Ie(i,"top"),!0),r=Ee(Ie(i,"bottom")),a=Oo(i,"x"),l=Oo(i,"y");return{fullSize:t,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:Ie(i,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function Ao(e,i,t,s){return Math.max(e[t],i[t])+Math.max(e[s],i[s])}function Mr(e,i){e.top=Math.max(e.top,i.top),e.left=Math.max(e.left,i.left),e.bottom=Math.max(e.bottom,i.bottom),e.right=Math.max(e.right,i.right)}function gh(e,i,t,s){let{pos:n,box:o}=t,r=e.maxPadding;if(!A(n)){t.size&&(e[n]-=t.size);let f=s[t.stack]||{size:0,count:1};f.size=Math.max(f.size,t.horizontal?o.height:o.width),t.size=f.size/f.count,e[n]+=t.size}o.getPadding&&Mr(r,o.getPadding());let a=Math.max(0,i.outerWidth-Ao(r,e,"left","right")),l=Math.max(0,i.outerHeight-Ao(r,e,"top","bottom")),c=a!==e.w,h=l!==e.h;return e.w=a,e.h=l,t.horizontal?{same:c,other:h}:{same:h,other:c}}function mh(e){let i=e.maxPadding;function t(s){let n=Math.max(i[s]-e[s],0);return e[s]+=n,n}e.y+=t("top"),e.x+=t("left"),t("right"),t("bottom")}function xh(e,i){let t=i.maxPadding;function s(n){let o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(i[r],t[r])}),o}return s(e?["left","right"]:["top","bottom"])}function Be(e,i,t,s){let n=[],o,r,a,l,c,h;for(o=0,r=e.length,c=0;o{typeof g.beforeLayout=="function"&&g.beforeLayout()});let h=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,f=Object.freeze({outerWidth:i,outerHeight:t,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},n);Mr(d,K(s));let u=Object.assign({maxPadding:d,w:o,h:r,x:n.left,y:n.top},n),p=uh(l.concat(c),f);Be(a.fullSize,u,f,p),Be(l,u,f,p),Be(c,u,f,p)&&Be(l,u,f,p),mh(u),Do(a.leftAndTop,u,f,p),u.x+=u.w,u.y+=u.h,Do(a.rightAndBottom,u,f,p),e.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},L(a.chartArea,g=>{let m=g.box;Object.assign(m,e.chartArea),m.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}},Li=class{acquireContext(i,t){}releaseContext(i){return!1}addEventListener(i,t,s){}removeEventListener(i,t,s){}getDevicePixelRatio(){return 1}getMaximumSize(i,t,s,n){return t=Math.max(0,t||i.width),s=s||i.height,{width:t,height:Math.max(0,n?Math.floor(t/n):s)}}isAttached(i){return!0}updateConfig(i){}},Ys=class extends Li{acquireContext(i){return i&&i.getContext&&i.getContext("2d")||null}updateConfig(i){i.options.animation=!1}},Ai="$chartjs",bh={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},To=e=>e===null||e==="";function _h(e,i){let t=e.style,s=e.getAttribute("height"),n=e.getAttribute("width");if(e[Ai]={initial:{height:s,width:n,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",To(n)){let o=As(e,"width");o!==void 0&&(e.width=o)}if(To(s))if(e.style.height==="")e.height=e.width/(i||2);else{let o=As(e,"height");o!==void 0&&(e.height=o)}return e}var wr=fo?{passive:!0}:!1;function yh(e,i,t){e&&e.addEventListener(i,t,wr)}function vh(e,i,t){e&&e.canvas&&e.canvas.removeEventListener(i,t,wr)}function Mh(e,i){let t=bh[e.type]||e.type,{x:s,y:n}=Tt(e,i);return{type:t,chart:i,native:e,x:s!==void 0?s:null,y:n!==void 0?n:null}}function Ri(e,i){for(let t of e)if(t===i||t.contains(i))return!0}function wh(e,i,t){let s=e.canvas,n=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Ri(a.addedNodes,s),r=r&&!Ri(a.removedNodes,s);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}function Sh(e,i,t){let s=e.canvas,n=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Ri(a.removedNodes,s),r=r&&!Ri(a.addedNodes,s);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}var Ne=new Map,Lo=0;function Sr(){let e=window.devicePixelRatio;e!==Lo&&(Lo=e,Ne.forEach((i,t)=>{t.currentDevicePixelRatio!==e&&i()}))}function kh(e,i){Ne.size||window.addEventListener("resize",Sr),Ne.set(e,i)}function Ch(e){Ne.delete(e),Ne.size||window.removeEventListener("resize",Sr)}function Ph(e,i,t){let s=e.canvas,n=s&&yi(s);if(!n)return;let o=ms((a,l)=>{let c=n.clientWidth;t(a,l),c{let l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),kh(e,o),r}function js(e,i,t){t&&t.disconnect(),i==="resize"&&Ch(e)}function Oh(e,i,t){let s=e.canvas,n=ms(o=>{e.ctx!==null&&t(Mh(o,e))},e);return yh(s,i,n),n}var Xs=class extends Li{acquireContext(i,t){let s=i&&i.getContext&&i.getContext("2d");return s&&s.canvas===i?(_h(i,t),s):null}releaseContext(i){let t=i.canvas;if(!t[Ai])return!1;let s=t[Ai].initial;["height","width"].forEach(o=>{let r=s[o];T(r)?t.removeAttribute(o):t.setAttribute(o,r)});let n=s.style||{};return Object.keys(n).forEach(o=>{t.style[o]=n[o]}),t.width=t.width,delete t[Ai],!0}addEventListener(i,t,s){this.removeEventListener(i,t);let n=i.$proxies||(i.$proxies={}),r={attach:wh,detach:Sh,resize:Ph}[t]||Oh;n[t]=r(i,t,s)}removeEventListener(i,t){let s=i.$proxies||(i.$proxies={}),n=s[t];if(!n)return;({attach:js,detach:js,resize:js}[t]||vh)(i,t,n),s[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(i,t,s,n){return ho(i,t,s,n)}isAttached(i){let t=i&&yi(i);return!!(t&&t.isConnected)}};function Ah(e){return!_i()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Ys:Xs}var lt=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(i){let{x:t,y:s}=this.getProps(["x","y"],i);return{x:t,y:s}}hasValue(){return $t(this.x)&&$t(this.y)}getProps(i,t){let s=this.$animations;if(!t||!s)return this;let n={};return i.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}};function Dh(e,i){let t=e.options.ticks,s=Th(e),n=Math.min(t.maxTicksLimit||s,s),o=t.major.enabled?Rh(i):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return Ih(i,c,o,r/n),c;let h=Lh(o,i,n);if(r>0){let f,d,u=r>1?Math.round((l-a)/(r-1)):null;for(wi(i,c,h,T(u)?0:a-u,a),f=0,d=r-1;fn)return l}return Math.max(n,1)}function Rh(e){let i=[],t,s;for(t=0,s=e.length;te==="left"?"right":e==="right"?"left":e,Ro=(e,i,t)=>i==="top"||i==="left"?e[i]+t:e[i]-t,Io=(e,i)=>Math.min(i||e,e);function Eo(e,i){let t=[],s=e.length/i,n=e.length,o=0;for(;or+a)))return l}function Bh(e,i){L(e,t=>{let s=t.gc,n=s.length/2,o;if(n>i){for(o=0;os?s:t,s=n&&t>s?t:s,{min:J(t,J(s,t)),max:J(s,J(t,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let i=this.chart.data;return this.options.labels||(this.isHorizontal()?i.xLabels:i.yLabels)||i.labels||[]}getLabelItems(i=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(i))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){I(this.options.beforeUpdate,[this])}update(i,t,s){let{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=i,this.maxHeight=t,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=no(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}let h=this._getLabelSizes(),f=h.widest.width,d=h.highest.height,u=U(this.chart.width-f,0,this.maxWidth);a=i.offset?this.maxWidth/s:u/(s-1),f+6>a&&(a=u/(s-(i.offset?.5:1)),l=this.maxHeight-Fe(i.grid)-t.padding-Fo(i.title,this.chart.options.font),c=Math.sqrt(f*f+d*d),r=di(Math.min(Math.asin(U((h.highest.height+6)/a,-1,1)),Math.asin(U(l/c,-1,1))-Math.asin(U(d/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){I(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){I(this.options.beforeFit,[this])}fit(){let i={width:0,height:0},{chart:t,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let l=Fo(n,t.options.font);if(a?(i.width=this.maxWidth,i.height=Fe(o)+l):(i.height=this.maxHeight,i.width=Fe(o)+l),s.display&&this.ticks.length){let{first:c,last:h,widest:f,highest:d}=this._getLabelSizes(),u=s.padding*2,p=nt(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(a){let b=s.mirror?0:m*f.width+g*d.height;i.height=Math.min(this.maxHeight,i.height+b+u)}else{let b=s.mirror?0:g*f.width+m*d.height;i.width=Math.min(this.maxWidth,i.width+b+u)}this._calculatePadding(c,h,m,g)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=i.height):(this.width=i.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(i,t,s,n){let{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let h=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1),d=0,u=0;l?c?(d=n*i.width,u=s*t.height):(d=s*i.height,u=n*t.width):o==="start"?u=t.width:o==="end"?d=i.width:o!=="inner"&&(d=i.width/2,u=t.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-f+r)*this.width/(this.width-f),0)}else{let h=t.height/2,f=i.height/2;o==="start"?(h=0,f=i.height):o==="end"&&(h=t.height,f=0),this.paddingTop=h+r,this.paddingBottom=f+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){I(this.options.afterFit,[this])}isHorizontal(){let{axis:i,position:t}=this.options;return t==="top"||t==="bottom"||i==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(i){this.beforeTickToLabelConversion(),this.generateTickLabels(i);let t,s;for(t=0,s=i.length;t({width:r[k]||0,height:a[k]||0});return{first:w(0),last:w(t-1),widest:w(v),highest:w(S),widths:r,heights:a}}getLabelForValue(i){return i}getPixelForValue(i,t){return NaN}getValueForPixel(i){}getPixelForTick(i){let t=this.ticks;return i<0||i>t.length-1?null:this.getPixelForValue(t[i].value)}getPixelForDecimal(i){this._reversePixels&&(i=1-i);let t=this._startPixel+i*this._length;return Xn(this._alignToPixels?Ot(this.chart,t,0):t)}getDecimalForPixel(i){let t=(i-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:i,max:t}=this;return i<0&&t<0?t:i>0&&t>0?i:0}getContext(i){let t=this.ticks||[];if(i>=0&&ia*n?a/s:l/n:l*n0}_computeGridLineItems(i){let t=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),d=Fe(o),u=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,b=function(N){return Ot(s,N,g)},x,y,M,_,v,S,w,k,O,P,D,Y;if(r==="top")x=b(this.bottom),S=this.bottom-d,k=x-m,P=b(i.top)+m,Y=i.bottom;else if(r==="bottom")x=b(this.top),P=i.top,Y=b(i.bottom)-m,S=x+m,k=this.top+d;else if(r==="left")x=b(this.right),v=this.right-d,w=x-m,O=b(i.left)+m,D=i.right;else if(r==="right")x=b(this.left),O=i.left,D=b(i.right)-m,v=x+m,w=this.left+d;else if(t==="x"){if(r==="center")x=b((i.top+i.bottom)/2+.5);else if(A(r)){let N=Object.keys(r)[0],H=r[N];x=b(this.chart.scales[N].getPixelForValue(H))}P=i.top,Y=i.bottom,S=x+m,k=S+d}else if(t==="y"){if(r==="center")x=b((i.left+i.right)/2);else if(A(r)){let N=Object.keys(r)[0],H=r[N];x=b(this.chart.scales[N].getPixelForValue(H))}v=x-m,w=v-d,O=i.left,D=i.right}let it=C(n.ticks.maxTicksLimit,f),R=Math.max(1,Math.ceil(f/it));for(y=0;y0&&(Nt-=jt/2);break}Ge={left:Nt,top:Me,width:jt+Gt.width,height:ve+Gt.height,color:R.backdropColor}}m.push({label:M,font:k,textOffset:D,options:{rotation:g,color:H,strokeColor:rt,strokeWidth:q,textAlign:qt,textBaseline:Y,translation:[_,v],backdrop:Ge}})}return m}_getXAxisLabelAlignment(){let{position:i,ticks:t}=this.options;if(-nt(this.labelRotation))return i==="top"?"left":"right";let n="center";return t.align==="start"?n="left":t.align==="end"?n="right":t.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(i){let{position:t,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=i+o,l=r.widest.width,c,h;return t==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):t==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,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;let i=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:i.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:i.width}}drawBackground(){let{ctx:i,options:{backgroundColor:t},left:s,top:n,width:o,height:r}=this;t&&(i.save(),i.fillStyle=t,i.fillRect(s,n,o,r),i.restore())}getLineWidthForValue(i){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let n=this.ticks.findIndex(o=>o.value===i);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(i){let t=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(i)),o,r,a=(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(t.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:t,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(i){let t=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[],o,r;for(o=0,r=t.length;o{let s=t.split("."),n=s.pop(),o=[e].concat(s).join("."),r=i[t].split("."),a=r.pop(),l=r.join(".");B.route(o,n,l,a)})}function Uh(e){return"id"in e&&"defaults"in e}var Ks=class{constructor(){this.controllers=new ce(Rt,"datasets",!0),this.elements=new ce(lt,"elements"),this.plugins=new ce(Object,"plugins"),this.scales=new ce(Kt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...i){this._each("register",i)}remove(...i){this._each("unregister",i)}addControllers(...i){this._each("register",i,this.controllers)}addElements(...i){this._each("register",i,this.elements)}addPlugins(...i){this._each("register",i,this.plugins)}addScales(...i){this._each("register",i,this.scales)}getController(i){return this._get(i,this.controllers,"controller")}getElement(i){return this._get(i,this.elements,"element")}getPlugin(i){return this._get(i,this.plugins,"plugin")}getScale(i){return this._get(i,this.scales,"scale")}removeControllers(...i){this._each("unregister",i,this.controllers)}removeElements(...i){this._each("unregister",i,this.elements)}removePlugins(...i){this._each("unregister",i,this.plugins)}removeScales(...i){this._each("unregister",i,this.scales)}_each(i,t,s){[...t].forEach(n=>{let o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(i,o,n):L(n,r=>{let a=s||this._getRegistryForType(r);this._exec(i,a,r)})})}_exec(i,t,s){let n=fi(i);I(s["before"+n],[],s),t[i](s),I(s["after"+n],[],s)}_getRegistryForType(i){for(let t=0;to.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(t,s),i,"stop"),this._notify(n(s,t),i,"start")}};function Yh(e){let i={},t=[],s=Object.keys(pt.plugins.items);for(let o=0;o1&&zo(e[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Bo(e,i,t){if(t[i+"AxisID"]===e)return{axis:i}}function Qh(e,i){if(i.data&&i.data.datasets){let t=i.data.datasets.filter(s=>s.xAxisID===e||s.yAxisID===e);if(t.length)return Bo(e,"x",t[0])||Bo(e,"y",t[0])}return{}}function tf(e,i){let t=Pt[e.type]||{scales:{}},s=i.scales||{},n=Gs(e.type,i),o=Object.create(null);return Object.keys(s).forEach(r=>{let a=s[r];if(!A(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let l=Zs(r,a,Qh(r,e),B.scales[a.type]),c=Zh(l,n),h=t.scales||{};o[r]=ee(Object.create(null),[{axis:l},a,h[l],h[c]])}),e.data.datasets.forEach(r=>{let a=r.type||e.type,l=r.indexAxis||Gs(a,i),h=(Pt[a]||{}).scales||{};Object.keys(h).forEach(f=>{let d=Gh(f,l),u=r[d+"AxisID"]||d;o[u]=o[u]||Object.create(null),ee(o[u],[{axis:d},s[u],h[f]])})}),Object.keys(o).forEach(r=>{let a=o[r];ee(a,[B.scales[a.type],B.scale])}),o}function kr(e){let i=e.options||(e.options={});i.plugins=C(i.plugins,{}),i.scales=tf(e,i)}function Cr(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function ef(e){return e=e||{},e.data=Cr(e.data),kr(e),e}var jo=new Map,Pr=new Set;function Si(e,i){let t=jo.get(e);return t||(t=i(),jo.set(e,t),Pr.add(t)),t}var ze=(e,i,t)=>{let s=_t(i,t);s!==void 0&&e.add(s)},Js=class{constructor(i){this._config=ef(i),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(i){this._config.type=i}get data(){return this._config.data}set data(i){this._config.data=Cr(i)}get options(){return this._config.options}set options(i){this._config.options=i}get plugins(){return this._config.plugins}update(){let i=this._config;this.clearCache(),kr(i)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(i){return Si(i,()=>[[`datasets.${i}`,""]])}datasetAnimationScopeKeys(i,t){return Si(`${i}.transition.${t}`,()=>[[`datasets.${i}.transitions.${t}`,`transitions.${t}`],[`datasets.${i}`,""]])}datasetElementScopeKeys(i,t){return Si(`${i}-${t}`,()=>[[`datasets.${i}.elements.${t}`,`datasets.${i}`,`elements.${t}`,""]])}pluginScopeKeys(i){let t=i.id,s=this.type;return Si(`${s}-plugin-${t}`,()=>[[`plugins.${t}`,...i.additionalOptionScopes||[]]])}_cachedScopes(i,t){let s=this._scopeCache,n=s.get(i);return(!n||t)&&(n=new Map,s.set(i,n)),n}getOptionScopes(i,t,s){let{options:n,type:o}=this,r=this._cachedScopes(i,s),a=r.get(t);if(a)return a;let l=new Set;t.forEach(h=>{i&&(l.add(i),h.forEach(f=>ze(l,i,f))),h.forEach(f=>ze(l,n,f)),h.forEach(f=>ze(l,Pt[o]||{},f)),h.forEach(f=>ze(l,B,f)),h.forEach(f=>ze(l,gi,f))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Pr.has(t)&&r.set(t,c),c}chartOptionScopes(){let{options:i,type:t}=this;return[i,Pt[t]||{},B.datasets[t]||{},{type:t},B,gi]}resolveNamedOptions(i,t,s,n=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=No(this._resolverCache,i,n),l=r;if(nf(r,t)){o.$shared=!1,s=xt(s)?s():s;let c=this.createResolver(i,s,a);l=Ht(r,s,c)}for(let c of t)o[c]=l[c];return o}createResolver(i,t,s=[""],n){let{resolver:o}=No(this._resolverCache,i,s);return A(t)?Ht(o,t,void 0,n):o}};function No(e,i,t){let s=e.get(i);s||(s=new Map,e.set(i,s));let n=t.join(),o=s.get(n);return o||(o={resolver:bi(i,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}var sf=e=>A(e)&&Object.getOwnPropertyNames(e).some(i=>xt(e[i]));function nf(e,i){let{isScriptable:t,isIndexable:s}=Ss(e);for(let n of i){let o=t(n),r=s(n),a=(r||o)&&e[n];if(o&&(xt(a)||sf(a))||r&&E(a))return!0}return!1}var of="4.4.4",rf=["top","bottom","left","right","chartArea"];function Wo(e,i){return e==="top"||e==="bottom"||rf.indexOf(e)===-1&&i==="x"}function Vo(e,i){return function(t,s){return t[e]===s[e]?t[i]-s[i]:t[e]-s[e]}}function Ho(e){let i=e.chart,t=i.options.animation;i.notifyPlugins("afterRender"),I(t&&t.onComplete,[e],i)}function af(e){let i=e.chart,t=i.options.animation;I(t&&t.onProgress,[e],i)}function Or(e){return _i()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}var Di={},$o=e=>{let i=Or(e);return Object.values(Di).filter(t=>t.canvas===i).pop()};function lf(e,i,t){let s=Object.keys(e);for(let n of s){let o=+n;if(o>=i){let r=e[n];delete e[n],(t>0||o>i)&&(e[o+t]=r)}}}function cf(e,i,t,s){return!t||e.type==="mouseout"?null:s?i:e}function ki(e,i,t){return e.options.clip?e[t]:i[t]}function hf(e,i){let{xScale:t,yScale:s}=e;return t&&s?{left:ki(t,i,"left"),right:ki(t,i,"right"),top:ki(s,i,"top"),bottom:ki(s,i,"bottom")}:i}var zi=(()=>{class e{static defaults=B;static instances=Di;static overrides=Pt;static registry=pt;static version=of;static getChart=$o;static register(...t){pt.add(...t),Uo()}static unregister(...t){pt.remove(...t),Uo()}constructor(t,s){let n=this.config=new Js(s),o=Or(t),r=$o(o);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");let a=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||Ah(o)),this.platform.updateConfig(n);let l=this.platform.acquireContext(o,a.aspectRatio),c=l&&l.canvas,h=c&&c.height,f=c&&c.width;if(this.id=Wn(),this.ctx=l,this.canvas=c,this.width=f,this.height=h,this._options=a,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 qs,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Jn(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Di[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}vt.listen(this,"complete",Ho),vt.listen(this,"progress",af),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:s},width:n,height:o,_aspectRatio:r}=this;return T(t)?s&&r?r:o?n/o: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 pt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Os(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return vs(this.canvas,this.ctx),this}stop(){return vt.stop(this),this}resize(t,s){vt.running(this)?this._resizeBeforeDraw={width:t,height:s}:this._resize(t,s)}_resize(t,s){let n=this.options,o=this.canvas,r=n.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(o,t,s,r),l=n.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Os(this,l,!0)&&(this.notifyPlugins("resize",{size:a}),I(n.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){let s=this.options.scales||{};L(s,(n,o)=>{n.id=o})}buildOrUpdateScales(){let t=this.options,s=t.scales,n=this.scales,o=Object.keys(n).reduce((a,l)=>(a[l]=!1,a),{}),r=[];s&&(r=r.concat(Object.keys(s).map(a=>{let l=s[a],c=Zs(a,l),h=c==="r",f=c==="x";return{options:l,dposition:h?"chartArea":f?"bottom":"left",dtype:h?"radialLinear":f?"category":"linear"}}))),L(r,a=>{let l=a.options,c=l.id,h=Zs(c,l),f=C(l.type,a.dtype);(l.position===void 0||Wo(l.position,h)!==Wo(a.dposition))&&(l.position=a.dposition),o[c]=!0;let d=null;if(c in n&&n[c].type===f)d=n[c];else{let u=pt.getScale(f);d=new u({id:c,type:f,ctx:this.ctx,chart:this}),n[d.id]=d}d.init(l,t)}),L(o,(a,l)=>{a||delete n[l]}),L(n,a=>{G.configure(this,a,a.options),G.addBox(this,a)})}_updateMetasets(){let t=this._metasets,s=this.data.datasets.length,n=t.length;if(t.sort((o,r)=>o.index-r.index),n>s){for(let o=s;os.length&&delete this._stacks,t.forEach((n,o)=>{s.filter(r=>r===n._dataset).length===0&&this._destroyDatasetMeta(o)})}buildOrUpdateControllers(){let t=[],s=this.data.datasets,n,o;for(this._removeUnreferencedMetasets(),n=0,o=s.length;n{this.getDatasetMeta(s).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let s=this.config;s.update();let n=this._options=s.createResolver(s.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let h=0,f=this.data.datasets.length;h{h.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Vo("z","_idx"));let{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){L(this.scales,t=>{G.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,s=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!ls(s,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,s=this._getUniformDataChanges()||[];for(let{method:n,start:o,count:r}of s){let a=n==="_removeElements"?-r:r;lf(t,o,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let s=this.data.datasets.length,n=r=>new Set(t.filter(a=>a[0]===r).map((a,l)=>l+","+a.splice(1).join(","))),o=n(0);for(let r=1;rr.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;G.update(this,this.width,this.height,t);let s=this.chartArea,n=s.width<=0||s.height<=0;this._layers=[],L(this.boxes,o=>{n&&o.position==="chartArea"||(o.configure&&o.configure(),this._layers.push(...o._layers()))},this),this._layers.forEach((o,r)=>{o._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let s=0,n=this.data.datasets.length;s=0;--s)this._drawDataset(t[s]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let s=this.ctx,n=t._clip,o=!n.disabled,r=hf(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(o&&Te(s,{left:n.left===!1?0:r.left-n.left,right:n.right===!1?this.width:r.right+n.right,top:n.top===!1?0:r.top-n.top,bottom:n.bottom===!1?this.height:r.bottom+n.bottom}),t.controller.draw(),o&&Le(s),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return ht(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,s,n,o){let r=hh.modes[s];return typeof r=="function"?r(this,t,n,o):[]}getDatasetMeta(t){let s=this.data.datasets[t],n=this._metasets,o=n.filter(r=>r&&r._dataset===s).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:s&&s.order||0,index:t,_dataset:s,_parsed:[],_sorted:!1},n.push(o)),o}getContext(){return this.$context||(this.$context=yt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let s=this.data.datasets[t];if(!s)return!1;let n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!s.hidden}setDatasetVisibility(t,s){let n=this.getDatasetMeta(t);n.hidden=!s}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,s,n){let o=n?"show":"hide",r=this.getDatasetMeta(t),a=r.controller._resolveAnimations(void 0,o);ie(s)?(r.data[s].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),a.update(r,{visible:n}),this.update(l=>l.datasetIndex===t?o:void 0))}hide(t,s){this._updateVisibility(t,s,!1)}show(t,s){this._updateVisibility(t,s,!0)}_destroyDatasetMeta(t){let s=this._metasets[t];s&&s.controller&&s.controller._destroy(),delete this._metasets[t]}_stop(){let t,s;for(this.stop(),vt.remove(this),t=0,s=this.data.datasets.length;t{s.addEventListener(this,r,a),t[r]=a},o=(r,a,l)=>{r.offsetX=a,r.offsetY=l,this._eventHandler(r)};L(this.options.events,r=>n(r,o))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,s=this.platform,n=(c,h)=>{s.addEventListener(this,c,h),t[c]=h},o=(c,h)=>{t[c]&&(s.removeEventListener(this,c,h),delete t[c])},r=(c,h)=>{this.canvas&&this.resize(c,h)},a,l=()=>{o("attach",l),this.attached=!0,this.resize(),n("resize",r),n("detach",a)};a=()=>{this.attached=!1,o("resize",r),this._stop(),this._resize(0,0),n("attach",l)},s.isAttached(this.canvas)?l():a()}unbindEvents(){L(this._listeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._listeners={},L(this._responsiveListeners,(t,s)=>{this.platform.removeEventListener(this,s,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,s,n){let o=n?"set":"remove",r,a,l,c;for(s==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+o+"DatasetHoverStyle"]()),l=0,c=t.length;l{let l=this.getDatasetMeta(r);if(!l)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:l.data[a],index:a}});!Ae(n,s)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,s))}notifyPlugins(t,s,n){return this._plugins.notify(this,t,s,n)}isPluginEnabled(t){return this._plugins._cache.filter(s=>s.plugin.id===t).length===1}_updateHoverStyles(t,s,n){let o=this.options.hover,r=(c,h)=>c.filter(f=>!h.some(d=>f.datasetIndex===d.datasetIndex&&f.index===d.index)),a=r(s,t),l=n?t:r(t,s);a.length&&this.updateHoverStyle(a,o.mode,!1),l.length&&o.mode&&this.updateHoverStyle(l,o.mode,!0)}_eventHandler(t,s){let n={event:t,replay:s,cancelable:!0,inChartArea:this.isPointInArea(t)},o=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,o)===!1)return;let r=this._handleEvent(t,s,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,o),(r||n.changed)&&this.render(),this}_handleEvent(t,s,n){let{_active:o=[],options:r}=this,a=s,l=this._getActiveElements(t,o,n,a),c=$n(t),h=cf(t,this._lastEvent,n,c);n&&(this._lastEvent=null,I(r.onHover,[t,l,this],this),c&&I(r.onClick,[t,l,this],this));let f=!Ae(l,o);return(f||s)&&(this._active=l,this._updateHoverStyles(l,o,s)),this._lastEvent=h,f}_getActiveElements(t,s,n,o){if(t.type==="mouseout")return[];if(!n)return s;let r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,o)}}return e})();function Uo(){return L(zi.instances,e=>e._plugins.invalidate())}function ff(e,i,t){let{startAngle:s,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:l}=i,c=n/a;e.beginPath(),e.arc(o,r,a,s-c,t+c),l>n?(c=n/l,e.arc(o,r,l,t+c,s-c,!0)):e.arc(o,r,n,t+V,s-V),e.closePath(),e.clip()}function df(e){return xi(e,["outerStart","outerEnd","innerStart","innerEnd"])}function uf(e,i,t,s){let n=df(e.options.borderRadius),o=(t-i)/2,r=Math.min(o,s*i/2),a=l=>{let c=(t-Math.min(o,l))*s/2;return U(l,0,Math.min(o,c))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:U(n.innerStart,0,r),innerEnd:U(n.innerEnd,0,r)}}function le(e,i,t,s){return{x:t+e*Math.cos(i),y:s+e*Math.sin(i)}}function Ii(e,i,t,s,n,o){let{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=i,f=Math.max(i.outerRadius+s+t-c,0),d=h>0?h+s+t+c:0,u=0,p=n-l;if(s){let R=h>0?h-s:0,N=f>0?f-s:0,H=(R+N)/2,rt=H!==0?p*H/(H+s):p;u=(p-rt)/2}let g=Math.max(.001,p*f-t/F)/f,m=(p-g)/2,b=l+m+u,x=n-m-u,{outerStart:y,outerEnd:M,innerStart:_,innerEnd:v}=uf(i,d,f,x-b),S=f-y,w=f-M,k=b+y/S,O=x-M/w,P=d+_,D=d+v,Y=b+_/P,it=x-v/D;if(e.beginPath(),o){let R=(k+O)/2;if(e.arc(r,a,f,k,R),e.arc(r,a,f,R,O),M>0){let q=le(w,O,r,a);e.arc(q.x,q.y,M,O,x+V)}let N=le(D,x,r,a);if(e.lineTo(N.x,N.y),v>0){let q=le(D,it,r,a);e.arc(q.x,q.y,v,x+V,it+Math.PI)}let H=(x-v/d+(b+_/d))/2;if(e.arc(r,a,d,x-v/d,H,!0),e.arc(r,a,d,H,b+_/d,!0),_>0){let q=le(P,Y,r,a);e.arc(q.x,q.y,_,Y+Math.PI,b-V)}let rt=le(S,b,r,a);if(e.lineTo(rt.x,rt.y),y>0){let q=le(S,k,r,a);e.arc(q.x,q.y,y,b-V,k)}}else{e.moveTo(r,a);let R=Math.cos(k)*f+r,N=Math.sin(k)*f+a;e.lineTo(R,N);let H=Math.cos(O)*f+r,rt=Math.sin(O)*f+a;e.lineTo(H,rt)}e.closePath()}function pf(e,i,t,s,n){let{fullCircles:o,startAngle:r,circumference:a}=i,l=i.endAngle;if(o){Ii(e,i,t,s,l,n);for(let c=0;ci!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(i){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,i&&Object.assign(this,i)}inRange(i,t,s){let n=this.getProps(["x","y"],s),{angle:o,distance:r}=ds(n,{x:i,y:t}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:h,circumference:f}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],s),d=(this.options.spacing+this.options.borderWidth)/2,u=C(f,l-a),p=ne(o,a,l)&&a!==l,g=u>=z||p,m=dt(r,c+d,h+d);return g&&m}getCenterPoint(i){let{x:t,y:s,startAngle:n,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],i),{offset:l,spacing:c}=this.options,h=(n+o)/2,f=(r+a+c+l)/2;return{x:t+Math.cos(h)*f,y:s+Math.sin(h)*f}}tooltipPosition(i){return this.getCenterPoint(i)}draw(i){let{options:t,circumference:s}=this,n=(t.offset||0)/4,o=(t.spacing||0)/2,r=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=s>z?Math.floor(s/z):0,s===0||this.innerRadius<0||this.outerRadius<0)return;i.save();let a=(this.startAngle+this.endAngle)/2;i.translate(Math.cos(a)*n,Math.sin(a)*n);let l=1-Math.sin(Math.min(F,s||0)),c=n*l;i.fillStyle=t.backgroundColor,i.strokeStyle=t.borderColor,pf(i,this,c,o,r),gf(i,this,c,o,r),i.restore()}};function Ar(e,i,t=i){e.lineCap=C(t.borderCapStyle,i.borderCapStyle),e.setLineDash(C(t.borderDash,i.borderDash)),e.lineDashOffset=C(t.borderDashOffset,i.borderDashOffset),e.lineJoin=C(t.borderJoinStyle,i.borderJoinStyle),e.lineWidth=C(t.borderWidth,i.borderWidth),e.strokeStyle=C(t.borderColor,i.borderColor)}function mf(e,i,t){e.lineTo(t.x,t.y)}function xf(e){return e.stepped?io:e.tension||e.cubicInterpolationMode==="monotone"?so:mf}function Dr(e,i,t={}){let s=e.length,{start:n=0,end:o=s-1}=t,{start:r,end:a}=i,l=Math.max(n,r),c=Math.min(o,a),h=na&&o>a;return{count:s,start:l,loop:i.loop,ilen:c(r+(c?a-M:M))%o,y=()=>{g!==m&&(e.lineTo(h,m),e.lineTo(h,g),e.lineTo(h,b))};for(l&&(u=n[x(0)],e.moveTo(u.x,u.y)),d=0;d<=a;++d){if(u=n[x(d)],u.skip)continue;let M=u.x,_=u.y,v=M|0;v===p?(_m&&(m=_),h=(f*h+M)/++f):(y(),e.lineTo(M,_),p=v,f=0,g=m=_),b=_}y()}function tn(e){let i=e.options,t=i.borderDash&&i.borderDash.length;return!e._decimated&&!e._loop&&!i.tension&&i.cubicInterpolationMode!=="monotone"&&!i.stepped&&!t?_f:bf}function yf(e){return e.stepped?uo:e.tension||e.cubicInterpolationMode==="monotone"?po:Ct}function vf(e,i,t,s){let n=i._path;n||(n=i._path=new Path2D,i.path(n,t,s)&&n.closePath()),Ar(e,i.options),e.stroke(n)}function Mf(e,i,t,s){let{segments:n,options:o}=i,r=tn(i);for(let a of n)Ar(e,o,a.style),e.beginPath(),r(e,i,a,{start:t,end:t+s-1})&&e.closePath(),e.stroke()}var wf=typeof Path2D=="function";function Sf(e,i,t,s){wf&&!i.options.segment?vf(e,i,t,s):Mf(e,i,t,s)}var Bi=(()=>{class e extends lt{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,s){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let o=n.spanGaps?this._loop:this._fullLoop;co(this._points,n,t,o,s),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=mo(this,this.options.segment))}first(){let t=this.segments,s=this.points;return t.length&&s[t[0].start]}last(){let t=this.segments,s=this.points,n=t.length;return n&&s[t[n-1].end]}interpolate(t,s){let n=this.options,o=t[s],r=this.points,a=Rs(this,{property:s,start:o,end:o});if(!a.length)return;let l=[],c=yf(n),h,f;for(h=0,f=a.length;h{class e extends lt{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,s,n){let o=this.options,{x:r,y:a}=this.getProps(["x","y"],n);return Math.pow(t-r,2)+Math.pow(s-a,2)e.replace("rgb(","rgba(").replace(")",", 0.5)"));function Lr(e){return sn[e%sn.length]}function Rr(e){return Xo[e%Xo.length]}function Lf(e,i){return e.borderColor=Lr(i),e.backgroundColor=Rr(i),++i}function Rf(e,i){return e.backgroundColor=e.data.map(()=>Lr(i++)),i}function If(e,i){return e.backgroundColor=e.data.map(()=>Rr(i++)),i}function Ef(e){let i=0;return(t,s)=>{let n=e.getDatasetMeta(s).controller;n instanceof fn?i=Rf(t,i):n instanceof yr?i=If(t,i):n&&(i=Lf(t,i))}}function Ko(e){let i;for(i in e)if(e[i].borderColor||e[i].backgroundColor)return!0;return!1}function Ff(e){return e&&(e.borderColor||e.backgroundColor)}var zf={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,i,t){if(!t.enabled)return;let{data:{datasets:s},options:n}=e.config,{elements:o}=n;if(!t.forceOverride&&(Ko(s)||Ff(n)||o&&Ko(o)))return;let r=Ef(e);s.forEach(r)}};function Bf(e,i,t,s,n){let o=n.samples||s;if(o>=t)return e.slice(i,i+t);let r=[],a=(t-2)/(o-2),l=0,c=i+t-1,h=i,f,d,u,p,g;for(r[l++]=e[h],f=0;fu&&(u=p,d=e[x],g=x);r[l++]=d,h=g}return r[l++]=e[c],r}function jf(e,i,t,s){let n=0,o=0,r,a,l,c,h,f,d,u,p,g,m=[],b=i+t-1,x=e[i].x,M=e[b].x-x;for(r=i;rg&&(g=c,d=r),n=(o*n+a.x)/++o;else{let v=r-1;if(!T(f)&&!T(d)){let S=Math.min(f,d),w=Math.max(f,d);S!==u&&S!==v&&m.push(Je(Ze({},e[S]),{x:n})),w!==u&&w!==v&&m.push(Je(Ze({},e[w]),{x:n}))}r>0&&v!==u&&m.push(e[v]),m.push(a),h=_,o=0,p=g=c,f=d=u=r}}return m}function Ir(e){if(e._decimated){let i=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:i})}}function qo(e){e.data.datasets.forEach(i=>{Ir(i)})}function Nf(e,i){let t=i.length,s=0,n,{iScale:o}=e,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(s=U(ct(i,o.axis,r).lo,0,t-1)),c?n=U(ct(i,o.axis,a).hi+1,s,t)-s:n=t-s,{start:s,count:n}}var Wf={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,i,t)=>{if(!t.enabled){qo(e);return}let s=e.width;e.data.datasets.forEach((n,o)=>{let{_data:r,indexAxis:a}=n,l=e.getDatasetMeta(o),c=r||n.data;if(ae([a,e.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let h=e.scales[l.xAxisID];if(h.type!=="linear"&&h.type!=="time"||e.options.parsing)return;let{start:f,count:d}=Nf(l,c),u=t.threshold||4*s;if(d<=u){Ir(n);return}T(r)&&(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 p;switch(t.algorithm){case"lttb":p=Bf(c,f,d,s,t);break;case"min-max":p=jf(c,f,d,s);break;default:throw new Error(`Unsupported decimation algorithm '${t.algorithm}'`)}n._decimated=p})},destroy(e){qo(e)}};function Vf(e,i,t){let s=e.segments,n=e.points,o=i.points,r=[];for(let a of s){let{start:l,end:c}=a;c=dn(l,c,n);let h=nn(t,n[l],n[c],a.loop);if(!i.segments){r.push({source:a,target:h,start:n[l],end:n[c]});continue}let f=Rs(i,h);for(let d of f){let u=nn(t,o[d.start],o[d.end],d.loop),p=Ls(a,n,u);for(let g of p)r.push({source:g,target:d,start:{[t]:Go(h,u,"start",Math.max)},end:{[t]:Go(h,u,"end",Math.min)}})}}return r}function nn(e,i,t,s){if(s)return;let n=i[e],o=t[e];return e==="angle"&&(n=Z(n),o=Z(o)),{property:e,start:n,end:o}}function Hf(e,i){let{x:t=null,y:s=null}=e||{},n=i.points,o=[];return i.segments.forEach(({start:r,end:a})=>{a=dn(r,a,n);let l=n[r],c=n[a];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):t!==null&&(o.push({x:t,y:l.y}),o.push({x:t,y:c.y}))}),o}function dn(e,i,t){for(;i>e;i--){let s=t[i];if(!isNaN(s.x)&&!isNaN(s.y))break}return i}function Go(e,i,t,s){return e&&i?s(e[t],i[t]):e?e[t]:i?i[t]:0}function Er(e,i){let t=[],s=!1;return E(e)?(s=!0,t=e):t=Hf(e,i),t.length?new Bi({points:t,options:{tension:0},_loop:s,_fullLoop:s}):null}function Zo(e){return e&&e.fill!==!1}function $f(e,i,t){let n=e[i].fill,o=[i],r;if(!t)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!W(n))return n;if(r=e[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function Uf(e,i,t){let s=qf(e);if(A(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return W(n)&&Math.floor(n)===n?Yf(s[0],i,n,t):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function Yf(e,i,t,s){return(e==="-"||e==="+")&&(t=i+t),t===i||t<0||t>=s?!1:t}function Xf(e,i){let t=null;return e==="start"?t=i.bottom:e==="end"?t=i.top:A(e)?t=i.getPixelForValue(e.value):i.getBasePixel&&(t=i.getBasePixel()),t}function Kf(e,i,t){let s;return e==="start"?s=t:e==="end"?s=i.options.reverse?i.min:i.max:A(e)?s=e.value:s=i.getBaseValue(),s}function qf(e){let i=e.options,t=i.fill,s=C(t&&t.target,t);return s===void 0&&(s=!!i.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function Gf(e){let{scale:i,index:t,line:s}=e,n=[],o=s.segments,r=s.points,a=Zf(i,t);a.push(Er({x:null,y:i.bottom},s));for(let l=0;l=0;--r){let a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&Vs(e.ctx,a,o))}},beforeDatasetsDraw(e,i,t){if(t.drawTime!=="beforeDatasetsDraw")return;let s=e.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){let o=s[n].$filler;Zo(o)&&Vs(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,i,t){let s=i.meta.$filler;!Zo(s)||t.drawTime!=="beforeDatasetDraw"||Vs(e.ctx,s,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},er=(e,i)=>{let{boxHeight:t=i,boxWidth:s=i}=e;return e.usePointStyle&&(t=Math.min(t,i),s=e.pointStyleWidth||Math.min(s,i)),{boxWidth:s,boxHeight:t,itemHeight:Math.max(i,t)}},ld=(e,i)=>e!==null&&i!==null&&e.datasetIndex===i.datasetIndex&&e.index===i.index,Fi=class extends lt{constructor(i){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=i.chart,this.options=i.options,this.ctx=i.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(i,t,s){this.maxWidth=i,this.maxHeight=t,this._margins=s,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(){let i=this.options.labels||{},t=I(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(s=>i.filter(s,this.chart.data))),i.sort&&(t=t.sort((s,n)=>i.sort(s,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:i,ctx:t}=this;if(!i.display){this.width=this.height=0;return}let s=i.labels,n=$(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=er(s,o),c,h;t.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,i.maxWidth||this.maxWidth),this.height=Math.min(h,i.maxHeight||this.maxHeight)}_fitRows(i,t,s,n){let{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a,f=i;o.textAlign="left",o.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach((p,g)=>{let m=s+t/2+o.measureText(p.text).width;(g===0||c[c.length-1]+m+2*a>r)&&(f+=h,c[c.length-(g>0?0:1)]=0,u+=h,d++),l[g]={left:0,top:u,row:d,width:m,height:n},c[c.length-1]+=m+a}),f}_fitCols(i,t,s,n){let{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-i,f=a,d=0,u=0,p=0,g=0;return this.legendItems.forEach((m,b)=>{let{itemWidth:x,itemHeight:y}=cd(s,t,o,m,n);b>0&&u+y+2*a>h&&(f+=d+a,c.push({width:d,height:u}),p+=d+a,g++,d=u=0),l[b]={left:p,top:u,col:g,width:x,height:y},d=Math.max(d,x),u+=y+a}),f+=d,c.push({width:d,height:u}),f}adjustHitBoxes(){if(!this.options.display)return;let i=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:s,labels:{padding:n},rtl:o}}=this,r=Ut(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=X(s,this.left+n,this.right-this.lineWidths[a]);for(let c of t)a!==c.row&&(a=c.row,l=X(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+i+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=X(s,this.top+i+n,this.bottom-this.columnSizes[a].height);for(let c of t)c.col!==a&&(a=c.col,l=X(s,this.top+i+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let i=this.ctx;Te(i,this),this._draw(),Le(i)}}_draw(){let{options:i,columnSizes:t,lineWidths:s,ctx:n}=this,{align:o,labels:r}=i,a=B.color,l=Ut(i.rtl,this.left,this.width),c=$(r.font),{padding:h}=r,f=c.size,d=f/2,u;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;let{boxWidth:p,boxHeight:g,itemHeight:m}=er(r,f),b=function(v,S,w){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;n.save();let k=C(w.lineWidth,1);if(n.fillStyle=C(w.fillStyle,a),n.lineCap=C(w.lineCap,"butt"),n.lineDashOffset=C(w.lineDashOffset,0),n.lineJoin=C(w.lineJoin,"miter"),n.lineWidth=k,n.strokeStyle=C(w.strokeStyle,a),n.setLineDash(C(w.lineDash,[])),r.usePointStyle){let O={radius:g*Math.SQRT2/2,pointStyle:w.pointStyle,rotation:w.rotation,borderWidth:k},P=l.xPlus(v,p/2),D=S+d;Ms(n,O,P,D,r.pointStyleWidth&&p)}else{let O=S+Math.max((f-g)/2,0),P=l.leftForLtr(v,p),D=Dt(w.borderRadius);n.beginPath(),Object.values(D).some(Y=>Y!==0)?re(n,{x:P,y:O,w:p,h:g,radius:D}):n.rect(P,O,p,g),n.fill(),k!==0&&n.stroke()}n.restore()},x=function(v,S,w){At(n,w.text,v,S+m/2,c,{strikethrough:w.hidden,textAlign:l.textAlign(w.textAlign)})},y=this.isHorizontal(),M=this._computeTitleHeight();y?u={x:X(o,this.left+h,this.right-s[0]),y:this.top+h+M,line:0}:u={x:this.left+h,y:X(o,this.top+M+h,this.bottom-t[0].height),line:0},Ds(this.ctx,i.textDirection);let _=m+h;this.legendItems.forEach((v,S)=>{n.strokeStyle=v.fontColor,n.fillStyle=v.fontColor;let w=n.measureText(v.text).width,k=l.textAlign(v.textAlign||(v.textAlign=r.textAlign)),O=p+d+w,P=u.x,D=u.y;l.setWidth(this.width),y?S>0&&P+O+h>this.right&&(D=u.y+=_,u.line++,P=u.x=X(o,this.left+h,this.right-s[u.line])):S>0&&D+_>this.bottom&&(P=u.x=P+t[u.line].width+h,u.line++,D=u.y=X(o,this.top+M+h,this.bottom-t[u.line].height));let Y=l.x(P);if(b(Y,D,v),P=Qn(k,P+p+d,y?P+O:this.right,i.rtl),x(l.x(P),D,v),y)u.x+=O+h;else if(typeof v.text!="string"){let it=c.lineHeight;u.y+=Fr(v,it)+h}else u.y+=_}),Ts(this.ctx,i.textDirection)}drawTitle(){let i=this.options,t=i.title,s=$(t.font),n=K(t.padding);if(!t.display)return;let o=Ut(i.rtl,this.left,this.width),r=this.ctx,a=t.position,l=s.size/2,c=n.top+l,h,f=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+c,f=X(i.align,f,this.right-d);else{let p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);h=c+X(i.align,this.top,this.bottom-p-i.labels.padding-this._computeTitleHeight())}let u=X(a,f,f+d);r.textAlign=o.textAlign(pi(a)),r.textBaseline="middle",r.strokeStyle=t.color,r.fillStyle=t.color,r.font=s.string,At(r,t.text,u,h,s)}_computeTitleHeight(){let i=this.options.title,t=$(i.font),s=K(i.padding);return i.display?t.lineHeight+s.height:0}_getLegendItemAt(i,t){let s,n,o;if(dt(i,this.left,this.right)&&dt(t,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;so.length>r.length?o:r)),i+t.size/2+s.measureText(n).width}function fd(e,i,t){let s=e;return typeof i.text!="string"&&(s=Fr(i,t)),s}function Fr(e,i){let t=e.text?e.text.length:0;return i*t}function dd(e,i){return!!((e==="mousemove"||e==="mouseout")&&(i.onHover||i.onLeave)||i.onClick&&(e==="click"||e==="mouseup"))}var ud={id:"legend",_element:Fi,start(e,i,t){let s=e.legend=new Fi({ctx:e.ctx,options:t,chart:e});G.configure(e,s,t),G.addBox(e,s)},stop(e){G.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,i,t){let s=e.legend;G.configure(e,s,t),s.options=t},afterUpdate(e){let i=e.legend;i.buildLabels(),i.adjustHitBoxes()},afterEvent(e,i){i.replay||e.legend.handleEvent(i.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,i,t){let s=i.datasetIndex,n=t.chart;n.isDatasetVisible(s)?(n.hide(s),i.hidden=!0):(n.show(s),i.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){let i=e.data.datasets,{labels:{usePointStyle:t,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(t?0:void 0),h=K(c.borderWidth);return{text:i[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:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}},We=class extends lt{constructor(i){super(),this.chart=i.chart,this.options=i.options,this.ctx=i.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(i,t){let s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=i,this.height=this.bottom=t;let n=E(s.text)?s.text.length:1;this._padding=K(s.padding);let o=n*$(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let i=this.options.position;return i==="top"||i==="bottom"}_drawArgs(i){let{top:t,left:s,bottom:n,right:o,options:r}=this,a=r.align,l=0,c,h,f;return this.isHorizontal()?(h=X(a,s,o),f=t+i,c=o-s):(r.position==="left"?(h=s+i,f=X(a,n,t),l=F*-.5):(h=o-i,f=X(a,t,n),l=F*.5),c=n-t),{titleX:h,titleY:f,maxWidth:c,rotation:l}}draw(){let i=this.ctx,t=this.options;if(!t.display)return;let s=$(t.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);At(i,t.text,0,0,s,{color:t.color,maxWidth:l,rotation:c,textAlign:pi(t.align),textBaseline:"middle",translation:[r,a]})}};function pd(e,i){let t=new We({ctx:e.ctx,options:i,chart:e});G.configure(e,t,i),G.addBox(e,t),e.titleBlock=t}var gd={id:"title",_element:We,start(e,i,t){pd(e,t)},stop(e){let i=e.titleBlock;G.removeBox(e,i),delete e.titleBlock},beforeUpdate(e,i,t){let s=e.titleBlock;G.configure(e,s,t),s.options=t},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}},Ci=new WeakMap,md={id:"subtitle",start(e,i,t){let s=new We({ctx:e.ctx,options:t,chart:e});G.configure(e,s,t),G.addBox(e,s),Ci.set(e,s)},stop(e){G.removeBox(e,Ci.get(e)),Ci.delete(e)},beforeUpdate(e,i,t){let s=Ci.get(e);G.configure(e,s,t),s.options=t},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}},je={average(e){if(!e.length)return!1;let i,t,s=new Set,n=0,o=0;for(i=0,t=e.length;ia+l)/s.size,y:n/o}},nearest(e,i){if(!e.length)return!1;let t=i.x,s=i.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=e.length;o-1?e.split(`
+`):e}function xd(e,i){let{element:t,datasetIndex:s,index:n}=i,o=e.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:e,label:r,parsed:o.getParsed(n),raw:e.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:t}}function ir(e,i){let t=e.chart.ctx,{body:s,footer:n,title:o}=e,{boxWidth:r,boxHeight:a}=i,l=$(i.bodyFont),c=$(i.titleFont),h=$(i.footerFont),f=o.length,d=n.length,u=s.length,p=K(i.padding),g=p.height,m=0,b=s.reduce((M,_)=>M+_.before.length+_.lines.length+_.after.length,0);if(b+=e.beforeBody.length+e.afterBody.length,f&&(g+=f*c.lineHeight+(f-1)*i.titleSpacing+i.titleMarginBottom),b){let M=i.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=u*M+(b-u)*l.lineHeight+(b-1)*i.bodySpacing}d&&(g+=i.footerMarginTop+d*h.lineHeight+(d-1)*i.footerSpacing);let x=0,y=function(M){m=Math.max(m,t.measureText(M).width+x)};return t.save(),t.font=c.string,L(e.title,y),t.font=l.string,L(e.beforeBody.concat(e.afterBody),y),x=i.displayColors?r+2+i.boxPadding:0,L(s,M=>{L(M.before,y),L(M.lines,y),L(M.after,y)}),x=0,t.font=h.string,L(e.footer,y),t.restore(),m+=p.width,{width:m,height:g}}function bd(e,i){let{y:t,height:s}=i;return te.height-s/2?"bottom":"center"}function _d(e,i,t,s){let{x:n,width:o}=s,r=t.caretSize+t.caretPadding;if(e==="left"&&n+o+r>i.width||e==="right"&&n-o-r<0)return!0}function yd(e,i,t,s){let{x:n,width:o}=t,{width:r,chartArea:{left:a,right:l}}=e,c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),_d(c,e,i,t)&&(c="center"),c}function sr(e,i,t){let s=t.yAlign||i.yAlign||bd(e,t);return{xAlign:t.xAlign||i.xAlign||yd(e,i,t,s),yAlign:s}}function vd(e,i){let{x:t,width:s}=e;return i==="right"?t-=s:i==="center"&&(t-=s/2),t}function Md(e,i,t){let{y:s,height:n}=e;return i==="top"?s+=t:i==="bottom"?s-=n+t:s-=n/2,s}function nr(e,i,t,s){let{caretSize:n,caretPadding:o,cornerRadius:r}=e,{xAlign:a,yAlign:l}=t,c=n+o,{topLeft:h,topRight:f,bottomLeft:d,bottomRight:u}=Dt(r),p=vd(i,a),g=Md(i,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(h,d)+n:a==="right"&&(p+=Math.max(f,u)+n),{x:U(p,0,s.width-i.width),y:U(g,0,s.height-i.height)}}function Pi(e,i,t){let s=K(t.padding);return i==="center"?e.x+e.width/2:i==="right"?e.x+e.width-s.right:e.x+s.left}function or(e){return ut([],Mt(e))}function wd(e,i,t){return yt(e,{tooltip:i,tooltipItems:t,type:"tooltip"})}function rr(e,i){let t=i&&i.dataset&&i.dataset.tooltip&&i.dataset.tooltip.callbacks;return t?e.override(t):e}var zr={beforeTitle:ft,title(e){if(e.length>0){let i=e[0],t=i.chart.data.labels,s=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return i.dataset.label||"";if(i.label)return i.label;if(s>0&&i.dataIndex"u"?zr[i].call(t,s):n}var ar=(()=>{class e extends lt{static positioners=je;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(){let t=this._cachedAnimations;if(t)return t;let s=this.chart,n=this.options.setContext(this.getContext()),o=n.enabled&&s.options.animation&&n.animations,r=new Ti(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=wd(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,s){let{callbacks:n}=s,o=Q(n,"beforeTitle",this,t),r=Q(n,"title",this,t),a=Q(n,"afterTitle",this,t),l=[];return l=ut(l,Mt(o)),l=ut(l,Mt(r)),l=ut(l,Mt(a)),l}getBeforeBody(t,s){return or(Q(s.callbacks,"beforeBody",this,t))}getBody(t,s){let{callbacks:n}=s,o=[];return L(t,r=>{let a={before:[],lines:[],after:[]},l=rr(n,r);ut(a.before,Mt(Q(l,"beforeLabel",this,r))),ut(a.lines,Q(l,"label",this,r)),ut(a.after,Mt(Q(l,"afterLabel",this,r))),o.push(a)}),o}getAfterBody(t,s){return or(Q(s.callbacks,"afterBody",this,t))}getFooter(t,s){let{callbacks:n}=s,o=Q(n,"beforeFooter",this,t),r=Q(n,"footer",this,t),a=Q(n,"afterFooter",this,t),l=[];return l=ut(l,Mt(o)),l=ut(l,Mt(r)),l=ut(l,Mt(a)),l}_createItems(t){let s=this._active,n=this.chart.data,o=[],r=[],a=[],l=[],c,h;for(c=0,h=s.length;ct.filter(f,d,u,n))),t.itemSort&&(l=l.sort((f,d)=>t.itemSort(f,d,n))),L(l,f=>{let d=rr(t.callbacks,f);o.push(Q(d,"labelColor",this,f)),r.push(Q(d,"labelPointStyle",this,f)),a.push(Q(d,"labelTextColor",this,f))}),this.labelColors=o,this.labelPointStyles=r,this.labelTextColors=a,this.dataPoints=l,l}update(t,s){let n=this.options.setContext(this.getContext()),o=this._active,r,a=[];if(!o.length)this.opacity!==0&&(r={opacity:0});else{let l=je[n.position].call(this,o,this._eventPosition);a=this._createItems(n),this.title=this.getTitle(a,n),this.beforeBody=this.getBeforeBody(a,n),this.body=this.getBody(a,n),this.afterBody=this.getAfterBody(a,n),this.footer=this.getFooter(a,n);let c=this._size=ir(this,n),h=Object.assign({},l,c),f=sr(this.chart,n,h),d=nr(n,h,f,this.chart);this.xAlign=f.xAlign,this.yAlign=f.yAlign,r={opacity:1,x:d.x,y:d.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:s})}drawCaret(t,s,n,o){let r=this.getCaretPosition(t,n,o);s.lineTo(r.x1,r.y1),s.lineTo(r.x2,r.y2),s.lineTo(r.x3,r.y3)}getCaretPosition(t,s,n){let{xAlign:o,yAlign:r}=this,{caretSize:a,cornerRadius:l}=n,{topLeft:c,topRight:h,bottomLeft:f,bottomRight:d}=Dt(l),{x:u,y:p}=t,{width:g,height:m}=s,b,x,y,M,_,v;return r==="center"?(_=p+m/2,o==="left"?(b=u,x=b-a,M=_+a,v=_-a):(b=u+g,x=b+a,M=_-a,v=_+a),y=b):(o==="left"?x=u+Math.max(c,f)+a:o==="right"?x=u+g-Math.max(h,d)-a:x=this.caretX,r==="top"?(M=p,_=M-a,b=x-a,y=x+a):(M=p+m,_=M+a,b=x+a,y=x-a),v=M),{x1:b,x2:x,x3:y,y1:M,y2:_,y3:v}}drawTitle(t,s,n){let o=this.title,r=o.length,a,l,c;if(r){let h=Ut(n.rtl,this.x,this.width);for(t.x=Pi(this,n.titleAlign,n),s.textAlign=h.textAlign(n.titleAlign),s.textBaseline="middle",a=$(n.titleFont),l=n.titleSpacing,s.fillStyle=n.titleColor,s.font=a.string,c=0;cy!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,re(t,{x:m,y:g,w:h,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),re(t,{x:b,y:g+1,w:h-2,h:c-2,radius:x}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(m,g,h,c),t.strokeRect(m,g,h,c),t.fillStyle=a.backgroundColor,t.fillRect(b,g+1,h-2,c-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,s,n){let{body:o}=this,{bodySpacing:r,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:h,boxPadding:f}=n,d=$(n.bodyFont),u=d.lineHeight,p=0,g=Ut(n.rtl,this.x,this.width),m=function(k){s.fillText(k,g.x(t.x+p),t.y+u/2),t.y+=u+r},b=g.textAlign(a),x,y,M,_,v,S,w;for(s.textAlign=a,s.textBaseline="middle",s.font=d.string,t.x=Pi(this,b,n),s.fillStyle=n.bodyColor,L(this.beforeBody,m),p=l&&b!=="right"?a==="center"?h/2+f:h+2+f:0,_=0,S=o.length;_0&&s.stroke()}_updateAnimationTarget(t){let s=this.chart,n=this.$animations,o=n&&n.x,r=n&&n.y;if(o||r){let a=je[t.position].call(this,this._active,this._eventPosition);if(!a)return;let l=this._size=ir(this,t),c=Object.assign({},a,this._size),h=sr(s,t,c),f=nr(t,c,h,s);(o._to!==f.x||r._to!==f.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,f))}}_willRender(){return!!this.opacity}draw(t){let s=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(s);let o={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let a=K(s.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;s.enabled&&l&&(t.save(),t.globalAlpha=n,this.drawBackground(r,t,o,s),Ds(t,s.textDirection),r.y+=a.top,this.drawTitle(r,t,s),this.drawBody(r,t,s),this.drawFooter(r,t,s),Ts(t,s.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,s){let n=this._active,o=t.map(({datasetIndex:l,index:c})=>{let h=this.chart.getDatasetMeta(l);if(!h)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:h.data[c],index:c}}),r=!Ae(n,o),a=this._positionChanged(o,s);(r||a)&&(this._active=o,this._eventPosition=s,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,s,n=!0){if(s&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let o=this.options,r=this._active||[],a=this._getActiveElements(t,r,s,n),l=this._positionChanged(a,t),c=s||!Ae(a,r)||l;return c&&(this._active=a,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,s))),c}_getActiveElements(t,s,n,o){let r=this.options;if(t.type==="mouseout")return[];if(!o)return s.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,r.mode,r,n);return r.reverse&&a.reverse(),a}_positionChanged(t,s){let{caretX:n,caretY:o,options:r}=this,a=je[r.position].call(this,t,s);return a!==!1&&(n!==a.x||o!==a.y)}}return e})(),Sd={id:"tooltip",_element:ar,positioners:je,afterInit(e,i,t){t&&(e.tooltip=new ar({chart:e,options:t}))},beforeUpdate(e,i,t){e.tooltip&&e.tooltip.initialize(t)},reset(e,i,t){e.tooltip&&e.tooltip.initialize(t)},afterDraw(e){let i=e.tooltip;if(i&&i._willRender()){let t={tooltip:i};if(e.notifyPlugins("beforeTooltipDraw",Je(Ze({},t),{cancelable:!0}))===!1)return;i.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",t)}},afterEvent(e,i){if(e.tooltip){let t=i.replay;e.tooltip.handleEvent(i.event,t,i.inChartArea)&&(i.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:(e,i)=>i.bodyFont.size,boxWidth:(e,i)=>i.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:zr},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},kd=Object.freeze({__proto__:null,Colors:zf,Decimation:Wf,Filler:ad,Legend:ud,SubTitle:md,Title:gd,Tooltip:Sd}),Cd=(e,i,t,s)=>(typeof i=="string"?(t=e.push(i)-1,s.unshift({index:t,label:i})):isNaN(i)&&(t=null),t);function Pd(e,i,t,s){let n=e.indexOf(i);if(n===-1)return Cd(e,i,t,s);let o=e.lastIndexOf(i);return n!==o?t:n}var Od=(e,i)=>e===null?null:U(Math.round(e),0,i);function lr(e){let i=this.getLabels();return e>=0&&e{class e extends Kt{static id="category";static defaults={ticks:{callback:lr}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let s=this._addedLabels;if(s.length){let n=this.getLabels();for(let{index:o,label:r}of s)n[o]===r&&n.splice(o,1);this._addedLabels=[]}super.init(t)}parse(t,s){if(T(t))return null;let n=this.getLabels();return s=isFinite(s)&&n[s]===t?s:Pd(n,t,C(s,t),this._addedLabels),Od(s,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),s||(o=this.getLabels().length-1)),this.min=n,this.max=o}buildTicks(){let t=this.min,s=this.max,n=this.options.offset,o=[],r=this.getLabels();r=t===0&&s===r.length-1?r:r.slice(t,s+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let a=t;a<=s;a++)o.push({value:a});return o}getLabelForValue(t){return lr.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){let s=this.ticks;return t<0||t>s.length-1?null:this.getPixelForValue(s[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}return e})();function Dd(e,i){let t=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:f,includeBounds:d}=e,u=o||1,p=h-1,{min:g,max:m}=i,b=!T(r),x=!T(a),y=!T(c),M=(m-g)/(f+1),_=cs((m-g)/p/u)*u,v,S,w,k;if(_<1e-14&&!b&&!x)return[{value:g},{value:m}];k=Math.ceil(m/_)-Math.floor(g/_),k>p&&(_=cs(k*_/p/u)*u),T(l)||(v=Math.pow(10,l),_=Math.ceil(_*v)/v),n==="ticks"?(S=Math.floor(g/_)*_,w=Math.ceil(m/_)*_):(S=g,w=m),b&&x&&o&&Yn((a-r)/o,_/1e3)?(k=Math.round(Math.min((a-r)/_,h)),_=(a-r)/k,S=r,w=a):y?(S=b?r:S,w=x?a:w,k=c-1,_=(w-S)/k):(k=(w-S)/_,se(k,Math.round(k),_/1e3)?k=Math.round(k):k=Math.ceil(k));let O=Math.max(fs(_),fs(S));v=Math.pow(10,T(l)?O:l),S=Math.round(S*v)/v,w=Math.round(w*v)/v;let P=0;for(b&&(d&&S!==r?(t.push({value:r}),Sa)break;t.push({value:D})}return x&&d&&w!==a?t.length&&se(t[t.length-1].value,a,cr(a,M,e))?t[t.length-1].value=a:t.push({value:a}):(!x||w===a)&&t.push({value:w}),t}function cr(e,i,{horizontal:t,minRotation:s}){let n=nt(s),o=(t?Math.sin(n):Math.cos(n))||.001,r=.75*i*(""+e).length;return Math.min(i/o,r)}var he=class extends Kt{constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(i,t){return T(i)||(typeof i=="number"||i instanceof Number)&&!isFinite(+i)?null:+i}handleTickRangeOptions(){let{beginAtZero:i}=this.options,{minDefined:t,maxDefined:s}=this.getUserBounds(),{min:n,max:o}=this,r=l=>n=t?n:l,a=l=>o=s?o:l;if(i){let l=at(n),c=at(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),i||r(n-l)}this.min=n,this.max=o}getTickLimit(){let i=this.options.ticks,{maxTicksLimit:t,stepSize:s}=i,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let i=this.options,t=i.ticks,s=this.getTickLimit();s=Math.max(2,s);let n={maxTicks:s,bounds:i.bounds,min:i.min,max:i.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},o=this._range||this,r=Dd(n,o);return i.bounds==="ticks"&&hs(r,this,"value"),i.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let i=this.ticks,t=this.min,s=this.max;if(super.configure(),this.options.offset&&i.length){let n=(s-t)/Math.max(i.length-1,1)/2;t-=n,s+=n}this._startValue=t,this._endValue=s,this._valueRange=s-t}getLabelForValue(i){return oe(i,this.chart.options.locale,this.options.ticks.format)}},on=class extends he{static id="linear";static defaults={ticks:{callback:De.formatters.numeric}};determineDataLimits(){let{min:i,max:t}=this.getMinMax(!0);this.min=W(i)?i:0,this.max=W(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let i=this.isHorizontal(),t=i?this.width:this.height,s=nt(this.options.ticks.minRotation),n=(i?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/n))}getPixelForValue(i){return i===null?NaN:this.getPixelForDecimal((i-this._startValue)/this._valueRange)}getValueForPixel(i){return this._startValue+this.getDecimalForPixel(i)*this._valueRange}},Ve=e=>Math.floor(bt(e)),Xt=(e,i)=>Math.pow(10,Ve(e)+i);function hr(e){return e/Math.pow(10,Ve(e))===1}function fr(e,i,t){let s=Math.pow(10,t),n=Math.floor(e/s);return Math.ceil(i/s)-n}function Td(e,i){let t=i-e,s=Ve(t);for(;fr(e,i,s)>10;)s++;for(;fr(e,i,s)<10;)s--;return Math.min(s,Ve(e))}function Ld(e,{min:i,max:t}){i=J(e.min,i);let s=[],n=Ve(i),o=Td(i,t),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),l=n>o?Math.pow(10,n):0,c=Math.round((i-l)*r)/r,h=Math.floor((i-l)/a/10)*a*10,f=Math.floor((c-h)/Math.pow(10,o)),d=J(e.min,Math.round((l+h+f*Math.pow(10,o))*r)/r);for(;d=10?f=f<15?15:20:f++,f>=20&&(o++,f=2,r=o>=0?1:r),d=Math.round((l+h+f*Math.pow(10,o))*r)/r;let u=J(e.max,d);return s.push({value:u,major:hr(u),significand:f}),s}var rn=class extends Kt{static id="logarithmic";static defaults={ticks:{callback:De.formatters.logarithmic,major:{enabled:!0}}};constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(i,t){let s=he.prototype.parse.apply(this,[i,t]);if(s===0){this._zero=!0;return}return W(s)&&s>0?s:null}determineDataLimits(){let{min:i,max:t}=this.getMinMax(!0);this.min=W(i)?Math.max(0,i):null,this.max=W(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!W(this._userMin)&&(this.min=i===Xt(this.min,0)?Xt(this.min,-1):Xt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:i,maxDefined:t}=this.getUserBounds(),s=this.min,n=this.max,o=a=>s=i?s:a,r=a=>n=t?n:a;s===n&&(s<=0?(o(1),r(10)):(o(Xt(s,-1)),r(Xt(n,1)))),s<=0&&o(Xt(n,-1)),n<=0&&r(Xt(s,1)),this.min=s,this.max=n}buildTicks(){let i=this.options,t={min:this._userMin,max:this._userMax},s=Ld(t,this);return i.bounds==="ticks"&&hs(s,this,"value"),i.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(i){return i===void 0?"0":oe(i,this.chart.options.locale,this.options.ticks.format)}configure(){let i=this.min;super.configure(),this._startValue=bt(i),this._valueRange=bt(this.max)-bt(i)}getPixelForValue(i){return(i===void 0||i===0)&&(i=this.min),i===null||isNaN(i)?NaN:this.getPixelForDecimal(i===this.min?0:(bt(i)-this._startValue)/this._valueRange)}getValueForPixel(i){let t=this.getDecimalForPixel(i);return Math.pow(10,this._startValue+t*this._valueRange)}};function an(e){let i=e.ticks;if(i.display&&e.display){let t=K(i.backdropPadding);return C(i.font&&i.font.size,B.font.size)+t.height}return 0}function Rd(e,i,t){return t=E(t)?t:[t],{w:eo(e,i.string,t),h:t.length*i.lineHeight}}function dr(e,i,t,s,n){return e===s||e===n?{start:i-t/2,end:i+t/2}:en?{start:i-t,end:i}:{start:i,end:i+t}}function Id(e){let i={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},t=Object.assign({},i),s=[],n=[],o=e._pointLabels.length,r=e.options.pointLabels,a=r.centerPointLabels?F/o:0;for(let l=0;li.r&&(a=(s.end-i.r)/o,e.r=Math.max(e.r,i.r+a)),n.starti.b&&(l=(n.end-i.b)/r,e.b=Math.max(e.b,i.b+l))}function Fd(e,i,t){let s=e.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=t,l=e.getPointPosition(i,s+n+r,o),c=Math.round(di(Z(l.angle+V))),h=Wd(l.y,a.h,c),f=jd(c),d=Nd(l.x,a.w,f);return{visible:!0,x:l.x,y:h,textAlign:f,left:d,top:h,right:d+a.w,bottom:h+a.h}}function zd(e,i){if(!i)return!0;let{left:t,top:s,right:n,bottom:o}=e;return!(ht({x:t,y:s},i)||ht({x:t,y:o},i)||ht({x:n,y:s},i)||ht({x:n,y:o},i))}function Bd(e,i,t){let s=[],n=e._pointLabels.length,o=e.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:an(o)/2,additionalAngle:r?F/n:0},c;for(let h=0;h270||t<90)&&(e-=i),e}function Vd(e,i,t){let{left:s,top:n,right:o,bottom:r}=t,{backdropColor:a}=i;if(!T(a)){let l=Dt(i.borderRadius),c=K(i.backdropPadding);e.fillStyle=a;let h=s-c.left,f=n-c.top,d=o-s+c.width,u=r-n+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),re(e,{x:h,y:f,w:d,h:u,radius:l}),e.fill()):e.fillRect(h,f,d,u)}}function Hd(e,i){let{ctx:t,options:{pointLabels:s}}=e;for(let n=i-1;n>=0;n--){let o=e._pointLabelItems[n];if(!o.visible)continue;let r=s.setContext(e.getPointLabelContext(n));Vd(t,r,o);let a=$(r.font),{x:l,y:c,textAlign:h}=o;At(t,e._pointLabels[n],l,c+a.lineHeight/2,a,{color:r.color,textAlign:h,textBaseline:"middle"})}}function Br(e,i,t,s){let{ctx:n}=e;if(t)n.arc(e.xCenter,e.yCenter,i,0,z);else{let o=e.getPointPosition(0,i);n.moveTo(o.x,o.y);for(let r=1;r{let n=I(this.options.pointLabels.callback,[t,s],this);return n||n===0?n:""}).filter((t,s)=>this.chart.getDataVisibility(s))}fit(){let i=this.options;i.display&&i.pointLabels.display?Id(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(i,t,s,n){this.xCenter+=Math.floor((i-t)/2),this.yCenter+=Math.floor((s-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(i,t,s,n))}getIndexAngle(i){let t=z/(this._pointLabels.length||1),s=this.options.startAngle||0;return Z(i*t+nt(s))}getDistanceFromCenterForValue(i){if(T(i))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-i)*t:(i-this.min)*t}getValueForDistanceFromCenter(i){if(T(i))return NaN;let t=i/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(i){let t=this._pointLabels||[];if(i>=0&&i{if(f!==0||f===0&&this.min<0){l=this.getDistanceFromCenterForValue(h.value);let d=this.getContext(f),u=n.setContext(d),p=o.setContext(d);$d(this,u,l,r,p)}}),s.display){for(i.save(),a=r-1;a>=0;a--){let h=s.setContext(this.getPointLabelContext(a)),{color:f,lineWidth:d}=h;!d||!f||(i.lineWidth=d,i.strokeStyle=f,i.setLineDash(h.borderDash),i.lineDashOffset=h.borderDashOffset,l=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(a,l),i.beginPath(),i.moveTo(this.xCenter,this.yCenter),i.lineTo(c.x,c.y),i.stroke())}i.restore()}}drawBorder(){}drawLabels(){let i=this.ctx,t=this.options,s=t.ticks;if(!s.display)return;let n=this.getIndexAngle(0),o,r;i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(n),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;let c=s.setContext(this.getContext(l)),h=$(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){i.font=h.string,r=i.measureText(a.label).width,i.fillStyle=c.backdropColor;let f=K(c.backdropPadding);i.fillRect(-r/2-f.left,-o-h.size/2-f.top,r+f.width,h.size+f.height)}At(i,a.label,0,-o,h,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),i.restore()}drawTitle(){}},ji={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}},tt=Object.keys(ji);function ur(e,i){return e-i}function pr(e,i){if(T(i))return null;let t=e._adapter,{parser:s,round:n,isoWeekday:o}=e._parseOpts,r=i;return typeof s=="function"&&(r=s(r)),W(r)||(r=typeof s=="string"?t.parse(r,s):t.parse(r)),r===null?null:(n&&(r=n==="week"&&($t(o)||o===!0)?t.startOf(r,"isoWeek",o):t.startOf(r,n)),+r)}function gr(e,i,t,s){let n=tt.length;for(let o=tt.indexOf(e);o=tt.indexOf(t);o--){let r=tt[o];if(ji[r].common&&e._adapter.diff(n,s,r)>=i-1)return r}return tt[t?tt.indexOf(t):0]}function Xd(e){for(let i=tt.indexOf(e)+1,t=tt.length;i=i?t[s]:t[n];e[o]=!0}}function Kd(e,i,t,s){let n=e._adapter,o=+n.startOf(i[0].value,s),r=i[i.length-1].value,a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=t[a],l>=0&&(i[l].major=!0);return i}function xr(e,i,t){let s=[],n={},o=i.length,r,a;for(r=0;r{class e extends Kt{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,s={}){let n=t.time||(t.time={}),o=this._adapter=new oh._date(t.adapters.date);o.init(s),ee(n.displayFormats,o.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=s.normalized}parse(t,s){return t===void 0?null:pr(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,s=this._adapter,n=t.time.unit||"day",{min:o,max:r,minDefined:a,maxDefined:l}=this.getUserBounds();function c(h){!a&&!isNaN(h.min)&&(o=Math.min(o,h.min)),!l&&!isNaN(h.max)&&(r=Math.max(r,h.max))}(!a||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),o=W(o)&&!isNaN(o)?o:+s.startOf(Date.now(),n),r=W(r)&&!isNaN(r)?r:+s.endOf(Date.now(),n)+1,this.min=Math.min(o,r-1),this.max=Math.max(o+1,r)}_getLabelBounds(){let t=this.getLabelTimestamps(),s=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(s=t[0],n=t[t.length-1]),{min:s,max:n}}buildTicks(){let t=this.options,s=t.time,n=t.ticks,o=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);let r=this.min,a=this.max,l=qn(o,r,a);return this._unit=s.unit||(n.autoSkip?gr(s.minUnit,this.min,this.max,this._getLabelCapacity(r)):Yd(this,l.length,s.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:Xd(this._unit),this.initOffsets(o),t.reverse&&l.reverse(),xr(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let s=0,n=0,o,r;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?s=1-o:s=(this.getDecimalForValue(t[1])-o)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?n=r:n=(r-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;s=U(s,0,a),n=U(n,0,a),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){let t=this._adapter,s=this.min,n=this.max,o=this.options,r=o.time,a=r.unit||gr(r.minUnit,s,n,this._getLabelCapacity(s)),l=C(o.ticks.stepSize,1),c=a==="week"?r.isoWeekday:!1,h=$t(c)||c===!0,f={},d=s,u,p;if(h&&(d=+t.startOf(d,"isoWeek",c)),d=+t.startOf(d,h?"day":a),t.diff(n,s,a)>1e5*l)throw new Error(s+" and "+n+" are too far apart with stepSize of "+l+" "+a);let g=o.ticks.source==="data"&&this.getDataTimestamps();for(u=d,p=0;u+m)}getLabelForValue(t){let s=this._adapter,n=this.options.time;return n.tooltipFormat?s.format(t,n.tooltipFormat):s.format(t,n.displayFormats.datetime)}format(t,s){let o=this.options.time.displayFormats,r=this._unit,a=s||o[r];return this._adapter.format(t,a)}_tickFormatFunction(t,s,n,o){let r=this.options,a=r.ticks.callback;if(a)return I(a,[t,s,n],this);let l=r.time.displayFormats,c=this._unit,h=this._majorUnit,f=c&&l[c],d=h&&l[h],u=n[s],p=h&&d&&u&&u.major;return this._adapter.format(t,o||(p?d:f))}generateTickLabels(t){let s,n,o;for(s=0,n=t.length;s0?l:1}getDataTimestamps(){let t=this._cache.data||[],s,n;if(t.length)return t;let o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(s=0,n=o.length;s=e[s].pos&&i<=e[n].pos&&({lo:s,hi:n}=ct(e,"pos",i)),{pos:o,time:a}=e[s],{pos:r,time:l}=e[n]):(i>=e[s].time&&i<=e[n].time&&({lo:s,hi:n}=ct(e,"time",i)),{time:o,pos:a}=e[s],{time:r,pos:l}=e[n]);let c=r-o;return c?a+(l-a)*(i-o)/c:a}var hn=class extends cn{static id="timeseries";static defaults=cn.defaults;constructor(i){super(i),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let i=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(i);this._minPos=Oi(t,this.min),this._tableRange=Oi(t,this.max)-this._minPos,super.initOffsets(i)}buildLookupTable(i){let{min:t,max:s}=this,n=[],o=[],r,a,l,c,h;for(r=0,a=i.length;r=t&&c<=s&&n.push(c);if(n.length<2)return[{time:t,pos:0},{time:s,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let i=this._cache.all||[];if(i.length)return i;let t=this.getDataTimestamps(),s=this.getLabelTimestamps();return t.length&&s.length?i=this.normalize(t.concat(s)):i=t.length?t:s,i=this._cache.all=i,i}getDecimalForValue(i){return(Oi(this._table,i)-this._minPos)/this._tableRange}getValueForPixel(i){let t=this._offsets,s=this.getDecimalForPixel(i)/t.factor-t.end;return Oi(this._table,s*this._tableRange+this._minPos,!0)}},qd=Object.freeze({__proto__:null,CategoryScale:Ad,LinearScale:on,LogarithmicScale:rn,RadialLinearScale:ln,TimeScale:cn,TimeSeriesScale:hn}),jr=[nh,Tf,kd,qd];var Gd=typeof global=="object"&&global&&global.Object===Object&&global,Ni=Gd;var Zd=typeof self=="object"&&self&&self.Object===Object&&self,Jd=Ni||Zd||Function("return this")(),ot=Jd;var Qd=ot.Symbol,fe=Qd;var Nr=Object.prototype,tu=Nr.hasOwnProperty,eu=Nr.toString,$e=fe?fe.toStringTag:void 0;function iu(e){var i=tu.call(e,$e),t=e[$e];try{e[$e]=void 0;var s=!0}catch{}var n=eu.call(e);return s&&(i?e[$e]=t:delete e[$e]),n}var Wr=iu;var su=Object.prototype,nu=su.toString;function ou(e){return nu.call(e)}var Vr=ou;var ru="[object Null]",au="[object Undefined]",Hr=fe?fe.toStringTag:void 0;function lu(e){return e==null?e===void 0?au:ru:Hr&&Hr in Object(e)?Wr(e):Vr(e)}var It=lu;function cu(e){return e!=null&&typeof e=="object"}var gt=cu;var hu=Array.isArray,Ue=hu;function fu(e){var i=typeof e;return e!=null&&(i=="object"||i=="function")}var et=fu;function du(e){return e}var Wi=du;var uu="[object AsyncFunction]",pu="[object Function]",gu="[object GeneratorFunction]",mu="[object Proxy]";function xu(e){if(!et(e))return!1;var i=It(e);return i==pu||i==gu||i==uu||i==mu}var de=xu;var bu=ot["__core-js_shared__"],Vi=bu;var $r=function(){var e=/[^.]+$/.exec(Vi&&Vi.keys&&Vi.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function _u(e){return!!$r&&$r in e}var Ur=_u;var yu=Function.prototype,vu=yu.toString;function Mu(e){if(e!=null){try{return vu.call(e)}catch{}try{return e+""}catch{}}return""}var Yr=Mu;var wu=/[\\^$.*+?()[\]{}|]/g,Su=/^\[object .+?Constructor\]$/,ku=Function.prototype,Cu=Object.prototype,Pu=ku.toString,Ou=Cu.hasOwnProperty,Au=RegExp("^"+Pu.call(Ou).replace(wu,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Du(e){if(!et(e)||Ur(e))return!1;var i=de(e)?Au:Su;return i.test(Yr(e))}var Xr=Du;function Tu(e,i){return e?.[i]}var Kr=Tu;function Lu(e,i){var t=Kr(e,i);return Xr(t)?t:void 0}var ue=Lu;var qr=Object.create,Ru=function(){function e(){}return function(i){if(!et(i))return{};if(qr)return qr(i);e.prototype=i;var t=new e;return e.prototype=void 0,t}}(),Gr=Ru;function Iu(e,i,t){switch(t.length){case 0:return e.call(i);case 1:return e.call(i,t[0]);case 2:return e.call(i,t[0],t[1]);case 3:return e.call(i,t[0],t[1],t[2])}return e.apply(i,t)}var Zr=Iu;function Eu(e,i){var t=-1,s=e.length;for(i||(i=Array(s));++t