@foodpilot/foods 0.3.79 → 0.3.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +8 -8
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -42739,8 +42739,8 @@ const aZ = sZ(Fo), lZ = /* @__PURE__ */ y.forwardRef(function(t, n) {
|
|
|
42739
42739
|
});
|
|
42740
42740
|
Yl.register(xi);
|
|
42741
42741
|
const Lie = (e) => {
|
|
42742
|
-
const { values: t, labels: n, colors: o, legend: r, children: i, valuesUnit: a, className: l, valuesFormatterFn: c } = e, [d, u] = Ge(null), [f, h] = Ge(!1), [g, m] = Ge(), [b, v] = Ge(null), [x, C] = Ge(null), S = (
|
|
42743
|
-
v(
|
|
42742
|
+
const { values: t, labels: n, colors: o, legend: r, children: i, valuesUnit: a, className: l, valuesFormatterFn: c } = e, [d, u] = Ge(null), [f, h] = Ge(!1), [g, m] = Ge(), [b, v] = Ge(null), [x, C] = Ge(null), S = (I, _) => {
|
|
42743
|
+
v(I), C(_);
|
|
42744
42744
|
};
|
|
42745
42745
|
jt(() => {
|
|
42746
42746
|
!n || !t || h(b !== null && x !== null);
|
|
@@ -42753,11 +42753,11 @@ const Lie = (e) => {
|
|
|
42753
42753
|
hoveredArcIndex: d,
|
|
42754
42754
|
setHoveredArcIndex: u,
|
|
42755
42755
|
handleChartHover: S
|
|
42756
|
-
});
|
|
42756
|
+
}), k = (I, _ = 35) => I.length <= _ ? I : I.substring(0, _ - 3) + "...";
|
|
42757
42757
|
jt(() => {
|
|
42758
42758
|
d !== null && n && n[d] !== void 0 && t && t[d] !== void 0 ? m(
|
|
42759
42759
|
/* @__PURE__ */ p.jsxs(te, { sx: { maxWidth: "250px" }, children: [
|
|
42760
|
-
/* @__PURE__ */ p.jsx(fe, { fontWeight: 700, fontSize: "0.75rem", children: n[d] }),
|
|
42760
|
+
/* @__PURE__ */ p.jsx(fe, { fontWeight: 700, fontSize: "0.75rem", children: r !== void 0 ? k(n[d]) : n[d] }),
|
|
42761
42761
|
/* @__PURE__ */ p.jsxs(fe, { fontWeight: 700, fontSize: "1.5rem", children: [
|
|
42762
42762
|
c ? c(t[d]) : t[d],
|
|
42763
42763
|
" ",
|
|
@@ -42766,7 +42766,7 @@ const Lie = (e) => {
|
|
|
42766
42766
|
] })
|
|
42767
42767
|
) : h(!1);
|
|
42768
42768
|
}, [a, d, n, t]);
|
|
42769
|
-
const
|
|
42769
|
+
const E = t == null ? void 0 : t.reduce((I, _) => I + _, 0);
|
|
42770
42770
|
return /* @__PURE__ */ p.jsx(
|
|
42771
42771
|
ye,
|
|
42772
42772
|
{
|
|
@@ -42774,7 +42774,7 @@ const Lie = (e) => {
|
|
|
42774
42774
|
direction: R === "bottom" ? "column" : "row",
|
|
42775
42775
|
gap: "3rem",
|
|
42776
42776
|
className: `doughnut-chart ${l}`,
|
|
42777
|
-
children: /* @__PURE__ */ p.jsx(u8, { variant: "popover", popupId: "demoPopover", disableAutoFocus: !0, children: (
|
|
42777
|
+
children: /* @__PURE__ */ p.jsx(u8, { variant: "popover", popupId: "demoPopover", disableAutoFocus: !0, children: (I) => /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
42778
42778
|
/* @__PURE__ */ p.jsx(
|
|
42779
42779
|
te,
|
|
42780
42780
|
{
|
|
@@ -42788,7 +42788,7 @@ const Lie = (e) => {
|
|
|
42788
42788
|
/* @__PURE__ */ p.jsx(
|
|
42789
42789
|
lZ,
|
|
42790
42790
|
{
|
|
42791
|
-
...rZ(
|
|
42791
|
+
...rZ(I),
|
|
42792
42792
|
open: f,
|
|
42793
42793
|
anchorEl: document.getElementById("doughnut-chart-wrapper"),
|
|
42794
42794
|
onClose: () => {
|
|
@@ -42832,7 +42832,7 @@ const Lie = (e) => {
|
|
|
42832
42832
|
},
|
|
42833
42833
|
className: "doughnut-chart-content",
|
|
42834
42834
|
children: /* @__PURE__ */ p.jsxs(te, { display: "flex", flexDirection: "column", children: [
|
|
42835
|
-
/* @__PURE__ */ p.jsx(te, { fontWeight: 700, fontSize: "3rem", children: i !== void 0 ? i :
|
|
42835
|
+
/* @__PURE__ */ p.jsx(te, { fontWeight: 700, fontSize: "3rem", children: i !== void 0 ? i : E }, "content-1"),
|
|
42836
42836
|
a && /* @__PURE__ */ p.jsx(te, { sx: { color: Re[1400] }, children: a })
|
|
42837
42837
|
] })
|
|
42838
42838
|
}
|
package/dist/main.umd.cjs
CHANGED
|
@@ -365,7 +365,7 @@ const theme2 = createTheme({ palette: {
|
|
|
365
365
|
* Released under the MIT License
|
|
366
366
|
*/class MF{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,o,r){const i=n.listeners[r],a=n.duration;i.forEach(l=>l({chart:t,initial:n.initial,numSteps:a,currentStep:Math.min(o-n.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=W6.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((o,r)=>{if(!o.running||!o.items.length)return;const i=o.items;let a=i.length-1,l=!1,c;for(;a>=0;--a)c=i[a],c._active?(c._total>o.duration&&(o.duration=c._total),c.tick(t),l=!0):(i[a]=i[i.length-1],i.pop());l&&(r.draw(),this._notify(r,o,t,"progress")),i.length||(o.running=!1,this._notify(r,o,t,"complete"),o.initial=!1),n+=i.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let o=n.get(t);return o||(o={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,o)),o}listen(t,n,o){this._getAnims(t).listeners[n].push(o)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((o,r)=>Math.max(o,r._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const o=n.items;let r=o.length-1;for(;r>=0;--r)o[r].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var vr=new MF;const y4="transparent",RF={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const o=K6(e||y4),r=o.valid&&K6(t||y4);return r&&r.valid?r.mix(o,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class OF{constructor(t,n,o,r){const i=n[o];r=Qt([t.to,r,i,t.from]);const a=Qt([t.from,i,r]);this._active=!0,this._fn=t.fn||RF[t.type||typeof a],this._easing=al[t.easing]||al.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=o,this._from=a,this._to=r,this._promises=void 0}active(){return this._active}update(t,n,o){if(this._active){this._notify(!1);const r=this._target[this._prop],i=o-this._start,a=this._duration-i;this._start=o,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=i,this._loop=!!t.loop,this._to=Qt([t.to,n,r,t.from]),this._from=Qt([t.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,o=this._duration,r=this._prop,i=this._from,a=this._loop,l=this._to;let c;if(this._active=i!==l&&(a||n<o),!this._active){this._target[r]=l,this._notify(!0);return}if(n<0){this._target[r]=i;return}c=n/o%2,c=a&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[r]=this._fn(i,l,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,o)=>{t.push({res:n,rej:o})})}_notify(t){const n=t?"res":"rej",o=this._promises||[];for(let r=0;r<o.length;r++)o[r][n]()}}class C4{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!St(t))return;const n=Object.keys(nn.animation),o=this._properties;Object.getOwnPropertyNames(t).forEach(r=>{const i=t[r];if(!St(i))return;const a={};for(const l of n)a[l]=i[l];(Yt(i.properties)&&i.properties||[r]).forEach(l=>{(l===r||!o.has(l))&&o.set(l,a)})})}_animateOptions(t,n){const o=n.options,r=kF(t,o);if(!r)return[];const i=this._createAnimations(r,o);return o.$shared&&EF(t.options.$animations,o).then(()=>{t.options=o},()=>{}),i}_createAnimations(t,n){const o=this._properties,r=[],i=t.$animations||(t.$animations={}),a=Object.keys(n),l=Date.now();let c;for(c=a.length-1;c>=0;--c){const d=a[c];if(d.charAt(0)==="$")continue;if(d==="options"){r.push(...this._animateOptions(t,n));continue}const u=n[d];let f=i[d];const h=o.get(d);if(f)if(h&&f.active()){f.update(h,u,l);continue}else f.cancel();if(!h||!h.duration){t[d]=u;continue}i[d]=f=new OF(h,t,d,u),r.push(f)}return r}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const o=this._createAnimations(t,n);if(o.length)return vr.add(this._chart,o),!0}}function EF(e,t){const n=[],o=Object.keys(t);for(let r=0;r<o.length;r++){const i=e[o[r]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function kF(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function w4(e,t){const n=e&&e.options||{},o=n.reverse,r=n.min===void 0?t:0,i=n.max===void 0?t:0;return{start:o?i:r,end:o?r:i}}function IF(e,t,n){if(n===!1)return!1;const o=w4(e,n),r=w4(t,n);return{top:r.end,right:o.end,bottom:r.start,left:o.start}}function jF(e){let t,n,o,r;return St(e)?(t=e.top,n=e.right,o=e.bottom,r=e.left):t=n=o=r=e,{top:t,right:n,bottom:o,left:r,disabled:e===!1}}function S4(e,t){const n=[],o=e._getSortedDatasetMetas(t);let r,i;for(r=0,i=o.length;r<i;++r)n.push(o[r].index);return n}function T4(e,t,n,o={}){const r=e.keys,i=o.mode==="single";let a,l,c,d;if(t!==null){for(a=0,l=r.length;a<l;++a){if(c=+r[a],c===n){if(o.all)continue;break}d=e.values[c],ln(d)&&(i||t===0||Qo(t)===Qo(d))&&(t+=d)}return t}}function _F(e,t){const{iScale:n,vScale:o}=t,r=n.axis==="x"?"x":"y",i=o.axis==="x"?"x":"y",a=Object.keys(e),l=new Array(a.length);let c,d,u;for(c=0,d=a.length;c<d;++c)u=a[c],l[c]={[r]:u,[i]:e[u]};return l}function P4(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function DF(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function LF(e){const{min:t,max:n,minDefined:o,maxDefined:r}=e.getUserBounds();return{min:o?t:Number.NEGATIVE_INFINITY,max:r?n:Number.POSITIVE_INFINITY}}function AF(e,t,n){const o=e[t]||(e[t]={});return o[n]||(o[n]={})}function M4(e,t,n,o){for(const r of t.getMatchingVisibleMetas(o).reverse()){const i=e[r.index];if(n&&i>0||!n&&i<0)return r.index}return null}function R4(e,t){const{chart:n,_cachedMeta:o}=e,r=n._stacks||(n._stacks={}),{iScale:i,vScale:a,index:l}=o,c=i.axis,d=a.axis,u=DF(i,a,o),f=t.length;let h;for(let g=0;g<f;++g){const m=t[g],{[c]:b,[d]:v}=m,x=m._stacks||(m._stacks={});h=x[d]=AF(r,u,b),h[l]=v,h._top=M4(h,a,!0,o.type),h._bottom=M4(h,a,!1,o.type);const C=h._visualValues||(h._visualValues={});C[l]=v}}function yf(e,t){const n=e.scales;return Object.keys(n).filter(o=>n[o].axis===t).shift()}function VF(e,t){return zr(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function FF(e,t,n){return zr(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function ul(e,t){const n=e.controller.index,o=e.vScale&&e.vScale.axis;if(o){t=t||e._parsed;for(const r of t){const i=r._stacks;if(!i||i[o]===void 0||i[o][n]===void 0)return;delete i[o][n],i[o]._visualValues!==void 0&&i[o]._visualValues[n]!==void 0&&delete i[o]._visualValues[n]}}}const Cf=e=>e==="reset"||e==="none",O4=(e,t)=>t?e:Object.assign({},e),$F=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:S4(n,!0),values:null};class jo{constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=P4(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&&ul(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,o=this.getDataset(),r=(f,h,g,m)=>f==="x"?h:f==="r"?m:g,i=n.xAxisID=ct(o.xAxisID,yf(t,"x")),a=n.yAxisID=ct(o.yAxisID,yf(t,"y")),l=n.rAxisID=ct(o.rAxisID,yf(t,"r")),c=n.indexAxis,d=n.iAxisID=r(c,i,a,l),u=n.vAxisID=r(c,a,i,l);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(l),n.iScale=this.getScaleForId(d),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&H6(this._data,this),t._stacked&&ul(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),o=this._data;if(St(n)){const r=this._cachedMeta;this._data=_F(n,r)}else if(o!==n){if(o){H6(o,this);const r=this._cachedMeta;ul(r),r._parsed=[]}n&&Object.isExtensible(n)&&TV(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,o=this.getDataset();let r=!1;this._dataCheck();const i=n._stacked;n._stacked=P4(n.vScale,n),n.stack!==o.stack&&(r=!0,ul(n),n.stack=o.stack),this._resyncElements(t),(r||i!==n._stacked)&&R4(this,n._parsed)}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),o=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(o,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:o,_data:r}=this,{iScale:i,_stacked:a}=o,l=i.axis;let c=t===0&&n===r.length?!0:o._sorted,d=t>0&&o._parsed[t-1],u,f,h;if(this._parsing===!1)o._parsed=r,o._sorted=!0,h=r;else{Yt(r[t])?h=this.parseArrayData(o,r,t,n):St(r[t])?h=this.parseObjectData(o,r,t,n):h=this.parsePrimitiveData(o,r,t,n);const g=()=>f[l]===null||d&&f[l]<d[l];for(u=0;u<n;++u)o._parsed[u+t]=f=h[u],c&&(g()&&(c=!1),d=f);o._sorted=c}a&&R4(this,h)}parsePrimitiveData(t,n,o,r){const{iScale:i,vScale:a}=t,l=i.axis,c=a.axis,d=i.getLabels(),u=i===a,f=new Array(r);let h,g,m;for(h=0,g=r;h<g;++h)m=h+o,f[h]={[l]:u||i.parse(d[m],m),[c]:a.parse(n[m],m)};return f}parseArrayData(t,n,o,r){const{xScale:i,yScale:a}=t,l=new Array(r);let c,d,u,f;for(c=0,d=r;c<d;++c)u=c+o,f=n[u],l[c]={x:i.parse(f[0],u),y:a.parse(f[1],u)};return l}parseObjectData(t,n,o,r){const{xScale:i,yScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=new Array(r);let u,f,h,g;for(u=0,f=r;u<f;++u)h=u+o,g=n[h],d[u]={x:i.parse(Nr(g,l),h),y:a.parse(Nr(g,c),h)};return d}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,o){const r=this.chart,i=this._cachedMeta,a=n[t.axis],l={keys:S4(r,!0),values:n._stacks[t.axis]._visualValues};return T4(l,a,i.index,{mode:o})}updateRangeFromParsed(t,n,o,r){const i=o[n.axis];let a=i===null?NaN:i;const l=r&&o._stacks[n.axis];r&&l&&(r.values=l,a=T4(r,i,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,n){const o=this._cachedMeta,r=o._parsed,i=o._sorted&&t===o.iScale,a=r.length,l=this._getOtherScale(t),c=$F(n,o,this.chart),d={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=LF(l);let h,g;function m(){g=r[h];const b=g[l.axis];return!ln(g[t.axis])||u>b||f<b}for(h=0;h<a&&!(!m()&&(this.updateRangeFromParsed(d,t,g,c),i));++h);if(i){for(h=a-1;h>=0;--h)if(!m()){this.updateRangeFromParsed(d,t,g,c);break}}return d}getAllParsedValues(t){const n=this._cachedMeta._parsed,o=[];let r,i,a;for(r=0,i=n.length;r<i;++r)a=n[r][t.axis],ln(a)&&o.push(a);return o}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,o=n.iScale,r=n.vScale,i=this.getParsed(t);return{label:o?""+o.getLabelForValue(i[o.axis]):"",value:r?""+r.getLabelForValue(i[r.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=jF(ct(this.options.clip,IF(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,o=this._cachedMeta,r=o.data||[],i=n.chartArea,a=[],l=this._drawStart||0,c=this._drawCount||r.length-l,d=this.options.drawActiveElementsOnTop;let u;for(o.dataset&&o.dataset.draw(t,i,l,c),u=l;u<l+c;++u){const f=r[u];f.hidden||(f.active&&d?a.push(f):f.draw(t,i))}for(u=0;u<a.length;++u)a[u].draw(t,i)}getStyle(t,n){const o=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(o):this.resolveDataElementOptions(t||0,o)}getContext(t,n,o){const r=this.getDataset();let i;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];i=a.$context||(a.$context=FF(this.getContext(),t,a)),i.parsed=this.getParsed(t),i.raw=r.data[t],i.index=i.dataIndex=t}else i=this.$context||(this.$context=VF(this.chart.getContext(),this.index)),i.dataset=r,i.index=i.datasetIndex=this.index;return i.active=!!n,i.mode=o,i}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",o){const r=n==="active",i=this._cachedDataOpts,a=t+"-"+n,l=i[a],c=this.enableOptionSharing&&rl(o);if(l)return O4(l,c);const d=this.chart.config,u=d.datasetElementScopeKeys(this._type,t),f=r?[`${t}Hover`,"hover",t,""]:[t,""],h=d.getOptionScopes(this.getDataset(),u),g=Object.keys(nn.elements[t]),m=()=>this.getContext(o,r,n),b=d.resolveNamedOptions(h,g,m,f);return b.$shared&&(b.$shared=c,i[a]=Object.freeze(O4(b,c))),b}_resolveAnimations(t,n,o){const r=this.chart,i=this._cachedDataOpts,a=`animation-${n}`,l=i[a];if(l)return l;let c;if(r.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),h=u.getOptionScopes(this.getDataset(),f);c=u.createResolver(h,this.getContext(t,o,n))}const d=new C4(r,c&&c.animations);return c&&c._cacheable&&(i[a]=Object.freeze(d)),d}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Cf(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const o=this.resolveDataElementOptions(t,n),r=this._sharedOptions,i=this.getSharedOptions(o),a=this.includeOptions(n,i)||i!==r;return this.updateSharedOptions(i,n,o),{sharedOptions:i,includeOptions:a}}updateElement(t,n,o,r){Cf(r)?Object.assign(t,o):this._resolveAnimations(n,r).update(t,o)}updateSharedOptions(t,n,o){t&&!Cf(n)&&this._resolveAnimations(void 0,n).update(t,o)}_setStyle(t,n,o,r){t.active=r;const i=this.getStyle(n,r);this._resolveAnimations(n,o,r).update(t,{options:!r&&this.getSharedOptions(i)||i})}removeHoverStyle(t,n,o){this._setStyle(t,o,"active",!1)}setHoverStyle(t,n,o){this._setStyle(t,o,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,o=this._cachedMeta.data;for(const[l,c,d]of this._syncList)this[l](c,d);this._syncList=[];const r=o.length,i=n.length,a=Math.min(i,r);a&&this.parse(0,a),i>r?this._insertElements(r,i-r,t):i<r&&this._removeElements(i,r-i)}_insertElements(t,n,o=!0){const r=this._cachedMeta,i=r.data,a=t+n;let l;const c=d=>{for(d.length+=n,l=d.length-1;l>=a;l--)d[l]=d[l-n]};for(c(i),l=t;l<a;++l)i[l]=new this.dataElementType;this._parsing&&c(r._parsed),this.parse(t,n),o&&this.updateElements(i,t,n,"reset")}updateElements(t,n,o,r){}_removeElements(t,n){const o=this._cachedMeta;if(this._parsing){const r=o._parsed.splice(t,n);o._stacked&&ul(o,r)}o.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,o,r]=t;this[n](o,r)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const o=arguments.length-2;o&&this._sync(["_insertElements",t,o])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}qe(jo,"defaults",{}),qe(jo,"datasetElementType",null),qe(jo,"dataElementType",null);function NF(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let o=[];for(let r=0,i=n.length;r<i;r++)o=o.concat(n[r].controller.getAllParsedValues(e));e._cache.$bar=z6(o.sort((r,i)=>r-i))}return e._cache.$bar}function BF(e){const t=e.iScale,n=NF(t,e.type);let o=t._length,r,i,a,l;const c=()=>{a===32767||a===-32768||(rl(l)&&(o=Math.min(o,Math.abs(a-l)||o)),l=a)};for(r=0,i=n.length;r<i;++r)a=t.getPixelForValue(n[r]),c();for(l=void 0,r=0,i=t.ticks.length;r<i;++r)a=t.getPixelForTick(r),c();return o}function HF(e,t,n,o){const r=n.barThickness;let i,a;return yt(r)?(i=t.min*n.categoryPercentage,a=n.barPercentage):(i=r*o,a=1),{chunk:i/o,ratio:a,start:t.pixels[e]-i/2}}function zF(e,t,n,o){const r=t.pixels,i=r[e];let a=e>0?r[e-1]:null,l=e<r.length-1?r[e+1]:null;const c=n.categoryPercentage;a===null&&(a=i-(l===null?t.end-t.start:l-i)),l===null&&(l=i+i-a);const d=i-(i-Math.min(a,l))/2*c;return{chunk:Math.abs(l-a)/2*c/o,ratio:n.barPercentage,start:d}}function WF(e,t,n,o){const r=n.parse(e[0],o),i=n.parse(e[1],o),a=Math.min(r,i),l=Math.max(r,i);let c=a,d=l;Math.abs(a)>Math.abs(l)&&(c=l,d=a),t[n.axis]=d,t._custom={barStart:c,barEnd:d,start:r,end:i,min:a,max:l}}function E4(e,t,n,o){return Yt(e)?WF(e,t,n,o):t[n.axis]=n.parse(e,o),t}function k4(e,t,n,o){const r=e.iScale,i=e.vScale,a=r.getLabels(),l=r===i,c=[];let d,u,f,h;for(d=n,u=n+o;d<u;++d)h=t[d],f={},f[r.axis]=l||r.parse(a[d],d),c.push(E4(h,f,i,d));return c}function wf(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function UF(e,t,n){return e!==0?Qo(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function ZF(e){let t,n,o,r,i;return e.horizontal?(t=e.base>e.x,n="left",o="right"):(t=e.base<e.y,n="bottom",o="top"),t?(r="end",i="start"):(r="start",i="end"),{start:n,end:o,reverse:t,top:r,bottom:i}}function qF(e,t,n,o){let r=t.borderSkipped;const i={};if(!r){e.borderSkipped=i;return}if(r===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:l,reverse:c,top:d,bottom:u}=ZF(e);r==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===o?r=d:(n._bottom||0)===o?r=u:(i[I4(u,a,l,c)]=!0,r=d)),i[I4(r,a,l,c)]=!0,e.borderSkipped=i}function I4(e,t,n,o){return o?(e=GF(e,t,n),e=j4(e,n,t)):e=j4(e,t,n),e}function GF(e,t,n){return e===t?n:e===n?t:e}function j4(e,t,n){return e==="start"?t:e==="end"?n:e}function YF(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class zd extends jo{parsePrimitiveData(t,n,o,r){return k4(t,n,o,r)}parseArrayData(t,n,o,r){return k4(t,n,o,r)}parseObjectData(t,n,o,r){const{iScale:i,vScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=i.axis==="x"?l:c,u=a.axis==="x"?l:c,f=[];let h,g,m,b;for(h=o,g=o+r;h<g;++h)b=n[h],m={},m[i.axis]=i.parse(Nr(b,d),h),f.push(E4(Nr(b,u),m,a,h));return f}updateRangeFromParsed(t,n,o,r){super.updateRangeFromParsed(t,n,o,r);const i=o._custom;i&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,i.min),t.max=Math.max(t.max,i.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:o,vScale:r}=n,i=this.getParsed(t),a=i._custom,l=wf(a)?"["+a.start+", "+a.end+"]":""+r.getLabelForValue(i[r.axis]);return{label:""+o.getLabelForValue(i[o.axis]),value:l}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,o,r){const i=r==="reset",{index:a,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),d=l.isHorizontal(),u=this._getRuler(),{sharedOptions:f,includeOptions:h}=this._getSharedOptions(n,r);for(let g=n;g<n+o;g++){const m=this.getParsed(g),b=i||yt(m[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(g),v=this._calculateBarIndexPixels(g,u),x=(m._stacks||{})[l.axis],C={horizontal:d,base:b.base,enableBorderRadius:!x||wf(m._custom)||a===x._top||a===x._bottom,x:d?b.head:v.center,y:d?v.center:b.head,height:d?v.size:Math.abs(b.size),width:d?Math.abs(b.size):v.size};h&&(C.options=f||this.resolveDataElementOptions(g,t[g].active?"active":r));const S=C.options||t[g].options;qF(C,S,x,a),YF(C,S,u.ratio),this.updateElement(t[g],g,C,r)}}_getStacks(t,n){const{iScale:o}=this._cachedMeta,r=o.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),i=o.options.stacked,a=[],l=this._cachedMeta.controller.getParsed(n),c=l&&l[o.axis],d=u=>{const f=u._parsed.find(g=>g[o.axis]===c),h=f&&f[u.vScale.axis];if(yt(h)||isNaN(h))return!0};for(const u of r)if(!(n!==void 0&&d(u))&&((i===!1||a.indexOf(u.stack)===-1||i===void 0&&u.stack===void 0)&&a.push(u.stack),u.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,n,o){const r=this._getStacks(t,o),i=n!==void 0?r.indexOf(n):-1;return i===-1?r.length-1:i}_getRuler(){const t=this.options,n=this._cachedMeta,o=n.iScale,r=[];let i,a;for(i=0,a=n.data.length;i<a;++i)r.push(o.getPixelForValue(this.getParsed(i)[o.axis],i));const l=t.barThickness;return{min:l||BF(n),pixels:r,start:o._startPixel,end:o._endPixel,stackCount:this._getStackCount(),scale:o,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:o,index:r},options:{base:i,minBarLength:a}}=this,l=i||0,c=this.getParsed(t),d=c._custom,u=wf(d);let f=c[n.axis],h=0,g=o?this.applyStack(n,c,o):f,m,b;g!==f&&(h=g-f,g=f),u&&(f=d.barStart,g=d.barEnd-d.barStart,f!==0&&Qo(f)!==Qo(d.barEnd)&&(h=0),h+=f);const v=!yt(i)&&!u?i:h;let x=n.getPixelForValue(v);if(this.chart.getDataVisibility(t)?m=n.getPixelForValue(h+g):m=x,b=m-x,Math.abs(b)<a){b=UF(b,n,l)*a,f===l&&(x-=b/2);const C=n.getPixelForDecimal(0),S=n.getPixelForDecimal(1),P=Math.min(C,S),w=Math.max(C,S);x=Math.max(Math.min(x,w),P),m=x+b,o&&!u&&(c._stacks[n.axis]._visualValues[r]=n.getValueForPixel(m)-n.getValueForPixel(x))}if(x===n.getPixelForValue(l)){const C=Qo(b)*n.getLineWidthForValue(l)/2;x+=C,b-=C}return{size:b,base:x,head:m,center:m+b/2}}_calculateBarIndexPixels(t,n){const o=n.scale,r=this.options,i=r.skipNull,a=ct(r.maxBarThickness,1/0);let l,c;if(n.grouped){const d=i?this._getStackCount(t):n.stackCount,u=r.barThickness==="flex"?zF(t,n,r,d):HF(t,n,r,d),f=this._getStackIndex(this.index,this._cachedMeta.stack,i?t:void 0);l=u.start+u.chunk*f+u.chunk/2,c=Math.min(a,u.chunk*u.ratio)}else l=o.getPixelForValue(this.getParsed(t)[o.axis],t),c=Math.min(a,n.min*n.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){const t=this._cachedMeta,n=t.vScale,o=t.data,r=o.length;let i=0;for(;i<r;++i)this.getParsed(i)[n.axis]!==null&&!o[i].hidden&&o[i].draw(this._ctx)}}qe(zd,"id","bar"),qe(zd,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),qe(zd,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class Wd extends jo{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,o,r){const i=super.parsePrimitiveData(t,n,o,r);for(let a=0;a<i.length;a++)i[a]._custom=this.resolveDataElementOptions(a+o).radius;return i}parseArrayData(t,n,o,r){const i=super.parseArrayData(t,n,o,r);for(let a=0;a<i.length;a++){const l=n[o+a];i[a]._custom=ct(l[2],this.resolveDataElementOptions(a+o).radius)}return i}parseObjectData(t,n,o,r){const i=super.parseObjectData(t,n,o,r);for(let a=0;a<i.length;a++){const l=n[o+a];i[a]._custom=ct(l&&l.r&&+l.r,this.resolveDataElementOptions(a+o).radius)}return i}getMaxOverflow(){const t=this._cachedMeta.data;let n=0;for(let o=t.length-1;o>=0;--o)n=Math.max(n,t[o].size(this.resolveDataElementOptions(o))/2);return n>0&&n}getLabelAndValue(t){const n=this._cachedMeta,o=this.chart.data.labels||[],{xScale:r,yScale:i}=n,a=this.getParsed(t),l=r.getLabelForValue(a.x),c=i.getLabelForValue(a.y),d=a._custom;return{label:o[t]||"",value:"("+l+", "+c+(d?", "+d:"")+")"}}update(t){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,o,r){const i=r==="reset",{iScale:a,vScale:l}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(n,r),u=a.axis,f=l.axis;for(let h=n;h<n+o;h++){const g=t[h],m=!i&&this.getParsed(h),b={},v=b[u]=i?a.getPixelForDecimal(.5):a.getPixelForValue(m[u]),x=b[f]=i?l.getBasePixel():l.getPixelForValue(m[f]);b.skip=isNaN(v)||isNaN(x),d&&(b.options=c||this.resolveDataElementOptions(h,g.active?"active":r),i&&(b.options.radius=0)),this.updateElement(g,h,b,r)}}resolveDataElementOptions(t,n){const o=this.getParsed(t);let r=super.resolveDataElementOptions(t,n);r.$shared&&(r=Object.assign({},r,{$shared:!1}));const i=r.radius;return n!=="active"&&(r.radius=0),r.radius+=ct(o&&o._custom,i),r}}qe(Wd,"id","bubble"),qe(Wd,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),qe(Wd,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function KF(e,t,n){let o=1,r=1,i=0,a=0;if(t<Xt){const l=e,c=l+t,d=Math.cos(l),u=Math.sin(l),f=Math.cos(c),h=Math.sin(c),g=(S,P,w)=>sl(S,l,c,!0)?1:Math.max(P,P*n,w,w*n),m=(S,P,w)=>sl(S,l,c,!0)?-1:Math.min(P,P*n,w,w*n),b=g(0,d,f),v=g(fn,u,h),x=m(Kt,d,f),C=m(Kt+fn,u,h);o=(b-x)/2,r=(v-C)/2,i=-(b+x)/2,a=-(v+C)/2}return{ratioX:o,ratioY:r,offsetX:i,offsetY:a}}class Wr extends jo{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const o=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=o;else{let i=c=>+o[c];if(St(o[t])){const{key:c="value"}=this._parsing;i=d=>+Nr(o[d],c)}let a,l;for(a=t,l=t+n;a<l;++a)r._parsed[a]=i(a)}}_getRotation(){return Io(this.options.rotation-90)}_getCircumference(){return Io(this.options.circumference)}_getRotationExtents(){let t=Xt,n=-Xt;for(let o=0;o<this.chart.data.datasets.length;++o)if(this.chart.isDatasetVisible(o)&&this.chart.getDatasetMeta(o).type===this._type){const r=this.chart.getDatasetMeta(o).controller,i=r._getRotation(),a=r._getCircumference();t=Math.min(t,i),n=Math.max(n,i+a)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:o}=n,r=this._cachedMeta,i=r.data,a=this.getMaxBorderWidth()+this.getMaxOffset(i)+this.options.spacing,l=Math.max((Math.min(o.width,o.height)-a)/2,0),c=Math.min(dV(this.options.cutout,l),1),d=this._getRingWeight(this.index),{circumference:u,rotation:f}=this._getRotationExtents(),{ratioX:h,ratioY:g,offsetX:m,offsetY:b}=KF(f,u,c),v=(o.width-a)/h,x=(o.height-a)/g,C=Math.max(Math.min(v,x)/2,0),S=j6(this.options.radius,C),P=Math.max(S*c,0),w=(S-P)/this._getVisibleDatasetWeightTotal();this.offsetX=m*S,this.offsetY=b*S,r.total=this.calculateTotal(),this.outerRadius=S-w*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-w*d,0),this.updateElements(i,0,i.length,t)}_circumference(t,n){const o=this.options,r=this._cachedMeta,i=this._getCircumference();return n&&o.animation.animateRotate||!this.chart.getDataVisibility(t)||r._parsed[t]===null||r.data[t].hidden?0:this.calculateCircumference(r._parsed[t]*i/Xt)}updateElements(t,n,o,r){const i=r==="reset",a=this.chart,l=a.chartArea,d=a.options.animation,u=(l.left+l.right)/2,f=(l.top+l.bottom)/2,h=i&&d.animateScale,g=h?0:this.innerRadius,m=h?0:this.outerRadius,{sharedOptions:b,includeOptions:v}=this._getSharedOptions(n,r);let x=this._getRotation(),C;for(C=0;C<n;++C)x+=this._circumference(C,i);for(C=n;C<n+o;++C){const S=this._circumference(C,i),P=t[C],w={x:u+this.offsetX,y:f+this.offsetY,startAngle:x,endAngle:x+S,circumference:S,outerRadius:m,innerRadius:g};v&&(w.options=b||this.resolveDataElementOptions(C,P.active?"active":r)),x+=S,this.updateElement(P,C,w,r)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let o=0,r;for(r=0;r<n.length;r++){const i=t._parsed[r];i!==null&&!isNaN(i)&&this.chart.getDataVisibility(r)&&!n[r].hidden&&(o+=Math.abs(i))}return o}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?Xt*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,o=this.chart,r=o.data.labels||[],i=ll(n._parsed[t],o.options.locale);return{label:r[t]||"",value:i}}getMaxBorderWidth(t){let n=0;const o=this.chart;let r,i,a,l,c;if(!t){for(r=0,i=o.data.datasets.length;r<i;++r)if(o.isDatasetVisible(r)){a=o.getDatasetMeta(r),t=a.data,l=a.controller;break}}if(!t)return 0;for(r=0,i=t.length;r<i;++r)c=l.resolveDataElementOptions(r),c.borderAlign!=="inner"&&(n=Math.max(n,c.borderWidth||0,c.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let o=0,r=t.length;o<r;++o){const i=this.resolveDataElementOptions(o);n=Math.max(n,i.offset||0,i.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let o=0;o<t;++o)this.chart.isDatasetVisible(o)&&(n+=this._getRingWeight(o));return n}_getRingWeight(t){return Math.max(ct(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}qe(Wr,"id","doughnut"),qe(Wr,"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"}),qe(Wr,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),qe(Wr,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:o,color:r}}=t.legend.options;return n.labels.map((i,a)=>{const c=t.getDatasetMeta(0).controller.getStyle(a);return{text:i,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:r,lineWidth:c.borderWidth,pointStyle:o,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,o){o.chart.toggleDataVisibility(n.index),o.chart.update()}}}});class Ud extends jo{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:o,data:r=[],_dataset:i}=n,a=this.chart._animationsDisabled;let{start:l,count:c}=Z6(n,r,a);this._drawStart=l,this._drawCount=c,q6(n)&&(l=0,c=r.length),o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!i._decimated,o.points=r;const d=this.resolveDatasetElementOptions(t);this.options.showLine||(d.borderWidth=0),d.segment=this.options.segment,this.updateElement(o,void 0,{animated:!a,options:d},t),this.updateElements(r,l,c,t)}updateElements(t,n,o,r){const i=r==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,r),h=a.axis,g=l.axis,{spanGaps:m,segment:b}=this.options,v=ks(m)?m:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||i||r==="none",C=n+o,S=t.length;let P=n>0&&this.getParsed(n-1);for(let w=0;w<S;++w){const R=t[w],M=x?R:{};if(w<n||w>=C){M.skip=!0;continue}const O=this.getParsed(w),E=yt(O[g]),k=M[h]=a.getPixelForValue(O[h],w),I=M[g]=i||E?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,O,c):O[g],w);M.skip=isNaN(k)||isNaN(I)||E,M.stop=w>0&&Math.abs(O[h]-P[h])>v,b&&(M.parsed=O,M.raw=d.data[w]),f&&(M.options=u||this.resolveDataElementOptions(w,R.active?"active":r)),x||this.updateElement(R,w,M,r),P=O}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,o=n.options&&n.options.borderWidth||0,r=t.data||[];if(!r.length)return o;const i=r[0].size(this.resolveDataElementOptions(0)),a=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(o,i,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}qe(Ud,"id","line"),qe(Ud,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),qe(Ud,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class pl extends jo{constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this._cachedMeta,o=this.chart,r=o.data.labels||[],i=ll(n._parsed[t].r,o.options.locale);return{label:r[t]||"",value:i}}parseObjectData(t,n,o,r){return l4.bind(this)(t,n,o,r)}update(t){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){const t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((o,r)=>{const i=this.getParsed(r).r;!isNaN(i)&&this.chart.getDataVisibility(r)&&(i<n.min&&(n.min=i),i>n.max&&(n.max=i))}),n}_updateRadius(){const t=this.chart,n=t.chartArea,o=t.options,r=Math.min(n.right-n.left,n.bottom-n.top),i=Math.max(r/2,0),a=Math.max(o.cutoutPercentage?i/100*o.cutoutPercentage:1,0),l=(i-a)/t.getVisibleDatasetCount();this.outerRadius=i-l*this.index,this.innerRadius=this.outerRadius-l}updateElements(t,n,o,r){const i=r==="reset",a=this.chart,c=a.options.animation,d=this._cachedMeta.rScale,u=d.xCenter,f=d.yCenter,h=d.getIndexAngle(0)-.5*Kt;let g=h,m;const b=360/this.countVisibleElements();for(m=0;m<n;++m)g+=this._computeAngle(m,r,b);for(m=n;m<n+o;m++){const v=t[m];let x=g,C=g+this._computeAngle(m,r,b),S=a.getDataVisibility(m)?d.getDistanceFromCenterForValue(this.getParsed(m).r):0;g=C,i&&(c.animateScale&&(S=0),c.animateRotate&&(x=C=h));const P={x:u,y:f,innerRadius:0,outerRadius:S,startAngle:x,endAngle:C,options:this.resolveDataElementOptions(m,v.active?"active":r)};this.updateElement(v,m,P,r)}}countVisibleElements(){const t=this._cachedMeta;let n=0;return t.data.forEach((o,r)=>{!isNaN(this.getParsed(r).r)&&this.chart.getDataVisibility(r)&&n++}),n}_computeAngle(t,n,o){return this.chart.getDataVisibility(t)?Io(this.resolveDataElementOptions(t,n).angle||o):0}}qe(pl,"id","polarArea"),qe(pl,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),qe(pl,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:o,color:r}}=t.legend.options;return n.labels.map((i,a)=>{const c=t.getDatasetMeta(0).controller.getStyle(a);return{text:i,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:r,lineWidth:c.borderWidth,pointStyle:o,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,o){o.chart.toggleDataVisibility(n.index),o.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Sf extends Wr{}qe(Sf,"id","pie"),qe(Sf,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class Zd extends jo{getLabelAndValue(t){const n=this._cachedMeta.vScale,o=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(o[n.axis])}}parseObjectData(t,n,o,r){return l4.bind(this)(t,n,o,r)}update(t){const n=this._cachedMeta,o=n.dataset,r=n.data||[],i=n.iScale.getLabels();if(o.points=r,t!=="resize"){const a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);const l={_loop:!0,_fullLoop:i.length===r.length,options:a};this.updateElement(o,void 0,l,t)}this.updateElements(r,0,r.length,t)}updateElements(t,n,o,r){const i=this._cachedMeta.rScale,a=r==="reset";for(let l=n;l<n+o;l++){const c=t[l],d=this.resolveDataElementOptions(l,c.active?"active":r),u=i.getPointPositionForValue(l,this.getParsed(l).r),f=a?i.xCenter:u.x,h=a?i.yCenter:u.y,g={x:f,y:h,angle:u.angle,skip:isNaN(f)||isNaN(h),options:d};this.updateElement(c,l,g,r)}}}qe(Zd,"id","radar"),qe(Zd,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),qe(Zd,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class fl extends jo{getLabelAndValue(t){const n=this._cachedMeta,o=this.chart.data.labels||[],{xScale:r,yScale:i}=n,a=this.getParsed(t),l=r.getLabelForValue(a.x),c=i.getLabelForValue(a.y);return{label:o[t]||"",value:"("+l+", "+c+")"}}update(t){const n=this._cachedMeta,{data:o=[]}=n,r=this.chart._animationsDisabled;let{start:i,count:a}=Z6(n,o,r);if(this._drawStart=i,this._drawCount=a,q6(n)&&(i=0,a=o.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:l,_dataset:c}=n;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=o;const d=this.resolveDatasetElementOptions(t);d.segment=this.options.segment,this.updateElement(l,void 0,{animated:!r,options:d},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(o,i,a,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,o,r){const i=r==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,u=this.resolveDataElementOptions(n,r),f=this.getSharedOptions(u),h=this.includeOptions(r,f),g=a.axis,m=l.axis,{spanGaps:b,segment:v}=this.options,x=ks(b)?b:Number.POSITIVE_INFINITY,C=this.chart._animationsDisabled||i||r==="none";let S=n>0&&this.getParsed(n-1);for(let P=n;P<n+o;++P){const w=t[P],R=this.getParsed(P),M=C?w:{},O=yt(R[m]),E=M[g]=a.getPixelForValue(R[g],P),k=M[m]=i||O?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,R,c):R[m],P);M.skip=isNaN(E)||isNaN(k)||O,M.stop=P>0&&Math.abs(R[g]-S[g])>x,v&&(M.parsed=R,M.raw=d.data[P]),h&&(M.options=f||this.resolveDataElementOptions(P,w.active?"active":r)),C||this.updateElement(w,P,M,r),S=R}this.updateSharedOptions(f,r,u)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let l=0;for(let c=n.length-1;c>=0;--c)l=Math.max(l,n[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}const o=t.dataset,r=o.options&&o.options.borderWidth||0;if(!n.length)return r;const i=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(r,i,a)/2}}qe(fl,"id","scatter"),qe(fl,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),qe(fl,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var XF=Object.freeze({__proto__:null,BarController:zd,BubbleController:Wd,DoughnutController:Wr,LineController:Ud,PieController:Sf,PolarAreaController:pl,RadarController:Zd,ScatterController:fl});function Oi(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Tf{constructor(t){qe(this,"options");this.options=t||{}}static override(t){Object.assign(Tf.prototype,t)}init(){}formats(){return Oi()}parse(){return Oi()}format(){return Oi()}add(){return Oi()}diff(){return Oi()}startOf(){return Oi()}endOf(){return Oi()}}var QF={_date:Tf};function JF(e,t,n,o){const{controller:r,data:i,_sorted:a}=e,l=r._cachedMeta.iScale;if(l&&t===l.axis&&t!=="r"&&a&&i.length){const c=l._reversePixels?wV:mr;if(o){if(r._sharedOptions){const d=i[0],u=typeof d.getRange=="function"&&d.getRange(t);if(u){const f=c(i,t,n-u),h=c(i,t,n+u);return{lo:f.lo,hi:h.hi}}}}else return c(i,t,n)}return{lo:0,hi:i.length-1}}function hl(e,t,n,o,r){const i=e.getSortedVisibleDatasetMetas(),a=n[t];for(let l=0,c=i.length;l<c;++l){const{index:d,data:u}=i[l],{lo:f,hi:h}=JF(i[l],t,a,r);for(let g=f;g<=h;++g){const m=u[g];m.skip||o(m,d,g)}}}function e$(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(o,r){const i=t?Math.abs(o.x-r.x):0,a=n?Math.abs(o.y-r.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(a,2))}}function Pf(e,t,n,o,r){const i=[];return!r&&!e.isPointInArea(t)||hl(e,n,t,function(l,c,d){!r&&!br(l,e.chartArea,0)||l.inRange(t.x,t.y,o)&&i.push({element:l,datasetIndex:c,index:d})},!0),i}function t$(e,t,n,o){let r=[];function i(a,l,c){const{startAngle:d,endAngle:u}=a.getProps(["startAngle","endAngle"],o),{angle:f}=N6(a,{x:t.x,y:t.y});sl(f,d,u)&&r.push({element:a,datasetIndex:l,index:c})}return hl(e,n,t,i),r}function n$(e,t,n,o,r,i){let a=[];const l=e$(n);let c=Number.POSITIVE_INFINITY;function d(u,f,h){const g=u.inRange(t.x,t.y,r);if(o&&!g)return;const m=u.getCenterPoint(r);if(!(!!i||e.isPointInArea(m))&&!g)return;const v=l(t,m);v<c?(a=[{element:u,datasetIndex:f,index:h}],c=v):v===c&&a.push({element:u,datasetIndex:f,index:h})}return hl(e,n,t,d),a}function Mf(e,t,n,o,r,i){return!i&&!e.isPointInArea(t)?[]:n==="r"&&!o?t$(e,t,n,r):n$(e,t,n,o,r,i)}function _4(e,t,n,o,r){const i=[],a=n==="x"?"inXRange":"inYRange";let l=!1;return hl(e,n,t,(c,d,u)=>{c[a]&&c[a](t[n],r)&&(i.push({element:c,datasetIndex:d,index:u}),l=l||c.inRange(t.x,t.y,r))}),o&&!l?[]:i}var o$={evaluateInteractionItems:hl,modes:{index(e,t,n,o){const r=Mi(t,e),i=n.axis||"x",a=n.includeInvisible||!1,l=n.intersect?Pf(e,r,i,o,a):Mf(e,r,i,!1,o,a),c=[];return l.length?(e.getSortedVisibleDatasetMetas().forEach(d=>{const u=l[0].index,f=d.data[u];f&&!f.skip&&c.push({element:f,datasetIndex:d.index,index:u})}),c):[]},dataset(e,t,n,o){const r=Mi(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;let l=n.intersect?Pf(e,r,i,o,a):Mf(e,r,i,!1,o,a);if(l.length>0){const c=l[0].datasetIndex,d=e.getDatasetMeta(c).data;l=[];for(let u=0;u<d.length;++u)l.push({element:d[u],datasetIndex:c,index:u})}return l},point(e,t,n,o){const r=Mi(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;return Pf(e,r,i,o,a)},nearest(e,t,n,o){const r=Mi(t,e),i=n.axis||"xy",a=n.includeInvisible||!1;return Mf(e,r,i,n.intersect,o,a)},x(e,t,n,o){const r=Mi(t,e);return _4(e,r,"x",n.intersect,o)},y(e,t,n,o){const r=Mi(t,e);return _4(e,r,"y",n.intersect,o)}}};const D4=["left","top","right","bottom"];function gl(e,t){return e.filter(n=>n.pos===t)}function L4(e,t){return e.filter(n=>D4.indexOf(n.pos)===-1&&n.box.axis===t)}function ml(e,t){return e.sort((n,o)=>{const r=t?o:n,i=t?n:o;return r.weight===i.weight?r.index-i.index:r.weight-i.weight})}function r$(e){const t=[];let n,o,r,i,a,l;for(n=0,o=(e||[]).length;n<o;++n)r=e[n],{position:i,options:{stack:a,stackWeight:l=1}}=r,t.push({index:n,box:r,pos:i,horizontal:r.isHorizontal(),weight:r.weight,stack:a&&i+a,stackWeight:l});return t}function i$(e){const t={};for(const n of e){const{stack:o,pos:r,stackWeight:i}=n;if(!o||!D4.includes(r))continue;const a=t[o]||(t[o]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=i}return t}function s$(e,t){const n=i$(e),{vBoxMaxWidth:o,hBoxMaxHeight:r}=t;let i,a,l;for(i=0,a=e.length;i<a;++i){l=e[i];const{fullSize:c}=l.box,d=n[l.stack],u=d&&l.stackWeight/d.weight;l.horizontal?(l.width=u?u*o:c&&t.availableWidth,l.height=r):(l.width=o,l.height=u?u*r:c&&t.availableHeight)}return n}function a$(e){const t=r$(e),n=ml(t.filter(d=>d.box.fullSize),!0),o=ml(gl(t,"left"),!0),r=ml(gl(t,"right")),i=ml(gl(t,"top"),!0),a=ml(gl(t,"bottom")),l=L4(t,"x"),c=L4(t,"y");return{fullSize:n,leftAndTop:o.concat(i),rightAndBottom:r.concat(c).concat(a).concat(l),chartArea:gl(t,"chartArea"),vertical:o.concat(r).concat(c),horizontal:i.concat(a).concat(l)}}function A4(e,t,n,o){return Math.max(e[n],t[n])+Math.max(e[o],t[o])}function V4(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function l$(e,t,n,o){const{pos:r,box:i}=n,a=e.maxPadding;if(!St(r)){n.size&&(e[r]-=n.size);const f=o[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?i.height:i.width),n.size=f.size/f.count,e[r]+=n.size}i.getPadding&&V4(a,i.getPadding());const l=Math.max(0,t.outerWidth-A4(a,e,"left","right")),c=Math.max(0,t.outerHeight-A4(a,e,"top","bottom")),d=l!==e.w,u=c!==e.h;return e.w=l,e.h=c,n.horizontal?{same:d,other:u}:{same:u,other:d}}function c$(e){const t=e.maxPadding;function n(o){const r=Math.max(t[o]-e[o],0);return e[o]+=r,r}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function d$(e,t){const n=t.maxPadding;function o(r){const i={left:0,top:0,right:0,bottom:0};return r.forEach(a=>{i[a]=Math.max(t[a],n[a])}),i}return o(e?["left","right"]:["top","bottom"])}function bl(e,t,n,o){const r=[];let i,a,l,c,d,u;for(i=0,a=e.length,d=0;i<a;++i){l=e[i],c=l.box,c.update(l.width||t.w,l.height||t.h,d$(l.horizontal,t));const{same:f,other:h}=l$(t,n,l,o);d|=f&&r.length,u=u||h,c.fullSize||r.push(l)}return d&&bl(r,t,n,o)||u}function qd(e,t,n,o,r){e.top=n,e.left=t,e.right=t+o,e.bottom=n+r,e.width=o,e.height=r}function F4(e,t,n,o){const r=n.padding;let{x:i,y:a}=t;for(const l of e){const c=l.box,d=o[l.stack]||{count:1,placed:0,weight:1},u=l.stackWeight/d.weight||1;if(l.horizontal){const f=t.w*u,h=d.size||c.height;rl(d.start)&&(a=d.start),c.fullSize?qd(c,r.left,a,n.outerWidth-r.right-r.left,h):qd(c,t.left+d.placed,a,f,h),d.start=a,d.placed+=f,a=c.bottom}else{const f=t.h*u,h=d.size||c.width;rl(d.start)&&(i=d.start),c.fullSize?qd(c,i,r.top,h,n.outerHeight-r.bottom-r.top):qd(c,i,t.top+d.placed,h,f),d.start=i,d.placed+=f,i=c.right}}t.x=i,t.y=a}var In={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,o){if(!e)return;const r=Mn(e.options.layout.padding),i=Math.max(t-r.width,0),a=Math.max(n-r.height,0),l=a$(e.boxes),c=l.vertical,d=l.horizontal;$t(e.boxes,b=>{typeof b.beforeLayout=="function"&&b.beforeLayout()});const u=c.reduce((b,v)=>v.box.options&&v.box.options.display===!1?b:b+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:n,padding:r,availableWidth:i,availableHeight:a,vBoxMaxWidth:i/2/u,hBoxMaxHeight:a/2}),h=Object.assign({},r);V4(h,Mn(o));const g=Object.assign({maxPadding:h,w:i,h:a,x:r.left,y:r.top},r),m=s$(c.concat(d),f);bl(l.fullSize,g,f,m),bl(c,g,f,m),bl(d,g,f,m)&&bl(c,g,f,m),c$(g),F4(l.leftAndTop,g,f,m),g.x+=g.w,g.y+=g.h,F4(l.rightAndBottom,g,f,m),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},$t(l.chartArea,b=>{const v=b.box;Object.assign(v,e.chartArea),v.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class $4{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,o){}removeEventListener(t,n,o){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,o,r){return n=Math.max(0,n||t.width),o=o||t.height,{width:n,height:Math.max(0,r?Math.floor(n/r):o)}}isAttached(t){return!0}updateConfig(t){}}class u$ extends $4{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Gd="$chartjs",p$={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},N4=e=>e===null||e==="";function f$(e,t){const n=e.style,o=e.getAttribute("height"),r=e.getAttribute("width");if(e[Gd]={initial:{height:o,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",N4(r)){const i=u4(e,"width");i!==void 0&&(e.width=i)}if(N4(o))if(e.style.height==="")e.height=e.width/(t||2);else{const i=u4(e,"height");i!==void 0&&(e.height=i)}return e}const B4=gF?{passive:!0}:!1;function h$(e,t,n){e&&e.addEventListener(t,n,B4)}function g$(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,B4)}function m$(e,t){const n=p$[e.type]||e.type,{x:o,y:r}=Mi(e,t);return{type:n,chart:t,native:e,x:o!==void 0?o:null,y:r!==void 0?r:null}}function Yd(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function b$(e,t,n){const o=e.canvas,r=new MutationObserver(i=>{let a=!1;for(const l of i)a=a||Yd(l.addedNodes,o),a=a&&!Yd(l.removedNodes,o);a&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function v$(e,t,n){const o=e.canvas,r=new MutationObserver(i=>{let a=!1;for(const l of i)a=a||Yd(l.removedNodes,o),a=a&&!Yd(l.addedNodes,o);a&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const vl=new Map;let H4=0;function z4(){const e=window.devicePixelRatio;e!==H4&&(H4=e,vl.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function x$(e,t){vl.size||window.addEventListener("resize",z4),vl.set(e,t)}function y$(e){vl.delete(e),vl.size||window.removeEventListener("resize",z4)}function C$(e,t,n){const o=e.canvas,r=o&&xf(o);if(!r)return;const i=U6((l,c)=>{const d=r.clientWidth;n(l,c),d<r.clientWidth&&n()},window),a=new ResizeObserver(l=>{const c=l[0],d=c.contentRect.width,u=c.contentRect.height;d===0&&u===0||i(d,u)});return a.observe(r),x$(e,i),a}function Rf(e,t,n){n&&n.disconnect(),t==="resize"&&y$(e)}function w$(e,t,n){const o=e.canvas,r=U6(i=>{e.ctx!==null&&n(m$(i,e))},e);return h$(o,t,r),r}class S$ extends $4{acquireContext(t,n){const o=t&&t.getContext&&t.getContext("2d");return o&&o.canvas===t?(f$(t,n),o):null}releaseContext(t){const n=t.canvas;if(!n[Gd])return!1;const o=n[Gd].initial;["height","width"].forEach(i=>{const a=o[i];yt(a)?n.removeAttribute(i):n.setAttribute(i,a)});const r=o.style||{};return Object.keys(r).forEach(i=>{n.style[i]=r[i]}),n.width=n.width,delete n[Gd],!0}addEventListener(t,n,o){this.removeEventListener(t,n);const r=t.$proxies||(t.$proxies={}),a={attach:b$,detach:v$,resize:C$}[n]||w$;r[n]=a(t,n,o)}removeEventListener(t,n){const o=t.$proxies||(t.$proxies={}),r=o[n];if(!r)return;({attach:Rf,detach:Rf,resize:Rf}[n]||g$)(t,n,r),o[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,o,r){return hF(t,n,o,r)}isAttached(t){const n=t&&xf(t);return!!(n&&n.isConnected)}}function T$(e){return!vf()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?u$:S$}let xr=(np=class{constructor(){qe(this,"x");qe(this,"y");qe(this,"active",!1);qe(this,"options");qe(this,"$animations")}tooltipPosition(t){const{x:n,y:o}=this.getProps(["x","y"],t);return{x:n,y:o}}hasValue(){return ks(this.x)&&ks(this.y)}getProps(t,n){const o=this.$animations;if(!n||!o)return this;const r={};return t.forEach(i=>{r[i]=o[i]&&o[i].active()?o[i]._to:this[i]}),r}},qe(np,"defaults",{}),qe(np,"defaultRoutes"),np);function P$(e,t){const n=e.options.ticks,o=M$(e),r=Math.min(n.maxTicksLimit||o,o),i=n.major.enabled?O$(t):[],a=i.length,l=i[0],c=i[a-1],d=[];if(a>r)return E$(t,d,i,a/r),d;const u=R$(i,t,r);if(a>0){let f,h;const g=a>1?Math.round((c-l)/(a-1)):null;for(Kd(t,d,u,yt(g)?0:l-g,l),f=0,h=a-1;f<h;f++)Kd(t,d,u,i[f],i[f+1]);return Kd(t,d,u,c,yt(g)?t.length:c+g),d}return Kd(t,d,u),d}function M$(e){const t=e.options.offset,n=e._tickSize(),o=e._length/n+(t?0:1),r=e._maxLength/n;return Math.floor(Math.min(o,r))}function R$(e,t,n){const o=k$(e),r=t.length/n;if(!o)return Math.max(r,1);const i=vV(o);for(let a=0,l=i.length-1;a<l;a++){const c=i[a];if(c>r)return c}return Math.max(r,1)}function O$(e){const t=[];let n,o;for(n=0,o=e.length;n<o;n++)e[n].major&&t.push(n);return t}function E$(e,t,n,o){let r=0,i=n[0],a;for(o=Math.ceil(o),a=0;a<e.length;a++)a===i&&(t.push(e[a]),r++,i=n[r*o])}function Kd(e,t,n,o,r){const i=ct(o,0),a=Math.min(ct(r,e.length),e.length);let l=0,c,d,u;for(n=Math.ceil(n),r&&(c=r-o,n=c/Math.floor(c/n)),u=i;u<0;)l++,u=Math.round(i+l*n);for(d=Math.max(i,0);d<a;d++)d===u&&(t.push(e[d]),l++,u=Math.round(i+l*n))}function k$(e){const t=e.length;let n,o;if(t<2)return!1;for(o=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==o)return!1;return o}const I$=e=>e==="left"?"right":e==="right"?"left":e,W4=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,U4=(e,t)=>Math.min(t||e,e);function Z4(e,t){const n=[],o=e.length/t,r=e.length;let i=0;for(;i<r;i+=o)n.push(e[Math.floor(i)]);return n}function j$(e,t,n){const o=e.ticks.length,r=Math.min(t,o-1),i=e._startPixel,a=e._endPixel,l=1e-6;let c=e.getPixelForTick(r),d;if(!(n&&(o===1?d=Math.max(c-i,a-c):t===0?d=(e.getPixelForTick(1)-c)/2:d=(c-e.getPixelForTick(r-1))/2,c+=r<t?d:-d,c<i-l||c>a+l)))return c}function _$(e,t){$t(e,n=>{const o=n.gc,r=o.length/2;let i;if(r>t){for(i=0;i<r;++i)delete n.data[o[i]];o.splice(0,r)}})}function xl(e){return e.drawTicks?e.tickLength:0}function q4(e,t){if(!e.display)return 0;const n=gn(e.font,t),o=Mn(e.padding);return(Yt(e.text)?e.text.length:1)*n.lineHeight+o.height}function D$(e,t){return zr(e,{scale:t,type:"scale"})}function L$(e,t,n){return zr(e,{tick:n,index:t,type:"tick"})}function A$(e,t,n){let o=lf(e);return(n&&t!=="right"||!n&&t==="right")&&(o=I$(o)),o}function V$(e,t,n,o){const{top:r,left:i,bottom:a,right:l,chart:c}=e,{chartArea:d,scales:u}=c;let f=0,h,g,m;const b=a-r,v=l-i;if(e.isHorizontal()){if(g=kn(o,i,l),St(n)){const x=Object.keys(n)[0],C=n[x];m=u[x].getPixelForValue(C)+b-t}else n==="center"?m=(d.bottom+d.top)/2+b-t:m=W4(e,n,t);h=l-i}else{if(St(n)){const x=Object.keys(n)[0],C=n[x];g=u[x].getPixelForValue(C)-v+t}else n==="center"?g=(d.left+d.right)/2-v+t:g=W4(e,n,t);m=kn(o,a,r),f=n==="left"?-fn:fn}return{titleX:g,titleY:m,maxWidth:h,rotation:f}}class Ei extends xr{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:o,_suggestedMax:r}=this;return t=io(t,Number.POSITIVE_INFINITY),n=io(n,Number.NEGATIVE_INFINITY),o=io(o,Number.POSITIVE_INFINITY),r=io(r,Number.NEGATIVE_INFINITY),{min:io(t,o),max:io(n,r),minDefined:ln(t),maxDefined:ln(n)}}getMinMax(t){let{min:n,max:o,minDefined:r,maxDefined:i}=this.getUserBounds(),a;if(r&&i)return{min:n,max:o};const l=this.getMatchingVisibleMetas();for(let c=0,d=l.length;c<d;++c)a=l[c].controller.getMinMax(this,t),r||(n=Math.min(n,a.min)),i||(o=Math.max(o,a.max));return n=i&&n>o?o:n,o=r&&n>o?n:o,{min:io(n,io(o,n)),max:io(o,io(n,o))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Wt(this.options.beforeUpdate,[this])}update(t,n,o){const{beginAtZero:r,grace:i,ticks:a}=this.options,l=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=o=Object.assign({left:0,right:0,top:0,bottom:0},o),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+o.left+o.right:this.height+o.top+o.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ZV(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=l<this.ticks.length;this._convertTicksToLabels(c?Z4(this.ticks,l):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=P$(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,o;this.isHorizontal()?(n=this.left,o=this.right):(n=this.top,o=this.bottom,t=!t),this._startPixel=n,this._endPixel=o,this._reversePixels=t,this._length=o-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Wt(this.options.afterUpdate,[this])}beforeSetDimensions(){Wt(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){Wt(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),Wt(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Wt(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let o,r,i;for(o=0,r=t.length;o<r;o++)i=t[o],i.label=Wt(n.callback,[i.value,o,t],this)}afterTickToLabelConversion(){Wt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Wt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,o=U4(this.ticks.length,t.ticks.maxTicksLimit),r=n.minRotation||0,i=n.maxRotation;let a=r,l,c,d;if(!this._isVisible()||!n.display||r>=i||o<=1||!this.isHorizontal()){this.labelRotation=r;return}const u=this._getLabelSizes(),f=u.widest.width,h=u.highest.height,g=Sn(this.chart.width-f,0,this.maxWidth);l=t.offset?this.maxWidth/o:g/(o-1),f+6>l&&(l=g/(o-(t.offset?.5:1)),c=this.maxHeight-xl(t.grid)-n.padding-q4(t.title,this.chart.options.font),d=Math.sqrt(f*f+h*h),a=rf(Math.min(Math.asin(Sn((u.highest.height+6)/l,-1,1)),Math.asin(Sn(c/d,-1,1))-Math.asin(Sn(h/d,-1,1)))),a=Math.max(r,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){Wt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Wt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:o,title:r,grid:i}}=this,a=this._isVisible(),l=this.isHorizontal();if(a){const c=q4(r,n.options.font);if(l?(t.width=this.maxWidth,t.height=xl(i)+c):(t.height=this.maxHeight,t.width=xl(i)+c),o.display&&this.ticks.length){const{first:d,last:u,widest:f,highest:h}=this._getLabelSizes(),g=o.padding*2,m=Io(this.labelRotation),b=Math.cos(m),v=Math.sin(m);if(l){const x=o.mirror?0:v*f.width+b*h.height;t.height=Math.min(this.maxHeight,t.height+x+g)}else{const x=o.mirror?0:b*f.width+v*h.height;t.width=Math.min(this.maxWidth,t.width+x+g)}this._calculatePadding(d,u,v,b)}}this._handleMargins(),l?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,o,r){const{ticks:{align:i,padding:a},position:l}=this.options,c=this.labelRotation!==0,d=l!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,g=0;c?d?(h=r*t.width,g=o*n.height):(h=o*t.height,g=r*n.width):i==="start"?g=n.width:i==="end"?h=t.width:i!=="inner"&&(h=t.width/2,g=n.width/2),this.paddingLeft=Math.max((h-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-f+a)*this.width/(this.width-f),0)}else{let u=n.height/2,f=t.height/2;i==="start"?(u=0,f=t.height):i==="end"&&(u=n.height,f=0),this.paddingTop=u+a,this.paddingBottom=f+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(){Wt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,o;for(n=0,o=t.length;n<o;n++)yt(t[n].label)&&(t.splice(n,1),o--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let o=this.ticks;n<o.length&&(o=Z4(o,n)),this._labelSizes=t=this._computeLabelSizes(o,o.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,o){const{ctx:r,_longestTextCache:i}=this,a=[],l=[],c=Math.floor(n/U4(n,o));let d=0,u=0,f,h,g,m,b,v,x,C,S,P,w;for(f=0;f<n;f+=c){if(m=t[f].label,b=this._resolveTickFontOptions(f),r.font=v=b.string,x=i[v]=i[v]||{data:{},gc:[]},C=b.lineHeight,S=P=0,!yt(m)&&!Yt(m))S=Ad(r,x.data,x.gc,S,m),P=C;else if(Yt(m))for(h=0,g=m.length;h<g;++h)w=m[h],!yt(w)&&!Yt(w)&&(S=Ad(r,x.data,x.gc,S,w),P+=C);a.push(S),l.push(P),d=Math.max(S,d),u=Math.max(P,u)}_$(i,n);const R=a.indexOf(d),M=l.indexOf(u),O=E=>({width:a[E]||0,height:l[E]||0});return{first:O(0),last:O(n-1),widest:O(R),highest:O(M),widths:a,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return CV(this._alignToPixels?wi(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const o=n[t];return o.$context||(o.$context=L$(this.getContext(),t,o))}return this.$context||(this.$context=D$(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=Io(this.labelRotation),o=Math.abs(Math.cos(n)),r=Math.abs(Math.sin(n)),i=this._getLabelSizes(),a=t.autoSkipPadding||0,l=i?i.widest.width+a:0,c=i?i.highest.height+a:0;return this.isHorizontal()?c*o>l*r?l/o:c/r:c*r<l*o?c/o:l/r}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,o=this.chart,r=this.options,{grid:i,position:a,border:l}=r,c=i.offset,d=this.isHorizontal(),f=this.ticks.length+(c?1:0),h=xl(i),g=[],m=l.setContext(this.getContext()),b=m.display?m.width:0,v=b/2,x=function(F){return wi(o,F,b)};let C,S,P,w,R,M,O,E,k,I,_,A;if(a==="top")C=x(this.bottom),M=this.bottom-h,E=C-v,I=x(t.top)+v,A=t.bottom;else if(a==="bottom")C=x(this.top),I=t.top,A=x(t.bottom)-v,M=C+v,E=this.top+h;else if(a==="left")C=x(this.right),R=this.right-h,O=C-v,k=x(t.left)+v,_=t.right;else if(a==="right")C=x(this.left),k=t.left,_=x(t.right)-v,R=C+v,O=this.left+h;else if(n==="x"){if(a==="center")C=x((t.top+t.bottom)/2+.5);else if(St(a)){const F=Object.keys(a)[0],$=a[F];C=x(this.chart.scales[F].getPixelForValue($))}I=t.top,A=t.bottom,M=C+v,E=M+h}else if(n==="y"){if(a==="center")C=x((t.left+t.right)/2);else if(St(a)){const F=Object.keys(a)[0],$=a[F];C=x(this.chart.scales[F].getPixelForValue($))}R=C-v,O=R-h,k=t.left,_=t.right}const L=ct(r.ticks.maxTicksLimit,f),D=Math.max(1,Math.ceil(f/L));for(S=0;S<f;S+=D){const F=this.getContext(S),$=i.setContext(F),V=l.setContext(F),B=$.lineWidth,N=$.color,U=V.dash||[],ce=V.dashOffset,Q=$.tickWidth,H=$.tickColor,q=$.tickBorderDash||[],Y=$.tickBorderDashOffset;P=j$(this,S,c),P!==void 0&&(w=wi(o,P,B),d?R=O=k=_=w:M=E=I=A=w,g.push({tx1:R,ty1:M,tx2:O,ty2:E,x1:k,y1:I,x2:_,y2:A,width:B,color:N,borderDash:U,borderDashOffset:ce,tickWidth:Q,tickColor:H,tickBorderDash:q,tickBorderDashOffset:Y}))}return this._ticksLength=f,this._borderValue=C,g}_computeLabelItems(t){const n=this.axis,o=this.options,{position:r,ticks:i}=o,a=this.isHorizontal(),l=this.ticks,{align:c,crossAlign:d,padding:u,mirror:f}=i,h=xl(o.grid),g=h+u,m=f?-u:g,b=-Io(this.labelRotation),v=[];let x,C,S,P,w,R,M,O,E,k,I,_,A="middle";if(r==="top")R=this.bottom-m,M=this._getXAxisLabelAlignment();else if(r==="bottom")R=this.top+m,M=this._getXAxisLabelAlignment();else if(r==="left"){const D=this._getYAxisLabelAlignment(h);M=D.textAlign,w=D.x}else if(r==="right"){const D=this._getYAxisLabelAlignment(h);M=D.textAlign,w=D.x}else if(n==="x"){if(r==="center")R=(t.top+t.bottom)/2+g;else if(St(r)){const D=Object.keys(r)[0],F=r[D];R=this.chart.scales[D].getPixelForValue(F)+g}M=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")w=(t.left+t.right)/2-g;else if(St(r)){const D=Object.keys(r)[0],F=r[D];w=this.chart.scales[D].getPixelForValue(F)}M=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(c==="start"?A="top":c==="end"&&(A="bottom"));const L=this._getLabelSizes();for(x=0,C=l.length;x<C;++x){S=l[x],P=S.label;const D=i.setContext(this.getContext(x));O=this.getPixelForTick(x)+i.labelOffset,E=this._resolveTickFontOptions(x),k=E.lineHeight,I=Yt(P)?P.length:1;const F=I/2,$=D.color,V=D.textStrokeColor,B=D.textStrokeWidth;let N=M;a?(w=O,M==="inner"&&(x===C-1?N=this.options.reverse?"left":"right":x===0?N=this.options.reverse?"right":"left":N="center"),r==="top"?d==="near"||b!==0?_=-I*k+k/2:d==="center"?_=-L.highest.height/2-F*k+k:_=-L.highest.height+k/2:d==="near"||b!==0?_=k/2:d==="center"?_=L.highest.height/2-F*k:_=L.highest.height-I*k,f&&(_*=-1),b!==0&&!D.showLabelBackdrop&&(w+=k/2*Math.sin(b))):(R=O,_=(1-I)*k/2);let U;if(D.showLabelBackdrop){const ce=Mn(D.backdropPadding),Q=L.heights[x],H=L.widths[x];let q=_-ce.top,Y=0-ce.left;switch(A){case"middle":q-=Q/2;break;case"bottom":q-=Q;break}switch(M){case"center":Y-=H/2;break;case"right":Y-=H;break;case"inner":x===C-1?Y-=H:x>0&&(Y-=H/2);break}U={left:Y,top:q,width:H+ce.width,height:Q+ce.height,color:D.backdropColor}}v.push({label:P,font:E,textOffset:_,options:{rotation:b,color:$,strokeColor:V,strokeWidth:B,textAlign:N,textBaseline:A,translation:[w,R],backdrop:U}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-Io(this.labelRotation))return t==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:o,mirror:r,padding:i}}=this.options,a=this._getLabelSizes(),l=t+i,c=a.widest.width;let d,u;return n==="left"?r?(u=this.right+i,o==="near"?d="left":o==="center"?(d="center",u+=c/2):(d="right",u+=c)):(u=this.right-l,o==="near"?d="right":o==="center"?(d="center",u-=c/2):(d="left",u=this.left)):n==="right"?r?(u=this.left+i,o==="near"?d="right":o==="center"?(d="center",u-=c/2):(d="left",u-=c)):(u=this.left+l,o==="near"?d="left":o==="center"?(d="center",u+=c/2):(d="right",u=this.right)):d="right",{textAlign:d,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:o,top:r,width:i,height:a}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(o,r,i,a),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(i=>i.value===t);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(t){const n=this.options.grid,o=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let i,a;const l=(c,d,u)=>{!u.width||!u.color||(o.save(),o.lineWidth=u.width,o.strokeStyle=u.color,o.setLineDash(u.borderDash||[]),o.lineDashOffset=u.borderDashOffset,o.beginPath(),o.moveTo(c.x,c.y),o.lineTo(d.x,d.y),o.stroke(),o.restore())};if(n.display)for(i=0,a=r.length;i<a;++i){const c=r[i];n.drawOnChartArea&&l({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&l({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:o,grid:r}}=this,i=o.setContext(this.getContext()),a=o.display?i.width:0;if(!a)return;const l=r.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let d,u,f,h;this.isHorizontal()?(d=wi(t,this.left,a)-a/2,u=wi(t,this.right,l)+l/2,f=h=c):(f=wi(t,this.top,a)-a/2,h=wi(t,this.bottom,l)+l/2,d=u=c),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(d,f),n.lineTo(u,h),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const o=this.ctx,r=this._computeLabelArea();r&&Vd(o,r);const i=this.getLabelItems(t);for(const a of i){const l=a.options,c=a.font,d=a.label,u=a.textOffset;Si(o,d,0,u,c,l)}r&&Fd(o)}drawTitle(){const{ctx:t,options:{position:n,title:o,reverse:r}}=this;if(!o.display)return;const i=gn(o.font),a=Mn(o.padding),l=o.align;let c=i.lineHeight/2;n==="bottom"||n==="center"||St(n)?(c+=a.bottom,Yt(o.text)&&(c+=i.lineHeight*(o.text.length-1))):c+=a.top;const{titleX:d,titleY:u,maxWidth:f,rotation:h}=V$(this,c,n,l);Si(t,o.text,0,0,i,{color:o.color,maxWidth:f,rotation:h,textAlign:A$(l,n,r),textBaseline:"middle",translation:[d,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,o=ct(t.grid&&t.grid.z,-1),r=ct(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Ei.prototype.draw?[{z:n,draw:i=>{this.draw(i)}}]:[{z:o,draw:i=>{this.drawBackground(),this.drawGrid(i),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:i=>{this.drawLabels(i)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),o=this.axis+"AxisID",r=[];let i,a;for(i=0,a=n.length;i<a;++i){const l=n[i];l[o]===this.id&&(!t||l.type===t)&&r.push(l)}return r}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return gn(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Xd{constructor(t,n,o){this.type=t,this.scope=n,this.override=o,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let o;N$(n)&&(o=this.register(n));const r=this.items,i=t.id,a=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+t);return i in r||(r[i]=t,F$(t,a,o),this.override&&nn.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const n=this.items,o=t.id,r=this.scope;o in n&&delete n[o],r&&o in nn[r]&&(delete nn[r][o],this.override&&delete Ci[o])}}function F$(e,t,n){const o=Xo(Object.create(null),[n?nn.get(n):{},nn.get(t),e.defaults]);nn.set(t,o),e.defaultRoutes&&$$(t,e.defaultRoutes),e.descriptors&&nn.describe(t,e.descriptors)}function $$(e,t){Object.keys(t).forEach(n=>{const o=n.split("."),r=o.pop(),i=[e].concat(o).join("."),a=t[n].split("."),l=a.pop(),c=a.join(".");nn.route(i,r,c,l)})}function N$(e){return"id"in e&&"defaults"in e}class B${constructor(){this.controllers=new Xd(jo,"datasets",!0),this.elements=new Xd(xr,"elements"),this.plugins=new Xd(Object,"plugins"),this.scales=new Xd(Ei,"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,n,o){[...n].forEach(r=>{const i=o||this._getRegistryForType(r);o||i.isForType(r)||i===this.plugins&&r.id?this._exec(t,i,r):$t(r,a=>{const l=o||this._getRegistryForType(a);this._exec(t,l,a)})})}_exec(t,n,o){const r=of(t);Wt(o["before"+r],[],o),n[t](o),Wt(o["after"+r],[],o)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const o=this._typedRegistries[n];if(o.isForType(t))return o}return this.plugins}_get(t,n,o){const r=n.get(t);if(r===void 0)throw new Error('"'+t+'" is not a registered '+o+".");return r}}var Jo=new B$;class H${constructor(){this._init=[]}notify(t,n,o,r){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const i=r?this._descriptors(t).filter(r):this._descriptors(t),a=this._notify(i,t,n,o);return n==="afterDestroy"&&(this._notify(i,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,n,o,r){r=r||{};for(const i of t){const a=i.plugin,l=a[o],c=[n,r,i.options];if(Wt(l,c,a)===!1&&r.cancelable)return!1}return!0}invalidate(){yt(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const o=t&&t.config,r=ct(o.options&&o.options.plugins,{}),i=z$(o);return r===!1&&!n?[]:U$(t,i,r,n)}_notifyStateChanges(t){const n=this._oldCache||[],o=this._cache,r=(i,a)=>i.filter(l=>!a.some(c=>l.plugin.id===c.plugin.id));this._notify(r(n,o),t,"stop"),this._notify(r(o,n),t,"start")}}function z$(e){const t={},n=[],o=Object.keys(Jo.plugins.items);for(let i=0;i<o.length;i++)n.push(Jo.getPlugin(o[i]));const r=e.plugins||[];for(let i=0;i<r.length;i++){const a=r[i];n.indexOf(a)===-1&&(n.push(a),t[a.id]=!0)}return{plugins:n,localIds:t}}function W$(e,t){return!t&&e===!1?null:e===!0?{}:e}function U$(e,{plugins:t,localIds:n},o,r){const i=[],a=e.getContext();for(const l of t){const c=l.id,d=W$(o[c],r);d!==null&&i.push({plugin:l,options:Z$(e.config,{plugin:l,local:n[c]},d,a)})}return i}function Z$(e,{plugin:t,local:n},o,r){const i=e.pluginScopeKeys(t),a=e.getOptionScopes(o,i);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Of(e,t){const n=nn.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function q$(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function G$(e,t){return e===t?"_index_":"_value_"}function G4(e){if(e==="x"||e==="y"||e==="r")return e}function Y$(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function Ef(e,...t){if(G4(e))return e;for(const n of t){const o=n.axis||Y$(n.position)||e.length>1&&G4(e[0].toLowerCase());if(o)return o}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function Y4(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function K$(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(o=>o.xAxisID===e||o.yAxisID===e);if(n.length)return Y4(e,"x",n[0])||Y4(e,"y",n[0])}return{}}function X$(e,t){const n=Ci[e.type]||{scales:{}},o=t.scales||{},r=Of(e.type,t),i=Object.create(null);return Object.keys(o).forEach(a=>{const l=o[a];if(!St(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=Ef(a,l,K$(a,e),nn.scales[l.type]),d=G$(c,r),u=n.scales||{};i[a]=ol(Object.create(null),[{axis:c},l,u[c],u[d]])}),e.data.datasets.forEach(a=>{const l=a.type||e.type,c=a.indexAxis||Of(l,t),u=(Ci[l]||{}).scales||{};Object.keys(u).forEach(f=>{const h=q$(f,c),g=a[h+"AxisID"]||h;i[g]=i[g]||Object.create(null),ol(i[g],[{axis:h},o[g],u[f]])})}),Object.keys(i).forEach(a=>{const l=i[a];ol(l,[nn.scales[l.type],nn.scale])}),i}function K4(e){const t=e.options||(e.options={});t.plugins=ct(t.plugins,{}),t.scales=X$(e,t)}function X4(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Q$(e){return e=e||{},e.data=X4(e.data),K4(e),e}const Q4=new Map,J4=new Set;function Qd(e,t){let n=Q4.get(e);return n||(n=t(),Q4.set(e,n),J4.add(n)),n}const yl=(e,t,n)=>{const o=Nr(t,n);o!==void 0&&e.add(o)};class J${constructor(t){this._config=Q$(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=X4(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),K4(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Qd(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Qd(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Qd(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,o=this.type;return Qd(`${o}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const o=this._scopeCache;let r=o.get(t);return(!r||n)&&(r=new Map,o.set(t,r)),r}getOptionScopes(t,n,o){const{options:r,type:i}=this,a=this._cachedScopes(t,o),l=a.get(n);if(l)return l;const c=new Set;n.forEach(u=>{t&&(c.add(t),u.forEach(f=>yl(c,t,f))),u.forEach(f=>yl(c,r,f)),u.forEach(f=>yl(c,Ci[i]||{},f)),u.forEach(f=>yl(c,nn,f)),u.forEach(f=>yl(c,uf,f))});const d=Array.from(c);return d.length===0&&d.push(Object.create(null)),J4.has(n)&&a.set(n,d),d}chartOptionScopes(){const{options:t,type:n}=this;return[t,Ci[n]||{},nn.datasets[n]||{},{type:n},nn,uf]}resolveNamedOptions(t,n,o,r=[""]){const i={$shared:!0},{resolver:a,subPrefixes:l}=e7(this._resolverCache,t,r);let c=a;if(tN(a,n)){i.$shared=!1,o=Br(o)?o():o;const d=this.createResolver(t,o,l);c=Is(a,o,d)}for(const d of n)i[d]=c[d];return i}createResolver(t,n,o=[""],r){const{resolver:i}=e7(this._resolverCache,t,o);return St(n)?Is(i,n,void 0,r):i}}function e7(e,t,n){let o=e.get(t);o||(o=new Map,e.set(t,o));const r=n.join();let i=o.get(r);return i||(i={resolver:gf(t,n),subPrefixes:n.filter(l=>!l.toLowerCase().includes("hover"))},o.set(r,i)),i}const eN=e=>St(e)&&Object.getOwnPropertyNames(e).some(t=>Br(e[t]));function tN(e,t){const{isScriptable:n,isIndexable:o}=n4(e);for(const r of t){const i=n(r),a=o(r),l=(a||i)&&e[r];if(i&&(Br(l)||eN(l))||a&&Yt(l))return!0}return!1}var nN="4.4.4";const oN=["top","bottom","left","right","chartArea"];function t7(e,t){return e==="top"||e==="bottom"||oN.indexOf(e)===-1&&t==="x"}function n7(e,t){return function(n,o){return n[e]===o[e]?n[t]-o[t]:n[e]-o[e]}}function o7(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),Wt(n&&n.onComplete,[e],t)}function rN(e){const t=e.chart,n=t.options.animation;Wt(n&&n.onProgress,[e],t)}function r7(e){return vf()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Jd={},i7=e=>{const t=r7(e);return Object.values(Jd).filter(n=>n.canvas===t).pop()};function iN(e,t,n){const o=Object.keys(e);for(const r of o){const i=+r;if(i>=t){const a=e[r];delete e[r],(n>0||i>t)&&(e[i+n]=a)}}}function sN(e,t,n,o){return!n||e.type==="mouseout"?null:o?t:e}function eu(e,t,n){return e.options.clip?e[n]:t[n]}function aN(e,t){const{xScale:n,yScale:o}=e;return n&&o?{left:eu(n,t,"left"),right:eu(n,t,"right"),top:eu(o,t,"top"),bottom:eu(o,t,"bottom")}:t}let Cl=(Jr=class{static register(...t){Jo.add(...t),s7()}static unregister(...t){Jo.remove(...t),s7()}constructor(t,n){const o=this.config=new J$(n),r=r7(t),i=i7(r);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");const a=o.createResolver(o.chartOptionScopes(),this.getContext());this.platform=new(o.platform||T$(r)),this.platform.updateConfig(o);const l=this.platform.acquireContext(r,a.aspectRatio),c=l&&l.canvas,d=c&&c.height,u=c&&c.width;if(this.id=cV(),this.ctx=l,this.canvas=c,this.width=u,this.height=d,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 H$,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=PV(f=>this.update(f),a.resizeDelay||0),this._dataChanges=[],Jd[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}vr.listen(this,"complete",o7),vr.listen(this,"progress",rN),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:o,height:r,_aspectRatio:i}=this;return yt(t)?n&&i?i:r?o/r: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 Jo}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():d4(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return J6(this.canvas,this.ctx),this}stop(){return vr.stop(this),this}resize(t,n){vr.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const o=this.options,r=this.canvas,i=o.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(r,t,n,i),l=o.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,d4(this,l,!0)&&(this.notifyPlugins("resize",{size:a}),Wt(o.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};$t(n,(o,r)=>{o.id=r})}buildOrUpdateScales(){const t=this.options,n=t.scales,o=this.scales,r=Object.keys(o).reduce((a,l)=>(a[l]=!1,a),{});let i=[];n&&(i=i.concat(Object.keys(n).map(a=>{const l=n[a],c=Ef(a,l),d=c==="r",u=c==="x";return{options:l,dposition:d?"chartArea":u?"bottom":"left",dtype:d?"radialLinear":u?"category":"linear"}}))),$t(i,a=>{const l=a.options,c=l.id,d=Ef(c,l),u=ct(l.type,a.dtype);(l.position===void 0||t7(l.position,d)!==t7(a.dposition))&&(l.position=a.dposition),r[c]=!0;let f=null;if(c in o&&o[c].type===u)f=o[c];else{const h=Jo.getScale(u);f=new h({id:c,type:u,ctx:this.ctx,chart:this}),o[f.id]=f}f.init(l,t)}),$t(r,(a,l)=>{a||delete o[l]}),$t(o,a=>{In.configure(this,a,a.options),In.addBox(this,a)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,o=t.length;if(t.sort((r,i)=>r.index-i.index),o>n){for(let r=n;r<o;++r)this._destroyDatasetMeta(r);t.splice(n,o-n)}this._sortedMetasets=t.slice(0).sort(n7("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((o,r)=>{n.filter(i=>i===o._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let o,r;for(this._removeUnreferencedMetasets(),o=0,r=n.length;o<r;o++){const i=n[o];let a=this.getDatasetMeta(o);const l=i.type||this.config.type;if(a.type&&a.type!==l&&(this._destroyDatasetMeta(o),a=this.getDatasetMeta(o)),a.type=l,a.indexAxis=i.indexAxis||Of(l,this.options),a.order=i.order||0,a.index=o,a.label=""+i.label,a.visible=this.isDatasetVisible(o),a.controller)a.controller.updateIndex(o),a.controller.linkScales();else{const c=Jo.getController(l),{datasetElementType:d,dataElementType:u}=nn.datasets[l];Object.assign(c,{dataElementType:Jo.getElement(u),datasetElementType:d&&Jo.getElement(d)}),a.controller=new c(this,o),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){$t(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const o=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!o.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const i=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let d=0,u=this.data.datasets.length;d<u;d++){const{controller:f}=this.getDatasetMeta(d),h=!r&&i.indexOf(f)===-1;f.buildOrUpdateElements(h),a=Math.max(+f.getMaxOverflow(),a)}a=this._minPadding=o.layout.autoPadding?a:0,this._updateLayout(a),r||$t(i,d=>{d.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(n7("z","_idx"));const{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){$t(this.scales,t=>{In.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),o=new Set(t.events);(!L6(n,o)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:o,start:r,count:i}of n){const a=o==="_removeElements"?-i:i;iN(t,r,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,o=i=>new Set(t.filter(a=>a[0]===i).map((a,l)=>l+","+a.splice(1).join(","))),r=o(0);for(let i=1;i<n;i++)if(!L6(r,o(i)))return;return Array.from(r).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;In.update(this,this.width,this.height,t);const n=this.chartArea,o=n.width<=0||n.height<=0;this._layers=[],$t(this.boxes,r=>{o&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,i)=>{r._idx=i}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,o=this.data.datasets.length;n<o;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,o=this.data.datasets.length;n<o;++n)this._updateDataset(n,Br(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const o=this.getDatasetMeta(t),r={meta:o,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",r)!==!1&&(o.controller._update(n),r.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",r))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(vr.has(this)?this.attached&&!vr.running(this)&&vr.start(this):(this.draw(),o7({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:o,height:r}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(o,r)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,o=[];let r,i;for(r=0,i=n.length;r<i;++r){const a=n[r];(!t||a.visible)&&o.push(a)}return o}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,o=t._clip,r=!o.disabled,i=aN(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(r&&Vd(n,{left:o.left===!1?0:i.left-o.left,right:o.right===!1?this.width:i.right+o.right,top:o.top===!1?0:i.top-o.top,bottom:o.bottom===!1?this.height:i.bottom+o.bottom}),t.controller.draw(),r&&Fd(n),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return br(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,o,r){const i=o$.modes[n];return typeof i=="function"?i(this,t,o,r):[]}getDatasetMeta(t){const n=this.data.datasets[t],o=this._metasets;let r=o.filter(i=>i&&i._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},o.push(r)),r}getContext(){return this.$context||(this.$context=zr(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const o=this.getDatasetMeta(t);return typeof o.hidden=="boolean"?!o.hidden:!n.hidden}setDatasetVisibility(t,n){const o=this.getDatasetMeta(t);o.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,o){const r=o?"show":"hide",i=this.getDatasetMeta(t),a=i.controller._resolveAnimations(void 0,r);rl(n)?(i.data[n].hidden=!o,this.update()):(this.setDatasetVisibility(t,o),a.update(i,{visible:o}),this.update(l=>l.datasetIndex===t?r:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),vr.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),J6(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Jd[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,o=(i,a)=>{n.addEventListener(this,i,a),t[i]=a},r=(i,a,l)=>{i.offsetX=a,i.offsetY=l,this._eventHandler(i)};$t(this.options.events,i=>o(i,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,o=(c,d)=>{n.addEventListener(this,c,d),t[c]=d},r=(c,d)=>{t[c]&&(n.removeEventListener(this,c,d),delete t[c])},i=(c,d)=>{this.canvas&&this.resize(c,d)};let a;const l=()=>{r("attach",l),this.attached=!0,this.resize(),o("resize",i),o("detach",a)};a=()=>{this.attached=!1,r("resize",i),this._stop(),this._resize(0,0),o("attach",l)},n.isAttached(this.canvas)?l():a()}unbindEvents(){$t(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},$t(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,o){const r=o?"set":"remove";let i,a,l,c;for(n==="dataset"&&(i=this.getDatasetMeta(t[0].datasetIndex),i.controller["_"+r+"DatasetHoverStyle"]()),l=0,c=t.length;l<c;++l){a=t[l];const d=a&&this.getDatasetMeta(a.datasetIndex).controller;d&&d[r+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],o=t.map(({datasetIndex:i,index:a})=>{const l=this.getDatasetMeta(i);if(!l)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:l.data[a],index:a}});!Id(o,n)&&(this._active=o,this._lastEvent=null,this._updateHoverStyles(o,n))}notifyPlugins(t,n,o){return this._plugins.notify(this,t,n,o)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,o){const r=this.options.hover,i=(c,d)=>c.filter(u=>!d.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.index)),a=i(n,t),l=o?t:i(t,n);a.length&&this.updateHoverStyle(a,r.mode,!1),l.length&&r.mode&&this.updateHoverStyle(l,r.mode,!0)}_eventHandler(t,n){const o={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},r=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",o,r)===!1)return;const i=this._handleEvent(t,n,o.inChartArea);return o.cancelable=!1,this.notifyPlugins("afterEvent",o,r),(i||o.changed)&&this.render(),this}_handleEvent(t,n,o){const{_active:r=[],options:i}=this,a=n,l=this._getActiveElements(t,r,o,a),c=gV(t),d=sN(t,this._lastEvent,o,c);o&&(this._lastEvent=null,Wt(i.onHover,[t,l,this],this),c&&Wt(i.onClick,[t,l,this],this));const u=!Id(l,r);return(u||n)&&(this._active=l,this._updateHoverStyles(l,r,n)),this._lastEvent=d,u}_getActiveElements(t,n,o,r){if(t.type==="mouseout")return[];if(!o)return n;const i=this.options.hover;return this.getElementsAtEventForMode(t,i.mode,i,r)}},qe(Jr,"defaults",nn),qe(Jr,"instances",Jd),qe(Jr,"overrides",Ci),qe(Jr,"registry",Jo),qe(Jr,"version",nN),qe(Jr,"getChart",i7),Jr);function s7(){return $t(Cl.instances,e=>e._plugins.invalidate())}function lN(e,t,n){const{startAngle:o,pixelMargin:r,x:i,y:a,outerRadius:l,innerRadius:c}=t;let d=r/l;e.beginPath(),e.arc(i,a,l,o-d,n+d),c>r?(d=r/c,e.arc(i,a,c,n+d,o-d,!0)):e.arc(i,a,r,n+fn,o-fn),e.closePath(),e.clip()}function cN(e){return hf(e,["outerStart","outerEnd","innerStart","innerEnd"])}function dN(e,t,n,o){const r=cN(e.options.borderRadius),i=(n-t)/2,a=Math.min(i,o*t/2),l=c=>{const d=(n-Math.min(i,c))*o/2;return Sn(c,0,Math.min(i,d))};return{outerStart:l(r.outerStart),outerEnd:l(r.outerEnd),innerStart:Sn(r.innerStart,0,a),innerEnd:Sn(r.innerEnd,0,a)}}function Ds(e,t,n,o){return{x:n+e*Math.cos(t),y:o+e*Math.sin(t)}}function tu(e,t,n,o,r,i){const{x:a,y:l,startAngle:c,pixelMargin:d,innerRadius:u}=t,f=Math.max(t.outerRadius+o+n-d,0),h=u>0?u+o+n+d:0;let g=0;const m=r-c;if(o){const D=u>0?u-o:0,F=f>0?f-o:0,$=(D+F)/2,V=$!==0?m*$/($+o):m;g=(m-V)/2}const b=Math.max(.001,m*f-n/Kt)/f,v=(m-b)/2,x=c+v+g,C=r-v-g,{outerStart:S,outerEnd:P,innerStart:w,innerEnd:R}=dN(t,h,f,C-x),M=f-S,O=f-P,E=x+S/M,k=C-P/O,I=h+w,_=h+R,A=x+w/I,L=C-R/_;if(e.beginPath(),i){const D=(E+k)/2;if(e.arc(a,l,f,E,D),e.arc(a,l,f,D,k),P>0){const B=Ds(O,k,a,l);e.arc(B.x,B.y,P,k,C+fn)}const F=Ds(_,C,a,l);if(e.lineTo(F.x,F.y),R>0){const B=Ds(_,L,a,l);e.arc(B.x,B.y,R,C+fn,L+Math.PI)}const $=(C-R/h+(x+w/h))/2;if(e.arc(a,l,h,C-R/h,$,!0),e.arc(a,l,h,$,x+w/h,!0),w>0){const B=Ds(I,A,a,l);e.arc(B.x,B.y,w,A+Math.PI,x-fn)}const V=Ds(M,x,a,l);if(e.lineTo(V.x,V.y),S>0){const B=Ds(M,E,a,l);e.arc(B.x,B.y,S,x-fn,E)}}else{e.moveTo(a,l);const D=Math.cos(E)*f+a,F=Math.sin(E)*f+l;e.lineTo(D,F);const $=Math.cos(k)*f+a,V=Math.sin(k)*f+l;e.lineTo($,V)}e.closePath()}function uN(e,t,n,o,r){const{fullCircles:i,startAngle:a,circumference:l}=t;let c=t.endAngle;if(i){tu(e,t,n,o,c,r);for(let d=0;d<i;++d)e.fill();isNaN(l)||(c=a+(l%Xt||Xt))}return tu(e,t,n,o,c,r),e.fill(),c}function pN(e,t,n,o,r){const{fullCircles:i,startAngle:a,circumference:l,options:c}=t,{borderWidth:d,borderJoinStyle:u,borderDash:f,borderDashOffset:h}=c,g=c.borderAlign==="inner";if(!d)return;e.setLineDash(f||[]),e.lineDashOffset=h,g?(e.lineWidth=d*2,e.lineJoin=u||"round"):(e.lineWidth=d,e.lineJoin=u||"bevel");let m=t.endAngle;if(i){tu(e,t,n,o,m,r);for(let b=0;b<i;++b)e.stroke();isNaN(l)||(m=a+(l%Xt||Xt))}g&&lN(e,t,m),i||(tu(e,t,n,o,m,r),e.stroke())}class ki extends xr{constructor(n){super();qe(this,"circumference");qe(this,"endAngle");qe(this,"fullCircles");qe(this,"innerRadius");qe(this,"outerRadius");qe(this,"pixelMargin");qe(this,"startAngle");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,n&&Object.assign(this,n)}inRange(n,o,r){const i=this.getProps(["x","y"],r),{angle:a,distance:l}=N6(i,{x:n,y:o}),{startAngle:c,endAngle:d,innerRadius:u,outerRadius:f,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),g=(this.options.spacing+this.options.borderWidth)/2,m=ct(h,d-c),b=sl(a,c,d)&&c!==d,v=m>=Xt||b,x=gr(l,u+g,f+g);return v&&x}getCenterPoint(n){const{x:o,y:r,startAngle:i,endAngle:a,innerRadius:l,outerRadius:c}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:d,spacing:u}=this.options,f=(i+a)/2,h=(l+c+u+d)/2;return{x:o+Math.cos(f)*h,y:r+Math.sin(f)*h}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:o,circumference:r}=this,i=(o.offset||0)/4,a=(o.spacing||0)/2,l=o.circular;if(this.pixelMargin=o.borderAlign==="inner"?.33:0,this.fullCircles=r>Xt?Math.floor(r/Xt):0,r===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const c=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(c)*i,Math.sin(c)*i);const d=1-Math.sin(Math.min(Kt,r||0)),u=i*d;n.fillStyle=o.backgroundColor,n.strokeStyle=o.borderColor,uN(n,this,u,a,l),pN(n,this,u,a,l),n.restore()}}qe(ki,"id","arc"),qe(ki,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),qe(ki,"defaultRoutes",{backgroundColor:"backgroundColor"}),qe(ki,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function a7(e,t,n=t){e.lineCap=ct(n.borderCapStyle,t.borderCapStyle),e.setLineDash(ct(n.borderDash,t.borderDash)),e.lineDashOffset=ct(n.borderDashOffset,t.borderDashOffset),e.lineJoin=ct(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=ct(n.borderWidth,t.borderWidth),e.strokeStyle=ct(n.borderColor,t.borderColor)}function fN(e,t,n){e.lineTo(n.x,n.y)}function hN(e){return e.stepped?VV:e.tension||e.cubicInterpolationMode==="monotone"?FV:fN}function l7(e,t,n={}){const o=e.length,{start:r=0,end:i=o-1}=n,{start:a,end:l}=t,c=Math.max(r,a),d=Math.min(i,l),u=r<a&&i<a||r>l&&i>l;return{count:o,start:c,loop:t.loop,ilen:d<c&&!u?o+d-c:d-c}}function gN(e,t,n,o){const{points:r,options:i}=t,{count:a,start:l,loop:c,ilen:d}=l7(r,n,o),u=hN(i);let{move:f=!0,reverse:h}=o||{},g,m,b;for(g=0;g<=d;++g)m=r[(l+(h?d-g:g))%a],!m.skip&&(f?(e.moveTo(m.x,m.y),f=!1):u(e,b,m,h,i.stepped),b=m);return c&&(m=r[(l+(h?d:0))%a],u(e,b,m,h,i.stepped)),!!c}function mN(e,t,n,o){const r=t.points,{count:i,start:a,ilen:l}=l7(r,n,o),{move:c=!0,reverse:d}=o||{};let u=0,f=0,h,g,m,b,v,x;const C=P=>(a+(d?l-P:P))%i,S=()=>{b!==v&&(e.lineTo(u,v),e.lineTo(u,b),e.lineTo(u,x))};for(c&&(g=r[C(0)],e.moveTo(g.x,g.y)),h=0;h<=l;++h){if(g=r[C(h)],g.skip)continue;const P=g.x,w=g.y,R=P|0;R===m?(w<b?b=w:w>v&&(v=w),u=(f*u+P)/++f):(S(),e.lineTo(P,w),m=R,f=0,b=v=w),x=w}S()}function kf(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?mN:gN}function bN(e){return e.stepped?mF:e.tension||e.cubicInterpolationMode==="monotone"?bF:Ri}function vN(e,t,n,o){let r=t._path;r||(r=t._path=new Path2D,t.path(r,n,o)&&r.closePath()),a7(e,t.options),e.stroke(r)}function xN(e,t,n,o){const{segments:r,options:i}=t,a=kf(t);for(const l of r)a7(e,i,l.style),e.beginPath(),a(e,t,l,{start:n,end:n+o-1})&&e.closePath(),e.stroke()}const yN=typeof Path2D=="function";function CN(e,t,n,o){yN&&!t.options.segment?vN(e,t,n,o):xN(e,t,n,o)}class Ur extends xr{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,n){const o=this.options;if((o.tension||o.cubicInterpolationMode==="monotone")&&!o.stepped&&!this._pointsUpdated){const r=o.spanGaps?this._loop:this._fullLoop;lF(this._points,o,t,r,n),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=SF(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,o=t.length;return o&&n[t[o-1].end]}interpolate(t,n){const o=this.options,r=t[n],i=this.points,a=b4(this,{property:n,start:r,end:r});if(!a.length)return;const l=[],c=bN(o);let d,u;for(d=0,u=a.length;d<u;++d){const{start:f,end:h}=a[d],g=i[f],m=i[h];if(g===m){l.push(g);continue}const b=Math.abs((r-g[n])/(m[n]-g[n])),v=c(g,m,b,o.stepped);v[n]=t[n],l.push(v)}return l.length===1?l[0]:l}pathSegment(t,n,o){return kf(this)(t,this,n,o)}path(t,n,o){const r=this.segments,i=kf(this);let a=this._loop;n=n||0,o=o||this.points.length-n;for(const l of r)a&=i(t,this,l,{start:n,end:n+o-1});return!!a}draw(t,n,o,r){const i=this.options||{};(this.points||[]).length&&i.borderWidth&&(t.save(),CN(t,this,o,r),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}qe(Ur,"id","line"),qe(Ur,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),qe(Ur,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),qe(Ur,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function c7(e,t,n,o){const r=e.options,{[n]:i}=e.getProps([n],o);return Math.abs(t-i)<r.radius+r.hitRadius}class wl extends xr{constructor(n){super();qe(this,"parsed");qe(this,"skip");qe(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,o,r){const i=this.options,{x:a,y:l}=this.getProps(["x","y"],r);return Math.pow(n-a,2)+Math.pow(o-l,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(n,o){return c7(this,n,"x",o)}inYRange(n,o){return c7(this,n,"y",o)}getCenterPoint(n){const{x:o,y:r}=this.getProps(["x","y"],n);return{x:o,y:r}}size(n){n=n||this.options||{};let o=n.radius||0;o=Math.max(o,o&&n.hoverRadius||0);const r=o&&n.borderWidth||0;return(o+r)*2}draw(n,o){const r=this.options;this.skip||r.radius<.1||!br(this,o,this.size(r)/2)||(n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.fillStyle=r.backgroundColor,ff(n,r,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}qe(wl,"id","point"),qe(wl,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),qe(wl,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function d7(e,t){const{x:n,y:o,base:r,width:i,height:a}=e.getProps(["x","y","base","width","height"],t);let l,c,d,u,f;return e.horizontal?(f=a/2,l=Math.min(n,r),c=Math.max(n,r),d=o-f,u=o+f):(f=i/2,l=n-f,c=n+f,d=Math.min(o,r),u=Math.max(o,r)),{left:l,top:d,right:c,bottom:u}}function Zr(e,t,n,o){return e?0:Sn(t,n,o)}function wN(e,t,n){const o=e.options.borderWidth,r=e.borderSkipped,i=t4(o);return{t:Zr(r.top,i.top,0,n),r:Zr(r.right,i.right,0,t),b:Zr(r.bottom,i.bottom,0,n),l:Zr(r.left,i.left,0,t)}}function SN(e,t,n){const{enableBorderRadius:o}=e.getProps(["enableBorderRadius"]),r=e.options.borderRadius,i=Ti(r),a=Math.min(t,n),l=e.borderSkipped,c=o||St(r);return{topLeft:Zr(!c||l.top||l.left,i.topLeft,0,a),topRight:Zr(!c||l.top||l.right,i.topRight,0,a),bottomLeft:Zr(!c||l.bottom||l.left,i.bottomLeft,0,a),bottomRight:Zr(!c||l.bottom||l.right,i.bottomRight,0,a)}}function TN(e){const t=d7(e),n=t.right-t.left,o=t.bottom-t.top,r=wN(e,n/2,o/2),i=SN(e,n/2,o/2);return{outer:{x:t.left,y:t.top,w:n,h:o,radius:i},inner:{x:t.left+r.l,y:t.top+r.t,w:n-r.l-r.r,h:o-r.t-r.b,radius:{topLeft:Math.max(0,i.topLeft-Math.max(r.t,r.l)),topRight:Math.max(0,i.topRight-Math.max(r.t,r.r)),bottomLeft:Math.max(0,i.bottomLeft-Math.max(r.b,r.l)),bottomRight:Math.max(0,i.bottomRight-Math.max(r.b,r.r))}}}}function If(e,t,n,o){const r=t===null,i=n===null,l=e&&!(r&&i)&&d7(e,o);return l&&(r||gr(t,l.left,l.right))&&(i||gr(n,l.top,l.bottom))}function PN(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function MN(e,t){e.rect(t.x,t.y,t.w,t.h)}function jf(e,t,n={}){const o=e.x!==n.x?-t:0,r=e.y!==n.y?-t:0,i=(e.x+e.w!==n.x+n.w?t:0)-o,a=(e.y+e.h!==n.y+n.h?t:0)-r;return{x:e.x+o,y:e.y+r,w:e.w+i,h:e.h+a,radius:e.radius}}class Sl extends xr{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:o,backgroundColor:r}}=this,{inner:i,outer:a}=TN(this),l=PN(a.radius)?dl:MN;t.save(),(a.w!==i.w||a.h!==i.h)&&(t.beginPath(),l(t,jf(a,n,i)),t.clip(),l(t,jf(i,-n,a)),t.fillStyle=o,t.fill("evenodd")),t.beginPath(),l(t,jf(i,n)),t.fillStyle=r,t.fill(),t.restore()}inRange(t,n,o){return If(this,t,n,o)}inXRange(t,n){return If(this,t,null,n)}inYRange(t,n){return If(this,null,t,n)}getCenterPoint(t){const{x:n,y:o,base:r,horizontal:i}=this.getProps(["x","y","base","horizontal"],t);return{x:i?(n+r)/2:n,y:i?o:(o+r)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}qe(Sl,"id","bar"),qe(Sl,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),qe(Sl,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var RN=Object.freeze({__proto__:null,ArcElement:ki,BarElement:Sl,LineElement:Ur,PointElement:wl});const _f=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],u7=_f.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function p7(e){return _f[e%_f.length]}function f7(e){return u7[e%u7.length]}function ON(e,t){return e.borderColor=p7(t),e.backgroundColor=f7(t),++t}function EN(e,t){return e.backgroundColor=e.data.map(()=>p7(t++)),t}function kN(e,t){return e.backgroundColor=e.data.map(()=>f7(t++)),t}function IN(e){let t=0;return(n,o)=>{const r=e.getDatasetMeta(o).controller;r instanceof Wr?t=EN(n,t):r instanceof pl?t=kN(n,t):r&&(t=ON(n,t))}}function h7(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function jN(e){return e&&(e.borderColor||e.backgroundColor)}var _N={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(e,t,n){if(!n.enabled)return;const{data:{datasets:o},options:r}=e.config,{elements:i}=r;if(!n.forceOverride&&(h7(o)||jN(r)||i&&h7(i)))return;const a=IN(e);o.forEach(a)}};function DN(e,t,n,o,r){const i=r.samples||o;if(i>=n)return e.slice(t,t+n);const a=[],l=(n-2)/(i-2);let c=0;const d=t+n-1;let u=t,f,h,g,m,b;for(a[c++]=e[u],f=0;f<i-2;f++){let v=0,x=0,C;const S=Math.floor((f+1)*l)+1+t,P=Math.min(Math.floor((f+2)*l)+1,n)+t,w=P-S;for(C=S;C<P;C++)v+=e[C].x,x+=e[C].y;v/=w,x/=w;const R=Math.floor(f*l)+1+t,M=Math.min(Math.floor((f+1)*l)+1,n)+t,{x:O,y:E}=e[u];for(g=m=-1,C=R;C<M;C++)m=.5*Math.abs((O-v)*(e[C].y-E)-(O-e[C].x)*(x-E)),m>g&&(g=m,h=e[C],b=C);a[c++]=h,u=b}return a[c++]=e[d],a}function LN(e,t,n,o){let r=0,i=0,a,l,c,d,u,f,h,g,m,b;const v=[],x=t+n-1,C=e[t].x,P=e[x].x-C;for(a=t;a<t+n;++a){l=e[a],c=(l.x-C)/P*o,d=l.y;const w=c|0;if(w===u)d<m?(m=d,f=a):d>b&&(b=d,h=a),r=(i*r+l.x)/++i;else{const R=a-1;if(!yt(f)&&!yt(h)){const M=Math.min(f,h),O=Math.max(f,h);M!==g&&M!==R&&v.push({...e[M],x:r}),O!==g&&O!==R&&v.push({...e[O],x:r})}a>0&&R!==g&&v.push(e[R]),v.push(l),u=w,i=0,m=b=d,f=h=g=a}}return v}function g7(e){if(e._decimated){const t=e._data;delete e._decimated,delete e._data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function m7(e){e.data.datasets.forEach(t=>{g7(t)})}function AN(e,t){const n=t.length;let o=0,r;const{iScale:i}=e,{min:a,max:l,minDefined:c,maxDefined:d}=i.getUserBounds();return c&&(o=Sn(mr(t,i.axis,a).lo,0,n-1)),d?r=Sn(mr(t,i.axis,l).hi+1,o,n)-o:r=n-o,{start:o,count:r}}var VN={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){m7(e);return}const o=e.width;e.data.datasets.forEach((r,i)=>{const{_data:a,indexAxis:l}=r,c=e.getDatasetMeta(i),d=a||r.data;if(Qt([l,e.options.indexAxis])==="y"||!c.controller.supportsDecimation)return;const u=e.scales[c.xAxisID];if(u.type!=="linear"&&u.type!=="time"||e.options.parsing)return;let{start:f,count:h}=AN(c,d);const g=n.threshold||4*o;if(h<=g){g7(r);return}yt(a)&&(r._data=d,delete r.data,Object.defineProperty(r,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(b){this._data=b}}));let m;switch(n.algorithm){case"lttb":m=DN(d,f,h,o,n);break;case"min-max":m=LN(d,f,h,o);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}r._decimated=m})},destroy(e){m7(e)}};function FN(e,t,n){const o=e.segments,r=e.points,i=t.points,a=[];for(const l of o){let{start:c,end:d}=l;d=Lf(c,d,r);const u=Df(n,r[c],r[d],l.loop);if(!t.segments){a.push({source:l,target:u,start:r[c],end:r[d]});continue}const f=b4(t,u);for(const h of f){const g=Df(n,i[h.start],i[h.end],h.loop),m=m4(l,r,g);for(const b of m)a.push({source:b,target:h,start:{[n]:b7(u,g,"start",Math.max)},end:{[n]:b7(u,g,"end",Math.min)}})}}return a}function Df(e,t,n,o){if(o)return;let r=t[e],i=n[e];return e==="angle"&&(r=so(r),i=so(i)),{property:e,start:r,end:i}}function $N(e,t){const{x:n=null,y:o=null}=e||{},r=t.points,i=[];return t.segments.forEach(({start:a,end:l})=>{l=Lf(a,l,r);const c=r[a],d=r[l];o!==null?(i.push({x:c.x,y:o}),i.push({x:d.x,y:o})):n!==null&&(i.push({x:n,y:c.y}),i.push({x:n,y:d.y}))}),i}function Lf(e,t,n){for(;t>e;t--){const o=n[t];if(!isNaN(o.x)&&!isNaN(o.y))break}return t}function b7(e,t,n,o){return e&&t?o(e[n],t[n]):e?e[n]:t?t[n]:0}function v7(e,t){let n=[],o=!1;return Yt(e)?(o=!0,n=e):n=$N(e,t),n.length?new Ur({points:n,options:{tension:0},_loop:o,_fullLoop:o}):null}function x7(e){return e&&e.fill!==!1}function NN(e,t,n){let r=e[t].fill;const i=[t];let a;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!ln(r))return r;if(a=e[r],!a)return!1;if(a.visible)return r;i.push(r),r=a.fill}return!1}function BN(e,t,n){const o=UN(e);if(St(o))return isNaN(o.value)?!1:o;let r=parseFloat(o);return ln(r)&&Math.floor(r)===r?HN(o[0],t,r,n):["origin","start","end","stack","shape"].indexOf(o)>=0&&o}function HN(e,t,n,o){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=o?!1:n}function zN(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:St(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function WN(e,t,n){let o;return e==="start"?o=n:e==="end"?o=t.options.reverse?t.min:t.max:St(e)?o=e.value:o=t.getBaseValue(),o}function UN(e){const t=e.options,n=t.fill;let o=ct(n&&n.target,n);return o===void 0&&(o=!!t.backgroundColor),o===!1||o===null?!1:o===!0?"origin":o}function ZN(e){const{scale:t,index:n,line:o}=e,r=[],i=o.segments,a=o.points,l=qN(t,n);l.push(v7({x:null,y:t.bottom},o));for(let c=0;c<i.length;c++){const d=i[c];for(let u=d.start;u<=d.end;u++)GN(r,a[u],l)}return new Ur({points:r,options:{}})}function qN(e,t){const n=[],o=e.getMatchingVisibleMetas("line");for(let r=0;r<o.length;r++){const i=o[r];if(i.index===t)break;i.hidden||n.unshift(i.dataset)}return n}function GN(e,t,n){const o=[];for(let r=0;r<n.length;r++){const i=n[r],{first:a,last:l,point:c}=YN(i,t,"x");if(!(!c||a&&l)){if(a)o.unshift(c);else if(e.push(c),!l)break}}e.push(...o)}function YN(e,t,n){const o=e.interpolate(t,n);if(!o)return{};const r=o[n],i=e.segments,a=e.points;let l=!1,c=!1;for(let d=0;d<i.length;d++){const u=i[d],f=a[u.start][n],h=a[u.end][n];if(gr(r,f,h)){l=r===f,c=r===h;break}}return{first:l,last:c,point:o}}class y7{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,o){const{x:r,y:i,radius:a}=this;return n=n||{start:0,end:Xt},t.arc(r,i,a,n.end,n.start,!0),!o.bounds}interpolate(t){const{x:n,y:o,radius:r}=this,i=t.angle;return{x:n+Math.cos(i)*r,y:o+Math.sin(i)*r,angle:i}}}function KN(e){const{chart:t,fill:n,line:o}=e;if(ln(n))return XN(t,n);if(n==="stack")return ZN(e);if(n==="shape")return!0;const r=QN(e);return r instanceof y7?r:v7(r,o)}function XN(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function QN(e){return(e.scale||{}).getPointPositionForValue?eB(e):JN(e)}function JN(e){const{scale:t={},fill:n}=e,o=zN(n,t);if(ln(o)){const r=t.isHorizontal();return{x:r?o:null,y:r?null:o}}return null}function eB(e){const{scale:t,fill:n}=e,o=t.options,r=t.getLabels().length,i=o.reverse?t.max:t.min,a=WN(n,t,i),l=[];if(o.grid.circular){const c=t.getPointPositionForValue(0,i);return new y7({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(a)})}for(let c=0;c<r;++c)l.push(t.getPointPositionForValue(c,a));return l}function Af(e,t,n){const o=KN(t),{line:r,scale:i,axis:a}=t,l=r.options,c=l.fill,d=l.backgroundColor,{above:u=d,below:f=d}=c||{};o&&r.points.length&&(Vd(e,n),tB(e,{line:r,target:o,above:u,below:f,area:n,scale:i,axis:a}),Fd(e))}function tB(e,t){const{line:n,target:o,above:r,below:i,area:a,scale:l}=t,c=n._loop?"angle":t.axis;e.save(),c==="x"&&i!==r&&(C7(e,o,a.top),w7(e,{line:n,target:o,color:r,scale:l,property:c}),e.restore(),e.save(),C7(e,o,a.bottom)),w7(e,{line:n,target:o,color:i,scale:l,property:c}),e.restore()}function C7(e,t,n){const{segments:o,points:r}=t;let i=!0,a=!1;e.beginPath();for(const l of o){const{start:c,end:d}=l,u=r[c],f=r[Lf(c,d,r)];i?(e.moveTo(u.x,u.y),i=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),a=!!t.pathSegment(e,l,{move:a}),a?e.closePath():e.lineTo(f.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function w7(e,t){const{line:n,target:o,property:r,color:i,scale:a}=t,l=FN(n,o,r);for(const{source:c,target:d,start:u,end:f}of l){const{style:{backgroundColor:h=i}={}}=c,g=o!==!0;e.save(),e.fillStyle=h,nB(e,a,g&&Df(r,u,f)),e.beginPath();const m=!!n.pathSegment(e,c);let b;if(g){m?e.closePath():S7(e,o,f,r);const v=!!o.pathSegment(e,d,{move:m,reverse:!0});b=m&&v,b||S7(e,o,u,r)}e.closePath(),e.fill(b?"evenodd":"nonzero"),e.restore()}}function nB(e,t,n){const{top:o,bottom:r}=t.chart.chartArea,{property:i,start:a,end:l}=n||{};i==="x"&&(e.beginPath(),e.rect(a,o,l-a,r-o),e.clip())}function S7(e,t,n,o){const r=t.interpolate(n,o);r&&e.lineTo(r.x,r.y)}var oB={id:"filler",afterDatasetsUpdate(e,t,n){const o=(e.data.datasets||[]).length,r=[];let i,a,l,c;for(a=0;a<o;++a)i=e.getDatasetMeta(a),l=i.dataset,c=null,l&&l.options&&l instanceof Ur&&(c={visible:e.isDatasetVisible(a),index:a,fill:BN(l,a,o),chart:e,axis:i.controller.options.indexAxis,scale:i.vScale,line:l}),i.$filler=c,r.push(c);for(a=0;a<o;++a)c=r[a],!(!c||c.fill===!1)&&(c.fill=NN(r,a,n.propagate))},beforeDraw(e,t,n){const o=n.drawTime==="beforeDraw",r=e.getSortedVisibleDatasetMetas(),i=e.chartArea;for(let a=r.length-1;a>=0;--a){const l=r[a].$filler;l&&(l.line.updateControlPoints(i,l.axis),o&&l.fill&&Af(e.ctx,l,i))}},beforeDatasetsDraw(e,t,n){if(n.drawTime!=="beforeDatasetsDraw")return;const o=e.getSortedVisibleDatasetMetas();for(let r=o.length-1;r>=0;--r){const i=o[r].$filler;x7(i)&&Af(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,n){const o=t.meta.$filler;!x7(o)||n.drawTime!=="beforeDatasetDraw"||Af(e.ctx,o,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const T7=(e,t)=>{let{boxHeight:n=t,boxWidth:o=t}=e;return e.usePointStyle&&(n=Math.min(n,t),o=e.pointStyleWidth||Math.min(o,t)),{boxWidth:o,boxHeight:n,itemHeight:Math.max(t,n)}},rB=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;let P7=class extends xr{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,n,o){this.maxWidth=t,this.maxHeight=n,this._margins=o,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=Wt(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(o=>t.filter(o,this.chart.data))),t.sort&&(n=n.sort((o,r)=>t.sort(o,r,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const o=t.labels,r=gn(o.font),i=r.size,a=this._computeTitleHeight(),{boxWidth:l,itemHeight:c}=T7(o,i);let d,u;n.font=r.string,this.isHorizontal()?(d=this.maxWidth,u=this._fitRows(a,i,l,c)+10):(u=this.maxHeight,d=this._fitCols(a,r,l,c)+10),this.width=Math.min(d,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,o,r){const{ctx:i,maxWidth:a,options:{labels:{padding:l}}}=this,c=this.legendHitBoxes=[],d=this.lineWidths=[0],u=r+l;let f=t;i.textAlign="left",i.textBaseline="middle";let h=-1,g=-u;return this.legendItems.forEach((m,b)=>{const v=o+n/2+i.measureText(m.text).width;(b===0||d[d.length-1]+v+2*l>a)&&(f+=u,d[d.length-(b>0?0:1)]=0,g+=u,h++),c[b]={left:0,top:g,row:h,width:v,height:r},d[d.length-1]+=v+l}),f}_fitCols(t,n,o,r){const{ctx:i,maxHeight:a,options:{labels:{padding:l}}}=this,c=this.legendHitBoxes=[],d=this.columnSizes=[],u=a-t;let f=l,h=0,g=0,m=0,b=0;return this.legendItems.forEach((v,x)=>{const{itemWidth:C,itemHeight:S}=iB(o,n,i,v,r);x>0&&g+S+2*l>u&&(f+=h+l,d.push({width:h,height:g}),m+=h+l,b++,h=g=0),c[x]={left:m,top:g,col:b,width:C,height:S},h=Math.max(h,C),g+=S+l}),f+=h,d.push({width:h,height:g}),f}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:o,labels:{padding:r},rtl:i}}=this,a=_s(i,this.left,this.width);if(this.isHorizontal()){let l=0,c=kn(o,this.left+r,this.right-this.lineWidths[l]);for(const d of n)l!==d.row&&(l=d.row,c=kn(o,this.left+r,this.right-this.lineWidths[l])),d.top+=this.top+t+r,d.left=a.leftForLtr(a.x(c),d.width),c+=d.width+r}else{let l=0,c=kn(o,this.top+t+r,this.bottom-this.columnSizes[l].height);for(const d of n)d.col!==l&&(l=d.col,c=kn(o,this.top+t+r,this.bottom-this.columnSizes[l].height)),d.top=c,d.left+=this.left+r,d.left=a.leftForLtr(a.x(d.left),d.width),c+=d.height+r}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;Vd(t,this),this._draw(),Fd(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:o,ctx:r}=this,{align:i,labels:a}=t,l=nn.color,c=_s(t.rtl,this.left,this.width),d=gn(a.font),{padding:u}=a,f=d.size,h=f/2;let g;this.drawTitle(),r.textAlign=c.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=d.string;const{boxWidth:m,boxHeight:b,itemHeight:v}=T7(a,f),x=function(R,M,O){if(isNaN(m)||m<=0||isNaN(b)||b<0)return;r.save();const E=ct(O.lineWidth,1);if(r.fillStyle=ct(O.fillStyle,l),r.lineCap=ct(O.lineCap,"butt"),r.lineDashOffset=ct(O.lineDashOffset,0),r.lineJoin=ct(O.lineJoin,"miter"),r.lineWidth=E,r.strokeStyle=ct(O.strokeStyle,l),r.setLineDash(ct(O.lineDash,[])),a.usePointStyle){const k={radius:b*Math.SQRT2/2,pointStyle:O.pointStyle,rotation:O.rotation,borderWidth:E},I=c.xPlus(R,m/2),_=M+h;e4(r,k,I,_,a.pointStyleWidth&&m)}else{const k=M+Math.max((f-b)/2,0),I=c.leftForLtr(R,m),_=Ti(O.borderRadius);r.beginPath(),Object.values(_).some(A=>A!==0)?dl(r,{x:I,y:k,w:m,h:b,radius:_}):r.rect(I,k,m,b),r.fill(),E!==0&&r.stroke()}r.restore()},C=function(R,M,O){Si(r,O.text,R,M+v/2,d,{strikethrough:O.hidden,textAlign:c.textAlign(O.textAlign)})},S=this.isHorizontal(),P=this._computeTitleHeight();S?g={x:kn(i,this.left+u,this.right-o[0]),y:this.top+u+P,line:0}:g={x:this.left+u,y:kn(i,this.top+P+u,this.bottom-n[0].height),line:0},p4(this.ctx,t.textDirection);const w=v+u;this.legendItems.forEach((R,M)=>{r.strokeStyle=R.fontColor,r.fillStyle=R.fontColor;const O=r.measureText(R.text).width,E=c.textAlign(R.textAlign||(R.textAlign=a.textAlign)),k=m+h+O;let I=g.x,_=g.y;c.setWidth(this.width),S?M>0&&I+k+u>this.right&&(_=g.y+=w,g.line++,I=g.x=kn(i,this.left+u,this.right-o[g.line])):M>0&&_+w>this.bottom&&(I=g.x=I+n[g.line].width+u,g.line++,_=g.y=kn(i,this.top+P+u,this.bottom-n[g.line].height));const A=c.x(I);if(x(A,_,R),I=MV(E,I+m+h,S?I+k:this.right,t.rtl),C(c.x(I),_,R),S)g.x+=k+u;else if(typeof R.text!="string"){const L=d.lineHeight;g.y+=M7(R,L)+u}else g.y+=w}),f4(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,o=gn(n.font),r=Mn(n.padding);if(!n.display)return;const i=_s(t.rtl,this.left,this.width),a=this.ctx,l=n.position,c=o.size/2,d=r.top+c;let u,f=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+d,f=kn(t.align,f,this.right-h);else{const m=this.columnSizes.reduce((b,v)=>Math.max(b,v.height),0);u=d+kn(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const g=kn(l,f,f+h);a.textAlign=i.textAlign(lf(l)),a.textBaseline="middle",a.strokeStyle=n.color,a.fillStyle=n.color,a.font=o.string,Si(a,n.text,g,u,o)}_computeTitleHeight(){const t=this.options.title,n=gn(t.font),o=Mn(t.padding);return t.display?n.lineHeight+o.height:0}_getLegendItemAt(t,n){let o,r,i;if(gr(t,this.left,this.right)&&gr(n,this.top,this.bottom)){for(i=this.legendHitBoxes,o=0;o<i.length;++o)if(r=i[o],gr(t,r.left,r.left+r.width)&&gr(n,r.top,r.top+r.height))return this.legendItems[o]}return null}handleEvent(t){const n=this.options;if(!lB(t.type,n))return;const o=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const r=this._hoveredItem,i=rB(r,o);r&&!i&&Wt(n.onLeave,[t,r,this],this),this._hoveredItem=o,o&&!i&&Wt(n.onHover,[t,o,this],this)}else o&&Wt(n.onClick,[t,o,this],this)}};function iB(e,t,n,o,r){const i=sB(o,e,t,n),a=aB(r,o,t.lineHeight);return{itemWidth:i,itemHeight:a}}function sB(e,t,n,o){let r=e.text;return r&&typeof r!="string"&&(r=r.reduce((i,a)=>i.length>a.length?i:a)),t+n.size/2+o.measureText(r).width}function aB(e,t,n){let o=e;return typeof t.text!="string"&&(o=M7(t,n)),o}function M7(e,t){const n=e.text?e.text.length:0;return t*n}function lB(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var cB={id:"legend",_element:P7,start(e,t,n){const o=e.legend=new P7({ctx:e.ctx,options:n,chart:e});In.configure(e,o,n),In.addBox(e,o)},stop(e){In.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const o=e.legend;In.configure(e,o,n),o.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const o=t.datasetIndex,r=n.chart;r.isDatasetVisible(o)?(r.hide(o),t.hidden=!0):(r.show(o),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:o,textAlign:r,color:i,useBorderRadius:a,borderRadius:l}}=e.legend.options;return e._getSortedDatasetMetas().map(c=>{const d=c.controller.getStyle(n?0:void 0),u=Mn(d.borderWidth);return{text:t[c.index].label,fillStyle:d.backgroundColor,fontColor:i,hidden:!c.visible,lineCap:d.borderCapStyle,lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:d.borderColor,pointStyle:o||d.pointStyle,rotation:d.rotation,textAlign:r||d.textAlign,borderRadius:a&&(l||d.borderRadius),datasetIndex:c.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class Vf extends xr{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,n){const o=this.options;if(this.left=0,this.top=0,!o.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const r=Yt(o.text)?o.text.length:1;this._padding=Mn(o.padding);const i=r*gn(o.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=i:this.width=i}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:o,bottom:r,right:i,options:a}=this,l=a.align;let c=0,d,u,f;return this.isHorizontal()?(u=kn(l,o,i),f=n+t,d=i-o):(a.position==="left"?(u=o+t,f=kn(l,r,n),c=Kt*-.5):(u=i-t,f=kn(l,n,r),c=Kt*.5),d=r-n),{titleX:u,titleY:f,maxWidth:d,rotation:c}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const o=gn(n.font),i=o.lineHeight/2+this._padding.top,{titleX:a,titleY:l,maxWidth:c,rotation:d}=this._drawArgs(i);Si(t,n.text,0,0,o,{color:n.color,maxWidth:c,rotation:d,textAlign:lf(n.align),textBaseline:"middle",translation:[a,l]})}}function dB(e,t){const n=new Vf({ctx:e.ctx,options:t,chart:e});In.configure(e,n,t),In.addBox(e,n),e.titleBlock=n}var uB={id:"title",_element:Vf,start(e,t,n){dB(e,n)},stop(e){const t=e.titleBlock;In.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const o=e.titleBlock;In.configure(e,o,n),o.options=n},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}};const nu=new WeakMap;var pB={id:"subtitle",start(e,t,n){const o=new Vf({ctx:e.ctx,options:n,chart:e});In.configure(e,o,n),In.addBox(e,o),nu.set(e,o)},stop(e){In.removeBox(e,nu.get(e)),nu.delete(e)},beforeUpdate(e,t,n){const o=nu.get(e);In.configure(e,o,n),o.options=n},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}};const Tl={average(e){if(!e.length)return!1;let t,n,o=new Set,r=0,i=0;for(t=0,n=e.length;t<n;++t){const l=e[t].element;if(l&&l.hasValue()){const c=l.tooltipPosition();o.add(c.x),r+=c.y,++i}}return i===0||o.size===0?!1:{x:[...o].reduce((l,c)=>l+c)/o.size,y:r/i}},nearest(e,t){if(!e.length)return!1;let n=t.x,o=t.y,r=Number.POSITIVE_INFINITY,i,a,l;for(i=0,a=e.length;i<a;++i){const c=e[i].element;if(c&&c.hasValue()){const d=c.getCenterPoint(),u=sf(t,d);u<r&&(r=u,l=c)}}if(l){const c=l.tooltipPosition();n=c.x,o=c.y}return{x:n,y:o}}};function er(e,t){return t&&(Yt(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function yr(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
|
|
367
367
|
`)>-1?e.split(`
|
|
368
|
-
`):e}function fB(e,t){const{element:n,datasetIndex:o,index:r}=t,i=e.getDatasetMeta(o).controller,{label:a,value:l}=i.getLabelAndValue(r);return{chart:e,label:a,parsed:i.getParsed(r),raw:e.data.datasets[o].data[r],formattedValue:l,dataset:i.getDataset(),dataIndex:r,datasetIndex:o,element:n}}function R7(e,t){const n=e.chart.ctx,{body:o,footer:r,title:i}=e,{boxWidth:a,boxHeight:l}=t,c=gn(t.bodyFont),d=gn(t.titleFont),u=gn(t.footerFont),f=i.length,h=r.length,g=o.length,m=Mn(t.padding);let b=m.height,v=0,x=o.reduce((P,w)=>P+w.before.length+w.lines.length+w.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,f&&(b+=f*d.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),x){const P=t.displayColors?Math.max(l,c.lineHeight):c.lineHeight;b+=g*P+(x-g)*c.lineHeight+(x-1)*t.bodySpacing}h&&(b+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let C=0;const S=function(P){v=Math.max(v,n.measureText(P).width+C)};return n.save(),n.font=d.string,$t(e.title,S),n.font=c.string,$t(e.beforeBody.concat(e.afterBody),S),C=t.displayColors?a+2+t.boxPadding:0,$t(o,P=>{$t(P.before,S),$t(P.lines,S),$t(P.after,S)}),C=0,n.font=u.string,$t(e.footer,S),n.restore(),v+=m.width,{width:v,height:b}}function hB(e,t){const{y:n,height:o}=t;return n<o/2?"top":n>e.height-o/2?"bottom":"center"}function gB(e,t,n,o){const{x:r,width:i}=o,a=n.caretSize+n.caretPadding;if(e==="left"&&r+i+a>t.width||e==="right"&&r-i-a<0)return!0}function mB(e,t,n,o){const{x:r,width:i}=n,{width:a,chartArea:{left:l,right:c}}=e;let d="center";return o==="center"?d=r<=(l+c)/2?"left":"right":r<=i/2?d="left":r>=a-i/2&&(d="right"),gB(d,e,t,n)&&(d="center"),d}function O7(e,t,n){const o=n.yAlign||t.yAlign||hB(e,n);return{xAlign:n.xAlign||t.xAlign||mB(e,t,n,o),yAlign:o}}function bB(e,t){let{x:n,width:o}=e;return t==="right"?n-=o:t==="center"&&(n-=o/2),n}function vB(e,t,n){let{y:o,height:r}=e;return t==="top"?o+=n:t==="bottom"?o-=r+n:o-=r/2,o}function E7(e,t,n,o){const{caretSize:r,caretPadding:i,cornerRadius:a}=e,{xAlign:l,yAlign:c}=n,d=r+i,{topLeft:u,topRight:f,bottomLeft:h,bottomRight:g}=Ti(a);let m=bB(t,l);const b=vB(t,c,d);return c==="center"?l==="left"?m+=d:l==="right"&&(m-=d):l==="left"?m-=Math.max(u,h)+r:l==="right"&&(m+=Math.max(f,g)+r),{x:Sn(m,0,o.width-t.width),y:Sn(b,0,o.height-t.height)}}function ou(e,t,n){const o=Mn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-o.right:e.x+o.left}function k7(e){return er([],yr(e))}function xB(e,t,n){return zr(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function I7(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const j7={beforeTitle:hr,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,o=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(o>0&&t.dataIndex<o)return n[t.dataIndex]}return""},afterTitle:hr,beforeBody:hr,beforeLabel:hr,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return yt(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:hr,afterBody:hr,beforeFooter:hr,footer:hr,afterFooter:hr};function Zn(e,t,n,o){const r=e[t].call(n,o);return typeof r>"u"?j7[t].call(n,o):r}class Ff extends xr{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,o=this.options.setContext(this.getContext()),r=o.enabled&&n.options.animation&&o.animations,i=new C4(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=xB(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:o}=n,r=Zn(o,"beforeTitle",this,t),i=Zn(o,"title",this,t),a=Zn(o,"afterTitle",this,t);let l=[];return l=er(l,yr(r)),l=er(l,yr(i)),l=er(l,yr(a)),l}getBeforeBody(t,n){return k7(Zn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:o}=n,r=[];return $t(t,i=>{const a={before:[],lines:[],after:[]},l=I7(o,i);er(a.before,yr(Zn(l,"beforeLabel",this,i))),er(a.lines,Zn(l,"label",this,i)),er(a.after,yr(Zn(l,"afterLabel",this,i))),r.push(a)}),r}getAfterBody(t,n){return k7(Zn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:o}=n,r=Zn(o,"beforeFooter",this,t),i=Zn(o,"footer",this,t),a=Zn(o,"afterFooter",this,t);let l=[];return l=er(l,yr(r)),l=er(l,yr(i)),l=er(l,yr(a)),l}_createItems(t){const n=this._active,o=this.chart.data,r=[],i=[],a=[];let l=[],c,d;for(c=0,d=n.length;c<d;++c)l.push(fB(this.chart,n[c]));return t.filter&&(l=l.filter((u,f,h)=>t.filter(u,f,h,o))),t.itemSort&&(l=l.sort((u,f)=>t.itemSort(u,f,o))),$t(l,u=>{const f=I7(t.callbacks,u);r.push(Zn(f,"labelColor",this,u)),i.push(Zn(f,"labelPointStyle",this,u)),a.push(Zn(f,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=l,l}update(t,n){const o=this.options.setContext(this.getContext()),r=this._active;let i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{const l=Tl[o.position].call(this,r,this._eventPosition);a=this._createItems(o),this.title=this.getTitle(a,o),this.beforeBody=this.getBeforeBody(a,o),this.body=this.getBody(a,o),this.afterBody=this.getAfterBody(a,o),this.footer=this.getFooter(a,o);const c=this._size=R7(this,o),d=Object.assign({},l,c),u=O7(this.chart,o,d),f=E7(o,d,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:f.x,y:f.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&o.external&&o.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,o,r){const i=this.getCaretPosition(t,o,r);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(t,n,o){const{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:l}=o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=Ti(l),{x:h,y:g}=t,{width:m,height:b}=n;let v,x,C,S,P,w;return i==="center"?(P=g+b/2,r==="left"?(v=h,x=v-a,S=P+a,w=P-a):(v=h+m,x=v+a,S=P-a,w=P+a),C=v):(r==="left"?x=h+Math.max(c,u)+a:r==="right"?x=h+m-Math.max(d,f)-a:x=this.caretX,i==="top"?(S=g,P=S-a,v=x-a,C=x+a):(S=g+b,P=S+a,v=x+a,C=x-a),w=S),{x1:v,x2:x,x3:C,y1:S,y2:P,y3:w}}drawTitle(t,n,o){const r=this.title,i=r.length;let a,l,c;if(i){const d=_s(o.rtl,this.x,this.width);for(t.x=ou(this,o.titleAlign,o),n.textAlign=d.textAlign(o.titleAlign),n.textBaseline="middle",a=gn(o.titleFont),l=o.titleSpacing,n.fillStyle=o.titleColor,n.font=a.string,c=0;c<i;++c)n.fillText(r[c],d.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+l,c+1===i&&(t.y+=o.titleMarginBottom-l)}}_drawColorBox(t,n,o,r,i){const a=this.labelColors[o],l=this.labelPointStyles[o],{boxHeight:c,boxWidth:d}=i,u=gn(i.bodyFont),f=ou(this,"left",i),h=r.x(f),g=c<u.lineHeight?(u.lineHeight-c)/2:0,m=n.y+g;if(i.usePointStyle){const b={radius:Math.min(d,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},v=r.leftForLtr(h,d)+d/2,x=m+c/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,ff(t,b,v,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,ff(t,b,v,x)}else{t.lineWidth=St(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const b=r.leftForLtr(h,d),v=r.leftForLtr(r.xPlus(h,1),d-2),x=Ti(a.borderRadius);Object.values(x).some(C=>C!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,dl(t,{x:b,y:m,w:d,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),dl(t,{x:v,y:m+1,w:d-2,h:c-2,radius:x}),t.fill()):(t.fillStyle=i.multiKeyBackground,t.fillRect(b,m,d,c),t.strokeRect(b,m,d,c),t.fillStyle=a.backgroundColor,t.fillRect(v,m+1,d-2,c-2))}t.fillStyle=this.labelTextColors[o]}drawBody(t,n,o){const{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:d,boxPadding:u}=o,f=gn(o.bodyFont);let h=f.lineHeight,g=0;const m=_s(o.rtl,this.x,this.width),b=function(O){n.fillText(O,m.x(t.x+g),t.y+h/2),t.y+=h+i},v=m.textAlign(a);let x,C,S,P,w,R,M;for(n.textAlign=a,n.textBaseline="middle",n.font=f.string,t.x=ou(this,v,o),n.fillStyle=o.bodyColor,$t(this.beforeBody,b),g=l&&v!=="right"?a==="center"?d/2+u:d+2+u:0,P=0,R=r.length;P<R;++P){for(x=r[P],C=this.labelTextColors[P],n.fillStyle=C,$t(x.before,b),S=x.lines,l&&S.length&&(this._drawColorBox(n,t,P,m,o),h=Math.max(f.lineHeight,c)),w=0,M=S.length;w<M;++w)b(S[w]),h=f.lineHeight;$t(x.after,b)}g=0,h=f.lineHeight,$t(this.afterBody,b),t.y-=i}drawFooter(t,n,o){const r=this.footer,i=r.length;let a,l;if(i){const c=_s(o.rtl,this.x,this.width);for(t.x=ou(this,o.footerAlign,o),t.y+=o.footerMarginTop,n.textAlign=c.textAlign(o.footerAlign),n.textBaseline="middle",a=gn(o.footerFont),n.fillStyle=o.footerColor,n.font=a.string,l=0;l<i;++l)n.fillText(r[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o.footerSpacing}}drawBackground(t,n,o,r){const{xAlign:i,yAlign:a}=this,{x:l,y:c}=t,{width:d,height:u}=o,{topLeft:f,topRight:h,bottomLeft:g,bottomRight:m}=Ti(r.cornerRadius);n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.beginPath(),n.moveTo(l+f,c),a==="top"&&this.drawCaret(t,n,o,r),n.lineTo(l+d-h,c),n.quadraticCurveTo(l+d,c,l+d,c+h),a==="center"&&i==="right"&&this.drawCaret(t,n,o,r),n.lineTo(l+d,c+u-m),n.quadraticCurveTo(l+d,c+u,l+d-m,c+u),a==="bottom"&&this.drawCaret(t,n,o,r),n.lineTo(l+g,c+u),n.quadraticCurveTo(l,c+u,l,c+u-g),a==="center"&&i==="left"&&this.drawCaret(t,n,o,r),n.lineTo(l,c+f),n.quadraticCurveTo(l,c,l+f,c),n.closePath(),n.fill(),r.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,o=this.$animations,r=o&&o.x,i=o&&o.y;if(r||i){const a=Tl[t.position].call(this,this._active,this._eventPosition);if(!a)return;const l=this._size=R7(this,t),c=Object.assign({},a,this._size),d=O7(n,t,c),u=E7(t,c,d,n);(r._to!==u.x||i._to!==u.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let o=this.opacity;if(!o)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},i={x:this.x,y:this.y};o=Math.abs(o)<.001?0:o;const a=Mn(n.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&l&&(t.save(),t.globalAlpha=o,this.drawBackground(i,t,r,n),p4(t,n.textDirection),i.y+=a.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),f4(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const o=this._active,r=t.map(({datasetIndex:l,index:c})=>{const d=this.chart.getDatasetMeta(l);if(!d)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:d.data[c],index:c}}),i=!Id(o,r),a=this._positionChanged(r,n);(i||a)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,o=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,i=this._active||[],a=this._getActiveElements(t,i,n,o),l=this._positionChanged(a,t),c=n||!Id(a,i)||l;return c&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,o,r){const i=this.options;if(t.type==="mouseout")return[];if(!r)return n.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,i.mode,i,o);return i.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:o,caretY:r,options:i}=this,a=Tl[i.position].call(this,t,n);return a!==!1&&(o!==a.x||r!==a.y)}}qe(Ff,"positioners",Tl);var yB={id:"tooltip",_element:Ff,positioners:Tl,afterInit(e,t,n){n&&(e.tooltip=new Ff({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,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:(e,t)=>t.bodyFont.size,boxWidth:(e,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:j7},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},CB=Object.freeze({__proto__:null,Colors:_N,Decimation:VN,Filler:oB,Legend:cB,SubTitle:pB,Title:uB,Tooltip:yB});const wB=(e,t,n,o)=>(typeof t=="string"?(n=e.push(t)-1,o.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function SB(e,t,n,o){const r=e.indexOf(t);if(r===-1)return wB(e,t,n,o);const i=e.lastIndexOf(t);return r!==i?n:r}const TB=(e,t)=>e===null?null:Sn(Math.round(e),0,t);function _7(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class $f extends Ei{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const o=this.getLabels();for(const{index:r,label:i}of n)o[r]===i&&o.splice(r,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(yt(t))return null;const o=this.getLabels();return n=isFinite(n)&&o[n]===t?n:SB(o,t,ct(n,t),this._addedLabels),TB(n,o.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:o,max:r}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(o=0),n||(r=this.getLabels().length-1)),this.min=o,this.max=r}buildTicks(){const t=this.min,n=this.max,o=this.options.offset,r=[];let i=this.getLabels();i=t===0&&n===i.length-1?i:i.slice(t,n+1),this._valueRange=Math.max(i.length-(o?0:1),1),this._startValue=this.min-(o?.5:0);for(let a=t;a<=n;a++)r.push({value:a});return r}getLabelForValue(t){return _7.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}qe($f,"id","category"),qe($f,"defaults",{ticks:{callback:_7}});function PB(e,t){const n=[],{bounds:r,step:i,min:a,max:l,precision:c,count:d,maxTicks:u,maxDigits:f,includeBounds:h}=e,g=i||1,m=u-1,{min:b,max:v}=t,x=!yt(a),C=!yt(l),S=!yt(d),P=(v-b)/(f+1);let w=V6((v-b)/m/g)*g,R,M,O,E;if(w<1e-14&&!x&&!C)return[{value:b},{value:v}];E=Math.ceil(v/w)-Math.floor(b/w),E>m&&(w=V6(E*w/m/g)*g),yt(c)||(R=Math.pow(10,c),w=Math.ceil(w*R)/R),r==="ticks"?(M=Math.floor(b/w)*w,O=Math.ceil(v/w)*w):(M=b,O=v),x&&C&&i&&xV((l-a)/i,w/1e3)?(E=Math.round(Math.min((l-a)/w,u)),w=(l-a)/E,M=a,O=l):S?(M=x?a:M,O=C?l:O,E=d-1,w=(O-M)/E):(E=(O-M)/w,il(E,Math.round(E),w/1e3)?E=Math.round(E):E=Math.ceil(E));const k=Math.max($6(w),$6(M));R=Math.pow(10,yt(c)?k:c),M=Math.round(M*R)/R,O=Math.round(O*R)/R;let I=0;for(x&&(h&&M!==a?(n.push({value:a}),M<a&&I++,il(Math.round((M+I*w)*R)/R,a,D7(a,P,e))&&I++):M<a&&I++);I<E;++I){const _=Math.round((M+I*w)*R)/R;if(C&&_>l)break;n.push({value:_})}return C&&h&&O!==l?n.length&&il(n[n.length-1].value,l,D7(l,P,e))?n[n.length-1].value=l:n.push({value:l}):(!C||O===l)&&n.push({value:O}),n}function D7(e,t,{horizontal:n,minRotation:o}){const r=Io(o),i=(n?Math.sin(r):Math.cos(r))||.001,a=.75*t*(""+e).length;return Math.min(t/i,a)}class ru extends Ei{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,n){return yt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:o}=this.getUserBounds();let{min:r,max:i}=this;const a=c=>r=n?r:c,l=c=>i=o?i:c;if(t){const c=Qo(r),d=Qo(i);c<0&&d<0?l(0):c>0&&d>0&&a(0)}if(r===i){let c=i===0?1:Math.abs(i*.05);l(i+c),t||a(r-c)}this.min=r,this.max=i}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:o}=t,r;return o?(r=Math.ceil(this.max/o)-Math.floor(this.min/o)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${o} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let o=this.getTickLimit();o=Math.max(2,o);const r={maxTicks:o,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,a=PB(r,i);return t.bounds==="ticks"&&F6(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(){const t=this.ticks;let n=this.min,o=this.max;if(super.configure(),this.options.offset&&t.length){const r=(o-n)/Math.max(t.length-1,1)/2;n-=r,o+=r}this._startValue=n,this._endValue=o,this._valueRange=o-n}getLabelForValue(t){return ll(t,this.chart.options.locale,this.options.ticks.format)}}class Nf extends ru{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=ln(t)?t:0,this.max=ln(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,o=Io(this.options.ticks.minRotation),r=(t?Math.sin(o):Math.cos(o))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/r))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}qe(Nf,"id","linear"),qe(Nf,"defaults",{ticks:{callback:Ld.formatters.numeric}});const Pl=e=>Math.floor(Hr(e)),Ii=(e,t)=>Math.pow(10,Pl(e)+t);function L7(e){return e/Math.pow(10,Pl(e))===1}function A7(e,t,n){const o=Math.pow(10,n),r=Math.floor(e/o);return Math.ceil(t/o)-r}function MB(e,t){const n=t-e;let o=Pl(n);for(;A7(e,t,o)>10;)o++;for(;A7(e,t,o)<10;)o--;return Math.min(o,Pl(e))}function RB(e,{min:t,max:n}){t=io(e.min,t);const o=[],r=Pl(t);let i=MB(t,n),a=i<0?Math.pow(10,Math.abs(i)):1;const l=Math.pow(10,i),c=r>i?Math.pow(10,r):0,d=Math.round((t-c)*a)/a,u=Math.floor((t-c)/l/10)*l*10;let f=Math.floor((d-u)/Math.pow(10,i)),h=io(e.min,Math.round((c+u+f*Math.pow(10,i))*a)/a);for(;h<n;)o.push({value:h,major:L7(h),significand:f}),f>=10?f=f<15?15:20:f++,f>=20&&(i++,f=2,a=i>=0?1:a),h=Math.round((c+u+f*Math.pow(10,i))*a)/a;const g=io(e.max,h);return o.push({value:g,major:L7(g),significand:f}),o}class Bf extends Ei{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const o=ru.prototype.parse.apply(this,[t,n]);if(o===0){this._zero=!0;return}return ln(o)&&o>0?o:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=ln(t)?Math.max(0,t):null,this.max=ln(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ln(this._userMin)&&(this.min=t===Ii(this.min,0)?Ii(this.min,-1):Ii(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let o=this.min,r=this.max;const i=l=>o=t?o:l,a=l=>r=n?r:l;o===r&&(o<=0?(i(1),a(10)):(i(Ii(o,-1)),a(Ii(r,1)))),o<=0&&i(Ii(r,-1)),r<=0&&a(Ii(o,1)),this.min=o,this.max=r}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},o=RB(n,this);return t.bounds==="ticks"&&F6(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}getLabelForValue(t){return t===void 0?"0":ll(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Hr(t),this._valueRange=Hr(this.max)-Hr(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Hr(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}qe(Bf,"id","logarithmic"),qe(Bf,"defaults",{ticks:{callback:Ld.formatters.logarithmic,major:{enabled:!0}}});function Hf(e){const t=e.ticks;if(t.display&&e.display){const n=Mn(t.backdropPadding);return ct(t.font&&t.font.size,nn.font.size)+n.height}return 0}function OB(e,t,n){return n=Yt(n)?n:[n],{w:AV(e,t.string,n),h:n.length*t.lineHeight}}function V7(e,t,n,o,r){return e===o||e===r?{start:t-n/2,end:t+n/2}:e<o||e>r?{start:t-n,end:t}:{start:t,end:t+n}}function EB(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),o=[],r=[],i=e._pointLabels.length,a=e.options.pointLabels,l=a.centerPointLabels?Kt/i:0;for(let c=0;c<i;c++){const d=a.setContext(e.getPointLabelContext(c));r[c]=d.padding;const u=e.getPointPosition(c,e.drawingArea+r[c],l),f=gn(d.font),h=OB(e.ctx,f,e._pointLabels[c]);o[c]=h;const g=so(e.getIndexAngle(c)+l),m=Math.round(rf(g)),b=V7(m,u.x,h.w,0,180),v=V7(m,u.y,h.h,90,270);kB(n,t,g,b,v)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=_B(e,o,r)}function kB(e,t,n,o,r){const i=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));let l=0,c=0;o.start<t.l?(l=(t.l-o.start)/i,e.l=Math.min(e.l,t.l-l)):o.end>t.r&&(l=(o.end-t.r)/i,e.r=Math.max(e.r,t.r+l)),r.start<t.t?(c=(t.t-r.start)/a,e.t=Math.min(e.t,t.t-c)):r.end>t.b&&(c=(r.end-t.b)/a,e.b=Math.max(e.b,t.b+c))}function IB(e,t,n){const o=e.drawingArea,{extra:r,additionalAngle:i,padding:a,size:l}=n,c=e.getPointPosition(t,o+r+a,i),d=Math.round(rf(so(c.angle+fn))),u=AB(c.y,l.h,d),f=DB(d),h=LB(c.x,l.w,f);return{visible:!0,x:c.x,y:u,textAlign:f,left:h,top:u,right:h+l.w,bottom:u+l.h}}function jB(e,t){if(!t)return!0;const{left:n,top:o,right:r,bottom:i}=e;return!(br({x:n,y:o},t)||br({x:n,y:i},t)||br({x:r,y:o},t)||br({x:r,y:i},t))}function _B(e,t,n){const o=[],r=e._pointLabels.length,i=e.options,{centerPointLabels:a,display:l}=i.pointLabels,c={extra:Hf(i)/2,additionalAngle:a?Kt/r:0};let d;for(let u=0;u<r;u++){c.padding=n[u],c.size=t[u];const f=IB(e,u,c);o.push(f),l==="auto"&&(f.visible=jB(f,d),f.visible&&(d=f))}return o}function DB(e){return e===0||e===180?"center":e<180?"left":"right"}function LB(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function AB(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function VB(e,t,n){const{left:o,top:r,right:i,bottom:a}=n,{backdropColor:l}=t;if(!yt(l)){const c=Ti(t.borderRadius),d=Mn(t.backdropPadding);e.fillStyle=l;const u=o-d.left,f=r-d.top,h=i-o+d.width,g=a-r+d.height;Object.values(c).some(m=>m!==0)?(e.beginPath(),dl(e,{x:u,y:f,w:h,h:g,radius:c}),e.fill()):e.fillRect(u,f,h,g)}}function FB(e,t){const{ctx:n,options:{pointLabels:o}}=e;for(let r=t-1;r>=0;r--){const i=e._pointLabelItems[r];if(!i.visible)continue;const a=o.setContext(e.getPointLabelContext(r));VB(n,a,i);const l=gn(a.font),{x:c,y:d,textAlign:u}=i;Si(n,e._pointLabels[r],c,d+l.lineHeight/2,l,{color:a.color,textAlign:u,textBaseline:"middle"})}}function F7(e,t,n,o){const{ctx:r}=e;if(n)r.arc(e.xCenter,e.yCenter,t,0,Xt);else{let i=e.getPointPosition(0,t);r.moveTo(i.x,i.y);for(let a=1;a<o;a++)i=e.getPointPosition(a,t),r.lineTo(i.x,i.y)}}function $B(e,t,n,o,r){const i=e.ctx,a=t.circular,{color:l,lineWidth:c}=t;!a&&!o||!l||!c||n<0||(i.save(),i.strokeStyle=l,i.lineWidth=c,i.setLineDash(r.dash),i.lineDashOffset=r.dashOffset,i.beginPath(),F7(e,n,a,o),i.closePath(),i.stroke(),i.restore())}function NB(e,t,n){return zr(e,{label:n,index:t,type:"pointLabel"})}class Ml extends ru{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Mn(Hf(this.options)/2),n=this.width=this.maxWidth-t.width,o=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+o/2+t.top),this.drawingArea=Math.floor(Math.min(n,o)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=ln(t)&&!isNaN(t)?t:0,this.max=ln(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Hf(this.options))}generateTickLabels(t){ru.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,o)=>{const r=Wt(this.options.pointLabels.callback,[n,o],this);return r||r===0?r:""}).filter((n,o)=>this.chart.getDataVisibility(o))}fit(){const t=this.options;t.display&&t.pointLabels.display?EB(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,o,r){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((o-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,o,r))}getIndexAngle(t){const n=Xt/(this._pointLabels.length||1),o=this.options.startAngle||0;return so(t*n+Io(o))}getDistanceFromCenterForValue(t){if(yt(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(yt(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const o=n[t];return NB(this.getContext(),t,o)}}getPointPosition(t,n,o=0){const r=this.getIndexAngle(t)-fn+o;return{x:Math.cos(r)*n+this.xCenter,y:Math.sin(r)*n+this.yCenter,angle:r}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:o,right:r,bottom:i}=this._pointLabelItems[t];return{left:n,top:o,right:r,bottom:i}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const o=this.ctx;o.save(),o.beginPath(),F7(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),o.closePath(),o.fillStyle=t,o.fill(),o.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:o,grid:r,border:i}=n,a=this._pointLabels.length;let l,c,d;if(n.pointLabels.display&&FB(this,a),r.display&&this.ticks.forEach((u,f)=>{if(f!==0||f===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(f),g=r.setContext(h),m=i.setContext(h);$B(this,g,c,a,m)}}),o.display){for(t.save(),l=a-1;l>=0;l--){const u=o.setContext(this.getPointLabelContext(l)),{color:f,lineWidth:h}=u;!h||!f||(t.lineWidth=h,t.strokeStyle=f,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),d=this.getPointPosition(l,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(d.x,d.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,o=n.ticks;if(!o.display)return;const r=this.getIndexAngle(0);let i,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(r),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((l,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;const d=o.setContext(this.getContext(c)),u=gn(d.font);if(i=this.getDistanceFromCenterForValue(this.ticks[c].value),d.showLabelBackdrop){t.font=u.string,a=t.measureText(l.label).width,t.fillStyle=d.backdropColor;const f=Mn(d.backdropPadding);t.fillRect(-a/2-f.left,-i-u.size/2-f.top,a+f.width,u.size+f.height)}Si(t,l.label,0,-i,u,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),t.restore()}drawTitle(){}}qe(Ml,"id","radialLinear"),qe(Ml,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ld.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),qe(Ml,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),qe(Ml,"descriptors",{angleLines:{_fallback:"grid"}});const iu={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}},qn=Object.keys(iu);function $7(e,t){return e-t}function N7(e,t){if(yt(t))return null;const n=e._adapter,{parser:o,round:r,isoWeekday:i}=e._parseOpts;let a=t;return typeof o=="function"&&(a=o(a)),ln(a)||(a=typeof o=="string"?n.parse(a,o):n.parse(a)),a===null?null:(r&&(a=r==="week"&&(ks(i)||i===!0)?n.startOf(a,"isoWeek",i):n.startOf(a,r)),+a)}function B7(e,t,n,o){const r=qn.length;for(let i=qn.indexOf(e);i<r-1;++i){const a=iu[qn[i]],l=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-t)/(l*a.size))<=o)return qn[i]}return qn[r-1]}function BB(e,t,n,o,r){for(let i=qn.length-1;i>=qn.indexOf(n);i--){const a=qn[i];if(iu[a].common&&e._adapter.diff(r,o,a)>=t-1)return a}return qn[n?qn.indexOf(n):0]}function HB(e){for(let t=qn.indexOf(e)+1,n=qn.length;t<n;++t)if(iu[qn[t]].common)return qn[t]}function H7(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:o,hi:r}=af(n,t),i=n[o]>=t?n[o]:n[r];e[i]=!0}}function zB(e,t,n,o){const r=e._adapter,i=+r.startOf(t[0].value,o),a=t[t.length-1].value;let l,c;for(l=i;l<=a;l=+r.add(l,1,o))c=n[l],c>=0&&(t[c].major=!0);return t}function z7(e,t,n){const o=[],r={},i=t.length;let a,l;for(a=0;a<i;++a)l=t[a],r[l]=a,o.push({value:l,major:!1});return i===0||!n?o:zB(e,o,r,n)}class Rl extends Ei{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const o=t.time||(t.time={}),r=this._adapter=new QF._date(t.adapters.date);r.init(n),ol(o.displayFormats,r.formats()),this._parseOpts={parser:o.parser,round:o.round,isoWeekday:o.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:N7(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,o=t.time.unit||"day";let{min:r,max:i,minDefined:a,maxDefined:l}=this.getUserBounds();function c(d){!a&&!isNaN(d.min)&&(r=Math.min(r,d.min)),!l&&!isNaN(d.max)&&(i=Math.max(i,d.max))}(!a||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),r=ln(r)&&!isNaN(r)?r:+n.startOf(Date.now(),o),i=ln(i)&&!isNaN(i)?i:+n.endOf(Date.now(),o)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],o=t[t.length-1]),{min:n,max:o}}buildTicks(){const t=this.options,n=t.time,o=t.ticks,r=o.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);const i=this.min,a=this.max,l=SV(r,i,a);return this._unit=n.unit||(o.autoSkip?B7(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):BB(this,l.length,n.minUnit,this.min,this.max)),this._majorUnit=!o.major.enabled||this._unit==="year"?void 0:HB(this._unit),this.initOffsets(r),t.reverse&&l.reverse(),z7(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,o=0,r,i;this.options.offset&&t.length&&(r=this.getDecimalForValue(t[0]),t.length===1?n=1-r:n=(this.getDecimalForValue(t[1])-r)/2,i=this.getDecimalForValue(t[t.length-1]),t.length===1?o=i:o=(i-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=Sn(n,0,a),o=Sn(o,0,a),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,n=this.min,o=this.max,r=this.options,i=r.time,a=i.unit||B7(i.minUnit,n,o,this._getLabelCapacity(n)),l=ct(r.ticks.stepSize,1),c=a==="week"?i.isoWeekday:!1,d=ks(c)||c===!0,u={};let f=n,h,g;if(d&&(f=+t.startOf(f,"isoWeek",c)),f=+t.startOf(f,d?"day":a),t.diff(o,n,a)>1e5*l)throw new Error(n+" and "+o+" are too far apart with stepSize of "+l+" "+a);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(h=f,g=0;h<o;h=+t.add(h,l,a),g++)H7(u,h,m);return(h===o||r.bounds==="ticks"||g===1)&&H7(u,h,m),Object.keys(u).sort($7).map(b=>+b)}getLabelForValue(t){const n=this._adapter,o=this.options.time;return o.tooltipFormat?n.format(t,o.tooltipFormat):n.format(t,o.displayFormats.datetime)}format(t,n){const r=this.options.time.displayFormats,i=this._unit,a=n||r[i];return this._adapter.format(t,a)}_tickFormatFunction(t,n,o,r){const i=this.options,a=i.ticks.callback;if(a)return Wt(a,[t,n,o],this);const l=i.time.displayFormats,c=this._unit,d=this._majorUnit,u=c&&l[c],f=d&&l[d],h=o[n],g=d&&f&&h&&h.major;return this._adapter.format(t,r||(g?f:u))}generateTickLabels(t){let n,o,r;for(n=0,o=t.length;n<o;++n)r=t[n],r.label=this._tickFormatFunction(r.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,o=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+o)*n.factor)}getValueForPixel(t){const n=this._offsets,o=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+o*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,o=this.ctx.measureText(t).width,r=Io(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),a=Math.sin(r),l=this._resolveTickFontOptions(0).size;return{w:o*i+l*a,h:o*a+l*i}}_getLabelCapacity(t){const n=this.options.time,o=n.displayFormats,r=o[n.unit]||o.millisecond,i=this._tickFormatFunction(t,0,z7(this,[t],this._majorUnit),r),a=this._getLabelSize(i),l=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],n,o;if(t.length)return t;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,o=r.length;n<o;++n)t=t.concat(r[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,o;if(t.length)return t;const r=this.getLabels();for(n=0,o=r.length;n<o;++n)t.push(N7(this,r[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return z6(t.sort($7))}}qe(Rl,"id","time"),qe(Rl,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function su(e,t,n){let o=0,r=e.length-1,i,a,l,c;n?(t>=e[o].pos&&t<=e[r].pos&&({lo:o,hi:r}=mr(e,"pos",t)),{pos:i,time:l}=e[o],{pos:a,time:c}=e[r]):(t>=e[o].time&&t<=e[r].time&&({lo:o,hi:r}=mr(e,"time",t)),{time:i,pos:l}=e[o],{time:a,pos:c}=e[r]);const d=a-i;return d?l+(c-l)*(t-i)/d:l}class zf extends Rl{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=su(n,this.min),this._tableRange=su(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:o}=this,r=[],i=[];let a,l,c,d,u;for(a=0,l=t.length;a<l;++a)d=t[a],d>=n&&d<=o&&r.push(d);if(r.length<2)return[{time:n,pos:0},{time:o,pos:1}];for(a=0,l=r.length;a<l;++a)u=r[a+1],c=r[a-1],d=r[a],Math.round((u+c)/2)!==d&&i.push({time:d,pos:a/(l-1)});return i}_generate(){const t=this.min,n=this.max;let o=super.getDataTimestamps();return(!o.includes(t)||!o.length)&&o.splice(0,0,t),(!o.includes(n)||o.length===1)&&o.push(n),o.sort((r,i)=>r-i)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),o=this.getLabelTimestamps();return n.length&&o.length?t=this.normalize(n.concat(o)):t=n.length?n:o,t=this._cache.all=t,t}getDecimalForValue(t){return(su(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,o=this.getDecimalForPixel(t)/n.factor-n.end;return su(this._table,o*this._tableRange+this._minPos,!0)}}qe(zf,"id","timeseries"),qe(zf,"defaults",Rl.defaults);var WB=Object.freeze({__proto__:null,CategoryScale:$f,LinearScale:Nf,LogarithmicScale:Bf,RadialLinearScale:Ml,TimeScale:Rl,TimeSeriesScale:zf});const UB=[XF,RN,CB,WB],W7="label";function U7(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function ZB(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Z7(e,t){e.labels=t}function q7(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W7;const o=[];e.datasets=t.map(r=>{const i=e.datasets.find(a=>a[n]===r[n]);return!i||!r.data||o.includes(i)?{...r}:(o.push(i),Object.assign(i,r),i)})}function qB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W7;const n={labels:[],datasets:[]};return Z7(n,e.labels),q7(n,e.datasets,t),n}function GB(e,t){return e.getElementsAtEventForMode(t.nativeEvent,"nearest",{intersect:!0},!1)}function YB(e,t){const{height:n=150,width:o=300,redraw:r=!1,datasetIdKey:i,type:a,data:l,options:c,plugins:d=[],fallbackContent:u,updateMode:f,...h}=e,g=G.useRef(null),m=G.useRef(),b=()=>{g.current&&(m.current=new Cl(g.current,{type:a,data:qB(l,i),options:c&&{...c},plugins:d}),U7(t,m.current))},v=()=>{U7(t,null),m.current&&(m.current.destroy(),m.current=null)};return G.useEffect(()=>{!r&&m.current&&c&&ZB(m.current,c)},[r,c]),G.useEffect(()=>{!r&&m.current&&Z7(m.current.config.data,l.labels)},[r,l.labels]),G.useEffect(()=>{!r&&m.current&&l.datasets&&q7(m.current.config.data,l.datasets,i)},[r,l.datasets]),G.useEffect(()=>{m.current&&(r?(v(),setTimeout(b)):m.current.update(f))},[r,c,l.labels,l.datasets,f]),G.useEffect(()=>{m.current&&(v(),setTimeout(b))},[a]),G.useEffect(()=>(b(),()=>v()),[]),G.createElement("canvas",Object.assign({ref:g,role:"img",height:n,width:o},h),u)}const Wf=G.forwardRef(YB);function G7(e,t){return Cl.register(t),G.forwardRef((n,o)=>G.createElement(Wf,Object.assign({},n,{ref:o,type:e})))}const KB=G7("doughnut",Wr),XB=G7("scatter",fl),Ls=(e,t=0,n=1)=>Zf(qf(t,e),n),Uf=e=>{e._clipped=!1,e._unclipped=e.slice(0);for(let t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=Ls(e[t],0,255)):t===3&&(e[t]=Ls(e[t],0,1));return e},Y7={};for(let e of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Y7[`[object ${e}]`]=e.toLowerCase();function Ct(e){return Y7[Object.prototype.toString.call(e)]||"object"}const wt=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):Ct(e[0])=="object"&&t?t.split("").filter(n=>e[0][n]!==void 0).map(n=>e[0][n]):e[0],au=e=>{if(e.length<2)return null;const t=e.length-1;return Ct(e[t])=="string"?e[t].toLowerCase():null},{PI:lu,min:Zf,max:qf}=Math,Cr=lu*2,Gf=lu/3,QB=lu/180,JB=180/lu,dt={format:{},autodetect:[]};class ze{constructor(...t){const n=this;if(Ct(t[0])==="object"&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let o=au(t),r=!1;if(!o){r=!0,dt.sorted||(dt.autodetect=dt.autodetect.sort((i,a)=>a.p-i.p),dt.sorted=!0);for(let i of dt.autodetect)if(o=i.test(...t),o)break}if(dt.format[o]){const i=dt.format[o].apply(null,r?t:t.slice(0,-1));n._rgb=Uf(i)}else throw new Error("unknown format: "+t);n._rgb.length===3&&n._rgb.push(1)}toString(){return Ct(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}}const eH="2.6.0",ft=(...e)=>new ft.Color(...e);ft.Color=ze,ft.version=eH;const tH=(...e)=>{e=wt(e,"cmyk");const[t,n,o,r]=e,i=e.length>4?e[4]:1;return r===1?[0,0,0,i]:[t>=1?0:255*(1-t)*(1-r),n>=1?0:255*(1-n)*(1-r),o>=1?0:255*(1-o)*(1-r),i]},{max:K7}=Math,nH=(...e)=>{let[t,n,o]=wt(e,"rgb");t=t/255,n=n/255,o=o/255;const r=1-K7(t,K7(n,o)),i=r<1?1/(1-r):0,a=(1-t-r)*i,l=(1-n-r)*i,c=(1-o-r)*i;return[a,l,c,r]};ze.prototype.cmyk=function(){return nH(this._rgb)},ft.cmyk=(...e)=>new ze(...e,"cmyk"),dt.format.cmyk=tH,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"cmyk"),Ct(e)==="array"&&e.length===4)return"cmyk"}});const Yf=e=>Math.round(e*100)/100,oH=(...e)=>{const t=wt(e,"hsla");let n=au(e)||"lsa";return t[0]=Yf(t[0]||0),t[1]=Yf(t[1]*100)+"%",t[2]=Yf(t[2]*100)+"%",n==="hsla"||t.length>3&&t[3]<1?(t[3]=t.length>3?t[3]:1,n="hsla"):t.length=3,`${n}(${t.join(",")})`},X7=(...e)=>{e=wt(e,"rgba");let[t,n,o]=e;t/=255,n/=255,o/=255;const r=Zf(t,n,o),i=qf(t,n,o),a=(i+r)/2;let l,c;return i===r?(l=0,c=Number.NaN):l=a<.5?(i-r)/(i+r):(i-r)/(2-i-r),t==i?c=(n-o)/(i-r):n==i?c=2+(o-t)/(i-r):o==i&&(c=4+(t-n)/(i-r)),c*=60,c<0&&(c+=360),e.length>3&&e[3]!==void 0?[c,l,a,e[3]]:[c,l,a]},{round:Kf}=Math,rH=(...e)=>{const t=wt(e,"rgba");let n=au(e)||"rgb";return n.substr(0,3)=="hsl"?oH(X7(t),n):(t[0]=Kf(t[0]),t[1]=Kf(t[1]),t[2]=Kf(t[2]),(n==="rgba"||t.length>3&&t[3]<1)&&(t[3]=t.length>3?t[3]:1,n="rgba"),`${n}(${t.slice(0,n==="rgb"?3:4).join(",")})`)},{round:Xf}=Math,Qf=(...e)=>{e=wt(e,"hsl");const[t,n,o]=e;let r,i,a;if(n===0)r=i=a=o*255;else{const l=[0,0,0],c=[0,0,0],d=o<.5?o*(1+n):o+n-o*n,u=2*o-d,f=t/360;l[0]=f+1/3,l[1]=f,l[2]=f-1/3;for(let h=0;h<3;h++)l[h]<0&&(l[h]+=1),l[h]>1&&(l[h]-=1),6*l[h]<1?c[h]=u+(d-u)*6*l[h]:2*l[h]<1?c[h]=d:3*l[h]<2?c[h]=u+(d-u)*(2/3-l[h])*6:c[h]=u;[r,i,a]=[Xf(c[0]*255),Xf(c[1]*255),Xf(c[2]*255)]}return e.length>3?[r,i,a,e[3]]:[r,i,a,1]},Q7=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,J7=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,eb=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,tb=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,nb=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ob=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,{round:rb}=Math,Jf=e=>{e=e.toLowerCase().trim();let t;if(dt.format.named)try{return dt.format.named(e)}catch{}if(t=e.match(Q7)){const n=t.slice(1,4);for(let o=0;o<3;o++)n[o]=+n[o];return n[3]=1,n}if(t=e.match(J7)){const n=t.slice(1,5);for(let o=0;o<4;o++)n[o]=+n[o];return n}if(t=e.match(eb)){const n=t.slice(1,4);for(let o=0;o<3;o++)n[o]=rb(n[o]*2.55);return n[3]=1,n}if(t=e.match(tb)){const n=t.slice(1,5);for(let o=0;o<3;o++)n[o]=rb(n[o]*2.55);return n[3]=+n[3],n}if(t=e.match(nb)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const o=Qf(n);return o[3]=1,o}if(t=e.match(ob)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const o=Qf(n);return o[3]=+t[4],o}};Jf.test=e=>Q7.test(e)||J7.test(e)||eb.test(e)||tb.test(e)||nb.test(e)||ob.test(e),ze.prototype.css=function(e){return rH(this._rgb,e)},ft.css=(...e)=>new ze(...e,"css"),dt.format.css=Jf,dt.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&Ct(e)==="string"&&Jf.test(e))return"css"}}),dt.format.gl=(...e)=>{const t=wt(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t},ft.gl=(...e)=>new ze(...e,"gl"),ze.prototype.gl=function(){const e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};const{floor:iH}=Math,sH=(...e)=>{e=wt(e,"hcg");let[t,n,o]=e,r,i,a;o=o*255;const l=n*255;if(n===0)r=i=a=o;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const c=iH(t),d=t-c,u=o*(1-n),f=u+l*(1-d),h=u+l*d,g=u+l;switch(c){case 0:[r,i,a]=[g,h,u];break;case 1:[r,i,a]=[f,g,u];break;case 2:[r,i,a]=[u,g,h];break;case 3:[r,i,a]=[u,f,g];break;case 4:[r,i,a]=[h,u,g];break;case 5:[r,i,a]=[g,u,f];break}}return[r,i,a,e.length>3?e[3]:1]},aH=(...e)=>{const[t,n,o]=wt(e,"rgb"),r=Zf(t,n,o),i=qf(t,n,o),a=i-r,l=a*100/255,c=r/(255-a)*100;let d;return a===0?d=Number.NaN:(t===i&&(d=(n-o)/a),n===i&&(d=2+(o-t)/a),o===i&&(d=4+(t-n)/a),d*=60,d<0&&(d+=360)),[d,l,c]};ze.prototype.hcg=function(){return aH(this._rgb)},ft.hcg=(...e)=>new ze(...e,"hcg"),dt.format.hcg=sH,dt.autodetect.push({p:1,test:(...e)=>{if(e=wt(e,"hcg"),Ct(e)==="array"&&e.length===3)return"hcg"}});const lH=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,cH=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,ib=e=>{if(e.match(lH)){(e.length===4||e.length===7)&&(e=e.substr(1)),e.length===3&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const t=parseInt(e,16),n=t>>16,o=t>>8&255,r=t&255;return[n,o,r,1]}if(e.match(cH)){(e.length===5||e.length===9)&&(e=e.substr(1)),e.length===4&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e,16),n=t>>24&255,o=t>>16&255,r=t>>8&255,i=Math.round((t&255)/255*100)/100;return[n,o,r,i]}throw new Error(`unknown hex color: ${e}`)},{round:cu}=Math,sb=(...e)=>{let[t,n,o,r]=wt(e,"rgba"),i=au(e)||"auto";r===void 0&&(r=1),i==="auto"&&(i=r<1?"rgba":"rgb"),t=cu(t),n=cu(n),o=cu(o);let l="000000"+(t<<16|n<<8|o).toString(16);l=l.substr(l.length-6);let c="0"+cu(r*255).toString(16);switch(c=c.substr(c.length-2),i.toLowerCase()){case"rgba":return`#${l}${c}`;case"argb":return`#${c}${l}`;default:return`#${l}`}};ze.prototype.hex=function(e){return sb(this._rgb,e)},ft.hex=(...e)=>new ze(...e,"hex"),dt.format.hex=ib,dt.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&Ct(e)==="string"&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{cos:As}=Math,dH=(...e)=>{e=wt(e,"hsi");let[t,n,o]=e,r,i,a;return isNaN(t)&&(t=0),isNaN(n)&&(n=0),t>360&&(t-=360),t<0&&(t+=360),t/=360,t<1/3?(a=(1-n)/3,r=(1+n*As(Cr*t)/As(Gf-Cr*t))/3,i=1-(a+r)):t<2/3?(t-=1/3,r=(1-n)/3,i=(1+n*As(Cr*t)/As(Gf-Cr*t))/3,a=1-(r+i)):(t-=2/3,i=(1-n)/3,a=(1+n*As(Cr*t)/As(Gf-Cr*t))/3,r=1-(i+a)),r=Ls(o*r*3),i=Ls(o*i*3),a=Ls(o*a*3),[r*255,i*255,a*255,e.length>3?e[3]:1]},{min:uH,sqrt:pH,acos:fH}=Math,hH=(...e)=>{let[t,n,o]=wt(e,"rgb");t/=255,n/=255,o/=255;let r;const i=uH(t,n,o),a=(t+n+o)/3,l=a>0?1-i/a:0;return l===0?r=NaN:(r=(t-n+(t-o))/2,r/=pH((t-n)*(t-n)+(t-o)*(n-o)),r=fH(r),o>n&&(r=Cr-r),r/=Cr),[r*360,l,a]};ze.prototype.hsi=function(){return hH(this._rgb)},ft.hsi=(...e)=>new ze(...e,"hsi"),dt.format.hsi=dH,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"hsi"),Ct(e)==="array"&&e.length===3)return"hsi"}}),ze.prototype.hsl=function(){return X7(this._rgb)},ft.hsl=(...e)=>new ze(...e,"hsl"),dt.format.hsl=Qf,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"hsl"),Ct(e)==="array"&&e.length===3)return"hsl"}});const{floor:gH}=Math,mH=(...e)=>{e=wt(e,"hsv");let[t,n,o]=e,r,i,a;if(o*=255,n===0)r=i=a=o;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const l=gH(t),c=t-l,d=o*(1-n),u=o*(1-n*c),f=o*(1-n*(1-c));switch(l){case 0:[r,i,a]=[o,f,d];break;case 1:[r,i,a]=[u,o,d];break;case 2:[r,i,a]=[d,o,f];break;case 3:[r,i,a]=[d,u,o];break;case 4:[r,i,a]=[f,d,o];break;case 5:[r,i,a]=[o,d,u];break}}return[r,i,a,e.length>3?e[3]:1]},{min:bH,max:vH}=Math,xH=(...e)=>{e=wt(e,"rgb");let[t,n,o]=e;const r=bH(t,n,o),i=vH(t,n,o),a=i-r;let l,c,d;return d=i/255,i===0?(l=Number.NaN,c=0):(c=a/i,t===i&&(l=(n-o)/a),n===i&&(l=2+(o-t)/a),o===i&&(l=4+(t-n)/a),l*=60,l<0&&(l+=360)),[l,c,d]};ze.prototype.hsv=function(){return xH(this._rgb)},ft.hsv=(...e)=>new ze(...e,"hsv"),dt.format.hsv=mH,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"hsv"),Ct(e)==="array"&&e.length===3)return"hsv"}});const Gn={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},{pow:yH}=Math,ab=(...e)=>{e=wt(e,"lab");const[t,n,o]=e;let r,i,a,l,c,d;return i=(t+16)/116,r=isNaN(n)?i:i+n/500,a=isNaN(o)?i:i-o/200,i=Gn.Yn*t2(i),r=Gn.Xn*t2(r),a=Gn.Zn*t2(a),l=e2(3.2404542*r-1.5371385*i-.4985314*a),c=e2(-.969266*r+1.8760108*i+.041556*a),d=e2(.0556434*r-.2040259*i+1.0572252*a),[l,c,d,e.length>3?e[3]:1]},e2=e=>255*(e<=.00304?12.92*e:1.055*yH(e,1/2.4)-.055),t2=e=>e>Gn.t1?e*e*e:Gn.t2*(e-Gn.t0),{pow:lb}=Math,cb=(...e)=>{const[t,n,o]=wt(e,"rgb"),[r,i,a]=CH(t,n,o),l=116*i-16;return[l<0?0:l,500*(r-i),200*(i-a)]},n2=e=>(e/=255)<=.04045?e/12.92:lb((e+.055)/1.055,2.4),o2=e=>e>Gn.t3?lb(e,1/3):e/Gn.t2+Gn.t0,CH=(e,t,n)=>{e=n2(e),t=n2(t),n=n2(n);const o=o2((.4124564*e+.3575761*t+.1804375*n)/Gn.Xn),r=o2((.2126729*e+.7151522*t+.072175*n)/Gn.Yn),i=o2((.0193339*e+.119192*t+.9503041*n)/Gn.Zn);return[o,r,i]};ze.prototype.lab=function(){return cb(this._rgb)},ft.lab=(...e)=>new ze(...e,"lab"),dt.format.lab=ab,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"lab"),Ct(e)==="array"&&e.length===3)return"lab"}});const{sin:wH,cos:SH}=Math,db=(...e)=>{let[t,n,o]=wt(e,"lch");return isNaN(o)&&(o=0),o=o*QB,[t,SH(o)*n,wH(o)*n]},ub=(...e)=>{e=wt(e,"lch");const[t,n,o]=e,[r,i,a]=db(t,n,o),[l,c,d]=ab(r,i,a);return[l,c,d,e.length>3?e[3]:1]},TH=(...e)=>{const t=wt(e,"hcl").reverse();return ub(...t)},{sqrt:PH,atan2:MH,round:RH}=Math,pb=(...e)=>{const[t,n,o]=wt(e,"lab"),r=PH(n*n+o*o);let i=(MH(o,n)*JB+360)%360;return RH(r*1e4)===0&&(i=Number.NaN),[t,r,i]},fb=(...e)=>{const[t,n,o]=wt(e,"rgb"),[r,i,a]=cb(t,n,o);return pb(r,i,a)};ze.prototype.lch=function(){return fb(this._rgb)},ze.prototype.hcl=function(){return fb(this._rgb).reverse()},ft.lch=(...e)=>new ze(...e,"lch"),ft.hcl=(...e)=>new ze(...e,"hcl"),dt.format.lch=ub,dt.format.hcl=TH,["lch","hcl"].forEach(e=>dt.autodetect.push({p:2,test:(...t)=>{if(t=wt(t,e),Ct(t)==="array"&&t.length===3)return e}}));const Vs={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};ze.prototype.name=function(){const e=sb(this._rgb,"rgb");for(let t of Object.keys(Vs))if(Vs[t]===e)return t.toLowerCase();return e},dt.format.named=e=>{if(e=e.toLowerCase(),Vs[e])return ib(Vs[e]);throw new Error("unknown color name: "+e)},dt.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&Ct(e)==="string"&&Vs[e.toLowerCase()])return"named"}});const OH=e=>{if(Ct(e)=="number"&&e>=0&&e<=16777215){const t=e>>16,n=e>>8&255,o=e&255;return[t,n,o,1]}throw new Error("unknown num color: "+e)},EH=(...e)=>{const[t,n,o]=wt(e,"rgb");return(t<<16)+(n<<8)+o};ze.prototype.num=function(){return EH(this._rgb)},ft.num=(...e)=>new ze(...e,"num"),dt.format.num=OH,dt.autodetect.push({p:5,test:(...e)=>{if(e.length===1&&Ct(e[0])==="number"&&e[0]>=0&&e[0]<=16777215)return"num"}});const{round:hb}=Math;ze.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(hb)},ze.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,n)=>n<3?e===!1?t:hb(t):t)},ft.rgb=(...e)=>new ze(...e,"rgb"),dt.format.rgb=(...e)=>{const t=wt(e,"rgba");return t[3]===void 0&&(t[3]=1),t},dt.autodetect.push({p:3,test:(...e)=>{if(e=wt(e,"rgba"),Ct(e)==="array"&&(e.length===3||e.length===4&&Ct(e[3])=="number"&&e[3]>=0&&e[3]<=1))return"rgb"}});const{log:du}=Math,gb=e=>{const t=e/100;let n,o,r;return t<66?(n=255,o=t<6?0:-155.25485562709179-.44596950469579133*(o=t-2)+104.49216199393888*du(o),r=t<20?0:-254.76935184120902+.8274096064007395*(r=t-10)+115.67994401066147*du(r)):(n=351.97690566805693+.114206453784165*(n=t-55)-40.25366309332127*du(n),o=325.4494125711974+.07943456536662342*(o=t-50)-28.0852963507957*du(o),r=255),[n,o,r,1]},{round:kH}=Math,IH=(...e)=>{const t=wt(e,"rgb"),n=t[0],o=t[2];let r=1e3,i=4e4;const a=.4;let l;for(;i-r>a;){l=(i+r)*.5;const c=gb(l);c[2]/c[0]>=o/n?i=l:r=l}return kH(l)};ze.prototype.temp=ze.prototype.kelvin=ze.prototype.temperature=function(){return IH(this._rgb)},ft.temp=ft.kelvin=ft.temperature=(...e)=>new ze(...e,"temp"),dt.format.temp=dt.format.kelvin=dt.format.temperature=gb;const{pow:uu,sign:jH}=Math,mb=(...e)=>{e=wt(e,"lab");const[t,n,o]=e,r=uu(t+.3963377774*n+.2158037573*o,3),i=uu(t-.1055613458*n-.0638541728*o,3),a=uu(t-.0894841775*n-1.291485548*o,3);return[255*r2(4.0767416621*r-3.3077115913*i+.2309699292*a),255*r2(-1.2684380046*r+2.6097574011*i-.3413193965*a),255*r2(-.0041960863*r-.7034186147*i+1.707614701*a),e.length>3?e[3]:1]};function r2(e){const t=Math.abs(e);return t>.0031308?(jH(e)||1)*(1.055*uu(t,1/2.4)-.055):e*12.92}const{cbrt:i2,pow:_H,sign:DH}=Math,bb=(...e)=>{const[t,n,o]=wt(e,"rgb"),[r,i,a]=[s2(t/255),s2(n/255),s2(o/255)],l=i2(.4122214708*r+.5363325363*i+.0514459929*a),c=i2(.2119034982*r+.6806995451*i+.1073969566*a),d=i2(.0883024619*r+.2817188376*i+.6299787005*a);return[.2104542553*l+.793617785*c-.0040720468*d,1.9779984951*l-2.428592205*c+.4505937099*d,.0259040371*l+.7827717662*c-.808675766*d]};function s2(e){const t=Math.abs(e);return t<.04045?e/12.92:(DH(e)||1)*_H((t+.055)/1.055,2.4)}ze.prototype.oklab=function(){return bb(this._rgb)},ft.oklab=(...e)=>new ze(...e,"oklab"),dt.format.oklab=mb,dt.autodetect.push({p:3,test:(...e)=>{if(e=wt(e,"oklab"),Ct(e)==="array"&&e.length===3)return"oklab"}});const LH=(...e)=>{e=wt(e,"lch");const[t,n,o]=e,[r,i,a]=db(t,n,o),[l,c,d]=mb(r,i,a);return[l,c,d,e.length>3?e[3]:1]},AH=(...e)=>{const[t,n,o]=wt(e,"rgb"),[r,i,a]=bb(t,n,o);return pb(r,i,a)};ze.prototype.oklch=function(){return AH(this._rgb)},ft.oklch=(...e)=>new ze(...e,"oklch"),dt.format.oklch=LH,dt.autodetect.push({p:3,test:(...e)=>{if(e=wt(e,"oklch"),Ct(e)==="array"&&e.length===3)return"oklch"}}),ze.prototype.alpha=function(e,t=!1){return e!==void 0&&Ct(e)==="number"?t?(this._rgb[3]=e,this):new ze([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]},ze.prototype.clipped=function(){return this._rgb._clipped||!1},ze.prototype.darken=function(e=1){const t=this,n=t.lab();return n[0]-=Gn.Kn*e,new ze(n,"lab").alpha(t.alpha(),!0)},ze.prototype.brighten=function(e=1){return this.darken(-e)},ze.prototype.darker=ze.prototype.darken,ze.prototype.brighter=ze.prototype.brighten,ze.prototype.get=function(e){const[t,n]=e.split("."),o=this[t]();if(n){const r=t.indexOf(n)-(t.substr(0,2)==="ok"?2:0);if(r>-1)return o[r];throw new Error(`unknown channel ${n} in mode ${t}`)}else return o};const{pow:VH}=Math,FH=1e-7,$H=20;ze.prototype.luminance=function(e,t="rgb"){if(e!==void 0&&Ct(e)==="number"){if(e===0)return new ze([0,0,0,this._rgb[3]],"rgb");if(e===1)return new ze([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),o=$H;const r=(a,l)=>{const c=a.interpolate(l,.5,t),d=c.luminance();return Math.abs(e-d)<FH||!o--?c:d>e?r(a,c):r(c,l)},i=(n>e?r(new ze([0,0,0]),this):r(this,new ze([255,255,255]))).rgb();return new ze([...i,this._rgb[3]])}return NH(...this._rgb.slice(0,3))};const NH=(e,t,n)=>(e=a2(e),t=a2(t),n=a2(n),.2126*e+.7152*t+.0722*n),a2=e=>(e/=255,e<=.03928?e/12.92:VH((e+.055)/1.055,2.4)),jn={},Ol=(e,t,n=.5,...o)=>{let r=o[0]||"lrgb";if(!jn[r]&&!o.length&&(r=Object.keys(jn)[0]),!jn[r])throw new Error(`interpolation mode ${r} is not defined`);return Ct(e)!=="object"&&(e=new ze(e)),Ct(t)!=="object"&&(t=new ze(t)),jn[r](e,t,n).alpha(e.alpha()+n*(t.alpha()-e.alpha()))};ze.prototype.mix=ze.prototype.interpolate=function(e,t=.5,...n){return Ol(this,e,t,...n)},ze.prototype.premultiply=function(e=!1){const t=this._rgb,n=t[3];return e?(this._rgb=[t[0]*n,t[1]*n,t[2]*n,n],this):new ze([t[0]*n,t[1]*n,t[2]*n,n],"rgb")},ze.prototype.saturate=function(e=1){const t=this,n=t.lch();return n[1]+=Gn.Kn*e,n[1]<0&&(n[1]=0),new ze(n,"lch").alpha(t.alpha(),!0)},ze.prototype.desaturate=function(e=1){return this.saturate(-e)},ze.prototype.set=function(e,t,n=!1){const[o,r]=e.split("."),i=this[o]();if(r){const a=o.indexOf(r)-(o.substr(0,2)==="ok"?2:0);if(a>-1){if(Ct(t)=="string")switch(t.charAt(0)){case"+":i[a]+=+t;break;case"-":i[a]+=+t;break;case"*":i[a]*=+t.substr(1);break;case"/":i[a]/=+t.substr(1);break;default:i[a]=+t}else if(Ct(t)==="number")i[a]=t;else throw new Error("unsupported value for Color.set");const l=new ze(i,o);return n?(this._rgb=l._rgb,this):l}throw new Error(`unknown channel ${r} in mode ${o}`)}else return i},ze.prototype.tint=function(e=.5,...t){return Ol(this,"white",e,...t)},ze.prototype.shade=function(e=.5,...t){return Ol(this,"black",e,...t)};const BH=(e,t,n)=>{const o=e._rgb,r=t._rgb;return new ze(o[0]+n*(r[0]-o[0]),o[1]+n*(r[1]-o[1]),o[2]+n*(r[2]-o[2]),"rgb")};jn.rgb=BH;const{sqrt:l2,pow:Fs}=Math,HH=(e,t,n)=>{const[o,r,i]=e._rgb,[a,l,c]=t._rgb;return new ze(l2(Fs(o,2)*(1-n)+Fs(a,2)*n),l2(Fs(r,2)*(1-n)+Fs(l,2)*n),l2(Fs(i,2)*(1-n)+Fs(c,2)*n),"rgb")};jn.lrgb=HH;const zH=(e,t,n)=>{const o=e.lab(),r=t.lab();return new ze(o[0]+n*(r[0]-o[0]),o[1]+n*(r[1]-o[1]),o[2]+n*(r[2]-o[2]),"lab")};jn.lab=zH;const $s=(e,t,n,o)=>{let r,i;o==="hsl"?(r=e.hsl(),i=t.hsl()):o==="hsv"?(r=e.hsv(),i=t.hsv()):o==="hcg"?(r=e.hcg(),i=t.hcg()):o==="hsi"?(r=e.hsi(),i=t.hsi()):o==="lch"||o==="hcl"?(o="hcl",r=e.hcl(),i=t.hcl()):o==="oklch"&&(r=e.oklch().reverse(),i=t.oklch().reverse());let a,l,c,d,u,f;(o.substr(0,1)==="h"||o==="oklch")&&([a,c,u]=r,[l,d,f]=i);let h,g,m,b;return!isNaN(a)&&!isNaN(l)?(l>a&&l-a>180?b=l-(a+360):l<a&&a-l>180?b=l+360-a:b=l-a,g=a+n*b):isNaN(a)?isNaN(l)?g=Number.NaN:(g=l,(u==1||u==0)&&o!="hsv"&&(h=d)):(g=a,(f==1||f==0)&&o!="hsv"&&(h=c)),h===void 0&&(h=c+n*(d-c)),m=u+n*(f-u),o==="oklch"?new ze([m,h,g],o):new ze([g,h,m],o)},vb=(e,t,n)=>$s(e,t,n,"lch");jn.lch=vb,jn.hcl=vb;const WH=(e,t,n)=>{const o=e.num(),r=t.num();return new ze(o+n*(r-o),"num")};jn.num=WH;const UH=(e,t,n)=>$s(e,t,n,"hcg");jn.hcg=UH;const ZH=(e,t,n)=>$s(e,t,n,"hsi");jn.hsi=ZH;const qH=(e,t,n)=>$s(e,t,n,"hsl");jn.hsl=qH;const GH=(e,t,n)=>$s(e,t,n,"hsv");jn.hsv=GH;const YH=(e,t,n)=>{const o=e.oklab(),r=t.oklab();return new ze(o[0]+n*(r[0]-o[0]),o[1]+n*(r[1]-o[1]),o[2]+n*(r[2]-o[2]),"oklab")};jn.oklab=YH;const KH=(e,t,n)=>$s(e,t,n,"oklch");jn.oklch=KH;const{pow:c2,sqrt:d2,PI:u2,cos:xb,sin:yb,atan2:XH}=Math,QH=(e,t="lrgb",n=null)=>{const o=e.length;n||(n=Array.from(new Array(o)).map(()=>1));const r=o/n.reduce(function(f,h){return f+h});if(n.forEach((f,h)=>{n[h]*=r}),e=e.map(f=>new ze(f)),t==="lrgb")return JH(e,n);const i=e.shift(),a=i.get(t),l=[];let c=0,d=0;for(let f=0;f<a.length;f++)if(a[f]=(a[f]||0)*n[0],l.push(isNaN(a[f])?0:n[0]),t.charAt(f)==="h"&&!isNaN(a[f])){const h=a[f]/180*u2;c+=xb(h)*n[0],d+=yb(h)*n[0]}let u=i.alpha()*n[0];e.forEach((f,h)=>{const g=f.get(t);u+=f.alpha()*n[h+1];for(let m=0;m<a.length;m++)if(!isNaN(g[m]))if(l[m]+=n[h+1],t.charAt(m)==="h"){const b=g[m]/180*u2;c+=xb(b)*n[h+1],d+=yb(b)*n[h+1]}else a[m]+=g[m]*n[h+1]});for(let f=0;f<a.length;f++)if(t.charAt(f)==="h"){let h=XH(d/l[f],c/l[f])/u2*180;for(;h<0;)h+=360;for(;h>=360;)h-=360;a[f]=h}else a[f]=a[f]/l[f];return u/=o,new ze(a,t).alpha(u>.99999?1:u,!0)},JH=(e,t)=>{const n=e.length,o=[0,0,0,0];for(let r=0;r<e.length;r++){const i=e[r],a=t[r]/n,l=i._rgb;o[0]+=c2(l[0],2)*a,o[1]+=c2(l[1],2)*a,o[2]+=c2(l[2],2)*a,o[3]+=l[3]*a}return o[0]=d2(o[0]),o[1]=d2(o[1]),o[2]=d2(o[2]),o[3]>.9999999&&(o[3]=1),new ze(Uf(o))},{pow:ez}=Math;function pu(e){let t="rgb",n=ft("#ccc"),o=0,r=[0,1],i=[],a=[0,0],l=!1,c=[],d=!1,u=0,f=1,h=!1,g={},m=!0,b=1;const v=function(M){if(M=M||["#fff","#000"],M&&Ct(M)==="string"&&ft.brewer&&ft.brewer[M.toLowerCase()]&&(M=ft.brewer[M.toLowerCase()]),Ct(M)==="array"){M.length===1&&(M=[M[0],M[0]]),M=M.slice(0);for(let O=0;O<M.length;O++)M[O]=ft(M[O]);i.length=0;for(let O=0;O<M.length;O++)i.push(O/(M.length-1))}return w(),c=M},x=function(M){if(l!=null){const O=l.length-1;let E=0;for(;E<O&&M>=l[E];)E++;return E-1}return 0};let C=M=>M,S=M=>M;const P=function(M,O){let E,k;if(O==null&&(O=!1),isNaN(M)||M===null)return n;O?k=M:l&&l.length>2?k=x(M)/(l.length-2):f!==u?k=(M-u)/(f-u):k=1,k=S(k),O||(k=C(k)),b!==1&&(k=ez(k,b)),k=a[0]+k*(1-a[0]-a[1]),k=Ls(k,0,1);const I=Math.floor(k*1e4);if(m&&g[I])E=g[I];else{if(Ct(c)==="array")for(let _=0;_<i.length;_++){const A=i[_];if(k<=A){E=c[_];break}if(k>=A&&_===i.length-1){E=c[_];break}if(k>A&&k<i[_+1]){k=(k-A)/(i[_+1]-A),E=ft.interpolate(c[_],c[_+1],k,t);break}}else Ct(c)==="function"&&(E=c(k));m&&(g[I]=E)}return E};var w=()=>g={};v(e);const R=function(M){const O=ft(P(M));return d&&O[d]?O[d]():O};return R.classes=function(M){if(M!=null){if(Ct(M)==="array")l=M,r=[M[0],M[M.length-1]];else{const O=ft.analyze(r);M===0?l=[O.min,O.max]:l=ft.limits(O,"e",M)}return R}return l},R.domain=function(M){if(!arguments.length)return r;u=M[0],f=M[M.length-1],i=[];const O=c.length;if(M.length===O&&u!==f)for(let E of Array.from(M))i.push((E-u)/(f-u));else{for(let E=0;E<O;E++)i.push(E/(O-1));if(M.length>2){const E=M.map((I,_)=>_/(M.length-1)),k=M.map(I=>(I-u)/(f-u));k.every((I,_)=>E[_]===I)||(S=I=>{if(I<=0||I>=1)return I;let _=0;for(;I>=k[_+1];)_++;const A=(I-k[_])/(k[_+1]-k[_]);return E[_]+A*(E[_+1]-E[_])})}}return r=[u,f],R},R.mode=function(M){return arguments.length?(t=M,w(),R):t},R.range=function(M,O){return v(M),R},R.out=function(M){return d=M,R},R.spread=function(M){return arguments.length?(o=M,R):o},R.correctLightness=function(M){return M==null&&(M=!0),h=M,w(),h?C=function(O){const E=P(0,!0).lab()[0],k=P(1,!0).lab()[0],I=E>k;let _=P(O,!0).lab()[0];const A=E+(k-E)*O;let L=_-A,D=0,F=1,$=20;for(;Math.abs(L)>.01&&$-- >0;)(function(){return I&&(L*=-1),L<0?(D=O,O+=(F-O)*.5):(F=O,O+=(D-O)*.5),_=P(O,!0).lab()[0],L=_-A})();return O}:C=O=>O,R},R.padding=function(M){return M!=null?(Ct(M)==="number"&&(M=[M,M]),a=M,R):a},R.colors=function(M,O){arguments.length<2&&(O="hex");let E=[];if(arguments.length===0)E=c.slice(0);else if(M===1)E=[R(.5)];else if(M>1){const k=r[0],I=r[1]-k;E=tz(0,M).map(_=>R(k+_/(M-1)*I))}else{e=[];let k=[];if(l&&l.length>2)for(let I=1,_=l.length,A=1<=_;A?I<_:I>_;A?I++:I--)k.push((l[I-1]+l[I])*.5);else k=r;E=k.map(I=>R(I))}return ft[O]&&(E=E.map(k=>k[O]())),E},R.cache=function(M){return M!=null?(m=M,R):m},R.gamma=function(M){return M!=null?(b=M,R):b},R.nodata=function(M){return M!=null?(n=ft(M),R):n},R}function tz(e,t,n){let o=[],r=e<t,i=t;for(let a=e;r?a<i:a>i;r?a++:a--)o.push(a);return o}const nz=function(e){let t=[1,1];for(let n=1;n<e;n++){let o=[1];for(let r=1;r<=t.length;r++)o[r]=(t[r]||0)+t[r-1];t=o}return t},oz=function(e){let t,n,o,r;if(e=e.map(i=>new ze(i)),e.length===2)[n,o]=e.map(i=>i.lab()),t=function(i){const a=[0,1,2].map(l=>n[l]+i*(o[l]-n[l]));return new ze(a,"lab")};else if(e.length===3)[n,o,r]=e.map(i=>i.lab()),t=function(i){const a=[0,1,2].map(l=>(1-i)*(1-i)*n[l]+2*(1-i)*i*o[l]+i*i*r[l]);return new ze(a,"lab")};else if(e.length===4){let i;[n,o,r,i]=e.map(a=>a.lab()),t=function(a){const l=[0,1,2].map(c=>(1-a)*(1-a)*(1-a)*n[c]+3*(1-a)*(1-a)*a*o[c]+3*(1-a)*a*a*r[c]+a*a*a*i[c]);return new ze(l,"lab")}}else if(e.length>=5){let i,a,l;i=e.map(c=>c.lab()),l=e.length-1,a=nz(l),t=function(c){const d=1-c,u=[0,1,2].map(f=>i.reduce((h,g,m)=>h+a[m]*d**(l-m)*c**m*g[f],0));return new ze(u,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return t},rz=e=>{const t=oz(e);return t.scale=()=>pu(t),t},_o=(e,t,n)=>{if(!_o[n])throw new Error("unknown blend mode "+n);return _o[n](e,t)},qr=e=>(t,n)=>{const o=ft(n).rgb(),r=ft(t).rgb();return ft.rgb(e(o,r))},Gr=e=>(t,n)=>{const o=[];return o[0]=e(t[0],n[0]),o[1]=e(t[1],n[1]),o[2]=e(t[2],n[2]),o},iz=e=>e,sz=(e,t)=>e*t/255,az=(e,t)=>e>t?t:e,lz=(e,t)=>e>t?e:t,cz=(e,t)=>255*(1-(1-e/255)*(1-t/255)),dz=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),uz=(e,t)=>255*(1-(1-t/255)/(e/255)),pz=(e,t)=>e===255?255:(e=255*(t/255)/(1-e/255),e>255?255:e);_o.normal=qr(Gr(iz)),_o.multiply=qr(Gr(sz)),_o.screen=qr(Gr(cz)),_o.overlay=qr(Gr(dz)),_o.darken=qr(Gr(az)),_o.lighten=qr(Gr(lz)),_o.dodge=qr(Gr(pz)),_o.burn=qr(Gr(uz));const{pow:fz,sin:hz,cos:gz}=Math;function mz(e=300,t=-1.5,n=1,o=1,r=[0,1]){let i=0,a;Ct(r)==="array"?a=r[1]-r[0]:(a=0,r=[r,r]);const l=function(c){const d=Cr*((e+120)/360+t*c),u=fz(r[0]+a*c,o),h=(i!==0?n[0]+c*i:n)*u*(1-u)/2,g=gz(d),m=hz(d),b=u+h*(-.14861*g+1.78277*m),v=u+h*(-.29227*g-.90649*m),x=u+h*(1.97294*g);return ft(Uf([b*255,v*255,x*255,1]))};return l.start=function(c){return c==null?e:(e=c,l)},l.rotations=function(c){return c==null?t:(t=c,l)},l.gamma=function(c){return c==null?o:(o=c,l)},l.hue=function(c){return c==null?n:(n=c,Ct(n)==="array"?(i=n[1]-n[0],i===0&&(n=n[1])):i=0,l)},l.lightness=function(c){return c==null?r:(Ct(c)==="array"?(r=c,a=c[1]-c[0]):(r=[c,c],a=0),l)},l.scale=()=>ft.scale(l),l.hue(n),l}const bz="0123456789abcdef",{floor:vz,random:xz}=Math,yz=()=>{let e="#";for(let t=0;t<6;t++)e+=bz.charAt(vz(xz()*16));return new ze(e,"hex")},{log:Cb,pow:Cz,floor:wz,abs:Sz}=Math;function wb(e,t=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return Ct(e)==="object"&&(e=Object.values(e)),e.forEach(o=>{t&&Ct(o)==="object"&&(o=o[t]),o!=null&&!isNaN(o)&&(n.values.push(o),n.sum+=o,o<n.min&&(n.min=o),o>n.max&&(n.max=o),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(o,r)=>Sb(n,o,r),n}function Sb(e,t="equal",n=7){Ct(e)=="array"&&(e=wb(e));const{min:o,max:r}=e,i=e.values.sort((l,c)=>l-c);if(n===1)return[o,r];const a=[];if(t.substr(0,1)==="c"&&(a.push(o),a.push(r)),t.substr(0,1)==="e"){a.push(o);for(let l=1;l<n;l++)a.push(o+l/n*(r-o));a.push(r)}else if(t.substr(0,1)==="l"){if(o<=0)throw new Error("Logarithmic scales are only possible for values > 0");const l=Math.LOG10E*Cb(o),c=Math.LOG10E*Cb(r);a.push(o);for(let d=1;d<n;d++)a.push(Cz(10,l+d/n*(c-l)));a.push(r)}else if(t.substr(0,1)==="q"){a.push(o);for(let l=1;l<n;l++){const c=(i.length-1)*l/n,d=wz(c);if(d===c)a.push(i[d]);else{const u=c-d;a.push(i[d]*(1-u)+i[d+1]*u)}}a.push(r)}else if(t.substr(0,1)==="k"){let l;const c=i.length,d=new Array(c),u=new Array(n);let f=!0,h=0,g=null;g=[],g.push(o);for(let v=1;v<n;v++)g.push(o+v/n*(r-o));for(g.push(r);f;){for(let x=0;x<n;x++)u[x]=0;for(let x=0;x<c;x++){const C=i[x];let S=Number.MAX_VALUE,P;for(let w=0;w<n;w++){const R=Sz(g[w]-C);R<S&&(S=R,P=w),u[P]++,d[x]=P}}const v=new Array(n);for(let x=0;x<n;x++)v[x]=null;for(let x=0;x<c;x++)l=d[x],v[l]===null?v[l]=i[x]:v[l]+=i[x];for(let x=0;x<n;x++)v[x]*=1/u[x];f=!1;for(let x=0;x<n;x++)if(v[x]!==g[x]){f=!0;break}g=v,h++,h>200&&(f=!1)}const m={};for(let v=0;v<n;v++)m[v]=[];for(let v=0;v<c;v++)l=d[v],m[l].push(i[v]);let b=[];for(let v=0;v<n;v++)b.push(m[v][0]),b.push(m[v][m[v].length-1]);b=b.sort((v,x)=>v-x),a.push(b[0]);for(let v=1;v<b.length;v+=2){const x=b[v];!isNaN(x)&&a.indexOf(x)===-1&&a.push(x)}}return a}const Tz=(e,t)=>{e=new ze(e),t=new ze(t);const n=e.luminance(),o=t.luminance();return n>o?(n+.05)/(o+.05):(o+.05)/(n+.05)},{sqrt:wr,pow:mn,min:Pz,max:Mz,atan2:Tb,abs:Pb,cos:fu,sin:Mb,exp:Rz,PI:Rb}=Math;function Oz(e,t,n=1,o=1,r=1){var i=function(Q){return 360*Q/(2*Rb)},a=function(Q){return 2*Rb*Q/360};e=new ze(e),t=new ze(t);const[l,c,d]=Array.from(e.lab()),[u,f,h]=Array.from(t.lab()),g=(l+u)/2,m=wr(mn(c,2)+mn(d,2)),b=wr(mn(f,2)+mn(h,2)),v=(m+b)/2,x=.5*(1-wr(mn(v,7)/(mn(v,7)+mn(25,7)))),C=c*(1+x),S=f*(1+x),P=wr(mn(C,2)+mn(d,2)),w=wr(mn(S,2)+mn(h,2)),R=(P+w)/2,M=i(Tb(d,C)),O=i(Tb(h,S)),E=M>=0?M:M+360,k=O>=0?O:O+360,I=Pb(E-k)>180?(E+k+360)/2:(E+k)/2,_=1-.17*fu(a(I-30))+.24*fu(a(2*I))+.32*fu(a(3*I+6))-.2*fu(a(4*I-63));let A=k-E;A=Pb(A)<=180?A:k<=E?A+360:A-360,A=2*wr(P*w)*Mb(a(A)/2);const L=u-l,D=w-P,F=1+.015*mn(g-50,2)/wr(20+mn(g-50,2)),$=1+.045*R,V=1+.015*R*_,B=30*Rz(-mn((I-275)/25,2)),U=-(2*wr(mn(R,7)/(mn(R,7)+mn(25,7))))*Mb(2*a(B)),ce=wr(mn(L/(n*F),2)+mn(D/(o*$),2)+mn(A/(r*V),2)+U*(D/(o*$))*(A/(r*V)));return Mz(0,Pz(100,ce))}function Ez(e,t,n="lab"){e=new ze(e),t=new ze(t);const o=e.get(n),r=t.get(n);let i=0;for(let a in o){const l=(o[a]||0)-(r[a]||0);i+=l*l}return Math.sqrt(i)}const kz=(...e)=>{try{return new ze(...e),!0}catch{return!1}},Iz={cool(){return pu([ft.hsl(180,1,.9),ft.hsl(250,.7,.4)])},hot(){return pu(["#000","#f00","#ff0","#fff"]).mode("rgb")}},hu={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]};for(let e of Object.keys(hu))hu[e.toLowerCase()]=hu[e];Object.assign(ft,{average:QH,bezier:rz,blend:_o,cubehelix:mz,mix:Ol,interpolate:Ol,random:yz,scale:pu,analyze:wb,contrast:Tz,deltaE:Oz,distance:Ez,limits:Sb,valid:kz,scales:Iz,input:dt,colors:Vs,brewer:hu});const jz=e=>{const{theme:t,values:n,palette:o,legend:r=!0,hoveredArcIndex:i,setHoveredArcIndex:a,handleChartHover:l,...c}=e;return{...c,data:{datasets:[{data:n??[],backgroundColor:i===null||!r?o:o.map((d,u)=>u!==i?ft(d).alpha(.4).css():d),hoverBackgroundColor:o}]},options:{cutout:"78%",responsive:!0,maintainAspectRatio:!0,elements:{arc:{borderWidth:0}},events:["mousemove","mouseout"],layout:{padding:1},onHover:(d,u)=>{var f,h;if(d.type!=="mousemove"||!u.length){a(null),((f=d.native)==null?void 0:f.target).style.cursor="default";return}((h=d.native)==null?void 0:h.target).style.cursor=u[0]?"pointer":"default",a(u[0].index),l(d.x,d.y)},plugins:{datalabels:{display:!1},legend:{display:!1},tooltip:{enabled:!1}}},plugins:[{id:"doughnutBackground",beforeDatasetsDraw:d=>{const u=d.canvas.clientWidth/2,f=d.canvas.clientHeight/2,h=d.ctx,{innerRadius:g,outerRadius:m}=d.getDatasetMeta(d.data.datasets.length-1).controller,b=m-g;h.lineWidth=b-2,h.strokeStyle=t.palette.primary[50]??'"',h.beginPath(),h.arc(u,f,m-b/2,0,2*Math.PI),h.stroke()}}]}},_z=(e,t,n)=>Object.entries(e.palette.primary).filter(([o])=>!isNaN(Number(o))&&t<=Number(o)&&Number(o)<=n).sort(([o],[r])=>Number(r)-Number(o)).map(([,o])=>o),Dz=(e,t)=>ft.scale(e).colors(t.length),Ob=e=>{const t=e.reduce((r,i)=>r+i,0);if(!t)return[...new Array(e.length)].map(()=>0);const n=e.map(r=>Math.floor(r/t*100)),o=100-n.reduce((r,i)=>r+i,0);for(let r=0;r<o;r++){const i=n.indexOf(Math.max(...n));n[i]++}return n},p2=e=>{const{action:t,seeMore:n}=e,o=Oe(),r={display:"flex",marginLeft:"auto",color:o.palette.primary[700],fontSize:".8rem",textDecoration:"none",alignItems:"center",fontWeight:o.typography.fontWeightBold,"&:hover":{textDecoration:"none"}};return p.jsx(rt,{onClick:t,sx:r,children:n})},Lz=e=>{const{values:t,labels:n,palette:o,legend:r,hoveredArcIndex:i,setHoveredArcIndex:a}=e,l=Oe(),c=Ob(t??[]);return p.jsx(we,{alignItems:"center",className:"doughnut-chart-legend-wrapper",children:p.jsx(we,{display:"inline-flex",children:n.map((d,u)=>{const f=t&&t[u]!==void 0;return p.jsxs(we,{direction:"row",alignItems:"center",gap:"12px",paddingY:"8px",onMouseEnter:()=>{f&&a(u)},onMouseLeave:()=>a(null),sx:{opacity:i===null||i===u?1:.4},className:"doughnut-chart-legend-item",children:[p.jsx(ne,{minWidth:"10px",height:"10px",bgcolor:f?o[u]:l.custom.grey[400]}),p.jsxs(we,{direction:"row",alignItems:"center",gap:"8px",sx:{width:"100%"},children:[p.jsxs(fe,{variant:"h5",className:"doughnut-chart-legend-item-label",children:[d,p.jsxs(ne,{component:"span",fontWeight:400,className:"doughnut-chart-legend-item-value",children:[d?" - ":"",f?`${c[u]}%`:"--%"]})]}),(r==null?void 0:r.actions)&&(r==null?void 0:r.seeMore)&&(r==null?void 0:r.actions[u])&&p.jsx(p2,{action:r==null?void 0:r.actions[u],seeMore:r==null?void 0:r.seeMore})]})]},u)})})})},Az=e=>{const{values:t,labels:n,palette:o,icons:r=[],legend:i,hoveredArcIndex:a,setHoveredArcIndex:l}=e,c=Oe(),d=Ob(t??[]);return p.jsx(we,{alignItems:"center",justifyContent:"center",sx:{width:"100%",alignItems:"flex-start"},className:"doughnut-chart-legend-wrapper",children:p.jsx(we,{width:"100%",children:n.map((u,f)=>{const h=t&&t[f]!==void 0;return p.jsx(we,{direction:"row",alignItems:"center",gap:"12px",onMouseEnter:()=>{h&&l(f)},onMouseLeave:()=>l(null),sx:{opacity:a===null||a===f?1:.4,borderBottom:"1px solid #e3e2e0","&:last-of-type":{borderBottom:"none"}},children:p.jsxs(we,{direction:"row",gap:"8px",sx:{width:"100%",padding:".4rem",alignItems:"center","&:hover":{cursor:"pointer",background:Ee[500]}},className:"doughnut-chart-legend-item",children:[r[f]!==void 0&&p.jsx(ne,{minWidth:"28px",height:"28px",sx:{background:o[f]||c.custom.grey[400],padding:"16px 5px",color:"#fff"},display:"flex",alignItems:"center",borderRadius:"6px",children:r[f]}),p.jsx(fe,{variant:"h5",sx:{marginLeft:"4px"},className:"doughnut-chart-legend-item-label",children:u}),p.jsxs(fe,{fontWeight:400,sx:{fontSize:".8rem",display:"flex",flexDirection:"row",whiteSpace:"pre",alignItems:"center"},className:"doughnut-chart-legend-item-value",children:[u?"- ":"",p.jsx(ne,{component:"span",alignItems:"center",sx:{display:"flex",borderRadius:"4px",background:Ee[400],padding:"0.25rem 0.5rem",fontWeight:500,fontSize:"0.75rem"},children:h?`${d[f]} %`:"--%"})]}),(i==null?void 0:i.actions)&&(i==null?void 0:i.seeMore)&&(i==null?void 0:i.actions[f])&&p.jsx(p2,{action:i==null?void 0:i.actions[f],seeMore:i==null?void 0:i.seeMore})]})},f)})})})},Vz=e=>{const{values:t,labels:n,palette:o,legend:r,hoveredArcIndex:i,setHoveredArcIndex:a,icons:l=[]}=e;return!n||!n.length?null:(r==null?void 0:r.position)==="bottom"?p.jsx(Lz,{labels:n,hoveredArcIndex:i,setHoveredArcIndex:a,values:t,palette:o,legend:r}):(r==null?void 0:r.position)==="right"?p.jsx(Az,{labels:n,hoveredArcIndex:i,setHoveredArcIndex:a,values:t,palette:o,legend:r,icons:l}):null};function El(e){if(typeof window>"u")return e;const t=y.useRef(null);return y.useLayoutEffect(()=>{t.current=e}),y.useCallback((...n)=>{var o;(o=t.current)===null||o===void 0||o.call(t,...n)},[])}const Eb={};function Fz(e,t){Eb[e]||(Eb[e]=!0,console.error("[material-ui-popup-state] WARNING",t))}const $z={isOpen:!1,setAnchorElUsed:!1,anchorEl:void 0,anchorPosition:void 0,hovered:!1,focused:!1,_openEventType:null,_childPopupState:null,_deferNextOpen:!1,_deferNextClose:!1},kb=y,Nz="useId"in kb?()=>kb.useId():()=>{};function Bz({parentPopupState:e,popupId:t=Nz(),variant:n,disableAutoFocus:o}){const r=G.useRef(!0);G.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]);const[i,a]=G.useState($z),l=G.useCallback(C=>{r.current&&a(C)},[]),c=G.useCallback(C=>l(S=>({...S,setAnchorElUsed:!0,anchorEl:C??void 0})),[]),d=El(C=>(i.isOpen?h(C):u(C),i)),u=El(C=>{const S=C instanceof Element?void 0:C,P=C instanceof Element?C:(C==null?void 0:C.currentTarget)instanceof Element?C.currentTarget:void 0;if((S==null?void 0:S.type)==="touchstart"){l(E=>({...E,_deferNextOpen:!0}));return}const w=S==null?void 0:S.clientX,R=S==null?void 0:S.clientY,M=typeof w=="number"&&typeof R=="number"?{left:w,top:R}:void 0,O=E=>{if(!C&&!E.setAnchorElUsed&&n!=="dialog"&&Fz("missingEventOrAnchorEl","eventOrAnchorEl should be defined if setAnchorEl is not used"),e){if(!e.isOpen)return E;setTimeout(()=>e._setChildPopupState(x))}const k={...E,isOpen:!0,anchorPosition:M,hovered:(S==null?void 0:S.type)==="mouseover"||E.hovered,focused:(S==null?void 0:S.type)==="focus"||E.focused,_openEventType:S==null?void 0:S.type};return E.setAnchorElUsed||(S!=null&&S.currentTarget?k.anchorEl=S==null?void 0:S.currentTarget:P&&(k.anchorEl=P)),k};l(E=>E._deferNextOpen?(setTimeout(()=>l(O),0),{...E,_deferNextOpen:!1}):O(E))}),f=C=>{const{_childPopupState:S}=C;return setTimeout(()=>{S==null||S.close(),e==null||e._setChildPopupState(null)}),{...C,isOpen:!1,hovered:!1,focused:!1}},h=El(C=>{const S=C instanceof Element?void 0:C;if((S==null?void 0:S.type)==="touchstart"){l(P=>({...P,_deferNextClose:!0}));return}l(P=>P._deferNextClose?(setTimeout(()=>l(f),0),{...P,_deferNextClose:!1}):f(P))}),g=G.useCallback((C,S)=>{C?u(S):h(S)},[]),m=El(C=>{const{relatedTarget:S}=C;l(P=>P.hovered&&!(S instanceof Element&&f2(S,x))?P.focused?{...P,hovered:!1}:f(P):P)}),b=El(C=>{if(!C)return;const{relatedTarget:S}=C;l(P=>P.focused&&!(S instanceof Element&&f2(S,x))?P.hovered?{...P,focused:!1}:f(P):P)}),v=G.useCallback(C=>l(S=>({...S,_childPopupState:C})),[]),x={...i,setAnchorEl:c,popupId:t??void 0,variant:n,open:u,close:h,toggle:d,setOpen:g,onBlur:b,onMouseLeave:m,disableAutoFocus:o??!!(i.hovered||i.focused),_setChildPopupState:v};return x}function Hz({isOpen:e,anchorEl:t,anchorPosition:n,close:o,popupId:r,onMouseLeave:i,disableAutoFocus:a,_openEventType:l}){return{id:r,anchorEl:t,anchorPosition:n,anchorReference:l==="contextmenu"?"anchorPosition":"anchorEl",open:e,onClose:o,onMouseLeave:i,...a&&{disableAutoFocus:!0,disableEnforceFocus:!0,disableRestoreFocus:!0}}}function zz(e,{popupId:t}){if(!t)return null;const n=typeof e.getRootNode=="function"?e.getRootNode():document;return typeof n.getElementById=="function"?n.getElementById(t):null}function f2(e,t){const{anchorEl:n,_childPopupState:o}=t;return Ib(n,e)||Ib(zz(e,t),e)||o!=null&&f2(e,o)}function Ib(e,t){if(!e)return!1;for(;t;){if(t===e)return!0;t=t.parentElement}return!1}function jb({children:e,popupId:t,variant:n,parentPopupState:o,disableAutoFocus:r}){const i=Bz({popupId:t,variant:n,parentPopupState:o,disableAutoFocus:r}),a=e(i);return a??null}jb.propTypes={children:s.func.isRequired,popupId:s.string,variant:s.oneOf(["popover","popper"]).isRequired,parentPopupState:s.object,disableAutoFocus:s.bool};function Wz(e){const t=e;return t.__esModule?t.default:e}const Uz=Wz(ko),Zz=y.forwardRef(function(t,n){var o,r;const i=y.useMemo(()=>{var a;const l=(a=t.slotProps)===null||a===void 0?void 0:a.paper;return l instanceof Function?c=>{const d=l(c);return{...d,style:{pointerEvents:"auto",...d==null?void 0:d.style}}}:{...l,style:{pointerEvents:"auto",...l==null?void 0:l.style}}},[(o=t.slotProps)===null||o===void 0?void 0:o.paper]);return y.createElement(Uz,hC({},t,{ref:n,style:{pointerEvents:"none",...t.style},PaperProps:{...t.PaperProps,style:{pointerEvents:"auto",...(r=t.PaperProps)===null||r===void 0?void 0:r.style}},slotProps:{...t.slotProps,paper:i}}))});Cl.register(ki);const qz=e=>{const{values:t,labels:n,colors:o,legend:r,children:i,valuesUnit:a,className:l,valuesFormatterFn:c}=e,[d,u]=G.useState(null),[f,h]=G.useState(!1),[g,m]=G.useState(),[b,v]=G.useState(null),[x,C]=G.useState(null),S=(k,I)=>{v(k),C(I)};G.useEffect(()=>{!n||!t||h(b!==null&&x!==null)},[n,t,b,x]);const P=Oe(),w=_z(P,100,700),R=(r==null?void 0:r.position)??"bottom",M=Dz(o&&o.length?o:w,t??[]),O=jz({...e,legend:!!r,theme:P,palette:M,hoveredArcIndex:d,setHoveredArcIndex:u,handleChartHover:S});G.useEffect(()=>{d!==null&&n&&n[d]!==void 0&&t&&t[d]!==void 0?m(p.jsxs(ne,{sx:{maxWidth:"250px"},children:[p.jsx(fe,{fontWeight:700,fontSize:"0.75rem",children:n[d]}),p.jsxs(fe,{fontWeight:700,fontSize:"1.5rem",children:[c?c(t[d]):t[d]," ",a&&p.jsx(fe,{component:"span",fontWeight:500,fontSize:"0.75rem",color:Ee[1400],children:a})]})]})):h(!1)},[a,d,n,t]);const E=t==null?void 0:t.reduce((k,I)=>k+I,0);return p.jsx(we,{onMouseLeave:()=>u(null),direction:R==="bottom"?"column":"row",gap:"3rem",className:`doughnut-chart ${l}`,children:p.jsx(jb,{variant:"popover",popupId:"demoPopover",disableAutoFocus:!0,children:k=>p.jsxs(p.Fragment,{children:[p.jsx(ne,{position:"relative",margin:"28px auto",sx:R==="bottom"?{maxWidth:"300px"}:{minWidth:"300px"},className:"doughnut-chart-wrapper",id:"doughnut-chart-wrapper",children:p.jsxs(ne,{position:"relative",children:[p.jsx(KB,{...O,style:{maxWidth:"100%"}}),p.jsx(Zz,{...Hz(k),open:f,anchorEl:document.getElementById("doughnut-chart-wrapper"),onClose:()=>{h(!1),u(null)},anchorOrigin:{vertical:(x||0)-10,horizontal:b||0},transformOrigin:{vertical:"bottom",horizontal:"center"},slotProps:{paper:{sx:{border:`1px solid ${Ee[500]}`,minWidth:220,borderRadius:"12px",padding:"8px"}}},children:p.jsx(ne,{sx:{p:2},children:g})}),p.jsx(ne,{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",padding:"10%",textAlign:"center",sx:{inset:"12.5%",pointerEvents:"none",top:0,bottom:0},className:"doughnut-chart-content",children:p.jsxs(ne,{display:"flex",flexDirection:"column",children:[p.jsx(ne,{fontWeight:700,fontSize:"3rem",children:i!==void 0?i:E},"content-1"),a&&p.jsx(ne,{sx:{color:Ee[1400]},children:a})]})})]})}),p.jsx(ne,{display:"flex",onMouseEnter:()=>h(!1),children:p.jsx(Vz,{labels:n,hoveredArcIndex:d,setHoveredArcIndex:u,values:t,palette:M,legend:r,icons:e.icons})})]})})})};/*!
|
|
368
|
+
`):e}function fB(e,t){const{element:n,datasetIndex:o,index:r}=t,i=e.getDatasetMeta(o).controller,{label:a,value:l}=i.getLabelAndValue(r);return{chart:e,label:a,parsed:i.getParsed(r),raw:e.data.datasets[o].data[r],formattedValue:l,dataset:i.getDataset(),dataIndex:r,datasetIndex:o,element:n}}function R7(e,t){const n=e.chart.ctx,{body:o,footer:r,title:i}=e,{boxWidth:a,boxHeight:l}=t,c=gn(t.bodyFont),d=gn(t.titleFont),u=gn(t.footerFont),f=i.length,h=r.length,g=o.length,m=Mn(t.padding);let b=m.height,v=0,x=o.reduce((P,w)=>P+w.before.length+w.lines.length+w.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,f&&(b+=f*d.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),x){const P=t.displayColors?Math.max(l,c.lineHeight):c.lineHeight;b+=g*P+(x-g)*c.lineHeight+(x-1)*t.bodySpacing}h&&(b+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let C=0;const S=function(P){v=Math.max(v,n.measureText(P).width+C)};return n.save(),n.font=d.string,$t(e.title,S),n.font=c.string,$t(e.beforeBody.concat(e.afterBody),S),C=t.displayColors?a+2+t.boxPadding:0,$t(o,P=>{$t(P.before,S),$t(P.lines,S),$t(P.after,S)}),C=0,n.font=u.string,$t(e.footer,S),n.restore(),v+=m.width,{width:v,height:b}}function hB(e,t){const{y:n,height:o}=t;return n<o/2?"top":n>e.height-o/2?"bottom":"center"}function gB(e,t,n,o){const{x:r,width:i}=o,a=n.caretSize+n.caretPadding;if(e==="left"&&r+i+a>t.width||e==="right"&&r-i-a<0)return!0}function mB(e,t,n,o){const{x:r,width:i}=n,{width:a,chartArea:{left:l,right:c}}=e;let d="center";return o==="center"?d=r<=(l+c)/2?"left":"right":r<=i/2?d="left":r>=a-i/2&&(d="right"),gB(d,e,t,n)&&(d="center"),d}function O7(e,t,n){const o=n.yAlign||t.yAlign||hB(e,n);return{xAlign:n.xAlign||t.xAlign||mB(e,t,n,o),yAlign:o}}function bB(e,t){let{x:n,width:o}=e;return t==="right"?n-=o:t==="center"&&(n-=o/2),n}function vB(e,t,n){let{y:o,height:r}=e;return t==="top"?o+=n:t==="bottom"?o-=r+n:o-=r/2,o}function E7(e,t,n,o){const{caretSize:r,caretPadding:i,cornerRadius:a}=e,{xAlign:l,yAlign:c}=n,d=r+i,{topLeft:u,topRight:f,bottomLeft:h,bottomRight:g}=Ti(a);let m=bB(t,l);const b=vB(t,c,d);return c==="center"?l==="left"?m+=d:l==="right"&&(m-=d):l==="left"?m-=Math.max(u,h)+r:l==="right"&&(m+=Math.max(f,g)+r),{x:Sn(m,0,o.width-t.width),y:Sn(b,0,o.height-t.height)}}function ou(e,t,n){const o=Mn(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-o.right:e.x+o.left}function k7(e){return er([],yr(e))}function xB(e,t,n){return zr(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function I7(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const j7={beforeTitle:hr,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,o=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(o>0&&t.dataIndex<o)return n[t.dataIndex]}return""},afterTitle:hr,beforeBody:hr,beforeLabel:hr,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return yt(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:hr,afterBody:hr,beforeFooter:hr,footer:hr,afterFooter:hr};function Zn(e,t,n,o){const r=e[t].call(n,o);return typeof r>"u"?j7[t].call(n,o):r}class Ff extends xr{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,o=this.options.setContext(this.getContext()),r=o.enabled&&n.options.animation&&o.animations,i=new C4(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=xB(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:o}=n,r=Zn(o,"beforeTitle",this,t),i=Zn(o,"title",this,t),a=Zn(o,"afterTitle",this,t);let l=[];return l=er(l,yr(r)),l=er(l,yr(i)),l=er(l,yr(a)),l}getBeforeBody(t,n){return k7(Zn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:o}=n,r=[];return $t(t,i=>{const a={before:[],lines:[],after:[]},l=I7(o,i);er(a.before,yr(Zn(l,"beforeLabel",this,i))),er(a.lines,Zn(l,"label",this,i)),er(a.after,yr(Zn(l,"afterLabel",this,i))),r.push(a)}),r}getAfterBody(t,n){return k7(Zn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:o}=n,r=Zn(o,"beforeFooter",this,t),i=Zn(o,"footer",this,t),a=Zn(o,"afterFooter",this,t);let l=[];return l=er(l,yr(r)),l=er(l,yr(i)),l=er(l,yr(a)),l}_createItems(t){const n=this._active,o=this.chart.data,r=[],i=[],a=[];let l=[],c,d;for(c=0,d=n.length;c<d;++c)l.push(fB(this.chart,n[c]));return t.filter&&(l=l.filter((u,f,h)=>t.filter(u,f,h,o))),t.itemSort&&(l=l.sort((u,f)=>t.itemSort(u,f,o))),$t(l,u=>{const f=I7(t.callbacks,u);r.push(Zn(f,"labelColor",this,u)),i.push(Zn(f,"labelPointStyle",this,u)),a.push(Zn(f,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=l,l}update(t,n){const o=this.options.setContext(this.getContext()),r=this._active;let i,a=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{const l=Tl[o.position].call(this,r,this._eventPosition);a=this._createItems(o),this.title=this.getTitle(a,o),this.beforeBody=this.getBeforeBody(a,o),this.body=this.getBody(a,o),this.afterBody=this.getAfterBody(a,o),this.footer=this.getFooter(a,o);const c=this._size=R7(this,o),d=Object.assign({},l,c),u=O7(this.chart,o,d),f=E7(o,d,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:f.x,y:f.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),t&&o.external&&o.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,o,r){const i=this.getCaretPosition(t,o,r);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(t,n,o){const{xAlign:r,yAlign:i}=this,{caretSize:a,cornerRadius:l}=o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=Ti(l),{x:h,y:g}=t,{width:m,height:b}=n;let v,x,C,S,P,w;return i==="center"?(P=g+b/2,r==="left"?(v=h,x=v-a,S=P+a,w=P-a):(v=h+m,x=v+a,S=P-a,w=P+a),C=v):(r==="left"?x=h+Math.max(c,u)+a:r==="right"?x=h+m-Math.max(d,f)-a:x=this.caretX,i==="top"?(S=g,P=S-a,v=x-a,C=x+a):(S=g+b,P=S+a,v=x+a,C=x-a),w=S),{x1:v,x2:x,x3:C,y1:S,y2:P,y3:w}}drawTitle(t,n,o){const r=this.title,i=r.length;let a,l,c;if(i){const d=_s(o.rtl,this.x,this.width);for(t.x=ou(this,o.titleAlign,o),n.textAlign=d.textAlign(o.titleAlign),n.textBaseline="middle",a=gn(o.titleFont),l=o.titleSpacing,n.fillStyle=o.titleColor,n.font=a.string,c=0;c<i;++c)n.fillText(r[c],d.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+l,c+1===i&&(t.y+=o.titleMarginBottom-l)}}_drawColorBox(t,n,o,r,i){const a=this.labelColors[o],l=this.labelPointStyles[o],{boxHeight:c,boxWidth:d}=i,u=gn(i.bodyFont),f=ou(this,"left",i),h=r.x(f),g=c<u.lineHeight?(u.lineHeight-c)/2:0,m=n.y+g;if(i.usePointStyle){const b={radius:Math.min(d,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},v=r.leftForLtr(h,d)+d/2,x=m+c/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,ff(t,b,v,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,ff(t,b,v,x)}else{t.lineWidth=St(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const b=r.leftForLtr(h,d),v=r.leftForLtr(r.xPlus(h,1),d-2),x=Ti(a.borderRadius);Object.values(x).some(C=>C!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,dl(t,{x:b,y:m,w:d,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),dl(t,{x:v,y:m+1,w:d-2,h:c-2,radius:x}),t.fill()):(t.fillStyle=i.multiKeyBackground,t.fillRect(b,m,d,c),t.strokeRect(b,m,d,c),t.fillStyle=a.backgroundColor,t.fillRect(v,m+1,d-2,c-2))}t.fillStyle=this.labelTextColors[o]}drawBody(t,n,o){const{body:r}=this,{bodySpacing:i,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:d,boxPadding:u}=o,f=gn(o.bodyFont);let h=f.lineHeight,g=0;const m=_s(o.rtl,this.x,this.width),b=function(O){n.fillText(O,m.x(t.x+g),t.y+h/2),t.y+=h+i},v=m.textAlign(a);let x,C,S,P,w,R,M;for(n.textAlign=a,n.textBaseline="middle",n.font=f.string,t.x=ou(this,v,o),n.fillStyle=o.bodyColor,$t(this.beforeBody,b),g=l&&v!=="right"?a==="center"?d/2+u:d+2+u:0,P=0,R=r.length;P<R;++P){for(x=r[P],C=this.labelTextColors[P],n.fillStyle=C,$t(x.before,b),S=x.lines,l&&S.length&&(this._drawColorBox(n,t,P,m,o),h=Math.max(f.lineHeight,c)),w=0,M=S.length;w<M;++w)b(S[w]),h=f.lineHeight;$t(x.after,b)}g=0,h=f.lineHeight,$t(this.afterBody,b),t.y-=i}drawFooter(t,n,o){const r=this.footer,i=r.length;let a,l;if(i){const c=_s(o.rtl,this.x,this.width);for(t.x=ou(this,o.footerAlign,o),t.y+=o.footerMarginTop,n.textAlign=c.textAlign(o.footerAlign),n.textBaseline="middle",a=gn(o.footerFont),n.fillStyle=o.footerColor,n.font=a.string,l=0;l<i;++l)n.fillText(r[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o.footerSpacing}}drawBackground(t,n,o,r){const{xAlign:i,yAlign:a}=this,{x:l,y:c}=t,{width:d,height:u}=o,{topLeft:f,topRight:h,bottomLeft:g,bottomRight:m}=Ti(r.cornerRadius);n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.beginPath(),n.moveTo(l+f,c),a==="top"&&this.drawCaret(t,n,o,r),n.lineTo(l+d-h,c),n.quadraticCurveTo(l+d,c,l+d,c+h),a==="center"&&i==="right"&&this.drawCaret(t,n,o,r),n.lineTo(l+d,c+u-m),n.quadraticCurveTo(l+d,c+u,l+d-m,c+u),a==="bottom"&&this.drawCaret(t,n,o,r),n.lineTo(l+g,c+u),n.quadraticCurveTo(l,c+u,l,c+u-g),a==="center"&&i==="left"&&this.drawCaret(t,n,o,r),n.lineTo(l,c+f),n.quadraticCurveTo(l,c,l+f,c),n.closePath(),n.fill(),r.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,o=this.$animations,r=o&&o.x,i=o&&o.y;if(r||i){const a=Tl[t.position].call(this,this._active,this._eventPosition);if(!a)return;const l=this._size=R7(this,t),c=Object.assign({},a,this._size),d=O7(n,t,c),u=E7(t,c,d,n);(r._to!==u.x||i._to!==u.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let o=this.opacity;if(!o)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},i={x:this.x,y:this.y};o=Math.abs(o)<.001?0:o;const a=Mn(n.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&l&&(t.save(),t.globalAlpha=o,this.drawBackground(i,t,r,n),p4(t,n.textDirection),i.y+=a.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),f4(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const o=this._active,r=t.map(({datasetIndex:l,index:c})=>{const d=this.chart.getDatasetMeta(l);if(!d)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:d.data[c],index:c}}),i=!Id(o,r),a=this._positionChanged(r,n);(i||a)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,o=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,i=this._active||[],a=this._getActiveElements(t,i,n,o),l=this._positionChanged(a,t),c=n||!Id(a,i)||l;return c&&(this._active=a,(r.enabled||r.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,o,r){const i=this.options;if(t.type==="mouseout")return[];if(!r)return n.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,i.mode,i,o);return i.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:o,caretY:r,options:i}=this,a=Tl[i.position].call(this,t,n);return a!==!1&&(o!==a.x||r!==a.y)}}qe(Ff,"positioners",Tl);var yB={id:"tooltip",_element:Ff,positioners:Tl,afterInit(e,t,n){n&&(e.tooltip=new Ff({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,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:(e,t)=>t.bodyFont.size,boxWidth:(e,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:j7},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},CB=Object.freeze({__proto__:null,Colors:_N,Decimation:VN,Filler:oB,Legend:cB,SubTitle:pB,Title:uB,Tooltip:yB});const wB=(e,t,n,o)=>(typeof t=="string"?(n=e.push(t)-1,o.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function SB(e,t,n,o){const r=e.indexOf(t);if(r===-1)return wB(e,t,n,o);const i=e.lastIndexOf(t);return r!==i?n:r}const TB=(e,t)=>e===null?null:Sn(Math.round(e),0,t);function _7(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class $f extends Ei{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const o=this.getLabels();for(const{index:r,label:i}of n)o[r]===i&&o.splice(r,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(yt(t))return null;const o=this.getLabels();return n=isFinite(n)&&o[n]===t?n:SB(o,t,ct(n,t),this._addedLabels),TB(n,o.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:o,max:r}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(o=0),n||(r=this.getLabels().length-1)),this.min=o,this.max=r}buildTicks(){const t=this.min,n=this.max,o=this.options.offset,r=[];let i=this.getLabels();i=t===0&&n===i.length-1?i:i.slice(t,n+1),this._valueRange=Math.max(i.length-(o?0:1),1),this._startValue=this.min-(o?.5:0);for(let a=t;a<=n;a++)r.push({value:a});return r}getLabelForValue(t){return _7.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}qe($f,"id","category"),qe($f,"defaults",{ticks:{callback:_7}});function PB(e,t){const n=[],{bounds:r,step:i,min:a,max:l,precision:c,count:d,maxTicks:u,maxDigits:f,includeBounds:h}=e,g=i||1,m=u-1,{min:b,max:v}=t,x=!yt(a),C=!yt(l),S=!yt(d),P=(v-b)/(f+1);let w=V6((v-b)/m/g)*g,R,M,O,E;if(w<1e-14&&!x&&!C)return[{value:b},{value:v}];E=Math.ceil(v/w)-Math.floor(b/w),E>m&&(w=V6(E*w/m/g)*g),yt(c)||(R=Math.pow(10,c),w=Math.ceil(w*R)/R),r==="ticks"?(M=Math.floor(b/w)*w,O=Math.ceil(v/w)*w):(M=b,O=v),x&&C&&i&&xV((l-a)/i,w/1e3)?(E=Math.round(Math.min((l-a)/w,u)),w=(l-a)/E,M=a,O=l):S?(M=x?a:M,O=C?l:O,E=d-1,w=(O-M)/E):(E=(O-M)/w,il(E,Math.round(E),w/1e3)?E=Math.round(E):E=Math.ceil(E));const k=Math.max($6(w),$6(M));R=Math.pow(10,yt(c)?k:c),M=Math.round(M*R)/R,O=Math.round(O*R)/R;let I=0;for(x&&(h&&M!==a?(n.push({value:a}),M<a&&I++,il(Math.round((M+I*w)*R)/R,a,D7(a,P,e))&&I++):M<a&&I++);I<E;++I){const _=Math.round((M+I*w)*R)/R;if(C&&_>l)break;n.push({value:_})}return C&&h&&O!==l?n.length&&il(n[n.length-1].value,l,D7(l,P,e))?n[n.length-1].value=l:n.push({value:l}):(!C||O===l)&&n.push({value:O}),n}function D7(e,t,{horizontal:n,minRotation:o}){const r=Io(o),i=(n?Math.sin(r):Math.cos(r))||.001,a=.75*t*(""+e).length;return Math.min(t/i,a)}class ru extends Ei{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,n){return yt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:o}=this.getUserBounds();let{min:r,max:i}=this;const a=c=>r=n?r:c,l=c=>i=o?i:c;if(t){const c=Qo(r),d=Qo(i);c<0&&d<0?l(0):c>0&&d>0&&a(0)}if(r===i){let c=i===0?1:Math.abs(i*.05);l(i+c),t||a(r-c)}this.min=r,this.max=i}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:o}=t,r;return o?(r=Math.ceil(this.max/o)-Math.floor(this.min/o)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${o} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let o=this.getTickLimit();o=Math.max(2,o);const r={maxTicks:o,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},i=this._range||this,a=PB(r,i);return t.bounds==="ticks"&&F6(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(){const t=this.ticks;let n=this.min,o=this.max;if(super.configure(),this.options.offset&&t.length){const r=(o-n)/Math.max(t.length-1,1)/2;n-=r,o+=r}this._startValue=n,this._endValue=o,this._valueRange=o-n}getLabelForValue(t){return ll(t,this.chart.options.locale,this.options.ticks.format)}}class Nf extends ru{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=ln(t)?t:0,this.max=ln(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,o=Io(this.options.ticks.minRotation),r=(t?Math.sin(o):Math.cos(o))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/r))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}qe(Nf,"id","linear"),qe(Nf,"defaults",{ticks:{callback:Ld.formatters.numeric}});const Pl=e=>Math.floor(Hr(e)),Ii=(e,t)=>Math.pow(10,Pl(e)+t);function L7(e){return e/Math.pow(10,Pl(e))===1}function A7(e,t,n){const o=Math.pow(10,n),r=Math.floor(e/o);return Math.ceil(t/o)-r}function MB(e,t){const n=t-e;let o=Pl(n);for(;A7(e,t,o)>10;)o++;for(;A7(e,t,o)<10;)o--;return Math.min(o,Pl(e))}function RB(e,{min:t,max:n}){t=io(e.min,t);const o=[],r=Pl(t);let i=MB(t,n),a=i<0?Math.pow(10,Math.abs(i)):1;const l=Math.pow(10,i),c=r>i?Math.pow(10,r):0,d=Math.round((t-c)*a)/a,u=Math.floor((t-c)/l/10)*l*10;let f=Math.floor((d-u)/Math.pow(10,i)),h=io(e.min,Math.round((c+u+f*Math.pow(10,i))*a)/a);for(;h<n;)o.push({value:h,major:L7(h),significand:f}),f>=10?f=f<15?15:20:f++,f>=20&&(i++,f=2,a=i>=0?1:a),h=Math.round((c+u+f*Math.pow(10,i))*a)/a;const g=io(e.max,h);return o.push({value:g,major:L7(g),significand:f}),o}class Bf extends Ei{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const o=ru.prototype.parse.apply(this,[t,n]);if(o===0){this._zero=!0;return}return ln(o)&&o>0?o:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=ln(t)?Math.max(0,t):null,this.max=ln(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ln(this._userMin)&&(this.min=t===Ii(this.min,0)?Ii(this.min,-1):Ii(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let o=this.min,r=this.max;const i=l=>o=t?o:l,a=l=>r=n?r:l;o===r&&(o<=0?(i(1),a(10)):(i(Ii(o,-1)),a(Ii(r,1)))),o<=0&&i(Ii(r,-1)),r<=0&&a(Ii(o,1)),this.min=o,this.max=r}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},o=RB(n,this);return t.bounds==="ticks"&&F6(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}getLabelForValue(t){return t===void 0?"0":ll(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Hr(t),this._valueRange=Hr(this.max)-Hr(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Hr(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}qe(Bf,"id","logarithmic"),qe(Bf,"defaults",{ticks:{callback:Ld.formatters.logarithmic,major:{enabled:!0}}});function Hf(e){const t=e.ticks;if(t.display&&e.display){const n=Mn(t.backdropPadding);return ct(t.font&&t.font.size,nn.font.size)+n.height}return 0}function OB(e,t,n){return n=Yt(n)?n:[n],{w:AV(e,t.string,n),h:n.length*t.lineHeight}}function V7(e,t,n,o,r){return e===o||e===r?{start:t-n/2,end:t+n/2}:e<o||e>r?{start:t-n,end:t}:{start:t,end:t+n}}function EB(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),o=[],r=[],i=e._pointLabels.length,a=e.options.pointLabels,l=a.centerPointLabels?Kt/i:0;for(let c=0;c<i;c++){const d=a.setContext(e.getPointLabelContext(c));r[c]=d.padding;const u=e.getPointPosition(c,e.drawingArea+r[c],l),f=gn(d.font),h=OB(e.ctx,f,e._pointLabels[c]);o[c]=h;const g=so(e.getIndexAngle(c)+l),m=Math.round(rf(g)),b=V7(m,u.x,h.w,0,180),v=V7(m,u.y,h.h,90,270);kB(n,t,g,b,v)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=_B(e,o,r)}function kB(e,t,n,o,r){const i=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));let l=0,c=0;o.start<t.l?(l=(t.l-o.start)/i,e.l=Math.min(e.l,t.l-l)):o.end>t.r&&(l=(o.end-t.r)/i,e.r=Math.max(e.r,t.r+l)),r.start<t.t?(c=(t.t-r.start)/a,e.t=Math.min(e.t,t.t-c)):r.end>t.b&&(c=(r.end-t.b)/a,e.b=Math.max(e.b,t.b+c))}function IB(e,t,n){const o=e.drawingArea,{extra:r,additionalAngle:i,padding:a,size:l}=n,c=e.getPointPosition(t,o+r+a,i),d=Math.round(rf(so(c.angle+fn))),u=AB(c.y,l.h,d),f=DB(d),h=LB(c.x,l.w,f);return{visible:!0,x:c.x,y:u,textAlign:f,left:h,top:u,right:h+l.w,bottom:u+l.h}}function jB(e,t){if(!t)return!0;const{left:n,top:o,right:r,bottom:i}=e;return!(br({x:n,y:o},t)||br({x:n,y:i},t)||br({x:r,y:o},t)||br({x:r,y:i},t))}function _B(e,t,n){const o=[],r=e._pointLabels.length,i=e.options,{centerPointLabels:a,display:l}=i.pointLabels,c={extra:Hf(i)/2,additionalAngle:a?Kt/r:0};let d;for(let u=0;u<r;u++){c.padding=n[u],c.size=t[u];const f=IB(e,u,c);o.push(f),l==="auto"&&(f.visible=jB(f,d),f.visible&&(d=f))}return o}function DB(e){return e===0||e===180?"center":e<180?"left":"right"}function LB(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function AB(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function VB(e,t,n){const{left:o,top:r,right:i,bottom:a}=n,{backdropColor:l}=t;if(!yt(l)){const c=Ti(t.borderRadius),d=Mn(t.backdropPadding);e.fillStyle=l;const u=o-d.left,f=r-d.top,h=i-o+d.width,g=a-r+d.height;Object.values(c).some(m=>m!==0)?(e.beginPath(),dl(e,{x:u,y:f,w:h,h:g,radius:c}),e.fill()):e.fillRect(u,f,h,g)}}function FB(e,t){const{ctx:n,options:{pointLabels:o}}=e;for(let r=t-1;r>=0;r--){const i=e._pointLabelItems[r];if(!i.visible)continue;const a=o.setContext(e.getPointLabelContext(r));VB(n,a,i);const l=gn(a.font),{x:c,y:d,textAlign:u}=i;Si(n,e._pointLabels[r],c,d+l.lineHeight/2,l,{color:a.color,textAlign:u,textBaseline:"middle"})}}function F7(e,t,n,o){const{ctx:r}=e;if(n)r.arc(e.xCenter,e.yCenter,t,0,Xt);else{let i=e.getPointPosition(0,t);r.moveTo(i.x,i.y);for(let a=1;a<o;a++)i=e.getPointPosition(a,t),r.lineTo(i.x,i.y)}}function $B(e,t,n,o,r){const i=e.ctx,a=t.circular,{color:l,lineWidth:c}=t;!a&&!o||!l||!c||n<0||(i.save(),i.strokeStyle=l,i.lineWidth=c,i.setLineDash(r.dash),i.lineDashOffset=r.dashOffset,i.beginPath(),F7(e,n,a,o),i.closePath(),i.stroke(),i.restore())}function NB(e,t,n){return zr(e,{label:n,index:t,type:"pointLabel"})}class Ml extends ru{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Mn(Hf(this.options)/2),n=this.width=this.maxWidth-t.width,o=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+n/2+t.left),this.yCenter=Math.floor(this.top+o/2+t.top),this.drawingArea=Math.floor(Math.min(n,o)/2)}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!1);this.min=ln(t)&&!isNaN(t)?t:0,this.max=ln(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Hf(this.options))}generateTickLabels(t){ru.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,o)=>{const r=Wt(this.options.pointLabels.callback,[n,o],this);return r||r===0?r:""}).filter((n,o)=>this.chart.getDataVisibility(o))}fit(){const t=this.options;t.display&&t.pointLabels.display?EB(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,o,r){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((o-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,o,r))}getIndexAngle(t){const n=Xt/(this._pointLabels.length||1),o=this.options.startAngle||0;return so(t*n+Io(o))}getDistanceFromCenterForValue(t){if(yt(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(yt(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t<n.length){const o=n[t];return NB(this.getContext(),t,o)}}getPointPosition(t,n,o=0){const r=this.getIndexAngle(t)-fn+o;return{x:Math.cos(r)*n+this.xCenter,y:Math.sin(r)*n+this.yCenter,angle:r}}getPointPositionForValue(t,n){return this.getPointPosition(t,this.getDistanceFromCenterForValue(n))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:n,top:o,right:r,bottom:i}=this._pointLabelItems[t];return{left:n,top:o,right:r,bottom:i}}drawBackground(){const{backgroundColor:t,grid:{circular:n}}=this.options;if(t){const o=this.ctx;o.save(),o.beginPath(),F7(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),o.closePath(),o.fillStyle=t,o.fill(),o.restore()}}drawGrid(){const t=this.ctx,n=this.options,{angleLines:o,grid:r,border:i}=n,a=this._pointLabels.length;let l,c,d;if(n.pointLabels.display&&FB(this,a),r.display&&this.ticks.forEach((u,f)=>{if(f!==0||f===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(f),g=r.setContext(h),m=i.setContext(h);$B(this,g,c,a,m)}}),o.display){for(t.save(),l=a-1;l>=0;l--){const u=o.setContext(this.getPointLabelContext(l)),{color:f,lineWidth:h}=u;!h||!f||(t.lineWidth=h,t.strokeStyle=f,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),d=this.getPointPosition(l,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(d.x,d.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,o=n.ticks;if(!o.display)return;const r=this.getIndexAngle(0);let i,a;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(r),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((l,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;const d=o.setContext(this.getContext(c)),u=gn(d.font);if(i=this.getDistanceFromCenterForValue(this.ticks[c].value),d.showLabelBackdrop){t.font=u.string,a=t.measureText(l.label).width,t.fillStyle=d.backdropColor;const f=Mn(d.backdropPadding);t.fillRect(-a/2-f.left,-i-u.size/2-f.top,a+f.width,u.size+f.height)}Si(t,l.label,0,-i,u,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),t.restore()}drawTitle(){}}qe(Ml,"id","radialLinear"),qe(Ml,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ld.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),qe(Ml,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),qe(Ml,"descriptors",{angleLines:{_fallback:"grid"}});const iu={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}},qn=Object.keys(iu);function $7(e,t){return e-t}function N7(e,t){if(yt(t))return null;const n=e._adapter,{parser:o,round:r,isoWeekday:i}=e._parseOpts;let a=t;return typeof o=="function"&&(a=o(a)),ln(a)||(a=typeof o=="string"?n.parse(a,o):n.parse(a)),a===null?null:(r&&(a=r==="week"&&(ks(i)||i===!0)?n.startOf(a,"isoWeek",i):n.startOf(a,r)),+a)}function B7(e,t,n,o){const r=qn.length;for(let i=qn.indexOf(e);i<r-1;++i){const a=iu[qn[i]],l=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-t)/(l*a.size))<=o)return qn[i]}return qn[r-1]}function BB(e,t,n,o,r){for(let i=qn.length-1;i>=qn.indexOf(n);i--){const a=qn[i];if(iu[a].common&&e._adapter.diff(r,o,a)>=t-1)return a}return qn[n?qn.indexOf(n):0]}function HB(e){for(let t=qn.indexOf(e)+1,n=qn.length;t<n;++t)if(iu[qn[t]].common)return qn[t]}function H7(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:o,hi:r}=af(n,t),i=n[o]>=t?n[o]:n[r];e[i]=!0}}function zB(e,t,n,o){const r=e._adapter,i=+r.startOf(t[0].value,o),a=t[t.length-1].value;let l,c;for(l=i;l<=a;l=+r.add(l,1,o))c=n[l],c>=0&&(t[c].major=!0);return t}function z7(e,t,n){const o=[],r={},i=t.length;let a,l;for(a=0;a<i;++a)l=t[a],r[l]=a,o.push({value:l,major:!1});return i===0||!n?o:zB(e,o,r,n)}class Rl extends Ei{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const o=t.time||(t.time={}),r=this._adapter=new QF._date(t.adapters.date);r.init(n),ol(o.displayFormats,r.formats()),this._parseOpts={parser:o.parser,round:o.round,isoWeekday:o.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:N7(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,o=t.time.unit||"day";let{min:r,max:i,minDefined:a,maxDefined:l}=this.getUserBounds();function c(d){!a&&!isNaN(d.min)&&(r=Math.min(r,d.min)),!l&&!isNaN(d.max)&&(i=Math.max(i,d.max))}(!a||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),r=ln(r)&&!isNaN(r)?r:+n.startOf(Date.now(),o),i=ln(i)&&!isNaN(i)?i:+n.endOf(Date.now(),o)+1,this.min=Math.min(r,i-1),this.max=Math.max(r+1,i)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],o=t[t.length-1]),{min:n,max:o}}buildTicks(){const t=this.options,n=t.time,o=t.ticks,r=o.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&r.length&&(this.min=this._userMin||r[0],this.max=this._userMax||r[r.length-1]);const i=this.min,a=this.max,l=SV(r,i,a);return this._unit=n.unit||(o.autoSkip?B7(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):BB(this,l.length,n.minUnit,this.min,this.max)),this._majorUnit=!o.major.enabled||this._unit==="year"?void 0:HB(this._unit),this.initOffsets(r),t.reverse&&l.reverse(),z7(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,o=0,r,i;this.options.offset&&t.length&&(r=this.getDecimalForValue(t[0]),t.length===1?n=1-r:n=(this.getDecimalForValue(t[1])-r)/2,i=this.getDecimalForValue(t[t.length-1]),t.length===1?o=i:o=(i-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=Sn(n,0,a),o=Sn(o,0,a),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,n=this.min,o=this.max,r=this.options,i=r.time,a=i.unit||B7(i.minUnit,n,o,this._getLabelCapacity(n)),l=ct(r.ticks.stepSize,1),c=a==="week"?i.isoWeekday:!1,d=ks(c)||c===!0,u={};let f=n,h,g;if(d&&(f=+t.startOf(f,"isoWeek",c)),f=+t.startOf(f,d?"day":a),t.diff(o,n,a)>1e5*l)throw new Error(n+" and "+o+" are too far apart with stepSize of "+l+" "+a);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(h=f,g=0;h<o;h=+t.add(h,l,a),g++)H7(u,h,m);return(h===o||r.bounds==="ticks"||g===1)&&H7(u,h,m),Object.keys(u).sort($7).map(b=>+b)}getLabelForValue(t){const n=this._adapter,o=this.options.time;return o.tooltipFormat?n.format(t,o.tooltipFormat):n.format(t,o.displayFormats.datetime)}format(t,n){const r=this.options.time.displayFormats,i=this._unit,a=n||r[i];return this._adapter.format(t,a)}_tickFormatFunction(t,n,o,r){const i=this.options,a=i.ticks.callback;if(a)return Wt(a,[t,n,o],this);const l=i.time.displayFormats,c=this._unit,d=this._majorUnit,u=c&&l[c],f=d&&l[d],h=o[n],g=d&&f&&h&&h.major;return this._adapter.format(t,r||(g?f:u))}generateTickLabels(t){let n,o,r;for(n=0,o=t.length;n<o;++n)r=t[n],r.label=this._tickFormatFunction(r.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,o=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+o)*n.factor)}getValueForPixel(t){const n=this._offsets,o=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+o*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,o=this.ctx.measureText(t).width,r=Io(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),a=Math.sin(r),l=this._resolveTickFontOptions(0).size;return{w:o*i+l*a,h:o*a+l*i}}_getLabelCapacity(t){const n=this.options.time,o=n.displayFormats,r=o[n.unit]||o.millisecond,i=this._tickFormatFunction(t,0,z7(this,[t],this._majorUnit),r),a=this._getLabelSize(i),l=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],n,o;if(t.length)return t;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,o=r.length;n<o;++n)t=t.concat(r[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,o;if(t.length)return t;const r=this.getLabels();for(n=0,o=r.length;n<o;++n)t.push(N7(this,r[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return z6(t.sort($7))}}qe(Rl,"id","time"),qe(Rl,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function su(e,t,n){let o=0,r=e.length-1,i,a,l,c;n?(t>=e[o].pos&&t<=e[r].pos&&({lo:o,hi:r}=mr(e,"pos",t)),{pos:i,time:l}=e[o],{pos:a,time:c}=e[r]):(t>=e[o].time&&t<=e[r].time&&({lo:o,hi:r}=mr(e,"time",t)),{time:i,pos:l}=e[o],{time:a,pos:c}=e[r]);const d=a-i;return d?l+(c-l)*(t-i)/d:l}class zf extends Rl{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=su(n,this.min),this._tableRange=su(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:o}=this,r=[],i=[];let a,l,c,d,u;for(a=0,l=t.length;a<l;++a)d=t[a],d>=n&&d<=o&&r.push(d);if(r.length<2)return[{time:n,pos:0},{time:o,pos:1}];for(a=0,l=r.length;a<l;++a)u=r[a+1],c=r[a-1],d=r[a],Math.round((u+c)/2)!==d&&i.push({time:d,pos:a/(l-1)});return i}_generate(){const t=this.min,n=this.max;let o=super.getDataTimestamps();return(!o.includes(t)||!o.length)&&o.splice(0,0,t),(!o.includes(n)||o.length===1)&&o.push(n),o.sort((r,i)=>r-i)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),o=this.getLabelTimestamps();return n.length&&o.length?t=this.normalize(n.concat(o)):t=n.length?n:o,t=this._cache.all=t,t}getDecimalForValue(t){return(su(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,o=this.getDecimalForPixel(t)/n.factor-n.end;return su(this._table,o*this._tableRange+this._minPos,!0)}}qe(zf,"id","timeseries"),qe(zf,"defaults",Rl.defaults);var WB=Object.freeze({__proto__:null,CategoryScale:$f,LinearScale:Nf,LogarithmicScale:Bf,RadialLinearScale:Ml,TimeScale:Rl,TimeSeriesScale:zf});const UB=[XF,RN,CB,WB],W7="label";function U7(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function ZB(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Z7(e,t){e.labels=t}function q7(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W7;const o=[];e.datasets=t.map(r=>{const i=e.datasets.find(a=>a[n]===r[n]);return!i||!r.data||o.includes(i)?{...r}:(o.push(i),Object.assign(i,r),i)})}function qB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W7;const n={labels:[],datasets:[]};return Z7(n,e.labels),q7(n,e.datasets,t),n}function GB(e,t){return e.getElementsAtEventForMode(t.nativeEvent,"nearest",{intersect:!0},!1)}function YB(e,t){const{height:n=150,width:o=300,redraw:r=!1,datasetIdKey:i,type:a,data:l,options:c,plugins:d=[],fallbackContent:u,updateMode:f,...h}=e,g=G.useRef(null),m=G.useRef(),b=()=>{g.current&&(m.current=new Cl(g.current,{type:a,data:qB(l,i),options:c&&{...c},plugins:d}),U7(t,m.current))},v=()=>{U7(t,null),m.current&&(m.current.destroy(),m.current=null)};return G.useEffect(()=>{!r&&m.current&&c&&ZB(m.current,c)},[r,c]),G.useEffect(()=>{!r&&m.current&&Z7(m.current.config.data,l.labels)},[r,l.labels]),G.useEffect(()=>{!r&&m.current&&l.datasets&&q7(m.current.config.data,l.datasets,i)},[r,l.datasets]),G.useEffect(()=>{m.current&&(r?(v(),setTimeout(b)):m.current.update(f))},[r,c,l.labels,l.datasets,f]),G.useEffect(()=>{m.current&&(v(),setTimeout(b))},[a]),G.useEffect(()=>(b(),()=>v()),[]),G.createElement("canvas",Object.assign({ref:g,role:"img",height:n,width:o},h),u)}const Wf=G.forwardRef(YB);function G7(e,t){return Cl.register(t),G.forwardRef((n,o)=>G.createElement(Wf,Object.assign({},n,{ref:o,type:e})))}const KB=G7("doughnut",Wr),XB=G7("scatter",fl),Ls=(e,t=0,n=1)=>Zf(qf(t,e),n),Uf=e=>{e._clipped=!1,e._unclipped=e.slice(0);for(let t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=Ls(e[t],0,255)):t===3&&(e[t]=Ls(e[t],0,1));return e},Y7={};for(let e of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Y7[`[object ${e}]`]=e.toLowerCase();function Ct(e){return Y7[Object.prototype.toString.call(e)]||"object"}const wt=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):Ct(e[0])=="object"&&t?t.split("").filter(n=>e[0][n]!==void 0).map(n=>e[0][n]):e[0],au=e=>{if(e.length<2)return null;const t=e.length-1;return Ct(e[t])=="string"?e[t].toLowerCase():null},{PI:lu,min:Zf,max:qf}=Math,Cr=lu*2,Gf=lu/3,QB=lu/180,JB=180/lu,dt={format:{},autodetect:[]};class ze{constructor(...t){const n=this;if(Ct(t[0])==="object"&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let o=au(t),r=!1;if(!o){r=!0,dt.sorted||(dt.autodetect=dt.autodetect.sort((i,a)=>a.p-i.p),dt.sorted=!0);for(let i of dt.autodetect)if(o=i.test(...t),o)break}if(dt.format[o]){const i=dt.format[o].apply(null,r?t:t.slice(0,-1));n._rgb=Uf(i)}else throw new Error("unknown format: "+t);n._rgb.length===3&&n._rgb.push(1)}toString(){return Ct(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}}const eH="2.6.0",ft=(...e)=>new ft.Color(...e);ft.Color=ze,ft.version=eH;const tH=(...e)=>{e=wt(e,"cmyk");const[t,n,o,r]=e,i=e.length>4?e[4]:1;return r===1?[0,0,0,i]:[t>=1?0:255*(1-t)*(1-r),n>=1?0:255*(1-n)*(1-r),o>=1?0:255*(1-o)*(1-r),i]},{max:K7}=Math,nH=(...e)=>{let[t,n,o]=wt(e,"rgb");t=t/255,n=n/255,o=o/255;const r=1-K7(t,K7(n,o)),i=r<1?1/(1-r):0,a=(1-t-r)*i,l=(1-n-r)*i,c=(1-o-r)*i;return[a,l,c,r]};ze.prototype.cmyk=function(){return nH(this._rgb)},ft.cmyk=(...e)=>new ze(...e,"cmyk"),dt.format.cmyk=tH,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"cmyk"),Ct(e)==="array"&&e.length===4)return"cmyk"}});const Yf=e=>Math.round(e*100)/100,oH=(...e)=>{const t=wt(e,"hsla");let n=au(e)||"lsa";return t[0]=Yf(t[0]||0),t[1]=Yf(t[1]*100)+"%",t[2]=Yf(t[2]*100)+"%",n==="hsla"||t.length>3&&t[3]<1?(t[3]=t.length>3?t[3]:1,n="hsla"):t.length=3,`${n}(${t.join(",")})`},X7=(...e)=>{e=wt(e,"rgba");let[t,n,o]=e;t/=255,n/=255,o/=255;const r=Zf(t,n,o),i=qf(t,n,o),a=(i+r)/2;let l,c;return i===r?(l=0,c=Number.NaN):l=a<.5?(i-r)/(i+r):(i-r)/(2-i-r),t==i?c=(n-o)/(i-r):n==i?c=2+(o-t)/(i-r):o==i&&(c=4+(t-n)/(i-r)),c*=60,c<0&&(c+=360),e.length>3&&e[3]!==void 0?[c,l,a,e[3]]:[c,l,a]},{round:Kf}=Math,rH=(...e)=>{const t=wt(e,"rgba");let n=au(e)||"rgb";return n.substr(0,3)=="hsl"?oH(X7(t),n):(t[0]=Kf(t[0]),t[1]=Kf(t[1]),t[2]=Kf(t[2]),(n==="rgba"||t.length>3&&t[3]<1)&&(t[3]=t.length>3?t[3]:1,n="rgba"),`${n}(${t.slice(0,n==="rgb"?3:4).join(",")})`)},{round:Xf}=Math,Qf=(...e)=>{e=wt(e,"hsl");const[t,n,o]=e;let r,i,a;if(n===0)r=i=a=o*255;else{const l=[0,0,0],c=[0,0,0],d=o<.5?o*(1+n):o+n-o*n,u=2*o-d,f=t/360;l[0]=f+1/3,l[1]=f,l[2]=f-1/3;for(let h=0;h<3;h++)l[h]<0&&(l[h]+=1),l[h]>1&&(l[h]-=1),6*l[h]<1?c[h]=u+(d-u)*6*l[h]:2*l[h]<1?c[h]=d:3*l[h]<2?c[h]=u+(d-u)*(2/3-l[h])*6:c[h]=u;[r,i,a]=[Xf(c[0]*255),Xf(c[1]*255),Xf(c[2]*255)]}return e.length>3?[r,i,a,e[3]]:[r,i,a,1]},Q7=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,J7=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,eb=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,tb=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,nb=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ob=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,{round:rb}=Math,Jf=e=>{e=e.toLowerCase().trim();let t;if(dt.format.named)try{return dt.format.named(e)}catch{}if(t=e.match(Q7)){const n=t.slice(1,4);for(let o=0;o<3;o++)n[o]=+n[o];return n[3]=1,n}if(t=e.match(J7)){const n=t.slice(1,5);for(let o=0;o<4;o++)n[o]=+n[o];return n}if(t=e.match(eb)){const n=t.slice(1,4);for(let o=0;o<3;o++)n[o]=rb(n[o]*2.55);return n[3]=1,n}if(t=e.match(tb)){const n=t.slice(1,5);for(let o=0;o<3;o++)n[o]=rb(n[o]*2.55);return n[3]=+n[3],n}if(t=e.match(nb)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const o=Qf(n);return o[3]=1,o}if(t=e.match(ob)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const o=Qf(n);return o[3]=+t[4],o}};Jf.test=e=>Q7.test(e)||J7.test(e)||eb.test(e)||tb.test(e)||nb.test(e)||ob.test(e),ze.prototype.css=function(e){return rH(this._rgb,e)},ft.css=(...e)=>new ze(...e,"css"),dt.format.css=Jf,dt.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&Ct(e)==="string"&&Jf.test(e))return"css"}}),dt.format.gl=(...e)=>{const t=wt(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t},ft.gl=(...e)=>new ze(...e,"gl"),ze.prototype.gl=function(){const e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};const{floor:iH}=Math,sH=(...e)=>{e=wt(e,"hcg");let[t,n,o]=e,r,i,a;o=o*255;const l=n*255;if(n===0)r=i=a=o;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const c=iH(t),d=t-c,u=o*(1-n),f=u+l*(1-d),h=u+l*d,g=u+l;switch(c){case 0:[r,i,a]=[g,h,u];break;case 1:[r,i,a]=[f,g,u];break;case 2:[r,i,a]=[u,g,h];break;case 3:[r,i,a]=[u,f,g];break;case 4:[r,i,a]=[h,u,g];break;case 5:[r,i,a]=[g,u,f];break}}return[r,i,a,e.length>3?e[3]:1]},aH=(...e)=>{const[t,n,o]=wt(e,"rgb"),r=Zf(t,n,o),i=qf(t,n,o),a=i-r,l=a*100/255,c=r/(255-a)*100;let d;return a===0?d=Number.NaN:(t===i&&(d=(n-o)/a),n===i&&(d=2+(o-t)/a),o===i&&(d=4+(t-n)/a),d*=60,d<0&&(d+=360)),[d,l,c]};ze.prototype.hcg=function(){return aH(this._rgb)},ft.hcg=(...e)=>new ze(...e,"hcg"),dt.format.hcg=sH,dt.autodetect.push({p:1,test:(...e)=>{if(e=wt(e,"hcg"),Ct(e)==="array"&&e.length===3)return"hcg"}});const lH=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,cH=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,ib=e=>{if(e.match(lH)){(e.length===4||e.length===7)&&(e=e.substr(1)),e.length===3&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const t=parseInt(e,16),n=t>>16,o=t>>8&255,r=t&255;return[n,o,r,1]}if(e.match(cH)){(e.length===5||e.length===9)&&(e=e.substr(1)),e.length===4&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e,16),n=t>>24&255,o=t>>16&255,r=t>>8&255,i=Math.round((t&255)/255*100)/100;return[n,o,r,i]}throw new Error(`unknown hex color: ${e}`)},{round:cu}=Math,sb=(...e)=>{let[t,n,o,r]=wt(e,"rgba"),i=au(e)||"auto";r===void 0&&(r=1),i==="auto"&&(i=r<1?"rgba":"rgb"),t=cu(t),n=cu(n),o=cu(o);let l="000000"+(t<<16|n<<8|o).toString(16);l=l.substr(l.length-6);let c="0"+cu(r*255).toString(16);switch(c=c.substr(c.length-2),i.toLowerCase()){case"rgba":return`#${l}${c}`;case"argb":return`#${c}${l}`;default:return`#${l}`}};ze.prototype.hex=function(e){return sb(this._rgb,e)},ft.hex=(...e)=>new ze(...e,"hex"),dt.format.hex=ib,dt.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&Ct(e)==="string"&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{cos:As}=Math,dH=(...e)=>{e=wt(e,"hsi");let[t,n,o]=e,r,i,a;return isNaN(t)&&(t=0),isNaN(n)&&(n=0),t>360&&(t-=360),t<0&&(t+=360),t/=360,t<1/3?(a=(1-n)/3,r=(1+n*As(Cr*t)/As(Gf-Cr*t))/3,i=1-(a+r)):t<2/3?(t-=1/3,r=(1-n)/3,i=(1+n*As(Cr*t)/As(Gf-Cr*t))/3,a=1-(r+i)):(t-=2/3,i=(1-n)/3,a=(1+n*As(Cr*t)/As(Gf-Cr*t))/3,r=1-(i+a)),r=Ls(o*r*3),i=Ls(o*i*3),a=Ls(o*a*3),[r*255,i*255,a*255,e.length>3?e[3]:1]},{min:uH,sqrt:pH,acos:fH}=Math,hH=(...e)=>{let[t,n,o]=wt(e,"rgb");t/=255,n/=255,o/=255;let r;const i=uH(t,n,o),a=(t+n+o)/3,l=a>0?1-i/a:0;return l===0?r=NaN:(r=(t-n+(t-o))/2,r/=pH((t-n)*(t-n)+(t-o)*(n-o)),r=fH(r),o>n&&(r=Cr-r),r/=Cr),[r*360,l,a]};ze.prototype.hsi=function(){return hH(this._rgb)},ft.hsi=(...e)=>new ze(...e,"hsi"),dt.format.hsi=dH,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"hsi"),Ct(e)==="array"&&e.length===3)return"hsi"}}),ze.prototype.hsl=function(){return X7(this._rgb)},ft.hsl=(...e)=>new ze(...e,"hsl"),dt.format.hsl=Qf,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"hsl"),Ct(e)==="array"&&e.length===3)return"hsl"}});const{floor:gH}=Math,mH=(...e)=>{e=wt(e,"hsv");let[t,n,o]=e,r,i,a;if(o*=255,n===0)r=i=a=o;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const l=gH(t),c=t-l,d=o*(1-n),u=o*(1-n*c),f=o*(1-n*(1-c));switch(l){case 0:[r,i,a]=[o,f,d];break;case 1:[r,i,a]=[u,o,d];break;case 2:[r,i,a]=[d,o,f];break;case 3:[r,i,a]=[d,u,o];break;case 4:[r,i,a]=[f,d,o];break;case 5:[r,i,a]=[o,d,u];break}}return[r,i,a,e.length>3?e[3]:1]},{min:bH,max:vH}=Math,xH=(...e)=>{e=wt(e,"rgb");let[t,n,o]=e;const r=bH(t,n,o),i=vH(t,n,o),a=i-r;let l,c,d;return d=i/255,i===0?(l=Number.NaN,c=0):(c=a/i,t===i&&(l=(n-o)/a),n===i&&(l=2+(o-t)/a),o===i&&(l=4+(t-n)/a),l*=60,l<0&&(l+=360)),[l,c,d]};ze.prototype.hsv=function(){return xH(this._rgb)},ft.hsv=(...e)=>new ze(...e,"hsv"),dt.format.hsv=mH,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"hsv"),Ct(e)==="array"&&e.length===3)return"hsv"}});const Gn={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},{pow:yH}=Math,ab=(...e)=>{e=wt(e,"lab");const[t,n,o]=e;let r,i,a,l,c,d;return i=(t+16)/116,r=isNaN(n)?i:i+n/500,a=isNaN(o)?i:i-o/200,i=Gn.Yn*t2(i),r=Gn.Xn*t2(r),a=Gn.Zn*t2(a),l=e2(3.2404542*r-1.5371385*i-.4985314*a),c=e2(-.969266*r+1.8760108*i+.041556*a),d=e2(.0556434*r-.2040259*i+1.0572252*a),[l,c,d,e.length>3?e[3]:1]},e2=e=>255*(e<=.00304?12.92*e:1.055*yH(e,1/2.4)-.055),t2=e=>e>Gn.t1?e*e*e:Gn.t2*(e-Gn.t0),{pow:lb}=Math,cb=(...e)=>{const[t,n,o]=wt(e,"rgb"),[r,i,a]=CH(t,n,o),l=116*i-16;return[l<0?0:l,500*(r-i),200*(i-a)]},n2=e=>(e/=255)<=.04045?e/12.92:lb((e+.055)/1.055,2.4),o2=e=>e>Gn.t3?lb(e,1/3):e/Gn.t2+Gn.t0,CH=(e,t,n)=>{e=n2(e),t=n2(t),n=n2(n);const o=o2((.4124564*e+.3575761*t+.1804375*n)/Gn.Xn),r=o2((.2126729*e+.7151522*t+.072175*n)/Gn.Yn),i=o2((.0193339*e+.119192*t+.9503041*n)/Gn.Zn);return[o,r,i]};ze.prototype.lab=function(){return cb(this._rgb)},ft.lab=(...e)=>new ze(...e,"lab"),dt.format.lab=ab,dt.autodetect.push({p:2,test:(...e)=>{if(e=wt(e,"lab"),Ct(e)==="array"&&e.length===3)return"lab"}});const{sin:wH,cos:SH}=Math,db=(...e)=>{let[t,n,o]=wt(e,"lch");return isNaN(o)&&(o=0),o=o*QB,[t,SH(o)*n,wH(o)*n]},ub=(...e)=>{e=wt(e,"lch");const[t,n,o]=e,[r,i,a]=db(t,n,o),[l,c,d]=ab(r,i,a);return[l,c,d,e.length>3?e[3]:1]},TH=(...e)=>{const t=wt(e,"hcl").reverse();return ub(...t)},{sqrt:PH,atan2:MH,round:RH}=Math,pb=(...e)=>{const[t,n,o]=wt(e,"lab"),r=PH(n*n+o*o);let i=(MH(o,n)*JB+360)%360;return RH(r*1e4)===0&&(i=Number.NaN),[t,r,i]},fb=(...e)=>{const[t,n,o]=wt(e,"rgb"),[r,i,a]=cb(t,n,o);return pb(r,i,a)};ze.prototype.lch=function(){return fb(this._rgb)},ze.prototype.hcl=function(){return fb(this._rgb).reverse()},ft.lch=(...e)=>new ze(...e,"lch"),ft.hcl=(...e)=>new ze(...e,"hcl"),dt.format.lch=ub,dt.format.hcl=TH,["lch","hcl"].forEach(e=>dt.autodetect.push({p:2,test:(...t)=>{if(t=wt(t,e),Ct(t)==="array"&&t.length===3)return e}}));const Vs={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};ze.prototype.name=function(){const e=sb(this._rgb,"rgb");for(let t of Object.keys(Vs))if(Vs[t]===e)return t.toLowerCase();return e},dt.format.named=e=>{if(e=e.toLowerCase(),Vs[e])return ib(Vs[e]);throw new Error("unknown color name: "+e)},dt.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&Ct(e)==="string"&&Vs[e.toLowerCase()])return"named"}});const OH=e=>{if(Ct(e)=="number"&&e>=0&&e<=16777215){const t=e>>16,n=e>>8&255,o=e&255;return[t,n,o,1]}throw new Error("unknown num color: "+e)},EH=(...e)=>{const[t,n,o]=wt(e,"rgb");return(t<<16)+(n<<8)+o};ze.prototype.num=function(){return EH(this._rgb)},ft.num=(...e)=>new ze(...e,"num"),dt.format.num=OH,dt.autodetect.push({p:5,test:(...e)=>{if(e.length===1&&Ct(e[0])==="number"&&e[0]>=0&&e[0]<=16777215)return"num"}});const{round:hb}=Math;ze.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(hb)},ze.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,n)=>n<3?e===!1?t:hb(t):t)},ft.rgb=(...e)=>new ze(...e,"rgb"),dt.format.rgb=(...e)=>{const t=wt(e,"rgba");return t[3]===void 0&&(t[3]=1),t},dt.autodetect.push({p:3,test:(...e)=>{if(e=wt(e,"rgba"),Ct(e)==="array"&&(e.length===3||e.length===4&&Ct(e[3])=="number"&&e[3]>=0&&e[3]<=1))return"rgb"}});const{log:du}=Math,gb=e=>{const t=e/100;let n,o,r;return t<66?(n=255,o=t<6?0:-155.25485562709179-.44596950469579133*(o=t-2)+104.49216199393888*du(o),r=t<20?0:-254.76935184120902+.8274096064007395*(r=t-10)+115.67994401066147*du(r)):(n=351.97690566805693+.114206453784165*(n=t-55)-40.25366309332127*du(n),o=325.4494125711974+.07943456536662342*(o=t-50)-28.0852963507957*du(o),r=255),[n,o,r,1]},{round:kH}=Math,IH=(...e)=>{const t=wt(e,"rgb"),n=t[0],o=t[2];let r=1e3,i=4e4;const a=.4;let l;for(;i-r>a;){l=(i+r)*.5;const c=gb(l);c[2]/c[0]>=o/n?i=l:r=l}return kH(l)};ze.prototype.temp=ze.prototype.kelvin=ze.prototype.temperature=function(){return IH(this._rgb)},ft.temp=ft.kelvin=ft.temperature=(...e)=>new ze(...e,"temp"),dt.format.temp=dt.format.kelvin=dt.format.temperature=gb;const{pow:uu,sign:jH}=Math,mb=(...e)=>{e=wt(e,"lab");const[t,n,o]=e,r=uu(t+.3963377774*n+.2158037573*o,3),i=uu(t-.1055613458*n-.0638541728*o,3),a=uu(t-.0894841775*n-1.291485548*o,3);return[255*r2(4.0767416621*r-3.3077115913*i+.2309699292*a),255*r2(-1.2684380046*r+2.6097574011*i-.3413193965*a),255*r2(-.0041960863*r-.7034186147*i+1.707614701*a),e.length>3?e[3]:1]};function r2(e){const t=Math.abs(e);return t>.0031308?(jH(e)||1)*(1.055*uu(t,1/2.4)-.055):e*12.92}const{cbrt:i2,pow:_H,sign:DH}=Math,bb=(...e)=>{const[t,n,o]=wt(e,"rgb"),[r,i,a]=[s2(t/255),s2(n/255),s2(o/255)],l=i2(.4122214708*r+.5363325363*i+.0514459929*a),c=i2(.2119034982*r+.6806995451*i+.1073969566*a),d=i2(.0883024619*r+.2817188376*i+.6299787005*a);return[.2104542553*l+.793617785*c-.0040720468*d,1.9779984951*l-2.428592205*c+.4505937099*d,.0259040371*l+.7827717662*c-.808675766*d]};function s2(e){const t=Math.abs(e);return t<.04045?e/12.92:(DH(e)||1)*_H((t+.055)/1.055,2.4)}ze.prototype.oklab=function(){return bb(this._rgb)},ft.oklab=(...e)=>new ze(...e,"oklab"),dt.format.oklab=mb,dt.autodetect.push({p:3,test:(...e)=>{if(e=wt(e,"oklab"),Ct(e)==="array"&&e.length===3)return"oklab"}});const LH=(...e)=>{e=wt(e,"lch");const[t,n,o]=e,[r,i,a]=db(t,n,o),[l,c,d]=mb(r,i,a);return[l,c,d,e.length>3?e[3]:1]},AH=(...e)=>{const[t,n,o]=wt(e,"rgb"),[r,i,a]=bb(t,n,o);return pb(r,i,a)};ze.prototype.oklch=function(){return AH(this._rgb)},ft.oklch=(...e)=>new ze(...e,"oklch"),dt.format.oklch=LH,dt.autodetect.push({p:3,test:(...e)=>{if(e=wt(e,"oklch"),Ct(e)==="array"&&e.length===3)return"oklch"}}),ze.prototype.alpha=function(e,t=!1){return e!==void 0&&Ct(e)==="number"?t?(this._rgb[3]=e,this):new ze([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]},ze.prototype.clipped=function(){return this._rgb._clipped||!1},ze.prototype.darken=function(e=1){const t=this,n=t.lab();return n[0]-=Gn.Kn*e,new ze(n,"lab").alpha(t.alpha(),!0)},ze.prototype.brighten=function(e=1){return this.darken(-e)},ze.prototype.darker=ze.prototype.darken,ze.prototype.brighter=ze.prototype.brighten,ze.prototype.get=function(e){const[t,n]=e.split("."),o=this[t]();if(n){const r=t.indexOf(n)-(t.substr(0,2)==="ok"?2:0);if(r>-1)return o[r];throw new Error(`unknown channel ${n} in mode ${t}`)}else return o};const{pow:VH}=Math,FH=1e-7,$H=20;ze.prototype.luminance=function(e,t="rgb"){if(e!==void 0&&Ct(e)==="number"){if(e===0)return new ze([0,0,0,this._rgb[3]],"rgb");if(e===1)return new ze([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),o=$H;const r=(a,l)=>{const c=a.interpolate(l,.5,t),d=c.luminance();return Math.abs(e-d)<FH||!o--?c:d>e?r(a,c):r(c,l)},i=(n>e?r(new ze([0,0,0]),this):r(this,new ze([255,255,255]))).rgb();return new ze([...i,this._rgb[3]])}return NH(...this._rgb.slice(0,3))};const NH=(e,t,n)=>(e=a2(e),t=a2(t),n=a2(n),.2126*e+.7152*t+.0722*n),a2=e=>(e/=255,e<=.03928?e/12.92:VH((e+.055)/1.055,2.4)),jn={},Ol=(e,t,n=.5,...o)=>{let r=o[0]||"lrgb";if(!jn[r]&&!o.length&&(r=Object.keys(jn)[0]),!jn[r])throw new Error(`interpolation mode ${r} is not defined`);return Ct(e)!=="object"&&(e=new ze(e)),Ct(t)!=="object"&&(t=new ze(t)),jn[r](e,t,n).alpha(e.alpha()+n*(t.alpha()-e.alpha()))};ze.prototype.mix=ze.prototype.interpolate=function(e,t=.5,...n){return Ol(this,e,t,...n)},ze.prototype.premultiply=function(e=!1){const t=this._rgb,n=t[3];return e?(this._rgb=[t[0]*n,t[1]*n,t[2]*n,n],this):new ze([t[0]*n,t[1]*n,t[2]*n,n],"rgb")},ze.prototype.saturate=function(e=1){const t=this,n=t.lch();return n[1]+=Gn.Kn*e,n[1]<0&&(n[1]=0),new ze(n,"lch").alpha(t.alpha(),!0)},ze.prototype.desaturate=function(e=1){return this.saturate(-e)},ze.prototype.set=function(e,t,n=!1){const[o,r]=e.split("."),i=this[o]();if(r){const a=o.indexOf(r)-(o.substr(0,2)==="ok"?2:0);if(a>-1){if(Ct(t)=="string")switch(t.charAt(0)){case"+":i[a]+=+t;break;case"-":i[a]+=+t;break;case"*":i[a]*=+t.substr(1);break;case"/":i[a]/=+t.substr(1);break;default:i[a]=+t}else if(Ct(t)==="number")i[a]=t;else throw new Error("unsupported value for Color.set");const l=new ze(i,o);return n?(this._rgb=l._rgb,this):l}throw new Error(`unknown channel ${r} in mode ${o}`)}else return i},ze.prototype.tint=function(e=.5,...t){return Ol(this,"white",e,...t)},ze.prototype.shade=function(e=.5,...t){return Ol(this,"black",e,...t)};const BH=(e,t,n)=>{const o=e._rgb,r=t._rgb;return new ze(o[0]+n*(r[0]-o[0]),o[1]+n*(r[1]-o[1]),o[2]+n*(r[2]-o[2]),"rgb")};jn.rgb=BH;const{sqrt:l2,pow:Fs}=Math,HH=(e,t,n)=>{const[o,r,i]=e._rgb,[a,l,c]=t._rgb;return new ze(l2(Fs(o,2)*(1-n)+Fs(a,2)*n),l2(Fs(r,2)*(1-n)+Fs(l,2)*n),l2(Fs(i,2)*(1-n)+Fs(c,2)*n),"rgb")};jn.lrgb=HH;const zH=(e,t,n)=>{const o=e.lab(),r=t.lab();return new ze(o[0]+n*(r[0]-o[0]),o[1]+n*(r[1]-o[1]),o[2]+n*(r[2]-o[2]),"lab")};jn.lab=zH;const $s=(e,t,n,o)=>{let r,i;o==="hsl"?(r=e.hsl(),i=t.hsl()):o==="hsv"?(r=e.hsv(),i=t.hsv()):o==="hcg"?(r=e.hcg(),i=t.hcg()):o==="hsi"?(r=e.hsi(),i=t.hsi()):o==="lch"||o==="hcl"?(o="hcl",r=e.hcl(),i=t.hcl()):o==="oklch"&&(r=e.oklch().reverse(),i=t.oklch().reverse());let a,l,c,d,u,f;(o.substr(0,1)==="h"||o==="oklch")&&([a,c,u]=r,[l,d,f]=i);let h,g,m,b;return!isNaN(a)&&!isNaN(l)?(l>a&&l-a>180?b=l-(a+360):l<a&&a-l>180?b=l+360-a:b=l-a,g=a+n*b):isNaN(a)?isNaN(l)?g=Number.NaN:(g=l,(u==1||u==0)&&o!="hsv"&&(h=d)):(g=a,(f==1||f==0)&&o!="hsv"&&(h=c)),h===void 0&&(h=c+n*(d-c)),m=u+n*(f-u),o==="oklch"?new ze([m,h,g],o):new ze([g,h,m],o)},vb=(e,t,n)=>$s(e,t,n,"lch");jn.lch=vb,jn.hcl=vb;const WH=(e,t,n)=>{const o=e.num(),r=t.num();return new ze(o+n*(r-o),"num")};jn.num=WH;const UH=(e,t,n)=>$s(e,t,n,"hcg");jn.hcg=UH;const ZH=(e,t,n)=>$s(e,t,n,"hsi");jn.hsi=ZH;const qH=(e,t,n)=>$s(e,t,n,"hsl");jn.hsl=qH;const GH=(e,t,n)=>$s(e,t,n,"hsv");jn.hsv=GH;const YH=(e,t,n)=>{const o=e.oklab(),r=t.oklab();return new ze(o[0]+n*(r[0]-o[0]),o[1]+n*(r[1]-o[1]),o[2]+n*(r[2]-o[2]),"oklab")};jn.oklab=YH;const KH=(e,t,n)=>$s(e,t,n,"oklch");jn.oklch=KH;const{pow:c2,sqrt:d2,PI:u2,cos:xb,sin:yb,atan2:XH}=Math,QH=(e,t="lrgb",n=null)=>{const o=e.length;n||(n=Array.from(new Array(o)).map(()=>1));const r=o/n.reduce(function(f,h){return f+h});if(n.forEach((f,h)=>{n[h]*=r}),e=e.map(f=>new ze(f)),t==="lrgb")return JH(e,n);const i=e.shift(),a=i.get(t),l=[];let c=0,d=0;for(let f=0;f<a.length;f++)if(a[f]=(a[f]||0)*n[0],l.push(isNaN(a[f])?0:n[0]),t.charAt(f)==="h"&&!isNaN(a[f])){const h=a[f]/180*u2;c+=xb(h)*n[0],d+=yb(h)*n[0]}let u=i.alpha()*n[0];e.forEach((f,h)=>{const g=f.get(t);u+=f.alpha()*n[h+1];for(let m=0;m<a.length;m++)if(!isNaN(g[m]))if(l[m]+=n[h+1],t.charAt(m)==="h"){const b=g[m]/180*u2;c+=xb(b)*n[h+1],d+=yb(b)*n[h+1]}else a[m]+=g[m]*n[h+1]});for(let f=0;f<a.length;f++)if(t.charAt(f)==="h"){let h=XH(d/l[f],c/l[f])/u2*180;for(;h<0;)h+=360;for(;h>=360;)h-=360;a[f]=h}else a[f]=a[f]/l[f];return u/=o,new ze(a,t).alpha(u>.99999?1:u,!0)},JH=(e,t)=>{const n=e.length,o=[0,0,0,0];for(let r=0;r<e.length;r++){const i=e[r],a=t[r]/n,l=i._rgb;o[0]+=c2(l[0],2)*a,o[1]+=c2(l[1],2)*a,o[2]+=c2(l[2],2)*a,o[3]+=l[3]*a}return o[0]=d2(o[0]),o[1]=d2(o[1]),o[2]=d2(o[2]),o[3]>.9999999&&(o[3]=1),new ze(Uf(o))},{pow:ez}=Math;function pu(e){let t="rgb",n=ft("#ccc"),o=0,r=[0,1],i=[],a=[0,0],l=!1,c=[],d=!1,u=0,f=1,h=!1,g={},m=!0,b=1;const v=function(M){if(M=M||["#fff","#000"],M&&Ct(M)==="string"&&ft.brewer&&ft.brewer[M.toLowerCase()]&&(M=ft.brewer[M.toLowerCase()]),Ct(M)==="array"){M.length===1&&(M=[M[0],M[0]]),M=M.slice(0);for(let O=0;O<M.length;O++)M[O]=ft(M[O]);i.length=0;for(let O=0;O<M.length;O++)i.push(O/(M.length-1))}return w(),c=M},x=function(M){if(l!=null){const O=l.length-1;let E=0;for(;E<O&&M>=l[E];)E++;return E-1}return 0};let C=M=>M,S=M=>M;const P=function(M,O){let E,k;if(O==null&&(O=!1),isNaN(M)||M===null)return n;O?k=M:l&&l.length>2?k=x(M)/(l.length-2):f!==u?k=(M-u)/(f-u):k=1,k=S(k),O||(k=C(k)),b!==1&&(k=ez(k,b)),k=a[0]+k*(1-a[0]-a[1]),k=Ls(k,0,1);const I=Math.floor(k*1e4);if(m&&g[I])E=g[I];else{if(Ct(c)==="array")for(let _=0;_<i.length;_++){const A=i[_];if(k<=A){E=c[_];break}if(k>=A&&_===i.length-1){E=c[_];break}if(k>A&&k<i[_+1]){k=(k-A)/(i[_+1]-A),E=ft.interpolate(c[_],c[_+1],k,t);break}}else Ct(c)==="function"&&(E=c(k));m&&(g[I]=E)}return E};var w=()=>g={};v(e);const R=function(M){const O=ft(P(M));return d&&O[d]?O[d]():O};return R.classes=function(M){if(M!=null){if(Ct(M)==="array")l=M,r=[M[0],M[M.length-1]];else{const O=ft.analyze(r);M===0?l=[O.min,O.max]:l=ft.limits(O,"e",M)}return R}return l},R.domain=function(M){if(!arguments.length)return r;u=M[0],f=M[M.length-1],i=[];const O=c.length;if(M.length===O&&u!==f)for(let E of Array.from(M))i.push((E-u)/(f-u));else{for(let E=0;E<O;E++)i.push(E/(O-1));if(M.length>2){const E=M.map((I,_)=>_/(M.length-1)),k=M.map(I=>(I-u)/(f-u));k.every((I,_)=>E[_]===I)||(S=I=>{if(I<=0||I>=1)return I;let _=0;for(;I>=k[_+1];)_++;const A=(I-k[_])/(k[_+1]-k[_]);return E[_]+A*(E[_+1]-E[_])})}}return r=[u,f],R},R.mode=function(M){return arguments.length?(t=M,w(),R):t},R.range=function(M,O){return v(M),R},R.out=function(M){return d=M,R},R.spread=function(M){return arguments.length?(o=M,R):o},R.correctLightness=function(M){return M==null&&(M=!0),h=M,w(),h?C=function(O){const E=P(0,!0).lab()[0],k=P(1,!0).lab()[0],I=E>k;let _=P(O,!0).lab()[0];const A=E+(k-E)*O;let L=_-A,D=0,F=1,$=20;for(;Math.abs(L)>.01&&$-- >0;)(function(){return I&&(L*=-1),L<0?(D=O,O+=(F-O)*.5):(F=O,O+=(D-O)*.5),_=P(O,!0).lab()[0],L=_-A})();return O}:C=O=>O,R},R.padding=function(M){return M!=null?(Ct(M)==="number"&&(M=[M,M]),a=M,R):a},R.colors=function(M,O){arguments.length<2&&(O="hex");let E=[];if(arguments.length===0)E=c.slice(0);else if(M===1)E=[R(.5)];else if(M>1){const k=r[0],I=r[1]-k;E=tz(0,M).map(_=>R(k+_/(M-1)*I))}else{e=[];let k=[];if(l&&l.length>2)for(let I=1,_=l.length,A=1<=_;A?I<_:I>_;A?I++:I--)k.push((l[I-1]+l[I])*.5);else k=r;E=k.map(I=>R(I))}return ft[O]&&(E=E.map(k=>k[O]())),E},R.cache=function(M){return M!=null?(m=M,R):m},R.gamma=function(M){return M!=null?(b=M,R):b},R.nodata=function(M){return M!=null?(n=ft(M),R):n},R}function tz(e,t,n){let o=[],r=e<t,i=t;for(let a=e;r?a<i:a>i;r?a++:a--)o.push(a);return o}const nz=function(e){let t=[1,1];for(let n=1;n<e;n++){let o=[1];for(let r=1;r<=t.length;r++)o[r]=(t[r]||0)+t[r-1];t=o}return t},oz=function(e){let t,n,o,r;if(e=e.map(i=>new ze(i)),e.length===2)[n,o]=e.map(i=>i.lab()),t=function(i){const a=[0,1,2].map(l=>n[l]+i*(o[l]-n[l]));return new ze(a,"lab")};else if(e.length===3)[n,o,r]=e.map(i=>i.lab()),t=function(i){const a=[0,1,2].map(l=>(1-i)*(1-i)*n[l]+2*(1-i)*i*o[l]+i*i*r[l]);return new ze(a,"lab")};else if(e.length===4){let i;[n,o,r,i]=e.map(a=>a.lab()),t=function(a){const l=[0,1,2].map(c=>(1-a)*(1-a)*(1-a)*n[c]+3*(1-a)*(1-a)*a*o[c]+3*(1-a)*a*a*r[c]+a*a*a*i[c]);return new ze(l,"lab")}}else if(e.length>=5){let i,a,l;i=e.map(c=>c.lab()),l=e.length-1,a=nz(l),t=function(c){const d=1-c,u=[0,1,2].map(f=>i.reduce((h,g,m)=>h+a[m]*d**(l-m)*c**m*g[f],0));return new ze(u,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return t},rz=e=>{const t=oz(e);return t.scale=()=>pu(t),t},_o=(e,t,n)=>{if(!_o[n])throw new Error("unknown blend mode "+n);return _o[n](e,t)},qr=e=>(t,n)=>{const o=ft(n).rgb(),r=ft(t).rgb();return ft.rgb(e(o,r))},Gr=e=>(t,n)=>{const o=[];return o[0]=e(t[0],n[0]),o[1]=e(t[1],n[1]),o[2]=e(t[2],n[2]),o},iz=e=>e,sz=(e,t)=>e*t/255,az=(e,t)=>e>t?t:e,lz=(e,t)=>e>t?e:t,cz=(e,t)=>255*(1-(1-e/255)*(1-t/255)),dz=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),uz=(e,t)=>255*(1-(1-t/255)/(e/255)),pz=(e,t)=>e===255?255:(e=255*(t/255)/(1-e/255),e>255?255:e);_o.normal=qr(Gr(iz)),_o.multiply=qr(Gr(sz)),_o.screen=qr(Gr(cz)),_o.overlay=qr(Gr(dz)),_o.darken=qr(Gr(az)),_o.lighten=qr(Gr(lz)),_o.dodge=qr(Gr(pz)),_o.burn=qr(Gr(uz));const{pow:fz,sin:hz,cos:gz}=Math;function mz(e=300,t=-1.5,n=1,o=1,r=[0,1]){let i=0,a;Ct(r)==="array"?a=r[1]-r[0]:(a=0,r=[r,r]);const l=function(c){const d=Cr*((e+120)/360+t*c),u=fz(r[0]+a*c,o),h=(i!==0?n[0]+c*i:n)*u*(1-u)/2,g=gz(d),m=hz(d),b=u+h*(-.14861*g+1.78277*m),v=u+h*(-.29227*g-.90649*m),x=u+h*(1.97294*g);return ft(Uf([b*255,v*255,x*255,1]))};return l.start=function(c){return c==null?e:(e=c,l)},l.rotations=function(c){return c==null?t:(t=c,l)},l.gamma=function(c){return c==null?o:(o=c,l)},l.hue=function(c){return c==null?n:(n=c,Ct(n)==="array"?(i=n[1]-n[0],i===0&&(n=n[1])):i=0,l)},l.lightness=function(c){return c==null?r:(Ct(c)==="array"?(r=c,a=c[1]-c[0]):(r=[c,c],a=0),l)},l.scale=()=>ft.scale(l),l.hue(n),l}const bz="0123456789abcdef",{floor:vz,random:xz}=Math,yz=()=>{let e="#";for(let t=0;t<6;t++)e+=bz.charAt(vz(xz()*16));return new ze(e,"hex")},{log:Cb,pow:Cz,floor:wz,abs:Sz}=Math;function wb(e,t=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return Ct(e)==="object"&&(e=Object.values(e)),e.forEach(o=>{t&&Ct(o)==="object"&&(o=o[t]),o!=null&&!isNaN(o)&&(n.values.push(o),n.sum+=o,o<n.min&&(n.min=o),o>n.max&&(n.max=o),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(o,r)=>Sb(n,o,r),n}function Sb(e,t="equal",n=7){Ct(e)=="array"&&(e=wb(e));const{min:o,max:r}=e,i=e.values.sort((l,c)=>l-c);if(n===1)return[o,r];const a=[];if(t.substr(0,1)==="c"&&(a.push(o),a.push(r)),t.substr(0,1)==="e"){a.push(o);for(let l=1;l<n;l++)a.push(o+l/n*(r-o));a.push(r)}else if(t.substr(0,1)==="l"){if(o<=0)throw new Error("Logarithmic scales are only possible for values > 0");const l=Math.LOG10E*Cb(o),c=Math.LOG10E*Cb(r);a.push(o);for(let d=1;d<n;d++)a.push(Cz(10,l+d/n*(c-l)));a.push(r)}else if(t.substr(0,1)==="q"){a.push(o);for(let l=1;l<n;l++){const c=(i.length-1)*l/n,d=wz(c);if(d===c)a.push(i[d]);else{const u=c-d;a.push(i[d]*(1-u)+i[d+1]*u)}}a.push(r)}else if(t.substr(0,1)==="k"){let l;const c=i.length,d=new Array(c),u=new Array(n);let f=!0,h=0,g=null;g=[],g.push(o);for(let v=1;v<n;v++)g.push(o+v/n*(r-o));for(g.push(r);f;){for(let x=0;x<n;x++)u[x]=0;for(let x=0;x<c;x++){const C=i[x];let S=Number.MAX_VALUE,P;for(let w=0;w<n;w++){const R=Sz(g[w]-C);R<S&&(S=R,P=w),u[P]++,d[x]=P}}const v=new Array(n);for(let x=0;x<n;x++)v[x]=null;for(let x=0;x<c;x++)l=d[x],v[l]===null?v[l]=i[x]:v[l]+=i[x];for(let x=0;x<n;x++)v[x]*=1/u[x];f=!1;for(let x=0;x<n;x++)if(v[x]!==g[x]){f=!0;break}g=v,h++,h>200&&(f=!1)}const m={};for(let v=0;v<n;v++)m[v]=[];for(let v=0;v<c;v++)l=d[v],m[l].push(i[v]);let b=[];for(let v=0;v<n;v++)b.push(m[v][0]),b.push(m[v][m[v].length-1]);b=b.sort((v,x)=>v-x),a.push(b[0]);for(let v=1;v<b.length;v+=2){const x=b[v];!isNaN(x)&&a.indexOf(x)===-1&&a.push(x)}}return a}const Tz=(e,t)=>{e=new ze(e),t=new ze(t);const n=e.luminance(),o=t.luminance();return n>o?(n+.05)/(o+.05):(o+.05)/(n+.05)},{sqrt:wr,pow:mn,min:Pz,max:Mz,atan2:Tb,abs:Pb,cos:fu,sin:Mb,exp:Rz,PI:Rb}=Math;function Oz(e,t,n=1,o=1,r=1){var i=function(Q){return 360*Q/(2*Rb)},a=function(Q){return 2*Rb*Q/360};e=new ze(e),t=new ze(t);const[l,c,d]=Array.from(e.lab()),[u,f,h]=Array.from(t.lab()),g=(l+u)/2,m=wr(mn(c,2)+mn(d,2)),b=wr(mn(f,2)+mn(h,2)),v=(m+b)/2,x=.5*(1-wr(mn(v,7)/(mn(v,7)+mn(25,7)))),C=c*(1+x),S=f*(1+x),P=wr(mn(C,2)+mn(d,2)),w=wr(mn(S,2)+mn(h,2)),R=(P+w)/2,M=i(Tb(d,C)),O=i(Tb(h,S)),E=M>=0?M:M+360,k=O>=0?O:O+360,I=Pb(E-k)>180?(E+k+360)/2:(E+k)/2,_=1-.17*fu(a(I-30))+.24*fu(a(2*I))+.32*fu(a(3*I+6))-.2*fu(a(4*I-63));let A=k-E;A=Pb(A)<=180?A:k<=E?A+360:A-360,A=2*wr(P*w)*Mb(a(A)/2);const L=u-l,D=w-P,F=1+.015*mn(g-50,2)/wr(20+mn(g-50,2)),$=1+.045*R,V=1+.015*R*_,B=30*Rz(-mn((I-275)/25,2)),U=-(2*wr(mn(R,7)/(mn(R,7)+mn(25,7))))*Mb(2*a(B)),ce=wr(mn(L/(n*F),2)+mn(D/(o*$),2)+mn(A/(r*V),2)+U*(D/(o*$))*(A/(r*V)));return Mz(0,Pz(100,ce))}function Ez(e,t,n="lab"){e=new ze(e),t=new ze(t);const o=e.get(n),r=t.get(n);let i=0;for(let a in o){const l=(o[a]||0)-(r[a]||0);i+=l*l}return Math.sqrt(i)}const kz=(...e)=>{try{return new ze(...e),!0}catch{return!1}},Iz={cool(){return pu([ft.hsl(180,1,.9),ft.hsl(250,.7,.4)])},hot(){return pu(["#000","#f00","#ff0","#fff"]).mode("rgb")}},hu={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]};for(let e of Object.keys(hu))hu[e.toLowerCase()]=hu[e];Object.assign(ft,{average:QH,bezier:rz,blend:_o,cubehelix:mz,mix:Ol,interpolate:Ol,random:yz,scale:pu,analyze:wb,contrast:Tz,deltaE:Oz,distance:Ez,limits:Sb,valid:kz,scales:Iz,input:dt,colors:Vs,brewer:hu});const jz=e=>{const{theme:t,values:n,palette:o,legend:r=!0,hoveredArcIndex:i,setHoveredArcIndex:a,handleChartHover:l,...c}=e;return{...c,data:{datasets:[{data:n??[],backgroundColor:i===null||!r?o:o.map((d,u)=>u!==i?ft(d).alpha(.4).css():d),hoverBackgroundColor:o}]},options:{cutout:"78%",responsive:!0,maintainAspectRatio:!0,elements:{arc:{borderWidth:0}},events:["mousemove","mouseout"],layout:{padding:1},onHover:(d,u)=>{var f,h;if(d.type!=="mousemove"||!u.length){a(null),((f=d.native)==null?void 0:f.target).style.cursor="default";return}((h=d.native)==null?void 0:h.target).style.cursor=u[0]?"pointer":"default",a(u[0].index),l(d.x,d.y)},plugins:{datalabels:{display:!1},legend:{display:!1},tooltip:{enabled:!1}}},plugins:[{id:"doughnutBackground",beforeDatasetsDraw:d=>{const u=d.canvas.clientWidth/2,f=d.canvas.clientHeight/2,h=d.ctx,{innerRadius:g,outerRadius:m}=d.getDatasetMeta(d.data.datasets.length-1).controller,b=m-g;h.lineWidth=b-2,h.strokeStyle=t.palette.primary[50]??'"',h.beginPath(),h.arc(u,f,m-b/2,0,2*Math.PI),h.stroke()}}]}},_z=(e,t,n)=>Object.entries(e.palette.primary).filter(([o])=>!isNaN(Number(o))&&t<=Number(o)&&Number(o)<=n).sort(([o],[r])=>Number(r)-Number(o)).map(([,o])=>o),Dz=(e,t)=>ft.scale(e).colors(t.length),Ob=e=>{const t=e.reduce((r,i)=>r+i,0);if(!t)return[...new Array(e.length)].map(()=>0);const n=e.map(r=>Math.floor(r/t*100)),o=100-n.reduce((r,i)=>r+i,0);for(let r=0;r<o;r++){const i=n.indexOf(Math.max(...n));n[i]++}return n},p2=e=>{const{action:t,seeMore:n}=e,o=Oe(),r={display:"flex",marginLeft:"auto",color:o.palette.primary[700],fontSize:".8rem",textDecoration:"none",alignItems:"center",fontWeight:o.typography.fontWeightBold,"&:hover":{textDecoration:"none"}};return p.jsx(rt,{onClick:t,sx:r,children:n})},Lz=e=>{const{values:t,labels:n,palette:o,legend:r,hoveredArcIndex:i,setHoveredArcIndex:a}=e,l=Oe(),c=Ob(t??[]);return p.jsx(we,{alignItems:"center",className:"doughnut-chart-legend-wrapper",children:p.jsx(we,{display:"inline-flex",children:n.map((d,u)=>{const f=t&&t[u]!==void 0;return p.jsxs(we,{direction:"row",alignItems:"center",gap:"12px",paddingY:"8px",onMouseEnter:()=>{f&&a(u)},onMouseLeave:()=>a(null),sx:{opacity:i===null||i===u?1:.4},className:"doughnut-chart-legend-item",children:[p.jsx(ne,{minWidth:"10px",height:"10px",bgcolor:f?o[u]:l.custom.grey[400]}),p.jsxs(we,{direction:"row",alignItems:"center",gap:"8px",sx:{width:"100%"},children:[p.jsxs(fe,{variant:"h5",className:"doughnut-chart-legend-item-label",children:[d,p.jsxs(ne,{component:"span",fontWeight:400,className:"doughnut-chart-legend-item-value",children:[d?" - ":"",f?`${c[u]}%`:"--%"]})]}),(r==null?void 0:r.actions)&&(r==null?void 0:r.seeMore)&&(r==null?void 0:r.actions[u])&&p.jsx(p2,{action:r==null?void 0:r.actions[u],seeMore:r==null?void 0:r.seeMore})]})]},u)})})})},Az=e=>{const{values:t,labels:n,palette:o,icons:r=[],legend:i,hoveredArcIndex:a,setHoveredArcIndex:l}=e,c=Oe(),d=Ob(t??[]);return p.jsx(we,{alignItems:"center",justifyContent:"center",sx:{width:"100%",alignItems:"flex-start"},className:"doughnut-chart-legend-wrapper",children:p.jsx(we,{width:"100%",children:n.map((u,f)=>{const h=t&&t[f]!==void 0;return p.jsx(we,{direction:"row",alignItems:"center",gap:"12px",onMouseEnter:()=>{h&&l(f)},onMouseLeave:()=>l(null),sx:{opacity:a===null||a===f?1:.4,borderBottom:"1px solid #e3e2e0","&:last-of-type":{borderBottom:"none"}},children:p.jsxs(we,{direction:"row",gap:"8px",sx:{width:"100%",padding:".4rem",alignItems:"center","&:hover":{cursor:"pointer",background:Ee[500]}},className:"doughnut-chart-legend-item",children:[r[f]!==void 0&&p.jsx(ne,{minWidth:"28px",height:"28px",sx:{background:o[f]||c.custom.grey[400],padding:"16px 5px",color:"#fff"},display:"flex",alignItems:"center",borderRadius:"6px",children:r[f]}),p.jsx(fe,{variant:"h5",sx:{marginLeft:"4px"},className:"doughnut-chart-legend-item-label",children:u}),p.jsxs(fe,{fontWeight:400,sx:{fontSize:".8rem",display:"flex",flexDirection:"row",whiteSpace:"pre",alignItems:"center"},className:"doughnut-chart-legend-item-value",children:[u?"- ":"",p.jsx(ne,{component:"span",alignItems:"center",sx:{display:"flex",borderRadius:"4px",background:Ee[400],padding:"0.25rem 0.5rem",fontWeight:500,fontSize:"0.75rem"},children:h?`${d[f]} %`:"--%"})]}),(i==null?void 0:i.actions)&&(i==null?void 0:i.seeMore)&&(i==null?void 0:i.actions[f])&&p.jsx(p2,{action:i==null?void 0:i.actions[f],seeMore:i==null?void 0:i.seeMore})]})},f)})})})},Vz=e=>{const{values:t,labels:n,palette:o,legend:r,hoveredArcIndex:i,setHoveredArcIndex:a,icons:l=[]}=e;return!n||!n.length?null:(r==null?void 0:r.position)==="bottom"?p.jsx(Lz,{labels:n,hoveredArcIndex:i,setHoveredArcIndex:a,values:t,palette:o,legend:r}):(r==null?void 0:r.position)==="right"?p.jsx(Az,{labels:n,hoveredArcIndex:i,setHoveredArcIndex:a,values:t,palette:o,legend:r,icons:l}):null};function El(e){if(typeof window>"u")return e;const t=y.useRef(null);return y.useLayoutEffect(()=>{t.current=e}),y.useCallback((...n)=>{var o;(o=t.current)===null||o===void 0||o.call(t,...n)},[])}const Eb={};function Fz(e,t){Eb[e]||(Eb[e]=!0,console.error("[material-ui-popup-state] WARNING",t))}const $z={isOpen:!1,setAnchorElUsed:!1,anchorEl:void 0,anchorPosition:void 0,hovered:!1,focused:!1,_openEventType:null,_childPopupState:null,_deferNextOpen:!1,_deferNextClose:!1},kb=y,Nz="useId"in kb?()=>kb.useId():()=>{};function Bz({parentPopupState:e,popupId:t=Nz(),variant:n,disableAutoFocus:o}){const r=G.useRef(!0);G.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]);const[i,a]=G.useState($z),l=G.useCallback(C=>{r.current&&a(C)},[]),c=G.useCallback(C=>l(S=>({...S,setAnchorElUsed:!0,anchorEl:C??void 0})),[]),d=El(C=>(i.isOpen?h(C):u(C),i)),u=El(C=>{const S=C instanceof Element?void 0:C,P=C instanceof Element?C:(C==null?void 0:C.currentTarget)instanceof Element?C.currentTarget:void 0;if((S==null?void 0:S.type)==="touchstart"){l(E=>({...E,_deferNextOpen:!0}));return}const w=S==null?void 0:S.clientX,R=S==null?void 0:S.clientY,M=typeof w=="number"&&typeof R=="number"?{left:w,top:R}:void 0,O=E=>{if(!C&&!E.setAnchorElUsed&&n!=="dialog"&&Fz("missingEventOrAnchorEl","eventOrAnchorEl should be defined if setAnchorEl is not used"),e){if(!e.isOpen)return E;setTimeout(()=>e._setChildPopupState(x))}const k={...E,isOpen:!0,anchorPosition:M,hovered:(S==null?void 0:S.type)==="mouseover"||E.hovered,focused:(S==null?void 0:S.type)==="focus"||E.focused,_openEventType:S==null?void 0:S.type};return E.setAnchorElUsed||(S!=null&&S.currentTarget?k.anchorEl=S==null?void 0:S.currentTarget:P&&(k.anchorEl=P)),k};l(E=>E._deferNextOpen?(setTimeout(()=>l(O),0),{...E,_deferNextOpen:!1}):O(E))}),f=C=>{const{_childPopupState:S}=C;return setTimeout(()=>{S==null||S.close(),e==null||e._setChildPopupState(null)}),{...C,isOpen:!1,hovered:!1,focused:!1}},h=El(C=>{const S=C instanceof Element?void 0:C;if((S==null?void 0:S.type)==="touchstart"){l(P=>({...P,_deferNextClose:!0}));return}l(P=>P._deferNextClose?(setTimeout(()=>l(f),0),{...P,_deferNextClose:!1}):f(P))}),g=G.useCallback((C,S)=>{C?u(S):h(S)},[]),m=El(C=>{const{relatedTarget:S}=C;l(P=>P.hovered&&!(S instanceof Element&&f2(S,x))?P.focused?{...P,hovered:!1}:f(P):P)}),b=El(C=>{if(!C)return;const{relatedTarget:S}=C;l(P=>P.focused&&!(S instanceof Element&&f2(S,x))?P.hovered?{...P,focused:!1}:f(P):P)}),v=G.useCallback(C=>l(S=>({...S,_childPopupState:C})),[]),x={...i,setAnchorEl:c,popupId:t??void 0,variant:n,open:u,close:h,toggle:d,setOpen:g,onBlur:b,onMouseLeave:m,disableAutoFocus:o??!!(i.hovered||i.focused),_setChildPopupState:v};return x}function Hz({isOpen:e,anchorEl:t,anchorPosition:n,close:o,popupId:r,onMouseLeave:i,disableAutoFocus:a,_openEventType:l}){return{id:r,anchorEl:t,anchorPosition:n,anchorReference:l==="contextmenu"?"anchorPosition":"anchorEl",open:e,onClose:o,onMouseLeave:i,...a&&{disableAutoFocus:!0,disableEnforceFocus:!0,disableRestoreFocus:!0}}}function zz(e,{popupId:t}){if(!t)return null;const n=typeof e.getRootNode=="function"?e.getRootNode():document;return typeof n.getElementById=="function"?n.getElementById(t):null}function f2(e,t){const{anchorEl:n,_childPopupState:o}=t;return Ib(n,e)||Ib(zz(e,t),e)||o!=null&&f2(e,o)}function Ib(e,t){if(!e)return!1;for(;t;){if(t===e)return!0;t=t.parentElement}return!1}function jb({children:e,popupId:t,variant:n,parentPopupState:o,disableAutoFocus:r}){const i=Bz({popupId:t,variant:n,parentPopupState:o,disableAutoFocus:r}),a=e(i);return a??null}jb.propTypes={children:s.func.isRequired,popupId:s.string,variant:s.oneOf(["popover","popper"]).isRequired,parentPopupState:s.object,disableAutoFocus:s.bool};function Wz(e){const t=e;return t.__esModule?t.default:e}const Uz=Wz(ko),Zz=y.forwardRef(function(t,n){var o,r;const i=y.useMemo(()=>{var a;const l=(a=t.slotProps)===null||a===void 0?void 0:a.paper;return l instanceof Function?c=>{const d=l(c);return{...d,style:{pointerEvents:"auto",...d==null?void 0:d.style}}}:{...l,style:{pointerEvents:"auto",...l==null?void 0:l.style}}},[(o=t.slotProps)===null||o===void 0?void 0:o.paper]);return y.createElement(Uz,hC({},t,{ref:n,style:{pointerEvents:"none",...t.style},PaperProps:{...t.PaperProps,style:{pointerEvents:"auto",...(r=t.PaperProps)===null||r===void 0?void 0:r.style}},slotProps:{...t.slotProps,paper:i}}))});Cl.register(ki);const qz=e=>{const{values:t,labels:n,colors:o,legend:r,children:i,valuesUnit:a,className:l,valuesFormatterFn:c}=e,[d,u]=G.useState(null),[f,h]=G.useState(!1),[g,m]=G.useState(),[b,v]=G.useState(null),[x,C]=G.useState(null),S=(I,_)=>{v(I),C(_)};G.useEffect(()=>{!n||!t||h(b!==null&&x!==null)},[n,t,b,x]);const P=Oe(),w=_z(P,100,700),R=(r==null?void 0:r.position)??"bottom",M=Dz(o&&o.length?o:w,t??[]),O=jz({...e,legend:!!r,theme:P,palette:M,hoveredArcIndex:d,setHoveredArcIndex:u,handleChartHover:S}),E=(I,_=35)=>I.length<=_?I:I.substring(0,_-3)+"...";G.useEffect(()=>{d!==null&&n&&n[d]!==void 0&&t&&t[d]!==void 0?m(p.jsxs(ne,{sx:{maxWidth:"250px"},children:[p.jsx(fe,{fontWeight:700,fontSize:"0.75rem",children:r!==void 0?E(n[d]):n[d]}),p.jsxs(fe,{fontWeight:700,fontSize:"1.5rem",children:[c?c(t[d]):t[d]," ",a&&p.jsx(fe,{component:"span",fontWeight:500,fontSize:"0.75rem",color:Ee[1400],children:a})]})]})):h(!1)},[a,d,n,t]);const k=t==null?void 0:t.reduce((I,_)=>I+_,0);return p.jsx(we,{onMouseLeave:()=>u(null),direction:R==="bottom"?"column":"row",gap:"3rem",className:`doughnut-chart ${l}`,children:p.jsx(jb,{variant:"popover",popupId:"demoPopover",disableAutoFocus:!0,children:I=>p.jsxs(p.Fragment,{children:[p.jsx(ne,{position:"relative",margin:"28px auto",sx:R==="bottom"?{maxWidth:"300px"}:{minWidth:"300px"},className:"doughnut-chart-wrapper",id:"doughnut-chart-wrapper",children:p.jsxs(ne,{position:"relative",children:[p.jsx(KB,{...O,style:{maxWidth:"100%"}}),p.jsx(Zz,{...Hz(I),open:f,anchorEl:document.getElementById("doughnut-chart-wrapper"),onClose:()=>{h(!1),u(null)},anchorOrigin:{vertical:(x||0)-10,horizontal:b||0},transformOrigin:{vertical:"bottom",horizontal:"center"},slotProps:{paper:{sx:{border:`1px solid ${Ee[500]}`,minWidth:220,borderRadius:"12px",padding:"8px"}}},children:p.jsx(ne,{sx:{p:2},children:g})}),p.jsx(ne,{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",padding:"10%",textAlign:"center",sx:{inset:"12.5%",pointerEvents:"none",top:0,bottom:0},className:"doughnut-chart-content",children:p.jsxs(ne,{display:"flex",flexDirection:"column",children:[p.jsx(ne,{fontWeight:700,fontSize:"3rem",children:i!==void 0?i:k},"content-1"),a&&p.jsx(ne,{sx:{color:Ee[1400]},children:a})]})})]})}),p.jsx(ne,{display:"flex",onMouseEnter:()=>h(!1),children:p.jsx(Vz,{labels:n,hoveredArcIndex:d,setHoveredArcIndex:u,values:t,palette:M,legend:r,icons:e.icons})})]})})})};/*!
|
|
369
369
|
* chartjs-plugin-datalabels v2.2.0
|
|
370
370
|
* https://chartjs-plugin-datalabels.netlify.app
|
|
371
371
|
* (c) 2017-2022 chartjs-plugin-datalabels contributors
|