/* esm.sh - chart.js@4.5.1 */ import{r as ln,a as Wt,e as bi,c as xi,i as z,d as I,b as G,v as A,u as _i,l as hn,f as Ct,g as V,h as Yt,s as dt,j as kt,k as O,_ as As,t as et,m as cn,n as dn,T as U,o as ye,p as ce,H as Q,P as j,q as Cs,w as Os,x as Ot,y as Ls,z as xt,A as un,B as Ut,C as _t,D as Ts,E as Y,F as L,G as fn,I as Es,J as yi,K as gn,L as Rs,M as Is,N as pn,O as Z,Q as E,R as mn,S as X,U as gi,V as vi,W as bn,X as pt,Y as ve,Z as vt,$ as Me,a0 as B,a1 as pi,a2 as H,a3 as Lt,a4 as xn,a5 as _n,a6 as Mi,a7 as ke,a8 as ki,a9 as yn,aa as vn,ab as re,ac as Mn,ad as kn,ae as Si,af as wi,ag as Di,ah as zs,ai as de,aj as Sn,ak as ht,al as ut,am as wn,an as Dn,ao as Pn,ap as Fs,aq as An,ar as Cn,as as On,at as Ln,au as Tn,av as Ve,aw as Xt,ax as En,ay as yt,az as Rn,aA as At,aB as Vs,aC as In,aD as Bs,aE as zn,aF as Fn,aG as at,aH as Ns,aI as Pi,aJ as Vn,aK as De,aL as Ai,aM as mi,aN as Ht,aO as Bn,aP as Nn,aQ as Wn}from"./dist/chunks/helpers.dataset.mjs";import"/public/js/@kurkle/color@^0.3.0?target=denonext";var Be=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let o=e.listeners[s],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=ln.call(globalThis,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,s)=>{if(!i.running||!i.items.length)return;let o=i.items,a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),o.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,s)=>Math.max(i,s._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},rt=new Be,Ci="transparent",Hn={boolean(n,t,e){return e>.5?t:n},color(n,t,e){let i=xi(n||Ci),s=i.valid&&xi(t||Ci);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}},Ne=class{constructor(t,e,i,s){let o=e[i];s=Wt([t.to,s,o,t.from]);let a=Wt([t.from,o,s]);this._active=!0,this._fn=t.fn||Hn[t.type||typeof a],this._easing=bi[t.easing]||bi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let s=this._target[this._prop],o=i-this._start,a=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Wt([t.to,e,s,t.from]),this._from=Wt([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,s=this._prop,o=this._from,a=this._loop,r=this._to,l;if(this._active=o!==r&&(a||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,r,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let s=0;s{let o=t[s];if(!z(o))return;let a={};for(let r of e)a[r]=o[r];(G(o.properties)&&o.properties||[s]).forEach(r=>{(r===s||!i.has(r))&&i.set(r,a)})})}_animateOptions(t,e){let i=e.options,s=$n(t,i);if(!s)return[];let o=this._createAnimations(s,i);return i.$shared&&jn(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=this._properties,s=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now(),l;for(l=a.length-1;l>=0;--l){let h=a[l];if(h.charAt(0)==="$")continue;if(h==="options"){s.push(...this._animateOptions(t,e));continue}let c=e[h],d=o[h],u=i.get(h);if(d)if(u&&d.active()){d.update(u,c,r);continue}else d.cancel();if(!u||!u.duration){t[h]=c;continue}o[h]=d=new Ne(u,t,h,c),s.push(d)}return s}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return rt.add(this._chart,i),!0}};function jn(n,t){let e=[],i=Object.keys(t);for(let s=0;s0||!e&&o<0)return s.index}return null}function Ei(n,t){let{chart:e,_cachedMeta:i}=n,s=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=i,l=o.axis,h=a.axis,c=Kn(o,a,i),d=t.length,u;for(let f=0;fe[i].axis===t).shift()}function Jn(n,t){return kt(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Zn(n,t,e){return kt(n,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function zt(n,t){let e=n.controller.index,i=n.vScale&&n.vScale.axis;if(i){t=t||n._parsed;for(let s of t){let o=s._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}var Ce=n=>n==="reset"||n==="none",Ri=(n,t)=>t?n:Object.assign({},n),Qn=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:Ws(e,!0),values:null},ot=class{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Pe(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&zt(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(d,u,f,g)=>d==="x"?u:d==="r"?g:f,o=e.xAxisID=A(i.xAxisID,Ae(t,"x")),a=e.yAxisID=A(i.yAxisID,Ae(t,"y")),r=e.rAxisID=A(i.rAxisID,Ae(t,"r")),l=e.indexAxis,h=e.iAxisID=s(l,o,a,r),c=e.vAxisID=s(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&_i(this._data,this),t._stacked&&zt(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(z(e)){let s=this._cachedMeta;this._data=Xn(e,s)}else if(i!==e){if(i){_i(i,this);let s=this._cachedMeta;zt(s),s._parsed=[]}e&&Object.isExtensible(e)&&hn(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),s=!1;this._dataCheck();let o=e._stacked;e._stacked=Pe(e.vScale,e),e.stack!==i.stack&&(s=!0,zt(e),e.stack=i.stack),this._resyncElements(t),(s||o!==e._stacked)&&(Ei(this,e._parsed),e._stacked=Pe(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:s}=this,{iScale:o,_stacked:a}=i,r=o.axis,l=t===0&&e===s.length?!0:i._sorted,h=t>0&&i._parsed[t-1],c,d,u;if(this._parsing===!1)i._parsed=s,i._sorted=!0,u=s;else{G(s[t])?u=this.parseArrayData(i,s,t,e):z(s[t])?u=this.parseObjectData(i,s,t,e):u=this.parsePrimitiveData(i,s,t,e);let f=()=>d[r]===null||h&&d[r]p||d=0;--u)if(!g()){this.updateRangeFromParsed(h,t,f,l);break}}return h}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],s,o,a;for(s=0,o=e.length;s=0&&tthis.getContext(i,s,e),p=h.resolveNamedOptions(u,f,g,d);return p.$shared&&(p.$shared=l,o[a]=Object.freeze(Ri(p,l))),p}_resolveAnimations(t,e,i){let s=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(s.options.animation!==!1){let c=this.chart.config,d=c.datasetAnimationScopeKeys(this._type,e),u=c.getOptionScopes(this.getDataset(),d);l=c.createResolver(u,this.getContext(t,i,e))}let h=new ue(s,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(h)),h}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ce(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,o=this.getSharedOptions(i),a=this.includeOptions(e,o)||o!==s;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:a}}updateElement(t,e,i,s){Ce(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ce(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let o=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[r,l,h]of this._syncList)this[r](l,h);this._syncList=[];let s=i.length,o=e.length,a=Math.min(o,s);a&&this.parse(0,a),o>s?this._insertElements(s,o-s,t):o{for(h.length+=e,r=h.length-1;r>=a;r--)h[r]=h[r-e]};for(l(o),r=t;rs-o))}return n._cache.$bar}function eo(n){let t=n.iScale,e=to(t,n.type),i=t._length,s,o,a,r,l=()=>{a===32767||a===-32768||(Yt(r)&&(i=Math.min(i,Math.abs(a-r)||i)),r=a)};for(s=0,o=e.length;s0?s[n-1]:null,r=nMath.abs(r)&&(l=r,h=a),t[e.axis]=h,t._custom={barStart:l,barEnd:h,start:s,end:o,min:a,max:r}}function Hs(n,t,e,i){return G(n)?no(n,t,e,i):t[e.axis]=e.parse(n,i),t}function Ii(n,t,e,i){let s=n.iScale,o=n.vScale,a=s.getLabels(),r=s===o,l=[],h,c,d,u;for(h=e,c=e+i;h=e?1:-1)}function ao(n){let t,e,i,s,o;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.basec.controller.options.grouped),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],h=c=>{let d=c._parsed.find(f=>f[i.axis]===l),u=d&&d[c.vScale.axis];if(O(u)||isNaN(u))return!0};for(let c of s)if(!(e!==void 0&&h(c))&&((o===!1||a.indexOf(c.stack)===-1||o===void 0&&c.stack===void 0)&&a.push(c.stack),c.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[A(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let s=this._getStacks(t,i),o=e!==void 0?s.indexOf(e):-1;return o===-1?s.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,s=[],o,a;for(o=0,a=e.data.length;o=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:o}=e,a=this.getParsed(t),r=s.getLabelForValue(a.x),l=o.getLabelForValue(a.y),h=a._custom;return{label:i[t]||"",value:"("+r+", "+l+(h?", "+h:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){let o=s==="reset",{iScale:a,vScale:r}=this._cachedMeta,{sharedOptions:l,includeOptions:h}=this._getSharedOptions(e,s),c=a.axis,d=r.axis;for(let u=e;uce(v,r,l,!0)?1:Math.max(y,y*e,_,_*e),g=(v,y,_)=>ce(v,r,l,!0)?-1:Math.min(y,y*e,_,_*e),p=f(0,h,d),b=f(Q,c,u),m=g(j,h,d),x=g(j+Q,c,u);i=(p-m)/2,s=(b-x)/2,o=-(p+m)/2,a=-(b+x)/2}return{ratioX:i,ratioY:s,offsetX:o,offsetY:a}}var Kt=class extends ot{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 e=t.data,{labels:{pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,h)=>{let d=t.getDatasetMeta(0).controller.getStyle(h);return{text:l,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(h),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:s,pointStyle:i,borderRadius:a&&(r||d.borderRadius),index:h}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){let i=this.getDataset().data,s=this._cachedMeta;if(this._parsing===!1)s._parsed=i;else{let o=l=>+i[l];if(z(i[t])){let{key:l="value"}=this._parsing;o=h=>+Ct(i[h],l)}let a,r;for(a=t,r=t+e;a0&&!isNaN(t)?U*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=ye(e._parsed[t],i.options.locale);return{label:s[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,s,o,a,r,l;if(!t){for(s=0,o=i.data.datasets.length;s0&&this.getParsed(e-1);for(let _=0;_=x){k.skip=!0;continue}let S=this.getParsed(_),w=O(S[f]),D=k[u]=a.getPixelForValue(S[u],_),P=k[f]=o||w?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,S,l):S[f],_);k.skip=isNaN(D)||isNaN(P)||w,k.stop=_>0&&Math.abs(S[u]-y[u])>b,p&&(k.parsed=S,k.raw=h.data[_]),d&&(k.options=c||this.resolveDataElementOptions(_,M.active?"active":s)),m||this.updateElement(M,_,k,s),y=S}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;let o=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,o,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},fe=class extends ot{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 e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map((o,a)=>{let l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:s,lineWidth:l.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],o=ye(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:o}}parseObjectData(t,e,i,s){return Ls.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{let o=this.getParsed(s).r;!isNaN(o)&&this.chart.getDataVisibility(s)&&(oe.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),r=(o-a)/t.getVisibleDatasetCount();this.outerRadius=o-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,e,i,s){let o=s==="reset",a=this.chart,l=a.options.animation,h=this._cachedMeta.rScale,c=h.xCenter,d=h.yCenter,u=h.getIndexAngle(0)-.5*j,f=u,g,p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?et(this.resolveDataElementOptions(t,e).angle||i):0}},$e=class extends Kt{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},Ye=class extends ot{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 e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return Ls.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],o=e.iScale.getLabels();if(i.points=s,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let r={_loop:!0,_fullLoop:o.length===s.length,options:a};this.updateElement(i,void 0,r,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let o=this._cachedMeta.rScale,a=s==="reset";for(let r=e;r0&&this.getParsed(e-1);for(let y=e;y0&&Math.abs(M[f]-v[f])>m,b&&(k.parsed=M,k.raw=h.data[y]),u&&(k.options=d||this.resolveDataElementOptions(y,_.active?"active":s)),x||this.updateElement(_,y,k,s),v=M}this.updateSharedOptions(d,s,c)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let r=0;for(let l=e.length-1;l>=0;--l)r=Math.max(r,e[l].size(this.resolveDataElementOptions(l))/2);return r>0&&r}let i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;let o=e[0].size(this.resolveDataElementOptions(0)),a=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,o,a)/2}},uo=Object.freeze({__proto__:null,BarController:We,BubbleController:He,DoughnutController:Kt,LineController:je,PieController:$e,PolarAreaController:fe,RadarController:Ye,ScatterController:Ue});function mt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Xe=class n{static override(t){Object.assign(n.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return mt()}parse(){return mt()}format(){return mt()}add(){return mt()}diff(){return mt()}startOf(){return mt()}endOf(){return mt()}},fo={_date:Xe};function go(n,t,e,i){let{controller:s,data:o,_sorted:a}=n,r=s._cachedMeta.iScale,l=n.dataset&&n.dataset.options?n.dataset.options.spanGaps:null;if(r&&t===r.axis&&t!=="r"&&a&&o.length){let h=r._reversePixels?un:Ut;if(i){if(s._sharedOptions){let c=o[0],d=typeof c.getRange=="function"&&c.getRange(t);if(d){let u=h(o,t,e-d),f=h(o,t,e+d);return{lo:u.lo,hi:f.hi}}}}else{let c=h(o,t,e);if(l){let{vScale:d}=s._cachedMeta,{_parsed:u}=n,f=u.slice(0,c.lo+1).reverse().findIndex(p=>!O(p[d.axis]));c.lo-=Math.max(0,f);let g=u.slice(c.hi).findIndex(p=>!O(p[d.axis]));c.hi+=Math.max(0,g)}return c}}return{lo:0,hi:o.length-1}}function Qt(n,t,e,i,s){let o=n.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r{l[a]&&l[a](t[e],s)&&(o.push({element:l,datasetIndex:h,index:c}),r=r||l.inRange(t.x,t.y,s))}),i&&!r?[]:o}var xo={evaluateInteractionItems:Qt,modes:{index(n,t,e,i){let s=xt(t,n),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?Le(n,s,o,i,a):Te(n,s,o,!1,i,a),l=[];return r.length?(n.getSortedVisibleDatasetMetas().forEach(h=>{let c=r[0].index,d=h.data[c];d&&!d.skip&&l.push({element:d,datasetIndex:h.index,index:c})}),l):[]},dataset(n,t,e,i){let s=xt(t,n),o=e.axis||"xy",a=e.includeInvisible||!1,r=e.intersect?Le(n,s,o,i,a):Te(n,s,o,!1,i,a);if(r.length>0){let l=r[0].datasetIndex,h=n.getDatasetMeta(l).data;r=[];for(let c=0;ce.pos===t)}function Bi(n,t){return n.filter(e=>js.indexOf(e.pos)===-1&&e.box.axis===t)}function Vt(n,t){return n.sort((e,i)=>{let s=t?i:e,o=t?e:i;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function _o(n){let t=[],e,i,s,o,a,r;for(e=0,i=(n||[]).length;eh.box.fullSize),!0),i=Vt(Ft(t,"left"),!0),s=Vt(Ft(t,"right")),o=Vt(Ft(t,"top"),!0),a=Vt(Ft(t,"bottom")),r=Bi(t,"x"),l=Bi(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:s.concat(l).concat(a).concat(r),chartArea:Ft(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:o.concat(a).concat(r)}}function Ni(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function $s(n,t){n.top=Math.max(n.top,t.top),n.left=Math.max(n.left,t.left),n.bottom=Math.max(n.bottom,t.bottom),n.right=Math.max(n.right,t.right)}function ko(n,t,e,i){let{pos:s,box:o}=e,a=n.maxPadding;if(!z(s)){e.size&&(n[s]-=e.size);let d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,n[s]+=e.size}o.getPadding&&$s(a,o.getPadding());let r=Math.max(0,t.outerWidth-Ni(a,n,"left","right")),l=Math.max(0,t.outerHeight-Ni(a,n,"top","bottom")),h=r!==n.w,c=l!==n.h;return n.w=r,n.h=l,e.horizontal?{same:h,other:c}:{same:c,other:h}}function So(n){let t=n.maxPadding;function e(i){let s=Math.max(t[i]-n[i],0);return n[i]+=s,s}n.y+=e("top"),n.x+=e("left"),e("right"),e("bottom")}function wo(n,t){let e=t.maxPadding;function i(s){let o={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return i(n?["left","right"]:["top","bottom"])}function jt(n,t,e,i){let s=[],o,a,r,l,h,c;for(o=0,a=n.length,h=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});let c=l.reduce((p,b)=>b.box.options&&b.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),u=Object.assign({},s);$s(u,Y(i));let f=Object.assign({maxPadding:u,w:o,h:a,x:s.left,y:s.top},s),g=vo(l.concat(h),d);jt(r.fullSize,f,d,g),jt(l,f,d,g),jt(h,f,d,g)&&jt(l,f,d,g),So(f),Wi(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,Wi(r.rightAndBottom,f,d,g),n.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},L(r.chartArea,p=>{let b=p.box;Object.assign(b,n.chartArea),b.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},ge=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}},Ke=class extends ge{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},le="$chartjs",Do={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Hi=n=>n===null||n==="";function Po(n,t){let e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[le]={initial:{height:i,width:s,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Hi(s)){let o=yi(n,"width");o!==void 0&&(n.width=o)}if(Hi(i))if(n.style.height==="")n.height=n.width/(t||2);else{let o=yi(n,"height");o!==void 0&&(n.height=o)}return n}var Ys=gn?{passive:!0}:!1;function Ao(n,t,e){n&&n.addEventListener(t,e,Ys)}function Co(n,t,e){n&&n.canvas&&n.canvas.removeEventListener(t,e,Ys)}function Oo(n,t){let e=Do[n.type]||n.type,{x:i,y:s}=xt(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function pe(n,t){for(let e of n)if(e===t||e.contains(t))return!0}function Lo(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||pe(r.addedNodes,i),a=a&&!pe(r.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function To(n,t,e){let i=n.canvas,s=new MutationObserver(o=>{let a=!1;for(let r of o)a=a||pe(r.removedNodes,i),a=a&&!pe(r.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}var Gt=new Map,ji=0;function Us(){let n=globalThis.devicePixelRatio;n!==ji&&(ji=n,Gt.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function Eo(n,t){Gt.size||globalThis.addEventListener("resize",Us),Gt.set(n,t)}function Ro(n){Gt.delete(n),Gt.size||globalThis.removeEventListener("resize",Us)}function Io(n,t,e){let i=n.canvas,s=i&&Es(i);if(!s)return;let o=Rs((r,l)=>{let h=s.clientWidth;e(r,l),h{let l=r[0],h=l.contentRect.width,c=l.contentRect.height;h===0&&c===0||o(h,c)});return a.observe(s),Eo(n,o),a}function Ee(n,t,e){e&&e.disconnect(),t==="resize"&&Ro(n)}function zo(n,t,e){let i=n.canvas,s=Rs(o=>{n.ctx!==null&&e(Oo(o,n))},n);return Ao(i,t,s),s}var Ge=class extends ge{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Po(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[le])return!1;let i=e[le].initial;["height","width"].forEach(o=>{let a=i[o];O(a)?e.removeAttribute(o):e.setAttribute(o,a)});let s=i.style||{};return Object.keys(s).forEach(o=>{e.style[o]=s[o]}),e.width=e.width,delete e[le],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:Lo,detach:To,resize:Io}[e]||zo;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:Ee,detach:Ee,resize:Ee}[e]||Co)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return globalThis.devicePixelRatio}getMaximumSize(t,e,i,s){return fn(t,e,i,s)}isAttached(t){let e=t&&Es(t);return!!(e&&e.isConnected)}};function Fo(n){return!Is()||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas?Ke:Ge}var it=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ot(this.x)&&Ot(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(o=>{s[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),s}};function Vo(n,t){let e=n.options.ticks,i=Bo(n),s=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?Wo(t):[],a=o.length,r=o[0],l=o[a-1],h=[];if(a>s)return Ho(t,h,o,a/s),h;let c=No(o,t,s);if(a>0){let d,u,f=a>1?Math.round((l-r)/(a-1)):null;for(ie(t,h,c,O(f)?0:r-f,r),d=0,u=a-1;ds)return l}return Math.max(s,1)}function Wo(n){let t=[],e,i;for(e=0,i=n.length;en==="left"?"right":n==="right"?"left":n,$i=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e,Yi=(n,t)=>Math.min(t||n,n);function Ui(n,t){let e=[],i=n.length/t,s=n.length,o=0;for(;oa+r)))return l}function Uo(n,t){L(n,e=>{let i=e.gc,s=i.length/2,o;if(s>t){for(o=0;oi?i:e,i=s&&e>i?e:i,{min:Z(e,Z(i,e)),max:Z(i,Z(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){E(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:s,grace:o,ticks:a}=this.options,r=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=mn(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=r=o||i<=1||!this.isHorizontal()){this.labelRotation=s;return}let c=this._getLabelSizes(),d=c.widest.width,u=c.highest.height,f=X(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/i:f/(i-1),d+6>r&&(r=f/(i-(t.offset?.5:1)),l=this.maxHeight-Bt(t.grid)-e.padding-Xi(t.title,this.chart.options.font),h=Math.sqrt(d*d+u*u),a=gi(Math.min(Math.asin(X((c.highest.height+6)/r,-1,1)),Math.asin(X(l/h,-1,1))-Math.asin(X(u/h,-1,1)))),a=Math.max(s,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){E(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){E(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){let l=Xi(s,e.options.font);if(r?(t.width=this.maxWidth,t.height=Bt(o)+l):(t.height=this.maxHeight,t.width=Bt(o)+l),i.display&&this.ticks.length){let{first:h,last:c,widest:d,highest:u}=this._getLabelSizes(),f=i.padding*2,g=et(this.labelRotation),p=Math.cos(g),b=Math.sin(g);if(r){let m=i.mirror?0:b*d.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+m+f)}else{let m=i.mirror?0:p*d.width+b*u.height;t.width=Math.min(this.maxWidth,t.width+m+f)}this._calculatePadding(h,c,b,p)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){let{ticks:{align:o,padding:a},position:r}=this.options,l=this.labelRotation!==0,h=r!=="top"&&this.axis==="x";if(this.isHorizontal()){let c=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?h?(u=s*t.width,f=i*e.height):(u=i*t.height,f=s*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-c+a)*this.width/(this.width-c),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let c=e.height/2,d=t.height/2;o==="start"?(c=0,d=t.height):o==="end"&&(c=e.height,d=0),this.paddingTop=c+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){E(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:a[w]||0,height:r[w]||0});return{first:S(0),last:S(e-1),widest:S(M),highest:S(k),widths:a,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return bn(this._alignToPixels?pt(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&tr*s?r/i:l/s:l*s0}_computeGridLineItems(t){let e=this.axis,i=this.chart,s=this.options,{grid:o,position:a,border:r}=s,l=o.offset,h=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=Bt(o),f=[],g=r.setContext(this.getContext()),p=g.display?g.width:0,b=p/2,m=function(R){return pt(i,R,p)},x,v,y,_,M,k,S,w,D,P,C,N;if(a==="top")x=m(this.bottom),k=this.bottom-u,w=x-b,P=m(t.top)+b,N=t.bottom;else if(a==="bottom")x=m(this.top),P=t.top,N=m(t.bottom)-b,k=x+b,w=this.top+u;else if(a==="left")x=m(this.right),M=this.right-u,S=x-b,D=m(t.left)+b,C=t.right;else if(a==="right")x=m(this.left),D=t.left,C=m(t.right)-b,M=x+b,S=this.left+u;else if(e==="x"){if(a==="center")x=m((t.top+t.bottom)/2+.5);else if(z(a)){let R=Object.keys(a)[0],F=a[R];x=m(this.chart.scales[R].getPixelForValue(F))}P=t.top,N=t.bottom,k=x+b,w=k+u}else if(e==="y"){if(a==="center")x=m((t.left+t.right)/2);else if(z(a)){let R=Object.keys(a)[0],F=a[R];x=m(this.chart.scales[R].getPixelForValue(F))}M=x-b,S=M-u,D=t.left,C=t.right}let J=A(s.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/J));for(v=0;v0&&(gt-=ft/2);break}te={left:gt,top:It,width:ft+wt.width,height:Rt+wt.height,color:T.backdropColor}}b.push({label:y,font:w,textOffset:C,options:{rotation:p,color:F,strokeColor:tt,strokeWidth:W,textAlign:St,textBaseline:N,translation:[_,M],backdrop:te}})}return b}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-et(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:s,padding:o}}=this.options,a=this._getLabelSizes(),r=t+o,l=a.widest.width,h,c;return e==="left"?s?(c=this.right+o,i==="near"?h="left":i==="center"?(h="center",c+=l/2):(h="right",c+=l)):(c=this.right-r,i==="near"?h="right":i==="center"?(h="center",c-=l/2):(h="left",c=this.left)):e==="right"?s?(c=this.left+o,i==="near"?h="right":i==="center"?(h="center",c-=l/2):(h="left",c-=l)):(c=this.left+r,i==="near"?h="left":i==="center"?(h="center",c+=l/2):(h="right",c=this.right)):h="right",{textAlign:h,x:c}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:s,width:o,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,o,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let s=this.ticks.findIndex(o=>o.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,a,r=(l,h,c)=>{!c.width||!c.color||(i.save(),i.lineWidth=c.width,i.strokeStyle=c.color,i.setLineDash(c.borderDash||[]),i.lineDashOffset=c.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(h.x,h.y),i.stroke(),i.restore())};if(e.display)for(o=0,a=s.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[],o,a;for(o=0,a=e.length;o{let i=e.split("."),s=i.pop(),o=[n].concat(i).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");I.route(o,s,l,r)})}function Qo(n){return"id"in n&&"defaults"in n}var qe=class{constructor(){this.controllers=new Pt(ot,"datasets",!0),this.elements=new Pt(it,"elements"),this.plugins=new Pt(Object,"plugins"),this.scales=new Pt(Mt,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach(s=>{let o=i||this._getRegistryForType(s);i||o.isForType(s)||o===this.plugins&&s.id?this._exec(t,o,s):L(s,a=>{let r=i||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,i){let s=_n(t);E(i["before"+s],[],i),e[t](i),E(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}};function ta(n){let t={},e=[],i=Object.keys(nt.plugins.items);for(let o=0;o1&&Ki(n[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${n}' axis. Please provide 'axis' or 'position' option.`)}function Gi(n,t,e){if(e[t+"AxisID"]===n)return{axis:t}}function ra(n,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===n||i.yAxisID===n);if(e.length)return Gi(n,"x",e[0])||Gi(n,"y",e[0])}return{}}function la(n,t){let e=Lt[n.type]||{scales:{}},i=t.scales||{},s=Ze(n.type,t),o=Object.create(null);return Object.keys(i).forEach(a=>{let r=i[a];if(!z(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);let l=Qe(a,r,ra(a,n),I.scales[r.type]),h=oa(l,s),c=e.scales||{};o[a]=re(Object.create(null),[{axis:l},r,c[l],c[h]])}),n.data.datasets.forEach(a=>{let r=a.type||n.type,l=a.indexAxis||Ze(r,t),c=(Lt[r]||{}).scales||{};Object.keys(c).forEach(d=>{let u=na(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),re(o[f],[{axis:u},i[f],c[d]])})}),Object.keys(o).forEach(a=>{let r=o[a];re(r,[I.scales[r.type],I.scale])}),o}function Xs(n){let t=n.options||(n.options={});t.plugins=A(t.plugins,{}),t.scales=la(n,t)}function Ks(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function ha(n){return n=n||{},n.data=Ks(n.data),Xs(n),n}var qi=new Map,Gs=new Set;function se(n,t){let e=qi.get(n);return e||(e=t(),qi.set(n,e),Gs.add(e)),e}var Nt=(n,t,e)=>{let i=Ct(t,e);i!==void 0&&n.add(i)},ti=class{constructor(t){this._config=ha(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Ks(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),Xs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return se(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return se(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return se(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return se(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,s=i.get(t);return(!s||e)&&(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){let{options:s,type:o}=this,a=this._cachedScopes(t,i),r=a.get(e);if(r)return r;let l=new Set;e.forEach(c=>{t&&(l.add(t),c.forEach(d=>Nt(l,t,d))),c.forEach(d=>Nt(l,s,d)),c.forEach(d=>Nt(l,Lt[o]||{},d)),c.forEach(d=>Nt(l,I,d)),c.forEach(d=>Nt(l,Mi,d))});let h=Array.from(l);return h.length===0&&h.push(Object.create(null)),Gs.has(e)&&a.set(e,h),h}chartOptionScopes(){let{options:t,type:e}=this;return[t,Lt[e]||{},I.datasets[e]||{},{type:e},I,Mi]}resolveNamedOptions(t,e,i,s=[""]){let o={$shared:!0},{resolver:a,subPrefixes:r}=Ji(this._resolverCache,t,s),l=a;if(da(a,e)){o.$shared=!1,i=ke(i)?i():i;let h=this.createResolver(t,i,r);l=ki(a,i,h)}for(let h of e)o[h]=l[h];return o}createResolver(t,e,i=[""],s){let{resolver:o}=Ji(this._resolverCache,t,i);return z(e)?ki(o,e,void 0,s):o}};function Ji(n,t,e){let i=n.get(t);i||(i=new Map,n.set(t,i));let s=e.join(),o=i.get(s);return o||(o={resolver:yn(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},i.set(s,o)),o}var ca=n=>z(n)&&Object.getOwnPropertyNames(n).some(t=>ke(n[t]));function da(n,t){let{isScriptable:e,isIndexable:i}=vn(n);for(let s of t){let o=e(s),a=i(s),r=(a||o)&&n[s];if(o&&(ke(r)||ca(r))||a&&G(r))return!0}return!1}var ua="4.5.1",fa=["top","bottom","left","right","chartArea"];function Zi(n,t){return n==="top"||n==="bottom"||fa.indexOf(n)===-1&&t==="x"}function Qi(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function ts(n){let t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),E(e&&e.onComplete,[n],t)}function ga(n){let t=n.chart,e=t.options.animation;E(e&&e.onProgress,[n],t)}function qs(n){return Is()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}var he={},es=n=>{let t=qs(n);return Object.values(he).filter(e=>e.canvas===t).pop()};function pa(n,t,e){let i=Object.keys(n);for(let s of i){let o=+s;if(o>=t){let a=n[s];delete n[s],(e>0||o>t)&&(n[o+e]=a)}}}function ma(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}var ei=class{static defaults=I;static instances=he;static overrides=Lt;static registry=nt;static version=ua;static getChart=es;static register(...t){nt.add(...t),is()}static unregister(...t){nt.remove(...t),is()}constructor(t,e){let i=this.config=new ti(e),s=qs(t),o=es(s);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let a=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Fo(s)),this.platform.updateConfig(i);let r=this.platform.acquireContext(s,a.aspectRatio),l=r&&r.canvas,h=l&&l.height,c=l&&l.width;if(this.id=Mn(),this.ctx=r,this.canvas=l,this.width=c,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 Je,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=kn(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],he[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}rt.listen(this,"complete",ts),rt.listen(this,"progress",ga),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:o}=this;return O(t)?e&&o?o:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return nt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Si(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return wi(this.canvas,this.ctx),this}stop(){return rt.stop(this),this}resize(t,e){rt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,s=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Si(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),E(i.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};L(e,(i,s)=>{i.id=s})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce((a,r)=>(a[r]=!1,a),{}),o=[];e&&(o=o.concat(Object.keys(e).map(a=>{let r=e[a],l=Qe(a,r),h=l==="r",c=l==="x";return{options:r,dposition:h?"chartArea":c?"bottom":"left",dtype:h?"radialLinear":c?"category":"linear"}}))),L(o,a=>{let r=a.options,l=r.id,h=Qe(l,r),c=A(r.type,a.dtype);(r.position===void 0||Zi(r.position,h)!==Zi(a.dposition))&&(r.position=a.dposition),s[l]=!0;let d=null;if(l in i&&i[l].type===c)d=i[l];else{let u=nt.getScale(c);d=new u({id:l,type:c,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(r,t)}),L(s,(a,r)=>{a||delete i[r]}),L(i,a=>{$.configure(this,a,a.options),$.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,o)=>s.index-o.index),i>e){for(let s=e;se.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let h=0,c=this.data.datasets.length;h{h.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Qi("z","_idx"));let{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){L(this.scales,t=>{$.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Di(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:s,count:o}of e){let a=i==="_removeElements"?-o:o;pa(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),s=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;$.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],L(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,o)=>{s._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=zs(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(s&&ve(e,s),t.controller.draw(),s&&Me(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return _t(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let o=xo.modes[e];return typeof o=="function"?o(this,t,i,s):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,s=i.filter(o=>o&&o._dataset===e).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=kt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let s=i?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,s);Yt(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),a.update(o,{visible:i}),this.update(r=>r.datasetIndex===t?s:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),rt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,a),t[o]=a},s=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};L(this.options.events,o=>i(o,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,h)=>{e.addEventListener(this,l,h),t[l]=h},s=(l,h)=>{t[l]&&(e.removeEventListener(this,l,h),delete t[l])},o=(l,h)=>{this.canvas&&this.resize(l,h)},a,r=()=>{s("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",a)};a=()=>{this.attached=!1,s("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){L(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},L(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s=i?"set":"remove",o,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+s+"DatasetHoverStyle"]()),r=0,l=t.length;r{let r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!de(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){let s=this.options.hover,o=(l,h)=>l.filter(c=>!h.some(d=>c.datasetIndex===d.datasetIndex&&c.index===d.index)),a=o(e,t),r=i?t:o(t,e);a.length&&this.updateHoverStyle(a,s.mode,!1),r.length&&s.mode&&this.updateHoverStyle(r,s.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,s)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:s=[],options:o}=this,a=e,r=this._getActiveElements(t,s,i,a),l=Sn(t),h=ma(t,this._lastEvent,i,l);i&&(this._lastEvent=null,E(o.onHover,[t,r,this],this),l&&E(o.onClick,[t,r,this],this));let c=!de(r,s);return(c||e)&&(this._active=r,this._updateHoverStyles(r,s,e)),this._lastEvent=h,c}_getActiveElements(t,e,i,s){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,s)}};function is(){return L(ei.instances,n=>n._plugins.invalidate())}function ba(n,t,e){let{startAngle:i,x:s,y:o,outerRadius:a,innerRadius:r,options:l}=t,{borderWidth:h,borderJoinStyle:c}=l,d=Math.min(h/a,ut(i-e));if(n.beginPath(),n.arc(s,o,a-h/2,i+d/2,e-d/2),r>0){let u=Math.min(h/r,ut(i-e));n.arc(s,o,r+h/2,e-u/2,i+u/2,!0)}else{let u=Math.min(h/2,a*ut(i-e));if(c==="round")n.arc(s,o,u,e-j/2,i+j/2,!0);else if(c==="bevel"){let f=2*u*u,g=-f*Math.cos(e+j/2)+s,p=-f*Math.sin(e+j/2)+o,b=f*Math.cos(i+j/2)+s,m=f*Math.sin(i+j/2)+o;n.lineTo(g,p),n.lineTo(b,m)}}n.closePath(),n.moveTo(0,0),n.rect(0,0,n.canvas.width,n.canvas.height),n.clip("evenodd")}function xa(n,t,e){let{startAngle:i,pixelMargin:s,x:o,y:a,outerRadius:r,innerRadius:l}=t,h=s/r;n.beginPath(),n.arc(o,a,r,i-h,e+h),l>s?(h=s/l,n.arc(o,a,l,e+h,i-h,!0)):n.arc(o,a,s,e+Q,i-Q),n.closePath(),n.clip()}function _a(n){return wn(n,["outerStart","outerEnd","innerStart","innerEnd"])}function ya(n,t,e,i){let s=_a(n.options.borderRadius),o=(e-t)/2,a=Math.min(o,i*t/2),r=l=>{let h=(e-Math.min(o,l))*i/2;return X(l,0,Math.min(o,h))};return{outerStart:r(s.outerStart),outerEnd:r(s.outerEnd),innerStart:X(s.innerStart,0,a),innerEnd:X(s.innerEnd,0,a)}}function Dt(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function me(n,t,e,i,s,o){let{x:a,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=t,d=Math.max(t.outerRadius+i+e-h,0),u=c>0?c+i+e+h:0,f=0,g=s-l;if(i){let T=c>0?c-i:0,R=d>0?d-i:0,F=(T+R)/2,tt=F!==0?g*F/(F+i):g;f=(g-tt)/2}let p=Math.max(.001,g*d-e/j)/d,b=(g-p)/2,m=l+b+f,x=s-b-f,{outerStart:v,outerEnd:y,innerStart:_,innerEnd:M}=ya(t,u,d,x-m),k=d-v,S=d-y,w=m+v/k,D=x-y/S,P=u+_,C=u+M,N=m+_/P,J=x-M/C;if(n.beginPath(),o){let T=(w+D)/2;if(n.arc(a,r,d,w,T),n.arc(a,r,d,T,D),y>0){let W=Dt(S,D,a,r);n.arc(W.x,W.y,y,D,x+Q)}let R=Dt(C,x,a,r);if(n.lineTo(R.x,R.y),M>0){let W=Dt(C,J,a,r);n.arc(W.x,W.y,M,x+Q,J+Math.PI)}let F=(x-M/u+(m+_/u))/2;if(n.arc(a,r,u,x-M/u,F,!0),n.arc(a,r,u,F,m+_/u,!0),_>0){let W=Dt(P,N,a,r);n.arc(W.x,W.y,_,N+Math.PI,m-Q)}let tt=Dt(k,m,a,r);if(n.lineTo(tt.x,tt.y),v>0){let W=Dt(k,w,a,r);n.arc(W.x,W.y,v,m-Q,w)}}else{n.moveTo(a,r);let T=Math.cos(w)*d+a,R=Math.sin(w)*d+r;n.lineTo(T,R);let F=Math.cos(D)*d+a,tt=Math.sin(D)*d+r;n.lineTo(F,tt)}n.closePath()}function va(n,t,e,i,s){let{fullCircles:o,startAngle:a,circumference:r}=t,l=t.endAngle;if(o){me(n,t,e,i,l,s);for(let h=0;h=j&&f===0&&c!=="miter"&&ba(n,t,p),o||(me(n,t,e,i,p,s),n.stroke())}var ii=class extends it{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.getProps(["x","y"],i),{angle:o,distance:a}=Ts(s,{x:t,y:e}),{startAngle:r,endAngle:l,innerRadius:h,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,f=A(d,l-r),g=ce(o,r,l)&&r!==l,p=f>=U||g,b=ht(a,h+u,c+u);return p&&b}getCenterPoint(t){let{x:e,y:i,startAngle:s,endAngle:o,innerRadius:a,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:h}=this.options,c=(s+o)/2,d=(a+r+h+l)/2;return{x:e+Math.cos(c)*d,y:i+Math.sin(c)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){let{options:e,circumference:i}=this,s=(e.offset||0)/4,o=(e.spacing||0)/2,a=e.circular;if(this.pixelMargin=e.borderAlign==="inner"?.33:0,this.fullCircles=i>U?Math.floor(i/U):0,i===0||this.innerRadius<0||this.outerRadius<0)return;t.save();let r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*s,Math.sin(r)*s);let l=1-Math.sin(Math.min(j,i||0)),h=s*l;t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,va(t,this,h,o,a),Ma(t,this,h,o,a),t.restore()}};function Js(n,t,e=t){n.lineCap=A(e.borderCapStyle,t.borderCapStyle),n.setLineDash(A(e.borderDash,t.borderDash)),n.lineDashOffset=A(e.borderDashOffset,t.borderDashOffset),n.lineJoin=A(e.borderJoinStyle,t.borderJoinStyle),n.lineWidth=A(e.borderWidth,t.borderWidth),n.strokeStyle=A(e.borderColor,t.borderColor)}function ka(n,t,e){n.lineTo(e.x,e.y)}function Sa(n){return n.stepped?Ln:n.tension||n.cubicInterpolationMode==="monotone"?Tn:ka}function Zs(n,t,e={}){let i=n.length,{start:s=0,end:o=i-1}=e,{start:a,end:r}=t,l=Math.max(s,a),h=Math.min(o,r),c=sr&&o>r;return{count:i,start:l,loop:t.loop,ilen:h(a+(h?r-y:y))%o,v=()=>{p!==b&&(n.lineTo(c,b),n.lineTo(c,p),n.lineTo(c,m))};for(l&&(f=s[x(0)],n.moveTo(f.x,f.y)),u=0;u<=r;++u){if(f=s[x(u)],f.skip)continue;let y=f.x,_=f.y,M=y|0;M===g?(_b&&(b=_),c=(d*c+y)/++d):(v(),n.lineTo(y,_),g=M,d=0,p=b=_),m=_}v()}function si(n){let t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Da:wa}function Pa(n){return n.stepped?An:n.tension||n.cubicInterpolationMode==="monotone"?Cn:On}function Aa(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Js(n,t.options),n.stroke(s)}function Ca(n,t,e,i){let{segments:s,options:o}=t,a=si(t);for(let r of s)Js(n,o,r.style),n.beginPath(),a(n,t,r,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}var Oa=typeof Path2D=="function";function La(n,t,e,i){Oa&&!t.options.segment?Aa(n,t,e,i):Ca(n,t,e,i)}var Tt=class extends it{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let s=i.spanGaps?this._loop:this._fullLoop;Dn(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Pn(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,s=t[e],o=this.points,a=Fs(this,{property:e,start:s,end:s});if(!a.length)return;let r=[],l=Pa(i),h,c;for(h=0,c=a.length;hn.replace("rgb(","rgba(").replace(")",", 0.5)"));function tn(n){return ai[n%ai.length]}function en(n){return ns[n%ns.length]}function Va(n,t){return n.borderColor=tn(t),n.backgroundColor=en(t),++t}function Ba(n,t){return n.backgroundColor=n.data.map(()=>tn(t++)),t}function Na(n,t){return n.backgroundColor=n.data.map(()=>en(t++)),t}function Wa(n){let t=0;return(e,i)=>{let s=n.getDatasetMeta(i).controller;s instanceof Kt?t=Ba(e,t):s instanceof fe?t=Na(e,t):s&&(t=Va(e,t))}}function os(n){let t;for(t in n)if(n[t].borderColor||n[t].backgroundColor)return!0;return!1}function Ha(n){return n&&(n.borderColor||n.backgroundColor)}function ja(){return I.borderColor!=="rgba(0,0,0,0.1)"||I.backgroundColor!=="rgba(0,0,0,0.1)"}var $a={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(n,t,e){if(!e.enabled)return;let{data:{datasets:i},options:s}=n.config,{elements:o}=s,a=os(i)||Ha(s)||o&&os(o)||ja();if(!e.forceOverride&&a)return;let r=Wa(n);i.forEach(r)}};function Ya(n,t,e,i,s){let o=s.samples||i;if(o>=e)return n.slice(t,t+e);let a=[],r=(e-2)/(o-2),l=0,h=t+e-1,c=t,d,u,f,g,p;for(a[l++]=n[c],d=0;df&&(f=g,u=n[x],p=x);a[l++]=u,c=p}return a[l++]=n[h],a}function Ua(n,t,e,i){let s=0,o=0,a,r,l,h,c,d,u,f,g,p,b=[],m=t+e-1,x=n[t].x,y=n[m].x-x;for(a=t;ap&&(p=h,u=a),s=(o*s+r.x)/++o;else{let M=a-1;if(!O(d)&&!O(u)){let k=Math.min(d,u),S=Math.max(d,u);k!==f&&k!==M&&b.push({...n[k],x:s}),S!==f&&S!==M&&b.push({...n[S],x:s})}a>0&&M!==f&&b.push(n[M]),b.push(r),c=_,o=0,g=p=h,d=u=f=a}}return b}function sn(n){if(n._decimated){let t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function as(n){n.data.datasets.forEach(t=>{sn(t)})}function Xa(n,t){let e=t.length,i=0,s,{iScale:o}=n,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(i=X(Ut(t,o.axis,a).lo,0,e-1)),h?s=X(Ut(t,o.axis,r).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var Ka={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){as(n);return}let i=n.width;n.data.datasets.forEach((s,o)=>{let{_data:a,indexAxis:r}=s,l=n.getDatasetMeta(o),h=a||s.data;if(Wt([r,n.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let c=n.scales[l.xAxisID];if(c.type!=="linear"&&c.type!=="time"||n.options.parsing)return;let{start:d,count:u}=Xa(l,h),f=e.threshold||4*i;if(u<=f){sn(s);return}O(a)&&(s._data=h,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=Ya(h,d,u,i,e);break;case"min-max":g=Ua(h,d,u,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=g})},destroy(n){as(n)}};function Ga(n,t,e){let i=n.segments,s=n.points,o=t.points,a=[];for(let r of i){let{start:l,end:h}=r;h=Se(l,h,s);let c=ri(e,s[l],s[h],r.loop);if(!t.segments){a.push({source:r,target:c,start:s[l],end:s[h]});continue}let d=Fs(t,c);for(let u of d){let f=ri(e,o[u.start],o[u.end],u.loop),g=Rn(r,s,f);for(let p of g)a.push({source:p,target:u,start:{[e]:rs(c,f,"start",Math.max)},end:{[e]:rs(c,f,"end",Math.min)}})}}return a}function ri(n,t,e,i){if(i)return;let s=t[n],o=e[n];return n==="angle"&&(s=ut(s),o=ut(o)),{property:n,start:s,end:o}}function qa(n,t){let{x:e=null,y:i=null}=n||{},s=t.points,o=[];return t.segments.forEach(({start:a,end:r})=>{r=Se(a,r,s);let l=s[a],h=s[r];i!==null?(o.push({x:l.x,y:i}),o.push({x:h.x,y:i})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:h.y}))}),o}function Se(n,t,e){for(;t>n;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function rs(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function nn(n,t){let e=[],i=!1;return G(n)?(i=!0,e=n):e=qa(n,t),e.length?new Tt({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function ls(n){return n&&n.fill!==!1}function Ja(n,t,e){let s=n[t].fill,o=[t],a;if(!e)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!V(s))return s;if(a=n[s],!a)return!1;if(a.visible)return s;o.push(s),s=a.fill}return!1}function Za(n,t,e){let i=ir(n);if(z(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return V(s)&&Math.floor(s)===s?Qa(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function Qa(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function tr(n,t){let e=null;return n==="start"?e=t.bottom:n==="end"?e=t.top:z(n)?e=t.getPixelForValue(n.value):t.getBasePixel&&(e=t.getBasePixel()),e}function er(n,t,e){let i;return n==="start"?i=e:n==="end"?i=t.options.reverse?t.min:t.max:z(n)?i=n.value:i=t.getBaseValue(),i}function ir(n){let t=n.options,e=t.fill,i=A(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function sr(n){let{scale:t,index:e,line:i}=n,s=[],o=i.segments,a=i.points,r=nr(t,e);r.push(nn({x:null,y:t.bottom},i));for(let l=0;l=0;--a){let r=s[a].$filler;r&&(r.line.updateControlPoints(o,r.axis),i&&r.fill&&ze(n.ctx,r,o))}},beforeDatasetsDraw(n,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=n.getSortedVisibleDatasetMetas();for(let s=i.length-1;s>=0;--s){let o=i[s].$filler;ls(o)&&ze(n.ctx,o,n.chartArea)}},beforeDatasetDraw(n,t,e){let i=t.meta.$filler;!ls(i)||e.drawTime!=="beforeDatasetDraw"||ze(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},us=(n,t)=>{let{boxHeight:e=t,boxWidth:i=t}=n;return n.usePointStyle&&(e=Math.min(e,t),i=n.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},pr=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index,xe=class extends it{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=E(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,s)=>t.sort(i,s,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,s=B(i.font),o=s.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=us(i,o),h,c;e.font=s.string,this.isHorizontal()?(h=this.maxWidth,c=this._fitRows(a,o,r,l)+10):(c=this.maxHeight,h=this._fitCols(a,s,r,l)+10),this.width=Math.min(h,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){let{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],h=this.lineWidths=[0],c=s+r,d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-c;return this.legendItems.forEach((g,p)=>{let b=i+e/2+o.measureText(g.text).width;(p===0||h[h.length-1]+b+2*r>a)&&(d+=c,h[h.length-(p>0?0:1)]=0,f+=c,u++),l[p]={left:0,top:f,row:u,width:b,height:s},h[h.length-1]+=b+r}),d}_fitCols(t,e,i,s){let{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],h=this.columnSizes=[],c=a-t,d=r,u=0,f=0,g=0,p=0;return this.legendItems.forEach((b,m)=>{let{itemWidth:x,itemHeight:v}=mr(i,e,o,b,s);m>0&&f+v+2*r>c&&(d+=u+r,h.push({width:u,height:f}),g+=u+r,p++,u=f=0),l[m]={left:g,top:f,col:p,width:x,height:v},u=Math.max(u,x),f+=v+r}),d+=u,h.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,a=At(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=H(i,this.left+s,this.right-this.lineWidths[r]);for(let h of e)r!==h.row&&(r=h.row,l=H(i,this.left+s,this.right-this.lineWidths[r])),h.top+=this.top+t+s,h.left=a.leftForLtr(a.x(l),h.width),l+=h.width+s}else{let r=0,l=H(i,this.top+t+s,this.bottom-this.columnSizes[r].height);for(let h of e)h.col!==r&&(r=h.col,l=H(i,this.top+t+s,this.bottom-this.columnSizes[r].height)),h.top=l,h.left+=this.left+s,h.left=a.leftForLtr(a.x(h.left),h.width),l+=h.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;ve(t,this),this._draw(),Me(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:o,labels:a}=t,r=I.color,l=At(t.rtl,this.left,this.width),h=B(a.font),{padding:c}=a,d=h.size,u=d/2,f;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=h.string;let{boxWidth:g,boxHeight:p,itemHeight:b}=us(a,d),m=function(M,k,S){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();let w=A(S.lineWidth,1);if(s.fillStyle=A(S.fillStyle,r),s.lineCap=A(S.lineCap,"butt"),s.lineDashOffset=A(S.lineDashOffset,0),s.lineJoin=A(S.lineJoin,"miter"),s.lineWidth=w,s.strokeStyle=A(S.strokeStyle,r),s.setLineDash(A(S.lineDash,[])),a.usePointStyle){let D={radius:p*Math.SQRT2/2,pointStyle:S.pointStyle,rotation:S.rotation,borderWidth:w},P=l.xPlus(M,g/2),C=k+u;zn(s,D,P,C,a.pointStyleWidth&&g)}else{let D=k+Math.max((d-p)/2,0),P=l.leftForLtr(M,g),C=yt(S.borderRadius);s.beginPath(),Object.values(C).some(N=>N!==0)?Xt(s,{x:P,y:D,w:g,h:p,radius:C}):s.rect(P,D,g,p),s.fill(),w!==0&&s.stroke()}s.restore()},x=function(M,k,S){vt(s,S.text,M,k+b/2,h,{strikethrough:S.hidden,textAlign:l.textAlign(S.textAlign)})},v=this.isHorizontal(),y=this._computeTitleHeight();v?f={x:H(o,this.left+c,this.right-i[0]),y:this.top+c+y,line:0}:f={x:this.left+c,y:H(o,this.top+y+c,this.bottom-e[0].height),line:0},Vs(this.ctx,t.textDirection);let _=b+c;this.legendItems.forEach((M,k)=>{s.strokeStyle=M.fontColor,s.fillStyle=M.fontColor;let S=s.measureText(M.text).width,w=l.textAlign(M.textAlign||(M.textAlign=a.textAlign)),D=g+u+S,P=f.x,C=f.y;l.setWidth(this.width),v?k>0&&P+D+c>this.right&&(C=f.y+=_,f.line++,P=f.x=H(o,this.left+c,this.right-i[f.line])):k>0&&C+_>this.bottom&&(P=f.x=P+e[f.line].width+c,f.line++,C=f.y=H(o,this.top+y+c,this.bottom-e[f.line].height));let N=l.x(P);if(m(N,C,M),P=In(w,P+g+u,v?P+D:this.right,t.rtl),x(l.x(P),C,M),v)f.x+=D+c;else if(typeof M.text!="string"){let J=h.lineHeight;f.y+=on(M,J)+c}else f.y+=_}),Bs(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=B(e.font),s=Y(e.padding);if(!e.display)return;let o=At(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=i.size/2,h=s.top+l,c,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),c=this.top+h,d=H(t.align,d,this.right-u);else{let g=this.columnSizes.reduce((p,b)=>Math.max(p,b.height),0);c=h+H(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}let f=H(r,d,d+u);a.textAlign=o.textAlign(pi(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,vt(a,e.text,f,c,i)}_computeTitleHeight(){let t=this.options.title,e=B(t.font),i=Y(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,o;if(ht(t,this.left,this.right)&&ht(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;io.length>a.length?o:a)),t+e.size/2+i.measureText(s).width}function xr(n,t,e){let i=n;return typeof t.text!="string"&&(i=on(t,e)),i}function on(n,t){let e=n.text?n.text.length:0;return t*e}function _r(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var yr={id:"legend",_element:xe,start(n,t,e){let i=n.legend=new xe({ctx:n.ctx,options:e,chart:n});$.configure(n,i,e),$.addBox(n,i)},stop(n){$.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){let i=n.legend;$.configure(n,i,e),i.options=e},afterUpdate(n){let t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){let i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){let t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:o,useBorderRadius:a,borderRadius:r}}=n.legend.options;return n._getSortedDatasetMetas().map(l=>{let h=l.controller.getStyle(e?0:void 0),c=Y(h.borderWidth);return{text:t[l.index].label,fillStyle:h.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:h.borderCapStyle,lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:h.borderColor,pointStyle:i||h.pointStyle,rotation:h.rotation,textAlign:s||h.textAlign,borderRadius:a&&(r||h.borderRadius),datasetIndex:l.index}},this)}},title:{color:n=>n.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:n=>!n.startsWith("on"),labels:{_scriptable:n=>!["generateLabels","filter","sort"].includes(n)}}},qt=class extends it{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let s=G(i.text)?i.text.length:1;this._padding=Y(i.padding);let o=s*B(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:i,bottom:s,right:o,options:a}=this,r=a.align,l=0,h,c,d;return this.isHorizontal()?(c=H(r,i,o),d=e+t,h=o-i):(a.position==="left"?(c=i+t,d=H(r,s,e),l=j*-.5):(c=o-t,d=H(r,e,s),l=j*.5),h=s-e),{titleX:c,titleY:d,maxWidth:h,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=B(e.font),o=i.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:h}=this._drawArgs(o);vt(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:h,textAlign:pi(e.align),textBaseline:"middle",translation:[a,r]})}};function vr(n,t){let e=new qt({ctx:n.ctx,options:t,chart:n});$.configure(n,e,t),$.addBox(n,e),n.titleBlock=e}var Mr={id:"title",_element:qt,start(n,t,e){vr(n,e)},stop(n){let t=n.titleBlock;$.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){let i=n.titleBlock;$.configure(n,i,e),i.options=e},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}},ne=new WeakMap,kr={id:"subtitle",start(n,t,e){let i=new qt({ctx:n.ctx,options:e,chart:n});$.configure(n,i,e),$.addBox(n,i),ne.set(n,i)},stop(n){$.removeBox(n,ne.get(n)),ne.delete(n)},beforeUpdate(n,t,e){let i=ne.get(n);$.configure(n,i,e),i.options=e},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}},$t={average(n){if(!n.length)return!1;let t,e,i=new Set,s=0,o=0;for(t=0,e=n.length;tr+l)/i.size,y:s/o}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,o,a,r;for(o=0,a=n.length;o-1?n.split(` `):n}function Sr(n,t){let{element:e,datasetIndex:i,index:s}=t,o=n.getDatasetMeta(i).controller,{label:a,value:r}=o.getLabelAndValue(s);return{chart:n,label:a,parsed:o.getParsed(s),raw:n.data.datasets[i].data[s],formattedValue:r,dataset:o.getDataset(),dataIndex:s,datasetIndex:i,element:e}}function fs(n,t){let e=n.chart.ctx,{body:i,footer:s,title:o}=n,{boxWidth:a,boxHeight:r}=t,l=B(t.bodyFont),h=B(t.titleFont),c=B(t.footerFont),d=o.length,u=s.length,f=i.length,g=Y(t.padding),p=g.height,b=0,m=i.reduce((y,_)=>y+_.before.length+_.lines.length+_.after.length,0);if(m+=n.beforeBody.length+n.afterBody.length,d&&(p+=d*h.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),m){let y=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;p+=f*y+(m-f)*l.lineHeight+(m-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*c.lineHeight+(u-1)*t.footerSpacing);let x=0,v=function(y){b=Math.max(b,e.measureText(y).width+x)};return e.save(),e.font=h.string,L(n.title,v),e.font=l.string,L(n.beforeBody.concat(n.afterBody),v),x=t.displayColors?a+2+t.boxPadding:0,L(i,y=>{L(y.before,v),L(y.lines,v),L(y.after,v)}),x=0,e.font=c.string,L(n.footer,v),e.restore(),b+=g.width,{width:b,height:p}}function wr(n,t){let{y:e,height:i}=t;return en.height-i/2?"bottom":"center"}function Dr(n,t,e,i){let{x:s,width:o}=i,a=e.caretSize+e.caretPadding;if(n==="left"&&s+o+a>t.width||n==="right"&&s-o-a<0)return!0}function Pr(n,t,e,i){let{x:s,width:o}=e,{width:a,chartArea:{left:r,right:l}}=n,h="center";return i==="center"?h=s<=(r+l)/2?"left":"right":s<=o/2?h="left":s>=a-o/2&&(h="right"),Dr(h,n,t,e)&&(h="center"),h}function gs(n,t,e){let i=e.yAlign||t.yAlign||wr(n,e);return{xAlign:e.xAlign||t.xAlign||Pr(n,t,e,i),yAlign:i}}function Ar(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Cr(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function ps(n,t,e,i){let{caretSize:s,caretPadding:o,cornerRadius:a}=n,{xAlign:r,yAlign:l}=e,h=s+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=yt(a),g=Ar(t,r),p=Cr(t,l,h);return l==="center"?r==="left"?g+=h:r==="right"&&(g-=h):r==="left"?g-=Math.max(c,u)+s:r==="right"&&(g+=Math.max(d,f)+s),{x:X(g,0,i.width-t.width),y:X(p,0,i.height-t.height)}}function oe(n,t,e){let i=Y(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function ms(n){return st([],lt(n))}function Or(n,t,e){return kt(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function bs(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}var an={beforeTitle:at,title(n){if(n.length>0){let t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?an[t].call(e,i):s}var _e=class extends it{static positioners=$t;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 e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,o=new ue(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Or(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,s=K(i,"beforeTitle",this,t),o=K(i,"title",this,t),a=K(i,"afterTitle",this,t),r=[];return r=st(r,lt(s)),r=st(r,lt(o)),r=st(r,lt(a)),r}getBeforeBody(t,e){return ms(K(e.callbacks,"beforeBody",this,t))}getBody(t,e){let{callbacks:i}=e,s=[];return L(t,o=>{let a={before:[],lines:[],after:[]},r=bs(i,o);st(a.before,lt(K(r,"beforeLabel",this,o))),st(a.lines,K(r,"label",this,o)),st(a.after,lt(K(r,"afterLabel",this,o))),s.push(a)}),s}getAfterBody(t,e){return ms(K(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,s=K(i,"beforeFooter",this,t),o=K(i,"footer",this,t),a=K(i,"afterFooter",this,t),r=[];return r=st(r,lt(s)),r=st(r,lt(o)),r=st(r,lt(a)),r}_createItems(t){let e=this._active,i=this.chart.data,s=[],o=[],a=[],r=[],l,h;for(l=0,h=e.length;lt.filter(c,d,u,i))),t.itemSort&&(r=r.sort((c,d)=>t.itemSort(c,d,i))),L(r,c=>{let d=bs(t.callbacks,c);s.push(K(d,"labelColor",this,c)),o.push(K(d,"labelPointStyle",this,c)),a.push(K(d,"labelTextColor",this,c))}),this.labelColors=s,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){let i=this.options.setContext(this.getContext()),s=this._active,o,a=[];if(!s.length)this.opacity!==0&&(o={opacity:0});else{let r=$t[i.position].call(this,s,this._eventPosition);a=this._createItems(i),this.title=this.getTitle(a,i),this.beforeBody=this.getBeforeBody(a,i),this.body=this.getBody(a,i),this.afterBody=this.getAfterBody(a,i),this.footer=this.getFooter(a,i);let l=this._size=fs(this,i),h=Object.assign({},r,l),c=gs(this.chart,i,h),d=ps(i,h,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){let o=this.getCaretPosition(t,i,s);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:s,yAlign:o}=this,{caretSize:a,cornerRadius:r}=i,{topLeft:l,topRight:h,bottomLeft:c,bottomRight:d}=yt(r),{x:u,y:f}=t,{width:g,height:p}=e,b,m,x,v,y,_;return o==="center"?(y=f+p/2,s==="left"?(b=u,m=b-a,v=y+a,_=y-a):(b=u+g,m=b+a,v=y-a,_=y+a),x=b):(s==="left"?m=u+Math.max(l,c)+a:s==="right"?m=u+g-Math.max(h,d)-a:m=this.caretX,o==="top"?(v=f,y=v-a,b=m-a,x=m+a):(v=f+p,y=v+a,b=m+a,x=m-a),_=v),{x1:b,x2:m,x3:x,y1:v,y2:y,y3:_}}drawTitle(t,e,i){let s=this.title,o=s.length,a,r,l;if(o){let h=At(i.rtl,this.x,this.width);for(t.x=oe(this,i.titleAlign,i),e.textAlign=h.textAlign(i.titleAlign),e.textBaseline="middle",a=B(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;lx!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Xt(t,{x:p,y:g,w:h,h:l,radius:m}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Xt(t,{x:b,y:g+1,w:h-2,h:l-2,radius:m}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,h,l),t.strokeRect(p,g,h,l),t.fillStyle=a.backgroundColor,t.fillRect(b,g+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:s}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:h,boxPadding:c}=i,d=B(i.bodyFont),u=d.lineHeight,f=0,g=At(i.rtl,this.x,this.width),p=function(S){e.fillText(S,g.x(t.x+f),t.y+u/2),t.y+=u+o},b=g.textAlign(a),m,x,v,y,_,M,k;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=oe(this,b,i),e.fillStyle=i.bodyColor,L(this.beforeBody,p),f=r&&b!=="right"?a==="center"?h/2+c:h+2+c:0,y=0,M=s.length;y0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,o=i&&i.y;if(s||o){let a=$t[t.position].call(this,this._active,this._eventPosition);if(!a)return;let r=this._size=fs(this,t),l=Object.assign({},a,this._size),h=gs(e,t,l),c=ps(t,l,h,e);(s._to!==c.x||o._to!==c.y)&&(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let s={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let a=Y(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,s,e),Vs(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Bs(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,s=t.map(({datasetIndex:r,index:l})=>{let h=this.chart.getDatasetMeta(r);if(!h)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:h.data[l],index:l}}),o=!de(i,s),a=this._positionChanged(s,e);(o||a)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let s=this.options,o=this._active||[],a=this._getActiveElements(t,o,e,i),r=this._positionChanged(a,t),l=e||!de(a,o)||r;return l&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,i,s){let o=this.options;if(t.type==="mouseout")return[];if(!s)return e.filter(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&a.reverse(),a}_positionChanged(t,e){let{caretX:i,caretY:s,options:o}=this,a=$t[o.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}},Lr={id:"tooltip",_element:_e,positioners:$t,afterInit(n,t,e){e&&(n.tooltip=new _e({chart:n,options:e}))},beforeUpdate(n,t,e){n.tooltip&&n.tooltip.initialize(e)},reset(n,t,e){n.tooltip&&n.tooltip.initialize(e)},afterDraw(n){let t=n.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(n.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(n.ctx),n.notifyPlugins("afterTooltipDraw",e)}},afterEvent(n,t){if(n.tooltip){let e=t.replay;n.tooltip.handleEvent(t.event,e,t.inChartArea)&&(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:(n,t)=>t.bodyFont.size,boxWidth:(n,t)=>t.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:an},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Tr=Object.freeze({__proto__:null,Colors:$a,Decimation:Ka,Filler:gr,Legend:yr,SubTitle:kr,Title:Mr,Tooltip:Lr}),Er=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Rr(n,t,e,i){let s=n.indexOf(t);if(s===-1)return Er(n,t,e,i);let o=n.lastIndexOf(t);return s!==o?e:s}var Ir=(n,t)=>n===null?null:X(Math.round(n),0,t);function xs(n){let t=this.getLabels();return n>=0&&ne.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};function zr(n,t){let e=[],{bounds:s,step:o,min:a,max:r,precision:l,count:h,maxTicks:c,maxDigits:d,includeBounds:u}=n,f=o||1,g=c-1,{min:p,max:b}=t,m=!O(a),x=!O(r),v=!O(h),y=(b-p)/(d+1),_=Pi((b-p)/g/f)*f,M,k,S,w;if(_<1e-14&&!m&&!x)return[{value:p},{value:b}];w=Math.ceil(b/_)-Math.floor(p/_),w>g&&(_=Pi(w*_/g/f)*f),O(l)||(M=Math.pow(10,l),_=Math.ceil(_*M)/M),s==="ticks"?(k=Math.floor(p/_)*_,S=Math.ceil(b/_)*_):(k=p,S=b),m&&x&&o&&Vn((r-a)/o,_/1e3)?(w=Math.round(Math.min((r-a)/_,c)),_=(r-a)/w,k=a,S=r):v?(k=m?a:k,S=x?r:S,w=h-1,_=(S-k)/w):(w=(S-k)/_,De(w,Math.round(w),_/1e3)?w=Math.round(w):w=Math.ceil(w));let D=Math.max(Ai(_),Ai(k));M=Math.pow(10,O(l)?D:l),k=Math.round(k*M)/M,S=Math.round(S*M)/M;let P=0;for(m&&(u&&k!==a?(e.push({value:a}),kr)break;e.push({value:C})}return x&&u&&S!==r?e.length&&De(e[e.length-1].value,r,_s(r,y,n))?e[e.length-1].value=r:e.push({value:r}):(!x||S===r)&&e.push({value:S}),e}function _s(n,t,{horizontal:e,minRotation:i}){let s=et(i),o=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/o,a)}var Et=class extends Mt{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return O(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:s,max:o}=this,a=l=>s=e?s:l,r=l=>o=i?o:l;if(t){let l=dt(s),h=dt(o);l<0&&h<0?r(0):l>0&&h>0&&a(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(s-l)}this.min=s,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,s;return i?(s=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),e=e||11),e&&(s=Math.min(e,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let s={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,a=zr(s,o);return t.bounds==="ticks"&&Ns(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ye(t,this.chart.options.locale,this.options.ticks.format)}},hi=class extends Et{static id="linear";static defaults={ticks:{callback:mi.formatters.numeric}};determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=et(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/s))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},Jt=n=>Math.floor(Ht(n)),bt=(n,t)=>Math.pow(10,Jt(n)+t);function ys(n){return n/Math.pow(10,Jt(n))===1}function vs(n,t,e){let i=Math.pow(10,e),s=Math.floor(n/i);return Math.ceil(t/i)-s}function Fr(n,t){let e=t-n,i=Jt(e);for(;vs(n,t,i)>10;)i++;for(;vs(n,t,i)<10;)i--;return Math.min(i,Jt(n))}function Vr(n,{min:t,max:e}){t=Z(n.min,t);let i=[],s=Jt(t),o=Fr(t,e),a=o<0?Math.pow(10,Math.abs(o)):1,r=Math.pow(10,o),l=s>o?Math.pow(10,s):0,h=Math.round((t-l)*a)/a,c=Math.floor((t-l)/r/10)*r*10,d=Math.floor((h-c)/Math.pow(10,o)),u=Z(n.min,Math.round((l+c+d*Math.pow(10,o))*a)/a);for(;u=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,a=o>=0?1:a),u=Math.round((l+c+d*Math.pow(10,o))*a)/a;let f=Z(n.max,u);return i.push({value:f,major:ys(f),significand:d}),i}var ci=class extends Mt{static id="logarithmic";static defaults={ticks:{callback:mi.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=Et.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return V(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?Math.max(0,t):null,this.max=V(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!V(this._userMin)&&(this.min=t===bt(this.min,0)?bt(this.min,-1):bt(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,s=this.max,o=r=>i=t?i:r,a=r=>s=e?s:r;i===s&&(i<=0?(o(1),a(10)):(o(bt(i,-1)),a(bt(s,1)))),i<=0&&o(bt(s,-1)),s<=0&&a(bt(i,1)),this.min=i,this.max=s}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=Vr(e,this);return t.bounds==="ticks"&&Ns(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":ye(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=Ht(t),this._valueRange=Ht(this.max)-Ht(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ht(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};function di(n){let t=n.ticks;if(t.display&&n.display){let e=Y(t.backdropPadding);return A(t.font&&t.font.size,I.font.size)+e.height}return 0}function Br(n,t,e){return e=G(e)?e:[e],{w:Bn(n,t.string,e),h:e.length*t.lineHeight}}function Ms(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:ns?{start:t-e,end:t}:{start:t,end:t+e}}function Nr(n){let t={l:n.left+n._padding.left,r:n.right-n._padding.right,t:n.top+n._padding.top,b:n.bottom-n._padding.bottom},e=Object.assign({},t),i=[],s=[],o=n._pointLabels.length,a=n.options.pointLabels,r=a.centerPointLabels?j/o:0;for(let l=0;lt.r&&(r=(i.end-t.r)/o,n.r=Math.max(n.r,t.r+r)),s.startt.b&&(l=(s.end-t.b)/a,n.b=Math.max(n.b,t.b+l))}function Hr(n,t,e){let i=n.drawingArea,{extra:s,additionalAngle:o,padding:a,size:r}=e,l=n.getPointPosition(t,i+s+a,o),h=Math.round(gi(ut(l.angle+Q))),c=Xr(l.y,r.h,h),d=Yr(h),u=Ur(l.x,r.w,d);return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+r.w,bottom:c+r.h}}function jr(n,t){if(!t)return!0;let{left:e,top:i,right:s,bottom:o}=n;return!(_t({x:e,y:i},t)||_t({x:e,y:o},t)||_t({x:s,y:i},t)||_t({x:s,y:o},t))}function $r(n,t,e){let i=[],s=n._pointLabels.length,o=n.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:di(o)/2,additionalAngle:a?j/s:0},h;for(let c=0;c270||e<90)&&(n-=t),n}function Kr(n,t,e){let{left:i,top:s,right:o,bottom:a}=e,{backdropColor:r}=t;if(!O(r)){let l=yt(t.borderRadius),h=Y(t.backdropPadding);n.fillStyle=r;let c=i-h.left,d=s-h.top,u=o-i+h.width,f=a-s+h.height;Object.values(l).some(g=>g!==0)?(n.beginPath(),Xt(n,{x:c,y:d,w:u,h:f,radius:l}),n.fill()):n.fillRect(c,d,u,f)}}function Gr(n,t){let{ctx:e,options:{pointLabels:i}}=n;for(let s=t-1;s>=0;s--){let o=n._pointLabelItems[s];if(!o.visible)continue;let a=i.setContext(n.getPointLabelContext(s));Kr(e,a,o);let r=B(a.font),{x:l,y:h,textAlign:c}=o;vt(e,n._pointLabels[s],l,h+r.lineHeight/2,r,{color:a.color,textAlign:c,textBaseline:"middle"})}}function rn(n,t,e,i){let{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,U);else{let o=n.getPointPosition(0,t);s.moveTo(o.x,o.y);for(let a=1;a{let s=E(this.options.pointLabels.callback,[e,i],this);return s||s===0?s:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?Nr(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){let e=U/(this._pointLabels.length||1),i=this.options.startAngle||0;return ut(t*e+et(i))}getDistanceFromCenterForValue(t){if(O(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(O(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t{if(d!==0||d===0&&this.min<0){l=this.getDistanceFromCenterForValue(c.value);let u=this.getContext(d),f=s.setContext(u),g=o.setContext(u);qr(this,f,l,a,g)}}),i.display){for(t.save(),r=a-1;r>=0;r--){let c=i.setContext(this.getPointLabelContext(r)),{color:d,lineWidth:u}=c;!u||!d||(t.lineWidth=u,t.strokeStyle=d,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),h=this.getPointPosition(r,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(h.x,h.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let s=this.getIndexAngle(0),o,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((r,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let h=i.setContext(this.getContext(l)),c=B(h.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),h.showLabelBackdrop){t.font=c.string,a=t.measureText(r.label).width,t.fillStyle=h.backdropColor;let d=Y(h.backdropPadding);t.fillRect(-a/2-d.left,-o-c.size/2-d.top,a+d.width,c.size+d.height)}vt(t,r.label,0,-o,c,{color:h.color,strokeColor:h.textStrokeColor,strokeWidth:h.textStrokeWidth})}),t.restore()}drawTitle(){}},we={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}},q=Object.keys(we);function ks(n,t){return n-t}function Ss(n,t){if(O(t))return null;let e=n._adapter,{parser:i,round:s,isoWeekday:o}=n._parseOpts,a=t;return typeof i=="function"&&(a=i(a)),V(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(Ot(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,s)),+a)}function ws(n,t,e,i){let s=q.length;for(let o=q.indexOf(n);o=q.indexOf(e);o--){let a=q[o];if(we[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return q[e?q.indexOf(e):0]}function Qr(n){for(let t=q.indexOf(n)+1,e=q.length;t=t?e[i]:e[s];n[o]=!0}}function tl(n,t,e,i){let s=n._adapter,o=+s.startOf(t[0].value,i),a=t[t.length-1].value,r,l;for(r=o;r<=a;r=+s.add(r,1,i))l=e[r],l>=0&&(t[l].major=!0);return t}function Ps(n,t,e){let i=[],s={},o=t.length,a,r;for(a=0;a+t.value))}initOffsets(t=[]){let e=0,i=0,s,o;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=X(e,0,a),i=X(i,0,a),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,s=this.options,o=s.time,a=o.unit||ws(o.minUnit,e,i,this._getLabelCapacity(e)),r=A(s.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,h=Ot(l)||l===!0,c={},d=e,u,f;if(h&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,h?"day":a),t.diff(i,e,a)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+a);let g=s.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u+p)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let s=this.options.time.displayFormats,o=this._unit,a=e||s[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,i,s){let o=this.options,a=o.ticks.callback;if(a)return E(a,[t,e,i],this);let r=o.time.displayFormats,l=this._unit,h=this._majorUnit,c=l&&r[l],d=h&&r[h],u=i[e],f=h&&d&&u&&u.major;return this._adapter.format(t,s||(f?d:c))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?r:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Ut(n,"pos",t)),{pos:o,time:r}=n[i],{pos:a,time:l}=n[s]):(t>=n[i].time&&t<=n[s].time&&({lo:i,hi:s}=Ut(n,"time",t)),{time:o,pos:r}=n[i],{time:a,pos:l}=n[s]);let h=a-o;return h?r+(l-r)*(t-o)/h:r}var fi=class extends Zt{static id="timeseries";static defaults=Zt.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=ae(e,this.min),this._tableRange=ae(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,s=[],o=[],a,r,l,h,c;for(a=0,r=t.length;a=e&&h<=i&&s.push(h);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,r=s.length;as-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(ae(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return ae(this._table,i*this._tableRange+this._minPos,!0)}},el=Object.freeze({__proto__:null,CategoryScale:li,LinearScale:hi,LogarithmicScale:ci,RadialLinearScale:ui,TimeScale:Zt,TimeSeriesScale:fi}),nl=[uo,Fa,Tr,el];export{Ne as Animation,ue as Animations,ii as ArcElement,We as BarController,oi as BarElement,ge as BasePlatform,Ke as BasicPlatform,He as BubbleController,li as CategoryScale,ei as Chart,$a as Colors,ot as DatasetController,Ka as Decimation,Ge as DomPlatform,Kt as DoughnutController,it as Element,gr as Filler,xo as Interaction,yr as Legend,je as LineController,Tt as LineElement,hi as LinearScale,ci as LogarithmicScale,$e as PieController,ni as PointElement,fe as PolarAreaController,Ye as RadarController,ui as RadialLinearScale,Mt as Scale,Ue as ScatterController,kr as SubTitle,mi as Ticks,Zt as TimeScale,fi as TimeSeriesScale,Mr as Title,Lr as Tooltip,fo as _adapters,Fo as _detectPlatform,rt as animator,uo as controllers,I as defaults,Fa as elements,$ as layouts,Tr as plugins,nl as registerables,nt as registry,el as scales}; /*! Bundled license information: chart.js/dist/chart.js: (*! * Chart.js v4.5.1 * https://www.chartjs.org * (c) 2025 Chart.js Contributors * Released under the MIT License *) */ //chart.mjs.map