(s+(c?a-e:e))%r,x=()=>{p!==f&&(e.lineTo(m,f),e.lineTo(m,p),e.lineTo(m,g))};for(l&&(h=n[y(0)],e.moveTo(h.x,h.y)),d=0;d<=a;++d){if(h=n[y(d)],h.skip)continue;const t=h.x,o=h.y,i=0|t;i===u?(of&&(f=o),m=(b*m+t)/++b):(x(),e.lineTo(t,o),u=i,b=0,p=f=o),g=o}x()}function wn(e){const t=e.options,o=t.borderDash&&t.borderDash.length;return!(e._decimated||e._loop||t.tension||"monotone"===t.cubicInterpolationMode||t.stepped||o)?_n:vn}mn.id="arc",mn.defaults={borderAlign:"center",borderColor:"#fff",borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0},mn.defaultRoutes={backgroundColor:"backgroundColor"};const Tn="function"==typeof Path2D;function kn(e,t,o,i){Tn&&1===t.segments.length?function(e,t,o,i){let n=t._path;n||(n=t._path=new Path2D,t.path(n,o,i)&&n.closePath()),bn(e,t.options),e.stroke(n)}(e,t,o,i):function(e,t,o,i){const{segments:n,options:r}=t,s=wn(t);for(const a of n)bn(e,r,a.style),e.beginPath(),s(e,t,a,{start:o,end:o+i-1})&&e.closePath(),e.stroke()}(e,t,o,i)}class Sn extends Si{constructor(e){super(),this.animated=!0,this.options=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,e&&Object.assign(this,e)}updateControlPoints(e,t){const o=this,i=o.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!o._pointsUpdated){const n=i.spanGaps?o._loop:o._fullLoop;Nt(o._points,i,e,n,t),o._pointsUpdated=!0}}set points(e){const t=this;t._points=e,delete t._segments,delete t._path,t._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(e,t){const o=e.points,i=e.options.spanGaps,n=o.length;if(!n)return[];const r=!!e._loop,{start:s,end:a}=function(e,t,o,i){let n=0,r=t-1;if(o&&!i)for(;nn&&e[r%t].skip;)r--;return r%=t,{start:n,end:r}}(o,n,r,i);return lo(!0===i?[{start:s,end:a,loop:r}]:function(e,t,o,i){const n=e.length,r=[];let s,a=t,l=e[t];for(s=t+1;s<=o;++s){const o=e[s%n];o.skip||o.stop?l.skip||(i=!1,r.push({start:t%n,end:(s-1)%n,loop:i}),t=a=o.stop?s:null):(a=s,l.skip&&(t=s)),l=o}return null!==a&&r.push({start:t%n,end:a%n,loop:i}),r}(o,s,a"borderDash"!==e&&"fill"!==e};class Pn extends Si{constructor(e){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,t,o){const i=this.options,{x:n,y:r}=this.getProps(["x","y"],o);return Math.pow(e-n,2)+Math.pow(t-r,2)e.x):Mn(t,"bottom","top",e.base=s.left&&t<=s.right)&&(r||o>=s.top&&o<=s.bottom)}function Hn(e,t){e.rect(t.x,t.y,t.w,t.h)}Pn.id="point",Pn.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},Pn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class Ln extends Si{constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,e&&Object.assign(this,e)}draw(e){const t=this.options,{inner:o,outer:i}=Rn(this),n=(r=i.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?tt:Hn;var r;e.save(),i.w===o.w&&i.h===o.h||(e.beginPath(),n(e,i),e.clip(),n(e,o),e.fillStyle=t.borderColor,e.fill("evenodd")),e.beginPath(),n(e,o),e.fillStyle=t.backgroundColor,e.fill(),e.restore()}inRange(e,t,o){return In(this,e,t,o)}inXRange(e,t){return In(this,e,null,t)}inYRange(e,t){return In(this,null,e,t)}getCenterPoint(e){const{x:t,y:o,base:i,horizontal:n}=this.getProps(["x","y","base","horizontal"],e);return{x:n?(t+i)/2:t,y:n?o:(o+i)/2}}getRange(e){return"x"===e?this.width/2:this.height/2}}Ln.id="bar",Ln.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,enableBorderRadius:!0,pointStyle:void 0},Ln.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};function Nn(e,t,o){const i=function(e){const t=e.options,o=t.fill;let i=f(o&&o.target,o);return void 0===i&&(i=!!t.backgroundColor),!1!==i&&null!==i&&(!0===i?"origin":i)}(e);if(h(i))return!isNaN(i.value)&&i;let n=parseFloat(i);return u(n)&&Math.floor(n)===n?("-"!==i[0]&&"+"!==i[0]||(n=t+n),!(n===t||n<0||n>=o)&&n):["origin","start","end","stack"].indexOf(i)>=0&&i}class zn{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,o){const{x:i,y:n,radius:r}=this;return t=t||{start:0,end:C},e.arc(i,n,r,t.end,t.start,!0),!o.bounds}interpolate(e){const{x:t,y:o,radius:i}=this,n=e.angle;return{x:t+Math.cos(n)*i,y:o+Math.sin(n)*i,angle:n}}}function Un(e){return(e.scale||{}).getPointPositionForValue?function(e){const{scale:t,fill:o}=e,i=t.options,n=t.getLabels().length,r=[],s=i.reverse?t.max:t.min,a=i.reverse?t.min:t.max;let l,c,d;if(d="start"===o?s:"end"===o?a:h(o)?o.value:t.getBaseValue(),i.grid.circular)return c=t.getPointPositionForValue(0,s),new zn({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(d)});for(l=0;le;t--){const e=o[t];if(!isNaN(e.x)&&!isNaN(e.y))break}return t}function jn(e){const{chart:t,scale:o,index:i,line:n}=e,r=[],s=n.segments,a=n.points,l=function(e,t){const o=[],i=e.getSortedVisibleDatasetMetas();for(let e=0;e"line"===e.type&&!e.hidden;function Vn(e,t,o){const i=[];for(let n=0;n=i&&n<=c){a=n===i,l=n===c;break}}return{first:a,last:l,point:i}}function $n(e,t){let o=[],i=!1;return d(e)?(i=!0,o=e):o=function(e,t){const{x:o=null,y:i=null}=e||{},n=t.points,r=[];return t.segments.forEach((({start:e,end:t})=>{t=Fn(e,t,n);const s=n[e],a=n[t];null!==i?(r.push({x:s.x,y:i}),r.push({x:a.x,y:i})):null!==o&&(r.push({x:o,y:s.y}),r.push({x:o,y:a.y}))})),r}(e,t),o.length?new Sn({points:o,options:{tension:0},_loop:i,_fullLoop:i}):null}function qn(e,t,o){let i=e[t].fill;const n=[t];let r;if(!o)return i;for(;!1!==i&&-1===n.indexOf(i);){if(!u(i))return i;if(r=e[i],!r)return!1;if(r.visible)return i;n.push(i),i=r.fill}return!1}function Yn(e,t,o){e.beginPath(),t.path(e),e.lineTo(t.last().x,o),e.lineTo(t.first().x,o),e.closePath(),e.clip()}function Kn(e,t,o,i){if(i)return;let n=t[e],r=o[e];return"angle"===e&&(n=Q(n),r=Q(r)),{property:e,start:n,end:r}}function Xn(e,t,o,i){return e&&t?i(e[o],t[o]):e?e[o]:t?t[o]:0}function Qn(e,t,o){const{top:i,bottom:n}=t.chart.chartArea,{property:r,start:s,end:a}=o||{};"x"===r&&(e.beginPath(),e.rect(s,i,a-s,n-i),e.clip())}function Gn(e,t,o,i){const n=t.interpolate(o,i);n&&e.lineTo(n.x,n.y)}function Jn(e,t){const{line:o,target:i,property:n,color:r,scale:s}=t,a=function(e,t,o){const i=e.segments,n=e.points,r=t.points,s=[];for(const e of i){let{start:i,end:a}=e;a=Fn(i,a,n);const l=Kn(o,n[i],n[a],e.loop);if(!t.segments){s.push({source:e,target:l,start:n[i],end:n[a]});continue}const c=ao(t,l);for(const t of c){const i=Kn(o,r[t.start],r[t.end],t.loop),a=so(e,n,i);for(const e of a)s.push({source:e,target:t,start:{[o]:Xn(l,i,"start",Math.max)},end:{[o]:Xn(l,i,"end",Math.min)}})}}return s}(o,i,n);for(const{source:t,target:l,start:c,end:d}of a){const{style:{backgroundColor:a=r}={}}=t;e.save(),e.fillStyle=a,Qn(e,s,Kn(n,c,d)),e.beginPath();const h=!!o.pathSegment(e,t);h?e.closePath():Gn(e,i,d,n);const u=!!i.pathSegment(e,l,{move:h,reverse:!0}),p=h&&u;p||Gn(e,i,c,n),e.closePath(),e.fill(p?"evenodd":"nonzero"),e.restore()}}function Zn(e,t,o){const i=function(e){const{chart:t,fill:o,line:i}=e;if(u(o))return function(e,t){const o=e.getDatasetMeta(t);return o&&e.isDatasetVisible(t)?o.dataset:null}(t,o);if("stack"===o)return jn(e);const n=Un(e);return n instanceof zn?n:$n(n,i)}(t),{line:n,scale:r,axis:s}=t,a=n.options,l=a.fill,c=a.backgroundColor,{above:d=c,below:h=c}=l||{};i&&n.points.length&&(Xe(e,o),function(e,t){const{line:o,target:i,above:n,below:r,area:s,scale:a}=t,l=o._loop?"angle":t.axis;e.save(),"x"===l&&r!==n&&(Yn(e,i,s.top),Jn(e,{line:o,target:i,color:n,scale:a,property:l}),e.restore(),e.save(),Yn(e,i,s.bottom)),Jn(e,{line:o,target:i,color:r,scale:a,property:l}),e.restore()}(e,{line:n,target:i,above:d,below:h,area:o,scale:r,axis:s}),Qe(e))}var er={id:"filler",afterDatasetsUpdate(e,t,o){const i=(e.data.datasets||[]).length,n=[];let r,s,a,l;for(s=0;s=0;--t){const o=n[t].$filler;o&&(o.line.updateControlPoints(r,o.axis),i&&Zn(e.ctx,o,r))}},beforeDatasetsDraw(e,t,o){if("beforeDatasetsDraw"!==o.drawTime)return;const i=e.getSortedVisibleDatasetMetas();for(let t=i.length-1;t>=0;--t){const o=i[t].$filler;o&&Zn(e.ctx,o,e.chartArea)}},beforeDatasetDraw(e,t,o){const i=t.meta.$filler;i&&!1!==i.fill&&"beforeDatasetDraw"===o.drawTime&&Zn(e.ctx,i,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};new WeakMap;const tr={average(e){if(!e.length)return!1;let t,o,i=0,n=0,r=0;for(t=0,o=e.length;t-1?e.split("\n"):e}function nr(e,t){const{element:o,datasetIndex:i,index:n}=t,r=e.getDatasetMeta(i).controller,{label:s,value:a}=r.getLabelAndValue(n);return{chart:e,label:s,parsed:r.getParsed(n),raw:e.data.datasets[i].data[n],formattedValue:a,dataset:r.getDataset(),dataIndex:n,datasetIndex:i,element:o}}function rr(e,t){const o=e._chart.ctx,{body:i,footer:n,title:r}=e,{boxWidth:s,boxHeight:a}=t,l=dt(t.bodyFont),c=dt(t.titleFont),d=dt(t.footerFont),h=r.length,u=n.length,p=i.length,f=ct(t.padding);let g=f.height,m=0,y=i.reduce(((e,t)=>e+t.before.length+t.lines.length+t.after.length),0);if(y+=e.beforeBody.length+e.afterBody.length,h&&(g+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),y){g+=p*(t.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(y-p)*l.lineHeight+(y-1)*t.bodySpacing}u&&(g+=t.footerMarginTop+u*d.lineHeight+(u-1)*t.footerSpacing);let x=0;const v=function(e){m=Math.max(m,o.measureText(e).width+x)};return o.save(),o.font=c.string,b(e.title,v),o.font=l.string,b(e.beforeBody.concat(e.afterBody),v),x=t.displayColors?s+2:0,b(i,(e=>{b(e.before,v),b(e.lines,v),b(e.after,v)})),x=0,o.font=d.string,b(e.footer,v),o.restore(),m+=f.width,{width:m,height:g}}function sr(e,t,o,i){const{x:n,width:r}=o,{width:s,chartArea:{left:a,right:l}}=e;let c="center";return"center"===i?c=n<=(a+l)/2?"left":"right":n<=r/2?c="left":n>=s-r/2&&(c="right"),function(e,t,o,i){const{x:n,width:r}=i,s=o.caretSize+o.caretPadding;return"left"===e&&n+r+s>t.width||"right"===e&&n-r-s<0||void 0}(c,e,t,o)&&(c="center"),c}function ar(e,t,o){const i=t.yAlign||function(e,t){const{y:o,height:i}=t;return oe.height-i/2?"bottom":"center"}(e,o);return{xAlign:t.xAlign||sr(e,t,o,i),yAlign:i}}function lr(e,t,o,i){const{caretSize:n,caretPadding:r,cornerRadius:s}=e,{xAlign:a,yAlign:l}=o,c=n+r,d=s+r;let h=function(e,t){let{x:o,width:i}=e;return"right"===t?o-=i:"center"===t&&(o-=i/2),o}(t,a);const u=function(e,t,o){let{y:i,height:n}=e;return"top"===t?i+=o:i-="bottom"===t?n+o:n/2,i}(t,l,c);return"center"===l?"left"===a?h+=c:"right"===a&&(h-=c):"left"===a?h-=d:"right"===a&&(h+=d),{x:J(h,0,i.width-t.width),y:J(u,0,i.height-t.height)}}function cr(e,t,o){const i=ct(o.padding);return"center"===t?e.x+e.width/2:"right"===t?e.x+e.width-i.right:e.x+i.left}function dr(e){return or([],ir(e))}function hr(e,t){const o=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return o?e.override(o):e}class ur extends Si{constructor(e){super(),this.opacity=0,this._active=[],this._chart=e._chart,this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this,t=e._cachedAnimations;if(t)return t;const o=e._chart,i=e.options.setContext(e.getContext()),n=i.enabled&&o.options.animation&&i.animations,r=new bo(e._chart,n);return n._cacheable&&(e._cachedAnimations=Object.freeze(r)),r}getContext(){const e=this;return e.$context||(e.$context=(t=e._chart.getContext(),o=e,i=e._tooltipItems,Object.assign(Object.create(t),{tooltip:o,tooltipItems:i,type:"tooltip"})));var t,o,i}getTitle(e,t){const o=this,{callbacks:i}=t,n=i.beforeTitle.apply(o,[e]),r=i.title.apply(o,[e]),s=i.afterTitle.apply(o,[e]);let a=[];return a=or(a,ir(n)),a=or(a,ir(r)),a=or(a,ir(s)),a}getBeforeBody(e,t){return dr(t.callbacks.beforeBody.apply(this,[e]))}getBody(e,t){const o=this,{callbacks:i}=t,n=[];return b(e,(e=>{const t={before:[],lines:[],after:[]},r=hr(i,e);or(t.before,ir(r.beforeLabel.call(o,e))),or(t.lines,r.label.call(o,e)),or(t.after,ir(r.afterLabel.call(o,e))),n.push(t)})),n}getAfterBody(e,t){return dr(t.callbacks.afterBody.apply(this,[e]))}getFooter(e,t){const o=this,{callbacks:i}=t,n=i.beforeFooter.apply(o,[e]),r=i.footer.apply(o,[e]),s=i.afterFooter.apply(o,[e]);let a=[];return a=or(a,ir(n)),a=or(a,ir(r)),a=or(a,ir(s)),a}_createItems(e){const t=this,o=t._active,i=t._chart.data,n=[],r=[],s=[];let a,l,c=[];for(a=0,l=o.length;ae.filter(t,o,n,i)))),e.itemSort&&(c=c.sort(((t,o)=>e.itemSort(t,o,i)))),b(c,(o=>{const i=hr(e.callbacks,o);n.push(i.labelColor.call(t,o)),r.push(i.labelPointStyle.call(t,o)),s.push(i.labelTextColor.call(t,o))})),t.labelColors=n,t.labelPointStyles=r,t.labelTextColors=s,t.dataPoints=c,c}update(e,t){const o=this,i=o.options.setContext(o.getContext()),n=o._active;let r,s=[];if(n.length){const e=tr[i.position].call(o,n,o._eventPosition);s=o._createItems(i),o.title=o.getTitle(s,i),o.beforeBody=o.getBeforeBody(s,i),o.body=o.getBody(s,i),o.afterBody=o.getAfterBody(s,i),o.footer=o.getFooter(s,i);const t=o._size=rr(o,i),a=Object.assign({},e,t),l=ar(o._chart,i,a),c=lr(i,a,l,o._chart);o.xAlign=l.xAlign,o.yAlign=l.yAlign,r={opacity:1,x:c.x,y:c.y,width:t.width,height:t.height,caretX:e.x,caretY:e.y}}else 0!==o.opacity&&(r={opacity:0});o._tooltipItems=s,o.$context=void 0,r&&o._resolveAnimations().update(o,r),e&&i.external&&i.external.call(o,{chart:o._chart,tooltip:o,replay:t})}drawCaret(e,t,o,i){const n=this.getCaretPosition(e,o,i);t.lineTo(n.x1,n.y1),t.lineTo(n.x2,n.y2),t.lineTo(n.x3,n.y3)}getCaretPosition(e,t,o){const{xAlign:i,yAlign:n}=this,{cornerRadius:r,caretSize:s}=o,{x:a,y:l}=e,{width:c,height:d}=t;let h,u,p,f,g,m;return"center"===n?(g=l+d/2,"left"===i?(h=a,u=h-s,f=g+s,m=g-s):(h=a+c,u=h+s,f=g-s,m=g+s),p=h):(u="left"===i?a+r+s:"right"===i?a+c-r-s:this.caretX,"top"===n?(f=l,g=f-s,h=u-s,p=u+s):(f=l+d,g=f+s,h=u+s,p=u-s),m=f),{x1:h,x2:u,x3:p,y1:f,y2:g,y3:m}}drawTitle(e,t,o){const i=this,n=i.title,r=n.length;let s,a,l;if(r){const c=to(o.rtl,i.x,i.width);for(e.x=cr(i,o.titleAlign,o),t.textAlign=c.textAlign(o.titleAlign),t.textBaseline="middle",s=dt(o.titleFont),a=o.titleSpacing,t.fillStyle=o.titleColor,t.font=s.string,l=0;l0!==e))?(e.beginPath(),e.fillStyle=n.multiKeyBackground,tt(e,{x:t,y:f,w:c,h:l,radius:r}),e.fill(),e.stroke(),e.fillStyle=s.backgroundColor,e.beginPath(),tt(e,{x:o,y:f+1,w:c-2,h:l-2,radius:r}),e.fill()):(e.fillStyle=n.multiKeyBackground,e.fillRect(t,f,c,l),e.strokeRect(t,f,c,l),e.fillStyle=s.backgroundColor,e.fillRect(o,f+1,c-2,l-2))}e.fillStyle=r.labelTextColors[o]}drawBody(e,t,o){const i=this,{body:n}=i,{bodySpacing:r,bodyAlign:s,displayColors:a,boxHeight:l,boxWidth:c}=o,d=dt(o.bodyFont);let h=d.lineHeight,u=0;const p=to(o.rtl,i.x,i.width),f=function(o){t.fillText(o,p.x(e.x+u),e.y+h/2),e.y+=h+r},g=p.textAlign(s);let m,y,x,v,_,w,T;for(t.textAlign=s,t.textBaseline="middle",t.font=d.string,e.x=cr(i,g,o),t.fillStyle=o.bodyColor,b(i.beforeBody,f),u=a&&"right"!==g?"center"===s?c/2+1:c+2:0,v=0,w=n.length;v0&&t.stroke()}_updateAnimationTarget(e){const t=this,o=t._chart,i=t.$animations,n=i&&i.x,r=i&&i.y;if(n||r){const i=tr[e.position].call(t,t._active,t._eventPosition);if(!i)return;const s=t._size=rr(t,e),a=Object.assign({},i,t._size),l=ar(o,e,a),c=lr(e,a,l,o);n._to===c.x&&r._to===c.y||(t.xAlign=l.xAlign,t.yAlign=l.yAlign,t.width=s.width,t.height=s.height,t.caretX=i.x,t.caretY=i.y,t._resolveAnimations().update(t,c))}}draw(e){const t=this,o=t.options.setContext(t.getContext());let i=t.opacity;if(!i)return;t._updateAnimationTarget(o);const n={width:t.width,height:t.height},r={x:t.x,y:t.y};i=Math.abs(i)<.001?0:i;const s=ct(o.padding),a=t.title.length||t.beforeBody.length||t.body.length||t.afterBody.length||t.footer.length;o.enabled&&a&&(e.save(),e.globalAlpha=i,t.drawBackground(r,e,n,o),oo(e,o.textDirection),r.y+=s.top,t.drawTitle(r,e,o),t.drawBody(r,e,o),t.drawFooter(r,e,o),io(e,o.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,t){const o=this,i=o._active,n=e.map((({datasetIndex:e,index:t})=>{const i=o._chart.getDatasetMeta(e);if(!i)throw new Error("Cannot find a dataset at index "+e);return{datasetIndex:e,element:i.data[t],index:t}})),r=!y(i,n),s=o._positionChanged(n,t);(r||s)&&(o._active=n,o._eventPosition=t,o.update(!0))}handleEvent(e,t){const o=this,i=o.options,n=o._active||[];let r=!1,s=[];"mouseout"!==e.type&&(s=o._chart.getElementsAtEventForMode(e,i.mode,i,t),i.reverse&&s.reverse());const a=o._positionChanged(s,e);return r=t||!y(s,n)||a,r&&(o._active=s,(i.enabled||i.external)&&(o._eventPosition={x:e.x,y:e.y},o.update(!0,t))),r}_positionChanged(e,t){const{caretX:o,caretY:i,options:n}=this,r=tr[n.position].call(this,e,t);return!1!==r&&(o!==r.x||i!==r.y)}}ur.positioners=tr;var pr={id:"tooltip",_element:ur,positioners:tr,afterInit(e,t,o){o&&(e.tooltip=new ur({_chart:e,options:o}))},beforeUpdate(e,t,o){e.tooltip&&e.tooltip.initialize(o)},reset(e,t,o){e.tooltip&&e.tooltip.initialize(o)},afterDraw(e){const t=e.tooltip,o={tooltip:t};!1!==e.notifyPlugins("beforeTooltipDraw",o)&&(t&&t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",o))},afterEvent(e,t){if(e.tooltip){const o=t.replay;e.tooltip.handleEvent(t.event,o)&&(t.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,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:a,title(e){if(e.length>0){const t=e[0],o=t.chart.data.labels,i=o?o.length:0;if(this&&this.options&&"dataset"===this.options.mode)return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"filter"!==e&&"itemSort"!==e&&"external"!==e,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};function fr(e,t,o){const i=e.indexOf(t);if(-1===i)return((e,t,o)=>"string"==typeof t?e.push(t)-1:isNaN(t)?null:o)(e,t,o);return i!==e.lastIndexOf(t)?o:i}class gr extends Li{constructor(e){super(e),this._startValue=void 0,this._valueRange=0}parse(e,t){if(c(e))return null;const o=this.getLabels();return((e,t)=>null===e?null:J(Math.round(e),0,t))(t=isFinite(t)&&o[t]===e?t:fr(o,e,f(t,e)),o.length-1)}determineDataLimits(){const e=this,{minDefined:t,maxDefined:o}=e.getUserBounds();let{min:i,max:n}=e.getMinMax(!0);"ticks"===e.options.bounds&&(t||(i=0),o||(n=e.getLabels().length-1)),e.min=i,e.max=n}buildTicks(){const e=this,t=e.min,o=e.max,i=e.options.offset,n=[];let r=e.getLabels();r=0===t&&o===r.length-1?r:r.slice(t,o+1),e._valueRange=Math.max(r.length-(i?0:1),1),e._startValue=e.min-(i?.5:0);for(let e=t;e<=o;e++)n.push({value:e});return n}getLabelForValue(e){const t=this.getLabels();return e>=0&&et.length-1?null:this.getPixelForValue(t[e].value)}getValueForPixel(e){const t=this;return Math.round(t._startValue+t.getDecimalForPixel(e)*t._valueRange)}getBasePixel(){return this.bottom}}function mr(e,t){const o=[],{bounds:i,step:n,min:r,max:s,precision:a,count:l,maxTicks:d,maxDigits:h,includeBounds:u}=e,p=n||1,f=d-1,{min:g,max:m}=t,b=!c(r),y=!c(s),x=!c(l),v=(m-g)/(h+1);let _,w,T,k,S=j((m-g)/f/p)*p;if(S<1e-14&&!b&&!y)return[{value:g},{value:m}];k=Math.ceil(m/S)-Math.floor(g/S),k>f&&(S=j(k*S/f/p)*p),c(a)||(_=Math.pow(10,a),S=Math.ceil(S*_)/_),"ticks"===i?(w=Math.floor(g/S)*S,T=Math.ceil(m/S)*S):(w=g,T=m),b&&y&&n&&function(e,t){const o=Math.round(e);return o-t<=e&&o+t>=e}((s-r)/n,S/1e3)?(k=Math.min((s-r)/S,d),S=(s-r)/k,w=r,T=s):x?(w=b?r:w,T=y?s:T,k=l-1,S=(T-w)/k):(k=(T-w)/S,k=V(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const A=Math.max(Y(S),Y(w));_=Math.pow(10,c(a)?A:a),w=Math.round(w*_)/_,T=Math.round(T*_)/_;let P=0;for(b&&(u&&w!==r?(o.push({value:r}),wn=o?n:e,a=e=>r=i?r:e;if(t){const e=F(n),t=F(r);e<0&&t<0?a(0):e>0&&t>0&&s(0)}n===r&&(a(r+1),t||s(n-1)),e.min=n,e.max=r}getTickLimit(){const e=this,t=e.options.ticks;let o,{maxTicksLimit:i,stepSize:n}=t;return n?o=Math.ceil(e.max/n)-Math.floor(e.min/n)+1:(o=e.computeTickLimit(),i=i||11),i&&(o=Math.min(i,o)),o}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this,t=e.options,o=t.ticks;let i=e.getTickLimit();i=Math.max(2,i);const n=mr({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:o.precision,step:o.stepSize,count:o.count,maxDigits:e._maxDigits(),horizontal:e.isHorizontal(),minRotation:o.minRotation||0,includeBounds:!1!==o.includeBounds},e._range||e);return"ticks"===t.bounds&&B(n,e,"value"),t.reverse?(n.reverse(),e.start=e.max,e.end=e.min):(e.start=e.min,e.end=e.max),n}configure(){const e=this,t=e.ticks;let o=e.min,i=e.max;if(super.configure(),e.options.offset&&t.length){const e=(i-o)/Math.max(t.length-1,1)/2;o-=e,i+=e}e._startValue=o,e._endValue=i,e._valueRange=i-o}getLabelForValue(e){return eo(e,this.chart.options.locale)}}class xr extends yr{determineDataLimits(){const e=this,{min:t,max:o}=e.getMinMax(!0);e.min=u(t)?t:0,e.max=u(o)?o:1,e.handleTickRangeOptions()}computeTickLimit(){const e=this,t=e.isHorizontal(),o=t?e.width:e.height,i=$(e.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,r=e._resolveTickFontOptions(0);return Math.ceil(o/Math.min(40,r.lineHeight/n))}getPixelForValue(e){return null===e?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}function vr(e){return 1===e/Math.pow(10,Math.floor(U(e)))}xr.id="linear",xr.defaults={ticks:{callback:Pi.formatters.numeric}};class _r extends Li{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){const o=yr.prototype.parse.apply(this,[e,t]);if(0!==o)return u(o)&&o>0?o:null;this._zero=!0}determineDataLimits(){const e=this,{min:t,max:o}=e.getMinMax(!0);e.min=u(t)?Math.max(0,t):null,e.max=u(o)?Math.max(0,o):null,e.options.beginAtZero&&(e._zero=!0),e.handleTickRangeOptions()}handleTickRangeOptions(){const e=this,{minDefined:t,maxDefined:o}=e.getUserBounds();let i=e.min,n=e.max;const r=e=>i=t?i:e,s=e=>n=o?n:e,a=(e,t)=>Math.pow(10,Math.floor(U(e))+t);i===n&&(i<=0?(r(1),s(10)):(r(a(i,-1)),s(a(n,1)))),i<=0&&r(a(n,-1)),n<=0&&s(a(i,1)),e._zero&&e.min!==e._suggestedMin&&i===a(e.min,0)&&r(a(i,-1)),e.min=i,e.max=n}buildTicks(){const e=this,t=e.options,o=function(e,t){const o=Math.floor(U(t.max)),i=Math.ceil(t.max/Math.pow(10,o)),n=[];let r=p(e.min,Math.pow(10,Math.floor(U(t.min)))),s=Math.floor(U(r)),a=Math.floor(r/Math.pow(10,s)),l=s<0?Math.pow(10,Math.abs(s)):1;do{n.push({value:r,major:vr(r)}),++a,10===a&&(a=1,++s,l=s>=0?1:l),r=Math.round(a*Math.pow(10,s)*l)/l}while(sn?{start:t-o,end:t}:{start:t,end:t+o}}function kr(e){const t={l:0,r:e.width,t:0,b:e.height-e.paddingTop},o={},i=[],n=[],r=e.getLabels().length;for(let c=0;ct.r&&(t.r=m.end,o.r=f),b.startt.b&&(t.b=b.end,o.b=f)}var s,a,l;e._setReductions(e.drawingArea,t,o),e._pointLabelItems=function(e,t,o){const i=[],n=e.getLabels().length,r=e.options,s=wr(r),a=e.getDistanceFromCenterForValue(r.ticks.reverse?e.min:e.max);for(let r=0;r270||o<90)&&(e-=t),e}function Er(e,t,o,i){const{ctx:n}=e;if(o)n.arc(e.xCenter,e.yCenter,t,0,C);else{let o=e.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let r=1;r{const i=m(t.options.pointLabels.callback,[e,o],t);return i||0===i?i:""}))}fit(){const e=this,t=e.options;t.display&&t.pointLabels.display?kr(e):e.setCenterPoint(0,0,0,0)}_setReductions(e,t,o){const i=this;let n=t.l/Math.sin(o.l),r=Math.max(t.r-i.width,0)/Math.sin(o.r),s=-t.t/Math.cos(o.t),a=-Math.max(t.b-(i.height-i.paddingTop),0)/Math.cos(o.b);n=Or(n),r=Or(r),s=Or(s),a=Or(a),i.drawingArea=Math.max(e/2,Math.min(Math.floor(e-(n+r)/2),Math.floor(e-(s+a)/2))),i.setCenterPoint(n,r,s,a)}setCenterPoint(e,t,o,i){const n=this,r=n.width-t-n.drawingArea,s=e+n.drawingArea,a=o+n.drawingArea,l=n.height-n.paddingTop-i-n.drawingArea;n.xCenter=Math.floor((s+r)/2+n.left),n.yCenter=Math.floor((a+l)/2+n.top+n.paddingTop)}getIndexAngle(e){return Q(e*(C/this.getLabels().length)+$(this.options.startAngle||0))}getDistanceFromCenterForValue(e){const t=this;if(c(e))return NaN;const o=t.drawingArea/(t.max-t.min);return t.options.reverse?(t.max-e)*o:(e-t.min)*o}getValueForDistanceFromCenter(e){if(c(e))return NaN;const t=this,o=e/(t.drawingArea/(t.max-t.min));return t.options.reverse?t.max-o:t.min+o}getPointPosition(e,t){const o=this,i=o.getIndexAngle(e)-L;return{x:Math.cos(i)*t+o.xCenter,y:Math.sin(i)*t+o.yCenter,angle:i}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){const{left:t,top:o,right:i,bottom:n}=this._pointLabelItems[e];return{left:t,top:o,right:i,bottom:n}}drawBackground(){const e=this,{backgroundColor:t,grid:{circular:o}}=e.options;if(t){const i=e.ctx;i.save(),i.beginPath(),Er(e,e.getDistanceFromCenterForValue(e._endValue),o,e.getLabels().length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const e=this,t=e.ctx,o=e.options,{angleLines:i,grid:n}=o,r=e.getLabels().length;let s,a,l;if(o.pointLabels.display&&function(e,t){const{ctx:o,options:{pointLabels:i}}=e;for(let n=t-1;n>=0;n--){const t=i.setContext(e.getContext(n)),r=dt(t.font),{x:s,y:a,textAlign:l,left:d,top:h,right:u,bottom:p}=e._pointLabelItems[n],{backdropColor:f}=t;if(!c(f)){const e=ct(t.backdropPadding);o.fillStyle=f,o.fillRect(d-e.left,h-e.top,u-d+e.width,p-h+e.height)}Ze(o,e._pointLabels[n],s,a+r.lineHeight/2,r,{color:t.color,textAlign:l,textBaseline:"middle"})}}(e,r),n.display&&e.ticks.forEach(((t,o)=>{if(0!==o){a=e.getDistanceFromCenterForValue(t.value);const i=n.setContext(e.getContext(o-1));!function(e,t,o,i){const n=e.ctx,r=t.circular,{color:s,lineWidth:a}=t;!r&&!i||!s||!a||o<0||(n.save(),n.strokeStyle=s,n.lineWidth=a,n.setLineDash(t.borderDash),n.lineDashOffset=t.borderDashOffset,n.beginPath(),Er(e,o,r,i),n.closePath(),n.stroke(),n.restore())}(e,i,a,r)}})),i.display){for(t.save(),s=e.getLabels().length-1;s>=0;s--){const n=i.setContext(e.getContext(s)),{color:r,lineWidth:c}=n;c&&r&&(t.lineWidth=c,t.strokeStyle=r,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,a=e.getDistanceFromCenterForValue(o.ticks.reverse?e.min:e.max),l=e.getPointPosition(s,a),t.beginPath(),t.moveTo(e.xCenter,e.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const e=this,t=e.ctx,o=e.options,i=o.ticks;if(!i.display)return;const n=e.getIndexAngle(0);let r,s;t.save(),t.translate(e.xCenter,e.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",e.ticks.forEach(((n,a)=>{if(0===a&&!o.reverse)return;const l=i.setContext(e.getContext(a)),c=dt(l.font);if(r=e.getDistanceFromCenterForValue(e.ticks[a].value),l.showLabelBackdrop){t.font=c.string,s=t.measureText(n.label).width,t.fillStyle=l.backdropColor;const e=ct(l.backdropPadding);t.fillRect(-s/2-e.left,-r-c.size/2-e.top,s+e.width,c.size+e.height)}Ze(t,n.label,0,-r,c,{color:l.color})})),t.restore()}drawTitle(){}}Mr.id="radialLinear",Mr.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Pi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:e=>e,padding:5}},Mr.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},Mr.descriptors={angleLines:{_fallback:"grid"}};const Dr={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}},Cr=Object.keys(Dr);function Rr(e,t){return e-t}function Ir(e,t){if(c(t))return null;const o=e._adapter,{parser:i,round:n,isoWeekday:r}=e._parseOpts;let s=t;return"function"==typeof i&&(s=i(s)),u(s)||(s="string"==typeof i?o.parse(s,i):o.parse(s)),null===s?null:(n&&(s="week"!==n||!W(r)&&!0!==r?o.startOf(s,n):o.startOf(s,"isoWeek",r)),+s)}function Hr(e,t,o,i){const n=Cr.length;for(let r=Cr.indexOf(e);r=t?o[i]:o[n]]=!0}}else e[t]=!0}function Nr(e,t,o){const i=[],n={},r=t.length;let s,a;for(s=0;s=0&&(t[l].major=!0);return t}(e,i,n,o):i}class zr extends Li{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,t){const o=e.time||(e.time={}),i=this._adapter=new Bo._date(e.adapters.date);T(o.displayFormats,i.formats()),this._parseOpts={parser:o.parser,round:o.round,isoWeekday:o.isoWeekday},super.init(e),this._normalized=t.normalized}parse(e,t){return void 0===e?null:Ir(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this,t=e.options,o=e._adapter,i=t.time.unit||"day";let{min:n,max:r,minDefined:s,maxDefined:a}=e.getUserBounds();function l(e){s||isNaN(e.min)||(n=Math.min(n,e.min)),a||isNaN(e.max)||(r=Math.max(r,e.max))}s&&a||(l(e._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||l(e.getMinMax(!1))),n=u(n)&&!isNaN(n)?n:+o.startOf(Date.now(),i),r=u(r)&&!isNaN(r)?r:+o.endOf(Date.now(),i)+1,e.min=Math.min(n,r-1),e.max=Math.max(n+1,r)}_getLabelBounds(){const e=this.getLabelTimestamps();let t=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return e.length&&(t=e[0],o=e[e.length-1]),{min:t,max:o}}buildTicks(){const e=this,t=e.options,o=t.time,i=t.ticks,n="labels"===i.source?e.getLabelTimestamps():e._generate();"ticks"===t.bounds&&n.length&&(e.min=e._userMin||n[0],e.max=e._userMax||n[n.length-1]);const r=e.min,s=function(e,t,o){let i=0,n=e.length;for(;ii&&e[n-1]>o;)n--;return i>0||n=Cr.indexOf(o);r--){const o=Cr[r];if(Dr[o].common&&e._adapter.diff(n,i,o)>=t-1)return o}return Cr[o?Cr.indexOf(o):0]}(e,s.length,o.minUnit,e.min,e.max)),e._majorUnit=i.major.enabled&&"year"!==e._unit?function(e){for(let t=Cr.indexOf(e)+1,o=Cr.length;t1e5*a)throw new Error(o+" and "+i+" are too far apart with stepSize of "+a+" "+s);const g="data"===n.ticks.source&&e.getDataTimestamps();for(h=p,u=0;he-t)).map((e=>+e))}getLabelForValue(e){const t=this._adapter,o=this.options.time;return o.tooltipFormat?t.format(e,o.tooltipFormat):t.format(e,o.displayFormats.datetime)}_tickFormatFunction(e,t,o,i){const n=this,r=n.options,s=r.time.displayFormats,a=n._unit,l=n._majorUnit,c=a&&s[a],d=l&&s[l],h=o[t],u=l&&d&&h&&h.major,p=n._adapter.format(e,i||(u?d:c)),f=r.ticks.callback;return f?m(f,[p,t,o],n):p}generateTickLabels(e){let t,o,i;for(t=0,o=e.length;t0?a:1}getDataTimestamps(){const e=this;let t,o,i=e._cache.data||[];if(i.length)return i;const n=e.getMatchingVisibleMetas();if(e._normalized&&n.length)return e._cache.data=n[0].controller.getAllParsedValues(e);for(t=0,o=n.length;tt&&s0&&!c(t)?t/o._maxIndex:o.getDecimalForValue(e);return o.getPixelForDecimal((i.start+n)*i.factor)}getDecimalForValue(e){return Ur(this._table,e)/this._maxIndex}getValueForPixel(e){const t=this,o=t._offsets,i=t.getDecimalForPixel(e)/o.factor-o.end;return Ur(t._table,i*this._maxIndex,!0)}}Fr.id="timeseries",Fr.defaults=zr.defaults},8227:(e,t,o)=>{"use strict";o.d(t,{A:()=>n});const i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const n=function(e){return"string"==typeof e&&i.test(e)}}}]);
//# sourceMappingURL=21571.047276997b77dee6f381.js.map