@foodpilot/foods 0.5.13 → 0.5.15

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.
@@ -13,18 +13,19 @@ export declare const getDoughnutConfig: (props: Omit<DoughnutChartProps, "legend
13
13
  setHoveredArcIndex: Dispatch<SetStateAction<number | null>>;
14
14
  handleChartHover: (x: number | null, y: number | null, centerX: number, centerY: number) => void;
15
15
  }) => {
16
+ skipNull: boolean;
16
17
  data: {
17
18
  datasets: {
18
19
  data: number[];
19
20
  backgroundColor: string[];
20
21
  hoverBackgroundColor: Property.Color[];
21
- spacing: number | undefined;
22
22
  hoverOffset: number | undefined;
23
23
  }[];
24
24
  };
25
25
  options: {
26
26
  cutout: string;
27
27
  responsive: boolean;
28
+ spacing: number | undefined;
28
29
  maintainAspectRatio: boolean;
29
30
  elements: {
30
31
  arc: {
package/dist/main.js CHANGED
@@ -43660,13 +43660,13 @@ const ote = (e) => {
43660
43660
  const t = e.theme, { values: n, palette: o, legend: r = !0, hoveredArcIndex: i, setHoveredArcIndex: s, handleChartHover: a, hoverOffset: c, ...d } = e;
43661
43661
  return {
43662
43662
  ...d,
43663
+ skipNull: !0,
43663
43664
  data: {
43664
43665
  datasets: [
43665
43666
  {
43666
43667
  data: n ?? [],
43667
- backgroundColor: i === null || !r ? o : o.map((u, p) => p !== i ? vt(u).alpha(0.4).css() : u),
43668
+ backgroundColor: i === null || !r ? o : o.flatMap((u, p) => p !== i ? vt(u).alpha(0.4).css() : u),
43668
43669
  hoverBackgroundColor: o,
43669
- spacing: e.spacing,
43670
43670
  hoverOffset: c
43671
43671
  }
43672
43672
  ]
@@ -43674,6 +43674,7 @@ const ote = (e) => {
43674
43674
  options: {
43675
43675
  cutout: "78%",
43676
43676
  responsive: !0,
43677
+ spacing: n && n.filter((u) => u !== null && u !== 0).length > 1 ? e.spacing : 0,
43677
43678
  maintainAspectRatio: !0,
43678
43679
  elements: {
43679
43680
  arc: {
@@ -43712,14 +43713,15 @@ const ote = (e) => {
43712
43713
  padding: "2px"
43713
43714
  },
43714
43715
  beforeDatasetsDraw: (u) => {
43715
- if (u.data.datasets.length > 0 && u.data.datasets[0].data.length > 0)
43716
+ const h = u.data.datasets.length > 0 && u.data.datasets[0].data.length > 0, g = u.data.datasets[0].data.every((w) => w === 0);
43717
+ if (h && !g)
43716
43718
  return;
43717
- const g = u.canvas.clientWidth / 2, m = u.canvas.clientHeight / 2, b = u.ctx, { innerRadius: C, outerRadius: x } = u.getDatasetMeta(
43719
+ const m = u.canvas.clientWidth / 2, b = u.canvas.clientHeight / 2, C = u.ctx, { innerRadius: x, outerRadius: v } = u.getDatasetMeta(
43718
43720
  u.data.datasets.length - 1
43719
- ).controller, v = x - C;
43720
- b.lineWidth = v + 2, b.strokeStyle = t.palette.primary[50] ?? "rgba(0, 0, 0, 0)";
43721
- const S = x - v / 2;
43722
- b.beginPath(), b.arc(g, m, S, 0, 2 * Math.PI), b.stroke();
43721
+ ).controller, S = v - x;
43722
+ C.lineWidth = S, C.strokeStyle = t.palette.primary[50] ?? "rgba(0, 0, 0, 0)";
43723
+ const T = v - S / 2;
43724
+ C.beginPath(), C.arc(m, b, T, 0, 2 * Math.PI), C.stroke();
43723
43725
  }
43724
43726
  }
43725
43727
  ]
package/dist/main.umd.cjs CHANGED
@@ -365,7 +365,7 @@ const theme2 = createTheme({ palette: {
365
365
  * Released under the MIT License
366
366
  */class sG{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],s=n.duration;i.forEach(a=>a({chart:t,initial:n.initial,numSteps:s,currentStep:Math.min(o-n.start,s)}))}_refresh(){this._request||(this._running=!0,this._request=Ub.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 s=i.length-1,a=!1,c;for(;s>=0;--s)c=i[s],c._active?(c._total>o.duration&&(o.duration=c._total),c.tick(t),a=!0):(i[s]=i[i.length-1],i.pop());a&&(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 ui=new sG;const wC="transparent",aG={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const o=Jb(e||wC),r=o.valid&&Jb(t||wC);return r&&r.valid?r.mix(o,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class lG{constructor(t,n,o,r){const i=n[o];r=dn([t.to,r,i,t.from]);const s=dn([t.from,i,r]);this._active=!0,this._fn=t.fn||aG[t.type||typeof s],this._easing=rc[t.easing]||rc.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=s,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,s=this._duration-i;this._start=o,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=i,this._loop=!!t.loop,this._to=dn([t.to,n,r,t.from]),this._from=dn([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,s=this._loop,a=this._to;let c;if(this._active=i!==a&&(s||n<o),!this._active){this._target[r]=a,this._notify(!0);return}if(n<0){this._target[r]=i;return}c=n/o%2,c=s&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[r]=this._fn(i,a,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 SC{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!It(t))return;const n=Object.keys(cn.animation),o=this._properties;Object.getOwnPropertyNames(t).forEach(r=>{const i=t[r];if(!It(i))return;const s={};for(const a of n)s[a]=i[a];(sn(i.properties)&&i.properties||[r]).forEach(a=>{(a===r||!o.has(a))&&o.set(a,s)})})}_animateOptions(t,n){const o=n.options,r=dG(t,o);if(!r)return[];const i=this._createAnimations(r,o);return o.$shared&&cG(t.options.$animations,o).then(()=>{t.options=o},()=>{}),i}_createAnimations(t,n){const o=this._properties,r=[],i=t.$animations||(t.$animations={}),s=Object.keys(n),a=Date.now();let c;for(c=s.length-1;c>=0;--c){const d=s[c];if(d.charAt(0)==="$")continue;if(d==="options"){r.push(...this._animateOptions(t,n));continue}const u=n[d];let p=i[d];const h=o.get(d);if(p)if(h&&p.active()){p.update(h,u,a);continue}else p.cancel();if(!h||!h.duration){t[d]=u;continue}i[d]=p=new lG(h,t,d,u),r.push(p)}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 ui.add(this._chart,o),!0}}function cG(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 dG(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 MC(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 uG(e,t,n){if(n===!1)return!1;const o=MC(e,n),r=MC(t,n);return{top:r.end,right:o.end,bottom:r.start,left:o.start}}function fG(e){let t,n,o,r;return It(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 TC(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 kC(e,t,n,o={}){const r=e.keys,i=o.mode==="single";let s,a,c,d;if(t===null)return;let u=!1;for(s=0,a=r.length;s<a;++s){if(c=+r[s],c===n){if(u=!0,o.all)continue;break}d=e.values[c],Cn(d)&&(i||t===0||$r(t)===$r(d))&&(t+=d)}return!u&&!o.all?0:t}function pG(e,t){const{iScale:n,vScale:o}=t,r=n.axis==="x"?"x":"y",i=o.axis==="x"?"x":"y",s=Object.keys(e),a=new Array(s.length);let c,d,u;for(c=0,d=s.length;c<d;++c)u=s[c],a[c]={[r]:u,[i]:e[u]};return a}function F6(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function hG(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function gG(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 mG(e,t,n){const o=e[t]||(e[t]={});return o[n]||(o[n]={})}function EC(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 OC(e,t){const{chart:n,_cachedMeta:o}=e,r=n._stacks||(n._stacks={}),{iScale:i,vScale:s,index:a}=o,c=i.axis,d=s.axis,u=hG(i,s,o),p=t.length;let h;for(let g=0;g<p;++g){const m=t[g],{[c]:b,[d]:C}=m,x=m._stacks||(m._stacks={});h=x[d]=mG(r,u,b),h[a]=C,h._top=EC(h,s,!0,o.type),h._bottom=EC(h,s,!1,o.type);const v=h._visualValues||(h._visualValues={});v[a]=C}}function N6(e,t){const n=e.scales;return Object.keys(n).filter(o=>n[o].axis===t).shift()}function bG(e,t){return $i(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function CG(e,t,n){return $i(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function lc(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 $6=e=>e==="reset"||e==="none",_C=(e,t)=>t?e:Object.assign({},e),xG=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:TC(n,!0),values:null};class mr{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=F6(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&&lc(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,o=this.getDataset(),r=(p,h,g,m)=>p==="x"?h:p==="r"?m:g,i=n.xAxisID=xt(o.xAxisID,N6(t,"x")),s=n.yAxisID=xt(o.yAxisID,N6(t,"y")),a=n.rAxisID=xt(o.rAxisID,N6(t,"r")),c=n.indexAxis,d=n.iAxisID=r(c,i,s,a),u=n.vAxisID=r(c,s,i,a);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(s),n.rScale=this.getScaleForId(a),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&&Zb(this._data,this),t._stacked&&lc(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),o=this._data;if(It(n)){const r=this._cachedMeta;this._data=pG(n,r)}else if(o!==n){if(o){Zb(o,this);const r=this._cachedMeta;lc(r),r._parsed=[]}n&&Object.isExtensible(n)&&rU(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=F6(n.vScale,n),n.stack!==o.stack&&(r=!0,lc(n),n.stack=o.stack),this._resyncElements(t),(r||i!==n._stacked)&&(OC(this,n._parsed),n._stacked=F6(n.vScale,n))}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:s}=o,a=i.axis;let c=t===0&&n===r.length?!0:o._sorted,d=t>0&&o._parsed[t-1],u,p,h;if(this._parsing===!1)o._parsed=r,o._sorted=!0,h=r;else{sn(r[t])?h=this.parseArrayData(o,r,t,n):It(r[t])?h=this.parseObjectData(o,r,t,n):h=this.parsePrimitiveData(o,r,t,n);const g=()=>p[a]===null||d&&p[a]<d[a];for(u=0;u<n;++u)o._parsed[u+t]=p=h[u],c&&(g()&&(c=!1),d=p);o._sorted=c}s&&OC(this,h)}parsePrimitiveData(t,n,o,r){const{iScale:i,vScale:s}=t,a=i.axis,c=s.axis,d=i.getLabels(),u=i===s,p=new Array(r);let h,g,m;for(h=0,g=r;h<g;++h)m=h+o,p[h]={[a]:u||i.parse(d[m],m),[c]:s.parse(n[m],m)};return p}parseArrayData(t,n,o,r){const{xScale:i,yScale:s}=t,a=new Array(r);let c,d,u,p;for(c=0,d=r;c<d;++c)u=c+o,p=n[u],a[c]={x:i.parse(p[0],u),y:s.parse(p[1],u)};return a}parseObjectData(t,n,o,r){const{xScale:i,yScale:s}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,d=new Array(r);let u,p,h,g;for(u=0,p=r;u<p;++u)h=u+o,g=n[h],d[u]={x:i.parse(Hi(g,a),h),y:s.parse(Hi(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,s=n[t.axis],a={keys:TC(r,!0),values:n._stacks[t.axis]._visualValues};return kC(a,s,i.index,{mode:o})}updateRangeFromParsed(t,n,o,r){const i=o[n.axis];let s=i===null?NaN:i;const a=r&&o._stacks[n.axis];r&&a&&(r.values=a,s=kC(r,i,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,n){const o=this._cachedMeta,r=o._parsed,i=o._sorted&&t===o.iScale,s=r.length,a=this._getOtherScale(t),c=xG(n,o,this.chart),d={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:p}=gG(a);let h,g;function m(){g=r[h];const b=g[a.axis];return!Cn(g[t.axis])||u>b||p<b}for(h=0;h<s&&!(!m()&&(this.updateRangeFromParsed(d,t,g,c),i));++h);if(i){for(h=s-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,s;for(r=0,i=n.length;r<i;++r)s=n[r][t.axis],Cn(s)&&o.push(s);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=fG(xt(this.options.clip,uG(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,s=[],a=this._drawStart||0,c=this._drawCount||r.length-a,d=this.options.drawActiveElementsOnTop;let u;for(o.dataset&&o.dataset.draw(t,i,a,c),u=a;u<a+c;++u){const p=r[u];p.hidden||(p.active&&d?s.push(p):p.draw(t,i))}for(u=0;u<s.length;++u)s[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 s=this._cachedMeta.data[t];i=s.$context||(s.$context=CG(this.getContext(),t,s)),i.parsed=this.getParsed(t),i.raw=r.data[t],i.index=i.dataIndex=t}else i=this.$context||(this.$context=bG(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,s=t+"-"+n,a=i[s],c=this.enableOptionSharing&&tc(o);if(a)return _C(a,c);const d=this.chart.config,u=d.datasetElementScopeKeys(this._type,t),p=r?[`${t}Hover`,"hover",t,""]:[t,""],h=d.getOptionScopes(this.getDataset(),u),g=Object.keys(cn.elements[t]),m=()=>this.getContext(o,r,n),b=d.resolveNamedOptions(h,g,m,p);return b.$shared&&(b.$shared=c,i[s]=Object.freeze(_C(b,c))),b}_resolveAnimations(t,n,o){const r=this.chart,i=this._cachedDataOpts,s=`animation-${n}`,a=i[s];if(a)return a;let c;if(r.options.animation!==!1){const u=this.chart.config,p=u.datasetAnimationScopeKeys(this._type,n),h=u.getOptionScopes(this.getDataset(),p);c=u.createResolver(h,this.getContext(t,o,n))}const d=new SC(r,c&&c.animations);return c&&c._cacheable&&(i[s]=Object.freeze(d)),d}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||$6(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const o=this.resolveDataElementOptions(t,n),r=this._sharedOptions,i=this.getSharedOptions(o),s=this.includeOptions(n,i)||i!==r;return this.updateSharedOptions(i,n,o),{sharedOptions:i,includeOptions:s}}updateElement(t,n,o,r){$6(r)?Object.assign(t,o):this._resolveAnimations(n,r).update(t,o)}updateSharedOptions(t,n,o){t&&!$6(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[a,c,d]of this._syncList)this[a](c,d);this._syncList=[];const r=o.length,i=n.length,s=Math.min(i,r);s&&this.parse(0,s),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,s=t+n;let a;const c=d=>{for(d.length+=n,a=d.length-1;a>=s;a--)d[a]=d[a-n]};for(c(i),a=t;a<s;++a)i[a]=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&&lc(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])}}Ge(mr,"defaults",{}),Ge(mr,"datasetElementType",null),Ge(mr,"dataElementType",null);function yG(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=Wb(o.sort((r,i)=>r-i))}return e._cache.$bar}function vG(e){const t=e.iScale,n=yG(t,e.type);let o=t._length,r,i,s,a;const c=()=>{s===32767||s===-32768||(tc(a)&&(o=Math.min(o,Math.abs(s-a)||o)),a=s)};for(r=0,i=n.length;r<i;++r)s=t.getPixelForValue(n[r]),c();for(a=void 0,r=0,i=t.ticks.length;r<i;++r)s=t.getPixelForTick(r),c();return o}function wG(e,t,n,o){const r=n.barThickness;let i,s;return Pt(r)?(i=t.min*n.categoryPercentage,s=n.barPercentage):(i=r*o,s=1),{chunk:i/o,ratio:s,start:t.pixels[e]-i/2}}function SG(e,t,n,o){const r=t.pixels,i=r[e];let s=e>0?r[e-1]:null,a=e<r.length-1?r[e+1]:null;const c=n.categoryPercentage;s===null&&(s=i-(a===null?t.end-t.start:a-i)),a===null&&(a=i+i-s);const d=i-(i-Math.min(s,a))/2*c;return{chunk:Math.abs(a-s)/2*c/o,ratio:n.barPercentage,start:d}}function MG(e,t,n,o){const r=n.parse(e[0],o),i=n.parse(e[1],o),s=Math.min(r,i),a=Math.max(r,i);let c=s,d=a;Math.abs(s)>Math.abs(a)&&(c=a,d=s),t[n.axis]=d,t._custom={barStart:c,barEnd:d,start:r,end:i,min:s,max:a}}function PC(e,t,n,o){return sn(e)?MG(e,t,n,o):t[n.axis]=n.parse(e,o),t}function RC(e,t,n,o){const r=e.iScale,i=e.vScale,s=r.getLabels(),a=r===i,c=[];let d,u,p,h;for(d=n,u=n+o;d<u;++d)h=t[d],p={},p[r.axis]=a||r.parse(s[d],d),c.push(PC(h,p,i,d));return c}function B6(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function TG(e,t,n){return e!==0?$r(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function kG(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 EG(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:s,end:a,reverse:c,top:d,bottom:u}=kG(e);r==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===o?r=d:(n._bottom||0)===o?r=u:(i[LC(u,s,a,c)]=!0,r=d)),i[LC(r,s,a,c)]=!0,e.borderSkipped=i}function LC(e,t,n,o){return o?(e=OG(e,t,n),e=IC(e,n,t)):e=IC(e,t,n),e}function OG(e,t,n){return e===t?n:e===n?t:e}function IC(e,t,n){return e==="start"?t:e==="end"?n:e}function _G(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class od extends mr{parsePrimitiveData(t,n,o,r){return RC(t,n,o,r)}parseArrayData(t,n,o,r){return RC(t,n,o,r)}parseObjectData(t,n,o,r){const{iScale:i,vScale:s}=t,{xAxisKey:a="x",yAxisKey:c="y"}=this._parsing,d=i.axis==="x"?a:c,u=s.axis==="x"?a:c,p=[];let h,g,m,b;for(h=o,g=o+r;h<g;++h)b=n[h],m={},m[i.axis]=i.parse(Hi(b,d),h),p.push(PC(Hi(b,u),m,s,h));return p}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),s=i._custom,a=B6(s)?"["+s.start+", "+s.end+"]":""+r.getLabelForValue(i[r.axis]);return{label:""+o.getLabelForValue(i[o.axis]),value:a}}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:s,_cachedMeta:{vScale:a}}=this,c=a.getBasePixel(),d=a.isHorizontal(),u=this._getRuler(),{sharedOptions:p,includeOptions:h}=this._getSharedOptions(n,r);for(let g=n;g<n+o;g++){const m=this.getParsed(g),b=i||Pt(m[a.axis])?{base:c,head:c}:this._calculateBarValuePixels(g),C=this._calculateBarIndexPixels(g,u),x=(m._stacks||{})[a.axis],v={horizontal:d,base:b.base,enableBorderRadius:!x||B6(m._custom)||s===x._top||s===x._bottom,x:d?b.head:C.center,y:d?C.center:b.head,height:d?C.size:Math.abs(b.size),width:d?Math.abs(b.size):C.size};h&&(v.options=p||this.resolveDataElementOptions(g,t[g].active?"active":r));const S=v.options||t[g].options;EG(v,S,x,s),_G(v,S,u.ratio),this.updateElement(t[g],g,v,r)}}_getStacks(t,n){const{iScale:o}=this._cachedMeta,r=o.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),i=o.options.stacked,s=[],a=this._cachedMeta.controller.getParsed(n),c=a&&a[o.axis],d=u=>{const p=u._parsed.find(g=>g[o.axis]===c),h=p&&p[u.vScale.axis];if(Pt(h)||isNaN(h))return!0};for(const u of r)if(!(n!==void 0&&d(u))&&((i===!1||s.indexOf(u.stack)===-1||i===void 0&&u.stack===void 0)&&s.push(u.stack),u.index===t))break;return s.length||s.push(void 0),s}_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,s;for(i=0,s=n.data.length;i<s;++i)r.push(o.getPixelForValue(this.getParsed(i)[o.axis],i));const a=t.barThickness;return{min:a||vG(n),pixels:r,start:o._startPixel,end:o._endPixel,stackCount:this._getStackCount(),scale:o,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:o,index:r},options:{base:i,minBarLength:s}}=this,a=i||0,c=this.getParsed(t),d=c._custom,u=B6(d);let p=c[n.axis],h=0,g=o?this.applyStack(n,c,o):p,m,b;g!==p&&(h=g-p,g=p),u&&(p=d.barStart,g=d.barEnd-d.barStart,p!==0&&$r(p)!==$r(d.barEnd)&&(h=0),h+=p);const C=!Pt(i)&&!u?i:h;let x=n.getPixelForValue(C);if(this.chart.getDataVisibility(t)?m=n.getPixelForValue(h+g):m=x,b=m-x,Math.abs(b)<s){b=TG(b,n,a)*s,p===a&&(x-=b/2);const v=n.getPixelForDecimal(0),S=n.getPixelForDecimal(1),T=Math.min(v,S),w=Math.max(v,S);x=Math.max(Math.min(x,w),T),m=x+b,o&&!u&&(c._stacks[n.axis]._visualValues[r]=n.getValueForPixel(m)-n.getValueForPixel(x))}if(x===n.getPixelForValue(a)){const v=$r(b)*n.getLineWidthForValue(a)/2;x+=v,b-=v}return{size:b,base:x,head:m,center:m+b/2}}_calculateBarIndexPixels(t,n){const o=n.scale,r=this.options,i=r.skipNull,s=xt(r.maxBarThickness,1/0);let a,c;if(n.grouped){const d=i?this._getStackCount(t):n.stackCount,u=r.barThickness==="flex"?SG(t,n,r,d):wG(t,n,r,d),p=this._getStackIndex(this.index,this._cachedMeta.stack,i?t:void 0);a=u.start+u.chunk*p+u.chunk/2,c=Math.min(s,u.chunk*u.ratio)}else a=o.getPixelForValue(this.getParsed(t)[o.axis],t),c=Math.min(s,n.min*n.ratio);return{base:a-c/2,head:a+c/2,center:a,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)}}Ge(od,"id","bar"),Ge(od,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),Ge(od,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class rd extends mr{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,o,r){const i=super.parsePrimitiveData(t,n,o,r);for(let s=0;s<i.length;s++)i[s]._custom=this.resolveDataElementOptions(s+o).radius;return i}parseArrayData(t,n,o,r){const i=super.parseArrayData(t,n,o,r);for(let s=0;s<i.length;s++){const a=n[o+s];i[s]._custom=xt(a[2],this.resolveDataElementOptions(s+o).radius)}return i}parseObjectData(t,n,o,r){const i=super.parseObjectData(t,n,o,r);for(let s=0;s<i.length;s++){const a=n[o+s];i[s]._custom=xt(a&&a.r&&+a.r,this.resolveDataElementOptions(s+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,s=this.getParsed(t),a=r.getLabelForValue(s.x),c=i.getLabelForValue(s.y),d=s._custom;return{label:o[t]||"",value:"("+a+", "+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:s,vScale:a}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(n,r),u=s.axis,p=a.axis;for(let h=n;h<n+o;h++){const g=t[h],m=!i&&this.getParsed(h),b={},C=b[u]=i?s.getPixelForDecimal(.5):s.getPixelForValue(m[u]),x=b[p]=i?a.getBasePixel():a.getPixelForValue(m[p]);b.skip=isNaN(C)||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+=xt(o&&o._custom,i),r}}Ge(rd,"id","bubble"),Ge(rd,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),Ge(rd,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function PG(e,t,n){let o=1,r=1,i=0,s=0;if(t<ln){const a=e,c=a+t,d=Math.cos(a),u=Math.sin(a),p=Math.cos(c),h=Math.sin(c),g=(S,T,w)=>oc(S,a,c,!0)?1:Math.max(T,T*n,w,w*n),m=(S,T,w)=>oc(S,a,c,!0)?-1:Math.min(T,T*n,w,w*n),b=g(0,d,p),C=g(Sn,u,h),x=m(an,d,p),v=m(an+Sn,u,h);o=(b-x)/2,r=(C-v)/2,i=-(b+x)/2,s=-(C+v)/2}return{ratioX:o,ratioY:r,offsetX:i,offsetY:s}}class Bi extends mr{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(It(o[t])){const{key:c="value"}=this._parsing;i=d=>+Hi(o[d],c)}let s,a;for(s=t,a=t+n;s<a;++s)r._parsed[s]=i(s)}}_getRotation(){return gr(this.options.rotation-90)}_getCircumference(){return gr(this.options.circumference)}_getRotationExtents(){let t=ln,n=-ln;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(),s=r._getCircumference();t=Math.min(t,i),n=Math.max(n,i+s)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:o}=n,r=this._cachedMeta,i=r.data,s=this.getMaxBorderWidth()+this.getMaxOffset(i)+this.options.spacing,a=Math.max((Math.min(o.width,o.height)-s)/2,0),c=Math.min(ZW(this.options.cutout,a),1),d=this._getRingWeight(this.index),{circumference:u,rotation:p}=this._getRotationExtents(),{ratioX:h,ratioY:g,offsetX:m,offsetY:b}=PG(p,u,c),C=(o.width-s)/h,x=(o.height-s)/g,v=Math.max(Math.min(C,x)/2,0),S=Vb(this.options.radius,v),T=Math.max(S*c,0),w=(S-T)/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/ln)}updateElements(t,n,o,r){const i=r==="reset",s=this.chart,a=s.chartArea,d=s.options.animation,u=(a.left+a.right)/2,p=(a.top+a.bottom)/2,h=i&&d.animateScale,g=h?0:this.innerRadius,m=h?0:this.outerRadius,{sharedOptions:b,includeOptions:C}=this._getSharedOptions(n,r);let x=this._getRotation(),v;for(v=0;v<n;++v)x+=this._circumference(v,i);for(v=n;v<n+o;++v){const S=this._circumference(v,i),T=t[v],w={x:u+this.offsetX,y:p+this.offsetY,startAngle:x,endAngle:x+S,circumference:S,outerRadius:m,innerRadius:g};C&&(w.options=b||this.resolveDataElementOptions(v,T.active?"active":r)),x+=S,this.updateElement(T,v,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)?ln*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,o=this.chart,r=o.data.labels||[],i=ic(n._parsed[t],o.options.locale);return{label:r[t]||"",value:i}}getMaxBorderWidth(t){let n=0;const o=this.chart;let r,i,s,a,c;if(!t){for(r=0,i=o.data.datasets.length;r<i;++r)if(o.isDatasetVisible(r)){s=o.getDatasetMeta(r),t=s.data,a=s.controller;break}}if(!t)return 0;for(r=0,i=t.length;r<i;++r)c=a.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(xt(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Ge(Bi,"id","doughnut"),Ge(Bi,"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"}),Ge(Bi,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),Ge(Bi,"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,s)=>{const c=t.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:r,lineWidth:c.borderWidth,pointStyle:o,hidden:!t.getDataVisibility(s),index:s}})}return[]}},onClick(t,n,o){o.chart.toggleDataVisibility(n.index),o.chart.update()}}}});class id extends mr{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:o,data:r=[],_dataset:i}=n,s=this.chart._animationsDisabled;let{start:a,count:c}=qb(n,r,s);this._drawStart=a,this._drawCount=c,Kb(n)&&(a=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:!s,options:d},t),this.updateElements(r,a,c,t)}updateElements(t,n,o,r){const i=r==="reset",{iScale:s,vScale:a,_stacked:c,_dataset:d}=this._cachedMeta,{sharedOptions:u,includeOptions:p}=this._getSharedOptions(n,r),h=s.axis,g=a.axis,{spanGaps:m,segment:b}=this.options,C=al(m)?m:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||i||r==="none",v=n+o,S=t.length;let T=n>0&&this.getParsed(n-1);for(let w=0;w<S;++w){const k=t[w],E=x?k:{};if(w<n||w>=v){E.skip=!0;continue}const O=this.getParsed(w),_=Pt(O[g]),R=E[h]=s.getPixelForValue(O[h],w),P=E[g]=i||_?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,O,c):O[g],w);E.skip=isNaN(R)||isNaN(P)||_,E.stop=w>0&&Math.abs(O[h]-T[h])>C,b&&(E.parsed=O,E.raw=d.data[w]),p&&(E.options=u||this.resolveDataElementOptions(w,k.active?"active":r)),x||this.updateElement(k,w,E,r),T=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)),s=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(o,i,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Ge(id,"id","line"),Ge(id,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),Ge(id,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class cc extends mr{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=ic(n._parsed[t].r,o.options.locale);return{label:r[t]||"",value:i}}parseObjectData(t,n,o,r){return dC.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),s=Math.max(o.cutoutPercentage?i/100*o.cutoutPercentage:1,0),a=(i-s)/t.getVisibleDatasetCount();this.outerRadius=i-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,n,o,r){const i=r==="reset",s=this.chart,c=s.options.animation,d=this._cachedMeta.rScale,u=d.xCenter,p=d.yCenter,h=d.getIndexAngle(0)-.5*an;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 C=t[m];let x=g,v=g+this._computeAngle(m,r,b),S=s.getDataVisibility(m)?d.getDistanceFromCenterForValue(this.getParsed(m).r):0;g=v,i&&(c.animateScale&&(S=0),c.animateRotate&&(x=v=h));const T={x:u,y:p,innerRadius:0,outerRadius:S,startAngle:x,endAngle:v,options:this.resolveDataElementOptions(m,C.active?"active":r)};this.updateElement(C,m,T,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)?gr(this.resolveDataElementOptions(t,n).angle||o):0}}Ge(cc,"id","polarArea"),Ge(cc,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),Ge(cc,"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,s)=>{const c=t.getDatasetMeta(0).controller.getStyle(s);return{text:i,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:r,lineWidth:c.borderWidth,pointStyle:o,hidden:!t.getDataVisibility(s),index:s}})}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 z6 extends Bi{}Ge(z6,"id","pie"),Ge(z6,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class sd extends mr{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 dC.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 s=this.resolveDatasetElementOptions(t);this.options.showLine||(s.borderWidth=0);const a={_loop:!0,_fullLoop:i.length===r.length,options:s};this.updateElement(o,void 0,a,t)}this.updateElements(r,0,r.length,t)}updateElements(t,n,o,r){const i=this._cachedMeta.rScale,s=r==="reset";for(let a=n;a<n+o;a++){const c=t[a],d=this.resolveDataElementOptions(a,c.active?"active":r),u=i.getPointPositionForValue(a,this.getParsed(a).r),p=s?i.xCenter:u.x,h=s?i.yCenter:u.y,g={x:p,y:h,angle:u.angle,skip:isNaN(p)||isNaN(h),options:d};this.updateElement(c,a,g,r)}}}Ge(sd,"id","radar"),Ge(sd,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),Ge(sd,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class dc extends mr{getLabelAndValue(t){const n=this._cachedMeta,o=this.chart.data.labels||[],{xScale:r,yScale:i}=n,s=this.getParsed(t),a=r.getLabelForValue(s.x),c=i.getLabelForValue(s.y);return{label:o[t]||"",value:"("+a+", "+c+")"}}update(t){const n=this._cachedMeta,{data:o=[]}=n,r=this.chart._animationsDisabled;let{start:i,count:s}=qb(n,o,r);if(this._drawStart=i,this._drawCount=s,Kb(n)&&(i=0,s=o.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:c}=n;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!c._decimated,a.points=o;const d=this.resolveDatasetElementOptions(t);d.segment=this.options.segment,this.updateElement(a,void 0,{animated:!r,options:d},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(o,i,s,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:s,vScale:a,_stacked:c,_dataset:d}=this._cachedMeta,u=this.resolveDataElementOptions(n,r),p=this.getSharedOptions(u),h=this.includeOptions(r,p),g=s.axis,m=a.axis,{spanGaps:b,segment:C}=this.options,x=al(b)?b:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||i||r==="none";let S=n>0&&this.getParsed(n-1);for(let T=n;T<n+o;++T){const w=t[T],k=this.getParsed(T),E=v?w:{},O=Pt(k[m]),_=E[g]=s.getPixelForValue(k[g],T),R=E[m]=i||O?a.getBasePixel():a.getPixelForValue(c?this.applyStack(a,k,c):k[m],T);E.skip=isNaN(_)||isNaN(R)||O,E.stop=T>0&&Math.abs(k[g]-S[g])>x,C&&(E.parsed=k,E.raw=d.data[T]),h&&(E.options=p||this.resolveDataElementOptions(T,w.active?"active":r)),v||this.updateElement(w,T,E,r),S=k}this.updateSharedOptions(p,r,u)}getMaxOverflow(){const t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let a=0;for(let c=n.length-1;c>=0;--c)a=Math.max(a,n[c].size(this.resolveDataElementOptions(c))/2);return a>0&&a}const o=t.dataset,r=o.options&&o.options.borderWidth||0;if(!n.length)return r;const i=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(r,i,s)/2}}Ge(dc,"id","scatter"),Ge(dc,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),Ge(dc,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var RG=Object.freeze({__proto__:null,BarController:od,BubbleController:rd,DoughnutController:Bi,LineController:id,PieController:z6,PolarAreaController:cc,RadarController:sd,ScatterController:dc});function $s(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Z6{constructor(t){Ge(this,"options");this.options=t||{}}static override(t){Object.assign(Z6.prototype,t)}init(){}formats(){return $s()}parse(){return $s()}format(){return $s()}add(){return $s()}diff(){return $s()}startOf(){return $s()}endOf(){return $s()}}var LG={_date:Z6};function IG(e,t,n,o){const{controller:r,data:i,_sorted:s}=e,a=r._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&s&&i.length){const c=a._reversePixels?nU:ci;if(o){if(r._sharedOptions){const d=i[0],u=typeof d.getRange=="function"&&d.getRange(t);if(u){const p=c(i,t,n-u),h=c(i,t,n+u);return{lo:p.lo,hi:h.hi}}}}else return c(i,t,n)}return{lo:0,hi:i.length-1}}function uc(e,t,n,o,r){const i=e.getSortedVisibleDatasetMetas(),s=n[t];for(let a=0,c=i.length;a<c;++a){const{index:d,data:u}=i[a],{lo:p,hi:h}=IG(i[a],t,s,r);for(let g=p;g<=h;++g){const m=u[g];m.skip||o(m,d,g)}}}function VG(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,s=n?Math.abs(o.y-r.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(s,2))}}function W6(e,t,n,o,r){const i=[];return!r&&!e.isPointInArea(t)||uc(e,n,t,function(a,c,d){!r&&!di(a,e.chartArea,0)||a.inRange(t.x,t.y,o)&&i.push({element:a,datasetIndex:c,index:d})},!0),i}function jG(e,t,n,o){let r=[];function i(s,a,c){const{startAngle:d,endAngle:u}=s.getProps(["startAngle","endAngle"],o),{angle:p}=Bb(s,{x:t.x,y:t.y});oc(p,d,u)&&r.push({element:s,datasetIndex:a,index:c})}return uc(e,n,t,i),r}function DG(e,t,n,o,r,i){let s=[];const a=VG(n);let c=Number.POSITIVE_INFINITY;function d(u,p,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 C=a(t,m);C<c?(s=[{element:u,datasetIndex:p,index:h}],c=C):C===c&&s.push({element:u,datasetIndex:p,index:h})}return uc(e,n,t,d),s}function U6(e,t,n,o,r,i){return!i&&!e.isPointInArea(t)?[]:n==="r"&&!o?jG(e,t,n,r):DG(e,t,n,o,r,i)}function VC(e,t,n,o,r){const i=[],s=n==="x"?"inXRange":"inYRange";let a=!1;return uc(e,n,t,(c,d,u)=>{c[s]&&c[s](t[n],r)&&(i.push({element:c,datasetIndex:d,index:u}),a=a||c.inRange(t.x,t.y,r))}),o&&!a?[]:i}var AG={evaluateInteractionItems:uc,modes:{index(e,t,n,o){const r=Fs(t,e),i=n.axis||"x",s=n.includeInvisible||!1,a=n.intersect?W6(e,r,i,o,s):U6(e,r,i,!1,o,s),c=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(d=>{const u=a[0].index,p=d.data[u];p&&!p.skip&&c.push({element:p,datasetIndex:d.index,index:u})}),c):[]},dataset(e,t,n,o){const r=Fs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;let a=n.intersect?W6(e,r,i,o,s):U6(e,r,i,!1,o,s);if(a.length>0){const c=a[0].datasetIndex,d=e.getDatasetMeta(c).data;a=[];for(let u=0;u<d.length;++u)a.push({element:d[u],datasetIndex:c,index:u})}return a},point(e,t,n,o){const r=Fs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;return W6(e,r,i,o,s)},nearest(e,t,n,o){const r=Fs(t,e),i=n.axis||"xy",s=n.includeInvisible||!1;return U6(e,r,i,n.intersect,o,s)},x(e,t,n,o){const r=Fs(t,e);return VC(e,r,"x",n.intersect,o)},y(e,t,n,o){const r=Fs(t,e);return VC(e,r,"y",n.intersect,o)}}};const jC=["left","top","right","bottom"];function fc(e,t){return e.filter(n=>n.pos===t)}function DC(e,t){return e.filter(n=>jC.indexOf(n.pos)===-1&&n.box.axis===t)}function pc(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 HG(e){const t=[];let n,o,r,i,s,a;for(n=0,o=(e||[]).length;n<o;++n)r=e[n],{position:i,options:{stack:s,stackWeight:a=1}}=r,t.push({index:n,box:r,pos:i,horizontal:r.isHorizontal(),weight:r.weight,stack:s&&i+s,stackWeight:a});return t}function FG(e){const t={};for(const n of e){const{stack:o,pos:r,stackWeight:i}=n;if(!o||!jC.includes(r))continue;const s=t[o]||(t[o]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=i}return t}function NG(e,t){const n=FG(e),{vBoxMaxWidth:o,hBoxMaxHeight:r}=t;let i,s,a;for(i=0,s=e.length;i<s;++i){a=e[i];const{fullSize:c}=a.box,d=n[a.stack],u=d&&a.stackWeight/d.weight;a.horizontal?(a.width=u?u*o:c&&t.availableWidth,a.height=r):(a.width=o,a.height=u?u*r:c&&t.availableHeight)}return n}function $G(e){const t=HG(e),n=pc(t.filter(d=>d.box.fullSize),!0),o=pc(fc(t,"left"),!0),r=pc(fc(t,"right")),i=pc(fc(t,"top"),!0),s=pc(fc(t,"bottom")),a=DC(t,"x"),c=DC(t,"y");return{fullSize:n,leftAndTop:o.concat(i),rightAndBottom:r.concat(c).concat(s).concat(a),chartArea:fc(t,"chartArea"),vertical:o.concat(r).concat(c),horizontal:i.concat(s).concat(a)}}function AC(e,t,n,o){return Math.max(e[n],t[n])+Math.max(e[o],t[o])}function HC(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 BG(e,t,n,o){const{pos:r,box:i}=n,s=e.maxPadding;if(!It(r)){n.size&&(e[r]-=n.size);const p=o[n.stack]||{size:0,count:1};p.size=Math.max(p.size,n.horizontal?i.height:i.width),n.size=p.size/p.count,e[r]+=n.size}i.getPadding&&HC(s,i.getPadding());const a=Math.max(0,t.outerWidth-AC(s,e,"left","right")),c=Math.max(0,t.outerHeight-AC(s,e,"top","bottom")),d=a!==e.w,u=c!==e.h;return e.w=a,e.h=c,n.horizontal?{same:d,other:u}:{same:u,other:d}}function zG(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 ZG(e,t){const n=t.maxPadding;function o(r){const i={left:0,top:0,right:0,bottom:0};return r.forEach(s=>{i[s]=Math.max(t[s],n[s])}),i}return o(e?["left","right"]:["top","bottom"])}function hc(e,t,n,o){const r=[];let i,s,a,c,d,u;for(i=0,s=e.length,d=0;i<s;++i){a=e[i],c=a.box,c.update(a.width||t.w,a.height||t.h,ZG(a.horizontal,t));const{same:p,other:h}=BG(t,n,a,o);d|=p&&r.length,u=u||h,c.fullSize||r.push(a)}return d&&hc(r,t,n,o)||u}function ad(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 FC(e,t,n,o){const r=n.padding;let{x:i,y:s}=t;for(const a of e){const c=a.box,d=o[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/d.weight||1;if(a.horizontal){const p=t.w*u,h=d.size||c.height;tc(d.start)&&(s=d.start),c.fullSize?ad(c,r.left,s,n.outerWidth-r.right-r.left,h):ad(c,t.left+d.placed,s,p,h),d.start=s,d.placed+=p,s=c.bottom}else{const p=t.h*u,h=d.size||c.width;tc(d.start)&&(i=d.start),c.fullSize?ad(c,i,r.top,h,n.outerHeight-r.bottom-r.top):ad(c,i,t.top+d.placed,h,p),d.start=i,d.placed+=p,i=c.right}}t.x=i,t.y=s}var eo={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=Un(e.options.layout.padding),i=Math.max(t-r.width,0),s=Math.max(n-r.height,0),a=$G(e.boxes),c=a.vertical,d=a.horizontal;qt(e.boxes,b=>{typeof b.beforeLayout=="function"&&b.beforeLayout()});const u=c.reduce((b,C)=>C.box.options&&C.box.options.display===!1?b:b+1,0)||1,p=Object.freeze({outerWidth:t,outerHeight:n,padding:r,availableWidth:i,availableHeight:s,vBoxMaxWidth:i/2/u,hBoxMaxHeight:s/2}),h=Object.assign({},r);HC(h,Un(o));const g=Object.assign({maxPadding:h,w:i,h:s,x:r.left,y:r.top},r),m=NG(c.concat(d),p);hc(a.fullSize,g,p,m),hc(c,g,p,m),hc(d,g,p,m)&&hc(c,g,p,m),zG(g),FC(a.leftAndTop,g,p,m),g.x+=g.w,g.y+=g.h,FC(a.rightAndBottom,g,p,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},qt(a.chartArea,b=>{const C=b.box;Object.assign(C,e.chartArea),C.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class NC{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 WG extends NC{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ld="$chartjs",UG={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},$C=e=>e===null||e==="";function GG(e,t){const n=e.style,o=e.getAttribute("height"),r=e.getAttribute("width");if(e[ld]={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",$C(r)){const i=pC(e,"width");i!==void 0&&(e.width=i)}if($C(o))if(e.style.height==="")e.height=e.width/(t||2);else{const i=pC(e,"height");i!==void 0&&(e.height=i)}return e}const BC=KU?{passive:!0}:!1;function qG(e,t,n){e&&e.addEventListener(t,n,BC)}function KG(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,BC)}function YG(e,t){const n=UG[e.type]||e.type,{x:o,y:r}=Fs(e,t);return{type:n,chart:t,native:e,x:o!==void 0?o:null,y:r!==void 0?r:null}}function cd(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function XG(e,t,n){const o=e.canvas,r=new MutationObserver(i=>{let s=!1;for(const a of i)s=s||cd(a.addedNodes,o),s=s&&!cd(a.removedNodes,o);s&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function JG(e,t,n){const o=e.canvas,r=new MutationObserver(i=>{let s=!1;for(const a of i)s=s||cd(a.removedNodes,o),s=s&&!cd(a.addedNodes,o);s&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const gc=new Map;let zC=0;function ZC(){const e=window.devicePixelRatio;e!==zC&&(zC=e,gc.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function QG(e,t){gc.size||window.addEventListener("resize",ZC),gc.set(e,t)}function eq(e){gc.delete(e),gc.size||window.removeEventListener("resize",ZC)}function tq(e,t,n){const o=e.canvas,r=o&&H6(o);if(!r)return;const i=Gb((a,c)=>{const d=r.clientWidth;n(a,c),d<r.clientWidth&&n()},window),s=new ResizeObserver(a=>{const c=a[0],d=c.contentRect.width,u=c.contentRect.height;d===0&&u===0||i(d,u)});return s.observe(r),QG(e,i),s}function G6(e,t,n){n&&n.disconnect(),t==="resize"&&eq(e)}function nq(e,t,n){const o=e.canvas,r=Gb(i=>{e.ctx!==null&&n(YG(i,e))},e);return qG(o,t,r),r}class oq extends NC{acquireContext(t,n){const o=t&&t.getContext&&t.getContext("2d");return o&&o.canvas===t?(GG(t,n),o):null}releaseContext(t){const n=t.canvas;if(!n[ld])return!1;const o=n[ld].initial;["height","width"].forEach(i=>{const s=o[i];Pt(s)?n.removeAttribute(i):n.setAttribute(i,s)});const r=o.style||{};return Object.keys(r).forEach(i=>{n.style[i]=r[i]}),n.width=n.width,delete n[ld],!0}addEventListener(t,n,o){this.removeEventListener(t,n);const r=t.$proxies||(t.$proxies={}),s={attach:XG,detach:JG,resize:tq}[n]||nq;r[n]=s(t,n,o)}removeEventListener(t,n){const o=t.$proxies||(t.$proxies={}),r=o[n];if(!r)return;({attach:G6,detach:G6,resize:G6}[n]||KG)(t,n,r),o[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,o,r){return qU(t,n,o,r)}isAttached(t){const n=t&&H6(t);return!!(n&&n.isConnected)}}function rq(e){return!A6()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?WG:oq}let fi=(l3=class{constructor(){Ge(this,"x");Ge(this,"y");Ge(this,"active",!1);Ge(this,"options");Ge(this,"$animations")}tooltipPosition(t){const{x:n,y:o}=this.getProps(["x","y"],t);return{x:n,y:o}}hasValue(){return al(this.x)&&al(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}},Ge(l3,"defaults",{}),Ge(l3,"defaultRoutes"),l3);function iq(e,t){const n=e.options.ticks,o=sq(e),r=Math.min(n.maxTicksLimit||o,o),i=n.major.enabled?lq(t):[],s=i.length,a=i[0],c=i[s-1],d=[];if(s>r)return cq(t,d,i,s/r),d;const u=aq(i,t,r);if(s>0){let p,h;const g=s>1?Math.round((c-a)/(s-1)):null;for(dd(t,d,u,Pt(g)?0:a-g,a),p=0,h=s-1;p<h;p++)dd(t,d,u,i[p],i[p+1]);return dd(t,d,u,c,Pt(g)?t.length:c+g),d}return dd(t,d,u),d}function sq(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 aq(e,t,n){const o=dq(e),r=t.length/n;if(!o)return Math.max(r,1);const i=JW(o);for(let s=0,a=i.length-1;s<a;s++){const c=i[s];if(c>r)return c}return Math.max(r,1)}function lq(e){const t=[];let n,o;for(n=0,o=e.length;n<o;n++)e[n].major&&t.push(n);return t}function cq(e,t,n,o){let r=0,i=n[0],s;for(o=Math.ceil(o),s=0;s<e.length;s++)s===i&&(t.push(e[s]),r++,i=n[r*o])}function dd(e,t,n,o,r){const i=xt(o,0),s=Math.min(xt(r,e.length),e.length);let a=0,c,d,u;for(n=Math.ceil(n),r&&(c=r-o,n=c/Math.floor(c/n)),u=i;u<0;)a++,u=Math.round(i+a*n);for(d=Math.max(i,0);d<s;d++)d===u&&(t.push(e[d]),a++,u=Math.round(i+a*n))}function dq(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 uq=e=>e==="left"?"right":e==="right"?"left":e,WC=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,UC=(e,t)=>Math.min(t||e,e);function GC(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 fq(e,t,n){const o=e.ticks.length,r=Math.min(t,o-1),i=e._startPixel,s=e._endPixel,a=1e-6;let c=e.getPixelForTick(r),d;if(!(n&&(o===1?d=Math.max(c-i,s-c):t===0?d=(e.getPixelForTick(1)-c)/2:d=(c-e.getPixelForTick(r-1))/2,c+=r<t?d:-d,c<i-a||c>s+a)))return c}function pq(e,t){qt(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 mc(e){return e.drawTicks?e.tickLength:0}function qC(e,t){if(!e.display)return 0;const n=Tn(e.font,t),o=Un(e.padding);return(sn(e.text)?e.text.length:1)*n.lineHeight+o.height}function hq(e,t){return $i(e,{scale:t,type:"scale"})}function gq(e,t,n){return $i(e,{tick:n,index:t,type:"tick"})}function mq(e,t,n){let o=E6(e);return(n&&t!=="right"||!n&&t==="right")&&(o=uq(o)),o}function bq(e,t,n,o){const{top:r,left:i,bottom:s,right:a,chart:c}=e,{chartArea:d,scales:u}=c;let p=0,h,g,m;const b=s-r,C=a-i;if(e.isHorizontal()){if(g=Qn(o,i,a),It(n)){const x=Object.keys(n)[0],v=n[x];m=u[x].getPixelForValue(v)+b-t}else n==="center"?m=(d.bottom+d.top)/2+b-t:m=WC(e,n,t);h=a-i}else{if(It(n)){const x=Object.keys(n)[0],v=n[x];g=u[x].getPixelForValue(v)-C+t}else n==="center"?g=(d.left+d.right)/2-C+t:g=WC(e,n,t);m=Qn(o,s,r),p=n==="left"?-Sn:Sn}return{titleX:g,titleY:m,maxWidth:h,rotation:p}}class Bs extends fi{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=Fo(t,Number.POSITIVE_INFINITY),n=Fo(n,Number.NEGATIVE_INFINITY),o=Fo(o,Number.POSITIVE_INFINITY),r=Fo(r,Number.NEGATIVE_INFINITY),{min:Fo(t,o),max:Fo(n,r),minDefined:Cn(t),maxDefined:Cn(n)}}getMinMax(t){let{min:n,max:o,minDefined:r,maxDefined:i}=this.getUserBounds(),s;if(r&&i)return{min:n,max:o};const a=this.getMatchingVisibleMetas();for(let c=0,d=a.length;c<d;++c)s=a[c].controller.getMinMax(this,t),r||(n=Math.min(n,s.min)),i||(o=Math.max(o,s.max));return n=i&&n>o?o:n,o=r&&n>o?n:o,{min:Fo(n,Fo(o,n)),max:Fo(o,Fo(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(){en(this.options.beforeUpdate,[this])}update(t,n,o){const{beginAtZero:r,grace:i,ticks:s}=this.options,a=s.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=kU(this,i,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a<this.ticks.length;this._convertTicksToLabels(c?GC(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||s.source==="auto")&&(this.ticks=iq(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(){en(this.options.afterUpdate,[this])}beforeSetDimensions(){en(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(){en(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),en(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){en(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=en(n.callback,[i.value,o,t],this)}afterTickToLabelConversion(){en(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){en(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,o=UC(this.ticks.length,t.ticks.maxTicksLimit),r=n.minRotation||0,i=n.maxRotation;let s=r,a,c,d;if(!this._isVisible()||!n.display||r>=i||o<=1||!this.isHorizontal()){this.labelRotation=r;return}const u=this._getLabelSizes(),p=u.widest.width,h=u.highest.height,g=Vn(this.chart.width-p,0,this.maxWidth);a=t.offset?this.maxWidth/o:g/(o-1),p+6>a&&(a=g/(o-(t.offset?.5:1)),c=this.maxHeight-mc(t.grid)-n.padding-qC(t.title,this.chart.options.font),d=Math.sqrt(p*p+h*h),s=M6(Math.min(Math.asin(Vn((u.highest.height+6)/a,-1,1)),Math.asin(Vn(c/d,-1,1))-Math.asin(Vn(h/d,-1,1)))),s=Math.max(r,Math.min(i,s))),this.labelRotation=s}afterCalculateLabelRotation(){en(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){en(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:o,title:r,grid:i}}=this,s=this._isVisible(),a=this.isHorizontal();if(s){const c=qC(r,n.options.font);if(a?(t.width=this.maxWidth,t.height=mc(i)+c):(t.height=this.maxHeight,t.width=mc(i)+c),o.display&&this.ticks.length){const{first:d,last:u,widest:p,highest:h}=this._getLabelSizes(),g=o.padding*2,m=gr(this.labelRotation),b=Math.cos(m),C=Math.sin(m);if(a){const x=o.mirror?0:C*p.width+b*h.height;t.height=Math.min(this.maxHeight,t.height+x+g)}else{const x=o.mirror?0:b*p.width+C*h.height;t.width=Math.min(this.maxWidth,t.width+x+g)}this._calculatePadding(d,u,C,b)}}this._handleMargins(),a?(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:s},position:a}=this.options,c=this.labelRotation!==0,d=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,p=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+s)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-p+s)*this.width/(this.width-p),0)}else{let u=n.height/2,p=t.height/2;i==="start"?(u=0,p=t.height):i==="end"&&(u=n.height,p=0),this.paddingTop=u+s,this.paddingBottom=p+s}}_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(){en(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++)Pt(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=GC(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,s=[],a=[],c=Math.floor(n/UC(n,o));let d=0,u=0,p,h,g,m,b,C,x,v,S,T,w;for(p=0;p<n;p+=c){if(m=t[p].label,b=this._resolveTickFontOptions(p),r.font=C=b.string,x=i[C]=i[C]||{data:{},gc:[]},v=b.lineHeight,S=T=0,!Pt(m)&&!sn(m))S=Y1(r,x.data,x.gc,S,m),T=v;else if(sn(m))for(h=0,g=m.length;h<g;++h)w=m[h],!Pt(w)&&!sn(w)&&(S=Y1(r,x.data,x.gc,S,w),T+=v);s.push(S),a.push(T),d=Math.max(S,d),u=Math.max(T,u)}pq(i,n);const k=s.indexOf(d),E=a.indexOf(u),O=_=>({width:s[_]||0,height:a[_]||0});return{first:O(0),last:O(n-1),widest:O(k),highest:O(E),widths:s,heights:a}}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 tU(this._alignToPixels?js(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=gq(this.getContext(),t,o))}return this.$context||(this.$context=hq(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=gr(this.labelRotation),o=Math.abs(Math.cos(n)),r=Math.abs(Math.sin(n)),i=this._getLabelSizes(),s=t.autoSkipPadding||0,a=i?i.widest.width+s:0,c=i?i.highest.height+s:0;return this.isHorizontal()?c*o>a*r?a/o:c/r:c*r<a*o?c/o:a/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:s,border:a}=r,c=i.offset,d=this.isHorizontal(),p=this.ticks.length+(c?1:0),h=mc(i),g=[],m=a.setContext(this.getContext()),b=m.display?m.width:0,C=b/2,x=function(N){return js(o,N,b)};let v,S,T,w,k,E,O,_,R,P,L,j;if(s==="top")v=x(this.bottom),E=this.bottom-h,_=v-C,P=x(t.top)+C,j=t.bottom;else if(s==="bottom")v=x(this.top),P=t.top,j=x(t.bottom)-C,E=v+C,_=this.top+h;else if(s==="left")v=x(this.right),k=this.right-h,O=v-C,R=x(t.left)+C,L=t.right;else if(s==="right")v=x(this.left),R=t.left,L=x(t.right)-C,k=v+C,O=this.left+h;else if(n==="x"){if(s==="center")v=x((t.top+t.bottom)/2+.5);else if(It(s)){const N=Object.keys(s)[0],B=s[N];v=x(this.chart.scales[N].getPixelForValue(B))}P=t.top,j=t.bottom,E=v+C,_=E+h}else if(n==="y"){if(s==="center")v=x((t.left+t.right)/2);else if(It(s)){const N=Object.keys(s)[0],B=s[N];v=x(this.chart.scales[N].getPixelForValue(B))}k=v-C,O=k-h,R=t.left,L=t.right}const V=xt(r.ticks.maxTicksLimit,p),I=Math.max(1,Math.ceil(p/V));for(S=0;S<p;S+=I){const N=this.getContext(S),B=i.setContext(N),D=a.setContext(N),A=B.lineWidth,$=B.color,Z=D.dash||[],ae=D.dashOffset,oe=B.tickWidth,W=B.tickColor,Y=B.tickBorderDash||[],K=B.tickBorderDashOffset;T=fq(this,S,c),T!==void 0&&(w=js(o,T,A),d?k=O=R=L=w:E=_=P=j=w,g.push({tx1:k,ty1:E,tx2:O,ty2:_,x1:R,y1:P,x2:L,y2:j,width:A,color:$,borderDash:Z,borderDashOffset:ae,tickWidth:oe,tickColor:W,tickBorderDash:Y,tickBorderDashOffset:K}))}return this._ticksLength=p,this._borderValue=v,g}_computeLabelItems(t){const n=this.axis,o=this.options,{position:r,ticks:i}=o,s=this.isHorizontal(),a=this.ticks,{align:c,crossAlign:d,padding:u,mirror:p}=i,h=mc(o.grid),g=h+u,m=p?-u:g,b=-gr(this.labelRotation),C=[];let x,v,S,T,w,k,E,O,_,R,P,L,j="middle";if(r==="top")k=this.bottom-m,E=this._getXAxisLabelAlignment();else if(r==="bottom")k=this.top+m,E=this._getXAxisLabelAlignment();else if(r==="left"){const I=this._getYAxisLabelAlignment(h);E=I.textAlign,w=I.x}else if(r==="right"){const I=this._getYAxisLabelAlignment(h);E=I.textAlign,w=I.x}else if(n==="x"){if(r==="center")k=(t.top+t.bottom)/2+g;else if(It(r)){const I=Object.keys(r)[0],N=r[I];k=this.chart.scales[I].getPixelForValue(N)+g}E=this._getXAxisLabelAlignment()}else if(n==="y"){if(r==="center")w=(t.left+t.right)/2-g;else if(It(r)){const I=Object.keys(r)[0],N=r[I];w=this.chart.scales[I].getPixelForValue(N)}E=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(c==="start"?j="top":c==="end"&&(j="bottom"));const V=this._getLabelSizes();for(x=0,v=a.length;x<v;++x){S=a[x],T=S.label;const I=i.setContext(this.getContext(x));O=this.getPixelForTick(x)+i.labelOffset,_=this._resolveTickFontOptions(x),R=_.lineHeight,P=sn(T)?T.length:1;const N=P/2,B=I.color,D=I.textStrokeColor,A=I.textStrokeWidth;let $=E;s?(w=O,E==="inner"&&(x===v-1?$=this.options.reverse?"left":"right":x===0?$=this.options.reverse?"right":"left":$="center"),r==="top"?d==="near"||b!==0?L=-P*R+R/2:d==="center"?L=-V.highest.height/2-N*R+R:L=-V.highest.height+R/2:d==="near"||b!==0?L=R/2:d==="center"?L=V.highest.height/2-N*R:L=V.highest.height-P*R,p&&(L*=-1),b!==0&&!I.showLabelBackdrop&&(w+=R/2*Math.sin(b))):(k=O,L=(1-P)*R/2);let Z;if(I.showLabelBackdrop){const ae=Un(I.backdropPadding),oe=V.heights[x],W=V.widths[x];let Y=L-ae.top,K=0-ae.left;switch(j){case"middle":Y-=oe/2;break;case"bottom":Y-=oe;break}switch(E){case"center":K-=W/2;break;case"right":K-=W;break;case"inner":x===v-1?K-=W:x>0&&(K-=W/2);break}Z={left:K,top:Y,width:W+ae.width,height:oe+ae.height,color:I.backdropColor}}C.push({label:T,font:_,textOffset:L,options:{rotation:b,color:B,strokeColor:D,strokeWidth:A,textAlign:$,textBaseline:j,translation:[w,k],backdrop:Z}})}return C}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-gr(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,s=this._getLabelSizes(),a=t+i,c=s.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-a,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+a,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:s}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(o,r,i,s),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,s;const a=(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,s=r.length;i<s;++i){const c=r[i];n.drawOnChartArea&&a({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&a({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()),s=o.display?i.width:0;if(!s)return;const a=r.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let d,u,p,h;this.isHorizontal()?(d=js(t,this.left,s)-s/2,u=js(t,this.right,a)+a/2,p=h=c):(p=js(t,this.top,s)-s/2,h=js(t,this.bottom,a)+a/2,d=u=c),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(d,p),n.lineTo(u,h),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const o=this.ctx,r=this._computeLabelArea();r&&X1(o,r);const i=this.getLabelItems(t);for(const s of i){const a=s.options,c=s.font,d=s.label,u=s.textOffset;Ds(o,d,0,u,c,a)}r&&J1(o)}drawTitle(){const{ctx:t,options:{position:n,title:o,reverse:r}}=this;if(!o.display)return;const i=Tn(o.font),s=Un(o.padding),a=o.align;let c=i.lineHeight/2;n==="bottom"||n==="center"||It(n)?(c+=s.bottom,sn(o.text)&&(c+=i.lineHeight*(o.text.length-1))):c+=s.top;const{titleX:d,titleY:u,maxWidth:p,rotation:h}=bq(this,c,n,a);Ds(t,o.text,0,0,i,{color:o.color,maxWidth:p,rotation:h,textAlign:mq(a,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=xt(t.grid&&t.grid.z,-1),r=xt(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==Bs.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,s;for(i=0,s=n.length;i<s;++i){const a=n[i];a[o]===this.id&&(!t||a.type===t)&&r.push(a)}return r}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return Tn(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class ud{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;yq(n)&&(o=this.register(n));const r=this.items,i=t.id,s=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+t);return i in r||(r[i]=t,Cq(t,s,o),this.override&&cn.override(t.id,t.overrides)),s}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 cn[r]&&(delete cn[r][o],this.override&&delete Vs[o])}}function Cq(e,t,n){const o=Nr(Object.create(null),[n?cn.get(n):{},cn.get(t),e.defaults]);cn.set(t,o),e.defaultRoutes&&xq(t,e.defaultRoutes),e.descriptors&&cn.describe(t,e.descriptors)}function xq(e,t){Object.keys(t).forEach(n=>{const o=n.split("."),r=o.pop(),i=[e].concat(o).join("."),s=t[n].split("."),a=s.pop(),c=s.join(".");cn.route(i,r,c,a)})}function yq(e){return"id"in e&&"defaults"in e}class vq{constructor(){this.controllers=new ud(mr,"datasets",!0),this.elements=new ud(fi,"elements"),this.plugins=new ud(Object,"plugins"),this.scales=new ud(Bs,"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):qt(r,s=>{const a=o||this._getRegistryForType(s);this._exec(t,a,s)})})}_exec(t,n,o){const r=S6(t);en(o["before"+r],[],o),n[t](o),en(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 Br=new vq;class wq{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),s=this._notify(i,t,n,o);return n==="afterDestroy"&&(this._notify(i,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,n,o,r){r=r||{};for(const i of t){const s=i.plugin,a=s[o],c=[n,r,i.options];if(en(a,c,s)===!1&&r.cancelable)return!1}return!0}invalidate(){Pt(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=xt(o.options&&o.options.plugins,{}),i=Sq(o);return r===!1&&!n?[]:Tq(t,i,r,n)}_notifyStateChanges(t){const n=this._oldCache||[],o=this._cache,r=(i,s)=>i.filter(a=>!s.some(c=>a.plugin.id===c.plugin.id));this._notify(r(n,o),t,"stop"),this._notify(r(o,n),t,"start")}}function Sq(e){const t={},n=[],o=Object.keys(Br.plugins.items);for(let i=0;i<o.length;i++)n.push(Br.getPlugin(o[i]));const r=e.plugins||[];for(let i=0;i<r.length;i++){const s=r[i];n.indexOf(s)===-1&&(n.push(s),t[s.id]=!0)}return{plugins:n,localIds:t}}function Mq(e,t){return!t&&e===!1?null:e===!0?{}:e}function Tq(e,{plugins:t,localIds:n},o,r){const i=[],s=e.getContext();for(const a of t){const c=a.id,d=Mq(o[c],r);d!==null&&i.push({plugin:a,options:kq(e.config,{plugin:a,local:n[c]},d,s)})}return i}function kq(e,{plugin:t,local:n},o,r){const i=e.pluginScopeKeys(t),s=e.getOptionScopes(o,i);return n&&t.defaults&&s.push(t.defaults),e.createResolver(s,r,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function q6(e,t){const n=cn.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function Eq(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Oq(e,t){return e===t?"_index_":"_value_"}function KC(e){if(e==="x"||e==="y"||e==="r")return e}function _q(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function K6(e,...t){if(KC(e))return e;for(const n of t){const o=n.axis||_q(n.position)||e.length>1&&KC(e[0].toLowerCase());if(o)return o}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function YC(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function Pq(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 YC(e,"x",n[0])||YC(e,"y",n[0])}return{}}function Rq(e,t){const n=Vs[e.type]||{scales:{}},o=t.scales||{},r=q6(e.type,t),i=Object.create(null);return Object.keys(o).forEach(s=>{const a=o[s];if(!It(a))return console.error(`Invalid scale configuration for scale: ${s}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${s}`);const c=K6(s,a,Pq(s,e),cn.scales[a.type]),d=Oq(c,r),u=n.scales||{};i[s]=ec(Object.create(null),[{axis:c},a,u[c],u[d]])}),e.data.datasets.forEach(s=>{const a=s.type||e.type,c=s.indexAxis||q6(a,t),u=(Vs[a]||{}).scales||{};Object.keys(u).forEach(p=>{const h=Eq(p,c),g=s[h+"AxisID"]||h;i[g]=i[g]||Object.create(null),ec(i[g],[{axis:h},o[g],u[p]])})}),Object.keys(i).forEach(s=>{const a=i[s];ec(a,[cn.scales[a.type],cn.scale])}),i}function XC(e){const t=e.options||(e.options={});t.plugins=xt(t.plugins,{}),t.scales=Rq(e,t)}function JC(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Lq(e){return e=e||{},e.data=JC(e.data),XC(e),e}const QC=new Map,ex=new Set;function fd(e,t){let n=QC.get(e);return n||(n=t(),QC.set(e,n),ex.add(n)),n}const bc=(e,t,n)=>{const o=Hi(t,n);o!==void 0&&e.add(o)};class Iq{constructor(t){this._config=Lq(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=JC(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(),XC(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return fd(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return fd(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return fd(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,o=this.type;return fd(`${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,s=this._cachedScopes(t,o),a=s.get(n);if(a)return a;const c=new Set;n.forEach(u=>{t&&(c.add(t),u.forEach(p=>bc(c,t,p))),u.forEach(p=>bc(c,r,p)),u.forEach(p=>bc(c,Vs[i]||{},p)),u.forEach(p=>bc(c,cn,p)),u.forEach(p=>bc(c,P6,p))});const d=Array.from(c);return d.length===0&&d.push(Object.create(null)),ex.has(n)&&s.set(n,d),d}chartOptionScopes(){const{options:t,type:n}=this;return[t,Vs[n]||{},cn.datasets[n]||{},{type:n},cn,P6]}resolveNamedOptions(t,n,o,r=[""]){const i={$shared:!0},{resolver:s,subPrefixes:a}=tx(this._resolverCache,t,r);let c=s;if(jq(s,n)){i.$shared=!1,o=Fi(o)?o():o;const d=this.createResolver(t,o,a);c=ll(s,o,d)}for(const d of n)i[d]=c[d];return i}createResolver(t,n,o=[""],r){const{resolver:i}=tx(this._resolverCache,t,o);return It(n)?ll(i,n,void 0,r):i}}function tx(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:V6(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},o.set(r,i)),i}const Vq=e=>It(e)&&Object.getOwnPropertyNames(e).some(t=>Fi(e[t]));function jq(e,t){const{isScriptable:n,isIndexable:o}=rC(e);for(const r of t){const i=n(r),s=o(r),a=(s||i)&&e[r];if(i&&(Fi(a)||Vq(a))||s&&sn(a))return!0}return!1}var Dq="4.4.7";const Aq=["top","bottom","left","right","chartArea"];function nx(e,t){return e==="top"||e==="bottom"||Aq.indexOf(e)===-1&&t==="x"}function ox(e,t){return function(n,o){return n[e]===o[e]?n[t]-o[t]:n[e]-o[e]}}function rx(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),en(n&&n.onComplete,[e],t)}function Hq(e){const t=e.chart,n=t.options.animation;en(n&&n.onProgress,[e],t)}function ix(e){return A6()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const pd={},sx=e=>{const t=ix(e);return Object.values(pd).filter(n=>n.canvas===t).pop()};function Fq(e,t,n){const o=Object.keys(e);for(const r of o){const i=+r;if(i>=t){const s=e[r];delete e[r],(n>0||i>t)&&(e[i+n]=s)}}}function Nq(e,t,n,o){return!n||e.type==="mouseout"?null:o?t:e}function hd(e,t,n){return e.options.clip?e[n]:t[n]}function $q(e,t){const{xScale:n,yScale:o}=e;return n&&o?{left:hd(n,t,"left"),right:hd(n,t,"right"),top:hd(o,t,"top"),bottom:hd(o,t,"bottom")}:t}let Cc=(ps=class{static register(...t){Br.add(...t),ax()}static unregister(...t){Br.remove(...t),ax()}constructor(t,n){const o=this.config=new Iq(n),r=ix(t),i=sx(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 s=o.createResolver(o.chartOptionScopes(),this.getContext());this.platform=new(o.platform||rq(r)),this.platform.updateConfig(o);const a=this.platform.acquireContext(r,s.aspectRatio),c=a&&a.canvas,d=c&&c.height,u=c&&c.width;if(this.id=zW(),this.ctx=a,this.canvas=c,this.width=u,this.height=d,this._options=s,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 wq,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=iU(p=>this.update(p),s.resizeDelay||0),this._dataChanges=[],pd[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}ui.listen(this,"complete",rx),ui.listen(this,"progress",Hq),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:o,height:r,_aspectRatio:i}=this;return Pt(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 Br}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():fC(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return tC(this.canvas,this.ctx),this}stop(){return ui.stop(this),this}resize(t,n){ui.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,s=this.platform.getMaximumSize(r,t,n,i),a=o.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,fC(this,a,!0)&&(this.notifyPlugins("resize",{size:s}),en(o.onResize,[this,s],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};qt(n,(o,r)=>{o.id=r})}buildOrUpdateScales(){const t=this.options,n=t.scales,o=this.scales,r=Object.keys(o).reduce((s,a)=>(s[a]=!1,s),{});let i=[];n&&(i=i.concat(Object.keys(n).map(s=>{const a=n[s],c=K6(s,a),d=c==="r",u=c==="x";return{options:a,dposition:d?"chartArea":u?"bottom":"left",dtype:d?"radialLinear":u?"category":"linear"}}))),qt(i,s=>{const a=s.options,c=a.id,d=K6(c,a),u=xt(a.type,s.dtype);(a.position===void 0||nx(a.position,d)!==nx(s.dposition))&&(a.position=s.dposition),r[c]=!0;let p=null;if(c in o&&o[c].type===u)p=o[c];else{const h=Br.getScale(u);p=new h({id:c,type:u,ctx:this.ctx,chart:this}),o[p.id]=p}p.init(a,t)}),qt(r,(s,a)=>{s||delete o[a]}),qt(o,s=>{eo.configure(this,s,s.options),eo.addBox(this,s)})}_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(ox("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 s=this.getDatasetMeta(o);const a=i.type||this.config.type;if(s.type&&s.type!==a&&(this._destroyDatasetMeta(o),s=this.getDatasetMeta(o)),s.type=a,s.indexAxis=i.indexAxis||q6(a,this.options),s.order=i.order||0,s.index=o,s.label=""+i.label,s.visible=this.isDatasetVisible(o),s.controller)s.controller.updateIndex(o),s.controller.linkScales();else{const c=Br.getController(a),{datasetElementType:d,dataElementType:u}=cn.datasets[a];Object.assign(c,{dataElementType:Br.getElement(u),datasetElementType:d&&Br.getElement(d)}),s.controller=new c(this,o),t.push(s.controller)}}return this._updateMetasets(),t}_resetElements(){qt(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 s=0;for(let d=0,u=this.data.datasets.length;d<u;d++){const{controller:p}=this.getDatasetMeta(d),h=!r&&i.indexOf(p)===-1;p.buildOrUpdateElements(h),s=Math.max(+p.getMaxOverflow(),s)}s=this._minPadding=o.layout.autoPadding?s:0,this._updateLayout(s),r||qt(i,d=>{d.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(ox("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){qt(this.scales,t=>{eo.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),o=new Set(t.events);(!Ab(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 s=o==="_removeElements"?-i:i;Fq(t,r,s)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,o=i=>new Set(t.filter(s=>s[0]===i).map((s,a)=>a+","+s.splice(1).join(","))),r=o(0);for(let i=1;i<n;i++)if(!Ab(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;eo.update(this,this.width,this.height,t);const n=this.chartArea,o=n.width<=0||n.height<=0;this._layers=[],qt(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,Fi(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&&(ui.has(this)?this.attached&&!ui.running(this)&&ui.start(this):(this.draw(),rx({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 s=n[r];(!t||s.visible)&&o.push(s)}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=$q(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(r&&X1(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&&J1(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return di(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,o,r){const i=AG.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=$i(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),s=i.controller._resolveAnimations(void 0,r);tc(n)?(i.data[n].hidden=!o,this.update()):(this.setDatasetVisibility(t,o),s.update(i,{visible:o}),this.update(a=>a.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(),ui.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(),tC(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete pd[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,s)=>{n.addEventListener(this,i,s),t[i]=s},r=(i,s,a)=>{i.offsetX=s,i.offsetY=a,this._eventHandler(i)};qt(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 s;const a=()=>{r("attach",a),this.attached=!0,this.resize(),o("resize",i),o("detach",s)};s=()=>{this.attached=!1,r("resize",i),this._stop(),this._resize(0,0),o("attach",a)},n.isAttached(this.canvas)?a():s()}unbindEvents(){qt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},qt(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,s,a,c;for(n==="dataset"&&(i=this.getDatasetMeta(t[0].datasetIndex),i.controller["_"+r+"DatasetHoverStyle"]()),a=0,c=t.length;a<c;++a){s=t[a];const d=s&&this.getDatasetMeta(s.datasetIndex).controller;d&&d[r+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],o=t.map(({datasetIndex:i,index:s})=>{const a=this.getDatasetMeta(i);if(!a)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:a.data[s],index:s}});!W1(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(p=>u.datasetIndex===p.datasetIndex&&u.index===p.index)),s=i(n,t),a=o?t:i(t,n);s.length&&this.updateHoverStyle(s,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(t,n){const o={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},r=s=>(s.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,s=n,a=this._getActiveElements(t,r,o,s),c=KW(t),d=Nq(t,this._lastEvent,o,c);o&&(this._lastEvent=null,en(i.onHover,[t,a,this],this),c&&en(i.onClick,[t,a,this],this));const u=!W1(a,r);return(u||n)&&(this._active=a,this._updateHoverStyles(a,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)}},Ge(ps,"defaults",cn),Ge(ps,"instances",pd),Ge(ps,"overrides",Vs),Ge(ps,"registry",Br),Ge(ps,"version",Dq),Ge(ps,"getChart",sx),ps);function ax(){return qt(Cc.instances,e=>e._plugins.invalidate())}function Bq(e,t,n){const{startAngle:o,pixelMargin:r,x:i,y:s,outerRadius:a,innerRadius:c}=t;let d=r/a;e.beginPath(),e.arc(i,s,a,o-d,n+d),c>r?(d=r/c,e.arc(i,s,c,n+d,o-d,!0)):e.arc(i,s,r,n+Sn,o-Sn),e.closePath(),e.clip()}function zq(e){return I6(e,["outerStart","outerEnd","innerStart","innerEnd"])}function Zq(e,t,n,o){const r=zq(e.options.borderRadius),i=(n-t)/2,s=Math.min(i,o*t/2),a=c=>{const d=(n-Math.min(i,c))*o/2;return Vn(c,0,Math.min(i,d))};return{outerStart:a(r.outerStart),outerEnd:a(r.outerEnd),innerStart:Vn(r.innerStart,0,s),innerEnd:Vn(r.innerEnd,0,s)}}function ul(e,t,n,o){return{x:n+e*Math.cos(t),y:o+e*Math.sin(t)}}function gd(e,t,n,o,r,i){const{x:s,y:a,startAngle:c,pixelMargin:d,innerRadius:u}=t,p=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 I=u>0?u-o:0,N=p>0?p-o:0,B=(I+N)/2,D=B!==0?m*B/(B+o):m;g=(m-D)/2}const b=Math.max(.001,m*p-n/an)/p,C=(m-b)/2,x=c+C+g,v=r-C-g,{outerStart:S,outerEnd:T,innerStart:w,innerEnd:k}=Zq(t,h,p,v-x),E=p-S,O=p-T,_=x+S/E,R=v-T/O,P=h+w,L=h+k,j=x+w/P,V=v-k/L;if(e.beginPath(),i){const I=(_+R)/2;if(e.arc(s,a,p,_,I),e.arc(s,a,p,I,R),T>0){const A=ul(O,R,s,a);e.arc(A.x,A.y,T,R,v+Sn)}const N=ul(L,v,s,a);if(e.lineTo(N.x,N.y),k>0){const A=ul(L,V,s,a);e.arc(A.x,A.y,k,v+Sn,V+Math.PI)}const B=(v-k/h+(x+w/h))/2;if(e.arc(s,a,h,v-k/h,B,!0),e.arc(s,a,h,B,x+w/h,!0),w>0){const A=ul(P,j,s,a);e.arc(A.x,A.y,w,j+Math.PI,x-Sn)}const D=ul(E,x,s,a);if(e.lineTo(D.x,D.y),S>0){const A=ul(E,_,s,a);e.arc(A.x,A.y,S,x-Sn,_)}}else{e.moveTo(s,a);const I=Math.cos(_)*p+s,N=Math.sin(_)*p+a;e.lineTo(I,N);const B=Math.cos(R)*p+s,D=Math.sin(R)*p+a;e.lineTo(B,D)}e.closePath()}function Wq(e,t,n,o,r){const{fullCircles:i,startAngle:s,circumference:a}=t;let c=t.endAngle;if(i){gd(e,t,n,o,c,r);for(let d=0;d<i;++d)e.fill();isNaN(a)||(c=s+(a%ln||ln))}return gd(e,t,n,o,c,r),e.fill(),c}function Uq(e,t,n,o,r){const{fullCircles:i,startAngle:s,circumference:a,options:c}=t,{borderWidth:d,borderJoinStyle:u,borderDash:p,borderDashOffset:h}=c,g=c.borderAlign==="inner";if(!d)return;e.setLineDash(p||[]),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){gd(e,t,n,o,m,r);for(let b=0;b<i;++b)e.stroke();isNaN(a)||(m=s+(a%ln||ln))}g&&Bq(e,t,m),i||(gd(e,t,n,o,m,r),e.stroke())}class zs extends fi{constructor(n){super();Ge(this,"circumference");Ge(this,"endAngle");Ge(this,"fullCircles");Ge(this,"innerRadius");Ge(this,"outerRadius");Ge(this,"pixelMargin");Ge(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:s,distance:a}=Bb(i,{x:n,y:o}),{startAngle:c,endAngle:d,innerRadius:u,outerRadius:p,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),g=(this.options.spacing+this.options.borderWidth)/2,m=xt(h,d-c),b=oc(s,c,d)&&c!==d,C=m>=ln||b,x=li(a,u+g,p+g);return C&&x}getCenterPoint(n){const{x:o,y:r,startAngle:i,endAngle:s,innerRadius:a,outerRadius:c}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:d,spacing:u}=this.options,p=(i+s)/2,h=(a+c+u+d)/2;return{x:o+Math.cos(p)*h,y:r+Math.sin(p)*h}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:o,circumference:r}=this,i=(o.offset||0)/4,s=(o.spacing||0)/2,a=o.circular;if(this.pixelMargin=o.borderAlign==="inner"?.33:0,this.fullCircles=r>ln?Math.floor(r/ln):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(an,r||0)),u=i*d;n.fillStyle=o.backgroundColor,n.strokeStyle=o.borderColor,Wq(n,this,u,s,a),Uq(n,this,u,s,a),n.restore()}}Ge(zs,"id","arc"),Ge(zs,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),Ge(zs,"defaultRoutes",{backgroundColor:"backgroundColor"}),Ge(zs,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function lx(e,t,n=t){e.lineCap=xt(n.borderCapStyle,t.borderCapStyle),e.setLineDash(xt(n.borderDash,t.borderDash)),e.lineDashOffset=xt(n.borderDashOffset,t.borderDashOffset),e.lineJoin=xt(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=xt(n.borderWidth,t.borderWidth),e.strokeStyle=xt(n.borderColor,t.borderColor)}function Gq(e,t,n){e.lineTo(n.x,n.y)}function qq(e){return e.stepped?bU:e.tension||e.cubicInterpolationMode==="monotone"?CU:Gq}function cx(e,t,n={}){const o=e.length,{start:r=0,end:i=o-1}=n,{start:s,end:a}=t,c=Math.max(r,s),d=Math.min(i,a),u=r<s&&i<s||r>a&&i>a;return{count:o,start:c,loop:t.loop,ilen:d<c&&!u?o+d-c:d-c}}function Kq(e,t,n,o){const{points:r,options:i}=t,{count:s,start:a,loop:c,ilen:d}=cx(r,n,o),u=qq(i);let{move:p=!0,reverse:h}=o||{},g,m,b;for(g=0;g<=d;++g)m=r[(a+(h?d-g:g))%s],!m.skip&&(p?(e.moveTo(m.x,m.y),p=!1):u(e,b,m,h,i.stepped),b=m);return c&&(m=r[(a+(h?d:0))%s],u(e,b,m,h,i.stepped)),!!c}function Yq(e,t,n,o){const r=t.points,{count:i,start:s,ilen:a}=cx(r,n,o),{move:c=!0,reverse:d}=o||{};let u=0,p=0,h,g,m,b,C,x;const v=T=>(s+(d?a-T:T))%i,S=()=>{b!==C&&(e.lineTo(u,C),e.lineTo(u,b),e.lineTo(u,x))};for(c&&(g=r[v(0)],e.moveTo(g.x,g.y)),h=0;h<=a;++h){if(g=r[v(h)],g.skip)continue;const T=g.x,w=g.y,k=T|0;k===m?(w<b?b=w:w>C&&(C=w),u=(p*u+T)/++p):(S(),e.lineTo(T,w),m=k,p=0,b=C=w),x=w}S()}function Y6(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?Yq:Kq}function Xq(e){return e.stepped?YU:e.tension||e.cubicInterpolationMode==="monotone"?XU:Ns}function Jq(e,t,n,o){let r=t._path;r||(r=t._path=new Path2D,t.path(r,n,o)&&r.closePath()),lx(e,t.options),e.stroke(r)}function Qq(e,t,n,o){const{segments:r,options:i}=t,s=Y6(t);for(const a of r)lx(e,i,a.style),e.beginPath(),s(e,t,a,{start:n,end:n+o-1})&&e.closePath(),e.stroke()}const eK=typeof Path2D=="function";function tK(e,t,n,o){eK&&!t.options.segment?Jq(e,t,n,o):Qq(e,t,n,o)}class zi extends fi{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;BU(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=oG(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,s=xC(this,{property:n,start:r,end:r});if(!s.length)return;const a=[],c=Xq(o);let d,u;for(d=0,u=s.length;d<u;++d){const{start:p,end:h}=s[d],g=i[p],m=i[h];if(g===m){a.push(g);continue}const b=Math.abs((r-g[n])/(m[n]-g[n])),C=c(g,m,b,o.stepped);C[n]=t[n],a.push(C)}return a.length===1?a[0]:a}pathSegment(t,n,o){return Y6(this)(t,this,n,o)}path(t,n,o){const r=this.segments,i=Y6(this);let s=this._loop;n=n||0,o=o||this.points.length-n;for(const a of r)s&=i(t,this,a,{start:n,end:n+o-1});return!!s}draw(t,n,o,r){const i=this.options||{};(this.points||[]).length&&i.borderWidth&&(t.save(),tK(t,this,o,r),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Ge(zi,"id","line"),Ge(zi,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),Ge(zi,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),Ge(zi,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function dx(e,t,n,o){const r=e.options,{[n]:i}=e.getProps([n],o);return Math.abs(t-i)<r.radius+r.hitRadius}class xc extends fi{constructor(n){super();Ge(this,"parsed");Ge(this,"skip");Ge(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:s,y:a}=this.getProps(["x","y"],r);return Math.pow(n-s,2)+Math.pow(o-a,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(n,o){return dx(this,n,"x",o)}inYRange(n,o){return dx(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||!di(this,o,this.size(r)/2)||(n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.fillStyle=r.backgroundColor,L6(n,r,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}Ge(xc,"id","point"),Ge(xc,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),Ge(xc,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function ux(e,t){const{x:n,y:o,base:r,width:i,height:s}=e.getProps(["x","y","base","width","height"],t);let a,c,d,u,p;return e.horizontal?(p=s/2,a=Math.min(n,r),c=Math.max(n,r),d=o-p,u=o+p):(p=i/2,a=n-p,c=n+p,d=Math.min(o,r),u=Math.max(o,r)),{left:a,top:d,right:c,bottom:u}}function Zi(e,t,n,o){return e?0:Vn(t,n,o)}function nK(e,t,n){const o=e.options.borderWidth,r=e.borderSkipped,i=oC(o);return{t:Zi(r.top,i.top,0,n),r:Zi(r.right,i.right,0,t),b:Zi(r.bottom,i.bottom,0,n),l:Zi(r.left,i.left,0,t)}}function oK(e,t,n){const{enableBorderRadius:o}=e.getProps(["enableBorderRadius"]),r=e.options.borderRadius,i=As(r),s=Math.min(t,n),a=e.borderSkipped,c=o||It(r);return{topLeft:Zi(!c||a.top||a.left,i.topLeft,0,s),topRight:Zi(!c||a.top||a.right,i.topRight,0,s),bottomLeft:Zi(!c||a.bottom||a.left,i.bottomLeft,0,s),bottomRight:Zi(!c||a.bottom||a.right,i.bottomRight,0,s)}}function rK(e){const t=ux(e),n=t.right-t.left,o=t.bottom-t.top,r=nK(e,n/2,o/2),i=oK(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 X6(e,t,n,o){const r=t===null,i=n===null,a=e&&!(r&&i)&&ux(e,o);return a&&(r||li(t,a.left,a.right))&&(i||li(n,a.top,a.bottom))}function iK(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function sK(e,t){e.rect(t.x,t.y,t.w,t.h)}function J6(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,s=(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+s,radius:e.radius}}class yc extends fi{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:s}=rK(this),a=iK(s.radius)?ac:sK;t.save(),(s.w!==i.w||s.h!==i.h)&&(t.beginPath(),a(t,J6(s,n,i)),t.clip(),a(t,J6(i,-n,s)),t.fillStyle=o,t.fill("evenodd")),t.beginPath(),a(t,J6(i,n)),t.fillStyle=r,t.fill(),t.restore()}inRange(t,n,o){return X6(this,t,n,o)}inXRange(t,n){return X6(this,t,null,n)}inYRange(t,n){return X6(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}}Ge(yc,"id","bar"),Ge(yc,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),Ge(yc,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var aK=Object.freeze({__proto__:null,ArcElement:zs,BarElement:yc,LineElement:zi,PointElement:xc});const Q6=["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)"],fx=Q6.map(e=>e.replace("rgb(","rgba(").replace(")",", 0.5)"));function px(e){return Q6[e%Q6.length]}function hx(e){return fx[e%fx.length]}function lK(e,t){return e.borderColor=px(t),e.backgroundColor=hx(t),++t}function cK(e,t){return e.backgroundColor=e.data.map(()=>px(t++)),t}function dK(e,t){return e.backgroundColor=e.data.map(()=>hx(t++)),t}function uK(e){let t=0;return(n,o)=>{const r=e.getDatasetMeta(o).controller;r instanceof Bi?t=cK(n,t):r instanceof cc?t=dK(n,t):r&&(t=lK(n,t))}}function gx(e){let t;for(t in e)if(e[t].borderColor||e[t].backgroundColor)return!0;return!1}function fK(e){return e&&(e.borderColor||e.backgroundColor)}function pK(){return cn.borderColor!=="rgba(0,0,0,0.1)"||cn.backgroundColor!=="rgba(0,0,0,0.1)"}var hK={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,s=gx(o)||fK(r)||i&&gx(i)||pK();if(!n.forceOverride&&s)return;const a=uK(e);o.forEach(a)}};function gK(e,t,n,o,r){const i=r.samples||o;if(i>=n)return e.slice(t,t+n);const s=[],a=(n-2)/(i-2);let c=0;const d=t+n-1;let u=t,p,h,g,m,b;for(s[c++]=e[u],p=0;p<i-2;p++){let C=0,x=0,v;const S=Math.floor((p+1)*a)+1+t,T=Math.min(Math.floor((p+2)*a)+1,n)+t,w=T-S;for(v=S;v<T;v++)C+=e[v].x,x+=e[v].y;C/=w,x/=w;const k=Math.floor(p*a)+1+t,E=Math.min(Math.floor((p+1)*a)+1,n)+t,{x:O,y:_}=e[u];for(g=m=-1,v=k;v<E;v++)m=.5*Math.abs((O-C)*(e[v].y-_)-(O-e[v].x)*(x-_)),m>g&&(g=m,h=e[v],b=v);s[c++]=h,u=b}return s[c++]=e[d],s}function mK(e,t,n,o){let r=0,i=0,s,a,c,d,u,p,h,g,m,b;const C=[],x=t+n-1,v=e[t].x,T=e[x].x-v;for(s=t;s<t+n;++s){a=e[s],c=(a.x-v)/T*o,d=a.y;const w=c|0;if(w===u)d<m?(m=d,p=s):d>b&&(b=d,h=s),r=(i*r+a.x)/++i;else{const k=s-1;if(!Pt(p)&&!Pt(h)){const E=Math.min(p,h),O=Math.max(p,h);E!==g&&E!==k&&C.push({...e[E],x:r}),O!==g&&O!==k&&C.push({...e[O],x:r})}s>0&&k!==g&&C.push(e[k]),C.push(a),u=w,i=0,m=b=d,p=h=g=s}}return C}function mx(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 bx(e){e.data.datasets.forEach(t=>{mx(t)})}function bK(e,t){const n=t.length;let o=0,r;const{iScale:i}=e,{min:s,max:a,minDefined:c,maxDefined:d}=i.getUserBounds();return c&&(o=Vn(ci(t,i.axis,s).lo,0,n-1)),d?r=Vn(ci(t,i.axis,a).hi+1,o,n)-o:r=n-o,{start:o,count:r}}var CK={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(e,t,n)=>{if(!n.enabled){bx(e);return}const o=e.width;e.data.datasets.forEach((r,i)=>{const{_data:s,indexAxis:a}=r,c=e.getDatasetMeta(i),d=s||r.data;if(dn([a,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:p,count:h}=bK(c,d);const g=n.threshold||4*o;if(h<=g){mx(r);return}Pt(s)&&(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=gK(d,p,h,o,n);break;case"min-max":m=mK(d,p,h,o);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}r._decimated=m})},destroy(e){bx(e)}};function xK(e,t,n){const o=e.segments,r=e.points,i=t.points,s=[];for(const a of o){let{start:c,end:d}=a;d=tp(c,d,r);const u=ep(n,r[c],r[d],a.loop);if(!t.segments){s.push({source:a,target:u,start:r[c],end:r[d]});continue}const p=xC(t,u);for(const h of p){const g=ep(n,i[h.start],i[h.end],h.loop),m=CC(a,r,g);for(const b of m)s.push({source:b,target:h,start:{[n]:Cx(u,g,"start",Math.max)},end:{[n]:Cx(u,g,"end",Math.min)}})}}return s}function ep(e,t,n,o){if(o)return;let r=t[e],i=n[e];return e==="angle"&&(r=No(r),i=No(i)),{property:e,start:r,end:i}}function yK(e,t){const{x:n=null,y:o=null}=e||{},r=t.points,i=[];return t.segments.forEach(({start:s,end:a})=>{a=tp(s,a,r);const c=r[s],d=r[a];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 tp(e,t,n){for(;t>e;t--){const o=n[t];if(!isNaN(o.x)&&!isNaN(o.y))break}return t}function Cx(e,t,n,o){return e&&t?o(e[n],t[n]):e?e[n]:t?t[n]:0}function xx(e,t){let n=[],o=!1;return sn(e)?(o=!0,n=e):n=yK(e,t),n.length?new zi({points:n,options:{tension:0},_loop:o,_fullLoop:o}):null}function yx(e){return e&&e.fill!==!1}function vK(e,t,n){let r=e[t].fill;const i=[t];let s;if(!n)return r;for(;r!==!1&&i.indexOf(r)===-1;){if(!Cn(r))return r;if(s=e[r],!s)return!1;if(s.visible)return r;i.push(r),r=s.fill}return!1}function wK(e,t,n){const o=kK(e);if(It(o))return isNaN(o.value)?!1:o;let r=parseFloat(o);return Cn(r)&&Math.floor(r)===r?SK(o[0],t,r,n):["origin","start","end","stack","shape"].indexOf(o)>=0&&o}function SK(e,t,n,o){return(e==="-"||e==="+")&&(n=t+n),n===t||n<0||n>=o?!1:n}function MK(e,t){let n=null;return e==="start"?n=t.bottom:e==="end"?n=t.top:It(e)?n=t.getPixelForValue(e.value):t.getBasePixel&&(n=t.getBasePixel()),n}function TK(e,t,n){let o;return e==="start"?o=n:e==="end"?o=t.options.reverse?t.min:t.max:It(e)?o=e.value:o=t.getBaseValue(),o}function kK(e){const t=e.options,n=t.fill;let o=xt(n&&n.target,n);return o===void 0&&(o=!!t.backgroundColor),o===!1||o===null?!1:o===!0?"origin":o}function EK(e){const{scale:t,index:n,line:o}=e,r=[],i=o.segments,s=o.points,a=OK(t,n);a.push(xx({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++)_K(r,s[u],a)}return new zi({points:r,options:{}})}function OK(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 _K(e,t,n){const o=[];for(let r=0;r<n.length;r++){const i=n[r],{first:s,last:a,point:c}=PK(i,t,"x");if(!(!c||s&&a)){if(s)o.unshift(c);else if(e.push(c),!a)break}}e.push(...o)}function PK(e,t,n){const o=e.interpolate(t,n);if(!o)return{};const r=o[n],i=e.segments,s=e.points;let a=!1,c=!1;for(let d=0;d<i.length;d++){const u=i[d],p=s[u.start][n],h=s[u.end][n];if(li(r,p,h)){a=r===p,c=r===h;break}}return{first:a,last:c,point:o}}class vx{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,n,o){const{x:r,y:i,radius:s}=this;return n=n||{start:0,end:ln},t.arc(r,i,s,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 RK(e){const{chart:t,fill:n,line:o}=e;if(Cn(n))return LK(t,n);if(n==="stack")return EK(e);if(n==="shape")return!0;const r=IK(e);return r instanceof vx?r:xx(r,o)}function LK(e,t){const n=e.getDatasetMeta(t);return n&&e.isDatasetVisible(t)?n.dataset:null}function IK(e){return(e.scale||{}).getPointPositionForValue?jK(e):VK(e)}function VK(e){const{scale:t={},fill:n}=e,o=MK(n,t);if(Cn(o)){const r=t.isHorizontal();return{x:r?o:null,y:r?null:o}}return null}function jK(e){const{scale:t,fill:n}=e,o=t.options,r=t.getLabels().length,i=o.reverse?t.max:t.min,s=TK(n,t,i),a=[];if(o.grid.circular){const c=t.getPointPositionForValue(0,i);return new vx({x:c.x,y:c.y,radius:t.getDistanceFromCenterForValue(s)})}for(let c=0;c<r;++c)a.push(t.getPointPositionForValue(c,s));return a}function np(e,t,n){const o=RK(t),{line:r,scale:i,axis:s}=t,a=r.options,c=a.fill,d=a.backgroundColor,{above:u=d,below:p=d}=c||{};o&&r.points.length&&(X1(e,n),DK(e,{line:r,target:o,above:u,below:p,area:n,scale:i,axis:s}),J1(e))}function DK(e,t){const{line:n,target:o,above:r,below:i,area:s,scale:a}=t,c=n._loop?"angle":t.axis;e.save(),c==="x"&&i!==r&&(wx(e,o,s.top),Sx(e,{line:n,target:o,color:r,scale:a,property:c}),e.restore(),e.save(),wx(e,o,s.bottom)),Sx(e,{line:n,target:o,color:i,scale:a,property:c}),e.restore()}function wx(e,t,n){const{segments:o,points:r}=t;let i=!0,s=!1;e.beginPath();for(const a of o){const{start:c,end:d}=a,u=r[c],p=r[tp(c,d,r)];i?(e.moveTo(u.x,u.y),i=!1):(e.lineTo(u.x,n),e.lineTo(u.x,u.y)),s=!!t.pathSegment(e,a,{move:s}),s?e.closePath():e.lineTo(p.x,n)}e.lineTo(t.first().x,n),e.closePath(),e.clip()}function Sx(e,t){const{line:n,target:o,property:r,color:i,scale:s}=t,a=xK(n,o,r);for(const{source:c,target:d,start:u,end:p}of a){const{style:{backgroundColor:h=i}={}}=c,g=o!==!0;e.save(),e.fillStyle=h,AK(e,s,g&&ep(r,u,p)),e.beginPath();const m=!!n.pathSegment(e,c);let b;if(g){m?e.closePath():Mx(e,o,p,r);const C=!!o.pathSegment(e,d,{move:m,reverse:!0});b=m&&C,b||Mx(e,o,u,r)}e.closePath(),e.fill(b?"evenodd":"nonzero"),e.restore()}}function AK(e,t,n){const{top:o,bottom:r}=t.chart.chartArea,{property:i,start:s,end:a}=n||{};i==="x"&&(e.beginPath(),e.rect(s,o,a-s,r-o),e.clip())}function Mx(e,t,n,o){const r=t.interpolate(n,o);r&&e.lineTo(r.x,r.y)}var HK={id:"filler",afterDatasetsUpdate(e,t,n){const o=(e.data.datasets||[]).length,r=[];let i,s,a,c;for(s=0;s<o;++s)i=e.getDatasetMeta(s),a=i.dataset,c=null,a&&a.options&&a instanceof zi&&(c={visible:e.isDatasetVisible(s),index:s,fill:wK(a,s,o),chart:e,axis:i.controller.options.indexAxis,scale:i.vScale,line:a}),i.$filler=c,r.push(c);for(s=0;s<o;++s)c=r[s],!(!c||c.fill===!1)&&(c.fill=vK(r,s,n.propagate))},beforeDraw(e,t,n){const o=n.drawTime==="beforeDraw",r=e.getSortedVisibleDatasetMetas(),i=e.chartArea;for(let s=r.length-1;s>=0;--s){const a=r[s].$filler;a&&(a.line.updateControlPoints(i,a.axis),o&&a.fill&&np(e.ctx,a,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;yx(i)&&np(e.ctx,i,e.chartArea)}},beforeDatasetDraw(e,t,n){const o=t.meta.$filler;!yx(o)||n.drawTime!=="beforeDatasetDraw"||np(e.ctx,o,e.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Tx=(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)}},FK=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;let kx=class extends fi{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=en(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=Tn(o.font),i=r.size,s=this._computeTitleHeight(),{boxWidth:a,itemHeight:c}=Tx(o,i);let d,u;n.font=r.string,this.isHorizontal()?(d=this.maxWidth,u=this._fitRows(s,i,a,c)+10):(u=this.maxHeight,d=this._fitCols(s,r,a,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:s,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],d=this.lineWidths=[0],u=r+a;let p=t;i.textAlign="left",i.textBaseline="middle";let h=-1,g=-u;return this.legendItems.forEach((m,b)=>{const C=o+n/2+i.measureText(m.text).width;(b===0||d[d.length-1]+C+2*a>s)&&(p+=u,d[d.length-(b>0?0:1)]=0,g+=u,h++),c[b]={left:0,top:g,row:h,width:C,height:r},d[d.length-1]+=C+a}),p}_fitCols(t,n,o,r){const{ctx:i,maxHeight:s,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],d=this.columnSizes=[],u=s-t;let p=a,h=0,g=0,m=0,b=0;return this.legendItems.forEach((C,x)=>{const{itemWidth:v,itemHeight:S}=NK(o,n,i,C,r);x>0&&g+S+2*a>u&&(p+=h+a,d.push({width:h,height:g}),m+=h+a,b++,h=g=0),c[x]={left:m,top:g,col:b,width:v,height:S},h=Math.max(h,v),g+=S+a}),p+=h,d.push({width:h,height:g}),p}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:o,labels:{padding:r},rtl:i}}=this,s=dl(i,this.left,this.width);if(this.isHorizontal()){let a=0,c=Qn(o,this.left+r,this.right-this.lineWidths[a]);for(const d of n)a!==d.row&&(a=d.row,c=Qn(o,this.left+r,this.right-this.lineWidths[a])),d.top+=this.top+t+r,d.left=s.leftForLtr(s.x(c),d.width),c+=d.width+r}else{let a=0,c=Qn(o,this.top+t+r,this.bottom-this.columnSizes[a].height);for(const d of n)d.col!==a&&(a=d.col,c=Qn(o,this.top+t+r,this.bottom-this.columnSizes[a].height)),d.top=c,d.left+=this.left+r,d.left=s.leftForLtr(s.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;X1(t,this),this._draw(),J1(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:o,ctx:r}=this,{align:i,labels:s}=t,a=cn.color,c=dl(t.rtl,this.left,this.width),d=Tn(s.font),{padding:u}=s,p=d.size,h=p/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:C}=Tx(s,p),x=function(k,E,O){if(isNaN(m)||m<=0||isNaN(b)||b<0)return;r.save();const _=xt(O.lineWidth,1);if(r.fillStyle=xt(O.fillStyle,a),r.lineCap=xt(O.lineCap,"butt"),r.lineDashOffset=xt(O.lineDashOffset,0),r.lineJoin=xt(O.lineJoin,"miter"),r.lineWidth=_,r.strokeStyle=xt(O.strokeStyle,a),r.setLineDash(xt(O.lineDash,[])),s.usePointStyle){const R={radius:b*Math.SQRT2/2,pointStyle:O.pointStyle,rotation:O.rotation,borderWidth:_},P=c.xPlus(k,m/2),L=E+h;nC(r,R,P,L,s.pointStyleWidth&&m)}else{const R=E+Math.max((p-b)/2,0),P=c.leftForLtr(k,m),L=As(O.borderRadius);r.beginPath(),Object.values(L).some(j=>j!==0)?ac(r,{x:P,y:R,w:m,h:b,radius:L}):r.rect(P,R,m,b),r.fill(),_!==0&&r.stroke()}r.restore()},v=function(k,E,O){Ds(r,O.text,k,E+C/2,d,{strikethrough:O.hidden,textAlign:c.textAlign(O.textAlign)})},S=this.isHorizontal(),T=this._computeTitleHeight();S?g={x:Qn(i,this.left+u,this.right-o[0]),y:this.top+u+T,line:0}:g={x:this.left+u,y:Qn(i,this.top+T+u,this.bottom-n[0].height),line:0},hC(this.ctx,t.textDirection);const w=C+u;this.legendItems.forEach((k,E)=>{r.strokeStyle=k.fontColor,r.fillStyle=k.fontColor;const O=r.measureText(k.text).width,_=c.textAlign(k.textAlign||(k.textAlign=s.textAlign)),R=m+h+O;let P=g.x,L=g.y;c.setWidth(this.width),S?E>0&&P+R+u>this.right&&(L=g.y+=w,g.line++,P=g.x=Qn(i,this.left+u,this.right-o[g.line])):E>0&&L+w>this.bottom&&(P=g.x=P+n[g.line].width+u,g.line++,L=g.y=Qn(i,this.top+T+u,this.bottom-n[g.line].height));const j=c.x(P);if(x(j,L,k),P=sU(_,P+m+h,S?P+R:this.right,t.rtl),v(c.x(P),L,k),S)g.x+=R+u;else if(typeof k.text!="string"){const V=d.lineHeight;g.y+=Ex(k,V)+u}else g.y+=w}),gC(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,o=Tn(n.font),r=Un(n.padding);if(!n.display)return;const i=dl(t.rtl,this.left,this.width),s=this.ctx,a=n.position,c=o.size/2,d=r.top+c;let u,p=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+d,p=Qn(t.align,p,this.right-h);else{const m=this.columnSizes.reduce((b,C)=>Math.max(b,C.height),0);u=d+Qn(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const g=Qn(a,p,p+h);s.textAlign=i.textAlign(E6(a)),s.textBaseline="middle",s.strokeStyle=n.color,s.fillStyle=n.color,s.font=o.string,Ds(s,n.text,g,u,o)}_computeTitleHeight(){const t=this.options.title,n=Tn(t.font),o=Un(t.padding);return t.display?n.lineHeight+o.height:0}_getLegendItemAt(t,n){let o,r,i;if(li(t,this.left,this.right)&&li(n,this.top,this.bottom)){for(i=this.legendHitBoxes,o=0;o<i.length;++o)if(r=i[o],li(t,r.left,r.left+r.width)&&li(n,r.top,r.top+r.height))return this.legendItems[o]}return null}handleEvent(t){const n=this.options;if(!zK(t.type,n))return;const o=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const r=this._hoveredItem,i=FK(r,o);r&&!i&&en(n.onLeave,[t,r,this],this),this._hoveredItem=o,o&&!i&&en(n.onHover,[t,o,this],this)}else o&&en(n.onClick,[t,o,this],this)}};function NK(e,t,n,o,r){const i=$K(o,e,t,n),s=BK(r,o,t.lineHeight);return{itemWidth:i,itemHeight:s}}function $K(e,t,n,o){let r=e.text;return r&&typeof r!="string"&&(r=r.reduce((i,s)=>i.length>s.length?i:s)),t+n.size/2+o.measureText(r).width}function BK(e,t,n){let o=e;return typeof t.text!="string"&&(o=Ex(t,n)),o}function Ex(e,t){const n=e.text?e.text.length:0;return t*n}function zK(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var ZK={id:"legend",_element:kx,start(e,t,n){const o=e.legend=new kx({ctx:e.ctx,options:n,chart:e});eo.configure(e,o,n),eo.addBox(e,o)},stop(e){eo.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const o=e.legend;eo.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:s,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(c=>{const d=c.controller.getStyle(n?0:void 0),u=Un(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:s&&(a||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 op extends fi{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=sn(o.text)?o.text.length:1;this._padding=Un(o.padding);const i=r*Tn(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:s}=this,a=s.align;let c=0,d,u,p;return this.isHorizontal()?(u=Qn(a,o,i),p=n+t,d=i-o):(s.position==="left"?(u=o+t,p=Qn(a,r,n),c=an*-.5):(u=i-t,p=Qn(a,n,r),c=an*.5),d=r-n),{titleX:u,titleY:p,maxWidth:d,rotation:c}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const o=Tn(n.font),i=o.lineHeight/2+this._padding.top,{titleX:s,titleY:a,maxWidth:c,rotation:d}=this._drawArgs(i);Ds(t,n.text,0,0,o,{color:n.color,maxWidth:c,rotation:d,textAlign:E6(n.align),textBaseline:"middle",translation:[s,a]})}}function WK(e,t){const n=new op({ctx:e.ctx,options:t,chart:e});eo.configure(e,n,t),eo.addBox(e,n),e.titleBlock=n}var UK={id:"title",_element:op,start(e,t,n){WK(e,n)},stop(e){const t=e.titleBlock;eo.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const o=e.titleBlock;eo.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 md=new WeakMap;var GK={id:"subtitle",start(e,t,n){const o=new op({ctx:e.ctx,options:n,chart:e});eo.configure(e,o,n),eo.addBox(e,o),md.set(e,o)},stop(e){eo.removeBox(e,md.get(e)),md.delete(e)},beforeUpdate(e,t,n){const o=md.get(e);eo.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 vc={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 a=e[t].element;if(a&&a.hasValue()){const c=a.tooltipPosition();o.add(c.x),r+=c.y,++i}}return i===0||o.size===0?!1:{x:[...o].reduce((a,c)=>a+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,s,a;for(i=0,s=e.length;i<s;++i){const c=e[i].element;if(c&&c.hasValue()){const d=c.getCenterPoint(),u=T6(t,d);u<r&&(r=u,a=c)}}if(a){const c=a.tooltipPosition();n=c.x,o=c.y}return{x:n,y:o}}};function zr(e,t){return t&&(sn(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function pi(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
367
367
  `)>-1?e.split(`
368
- `):e}function qK(e,t){const{element:n,datasetIndex:o,index:r}=t,i=e.getDatasetMeta(o).controller,{label:s,value:a}=i.getLabelAndValue(r);return{chart:e,label:s,parsed:i.getParsed(r),raw:e.data.datasets[o].data[r],formattedValue:a,dataset:i.getDataset(),dataIndex:r,datasetIndex:o,element:n}}function Ox(e,t){const n=e.chart.ctx,{body:o,footer:r,title:i}=e,{boxWidth:s,boxHeight:a}=t,c=Tn(t.bodyFont),d=Tn(t.titleFont),u=Tn(t.footerFont),p=i.length,h=r.length,g=o.length,m=Un(t.padding);let b=m.height,C=0,x=o.reduce((T,w)=>T+w.before.length+w.lines.length+w.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,p&&(b+=p*d.lineHeight+(p-1)*t.titleSpacing+t.titleMarginBottom),x){const T=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;b+=g*T+(x-g)*c.lineHeight+(x-1)*t.bodySpacing}h&&(b+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let v=0;const S=function(T){C=Math.max(C,n.measureText(T).width+v)};return n.save(),n.font=d.string,qt(e.title,S),n.font=c.string,qt(e.beforeBody.concat(e.afterBody),S),v=t.displayColors?s+2+t.boxPadding:0,qt(o,T=>{qt(T.before,S),qt(T.lines,S),qt(T.after,S)}),v=0,n.font=u.string,qt(e.footer,S),n.restore(),C+=m.width,{width:C,height:b}}function KK(e,t){const{y:n,height:o}=t;return n<o/2?"top":n>e.height-o/2?"bottom":"center"}function YK(e,t,n,o){const{x:r,width:i}=o,s=n.caretSize+n.caretPadding;if(e==="left"&&r+i+s>t.width||e==="right"&&r-i-s<0)return!0}function XK(e,t,n,o){const{x:r,width:i}=n,{width:s,chartArea:{left:a,right:c}}=e;let d="center";return o==="center"?d=r<=(a+c)/2?"left":"right":r<=i/2?d="left":r>=s-i/2&&(d="right"),YK(d,e,t,n)&&(d="center"),d}function _x(e,t,n){const o=n.yAlign||t.yAlign||KK(e,n);return{xAlign:n.xAlign||t.xAlign||XK(e,t,n,o),yAlign:o}}function JK(e,t){let{x:n,width:o}=e;return t==="right"?n-=o:t==="center"&&(n-=o/2),n}function QK(e,t,n){let{y:o,height:r}=e;return t==="top"?o+=n:t==="bottom"?o-=r+n:o-=r/2,o}function Px(e,t,n,o){const{caretSize:r,caretPadding:i,cornerRadius:s}=e,{xAlign:a,yAlign:c}=n,d=r+i,{topLeft:u,topRight:p,bottomLeft:h,bottomRight:g}=As(s);let m=JK(t,a);const b=QK(t,c,d);return c==="center"?a==="left"?m+=d:a==="right"&&(m-=d):a==="left"?m-=Math.max(u,h)+r:a==="right"&&(m+=Math.max(p,g)+r),{x:Vn(m,0,o.width-t.width),y:Vn(b,0,o.height-t.height)}}function bd(e,t,n){const o=Un(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-o.right:e.x+o.left}function Rx(e){return zr([],pi(e))}function eY(e,t,n){return $i(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Lx(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Ix={beforeTitle:ai,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:ai,beforeBody:ai,beforeLabel:ai,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 Pt(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:ai,afterBody:ai,beforeFooter:ai,footer:ai,afterFooter:ai};function Mo(e,t,n,o){const r=e[t].call(n,o);return typeof r>"u"?Ix[t].call(n,o):r}class rp extends fi{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 SC(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=eY(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:o}=n,r=Mo(o,"beforeTitle",this,t),i=Mo(o,"title",this,t),s=Mo(o,"afterTitle",this,t);let a=[];return a=zr(a,pi(r)),a=zr(a,pi(i)),a=zr(a,pi(s)),a}getBeforeBody(t,n){return Rx(Mo(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:o}=n,r=[];return qt(t,i=>{const s={before:[],lines:[],after:[]},a=Lx(o,i);zr(s.before,pi(Mo(a,"beforeLabel",this,i))),zr(s.lines,Mo(a,"label",this,i)),zr(s.after,pi(Mo(a,"afterLabel",this,i))),r.push(s)}),r}getAfterBody(t,n){return Rx(Mo(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:o}=n,r=Mo(o,"beforeFooter",this,t),i=Mo(o,"footer",this,t),s=Mo(o,"afterFooter",this,t);let a=[];return a=zr(a,pi(r)),a=zr(a,pi(i)),a=zr(a,pi(s)),a}_createItems(t){const n=this._active,o=this.chart.data,r=[],i=[],s=[];let a=[],c,d;for(c=0,d=n.length;c<d;++c)a.push(qK(this.chart,n[c]));return t.filter&&(a=a.filter((u,p,h)=>t.filter(u,p,h,o))),t.itemSort&&(a=a.sort((u,p)=>t.itemSort(u,p,o))),qt(a,u=>{const p=Lx(t.callbacks,u);r.push(Mo(p,"labelColor",this,u)),i.push(Mo(p,"labelPointStyle",this,u)),s.push(Mo(p,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=s,this.dataPoints=a,a}update(t,n){const o=this.options.setContext(this.getContext()),r=this._active;let i,s=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{const a=vc[o.position].call(this,r,this._eventPosition);s=this._createItems(o),this.title=this.getTitle(s,o),this.beforeBody=this.getBeforeBody(s,o),this.body=this.getBody(s,o),this.afterBody=this.getAfterBody(s,o),this.footer=this.getFooter(s,o);const c=this._size=Ox(this,o),d=Object.assign({},a,c),u=_x(this.chart,o,d),p=Px(o,d,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:p.x,y:p.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=s,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:s,cornerRadius:a}=o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:p}=As(a),{x:h,y:g}=t,{width:m,height:b}=n;let C,x,v,S,T,w;return i==="center"?(T=g+b/2,r==="left"?(C=h,x=C-s,S=T+s,w=T-s):(C=h+m,x=C+s,S=T-s,w=T+s),v=C):(r==="left"?x=h+Math.max(c,u)+s:r==="right"?x=h+m-Math.max(d,p)-s:x=this.caretX,i==="top"?(S=g,T=S-s,C=x-s,v=x+s):(S=g+b,T=S+s,C=x+s,v=x-s),w=S),{x1:C,x2:x,x3:v,y1:S,y2:T,y3:w}}drawTitle(t,n,o){const r=this.title,i=r.length;let s,a,c;if(i){const d=dl(o.rtl,this.x,this.width);for(t.x=bd(this,o.titleAlign,o),n.textAlign=d.textAlign(o.titleAlign),n.textBaseline="middle",s=Tn(o.titleFont),a=o.titleSpacing,n.fillStyle=o.titleColor,n.font=s.string,c=0;c<i;++c)n.fillText(r[c],d.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+a,c+1===i&&(t.y+=o.titleMarginBottom-a)}}_drawColorBox(t,n,o,r,i){const s=this.labelColors[o],a=this.labelPointStyles[o],{boxHeight:c,boxWidth:d}=i,u=Tn(i.bodyFont),p=bd(this,"left",i),h=r.x(p),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:a.pointStyle,rotation:a.rotation,borderWidth:1},C=r.leftForLtr(h,d)+d/2,x=m+c/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,L6(t,b,C,x),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,L6(t,b,C,x)}else{t.lineWidth=It(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const b=r.leftForLtr(h,d),C=r.leftForLtr(r.xPlus(h,1),d-2),x=As(s.borderRadius);Object.values(x).some(v=>v!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,ac(t,{x:b,y:m,w:d,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),ac(t,{x:C,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=s.backgroundColor,t.fillRect(C,m+1,d-2,c-2))}t.fillStyle=this.labelTextColors[o]}drawBody(t,n,o){const{body:r}=this,{bodySpacing:i,bodyAlign:s,displayColors:a,boxHeight:c,boxWidth:d,boxPadding:u}=o,p=Tn(o.bodyFont);let h=p.lineHeight,g=0;const m=dl(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},C=m.textAlign(s);let x,v,S,T,w,k,E;for(n.textAlign=s,n.textBaseline="middle",n.font=p.string,t.x=bd(this,C,o),n.fillStyle=o.bodyColor,qt(this.beforeBody,b),g=a&&C!=="right"?s==="center"?d/2+u:d+2+u:0,T=0,k=r.length;T<k;++T){for(x=r[T],v=this.labelTextColors[T],n.fillStyle=v,qt(x.before,b),S=x.lines,a&&S.length&&(this._drawColorBox(n,t,T,m,o),h=Math.max(p.lineHeight,c)),w=0,E=S.length;w<E;++w)b(S[w]),h=p.lineHeight;qt(x.after,b)}g=0,h=p.lineHeight,qt(this.afterBody,b),t.y-=i}drawFooter(t,n,o){const r=this.footer,i=r.length;let s,a;if(i){const c=dl(o.rtl,this.x,this.width);for(t.x=bd(this,o.footerAlign,o),t.y+=o.footerMarginTop,n.textAlign=c.textAlign(o.footerAlign),n.textBaseline="middle",s=Tn(o.footerFont),n.fillStyle=o.footerColor,n.font=s.string,a=0;a<i;++a)n.fillText(r[a],c.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+o.footerSpacing}}drawBackground(t,n,o,r){const{xAlign:i,yAlign:s}=this,{x:a,y:c}=t,{width:d,height:u}=o,{topLeft:p,topRight:h,bottomLeft:g,bottomRight:m}=As(r.cornerRadius);n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.beginPath(),n.moveTo(a+p,c),s==="top"&&this.drawCaret(t,n,o,r),n.lineTo(a+d-h,c),n.quadraticCurveTo(a+d,c,a+d,c+h),s==="center"&&i==="right"&&this.drawCaret(t,n,o,r),n.lineTo(a+d,c+u-m),n.quadraticCurveTo(a+d,c+u,a+d-m,c+u),s==="bottom"&&this.drawCaret(t,n,o,r),n.lineTo(a+g,c+u),n.quadraticCurveTo(a,c+u,a,c+u-g),s==="center"&&i==="left"&&this.drawCaret(t,n,o,r),n.lineTo(a,c+p),n.quadraticCurveTo(a,c,a+p,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 s=vc[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=Ox(this,t),c=Object.assign({},s,this._size),d=_x(n,t,c),u=Px(t,c,d,n);(r._to!==u.x||i._to!==u.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=a.width,this.height=a.height,this.caretX=s.x,this.caretY=s.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 s=Un(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=o,this.drawBackground(i,t,r,n),hC(t,n.textDirection),i.y+=s.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),gC(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const o=this._active,r=t.map(({datasetIndex:a,index:c})=>{const d=this.chart.getDatasetMeta(a);if(!d)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:d.data[c],index:c}}),i=!W1(o,r),s=this._positionChanged(r,n);(i||s)&&(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||[],s=this._getActiveElements(t,i,n,o),a=this._positionChanged(s,t),c=n||!W1(s,i)||a;return c&&(this._active=s,(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(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const s=this.chart.getElementsAtEventForMode(t,i.mode,i,o);return i.reverse&&s.reverse(),s}_positionChanged(t,n){const{caretX:o,caretY:r,options:i}=this,s=vc[i.position].call(this,t,n);return s!==!1&&(o!==s.x||r!==s.y)}}Ge(rp,"positioners",vc);var tY={id:"tooltip",_element:rp,positioners:vc,afterInit(e,t,n){n&&(e.tooltip=new rp({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:Ix},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"]},nY=Object.freeze({__proto__:null,Colors:hK,Decimation:CK,Filler:HK,Legend:ZK,SubTitle:GK,Title:UK,Tooltip:tY});const oY=(e,t,n,o)=>(typeof t=="string"?(n=e.push(t)-1,o.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function rY(e,t,n,o){const r=e.indexOf(t);if(r===-1)return oY(e,t,n,o);const i=e.lastIndexOf(t);return r!==i?n:r}const iY=(e,t)=>e===null?null:Vn(Math.round(e),0,t);function Vx(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class ip extends Bs{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(Pt(t))return null;const o=this.getLabels();return n=isFinite(n)&&o[n]===t?n:rY(o,t,xt(n,t),this._addedLabels),iY(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 s=t;s<=n;s++)r.push({value:s});return r}getLabelForValue(t){return Vx.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}}Ge(ip,"id","category"),Ge(ip,"defaults",{ticks:{callback:Vx}});function sY(e,t){const n=[],{bounds:r,step:i,min:s,max:a,precision:c,count:d,maxTicks:u,maxDigits:p,includeBounds:h}=e,g=i||1,m=u-1,{min:b,max:C}=t,x=!Pt(s),v=!Pt(a),S=!Pt(d),T=(C-b)/(p+1);let w=Fb((C-b)/m/g)*g,k,E,O,_;if(w<1e-14&&!x&&!v)return[{value:b},{value:C}];_=Math.ceil(C/w)-Math.floor(b/w),_>m&&(w=Fb(_*w/m/g)*g),Pt(c)||(k=Math.pow(10,c),w=Math.ceil(w*k)/k),r==="ticks"?(E=Math.floor(b/w)*w,O=Math.ceil(C/w)*w):(E=b,O=C),x&&v&&i&&QW((a-s)/i,w/1e3)?(_=Math.round(Math.min((a-s)/w,u)),w=(a-s)/_,E=s,O=a):S?(E=x?s:E,O=v?a:O,_=d-1,w=(O-E)/_):(_=(O-E)/w,nc(_,Math.round(_),w/1e3)?_=Math.round(_):_=Math.ceil(_));const R=Math.max($b(w),$b(E));k=Math.pow(10,Pt(c)?R:c),E=Math.round(E*k)/k,O=Math.round(O*k)/k;let P=0;for(x&&(h&&E!==s?(n.push({value:s}),E<s&&P++,nc(Math.round((E+P*w)*k)/k,s,jx(s,T,e))&&P++):E<s&&P++);P<_;++P){const L=Math.round((E+P*w)*k)/k;if(v&&L>a)break;n.push({value:L})}return v&&h&&O!==a?n.length&&nc(n[n.length-1].value,a,jx(a,T,e))?n[n.length-1].value=a:n.push({value:a}):(!v||O===a)&&n.push({value:O}),n}function jx(e,t,{horizontal:n,minRotation:o}){const r=gr(o),i=(n?Math.sin(r):Math.cos(r))||.001,s=.75*t*(""+e).length;return Math.min(t/i,s)}class Cd extends Bs{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 Pt(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 s=c=>r=n?r:c,a=c=>i=o?i:c;if(t){const c=$r(r),d=$r(i);c<0&&d<0?a(0):c>0&&d>0&&s(0)}if(r===i){let c=i===0?1:Math.abs(i*.05);a(i+c),t||s(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,s=sY(r,i);return t.bounds==="ticks"&&Nb(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let 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 ic(t,this.chart.options.locale,this.options.ticks.format)}}class sp extends Cd{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Cn(t)?t:0,this.max=Cn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,o=gr(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}}Ge(sp,"id","linear"),Ge(sp,"defaults",{ticks:{callback:K1.formatters.numeric}});const wc=e=>Math.floor(Ni(e)),Zs=(e,t)=>Math.pow(10,wc(e)+t);function Dx(e){return e/Math.pow(10,wc(e))===1}function Ax(e,t,n){const o=Math.pow(10,n),r=Math.floor(e/o);return Math.ceil(t/o)-r}function aY(e,t){const n=t-e;let o=wc(n);for(;Ax(e,t,o)>10;)o++;for(;Ax(e,t,o)<10;)o--;return Math.min(o,wc(e))}function lY(e,{min:t,max:n}){t=Fo(e.min,t);const o=[],r=wc(t);let i=aY(t,n),s=i<0?Math.pow(10,Math.abs(i)):1;const a=Math.pow(10,i),c=r>i?Math.pow(10,r):0,d=Math.round((t-c)*s)/s,u=Math.floor((t-c)/a/10)*a*10;let p=Math.floor((d-u)/Math.pow(10,i)),h=Fo(e.min,Math.round((c+u+p*Math.pow(10,i))*s)/s);for(;h<n;)o.push({value:h,major:Dx(h),significand:p}),p>=10?p=p<15?15:20:p++,p>=20&&(i++,p=2,s=i>=0?1:s),h=Math.round((c+u+p*Math.pow(10,i))*s)/s;const g=Fo(e.max,h);return o.push({value:g,major:Dx(g),significand:p}),o}class ap extends Bs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const o=Cd.prototype.parse.apply(this,[t,n]);if(o===0){this._zero=!0;return}return Cn(o)&&o>0?o:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Cn(t)?Math.max(0,t):null,this.max=Cn(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Cn(this._userMin)&&(this.min=t===Zs(this.min,0)?Zs(this.min,-1):Zs(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let o=this.min,r=this.max;const i=a=>o=t?o:a,s=a=>r=n?r:a;o===r&&(o<=0?(i(1),s(10)):(i(Zs(o,-1)),s(Zs(r,1)))),o<=0&&i(Zs(r,-1)),r<=0&&s(Zs(o,1)),this.min=o,this.max=r}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},o=lY(n,this);return t.bounds==="ticks"&&Nb(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":ic(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ni(t),this._valueRange=Ni(this.max)-Ni(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ni(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}Ge(ap,"id","logarithmic"),Ge(ap,"defaults",{ticks:{callback:K1.formatters.logarithmic,major:{enabled:!0}}});function lp(e){const t=e.ticks;if(t.display&&e.display){const n=Un(t.backdropPadding);return xt(t.font&&t.font.size,cn.font.size)+n.height}return 0}function cY(e,t,n){return n=sn(n)?n:[n],{w:mU(e,t.string,n),h:n.length*t.lineHeight}}function Hx(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 dY(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,s=e.options.pointLabels,a=s.centerPointLabels?an/i:0;for(let c=0;c<i;c++){const d=s.setContext(e.getPointLabelContext(c));r[c]=d.padding;const u=e.getPointPosition(c,e.drawingArea+r[c],a),p=Tn(d.font),h=cY(e.ctx,p,e._pointLabels[c]);o[c]=h;const g=No(e.getIndexAngle(c)+a),m=Math.round(M6(g)),b=Hx(m,u.x,h.w,0,180),C=Hx(m,u.y,h.h,90,270);uY(n,t,g,b,C)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=hY(e,o,r)}function uY(e,t,n,o,r){const i=Math.abs(Math.sin(n)),s=Math.abs(Math.cos(n));let a=0,c=0;o.start<t.l?(a=(t.l-o.start)/i,e.l=Math.min(e.l,t.l-a)):o.end>t.r&&(a=(o.end-t.r)/i,e.r=Math.max(e.r,t.r+a)),r.start<t.t?(c=(t.t-r.start)/s,e.t=Math.min(e.t,t.t-c)):r.end>t.b&&(c=(r.end-t.b)/s,e.b=Math.max(e.b,t.b+c))}function fY(e,t,n){const o=e.drawingArea,{extra:r,additionalAngle:i,padding:s,size:a}=n,c=e.getPointPosition(t,o+r+s,i),d=Math.round(M6(No(c.angle+Sn))),u=bY(c.y,a.h,d),p=gY(d),h=mY(c.x,a.w,p);return{visible:!0,x:c.x,y:u,textAlign:p,left:h,top:u,right:h+a.w,bottom:u+a.h}}function pY(e,t){if(!t)return!0;const{left:n,top:o,right:r,bottom:i}=e;return!(di({x:n,y:o},t)||di({x:n,y:i},t)||di({x:r,y:o},t)||di({x:r,y:i},t))}function hY(e,t,n){const o=[],r=e._pointLabels.length,i=e.options,{centerPointLabels:s,display:a}=i.pointLabels,c={extra:lp(i)/2,additionalAngle:s?an/r:0};let d;for(let u=0;u<r;u++){c.padding=n[u],c.size=t[u];const p=fY(e,u,c);o.push(p),a==="auto"&&(p.visible=pY(p,d),p.visible&&(d=p))}return o}function gY(e){return e===0||e===180?"center":e<180?"left":"right"}function mY(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function bY(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function CY(e,t,n){const{left:o,top:r,right:i,bottom:s}=n,{backdropColor:a}=t;if(!Pt(a)){const c=As(t.borderRadius),d=Un(t.backdropPadding);e.fillStyle=a;const u=o-d.left,p=r-d.top,h=i-o+d.width,g=s-r+d.height;Object.values(c).some(m=>m!==0)?(e.beginPath(),ac(e,{x:u,y:p,w:h,h:g,radius:c}),e.fill()):e.fillRect(u,p,h,g)}}function xY(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 s=o.setContext(e.getPointLabelContext(r));CY(n,s,i);const a=Tn(s.font),{x:c,y:d,textAlign:u}=i;Ds(n,e._pointLabels[r],c,d+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function Fx(e,t,n,o){const{ctx:r}=e;if(n)r.arc(e.xCenter,e.yCenter,t,0,ln);else{let i=e.getPointPosition(0,t);r.moveTo(i.x,i.y);for(let s=1;s<o;s++)i=e.getPointPosition(s,t),r.lineTo(i.x,i.y)}}function yY(e,t,n,o,r){const i=e.ctx,s=t.circular,{color:a,lineWidth:c}=t;!s&&!o||!a||!c||n<0||(i.save(),i.strokeStyle=a,i.lineWidth=c,i.setLineDash(r.dash||[]),i.lineDashOffset=r.dashOffset,i.beginPath(),Fx(e,n,s,o),i.closePath(),i.stroke(),i.restore())}function vY(e,t,n){return $i(e,{label:n,index:t,type:"pointLabel"})}class Sc extends Cd{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=Un(lp(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=Cn(t)&&!isNaN(t)?t:0,this.max=Cn(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/lp(this.options))}generateTickLabels(t){Cd.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,o)=>{const r=en(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?dY(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=ln/(this._pointLabels.length||1),o=this.options.startAngle||0;return No(t*n+gr(o))}getDistanceFromCenterForValue(t){if(Pt(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(Pt(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 vY(this.getContext(),t,o)}}getPointPosition(t,n,o=0){const r=this.getIndexAngle(t)-Sn+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(),Fx(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,s=this._pointLabels.length;let a,c,d;if(n.pointLabels.display&&xY(this,s),r.display&&this.ticks.forEach((u,p)=>{if(p!==0||p===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(p),g=r.setContext(h),m=i.setContext(h);yY(this,g,c,s,m)}}),o.display){for(t.save(),a=s-1;a>=0;a--){const u=o.setContext(this.getPointLabelContext(a)),{color:p,lineWidth:h}=u;!h||!p||(t.lineWidth=h,t.strokeStyle=p,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),d=this.getPointPosition(a,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,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(r),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;const d=o.setContext(this.getContext(c)),u=Tn(d.font);if(i=this.getDistanceFromCenterForValue(this.ticks[c].value),d.showLabelBackdrop){t.font=u.string,s=t.measureText(a.label).width,t.fillStyle=d.backdropColor;const p=Un(d.backdropPadding);t.fillRect(-s/2-p.left,-i-u.size/2-p.top,s+p.width,u.size+p.height)}Ds(t,a.label,0,-i,u,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),t.restore()}drawTitle(){}}Ge(Sc,"id","radialLinear"),Ge(Sc,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:K1.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),Ge(Sc,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),Ge(Sc,"descriptors",{angleLines:{_fallback:"grid"}});const xd={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}},To=Object.keys(xd);function Nx(e,t){return e-t}function $x(e,t){if(Pt(t))return null;const n=e._adapter,{parser:o,round:r,isoWeekday:i}=e._parseOpts;let s=t;return typeof o=="function"&&(s=o(s)),Cn(s)||(s=typeof o=="string"?n.parse(s,o):n.parse(s)),s===null?null:(r&&(s=r==="week"&&(al(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,r)),+s)}function Bx(e,t,n,o){const r=To.length;for(let i=To.indexOf(e);i<r-1;++i){const s=xd[To[i]],a=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-t)/(a*s.size))<=o)return To[i]}return To[r-1]}function wY(e,t,n,o,r){for(let i=To.length-1;i>=To.indexOf(n);i--){const s=To[i];if(xd[s].common&&e._adapter.diff(r,o,s)>=t-1)return s}return To[n?To.indexOf(n):0]}function SY(e){for(let t=To.indexOf(e)+1,n=To.length;t<n;++t)if(xd[To[t]].common)return To[t]}function zx(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:o,hi:r}=k6(n,t),i=n[o]>=t?n[o]:n[r];e[i]=!0}}function MY(e,t,n,o){const r=e._adapter,i=+r.startOf(t[0].value,o),s=t[t.length-1].value;let a,c;for(a=i;a<=s;a=+r.add(a,1,o))c=n[a],c>=0&&(t[c].major=!0);return t}function Zx(e,t,n){const o=[],r={},i=t.length;let s,a;for(s=0;s<i;++s)a=t[s],r[a]=s,o.push({value:a,major:!1});return i===0||!n?o:MY(e,o,r,n)}class Mc extends Bs{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 LG._date(t.adapters.date);r.init(n),ec(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:$x(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:s,maxDefined:a}=this.getUserBounds();function c(d){!s&&!isNaN(d.min)&&(r=Math.min(r,d.min)),!a&&!isNaN(d.max)&&(i=Math.max(i,d.max))}(!s||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),r=Cn(r)&&!isNaN(r)?r:+n.startOf(Date.now(),o),i=Cn(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,s=this.max,a=oU(r,i,s);return this._unit=n.unit||(o.autoSkip?Bx(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):wY(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!o.major.enabled||this._unit==="year"?void 0:SY(this._unit),this.initOffsets(r),t.reverse&&a.reverse(),Zx(this,a,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 s=t.length<3?.5:.25;n=Vn(n,0,s),o=Vn(o,0,s),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,s=i.unit||Bx(i.minUnit,n,o,this._getLabelCapacity(n)),a=xt(r.ticks.stepSize,1),c=s==="week"?i.isoWeekday:!1,d=al(c)||c===!0,u={};let p=n,h,g;if(d&&(p=+t.startOf(p,"isoWeek",c)),p=+t.startOf(p,d?"day":s),t.diff(o,n,s)>1e5*a)throw new Error(n+" and "+o+" are too far apart with stepSize of "+a+" "+s);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(h=p,g=0;h<o;h=+t.add(h,a,s),g++)zx(u,h,m);return(h===o||r.bounds==="ticks"||g===1)&&zx(u,h,m),Object.keys(u).sort(Nx).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,s=n||r[i];return this._adapter.format(t,s)}_tickFormatFunction(t,n,o,r){const i=this.options,s=i.ticks.callback;if(s)return en(s,[t,n,o],this);const a=i.time.displayFormats,c=this._unit,d=this._majorUnit,u=c&&a[c],p=d&&a[d],h=o[n],g=d&&p&&h&&h.major;return this._adapter.format(t,r||(g?p: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=gr(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),s=Math.sin(r),a=this._resolveTickFontOptions(0).size;return{w:o*i+a*s,h:o*s+a*i}}_getLabelCapacity(t){const n=this.options.time,o=n.displayFormats,r=o[n.unit]||o.millisecond,i=this._tickFormatFunction(t,0,Zx(this,[t],this._majorUnit),r),s=this._getLabelSize(i),a=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return a>0?a: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($x(this,r[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Wb(t.sort(Nx))}}Ge(Mc,"id","time"),Ge(Mc,"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 yd(e,t,n){let o=0,r=e.length-1,i,s,a,c;n?(t>=e[o].pos&&t<=e[r].pos&&({lo:o,hi:r}=ci(e,"pos",t)),{pos:i,time:a}=e[o],{pos:s,time:c}=e[r]):(t>=e[o].time&&t<=e[r].time&&({lo:o,hi:r}=ci(e,"time",t)),{time:i,pos:a}=e[o],{time:s,pos:c}=e[r]);const d=s-i;return d?a+(c-a)*(t-i)/d:a}class cp extends Mc{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=yd(n,this.min),this._tableRange=yd(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:o}=this,r=[],i=[];let s,a,c,d,u;for(s=0,a=t.length;s<a;++s)d=t[s],d>=n&&d<=o&&r.push(d);if(r.length<2)return[{time:n,pos:0},{time:o,pos:1}];for(s=0,a=r.length;s<a;++s)u=r[s+1],c=r[s-1],d=r[s],Math.round((u+c)/2)!==d&&i.push({time:d,pos:s/(a-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(yd(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,o=this.getDecimalForPixel(t)/n.factor-n.end;return yd(this._table,o*this._tableRange+this._minPos,!0)}}Ge(cp,"id","timeseries"),Ge(cp,"defaults",Mc.defaults);var TY=Object.freeze({__proto__:null,CategoryScale:ip,LinearScale:sp,LogarithmicScale:ap,RadialLinearScale:Sc,TimeScale:Mc,TimeSeriesScale:cp});const kY=[RG,aK,nY,TY],Wx="label";function Ux(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function EY(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Gx(e,t){e.labels=t}function qx(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wx;const o=[];e.datasets=t.map(r=>{const i=e.datasets.find(s=>s[n]===r[n]);return!i||!r.data||o.includes(i)?{...r}:(o.push(i),Object.assign(i,r),i)})}function OY(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Wx;const n={labels:[],datasets:[]};return Gx(n,e.labels),qx(n,e.datasets,t),n}function _Y(e,t){return e.getElementsAtEventForMode(t.nativeEvent,"nearest",{intersect:!0},!1)}function PY(e,t){const{height:n=150,width:o=300,redraw:r=!1,datasetIdKey:i,type:s,data:a,options:c,plugins:d=[],fallbackContent:u,updateMode:p,...h}=e,g=F.useRef(null),m=F.useRef(null),b=()=>{g.current&&(m.current=new Cc(g.current,{type:s,data:OY(a,i),options:c&&{...c},plugins:d}),Ux(t,m.current))},C=()=>{Ux(t,null),m.current&&(m.current.destroy(),m.current=null)};return F.useEffect(()=>{!r&&m.current&&c&&EY(m.current,c)},[r,c]),F.useEffect(()=>{!r&&m.current&&Gx(m.current.config.data,a.labels)},[r,a.labels]),F.useEffect(()=>{!r&&m.current&&a.datasets&&qx(m.current.config.data,a.datasets,i)},[r,a.datasets]),F.useEffect(()=>{m.current&&(r?(C(),setTimeout(b)):m.current.update(p))},[r,c,a.labels,a.datasets,p]),F.useEffect(()=>{m.current&&(C(),setTimeout(b))},[s]),F.useEffect(()=>(b(),()=>C()),[]),F.createElement("canvas",{ref:g,role:"img",height:n,width:o,...h},u)}const vd=F.forwardRef(PY);function Kx(e,t){return Cc.register(t),F.forwardRef((n,o)=>F.createElement(vd,{...n,ref:o,type:e}))}const RY=Kx("doughnut",Bi),LY=Kx("scatter",dc),fl=(e,t=0,n=1)=>up(fp(t,e),n),dp=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]=fl(e[t],0,255)):t===3&&(e[t]=fl(e[t],0,1));return e},Yx={};for(let e of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Yx[`[object ${e}]`]=e.toLowerCase();function Rt(e){return Yx[Object.prototype.toString.call(e)]||"object"}const Lt=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):Rt(e[0])=="object"&&t?t.split("").filter(n=>e[0][n]!==void 0).map(n=>e[0][n]):e[0],wd=e=>{if(e.length<2)return null;const t=e.length-1;return Rt(e[t])=="string"?e[t].toLowerCase():null},{PI:Sd,min:up,max:fp}=Math,hi=Sd*2,pp=Sd/3,IY=Sd/180,VY=180/Sd,yt={format:{},autodetect:[]};let ze=class{constructor(...t){const n=this;if(Rt(t[0])==="object"&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let o=wd(t),r=!1;if(!o){r=!0,yt.sorted||(yt.autodetect=yt.autodetect.sort((i,s)=>s.p-i.p),yt.sorted=!0);for(let i of yt.autodetect)if(o=i.test(...t),o)break}if(yt.format[o]){const i=yt.format[o].apply(null,r?t:t.slice(0,-1));n._rgb=dp(i)}else throw new Error("unknown format: "+t);n._rgb.length===3&&n._rgb.push(1)}toString(){return Rt(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const jY="2.6.0",vt=(...e)=>new vt.Color(...e);vt.Color=ze,vt.version=jY;const DY=(...e)=>{e=Lt(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:Xx}=Math,AY=(...e)=>{let[t,n,o]=Lt(e,"rgb");t=t/255,n=n/255,o=o/255;const r=1-Xx(t,Xx(n,o)),i=r<1?1/(1-r):0,s=(1-t-r)*i,a=(1-n-r)*i,c=(1-o-r)*i;return[s,a,c,r]};ze.prototype.cmyk=function(){return AY(this._rgb)},vt.cmyk=(...e)=>new ze(...e,"cmyk"),yt.format.cmyk=DY,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"cmyk"),Rt(e)==="array"&&e.length===4)return"cmyk"}});const hp=e=>Math.round(e*100)/100,HY=(...e)=>{const t=Lt(e,"hsla");let n=wd(e)||"lsa";return t[0]=hp(t[0]||0),t[1]=hp(t[1]*100)+"%",t[2]=hp(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(",")})`},Jx=(...e)=>{e=Lt(e,"rgba");let[t,n,o]=e;t/=255,n/=255,o/=255;const r=up(t,n,o),i=fp(t,n,o),s=(i+r)/2;let a,c;return i===r?(a=0,c=Number.NaN):a=s<.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,a,s,e[3]]:[c,a,s]},{round:gp}=Math,FY=(...e)=>{const t=Lt(e,"rgba");let n=wd(e)||"rgb";return n.substr(0,3)=="hsl"?HY(Jx(t),n):(t[0]=gp(t[0]),t[1]=gp(t[1]),t[2]=gp(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:mp}=Math,bp=(...e)=>{e=Lt(e,"hsl");const[t,n,o]=e;let r,i,s;if(n===0)r=i=s=o*255;else{const a=[0,0,0],c=[0,0,0],d=o<.5?o*(1+n):o+n-o*n,u=2*o-d,p=t/360;a[0]=p+1/3,a[1]=p,a[2]=p-1/3;for(let h=0;h<3;h++)a[h]<0&&(a[h]+=1),a[h]>1&&(a[h]-=1),6*a[h]<1?c[h]=u+(d-u)*6*a[h]:2*a[h]<1?c[h]=d:3*a[h]<2?c[h]=u+(d-u)*(2/3-a[h])*6:c[h]=u;[r,i,s]=[mp(c[0]*255),mp(c[1]*255),mp(c[2]*255)]}return e.length>3?[r,i,s,e[3]]:[r,i,s,1]},Qx=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,ey=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,ty=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ny=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,oy=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ry=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,{round:iy}=Math,Cp=e=>{e=e.toLowerCase().trim();let t;if(yt.format.named)try{return yt.format.named(e)}catch{}if(t=e.match(Qx)){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(ey)){const n=t.slice(1,5);for(let o=0;o<4;o++)n[o]=+n[o];return n}if(t=e.match(ty)){const n=t.slice(1,4);for(let o=0;o<3;o++)n[o]=iy(n[o]*2.55);return n[3]=1,n}if(t=e.match(ny)){const n=t.slice(1,5);for(let o=0;o<3;o++)n[o]=iy(n[o]*2.55);return n[3]=+n[3],n}if(t=e.match(oy)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const o=bp(n);return o[3]=1,o}if(t=e.match(ry)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const o=bp(n);return o[3]=+t[4],o}};Cp.test=e=>Qx.test(e)||ey.test(e)||ty.test(e)||ny.test(e)||oy.test(e)||ry.test(e),ze.prototype.css=function(e){return FY(this._rgb,e)},vt.css=(...e)=>new ze(...e,"css"),yt.format.css=Cp,yt.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&Rt(e)==="string"&&Cp.test(e))return"css"}}),yt.format.gl=(...e)=>{const t=Lt(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t},vt.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:NY}=Math,$Y=(...e)=>{e=Lt(e,"hcg");let[t,n,o]=e,r,i,s;o=o*255;const a=n*255;if(n===0)r=i=s=o;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const c=NY(t),d=t-c,u=o*(1-n),p=u+a*(1-d),h=u+a*d,g=u+a;switch(c){case 0:[r,i,s]=[g,h,u];break;case 1:[r,i,s]=[p,g,u];break;case 2:[r,i,s]=[u,g,h];break;case 3:[r,i,s]=[u,p,g];break;case 4:[r,i,s]=[h,u,g];break;case 5:[r,i,s]=[g,u,p];break}}return[r,i,s,e.length>3?e[3]:1]},BY=(...e)=>{const[t,n,o]=Lt(e,"rgb"),r=up(t,n,o),i=fp(t,n,o),s=i-r,a=s*100/255,c=r/(255-s)*100;let d;return s===0?d=Number.NaN:(t===i&&(d=(n-o)/s),n===i&&(d=2+(o-t)/s),o===i&&(d=4+(t-n)/s),d*=60,d<0&&(d+=360)),[d,a,c]};ze.prototype.hcg=function(){return BY(this._rgb)},vt.hcg=(...e)=>new ze(...e,"hcg"),yt.format.hcg=$Y,yt.autodetect.push({p:1,test:(...e)=>{if(e=Lt(e,"hcg"),Rt(e)==="array"&&e.length===3)return"hcg"}});const zY=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,ZY=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,sy=e=>{if(e.match(zY)){(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(ZY)){(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:Md}=Math,ay=(...e)=>{let[t,n,o,r]=Lt(e,"rgba"),i=wd(e)||"auto";r===void 0&&(r=1),i==="auto"&&(i=r<1?"rgba":"rgb"),t=Md(t),n=Md(n),o=Md(o);let a="000000"+(t<<16|n<<8|o).toString(16);a=a.substr(a.length-6);let c="0"+Md(r*255).toString(16);switch(c=c.substr(c.length-2),i.toLowerCase()){case"rgba":return`#${a}${c}`;case"argb":return`#${c}${a}`;default:return`#${a}`}};ze.prototype.hex=function(e){return ay(this._rgb,e)},vt.hex=(...e)=>new ze(...e,"hex"),yt.format.hex=sy,yt.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&Rt(e)==="string"&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{cos:pl}=Math,WY=(...e)=>{e=Lt(e,"hsi");let[t,n,o]=e,r,i,s;return isNaN(t)&&(t=0),isNaN(n)&&(n=0),t>360&&(t-=360),t<0&&(t+=360),t/=360,t<1/3?(s=(1-n)/3,r=(1+n*pl(hi*t)/pl(pp-hi*t))/3,i=1-(s+r)):t<2/3?(t-=1/3,r=(1-n)/3,i=(1+n*pl(hi*t)/pl(pp-hi*t))/3,s=1-(r+i)):(t-=2/3,i=(1-n)/3,s=(1+n*pl(hi*t)/pl(pp-hi*t))/3,r=1-(i+s)),r=fl(o*r*3),i=fl(o*i*3),s=fl(o*s*3),[r*255,i*255,s*255,e.length>3?e[3]:1]},{min:UY,sqrt:GY,acos:qY}=Math,KY=(...e)=>{let[t,n,o]=Lt(e,"rgb");t/=255,n/=255,o/=255;let r;const i=UY(t,n,o),s=(t+n+o)/3,a=s>0?1-i/s:0;return a===0?r=NaN:(r=(t-n+(t-o))/2,r/=GY((t-n)*(t-n)+(t-o)*(n-o)),r=qY(r),o>n&&(r=hi-r),r/=hi),[r*360,a,s]};ze.prototype.hsi=function(){return KY(this._rgb)},vt.hsi=(...e)=>new ze(...e,"hsi"),yt.format.hsi=WY,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"hsi"),Rt(e)==="array"&&e.length===3)return"hsi"}}),ze.prototype.hsl=function(){return Jx(this._rgb)},vt.hsl=(...e)=>new ze(...e,"hsl"),yt.format.hsl=bp,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"hsl"),Rt(e)==="array"&&e.length===3)return"hsl"}});const{floor:YY}=Math,XY=(...e)=>{e=Lt(e,"hsv");let[t,n,o]=e,r,i,s;if(o*=255,n===0)r=i=s=o;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const a=YY(t),c=t-a,d=o*(1-n),u=o*(1-n*c),p=o*(1-n*(1-c));switch(a){case 0:[r,i,s]=[o,p,d];break;case 1:[r,i,s]=[u,o,d];break;case 2:[r,i,s]=[d,o,p];break;case 3:[r,i,s]=[d,u,o];break;case 4:[r,i,s]=[p,d,o];break;case 5:[r,i,s]=[o,d,u];break}}return[r,i,s,e.length>3?e[3]:1]},{min:JY,max:QY}=Math,eX=(...e)=>{e=Lt(e,"rgb");let[t,n,o]=e;const r=JY(t,n,o),i=QY(t,n,o),s=i-r;let a,c,d;return d=i/255,i===0?(a=Number.NaN,c=0):(c=s/i,t===i&&(a=(n-o)/s),n===i&&(a=2+(o-t)/s),o===i&&(a=4+(t-n)/s),a*=60,a<0&&(a+=360)),[a,c,d]};ze.prototype.hsv=function(){return eX(this._rgb)},vt.hsv=(...e)=>new ze(...e,"hsv"),yt.format.hsv=XY,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"hsv"),Rt(e)==="array"&&e.length===3)return"hsv"}});const ko={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},{pow:tX}=Math,ly=(...e)=>{e=Lt(e,"lab");const[t,n,o]=e;let r,i,s,a,c,d;return i=(t+16)/116,r=isNaN(n)?i:i+n/500,s=isNaN(o)?i:i-o/200,i=ko.Yn*yp(i),r=ko.Xn*yp(r),s=ko.Zn*yp(s),a=xp(3.2404542*r-1.5371385*i-.4985314*s),c=xp(-.969266*r+1.8760108*i+.041556*s),d=xp(.0556434*r-.2040259*i+1.0572252*s),[a,c,d,e.length>3?e[3]:1]},xp=e=>255*(e<=.00304?12.92*e:1.055*tX(e,1/2.4)-.055),yp=e=>e>ko.t1?e*e*e:ko.t2*(e-ko.t0),{pow:cy}=Math,dy=(...e)=>{const[t,n,o]=Lt(e,"rgb"),[r,i,s]=nX(t,n,o),a=116*i-16;return[a<0?0:a,500*(r-i),200*(i-s)]},vp=e=>(e/=255)<=.04045?e/12.92:cy((e+.055)/1.055,2.4),wp=e=>e>ko.t3?cy(e,1/3):e/ko.t2+ko.t0,nX=(e,t,n)=>{e=vp(e),t=vp(t),n=vp(n);const o=wp((.4124564*e+.3575761*t+.1804375*n)/ko.Xn),r=wp((.2126729*e+.7151522*t+.072175*n)/ko.Yn),i=wp((.0193339*e+.119192*t+.9503041*n)/ko.Zn);return[o,r,i]};ze.prototype.lab=function(){return dy(this._rgb)},vt.lab=(...e)=>new ze(...e,"lab"),yt.format.lab=ly,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"lab"),Rt(e)==="array"&&e.length===3)return"lab"}});const{sin:oX,cos:rX}=Math,uy=(...e)=>{let[t,n,o]=Lt(e,"lch");return isNaN(o)&&(o=0),o=o*IY,[t,rX(o)*n,oX(o)*n]},fy=(...e)=>{e=Lt(e,"lch");const[t,n,o]=e,[r,i,s]=uy(t,n,o),[a,c,d]=ly(r,i,s);return[a,c,d,e.length>3?e[3]:1]},iX=(...e)=>{const t=Lt(e,"hcl").reverse();return fy(...t)},{sqrt:sX,atan2:aX,round:lX}=Math,py=(...e)=>{const[t,n,o]=Lt(e,"lab"),r=sX(n*n+o*o);let i=(aX(o,n)*VY+360)%360;return lX(r*1e4)===0&&(i=Number.NaN),[t,r,i]},hy=(...e)=>{const[t,n,o]=Lt(e,"rgb"),[r,i,s]=dy(t,n,o);return py(r,i,s)};ze.prototype.lch=function(){return hy(this._rgb)},ze.prototype.hcl=function(){return hy(this._rgb).reverse()},vt.lch=(...e)=>new ze(...e,"lch"),vt.hcl=(...e)=>new ze(...e,"hcl"),yt.format.lch=fy,yt.format.hcl=iX,["lch","hcl"].forEach(e=>yt.autodetect.push({p:2,test:(...t)=>{if(t=Lt(t,e),Rt(t)==="array"&&t.length===3)return e}}));const hl={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=ay(this._rgb,"rgb");for(let t of Object.keys(hl))if(hl[t]===e)return t.toLowerCase();return e},yt.format.named=e=>{if(e=e.toLowerCase(),hl[e])return sy(hl[e]);throw new Error("unknown color name: "+e)},yt.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&Rt(e)==="string"&&hl[e.toLowerCase()])return"named"}});const cX=e=>{if(Rt(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)},dX=(...e)=>{const[t,n,o]=Lt(e,"rgb");return(t<<16)+(n<<8)+o};ze.prototype.num=function(){return dX(this._rgb)},vt.num=(...e)=>new ze(...e,"num"),yt.format.num=cX,yt.autodetect.push({p:5,test:(...e)=>{if(e.length===1&&Rt(e[0])==="number"&&e[0]>=0&&e[0]<=16777215)return"num"}});const{round:gy}=Math;ze.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(gy)},ze.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,n)=>n<3?e===!1?t:gy(t):t)},vt.rgb=(...e)=>new ze(...e,"rgb"),yt.format.rgb=(...e)=>{const t=Lt(e,"rgba");return t[3]===void 0&&(t[3]=1),t},yt.autodetect.push({p:3,test:(...e)=>{if(e=Lt(e,"rgba"),Rt(e)==="array"&&(e.length===3||e.length===4&&Rt(e[3])=="number"&&e[3]>=0&&e[3]<=1))return"rgb"}});const{log:Td}=Math,my=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*Td(o),r=t<20?0:-254.76935184120902+.8274096064007395*(r=t-10)+115.67994401066147*Td(r)):(n=351.97690566805693+.114206453784165*(n=t-55)-40.25366309332127*Td(n),o=325.4494125711974+.07943456536662342*(o=t-50)-28.0852963507957*Td(o),r=255),[n,o,r,1]},{round:uX}=Math,fX=(...e)=>{const t=Lt(e,"rgb"),n=t[0],o=t[2];let r=1e3,i=4e4;const s=.4;let a;for(;i-r>s;){a=(i+r)*.5;const c=my(a);c[2]/c[0]>=o/n?i=a:r=a}return uX(a)};ze.prototype.temp=ze.prototype.kelvin=ze.prototype.temperature=function(){return fX(this._rgb)},vt.temp=vt.kelvin=vt.temperature=(...e)=>new ze(...e,"temp"),yt.format.temp=yt.format.kelvin=yt.format.temperature=my;const{pow:kd,sign:pX}=Math,by=(...e)=>{e=Lt(e,"lab");const[t,n,o]=e,r=kd(t+.3963377774*n+.2158037573*o,3),i=kd(t-.1055613458*n-.0638541728*o,3),s=kd(t-.0894841775*n-1.291485548*o,3);return[255*Sp(4.0767416621*r-3.3077115913*i+.2309699292*s),255*Sp(-1.2684380046*r+2.6097574011*i-.3413193965*s),255*Sp(-.0041960863*r-.7034186147*i+1.707614701*s),e.length>3?e[3]:1]};function Sp(e){const t=Math.abs(e);return t>.0031308?(pX(e)||1)*(1.055*kd(t,1/2.4)-.055):e*12.92}const{cbrt:Mp,pow:hX,sign:gX}=Math,Cy=(...e)=>{const[t,n,o]=Lt(e,"rgb"),[r,i,s]=[Tp(t/255),Tp(n/255),Tp(o/255)],a=Mp(.4122214708*r+.5363325363*i+.0514459929*s),c=Mp(.2119034982*r+.6806995451*i+.1073969566*s),d=Mp(.0883024619*r+.2817188376*i+.6299787005*s);return[.2104542553*a+.793617785*c-.0040720468*d,1.9779984951*a-2.428592205*c+.4505937099*d,.0259040371*a+.7827717662*c-.808675766*d]};function Tp(e){const t=Math.abs(e);return t<.04045?e/12.92:(gX(e)||1)*hX((t+.055)/1.055,2.4)}ze.prototype.oklab=function(){return Cy(this._rgb)},vt.oklab=(...e)=>new ze(...e,"oklab"),yt.format.oklab=by,yt.autodetect.push({p:3,test:(...e)=>{if(e=Lt(e,"oklab"),Rt(e)==="array"&&e.length===3)return"oklab"}});const mX=(...e)=>{e=Lt(e,"lch");const[t,n,o]=e,[r,i,s]=uy(t,n,o),[a,c,d]=by(r,i,s);return[a,c,d,e.length>3?e[3]:1]},bX=(...e)=>{const[t,n,o]=Lt(e,"rgb"),[r,i,s]=Cy(t,n,o);return py(r,i,s)};ze.prototype.oklch=function(){return bX(this._rgb)},vt.oklch=(...e)=>new ze(...e,"oklch"),yt.format.oklch=mX,yt.autodetect.push({p:3,test:(...e)=>{if(e=Lt(e,"oklch"),Rt(e)==="array"&&e.length===3)return"oklch"}}),ze.prototype.alpha=function(e,t=!1){return e!==void 0&&Rt(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]-=ko.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:CX}=Math,xX=1e-7,yX=20;ze.prototype.luminance=function(e,t="rgb"){if(e!==void 0&&Rt(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=yX;const r=(s,a)=>{const c=s.interpolate(a,.5,t),d=c.luminance();return Math.abs(e-d)<xX||!o--?c:d>e?r(s,c):r(c,a)},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 vX(...this._rgb.slice(0,3))};const vX=(e,t,n)=>(e=kp(e),t=kp(t),n=kp(n),.2126*e+.7152*t+.0722*n),kp=e=>(e/=255,e<=.03928?e/12.92:CX((e+.055)/1.055,2.4)),to={},Tc=(e,t,n=.5,...o)=>{let r=o[0]||"lrgb";if(!to[r]&&!o.length&&(r=Object.keys(to)[0]),!to[r])throw new Error(`interpolation mode ${r} is not defined`);return Rt(e)!=="object"&&(e=new ze(e)),Rt(t)!=="object"&&(t=new ze(t)),to[r](e,t,n).alpha(e.alpha()+n*(t.alpha()-e.alpha()))};ze.prototype.mix=ze.prototype.interpolate=function(e,t=.5,...n){return Tc(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]+=ko.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 s=o.indexOf(r)-(o.substr(0,2)==="ok"?2:0);if(s>-1){if(Rt(t)=="string")switch(t.charAt(0)){case"+":i[s]+=+t;break;case"-":i[s]+=+t;break;case"*":i[s]*=+t.substr(1);break;case"/":i[s]/=+t.substr(1);break;default:i[s]=+t}else if(Rt(t)==="number")i[s]=t;else throw new Error("unsupported value for Color.set");const a=new ze(i,o);return n?(this._rgb=a._rgb,this):a}throw new Error(`unknown channel ${r} in mode ${o}`)}else return i},ze.prototype.tint=function(e=.5,...t){return Tc(this,"white",e,...t)},ze.prototype.shade=function(e=.5,...t){return Tc(this,"black",e,...t)};const wX=(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")};to.rgb=wX;const{sqrt:Ep,pow:gl}=Math,SX=(e,t,n)=>{const[o,r,i]=e._rgb,[s,a,c]=t._rgb;return new ze(Ep(gl(o,2)*(1-n)+gl(s,2)*n),Ep(gl(r,2)*(1-n)+gl(a,2)*n),Ep(gl(i,2)*(1-n)+gl(c,2)*n),"rgb")};to.lrgb=SX;const MX=(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")};to.lab=MX;const ml=(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 s,a,c,d,u,p;(o.substr(0,1)==="h"||o==="oklch")&&([s,c,u]=r,[a,d,p]=i);let h,g,m,b;return!isNaN(s)&&!isNaN(a)?(a>s&&a-s>180?b=a-(s+360):a<s&&s-a>180?b=a+360-s:b=a-s,g=s+n*b):isNaN(s)?isNaN(a)?g=Number.NaN:(g=a,(u==1||u==0)&&o!="hsv"&&(h=d)):(g=s,(p==1||p==0)&&o!="hsv"&&(h=c)),h===void 0&&(h=c+n*(d-c)),m=u+n*(p-u),o==="oklch"?new ze([m,h,g],o):new ze([g,h,m],o)},xy=(e,t,n)=>ml(e,t,n,"lch");to.lch=xy,to.hcl=xy;const TX=(e,t,n)=>{const o=e.num(),r=t.num();return new ze(o+n*(r-o),"num")};to.num=TX;const kX=(e,t,n)=>ml(e,t,n,"hcg");to.hcg=kX;const EX=(e,t,n)=>ml(e,t,n,"hsi");to.hsi=EX;const OX=(e,t,n)=>ml(e,t,n,"hsl");to.hsl=OX;const _X=(e,t,n)=>ml(e,t,n,"hsv");to.hsv=_X;const PX=(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")};to.oklab=PX;const RX=(e,t,n)=>ml(e,t,n,"oklch");to.oklch=RX;const{pow:Op,sqrt:_p,PI:Pp,cos:yy,sin:vy,atan2:LX}=Math,IX=(e,t="lrgb",n=null)=>{const o=e.length;n||(n=Array.from(new Array(o)).map(()=>1));const r=o/n.reduce(function(p,h){return p+h});if(n.forEach((p,h)=>{n[h]*=r}),e=e.map(p=>new ze(p)),t==="lrgb")return VX(e,n);const i=e.shift(),s=i.get(t),a=[];let c=0,d=0;for(let p=0;p<s.length;p++)if(s[p]=(s[p]||0)*n[0],a.push(isNaN(s[p])?0:n[0]),t.charAt(p)==="h"&&!isNaN(s[p])){const h=s[p]/180*Pp;c+=yy(h)*n[0],d+=vy(h)*n[0]}let u=i.alpha()*n[0];e.forEach((p,h)=>{const g=p.get(t);u+=p.alpha()*n[h+1];for(let m=0;m<s.length;m++)if(!isNaN(g[m]))if(a[m]+=n[h+1],t.charAt(m)==="h"){const b=g[m]/180*Pp;c+=yy(b)*n[h+1],d+=vy(b)*n[h+1]}else s[m]+=g[m]*n[h+1]});for(let p=0;p<s.length;p++)if(t.charAt(p)==="h"){let h=LX(d/a[p],c/a[p])/Pp*180;for(;h<0;)h+=360;for(;h>=360;)h-=360;s[p]=h}else s[p]=s[p]/a[p];return u/=o,new ze(s,t).alpha(u>.99999?1:u,!0)},VX=(e,t)=>{const n=e.length,o=[0,0,0,0];for(let r=0;r<e.length;r++){const i=e[r],s=t[r]/n,a=i._rgb;o[0]+=Op(a[0],2)*s,o[1]+=Op(a[1],2)*s,o[2]+=Op(a[2],2)*s,o[3]+=a[3]*s}return o[0]=_p(o[0]),o[1]=_p(o[1]),o[2]=_p(o[2]),o[3]>.9999999&&(o[3]=1),new ze(dp(o))},{pow:jX}=Math;function Ed(e){let t="rgb",n=vt("#ccc"),o=0,r=[0,1],i=[],s=[0,0],a=!1,c=[],d=!1,u=0,p=1,h=!1,g={},m=!0,b=1;const C=function(E){if(E=E||["#fff","#000"],E&&Rt(E)==="string"&&vt.brewer&&vt.brewer[E.toLowerCase()]&&(E=vt.brewer[E.toLowerCase()]),Rt(E)==="array"){E.length===1&&(E=[E[0],E[0]]),E=E.slice(0);for(let O=0;O<E.length;O++)E[O]=vt(E[O]);i.length=0;for(let O=0;O<E.length;O++)i.push(O/(E.length-1))}return w(),c=E},x=function(E){if(a!=null){const O=a.length-1;let _=0;for(;_<O&&E>=a[_];)_++;return _-1}return 0};let v=E=>E,S=E=>E;const T=function(E,O){let _,R;if(O==null&&(O=!1),isNaN(E)||E===null)return n;O?R=E:a&&a.length>2?R=x(E)/(a.length-2):p!==u?R=(E-u)/(p-u):R=1,R=S(R),O||(R=v(R)),b!==1&&(R=jX(R,b)),R=s[0]+R*(1-s[0]-s[1]),R=fl(R,0,1);const P=Math.floor(R*1e4);if(m&&g[P])_=g[P];else{if(Rt(c)==="array")for(let L=0;L<i.length;L++){const j=i[L];if(R<=j){_=c[L];break}if(R>=j&&L===i.length-1){_=c[L];break}if(R>j&&R<i[L+1]){R=(R-j)/(i[L+1]-j),_=vt.interpolate(c[L],c[L+1],R,t);break}}else Rt(c)==="function"&&(_=c(R));m&&(g[P]=_)}return _};var w=()=>g={};C(e);const k=function(E){const O=vt(T(E));return d&&O[d]?O[d]():O};return k.classes=function(E){if(E!=null){if(Rt(E)==="array")a=E,r=[E[0],E[E.length-1]];else{const O=vt.analyze(r);E===0?a=[O.min,O.max]:a=vt.limits(O,"e",E)}return k}return a},k.domain=function(E){if(!arguments.length)return r;u=E[0],p=E[E.length-1],i=[];const O=c.length;if(E.length===O&&u!==p)for(let _ of Array.from(E))i.push((_-u)/(p-u));else{for(let _=0;_<O;_++)i.push(_/(O-1));if(E.length>2){const _=E.map((P,L)=>L/(E.length-1)),R=E.map(P=>(P-u)/(p-u));R.every((P,L)=>_[L]===P)||(S=P=>{if(P<=0||P>=1)return P;let L=0;for(;P>=R[L+1];)L++;const j=(P-R[L])/(R[L+1]-R[L]);return _[L]+j*(_[L+1]-_[L])})}}return r=[u,p],k},k.mode=function(E){return arguments.length?(t=E,w(),k):t},k.range=function(E,O){return C(E),k},k.out=function(E){return d=E,k},k.spread=function(E){return arguments.length?(o=E,k):o},k.correctLightness=function(E){return E==null&&(E=!0),h=E,w(),h?v=function(O){const _=T(0,!0).lab()[0],R=T(1,!0).lab()[0],P=_>R;let L=T(O,!0).lab()[0];const j=_+(R-_)*O;let V=L-j,I=0,N=1,B=20;for(;Math.abs(V)>.01&&B-- >0;)(function(){return P&&(V*=-1),V<0?(I=O,O+=(N-O)*.5):(N=O,O+=(I-O)*.5),L=T(O,!0).lab()[0],V=L-j})();return O}:v=O=>O,k},k.padding=function(E){return E!=null?(Rt(E)==="number"&&(E=[E,E]),s=E,k):s},k.colors=function(E,O){arguments.length<2&&(O="hex");let _=[];if(arguments.length===0)_=c.slice(0);else if(E===1)_=[k(.5)];else if(E>1){const R=r[0],P=r[1]-R;_=DX(0,E).map(L=>k(R+L/(E-1)*P))}else{e=[];let R=[];if(a&&a.length>2)for(let P=1,L=a.length,j=1<=L;j?P<L:P>L;j?P++:P--)R.push((a[P-1]+a[P])*.5);else R=r;_=R.map(P=>k(P))}return vt[O]&&(_=_.map(R=>R[O]())),_},k.cache=function(E){return E!=null?(m=E,k):m},k.gamma=function(E){return E!=null?(b=E,k):b},k.nodata=function(E){return E!=null?(n=vt(E),k):n},k}function DX(e,t,n){let o=[],r=e<t,i=t;for(let s=e;r?s<i:s>i;r?s++:s--)o.push(s);return o}const AX=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},HX=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 s=[0,1,2].map(a=>n[a]+i*(o[a]-n[a]));return new ze(s,"lab")};else if(e.length===3)[n,o,r]=e.map(i=>i.lab()),t=function(i){const s=[0,1,2].map(a=>(1-i)*(1-i)*n[a]+2*(1-i)*i*o[a]+i*i*r[a]);return new ze(s,"lab")};else if(e.length===4){let i;[n,o,r,i]=e.map(s=>s.lab()),t=function(s){const a=[0,1,2].map(c=>(1-s)*(1-s)*(1-s)*n[c]+3*(1-s)*(1-s)*s*o[c]+3*(1-s)*s*s*r[c]+s*s*s*i[c]);return new ze(a,"lab")}}else if(e.length>=5){let i,s,a;i=e.map(c=>c.lab()),a=e.length-1,s=AX(a),t=function(c){const d=1-c,u=[0,1,2].map(p=>i.reduce((h,g,m)=>h+s[m]*d**(a-m)*c**m*g[p],0));return new ze(u,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return t},FX=e=>{const t=HX(e);return t.scale=()=>Ed(t),t},br=(e,t,n)=>{if(!br[n])throw new Error("unknown blend mode "+n);return br[n](e,t)},Wi=e=>(t,n)=>{const o=vt(n).rgb(),r=vt(t).rgb();return vt.rgb(e(o,r))},Ui=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},NX=e=>e,$X=(e,t)=>e*t/255,BX=(e,t)=>e>t?t:e,zX=(e,t)=>e>t?e:t,ZX=(e,t)=>255*(1-(1-e/255)*(1-t/255)),WX=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),UX=(e,t)=>255*(1-(1-t/255)/(e/255)),GX=(e,t)=>e===255?255:(e=255*(t/255)/(1-e/255),e>255?255:e);br.normal=Wi(Ui(NX)),br.multiply=Wi(Ui($X)),br.screen=Wi(Ui(ZX)),br.overlay=Wi(Ui(WX)),br.darken=Wi(Ui(BX)),br.lighten=Wi(Ui(zX)),br.dodge=Wi(Ui(GX)),br.burn=Wi(Ui(UX));const{pow:qX,sin:KX,cos:YX}=Math;function XX(e=300,t=-1.5,n=1,o=1,r=[0,1]){let i=0,s;Rt(r)==="array"?s=r[1]-r[0]:(s=0,r=[r,r]);const a=function(c){const d=hi*((e+120)/360+t*c),u=qX(r[0]+s*c,o),h=(i!==0?n[0]+c*i:n)*u*(1-u)/2,g=YX(d),m=KX(d),b=u+h*(-.14861*g+1.78277*m),C=u+h*(-.29227*g-.90649*m),x=u+h*(1.97294*g);return vt(dp([b*255,C*255,x*255,1]))};return a.start=function(c){return c==null?e:(e=c,a)},a.rotations=function(c){return c==null?t:(t=c,a)},a.gamma=function(c){return c==null?o:(o=c,a)},a.hue=function(c){return c==null?n:(n=c,Rt(n)==="array"?(i=n[1]-n[0],i===0&&(n=n[1])):i=0,a)},a.lightness=function(c){return c==null?r:(Rt(c)==="array"?(r=c,s=c[1]-c[0]):(r=[c,c],s=0),a)},a.scale=()=>vt.scale(a),a.hue(n),a}const JX="0123456789abcdef",{floor:QX,random:eJ}=Math,tJ=()=>{let e="#";for(let t=0;t<6;t++)e+=JX.charAt(QX(eJ()*16));return new ze(e,"hex")},{log:wy,pow:nJ,floor:oJ,abs:rJ}=Math;function Sy(e,t=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return Rt(e)==="object"&&(e=Object.values(e)),e.forEach(o=>{t&&Rt(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)=>My(n,o,r),n}function My(e,t="equal",n=7){Rt(e)=="array"&&(e=Sy(e));const{min:o,max:r}=e,i=e.values.sort((a,c)=>a-c);if(n===1)return[o,r];const s=[];if(t.substr(0,1)==="c"&&(s.push(o),s.push(r)),t.substr(0,1)==="e"){s.push(o);for(let a=1;a<n;a++)s.push(o+a/n*(r-o));s.push(r)}else if(t.substr(0,1)==="l"){if(o<=0)throw new Error("Logarithmic scales are only possible for values > 0");const a=Math.LOG10E*wy(o),c=Math.LOG10E*wy(r);s.push(o);for(let d=1;d<n;d++)s.push(nJ(10,a+d/n*(c-a)));s.push(r)}else if(t.substr(0,1)==="q"){s.push(o);for(let a=1;a<n;a++){const c=(i.length-1)*a/n,d=oJ(c);if(d===c)s.push(i[d]);else{const u=c-d;s.push(i[d]*(1-u)+i[d+1]*u)}}s.push(r)}else if(t.substr(0,1)==="k"){let a;const c=i.length,d=new Array(c),u=new Array(n);let p=!0,h=0,g=null;g=[],g.push(o);for(let C=1;C<n;C++)g.push(o+C/n*(r-o));for(g.push(r);p;){for(let x=0;x<n;x++)u[x]=0;for(let x=0;x<c;x++){const v=i[x];let S=Number.MAX_VALUE,T;for(let w=0;w<n;w++){const k=rJ(g[w]-v);k<S&&(S=k,T=w),u[T]++,d[x]=T}}const C=new Array(n);for(let x=0;x<n;x++)C[x]=null;for(let x=0;x<c;x++)a=d[x],C[a]===null?C[a]=i[x]:C[a]+=i[x];for(let x=0;x<n;x++)C[x]*=1/u[x];p=!1;for(let x=0;x<n;x++)if(C[x]!==g[x]){p=!0;break}g=C,h++,h>200&&(p=!1)}const m={};for(let C=0;C<n;C++)m[C]=[];for(let C=0;C<c;C++)a=d[C],m[a].push(i[C]);let b=[];for(let C=0;C<n;C++)b.push(m[C][0]),b.push(m[C][m[C].length-1]);b=b.sort((C,x)=>C-x),s.push(b[0]);for(let C=1;C<b.length;C+=2){const x=b[C];!isNaN(x)&&s.indexOf(x)===-1&&s.push(x)}}return s}const iJ=(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:gi,pow:kn,min:sJ,max:aJ,atan2:Ty,abs:ky,cos:Od,sin:Ey,exp:lJ,PI:Oy}=Math;function cJ(e,t,n=1,o=1,r=1){var i=function(oe){return 360*oe/(2*Oy)},s=function(oe){return 2*Oy*oe/360};e=new ze(e),t=new ze(t);const[a,c,d]=Array.from(e.lab()),[u,p,h]=Array.from(t.lab()),g=(a+u)/2,m=gi(kn(c,2)+kn(d,2)),b=gi(kn(p,2)+kn(h,2)),C=(m+b)/2,x=.5*(1-gi(kn(C,7)/(kn(C,7)+kn(25,7)))),v=c*(1+x),S=p*(1+x),T=gi(kn(v,2)+kn(d,2)),w=gi(kn(S,2)+kn(h,2)),k=(T+w)/2,E=i(Ty(d,v)),O=i(Ty(h,S)),_=E>=0?E:E+360,R=O>=0?O:O+360,P=ky(_-R)>180?(_+R+360)/2:(_+R)/2,L=1-.17*Od(s(P-30))+.24*Od(s(2*P))+.32*Od(s(3*P+6))-.2*Od(s(4*P-63));let j=R-_;j=ky(j)<=180?j:R<=_?j+360:j-360,j=2*gi(T*w)*Ey(s(j)/2);const V=u-a,I=w-T,N=1+.015*kn(g-50,2)/gi(20+kn(g-50,2)),B=1+.045*k,D=1+.015*k*L,A=30*lJ(-kn((P-275)/25,2)),Z=-(2*gi(kn(k,7)/(kn(k,7)+kn(25,7))))*Ey(2*s(A)),ae=gi(kn(V/(n*N),2)+kn(I/(o*B),2)+kn(j/(r*D),2)+Z*(I/(o*B))*(j/(r*D)));return aJ(0,sJ(100,ae))}function dJ(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 s in o){const a=(o[s]||0)-(r[s]||0);i+=a*a}return Math.sqrt(i)}const uJ=(...e)=>{try{return new ze(...e),!0}catch{return!1}},fJ={cool(){return Ed([vt.hsl(180,1,.9),vt.hsl(250,.7,.4)])},hot(){return Ed(["#000","#f00","#ff0","#fff"]).mode("rgb")}},_d={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(_d))_d[e.toLowerCase()]=_d[e];Object.assign(vt,{average:IX,bezier:FX,blend:br,cubehelix:XX,mix:Tc,interpolate:Tc,random:tJ,scale:Ed,analyze:Sy,contrast:iJ,deltaE:cJ,distance:dJ,limits:My,valid:uJ,scales:fJ,input:yt,colors:hl,brewer:_d});const pJ=e=>{const t=e.theme,{values:n,palette:o,legend:r=!0,hoveredArcIndex:i,setHoveredArcIndex:s,handleChartHover:a,hoverOffset:c,...d}=e;return{...d,data:{datasets:[{data:n??[],backgroundColor:i===null||!r?o:o.map((u,p)=>p!==i?vt(u).alpha(.4).css():u),hoverBackgroundColor:o,spacing:e.spacing,hoverOffset:c}]},options:{cutout:"78%",responsive:!0,maintainAspectRatio:!0,elements:{arc:{borderWidth:0}},events:["mousemove","mouseout"],layout:{padding:0},onHover:(u,p)=>{var h,g;if(u.type!=="mousemove"||!p.length){s(null),((h=u.native)==null?void 0:h.target).style.cursor="default";return}if(((g=u.native)==null?void 0:g.target).style.cursor=p[0]?"pointer":"default",s(p[0].index),i!==null&&u.native){const b=u.native.target.getBoundingClientRect(),C=b.left+b.width/2,x=b.top+b.height/2,v=u.native instanceof MouseEvent?u.native.clientX:u.x,S=u.native instanceof MouseEvent?u.native.clientY:u.y;a(v,S,C,x)}},plugins:{datalabels:{display:!1},legend:{display:!1},tooltip:{enabled:!1}}},plugins:[{id:"doughnutBackground",style:{padding:"2px"},beforeDatasetsDraw:u=>{if(u.data.datasets.length>0&&u.data.datasets[0].data.length>0)return;const g=u.canvas.clientWidth/2,m=u.canvas.clientHeight/2,b=u.ctx,{innerRadius:C,outerRadius:x}=u.getDatasetMeta(u.data.datasets.length-1).controller,v=x-C;b.lineWidth=v+2,b.strokeStyle=t.palette.primary[50]??"rgba(0, 0, 0, 0)";const S=x-v/2;b.beginPath(),b.arc(g,m,S,0,2*Math.PI),b.stroke()}}]}},hJ=(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),gJ=(e,t)=>vt.scale(e).colors(t.length),_y=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},Py=(e,t,n,o)=>{const r=e-n,i=o-t,s=Math.atan2(i,r)*(180/Math.PI);return s>-45&&s<=45?"left":s>45&&s<=135?"bottom":s>135&&s<=180||s>=-180&&s<=-135?"right":"top"},mJ=(e,t,n,o={x:0,y:0})=>{const r=n.left+o.x+n.width/2,i=n.top+o.y+n.height/2,a=Math.min(n.width,n.height)/2*.8,c=t.reduce((C,x)=>C+x,0)||0,d={x:r,y:i-a,centerX:r,centerY:i,placement:"top"};if(c<=0||!t[e])return d;let u=-Math.PI/2;for(let C=0;C<e;C++)t[C]&&(u+=t[C]/c*(2*Math.PI));const p=t[e]/c*(2*Math.PI),h=u+p/2,g=r+Math.cos(h)*a,m=i+Math.sin(h)*a,b=Py(g,m,r,i);return{x:g,y:m,centerX:r,centerY:i,placement:b}},Rp=e=>{const{action:t,seeMore:n}=e,o=ye(),r={display:"flex",marginLeft:"auto",color:o.palette.primary[700],fontSize:".8rem",textDecoration:"none",alignItems:"center",fontWeight:o.typography.fontWeightBold,"&:hover":{textDecoration:"none"}},i=s=>{s.stopPropagation(),t()};return f.jsx(at,{onClick:i,sx:r,children:n})},bJ=e=>{const{values:t,labels:n,palette:o,legend:r,hoveredArcIndex:i,setHoveredArcIndex:s,onLegendHover:a}=e,c=ye(),d=_y(t??[]),u=(h,g)=>{g&&(a?a(h):s(h))},p=()=>{a?a(null):s(null)};return f.jsx(ve,{width:"100%",alignItems:"left",className:"doughnut-chart-legend-wrapper",children:f.jsx(ve,{display:"inline-flex",justifyContent:"center",children:n.map((h,g)=>{const m=t!==void 0&&g<((t==null?void 0:t.length)??0)&&t[g]!==void 0;return f.jsx(ve,{sx:{borderBottom:"1px solid #e3e2e0","&:last-of-type":{borderBottom:"none"},padding:c.spacing(.5,0)},children:f.jsxs(ve,{direction:"row",alignItems:"center",justifyContent:"center",gap:"12px",paddingY:"8px",onMouseEnter:()=>u(g,m),onMouseLeave:()=>p(),sx:{"&:hover":{background:c.custom.grey[500]},backgroundColor:i!==g?"unset":c.custom.grey[500],padding:c.spacing(.5,.5)},className:"doughnut-chart-legend-item",children:[f.jsx(Q,{minWidth:"10px",height:"10px",bgcolor:m?o[g]:c.custom.grey[400]}),f.jsxs(ve,{direction:"row",alignItems:"center",gap:"8px",sx:{width:"100%"},children:[f.jsxs(ve,{width:"100%",display:"flex",direction:"row",alignItems:"center",justifyContent:"space-between",gap:"8px",fontWeight:400,className:"doughnut-chart-legend-item-value",children:[f.jsx(ie,{variant:"h5",className:"doughnut-chart-legend-item-label",children:h}),f.jsx(Q,{alignItems:"center",sx:{display:"flex",borderRadius:c.spacing(.75),background:c.custom.grey[400],padding:c.spacing(.25,1.25),minWidth:c.spacing(6),justifyContent:"center",fontWeight:c.typography.fontWeightMedium,fontSize:c.typography["body-medium"],whiteSpace:"nowrap"},children:m?`${d[g]} %`:"--%"})]}),(r==null?void 0:r.actions)&&(r==null?void 0:r.seeMore)&&(r==null?void 0:r.actions[g])&&f.jsx(Rp,{action:r==null?void 0:r.actions[g],seeMore:r==null?void 0:r.seeMore})]})]})},g)})})})},Ry=e=>{const{index:t,palette:n,icons:o,values:r}=e;return o&&o[t]!==void 0?f.jsx(Q,{minWidth:"28px",width:"28px",height:"28px",sx:i=>({background:n[t]||i.custom.grey[400],padding:"16px 5px",color:"#fff"}),display:"flex",alignItems:"center",borderRadius:"6px",children:o[t]}):r[t]!==void 0&&n[t]!==void 0?f.jsx(Q,{minWidth:"12px",width:"12px",height:"12px",sx:{background:n[t],color:"#fff"},display:"flex",alignItems:"center"}):null},CJ=e=>{const t=ye(),{values:n,labels:o,palette:r,icons:i=[],legend:s,setHoveredArcIndex:a,hoveredArcIndex:c,onLegendHover:d}=e,u=_y(n??[]),p=(g,m)=>{m&&(d?d(g):a(g))},h=()=>{d?d(null):a(null)};return f.jsx(ve,{alignItems:"center",justifyContent:"center",sx:{width:"100%",alignItems:"flex-start"},className:"doughnut-chart-legend-wrapper",children:f.jsx(ve,{width:"100%",children:o.map((g,m)=>{const b=!!n&&n[m]!==void 0,C=(s==null?void 0:s.actions)&&(s==null?void 0:s.seeMore)&&(s==null?void 0:s.actions[m])&&s;return f.jsx(ve,{direction:"row",alignItems:"center",gap:"12px",onMouseEnter:()=>p(m,b),onMouseLeave:()=>h(),onClick:()=>{var x,v;C&&(x=s==null?void 0:s.actions)!=null&&x[m]&&((v=s==null?void 0:s.actions)==null||v[m]())},sx:{borderBottom:"1px solid #e3e2e0","&:last-of-type":{borderBottom:"none"}},children:f.jsxs(ve,{direction:"row",gap:"8px",sx:{width:"100%",padding:".4rem",alignItems:"center",backgroundColor:c!==m?"unset":t.custom.grey[500]},className:"doughnut-chart-legend-item",children:[f.jsx(Ry,{index:m,palette:r,icons:i,values:n}),f.jsx(ie,{variant:"h5",sx:{marginLeft:"4px"},className:"doughnut-chart-legend-item-label",children:g}),g?"- ":"",f.jsx(ie,{fontWeight:400,sx:{fontSize:".8rem",display:"flex",flexDirection:"row",whiteSpace:"pre",alignItems:"center"},className:"doughnut-chart-legend-item-value",children:f.jsx(Q,{component:"span",alignItems:"center",sx:{display:"flex",borderRadius:t.spacing(.75),background:t.custom.grey[400],padding:t.spacing(.25,1.25),minWidth:t.spacing(6),justifyContent:"center",fontWeight:t.typography.fontWeightMedium,fontSize:t.typography["body-medium"],whiteSpace:"nowrap"},children:b?`${u[m]} %`:"--%"})}),C&&f.jsx(Rp,{action:s.actions[m],seeMore:s.seeMore})]})},m)})})})},xJ=e=>{const{values:t,labels:n,palette:o,legend:r,hoveredArcIndex:i,setHoveredArcIndex:s,icons:a=[],onLegendHover:c}=e,d=JSON.stringify(n);return F.useEffect(()=>{s(null)},[d,s]),!n||!n.length?null:(r==null?void 0:r.position)==="bottom"?f.jsx(bJ,{labels:n,hoveredArcIndex:i,setHoveredArcIndex:s,values:t,palette:o,legend:r,onLegendHover:c}):(r==null?void 0:r.position)==="right"?f.jsx(CJ,{labels:n,setHoveredArcIndex:s,hoveredArcIndex:i,values:t,palette:o,legend:r,icons:a,onLegendHover:c}):null};Cc.register(zs);const yJ=e=>{const{values:t,labels:n,colors:o,legend:r,children:i,valuesUnit:s,className:a,valuesFormatterFn:c,createPalette:d=!0,isLoading:u=!1,displayTotal:p=!0,fullWidthLegend:h=!1,displayTotalVariant:g="number-big",spacing:m=0,hoverOffset:b=0}=e,[C,x]=F.useState(null),[v,S]=F.useState(!1),[T,w]=F.useState(),[k,E]=F.useState(null),[O,_]=F.useState(null),[R,P]=F.useState("top"),[L,j]=F.useState(!1),V=F.useRef(null),I=F.useRef({x:null,y:null}),N=F.useRef(null),B=F.useCallback((q,J,re,G)=>{if(q!==null&&J!==null){if(I.current={x:q,y:J},V.current&&(clearTimeout(V.current),V.current=null),re!==void 0&&G!==void 0){const U=Py(q,J,re,G);P(U)}E(q),_(J)}else V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{E(null),_(null),V.current=null},50)},[]),D=F.useCallback(q=>{if(x(q),q!==null&&N.current&&t&&t.length>0){j(!0);const J=N.current.getBoundingClientRect(),re=mJ(q,t,J,{x:0,y:0});re.x&&re.y&&(I.current={x:re.x,y:re.y},E(re.x),_(re.y),P(re.placement))}else j(!1)},[t,x]);F.useEffect(()=>()=>{V.current&&clearTimeout(V.current)},[]),F.useEffect(()=>{if(!n||!t)return;const q=k!==null&&O!==null&&C!==null;q!==v&&S(q)},[n,t,k,O,C,v]);const A=ye(),$=hJ(A,100,700),Z=(r==null?void 0:r.position)??"bottom",ae=d?gJ(o&&o.length?o:$,t??[]):o??$,oe=pJ({values:t,labels:n,spacing:m,hoverOffset:b,legend:!!r,theme:A,palette:ae,hoveredArcIndex:C,setHoveredArcIndex:x,handleChartHover:B}),W=(q,J=35)=>q.length<=J?q:q.substring(0,J-3)+"...";F.useEffect(()=>{C!==null&&n&&n[C]!==void 0&&t&&t[C]!==void 0?(w(f.jsxs(ve,{direction:"column",spacing:1,children:[f.jsxs(ve,{direction:"row",alignItems:"center",spacing:1,children:[f.jsx(Ry,{index:C,palette:ae,icons:e.icons,values:t}),f.jsx(ie,{fontWeight:700,fontSize:"0.75rem",children:r!==void 0?W(n[C]):n[C]})]}),f.jsxs(ie,{fontWeight:700,sx:{fontSize:"1.5rem",lineHeight:A.spacing(1.5),pt:A.spacing(1)},children:[c?c(t[C]):t[C],s&&f.jsx(ie,{component:"span",fontWeight:500,fontSize:"0.75rem",color:ke[1400],sx:{wordBreak:"break-word",whiteSpace:"break-spaces",marginLeft:"4px"},children:s})]})]})),S(!0)):(w(null),S(!1))},[C]);const Y=p&&(t==null?void 0:t.reduce((q,J)=>q+J,0)),K=i??(p&&typeof p=="string"?p:Y);return f.jsxs(ve,{direction:Z==="bottom"?"column":"row",gap:"3rem",className:`doughnut-chart ${a}`,children:[f.jsx(ve,{children:f.jsx(Q,{position:"relative",margin:"28px auto",sx:Z==="bottom"?{maxWidth:"300px"}:{minWidth:"300px"},className:"doughnut-chart-wrapper",id:"doughnut-chart-wrapper",ref:N,children:f.jsxs(Q,{position:"relative",children:[f.jsx(RY,{...oe,style:{maxWidth:"100%"}}),v&&T&&f.jsx(Q,{sx:{position:"absolute",pointerEvents:"none",left:0,top:0,width:0,height:0,overflow:"visible",zIndex:1e3},children:f.jsx("div",{style:{position:"fixed",left:k?`${k}px`:0,top:O?`${O}px`:0,pointerEvents:"none"},children:f.jsx(ji,{open:v,align:"start",title:T,width:"220px",padding:A.spacing(2),arrow:!0,placement:R,PopperProps:{disablePortal:!0,modifiers:[{name:"preventOverflow",enabled:!0,options:{boundary:document.body}},{name:"offset",options:{offset:L?[8,0]:[0,14]}}]},children:f.jsx("div",{})})})}),f.jsx(Q,{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:f.jsx(Q,{display:"flex",flexDirection:"column",children:u?f.jsx(Ps,{}):f.jsxs(f.Fragment,{children:[f.jsx(ie,{variant:g,children:K},"content-1"),s?p&&f.jsx(Q,{sx:{color:ke[1400]},children:s}):f.jsx(f.Fragment,{})]})})})]})})}),f.jsx(Q,{display:"flex",width:h?"100%":"inherit",onMouseEnter:()=>S(!1),sx:{width:h?"100%":"inherit"},children:f.jsx(xJ,{labels:n,hoveredArcIndex:C,setHoveredArcIndex:x,values:t,palette:ae,legend:r,icons:e.icons,onLegendHover:D})})]})};/*!
368
+ `):e}function qK(e,t){const{element:n,datasetIndex:o,index:r}=t,i=e.getDatasetMeta(o).controller,{label:s,value:a}=i.getLabelAndValue(r);return{chart:e,label:s,parsed:i.getParsed(r),raw:e.data.datasets[o].data[r],formattedValue:a,dataset:i.getDataset(),dataIndex:r,datasetIndex:o,element:n}}function Ox(e,t){const n=e.chart.ctx,{body:o,footer:r,title:i}=e,{boxWidth:s,boxHeight:a}=t,c=Tn(t.bodyFont),d=Tn(t.titleFont),u=Tn(t.footerFont),p=i.length,h=r.length,g=o.length,m=Un(t.padding);let b=m.height,C=0,x=o.reduce((T,w)=>T+w.before.length+w.lines.length+w.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,p&&(b+=p*d.lineHeight+(p-1)*t.titleSpacing+t.titleMarginBottom),x){const T=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;b+=g*T+(x-g)*c.lineHeight+(x-1)*t.bodySpacing}h&&(b+=t.footerMarginTop+h*u.lineHeight+(h-1)*t.footerSpacing);let v=0;const S=function(T){C=Math.max(C,n.measureText(T).width+v)};return n.save(),n.font=d.string,qt(e.title,S),n.font=c.string,qt(e.beforeBody.concat(e.afterBody),S),v=t.displayColors?s+2+t.boxPadding:0,qt(o,T=>{qt(T.before,S),qt(T.lines,S),qt(T.after,S)}),v=0,n.font=u.string,qt(e.footer,S),n.restore(),C+=m.width,{width:C,height:b}}function KK(e,t){const{y:n,height:o}=t;return n<o/2?"top":n>e.height-o/2?"bottom":"center"}function YK(e,t,n,o){const{x:r,width:i}=o,s=n.caretSize+n.caretPadding;if(e==="left"&&r+i+s>t.width||e==="right"&&r-i-s<0)return!0}function XK(e,t,n,o){const{x:r,width:i}=n,{width:s,chartArea:{left:a,right:c}}=e;let d="center";return o==="center"?d=r<=(a+c)/2?"left":"right":r<=i/2?d="left":r>=s-i/2&&(d="right"),YK(d,e,t,n)&&(d="center"),d}function _x(e,t,n){const o=n.yAlign||t.yAlign||KK(e,n);return{xAlign:n.xAlign||t.xAlign||XK(e,t,n,o),yAlign:o}}function JK(e,t){let{x:n,width:o}=e;return t==="right"?n-=o:t==="center"&&(n-=o/2),n}function QK(e,t,n){let{y:o,height:r}=e;return t==="top"?o+=n:t==="bottom"?o-=r+n:o-=r/2,o}function Px(e,t,n,o){const{caretSize:r,caretPadding:i,cornerRadius:s}=e,{xAlign:a,yAlign:c}=n,d=r+i,{topLeft:u,topRight:p,bottomLeft:h,bottomRight:g}=As(s);let m=JK(t,a);const b=QK(t,c,d);return c==="center"?a==="left"?m+=d:a==="right"&&(m-=d):a==="left"?m-=Math.max(u,h)+r:a==="right"&&(m+=Math.max(p,g)+r),{x:Vn(m,0,o.width-t.width),y:Vn(b,0,o.height-t.height)}}function bd(e,t,n){const o=Un(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-o.right:e.x+o.left}function Rx(e){return zr([],pi(e))}function eY(e,t,n){return $i(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Lx(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Ix={beforeTitle:ai,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:ai,beforeBody:ai,beforeLabel:ai,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 Pt(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:ai,afterBody:ai,beforeFooter:ai,footer:ai,afterFooter:ai};function Mo(e,t,n,o){const r=e[t].call(n,o);return typeof r>"u"?Ix[t].call(n,o):r}class rp extends fi{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 SC(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=eY(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:o}=n,r=Mo(o,"beforeTitle",this,t),i=Mo(o,"title",this,t),s=Mo(o,"afterTitle",this,t);let a=[];return a=zr(a,pi(r)),a=zr(a,pi(i)),a=zr(a,pi(s)),a}getBeforeBody(t,n){return Rx(Mo(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:o}=n,r=[];return qt(t,i=>{const s={before:[],lines:[],after:[]},a=Lx(o,i);zr(s.before,pi(Mo(a,"beforeLabel",this,i))),zr(s.lines,Mo(a,"label",this,i)),zr(s.after,pi(Mo(a,"afterLabel",this,i))),r.push(s)}),r}getAfterBody(t,n){return Rx(Mo(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:o}=n,r=Mo(o,"beforeFooter",this,t),i=Mo(o,"footer",this,t),s=Mo(o,"afterFooter",this,t);let a=[];return a=zr(a,pi(r)),a=zr(a,pi(i)),a=zr(a,pi(s)),a}_createItems(t){const n=this._active,o=this.chart.data,r=[],i=[],s=[];let a=[],c,d;for(c=0,d=n.length;c<d;++c)a.push(qK(this.chart,n[c]));return t.filter&&(a=a.filter((u,p,h)=>t.filter(u,p,h,o))),t.itemSort&&(a=a.sort((u,p)=>t.itemSort(u,p,o))),qt(a,u=>{const p=Lx(t.callbacks,u);r.push(Mo(p,"labelColor",this,u)),i.push(Mo(p,"labelPointStyle",this,u)),s.push(Mo(p,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=i,this.labelTextColors=s,this.dataPoints=a,a}update(t,n){const o=this.options.setContext(this.getContext()),r=this._active;let i,s=[];if(!r.length)this.opacity!==0&&(i={opacity:0});else{const a=vc[o.position].call(this,r,this._eventPosition);s=this._createItems(o),this.title=this.getTitle(s,o),this.beforeBody=this.getBeforeBody(s,o),this.body=this.getBody(s,o),this.afterBody=this.getAfterBody(s,o),this.footer=this.getFooter(s,o);const c=this._size=Ox(this,o),d=Object.assign({},a,c),u=_x(this.chart,o,d),p=Px(o,d,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:p.x,y:p.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=s,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:s,cornerRadius:a}=o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:p}=As(a),{x:h,y:g}=t,{width:m,height:b}=n;let C,x,v,S,T,w;return i==="center"?(T=g+b/2,r==="left"?(C=h,x=C-s,S=T+s,w=T-s):(C=h+m,x=C+s,S=T-s,w=T+s),v=C):(r==="left"?x=h+Math.max(c,u)+s:r==="right"?x=h+m-Math.max(d,p)-s:x=this.caretX,i==="top"?(S=g,T=S-s,C=x-s,v=x+s):(S=g+b,T=S+s,C=x+s,v=x-s),w=S),{x1:C,x2:x,x3:v,y1:S,y2:T,y3:w}}drawTitle(t,n,o){const r=this.title,i=r.length;let s,a,c;if(i){const d=dl(o.rtl,this.x,this.width);for(t.x=bd(this,o.titleAlign,o),n.textAlign=d.textAlign(o.titleAlign),n.textBaseline="middle",s=Tn(o.titleFont),a=o.titleSpacing,n.fillStyle=o.titleColor,n.font=s.string,c=0;c<i;++c)n.fillText(r[c],d.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+a,c+1===i&&(t.y+=o.titleMarginBottom-a)}}_drawColorBox(t,n,o,r,i){const s=this.labelColors[o],a=this.labelPointStyles[o],{boxHeight:c,boxWidth:d}=i,u=Tn(i.bodyFont),p=bd(this,"left",i),h=r.x(p),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:a.pointStyle,rotation:a.rotation,borderWidth:1},C=r.leftForLtr(h,d)+d/2,x=m+c/2;t.strokeStyle=i.multiKeyBackground,t.fillStyle=i.multiKeyBackground,L6(t,b,C,x),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,L6(t,b,C,x)}else{t.lineWidth=It(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const b=r.leftForLtr(h,d),C=r.leftForLtr(r.xPlus(h,1),d-2),x=As(s.borderRadius);Object.values(x).some(v=>v!==0)?(t.beginPath(),t.fillStyle=i.multiKeyBackground,ac(t,{x:b,y:m,w:d,h:c,radius:x}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),ac(t,{x:C,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=s.backgroundColor,t.fillRect(C,m+1,d-2,c-2))}t.fillStyle=this.labelTextColors[o]}drawBody(t,n,o){const{body:r}=this,{bodySpacing:i,bodyAlign:s,displayColors:a,boxHeight:c,boxWidth:d,boxPadding:u}=o,p=Tn(o.bodyFont);let h=p.lineHeight,g=0;const m=dl(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},C=m.textAlign(s);let x,v,S,T,w,k,E;for(n.textAlign=s,n.textBaseline="middle",n.font=p.string,t.x=bd(this,C,o),n.fillStyle=o.bodyColor,qt(this.beforeBody,b),g=a&&C!=="right"?s==="center"?d/2+u:d+2+u:0,T=0,k=r.length;T<k;++T){for(x=r[T],v=this.labelTextColors[T],n.fillStyle=v,qt(x.before,b),S=x.lines,a&&S.length&&(this._drawColorBox(n,t,T,m,o),h=Math.max(p.lineHeight,c)),w=0,E=S.length;w<E;++w)b(S[w]),h=p.lineHeight;qt(x.after,b)}g=0,h=p.lineHeight,qt(this.afterBody,b),t.y-=i}drawFooter(t,n,o){const r=this.footer,i=r.length;let s,a;if(i){const c=dl(o.rtl,this.x,this.width);for(t.x=bd(this,o.footerAlign,o),t.y+=o.footerMarginTop,n.textAlign=c.textAlign(o.footerAlign),n.textBaseline="middle",s=Tn(o.footerFont),n.fillStyle=o.footerColor,n.font=s.string,a=0;a<i;++a)n.fillText(r[a],c.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+o.footerSpacing}}drawBackground(t,n,o,r){const{xAlign:i,yAlign:s}=this,{x:a,y:c}=t,{width:d,height:u}=o,{topLeft:p,topRight:h,bottomLeft:g,bottomRight:m}=As(r.cornerRadius);n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,n.lineWidth=r.borderWidth,n.beginPath(),n.moveTo(a+p,c),s==="top"&&this.drawCaret(t,n,o,r),n.lineTo(a+d-h,c),n.quadraticCurveTo(a+d,c,a+d,c+h),s==="center"&&i==="right"&&this.drawCaret(t,n,o,r),n.lineTo(a+d,c+u-m),n.quadraticCurveTo(a+d,c+u,a+d-m,c+u),s==="bottom"&&this.drawCaret(t,n,o,r),n.lineTo(a+g,c+u),n.quadraticCurveTo(a,c+u,a,c+u-g),s==="center"&&i==="left"&&this.drawCaret(t,n,o,r),n.lineTo(a,c+p),n.quadraticCurveTo(a,c,a+p,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 s=vc[t.position].call(this,this._active,this._eventPosition);if(!s)return;const a=this._size=Ox(this,t),c=Object.assign({},s,this._size),d=_x(n,t,c),u=Px(t,c,d,n);(r._to!==u.x||i._to!==u.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=a.width,this.height=a.height,this.caretX=s.x,this.caretY=s.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 s=Un(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=o,this.drawBackground(i,t,r,n),hC(t,n.textDirection),i.y+=s.top,this.drawTitle(i,t,n),this.drawBody(i,t,n),this.drawFooter(i,t,n),gC(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const o=this._active,r=t.map(({datasetIndex:a,index:c})=>{const d=this.chart.getDatasetMeta(a);if(!d)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:d.data[c],index:c}}),i=!W1(o,r),s=this._positionChanged(r,n);(i||s)&&(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||[],s=this._getActiveElements(t,i,n,o),a=this._positionChanged(s,t),c=n||!W1(s,i)||a;return c&&(this._active=s,(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(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const s=this.chart.getElementsAtEventForMode(t,i.mode,i,o);return i.reverse&&s.reverse(),s}_positionChanged(t,n){const{caretX:o,caretY:r,options:i}=this,s=vc[i.position].call(this,t,n);return s!==!1&&(o!==s.x||r!==s.y)}}Ge(rp,"positioners",vc);var tY={id:"tooltip",_element:rp,positioners:vc,afterInit(e,t,n){n&&(e.tooltip=new rp({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:Ix},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"]},nY=Object.freeze({__proto__:null,Colors:hK,Decimation:CK,Filler:HK,Legend:ZK,SubTitle:GK,Title:UK,Tooltip:tY});const oY=(e,t,n,o)=>(typeof t=="string"?(n=e.push(t)-1,o.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function rY(e,t,n,o){const r=e.indexOf(t);if(r===-1)return oY(e,t,n,o);const i=e.lastIndexOf(t);return r!==i?n:r}const iY=(e,t)=>e===null?null:Vn(Math.round(e),0,t);function Vx(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class ip extends Bs{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(Pt(t))return null;const o=this.getLabels();return n=isFinite(n)&&o[n]===t?n:rY(o,t,xt(n,t),this._addedLabels),iY(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 s=t;s<=n;s++)r.push({value:s});return r}getLabelForValue(t){return Vx.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}}Ge(ip,"id","category"),Ge(ip,"defaults",{ticks:{callback:Vx}});function sY(e,t){const n=[],{bounds:r,step:i,min:s,max:a,precision:c,count:d,maxTicks:u,maxDigits:p,includeBounds:h}=e,g=i||1,m=u-1,{min:b,max:C}=t,x=!Pt(s),v=!Pt(a),S=!Pt(d),T=(C-b)/(p+1);let w=Fb((C-b)/m/g)*g,k,E,O,_;if(w<1e-14&&!x&&!v)return[{value:b},{value:C}];_=Math.ceil(C/w)-Math.floor(b/w),_>m&&(w=Fb(_*w/m/g)*g),Pt(c)||(k=Math.pow(10,c),w=Math.ceil(w*k)/k),r==="ticks"?(E=Math.floor(b/w)*w,O=Math.ceil(C/w)*w):(E=b,O=C),x&&v&&i&&QW((a-s)/i,w/1e3)?(_=Math.round(Math.min((a-s)/w,u)),w=(a-s)/_,E=s,O=a):S?(E=x?s:E,O=v?a:O,_=d-1,w=(O-E)/_):(_=(O-E)/w,nc(_,Math.round(_),w/1e3)?_=Math.round(_):_=Math.ceil(_));const R=Math.max($b(w),$b(E));k=Math.pow(10,Pt(c)?R:c),E=Math.round(E*k)/k,O=Math.round(O*k)/k;let P=0;for(x&&(h&&E!==s?(n.push({value:s}),E<s&&P++,nc(Math.round((E+P*w)*k)/k,s,jx(s,T,e))&&P++):E<s&&P++);P<_;++P){const L=Math.round((E+P*w)*k)/k;if(v&&L>a)break;n.push({value:L})}return v&&h&&O!==a?n.length&&nc(n[n.length-1].value,a,jx(a,T,e))?n[n.length-1].value=a:n.push({value:a}):(!v||O===a)&&n.push({value:O}),n}function jx(e,t,{horizontal:n,minRotation:o}){const r=gr(o),i=(n?Math.sin(r):Math.cos(r))||.001,s=.75*t*(""+e).length;return Math.min(t/i,s)}class Cd extends Bs{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 Pt(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 s=c=>r=n?r:c,a=c=>i=o?i:c;if(t){const c=$r(r),d=$r(i);c<0&&d<0?a(0):c>0&&d>0&&s(0)}if(r===i){let c=i===0?1:Math.abs(i*.05);a(i+c),t||s(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,s=sY(r,i);return t.bounds==="ticks"&&Nb(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let 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 ic(t,this.chart.options.locale,this.options.ticks.format)}}class sp extends Cd{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Cn(t)?t:0,this.max=Cn(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,o=gr(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}}Ge(sp,"id","linear"),Ge(sp,"defaults",{ticks:{callback:K1.formatters.numeric}});const wc=e=>Math.floor(Ni(e)),Zs=(e,t)=>Math.pow(10,wc(e)+t);function Dx(e){return e/Math.pow(10,wc(e))===1}function Ax(e,t,n){const o=Math.pow(10,n),r=Math.floor(e/o);return Math.ceil(t/o)-r}function aY(e,t){const n=t-e;let o=wc(n);for(;Ax(e,t,o)>10;)o++;for(;Ax(e,t,o)<10;)o--;return Math.min(o,wc(e))}function lY(e,{min:t,max:n}){t=Fo(e.min,t);const o=[],r=wc(t);let i=aY(t,n),s=i<0?Math.pow(10,Math.abs(i)):1;const a=Math.pow(10,i),c=r>i?Math.pow(10,r):0,d=Math.round((t-c)*s)/s,u=Math.floor((t-c)/a/10)*a*10;let p=Math.floor((d-u)/Math.pow(10,i)),h=Fo(e.min,Math.round((c+u+p*Math.pow(10,i))*s)/s);for(;h<n;)o.push({value:h,major:Dx(h),significand:p}),p>=10?p=p<15?15:20:p++,p>=20&&(i++,p=2,s=i>=0?1:s),h=Math.round((c+u+p*Math.pow(10,i))*s)/s;const g=Fo(e.max,h);return o.push({value:g,major:Dx(g),significand:p}),o}class ap extends Bs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const o=Cd.prototype.parse.apply(this,[t,n]);if(o===0){this._zero=!0;return}return Cn(o)&&o>0?o:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Cn(t)?Math.max(0,t):null,this.max=Cn(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Cn(this._userMin)&&(this.min=t===Zs(this.min,0)?Zs(this.min,-1):Zs(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let o=this.min,r=this.max;const i=a=>o=t?o:a,s=a=>r=n?r:a;o===r&&(o<=0?(i(1),s(10)):(i(Zs(o,-1)),s(Zs(r,1)))),o<=0&&i(Zs(r,-1)),r<=0&&s(Zs(o,1)),this.min=o,this.max=r}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},o=lY(n,this);return t.bounds==="ticks"&&Nb(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":ic(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Ni(t),this._valueRange=Ni(this.max)-Ni(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Ni(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}Ge(ap,"id","logarithmic"),Ge(ap,"defaults",{ticks:{callback:K1.formatters.logarithmic,major:{enabled:!0}}});function lp(e){const t=e.ticks;if(t.display&&e.display){const n=Un(t.backdropPadding);return xt(t.font&&t.font.size,cn.font.size)+n.height}return 0}function cY(e,t,n){return n=sn(n)?n:[n],{w:mU(e,t.string,n),h:n.length*t.lineHeight}}function Hx(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 dY(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,s=e.options.pointLabels,a=s.centerPointLabels?an/i:0;for(let c=0;c<i;c++){const d=s.setContext(e.getPointLabelContext(c));r[c]=d.padding;const u=e.getPointPosition(c,e.drawingArea+r[c],a),p=Tn(d.font),h=cY(e.ctx,p,e._pointLabels[c]);o[c]=h;const g=No(e.getIndexAngle(c)+a),m=Math.round(M6(g)),b=Hx(m,u.x,h.w,0,180),C=Hx(m,u.y,h.h,90,270);uY(n,t,g,b,C)}e.setCenterPoint(t.l-n.l,n.r-t.r,t.t-n.t,n.b-t.b),e._pointLabelItems=hY(e,o,r)}function uY(e,t,n,o,r){const i=Math.abs(Math.sin(n)),s=Math.abs(Math.cos(n));let a=0,c=0;o.start<t.l?(a=(t.l-o.start)/i,e.l=Math.min(e.l,t.l-a)):o.end>t.r&&(a=(o.end-t.r)/i,e.r=Math.max(e.r,t.r+a)),r.start<t.t?(c=(t.t-r.start)/s,e.t=Math.min(e.t,t.t-c)):r.end>t.b&&(c=(r.end-t.b)/s,e.b=Math.max(e.b,t.b+c))}function fY(e,t,n){const o=e.drawingArea,{extra:r,additionalAngle:i,padding:s,size:a}=n,c=e.getPointPosition(t,o+r+s,i),d=Math.round(M6(No(c.angle+Sn))),u=bY(c.y,a.h,d),p=gY(d),h=mY(c.x,a.w,p);return{visible:!0,x:c.x,y:u,textAlign:p,left:h,top:u,right:h+a.w,bottom:u+a.h}}function pY(e,t){if(!t)return!0;const{left:n,top:o,right:r,bottom:i}=e;return!(di({x:n,y:o},t)||di({x:n,y:i},t)||di({x:r,y:o},t)||di({x:r,y:i},t))}function hY(e,t,n){const o=[],r=e._pointLabels.length,i=e.options,{centerPointLabels:s,display:a}=i.pointLabels,c={extra:lp(i)/2,additionalAngle:s?an/r:0};let d;for(let u=0;u<r;u++){c.padding=n[u],c.size=t[u];const p=fY(e,u,c);o.push(p),a==="auto"&&(p.visible=pY(p,d),p.visible&&(d=p))}return o}function gY(e){return e===0||e===180?"center":e<180?"left":"right"}function mY(e,t,n){return n==="right"?e-=t:n==="center"&&(e-=t/2),e}function bY(e,t,n){return n===90||n===270?e-=t/2:(n>270||n<90)&&(e-=t),e}function CY(e,t,n){const{left:o,top:r,right:i,bottom:s}=n,{backdropColor:a}=t;if(!Pt(a)){const c=As(t.borderRadius),d=Un(t.backdropPadding);e.fillStyle=a;const u=o-d.left,p=r-d.top,h=i-o+d.width,g=s-r+d.height;Object.values(c).some(m=>m!==0)?(e.beginPath(),ac(e,{x:u,y:p,w:h,h:g,radius:c}),e.fill()):e.fillRect(u,p,h,g)}}function xY(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 s=o.setContext(e.getPointLabelContext(r));CY(n,s,i);const a=Tn(s.font),{x:c,y:d,textAlign:u}=i;Ds(n,e._pointLabels[r],c,d+a.lineHeight/2,a,{color:s.color,textAlign:u,textBaseline:"middle"})}}function Fx(e,t,n,o){const{ctx:r}=e;if(n)r.arc(e.xCenter,e.yCenter,t,0,ln);else{let i=e.getPointPosition(0,t);r.moveTo(i.x,i.y);for(let s=1;s<o;s++)i=e.getPointPosition(s,t),r.lineTo(i.x,i.y)}}function yY(e,t,n,o,r){const i=e.ctx,s=t.circular,{color:a,lineWidth:c}=t;!s&&!o||!a||!c||n<0||(i.save(),i.strokeStyle=a,i.lineWidth=c,i.setLineDash(r.dash||[]),i.lineDashOffset=r.dashOffset,i.beginPath(),Fx(e,n,s,o),i.closePath(),i.stroke(),i.restore())}function vY(e,t,n){return $i(e,{label:n,index:t,type:"pointLabel"})}class Sc extends Cd{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=Un(lp(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=Cn(t)&&!isNaN(t)?t:0,this.max=Cn(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/lp(this.options))}generateTickLabels(t){Cd.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((n,o)=>{const r=en(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?dY(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=ln/(this._pointLabels.length||1),o=this.options.startAngle||0;return No(t*n+gr(o))}getDistanceFromCenterForValue(t){if(Pt(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(Pt(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 vY(this.getContext(),t,o)}}getPointPosition(t,n,o=0){const r=this.getIndexAngle(t)-Sn+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(),Fx(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,s=this._pointLabels.length;let a,c,d;if(n.pointLabels.display&&xY(this,s),r.display&&this.ticks.forEach((u,p)=>{if(p!==0||p===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(p),g=r.setContext(h),m=i.setContext(h);yY(this,g,c,s,m)}}),o.display){for(t.save(),a=s-1;a>=0;a--){const u=o.setContext(this.getPointLabelContext(a)),{color:p,lineWidth:h}=u;!h||!p||(t.lineWidth=h,t.strokeStyle=p,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),d=this.getPointPosition(a,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,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(r),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;const d=o.setContext(this.getContext(c)),u=Tn(d.font);if(i=this.getDistanceFromCenterForValue(this.ticks[c].value),d.showLabelBackdrop){t.font=u.string,s=t.measureText(a.label).width,t.fillStyle=d.backdropColor;const p=Un(d.backdropPadding);t.fillRect(-s/2-p.left,-i-u.size/2-p.top,s+p.width,u.size+p.height)}Ds(t,a.label,0,-i,u,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),t.restore()}drawTitle(){}}Ge(Sc,"id","radialLinear"),Ge(Sc,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:K1.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),Ge(Sc,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),Ge(Sc,"descriptors",{angleLines:{_fallback:"grid"}});const xd={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}},To=Object.keys(xd);function Nx(e,t){return e-t}function $x(e,t){if(Pt(t))return null;const n=e._adapter,{parser:o,round:r,isoWeekday:i}=e._parseOpts;let s=t;return typeof o=="function"&&(s=o(s)),Cn(s)||(s=typeof o=="string"?n.parse(s,o):n.parse(s)),s===null?null:(r&&(s=r==="week"&&(al(i)||i===!0)?n.startOf(s,"isoWeek",i):n.startOf(s,r)),+s)}function Bx(e,t,n,o){const r=To.length;for(let i=To.indexOf(e);i<r-1;++i){const s=xd[To[i]],a=s.steps?s.steps:Number.MAX_SAFE_INTEGER;if(s.common&&Math.ceil((n-t)/(a*s.size))<=o)return To[i]}return To[r-1]}function wY(e,t,n,o,r){for(let i=To.length-1;i>=To.indexOf(n);i--){const s=To[i];if(xd[s].common&&e._adapter.diff(r,o,s)>=t-1)return s}return To[n?To.indexOf(n):0]}function SY(e){for(let t=To.indexOf(e)+1,n=To.length;t<n;++t)if(xd[To[t]].common)return To[t]}function zx(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:o,hi:r}=k6(n,t),i=n[o]>=t?n[o]:n[r];e[i]=!0}}function MY(e,t,n,o){const r=e._adapter,i=+r.startOf(t[0].value,o),s=t[t.length-1].value;let a,c;for(a=i;a<=s;a=+r.add(a,1,o))c=n[a],c>=0&&(t[c].major=!0);return t}function Zx(e,t,n){const o=[],r={},i=t.length;let s,a;for(s=0;s<i;++s)a=t[s],r[a]=s,o.push({value:a,major:!1});return i===0||!n?o:MY(e,o,r,n)}class Mc extends Bs{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 LG._date(t.adapters.date);r.init(n),ec(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:$x(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:s,maxDefined:a}=this.getUserBounds();function c(d){!s&&!isNaN(d.min)&&(r=Math.min(r,d.min)),!a&&!isNaN(d.max)&&(i=Math.max(i,d.max))}(!s||!a)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),r=Cn(r)&&!isNaN(r)?r:+n.startOf(Date.now(),o),i=Cn(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,s=this.max,a=oU(r,i,s);return this._unit=n.unit||(o.autoSkip?Bx(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):wY(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!o.major.enabled||this._unit==="year"?void 0:SY(this._unit),this.initOffsets(r),t.reverse&&a.reverse(),Zx(this,a,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 s=t.length<3?.5:.25;n=Vn(n,0,s),o=Vn(o,0,s),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,s=i.unit||Bx(i.minUnit,n,o,this._getLabelCapacity(n)),a=xt(r.ticks.stepSize,1),c=s==="week"?i.isoWeekday:!1,d=al(c)||c===!0,u={};let p=n,h,g;if(d&&(p=+t.startOf(p,"isoWeek",c)),p=+t.startOf(p,d?"day":s),t.diff(o,n,s)>1e5*a)throw new Error(n+" and "+o+" are too far apart with stepSize of "+a+" "+s);const m=r.ticks.source==="data"&&this.getDataTimestamps();for(h=p,g=0;h<o;h=+t.add(h,a,s),g++)zx(u,h,m);return(h===o||r.bounds==="ticks"||g===1)&&zx(u,h,m),Object.keys(u).sort(Nx).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,s=n||r[i];return this._adapter.format(t,s)}_tickFormatFunction(t,n,o,r){const i=this.options,s=i.ticks.callback;if(s)return en(s,[t,n,o],this);const a=i.time.displayFormats,c=this._unit,d=this._majorUnit,u=c&&a[c],p=d&&a[d],h=o[n],g=d&&p&&h&&h.major;return this._adapter.format(t,r||(g?p: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=gr(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(r),s=Math.sin(r),a=this._resolveTickFontOptions(0).size;return{w:o*i+a*s,h:o*s+a*i}}_getLabelCapacity(t){const n=this.options.time,o=n.displayFormats,r=o[n.unit]||o.millisecond,i=this._tickFormatFunction(t,0,Zx(this,[t],this._majorUnit),r),s=this._getLabelSize(i),a=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return a>0?a: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($x(this,r[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Wb(t.sort(Nx))}}Ge(Mc,"id","time"),Ge(Mc,"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 yd(e,t,n){let o=0,r=e.length-1,i,s,a,c;n?(t>=e[o].pos&&t<=e[r].pos&&({lo:o,hi:r}=ci(e,"pos",t)),{pos:i,time:a}=e[o],{pos:s,time:c}=e[r]):(t>=e[o].time&&t<=e[r].time&&({lo:o,hi:r}=ci(e,"time",t)),{time:i,pos:a}=e[o],{time:s,pos:c}=e[r]);const d=s-i;return d?a+(c-a)*(t-i)/d:a}class cp extends Mc{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=yd(n,this.min),this._tableRange=yd(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:o}=this,r=[],i=[];let s,a,c,d,u;for(s=0,a=t.length;s<a;++s)d=t[s],d>=n&&d<=o&&r.push(d);if(r.length<2)return[{time:n,pos:0},{time:o,pos:1}];for(s=0,a=r.length;s<a;++s)u=r[s+1],c=r[s-1],d=r[s],Math.round((u+c)/2)!==d&&i.push({time:d,pos:s/(a-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(yd(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,o=this.getDecimalForPixel(t)/n.factor-n.end;return yd(this._table,o*this._tableRange+this._minPos,!0)}}Ge(cp,"id","timeseries"),Ge(cp,"defaults",Mc.defaults);var TY=Object.freeze({__proto__:null,CategoryScale:ip,LinearScale:sp,LogarithmicScale:ap,RadialLinearScale:Sc,TimeScale:Mc,TimeSeriesScale:cp});const kY=[RG,aK,nY,TY],Wx="label";function Ux(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function EY(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Gx(e,t){e.labels=t}function qx(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wx;const o=[];e.datasets=t.map(r=>{const i=e.datasets.find(s=>s[n]===r[n]);return!i||!r.data||o.includes(i)?{...r}:(o.push(i),Object.assign(i,r),i)})}function OY(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Wx;const n={labels:[],datasets:[]};return Gx(n,e.labels),qx(n,e.datasets,t),n}function _Y(e,t){return e.getElementsAtEventForMode(t.nativeEvent,"nearest",{intersect:!0},!1)}function PY(e,t){const{height:n=150,width:o=300,redraw:r=!1,datasetIdKey:i,type:s,data:a,options:c,plugins:d=[],fallbackContent:u,updateMode:p,...h}=e,g=F.useRef(null),m=F.useRef(null),b=()=>{g.current&&(m.current=new Cc(g.current,{type:s,data:OY(a,i),options:c&&{...c},plugins:d}),Ux(t,m.current))},C=()=>{Ux(t,null),m.current&&(m.current.destroy(),m.current=null)};return F.useEffect(()=>{!r&&m.current&&c&&EY(m.current,c)},[r,c]),F.useEffect(()=>{!r&&m.current&&Gx(m.current.config.data,a.labels)},[r,a.labels]),F.useEffect(()=>{!r&&m.current&&a.datasets&&qx(m.current.config.data,a.datasets,i)},[r,a.datasets]),F.useEffect(()=>{m.current&&(r?(C(),setTimeout(b)):m.current.update(p))},[r,c,a.labels,a.datasets,p]),F.useEffect(()=>{m.current&&(C(),setTimeout(b))},[s]),F.useEffect(()=>(b(),()=>C()),[]),F.createElement("canvas",{ref:g,role:"img",height:n,width:o,...h},u)}const vd=F.forwardRef(PY);function Kx(e,t){return Cc.register(t),F.forwardRef((n,o)=>F.createElement(vd,{...n,ref:o,type:e}))}const RY=Kx("doughnut",Bi),LY=Kx("scatter",dc),fl=(e,t=0,n=1)=>up(fp(t,e),n),dp=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]=fl(e[t],0,255)):t===3&&(e[t]=fl(e[t],0,1));return e},Yx={};for(let e of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Yx[`[object ${e}]`]=e.toLowerCase();function Rt(e){return Yx[Object.prototype.toString.call(e)]||"object"}const Lt=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):Rt(e[0])=="object"&&t?t.split("").filter(n=>e[0][n]!==void 0).map(n=>e[0][n]):e[0],wd=e=>{if(e.length<2)return null;const t=e.length-1;return Rt(e[t])=="string"?e[t].toLowerCase():null},{PI:Sd,min:up,max:fp}=Math,hi=Sd*2,pp=Sd/3,IY=Sd/180,VY=180/Sd,yt={format:{},autodetect:[]};let ze=class{constructor(...t){const n=this;if(Rt(t[0])==="object"&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let o=wd(t),r=!1;if(!o){r=!0,yt.sorted||(yt.autodetect=yt.autodetect.sort((i,s)=>s.p-i.p),yt.sorted=!0);for(let i of yt.autodetect)if(o=i.test(...t),o)break}if(yt.format[o]){const i=yt.format[o].apply(null,r?t:t.slice(0,-1));n._rgb=dp(i)}else throw new Error("unknown format: "+t);n._rgb.length===3&&n._rgb.push(1)}toString(){return Rt(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}};const jY="2.6.0",vt=(...e)=>new vt.Color(...e);vt.Color=ze,vt.version=jY;const DY=(...e)=>{e=Lt(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:Xx}=Math,AY=(...e)=>{let[t,n,o]=Lt(e,"rgb");t=t/255,n=n/255,o=o/255;const r=1-Xx(t,Xx(n,o)),i=r<1?1/(1-r):0,s=(1-t-r)*i,a=(1-n-r)*i,c=(1-o-r)*i;return[s,a,c,r]};ze.prototype.cmyk=function(){return AY(this._rgb)},vt.cmyk=(...e)=>new ze(...e,"cmyk"),yt.format.cmyk=DY,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"cmyk"),Rt(e)==="array"&&e.length===4)return"cmyk"}});const hp=e=>Math.round(e*100)/100,HY=(...e)=>{const t=Lt(e,"hsla");let n=wd(e)||"lsa";return t[0]=hp(t[0]||0),t[1]=hp(t[1]*100)+"%",t[2]=hp(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(",")})`},Jx=(...e)=>{e=Lt(e,"rgba");let[t,n,o]=e;t/=255,n/=255,o/=255;const r=up(t,n,o),i=fp(t,n,o),s=(i+r)/2;let a,c;return i===r?(a=0,c=Number.NaN):a=s<.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,a,s,e[3]]:[c,a,s]},{round:gp}=Math,FY=(...e)=>{const t=Lt(e,"rgba");let n=wd(e)||"rgb";return n.substr(0,3)=="hsl"?HY(Jx(t),n):(t[0]=gp(t[0]),t[1]=gp(t[1]),t[2]=gp(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:mp}=Math,bp=(...e)=>{e=Lt(e,"hsl");const[t,n,o]=e;let r,i,s;if(n===0)r=i=s=o*255;else{const a=[0,0,0],c=[0,0,0],d=o<.5?o*(1+n):o+n-o*n,u=2*o-d,p=t/360;a[0]=p+1/3,a[1]=p,a[2]=p-1/3;for(let h=0;h<3;h++)a[h]<0&&(a[h]+=1),a[h]>1&&(a[h]-=1),6*a[h]<1?c[h]=u+(d-u)*6*a[h]:2*a[h]<1?c[h]=d:3*a[h]<2?c[h]=u+(d-u)*(2/3-a[h])*6:c[h]=u;[r,i,s]=[mp(c[0]*255),mp(c[1]*255),mp(c[2]*255)]}return e.length>3?[r,i,s,e[3]]:[r,i,s,1]},Qx=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,ey=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,ty=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ny=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,oy=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ry=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,{round:iy}=Math,Cp=e=>{e=e.toLowerCase().trim();let t;if(yt.format.named)try{return yt.format.named(e)}catch{}if(t=e.match(Qx)){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(ey)){const n=t.slice(1,5);for(let o=0;o<4;o++)n[o]=+n[o];return n}if(t=e.match(ty)){const n=t.slice(1,4);for(let o=0;o<3;o++)n[o]=iy(n[o]*2.55);return n[3]=1,n}if(t=e.match(ny)){const n=t.slice(1,5);for(let o=0;o<3;o++)n[o]=iy(n[o]*2.55);return n[3]=+n[3],n}if(t=e.match(oy)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const o=bp(n);return o[3]=1,o}if(t=e.match(ry)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const o=bp(n);return o[3]=+t[4],o}};Cp.test=e=>Qx.test(e)||ey.test(e)||ty.test(e)||ny.test(e)||oy.test(e)||ry.test(e),ze.prototype.css=function(e){return FY(this._rgb,e)},vt.css=(...e)=>new ze(...e,"css"),yt.format.css=Cp,yt.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&Rt(e)==="string"&&Cp.test(e))return"css"}}),yt.format.gl=(...e)=>{const t=Lt(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t},vt.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:NY}=Math,$Y=(...e)=>{e=Lt(e,"hcg");let[t,n,o]=e,r,i,s;o=o*255;const a=n*255;if(n===0)r=i=s=o;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const c=NY(t),d=t-c,u=o*(1-n),p=u+a*(1-d),h=u+a*d,g=u+a;switch(c){case 0:[r,i,s]=[g,h,u];break;case 1:[r,i,s]=[p,g,u];break;case 2:[r,i,s]=[u,g,h];break;case 3:[r,i,s]=[u,p,g];break;case 4:[r,i,s]=[h,u,g];break;case 5:[r,i,s]=[g,u,p];break}}return[r,i,s,e.length>3?e[3]:1]},BY=(...e)=>{const[t,n,o]=Lt(e,"rgb"),r=up(t,n,o),i=fp(t,n,o),s=i-r,a=s*100/255,c=r/(255-s)*100;let d;return s===0?d=Number.NaN:(t===i&&(d=(n-o)/s),n===i&&(d=2+(o-t)/s),o===i&&(d=4+(t-n)/s),d*=60,d<0&&(d+=360)),[d,a,c]};ze.prototype.hcg=function(){return BY(this._rgb)},vt.hcg=(...e)=>new ze(...e,"hcg"),yt.format.hcg=$Y,yt.autodetect.push({p:1,test:(...e)=>{if(e=Lt(e,"hcg"),Rt(e)==="array"&&e.length===3)return"hcg"}});const zY=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,ZY=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,sy=e=>{if(e.match(zY)){(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(ZY)){(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:Md}=Math,ay=(...e)=>{let[t,n,o,r]=Lt(e,"rgba"),i=wd(e)||"auto";r===void 0&&(r=1),i==="auto"&&(i=r<1?"rgba":"rgb"),t=Md(t),n=Md(n),o=Md(o);let a="000000"+(t<<16|n<<8|o).toString(16);a=a.substr(a.length-6);let c="0"+Md(r*255).toString(16);switch(c=c.substr(c.length-2),i.toLowerCase()){case"rgba":return`#${a}${c}`;case"argb":return`#${c}${a}`;default:return`#${a}`}};ze.prototype.hex=function(e){return ay(this._rgb,e)},vt.hex=(...e)=>new ze(...e,"hex"),yt.format.hex=sy,yt.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&Rt(e)==="string"&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{cos:pl}=Math,WY=(...e)=>{e=Lt(e,"hsi");let[t,n,o]=e,r,i,s;return isNaN(t)&&(t=0),isNaN(n)&&(n=0),t>360&&(t-=360),t<0&&(t+=360),t/=360,t<1/3?(s=(1-n)/3,r=(1+n*pl(hi*t)/pl(pp-hi*t))/3,i=1-(s+r)):t<2/3?(t-=1/3,r=(1-n)/3,i=(1+n*pl(hi*t)/pl(pp-hi*t))/3,s=1-(r+i)):(t-=2/3,i=(1-n)/3,s=(1+n*pl(hi*t)/pl(pp-hi*t))/3,r=1-(i+s)),r=fl(o*r*3),i=fl(o*i*3),s=fl(o*s*3),[r*255,i*255,s*255,e.length>3?e[3]:1]},{min:UY,sqrt:GY,acos:qY}=Math,KY=(...e)=>{let[t,n,o]=Lt(e,"rgb");t/=255,n/=255,o/=255;let r;const i=UY(t,n,o),s=(t+n+o)/3,a=s>0?1-i/s:0;return a===0?r=NaN:(r=(t-n+(t-o))/2,r/=GY((t-n)*(t-n)+(t-o)*(n-o)),r=qY(r),o>n&&(r=hi-r),r/=hi),[r*360,a,s]};ze.prototype.hsi=function(){return KY(this._rgb)},vt.hsi=(...e)=>new ze(...e,"hsi"),yt.format.hsi=WY,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"hsi"),Rt(e)==="array"&&e.length===3)return"hsi"}}),ze.prototype.hsl=function(){return Jx(this._rgb)},vt.hsl=(...e)=>new ze(...e,"hsl"),yt.format.hsl=bp,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"hsl"),Rt(e)==="array"&&e.length===3)return"hsl"}});const{floor:YY}=Math,XY=(...e)=>{e=Lt(e,"hsv");let[t,n,o]=e,r,i,s;if(o*=255,n===0)r=i=s=o;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const a=YY(t),c=t-a,d=o*(1-n),u=o*(1-n*c),p=o*(1-n*(1-c));switch(a){case 0:[r,i,s]=[o,p,d];break;case 1:[r,i,s]=[u,o,d];break;case 2:[r,i,s]=[d,o,p];break;case 3:[r,i,s]=[d,u,o];break;case 4:[r,i,s]=[p,d,o];break;case 5:[r,i,s]=[o,d,u];break}}return[r,i,s,e.length>3?e[3]:1]},{min:JY,max:QY}=Math,eX=(...e)=>{e=Lt(e,"rgb");let[t,n,o]=e;const r=JY(t,n,o),i=QY(t,n,o),s=i-r;let a,c,d;return d=i/255,i===0?(a=Number.NaN,c=0):(c=s/i,t===i&&(a=(n-o)/s),n===i&&(a=2+(o-t)/s),o===i&&(a=4+(t-n)/s),a*=60,a<0&&(a+=360)),[a,c,d]};ze.prototype.hsv=function(){return eX(this._rgb)},vt.hsv=(...e)=>new ze(...e,"hsv"),yt.format.hsv=XY,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"hsv"),Rt(e)==="array"&&e.length===3)return"hsv"}});const ko={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},{pow:tX}=Math,ly=(...e)=>{e=Lt(e,"lab");const[t,n,o]=e;let r,i,s,a,c,d;return i=(t+16)/116,r=isNaN(n)?i:i+n/500,s=isNaN(o)?i:i-o/200,i=ko.Yn*yp(i),r=ko.Xn*yp(r),s=ko.Zn*yp(s),a=xp(3.2404542*r-1.5371385*i-.4985314*s),c=xp(-.969266*r+1.8760108*i+.041556*s),d=xp(.0556434*r-.2040259*i+1.0572252*s),[a,c,d,e.length>3?e[3]:1]},xp=e=>255*(e<=.00304?12.92*e:1.055*tX(e,1/2.4)-.055),yp=e=>e>ko.t1?e*e*e:ko.t2*(e-ko.t0),{pow:cy}=Math,dy=(...e)=>{const[t,n,o]=Lt(e,"rgb"),[r,i,s]=nX(t,n,o),a=116*i-16;return[a<0?0:a,500*(r-i),200*(i-s)]},vp=e=>(e/=255)<=.04045?e/12.92:cy((e+.055)/1.055,2.4),wp=e=>e>ko.t3?cy(e,1/3):e/ko.t2+ko.t0,nX=(e,t,n)=>{e=vp(e),t=vp(t),n=vp(n);const o=wp((.4124564*e+.3575761*t+.1804375*n)/ko.Xn),r=wp((.2126729*e+.7151522*t+.072175*n)/ko.Yn),i=wp((.0193339*e+.119192*t+.9503041*n)/ko.Zn);return[o,r,i]};ze.prototype.lab=function(){return dy(this._rgb)},vt.lab=(...e)=>new ze(...e,"lab"),yt.format.lab=ly,yt.autodetect.push({p:2,test:(...e)=>{if(e=Lt(e,"lab"),Rt(e)==="array"&&e.length===3)return"lab"}});const{sin:oX,cos:rX}=Math,uy=(...e)=>{let[t,n,o]=Lt(e,"lch");return isNaN(o)&&(o=0),o=o*IY,[t,rX(o)*n,oX(o)*n]},fy=(...e)=>{e=Lt(e,"lch");const[t,n,o]=e,[r,i,s]=uy(t,n,o),[a,c,d]=ly(r,i,s);return[a,c,d,e.length>3?e[3]:1]},iX=(...e)=>{const t=Lt(e,"hcl").reverse();return fy(...t)},{sqrt:sX,atan2:aX,round:lX}=Math,py=(...e)=>{const[t,n,o]=Lt(e,"lab"),r=sX(n*n+o*o);let i=(aX(o,n)*VY+360)%360;return lX(r*1e4)===0&&(i=Number.NaN),[t,r,i]},hy=(...e)=>{const[t,n,o]=Lt(e,"rgb"),[r,i,s]=dy(t,n,o);return py(r,i,s)};ze.prototype.lch=function(){return hy(this._rgb)},ze.prototype.hcl=function(){return hy(this._rgb).reverse()},vt.lch=(...e)=>new ze(...e,"lch"),vt.hcl=(...e)=>new ze(...e,"hcl"),yt.format.lch=fy,yt.format.hcl=iX,["lch","hcl"].forEach(e=>yt.autodetect.push({p:2,test:(...t)=>{if(t=Lt(t,e),Rt(t)==="array"&&t.length===3)return e}}));const hl={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=ay(this._rgb,"rgb");for(let t of Object.keys(hl))if(hl[t]===e)return t.toLowerCase();return e},yt.format.named=e=>{if(e=e.toLowerCase(),hl[e])return sy(hl[e]);throw new Error("unknown color name: "+e)},yt.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&Rt(e)==="string"&&hl[e.toLowerCase()])return"named"}});const cX=e=>{if(Rt(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)},dX=(...e)=>{const[t,n,o]=Lt(e,"rgb");return(t<<16)+(n<<8)+o};ze.prototype.num=function(){return dX(this._rgb)},vt.num=(...e)=>new ze(...e,"num"),yt.format.num=cX,yt.autodetect.push({p:5,test:(...e)=>{if(e.length===1&&Rt(e[0])==="number"&&e[0]>=0&&e[0]<=16777215)return"num"}});const{round:gy}=Math;ze.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(gy)},ze.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,n)=>n<3?e===!1?t:gy(t):t)},vt.rgb=(...e)=>new ze(...e,"rgb"),yt.format.rgb=(...e)=>{const t=Lt(e,"rgba");return t[3]===void 0&&(t[3]=1),t},yt.autodetect.push({p:3,test:(...e)=>{if(e=Lt(e,"rgba"),Rt(e)==="array"&&(e.length===3||e.length===4&&Rt(e[3])=="number"&&e[3]>=0&&e[3]<=1))return"rgb"}});const{log:Td}=Math,my=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*Td(o),r=t<20?0:-254.76935184120902+.8274096064007395*(r=t-10)+115.67994401066147*Td(r)):(n=351.97690566805693+.114206453784165*(n=t-55)-40.25366309332127*Td(n),o=325.4494125711974+.07943456536662342*(o=t-50)-28.0852963507957*Td(o),r=255),[n,o,r,1]},{round:uX}=Math,fX=(...e)=>{const t=Lt(e,"rgb"),n=t[0],o=t[2];let r=1e3,i=4e4;const s=.4;let a;for(;i-r>s;){a=(i+r)*.5;const c=my(a);c[2]/c[0]>=o/n?i=a:r=a}return uX(a)};ze.prototype.temp=ze.prototype.kelvin=ze.prototype.temperature=function(){return fX(this._rgb)},vt.temp=vt.kelvin=vt.temperature=(...e)=>new ze(...e,"temp"),yt.format.temp=yt.format.kelvin=yt.format.temperature=my;const{pow:kd,sign:pX}=Math,by=(...e)=>{e=Lt(e,"lab");const[t,n,o]=e,r=kd(t+.3963377774*n+.2158037573*o,3),i=kd(t-.1055613458*n-.0638541728*o,3),s=kd(t-.0894841775*n-1.291485548*o,3);return[255*Sp(4.0767416621*r-3.3077115913*i+.2309699292*s),255*Sp(-1.2684380046*r+2.6097574011*i-.3413193965*s),255*Sp(-.0041960863*r-.7034186147*i+1.707614701*s),e.length>3?e[3]:1]};function Sp(e){const t=Math.abs(e);return t>.0031308?(pX(e)||1)*(1.055*kd(t,1/2.4)-.055):e*12.92}const{cbrt:Mp,pow:hX,sign:gX}=Math,Cy=(...e)=>{const[t,n,o]=Lt(e,"rgb"),[r,i,s]=[Tp(t/255),Tp(n/255),Tp(o/255)],a=Mp(.4122214708*r+.5363325363*i+.0514459929*s),c=Mp(.2119034982*r+.6806995451*i+.1073969566*s),d=Mp(.0883024619*r+.2817188376*i+.6299787005*s);return[.2104542553*a+.793617785*c-.0040720468*d,1.9779984951*a-2.428592205*c+.4505937099*d,.0259040371*a+.7827717662*c-.808675766*d]};function Tp(e){const t=Math.abs(e);return t<.04045?e/12.92:(gX(e)||1)*hX((t+.055)/1.055,2.4)}ze.prototype.oklab=function(){return Cy(this._rgb)},vt.oklab=(...e)=>new ze(...e,"oklab"),yt.format.oklab=by,yt.autodetect.push({p:3,test:(...e)=>{if(e=Lt(e,"oklab"),Rt(e)==="array"&&e.length===3)return"oklab"}});const mX=(...e)=>{e=Lt(e,"lch");const[t,n,o]=e,[r,i,s]=uy(t,n,o),[a,c,d]=by(r,i,s);return[a,c,d,e.length>3?e[3]:1]},bX=(...e)=>{const[t,n,o]=Lt(e,"rgb"),[r,i,s]=Cy(t,n,o);return py(r,i,s)};ze.prototype.oklch=function(){return bX(this._rgb)},vt.oklch=(...e)=>new ze(...e,"oklch"),yt.format.oklch=mX,yt.autodetect.push({p:3,test:(...e)=>{if(e=Lt(e,"oklch"),Rt(e)==="array"&&e.length===3)return"oklch"}}),ze.prototype.alpha=function(e,t=!1){return e!==void 0&&Rt(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]-=ko.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:CX}=Math,xX=1e-7,yX=20;ze.prototype.luminance=function(e,t="rgb"){if(e!==void 0&&Rt(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=yX;const r=(s,a)=>{const c=s.interpolate(a,.5,t),d=c.luminance();return Math.abs(e-d)<xX||!o--?c:d>e?r(s,c):r(c,a)},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 vX(...this._rgb.slice(0,3))};const vX=(e,t,n)=>(e=kp(e),t=kp(t),n=kp(n),.2126*e+.7152*t+.0722*n),kp=e=>(e/=255,e<=.03928?e/12.92:CX((e+.055)/1.055,2.4)),to={},Tc=(e,t,n=.5,...o)=>{let r=o[0]||"lrgb";if(!to[r]&&!o.length&&(r=Object.keys(to)[0]),!to[r])throw new Error(`interpolation mode ${r} is not defined`);return Rt(e)!=="object"&&(e=new ze(e)),Rt(t)!=="object"&&(t=new ze(t)),to[r](e,t,n).alpha(e.alpha()+n*(t.alpha()-e.alpha()))};ze.prototype.mix=ze.prototype.interpolate=function(e,t=.5,...n){return Tc(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]+=ko.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 s=o.indexOf(r)-(o.substr(0,2)==="ok"?2:0);if(s>-1){if(Rt(t)=="string")switch(t.charAt(0)){case"+":i[s]+=+t;break;case"-":i[s]+=+t;break;case"*":i[s]*=+t.substr(1);break;case"/":i[s]/=+t.substr(1);break;default:i[s]=+t}else if(Rt(t)==="number")i[s]=t;else throw new Error("unsupported value for Color.set");const a=new ze(i,o);return n?(this._rgb=a._rgb,this):a}throw new Error(`unknown channel ${r} in mode ${o}`)}else return i},ze.prototype.tint=function(e=.5,...t){return Tc(this,"white",e,...t)},ze.prototype.shade=function(e=.5,...t){return Tc(this,"black",e,...t)};const wX=(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")};to.rgb=wX;const{sqrt:Ep,pow:gl}=Math,SX=(e,t,n)=>{const[o,r,i]=e._rgb,[s,a,c]=t._rgb;return new ze(Ep(gl(o,2)*(1-n)+gl(s,2)*n),Ep(gl(r,2)*(1-n)+gl(a,2)*n),Ep(gl(i,2)*(1-n)+gl(c,2)*n),"rgb")};to.lrgb=SX;const MX=(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")};to.lab=MX;const ml=(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 s,a,c,d,u,p;(o.substr(0,1)==="h"||o==="oklch")&&([s,c,u]=r,[a,d,p]=i);let h,g,m,b;return!isNaN(s)&&!isNaN(a)?(a>s&&a-s>180?b=a-(s+360):a<s&&s-a>180?b=a+360-s:b=a-s,g=s+n*b):isNaN(s)?isNaN(a)?g=Number.NaN:(g=a,(u==1||u==0)&&o!="hsv"&&(h=d)):(g=s,(p==1||p==0)&&o!="hsv"&&(h=c)),h===void 0&&(h=c+n*(d-c)),m=u+n*(p-u),o==="oklch"?new ze([m,h,g],o):new ze([g,h,m],o)},xy=(e,t,n)=>ml(e,t,n,"lch");to.lch=xy,to.hcl=xy;const TX=(e,t,n)=>{const o=e.num(),r=t.num();return new ze(o+n*(r-o),"num")};to.num=TX;const kX=(e,t,n)=>ml(e,t,n,"hcg");to.hcg=kX;const EX=(e,t,n)=>ml(e,t,n,"hsi");to.hsi=EX;const OX=(e,t,n)=>ml(e,t,n,"hsl");to.hsl=OX;const _X=(e,t,n)=>ml(e,t,n,"hsv");to.hsv=_X;const PX=(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")};to.oklab=PX;const RX=(e,t,n)=>ml(e,t,n,"oklch");to.oklch=RX;const{pow:Op,sqrt:_p,PI:Pp,cos:yy,sin:vy,atan2:LX}=Math,IX=(e,t="lrgb",n=null)=>{const o=e.length;n||(n=Array.from(new Array(o)).map(()=>1));const r=o/n.reduce(function(p,h){return p+h});if(n.forEach((p,h)=>{n[h]*=r}),e=e.map(p=>new ze(p)),t==="lrgb")return VX(e,n);const i=e.shift(),s=i.get(t),a=[];let c=0,d=0;for(let p=0;p<s.length;p++)if(s[p]=(s[p]||0)*n[0],a.push(isNaN(s[p])?0:n[0]),t.charAt(p)==="h"&&!isNaN(s[p])){const h=s[p]/180*Pp;c+=yy(h)*n[0],d+=vy(h)*n[0]}let u=i.alpha()*n[0];e.forEach((p,h)=>{const g=p.get(t);u+=p.alpha()*n[h+1];for(let m=0;m<s.length;m++)if(!isNaN(g[m]))if(a[m]+=n[h+1],t.charAt(m)==="h"){const b=g[m]/180*Pp;c+=yy(b)*n[h+1],d+=vy(b)*n[h+1]}else s[m]+=g[m]*n[h+1]});for(let p=0;p<s.length;p++)if(t.charAt(p)==="h"){let h=LX(d/a[p],c/a[p])/Pp*180;for(;h<0;)h+=360;for(;h>=360;)h-=360;s[p]=h}else s[p]=s[p]/a[p];return u/=o,new ze(s,t).alpha(u>.99999?1:u,!0)},VX=(e,t)=>{const n=e.length,o=[0,0,0,0];for(let r=0;r<e.length;r++){const i=e[r],s=t[r]/n,a=i._rgb;o[0]+=Op(a[0],2)*s,o[1]+=Op(a[1],2)*s,o[2]+=Op(a[2],2)*s,o[3]+=a[3]*s}return o[0]=_p(o[0]),o[1]=_p(o[1]),o[2]=_p(o[2]),o[3]>.9999999&&(o[3]=1),new ze(dp(o))},{pow:jX}=Math;function Ed(e){let t="rgb",n=vt("#ccc"),o=0,r=[0,1],i=[],s=[0,0],a=!1,c=[],d=!1,u=0,p=1,h=!1,g={},m=!0,b=1;const C=function(E){if(E=E||["#fff","#000"],E&&Rt(E)==="string"&&vt.brewer&&vt.brewer[E.toLowerCase()]&&(E=vt.brewer[E.toLowerCase()]),Rt(E)==="array"){E.length===1&&(E=[E[0],E[0]]),E=E.slice(0);for(let O=0;O<E.length;O++)E[O]=vt(E[O]);i.length=0;for(let O=0;O<E.length;O++)i.push(O/(E.length-1))}return w(),c=E},x=function(E){if(a!=null){const O=a.length-1;let _=0;for(;_<O&&E>=a[_];)_++;return _-1}return 0};let v=E=>E,S=E=>E;const T=function(E,O){let _,R;if(O==null&&(O=!1),isNaN(E)||E===null)return n;O?R=E:a&&a.length>2?R=x(E)/(a.length-2):p!==u?R=(E-u)/(p-u):R=1,R=S(R),O||(R=v(R)),b!==1&&(R=jX(R,b)),R=s[0]+R*(1-s[0]-s[1]),R=fl(R,0,1);const P=Math.floor(R*1e4);if(m&&g[P])_=g[P];else{if(Rt(c)==="array")for(let L=0;L<i.length;L++){const j=i[L];if(R<=j){_=c[L];break}if(R>=j&&L===i.length-1){_=c[L];break}if(R>j&&R<i[L+1]){R=(R-j)/(i[L+1]-j),_=vt.interpolate(c[L],c[L+1],R,t);break}}else Rt(c)==="function"&&(_=c(R));m&&(g[P]=_)}return _};var w=()=>g={};C(e);const k=function(E){const O=vt(T(E));return d&&O[d]?O[d]():O};return k.classes=function(E){if(E!=null){if(Rt(E)==="array")a=E,r=[E[0],E[E.length-1]];else{const O=vt.analyze(r);E===0?a=[O.min,O.max]:a=vt.limits(O,"e",E)}return k}return a},k.domain=function(E){if(!arguments.length)return r;u=E[0],p=E[E.length-1],i=[];const O=c.length;if(E.length===O&&u!==p)for(let _ of Array.from(E))i.push((_-u)/(p-u));else{for(let _=0;_<O;_++)i.push(_/(O-1));if(E.length>2){const _=E.map((P,L)=>L/(E.length-1)),R=E.map(P=>(P-u)/(p-u));R.every((P,L)=>_[L]===P)||(S=P=>{if(P<=0||P>=1)return P;let L=0;for(;P>=R[L+1];)L++;const j=(P-R[L])/(R[L+1]-R[L]);return _[L]+j*(_[L+1]-_[L])})}}return r=[u,p],k},k.mode=function(E){return arguments.length?(t=E,w(),k):t},k.range=function(E,O){return C(E),k},k.out=function(E){return d=E,k},k.spread=function(E){return arguments.length?(o=E,k):o},k.correctLightness=function(E){return E==null&&(E=!0),h=E,w(),h?v=function(O){const _=T(0,!0).lab()[0],R=T(1,!0).lab()[0],P=_>R;let L=T(O,!0).lab()[0];const j=_+(R-_)*O;let V=L-j,I=0,N=1,B=20;for(;Math.abs(V)>.01&&B-- >0;)(function(){return P&&(V*=-1),V<0?(I=O,O+=(N-O)*.5):(N=O,O+=(I-O)*.5),L=T(O,!0).lab()[0],V=L-j})();return O}:v=O=>O,k},k.padding=function(E){return E!=null?(Rt(E)==="number"&&(E=[E,E]),s=E,k):s},k.colors=function(E,O){arguments.length<2&&(O="hex");let _=[];if(arguments.length===0)_=c.slice(0);else if(E===1)_=[k(.5)];else if(E>1){const R=r[0],P=r[1]-R;_=DX(0,E).map(L=>k(R+L/(E-1)*P))}else{e=[];let R=[];if(a&&a.length>2)for(let P=1,L=a.length,j=1<=L;j?P<L:P>L;j?P++:P--)R.push((a[P-1]+a[P])*.5);else R=r;_=R.map(P=>k(P))}return vt[O]&&(_=_.map(R=>R[O]())),_},k.cache=function(E){return E!=null?(m=E,k):m},k.gamma=function(E){return E!=null?(b=E,k):b},k.nodata=function(E){return E!=null?(n=vt(E),k):n},k}function DX(e,t,n){let o=[],r=e<t,i=t;for(let s=e;r?s<i:s>i;r?s++:s--)o.push(s);return o}const AX=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},HX=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 s=[0,1,2].map(a=>n[a]+i*(o[a]-n[a]));return new ze(s,"lab")};else if(e.length===3)[n,o,r]=e.map(i=>i.lab()),t=function(i){const s=[0,1,2].map(a=>(1-i)*(1-i)*n[a]+2*(1-i)*i*o[a]+i*i*r[a]);return new ze(s,"lab")};else if(e.length===4){let i;[n,o,r,i]=e.map(s=>s.lab()),t=function(s){const a=[0,1,2].map(c=>(1-s)*(1-s)*(1-s)*n[c]+3*(1-s)*(1-s)*s*o[c]+3*(1-s)*s*s*r[c]+s*s*s*i[c]);return new ze(a,"lab")}}else if(e.length>=5){let i,s,a;i=e.map(c=>c.lab()),a=e.length-1,s=AX(a),t=function(c){const d=1-c,u=[0,1,2].map(p=>i.reduce((h,g,m)=>h+s[m]*d**(a-m)*c**m*g[p],0));return new ze(u,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return t},FX=e=>{const t=HX(e);return t.scale=()=>Ed(t),t},br=(e,t,n)=>{if(!br[n])throw new Error("unknown blend mode "+n);return br[n](e,t)},Wi=e=>(t,n)=>{const o=vt(n).rgb(),r=vt(t).rgb();return vt.rgb(e(o,r))},Ui=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},NX=e=>e,$X=(e,t)=>e*t/255,BX=(e,t)=>e>t?t:e,zX=(e,t)=>e>t?e:t,ZX=(e,t)=>255*(1-(1-e/255)*(1-t/255)),WX=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),UX=(e,t)=>255*(1-(1-t/255)/(e/255)),GX=(e,t)=>e===255?255:(e=255*(t/255)/(1-e/255),e>255?255:e);br.normal=Wi(Ui(NX)),br.multiply=Wi(Ui($X)),br.screen=Wi(Ui(ZX)),br.overlay=Wi(Ui(WX)),br.darken=Wi(Ui(BX)),br.lighten=Wi(Ui(zX)),br.dodge=Wi(Ui(GX)),br.burn=Wi(Ui(UX));const{pow:qX,sin:KX,cos:YX}=Math;function XX(e=300,t=-1.5,n=1,o=1,r=[0,1]){let i=0,s;Rt(r)==="array"?s=r[1]-r[0]:(s=0,r=[r,r]);const a=function(c){const d=hi*((e+120)/360+t*c),u=qX(r[0]+s*c,o),h=(i!==0?n[0]+c*i:n)*u*(1-u)/2,g=YX(d),m=KX(d),b=u+h*(-.14861*g+1.78277*m),C=u+h*(-.29227*g-.90649*m),x=u+h*(1.97294*g);return vt(dp([b*255,C*255,x*255,1]))};return a.start=function(c){return c==null?e:(e=c,a)},a.rotations=function(c){return c==null?t:(t=c,a)},a.gamma=function(c){return c==null?o:(o=c,a)},a.hue=function(c){return c==null?n:(n=c,Rt(n)==="array"?(i=n[1]-n[0],i===0&&(n=n[1])):i=0,a)},a.lightness=function(c){return c==null?r:(Rt(c)==="array"?(r=c,s=c[1]-c[0]):(r=[c,c],s=0),a)},a.scale=()=>vt.scale(a),a.hue(n),a}const JX="0123456789abcdef",{floor:QX,random:eJ}=Math,tJ=()=>{let e="#";for(let t=0;t<6;t++)e+=JX.charAt(QX(eJ()*16));return new ze(e,"hex")},{log:wy,pow:nJ,floor:oJ,abs:rJ}=Math;function Sy(e,t=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return Rt(e)==="object"&&(e=Object.values(e)),e.forEach(o=>{t&&Rt(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)=>My(n,o,r),n}function My(e,t="equal",n=7){Rt(e)=="array"&&(e=Sy(e));const{min:o,max:r}=e,i=e.values.sort((a,c)=>a-c);if(n===1)return[o,r];const s=[];if(t.substr(0,1)==="c"&&(s.push(o),s.push(r)),t.substr(0,1)==="e"){s.push(o);for(let a=1;a<n;a++)s.push(o+a/n*(r-o));s.push(r)}else if(t.substr(0,1)==="l"){if(o<=0)throw new Error("Logarithmic scales are only possible for values > 0");const a=Math.LOG10E*wy(o),c=Math.LOG10E*wy(r);s.push(o);for(let d=1;d<n;d++)s.push(nJ(10,a+d/n*(c-a)));s.push(r)}else if(t.substr(0,1)==="q"){s.push(o);for(let a=1;a<n;a++){const c=(i.length-1)*a/n,d=oJ(c);if(d===c)s.push(i[d]);else{const u=c-d;s.push(i[d]*(1-u)+i[d+1]*u)}}s.push(r)}else if(t.substr(0,1)==="k"){let a;const c=i.length,d=new Array(c),u=new Array(n);let p=!0,h=0,g=null;g=[],g.push(o);for(let C=1;C<n;C++)g.push(o+C/n*(r-o));for(g.push(r);p;){for(let x=0;x<n;x++)u[x]=0;for(let x=0;x<c;x++){const v=i[x];let S=Number.MAX_VALUE,T;for(let w=0;w<n;w++){const k=rJ(g[w]-v);k<S&&(S=k,T=w),u[T]++,d[x]=T}}const C=new Array(n);for(let x=0;x<n;x++)C[x]=null;for(let x=0;x<c;x++)a=d[x],C[a]===null?C[a]=i[x]:C[a]+=i[x];for(let x=0;x<n;x++)C[x]*=1/u[x];p=!1;for(let x=0;x<n;x++)if(C[x]!==g[x]){p=!0;break}g=C,h++,h>200&&(p=!1)}const m={};for(let C=0;C<n;C++)m[C]=[];for(let C=0;C<c;C++)a=d[C],m[a].push(i[C]);let b=[];for(let C=0;C<n;C++)b.push(m[C][0]),b.push(m[C][m[C].length-1]);b=b.sort((C,x)=>C-x),s.push(b[0]);for(let C=1;C<b.length;C+=2){const x=b[C];!isNaN(x)&&s.indexOf(x)===-1&&s.push(x)}}return s}const iJ=(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:gi,pow:kn,min:sJ,max:aJ,atan2:Ty,abs:ky,cos:Od,sin:Ey,exp:lJ,PI:Oy}=Math;function cJ(e,t,n=1,o=1,r=1){var i=function(oe){return 360*oe/(2*Oy)},s=function(oe){return 2*Oy*oe/360};e=new ze(e),t=new ze(t);const[a,c,d]=Array.from(e.lab()),[u,p,h]=Array.from(t.lab()),g=(a+u)/2,m=gi(kn(c,2)+kn(d,2)),b=gi(kn(p,2)+kn(h,2)),C=(m+b)/2,x=.5*(1-gi(kn(C,7)/(kn(C,7)+kn(25,7)))),v=c*(1+x),S=p*(1+x),T=gi(kn(v,2)+kn(d,2)),w=gi(kn(S,2)+kn(h,2)),k=(T+w)/2,E=i(Ty(d,v)),O=i(Ty(h,S)),_=E>=0?E:E+360,R=O>=0?O:O+360,P=ky(_-R)>180?(_+R+360)/2:(_+R)/2,L=1-.17*Od(s(P-30))+.24*Od(s(2*P))+.32*Od(s(3*P+6))-.2*Od(s(4*P-63));let j=R-_;j=ky(j)<=180?j:R<=_?j+360:j-360,j=2*gi(T*w)*Ey(s(j)/2);const V=u-a,I=w-T,N=1+.015*kn(g-50,2)/gi(20+kn(g-50,2)),B=1+.045*k,D=1+.015*k*L,A=30*lJ(-kn((P-275)/25,2)),Z=-(2*gi(kn(k,7)/(kn(k,7)+kn(25,7))))*Ey(2*s(A)),ae=gi(kn(V/(n*N),2)+kn(I/(o*B),2)+kn(j/(r*D),2)+Z*(I/(o*B))*(j/(r*D)));return aJ(0,sJ(100,ae))}function dJ(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 s in o){const a=(o[s]||0)-(r[s]||0);i+=a*a}return Math.sqrt(i)}const uJ=(...e)=>{try{return new ze(...e),!0}catch{return!1}},fJ={cool(){return Ed([vt.hsl(180,1,.9),vt.hsl(250,.7,.4)])},hot(){return Ed(["#000","#f00","#ff0","#fff"]).mode("rgb")}},_d={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(_d))_d[e.toLowerCase()]=_d[e];Object.assign(vt,{average:IX,bezier:FX,blend:br,cubehelix:XX,mix:Tc,interpolate:Tc,random:tJ,scale:Ed,analyze:Sy,contrast:iJ,deltaE:cJ,distance:dJ,limits:My,valid:uJ,scales:fJ,input:yt,colors:hl,brewer:_d});const pJ=e=>{const t=e.theme,{values:n,palette:o,legend:r=!0,hoveredArcIndex:i,setHoveredArcIndex:s,handleChartHover:a,hoverOffset:c,...d}=e;return{...d,skipNull:!0,data:{datasets:[{data:n??[],backgroundColor:i===null||!r?o:o.flatMap((u,p)=>p!==i?vt(u).alpha(.4).css():u),hoverBackgroundColor:o,hoverOffset:c}]},options:{cutout:"78%",responsive:!0,spacing:n&&n.filter(u=>u!==null&&u!==0).length>1?e.spacing:0,maintainAspectRatio:!0,elements:{arc:{borderWidth:0}},events:["mousemove","mouseout"],layout:{padding:0},onHover:(u,p)=>{var h,g;if(u.type!=="mousemove"||!p.length){s(null),((h=u.native)==null?void 0:h.target).style.cursor="default";return}if(((g=u.native)==null?void 0:g.target).style.cursor=p[0]?"pointer":"default",s(p[0].index),i!==null&&u.native){const b=u.native.target.getBoundingClientRect(),C=b.left+b.width/2,x=b.top+b.height/2,v=u.native instanceof MouseEvent?u.native.clientX:u.x,S=u.native instanceof MouseEvent?u.native.clientY:u.y;a(v,S,C,x)}},plugins:{datalabels:{display:!1},legend:{display:!1},tooltip:{enabled:!1}}},plugins:[{id:"doughnutBackground",style:{padding:"2px"},beforeDatasetsDraw:u=>{const h=u.data.datasets.length>0&&u.data.datasets[0].data.length>0,g=u.data.datasets[0].data.every(w=>w===0);if(h&&!g)return;const m=u.canvas.clientWidth/2,b=u.canvas.clientHeight/2,C=u.ctx,{innerRadius:x,outerRadius:v}=u.getDatasetMeta(u.data.datasets.length-1).controller,S=v-x;C.lineWidth=S,C.strokeStyle=t.palette.primary[50]??"rgba(0, 0, 0, 0)";const T=v-S/2;C.beginPath(),C.arc(m,b,T,0,2*Math.PI),C.stroke()}}]}},hJ=(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),gJ=(e,t)=>vt.scale(e).colors(t.length),_y=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},Py=(e,t,n,o)=>{const r=e-n,i=o-t,s=Math.atan2(i,r)*(180/Math.PI);return s>-45&&s<=45?"left":s>45&&s<=135?"bottom":s>135&&s<=180||s>=-180&&s<=-135?"right":"top"},mJ=(e,t,n,o={x:0,y:0})=>{const r=n.left+o.x+n.width/2,i=n.top+o.y+n.height/2,a=Math.min(n.width,n.height)/2*.8,c=t.reduce((C,x)=>C+x,0)||0,d={x:r,y:i-a,centerX:r,centerY:i,placement:"top"};if(c<=0||!t[e])return d;let u=-Math.PI/2;for(let C=0;C<e;C++)t[C]&&(u+=t[C]/c*(2*Math.PI));const p=t[e]/c*(2*Math.PI),h=u+p/2,g=r+Math.cos(h)*a,m=i+Math.sin(h)*a,b=Py(g,m,r,i);return{x:g,y:m,centerX:r,centerY:i,placement:b}},Rp=e=>{const{action:t,seeMore:n}=e,o=ye(),r={display:"flex",marginLeft:"auto",color:o.palette.primary[700],fontSize:".8rem",textDecoration:"none",alignItems:"center",fontWeight:o.typography.fontWeightBold,"&:hover":{textDecoration:"none"}},i=s=>{s.stopPropagation(),t()};return f.jsx(at,{onClick:i,sx:r,children:n})},bJ=e=>{const{values:t,labels:n,palette:o,legend:r,hoveredArcIndex:i,setHoveredArcIndex:s,onLegendHover:a}=e,c=ye(),d=_y(t??[]),u=(h,g)=>{g&&(a?a(h):s(h))},p=()=>{a?a(null):s(null)};return f.jsx(ve,{width:"100%",alignItems:"left",className:"doughnut-chart-legend-wrapper",children:f.jsx(ve,{display:"inline-flex",justifyContent:"center",children:n.map((h,g)=>{const m=t!==void 0&&g<((t==null?void 0:t.length)??0)&&t[g]!==void 0;return f.jsx(ve,{sx:{borderBottom:"1px solid #e3e2e0","&:last-of-type":{borderBottom:"none"},padding:c.spacing(.5,0)},children:f.jsxs(ve,{direction:"row",alignItems:"center",justifyContent:"center",gap:"12px",paddingY:"8px",onMouseEnter:()=>u(g,m),onMouseLeave:()=>p(),sx:{"&:hover":{background:c.custom.grey[500]},backgroundColor:i!==g?"unset":c.custom.grey[500],padding:c.spacing(.5,.5)},className:"doughnut-chart-legend-item",children:[f.jsx(Q,{minWidth:"10px",height:"10px",bgcolor:m?o[g]:c.custom.grey[400]}),f.jsxs(ve,{direction:"row",alignItems:"center",gap:"8px",sx:{width:"100%"},children:[f.jsxs(ve,{width:"100%",display:"flex",direction:"row",alignItems:"center",justifyContent:"space-between",gap:"8px",fontWeight:400,className:"doughnut-chart-legend-item-value",children:[f.jsx(ie,{variant:"h5",className:"doughnut-chart-legend-item-label",children:h}),f.jsx(Q,{alignItems:"center",sx:{display:"flex",borderRadius:c.spacing(.75),background:c.custom.grey[400],padding:c.spacing(.25,1.25),minWidth:c.spacing(6),justifyContent:"center",fontWeight:c.typography.fontWeightMedium,fontSize:c.typography["body-medium"],whiteSpace:"nowrap"},children:m?`${d[g]} %`:"--%"})]}),(r==null?void 0:r.actions)&&(r==null?void 0:r.seeMore)&&(r==null?void 0:r.actions[g])&&f.jsx(Rp,{action:r==null?void 0:r.actions[g],seeMore:r==null?void 0:r.seeMore})]})]})},g)})})})},Ry=e=>{const{index:t,palette:n,icons:o,values:r}=e;return o&&o[t]!==void 0?f.jsx(Q,{minWidth:"28px",width:"28px",height:"28px",sx:i=>({background:n[t]||i.custom.grey[400],padding:"16px 5px",color:"#fff"}),display:"flex",alignItems:"center",borderRadius:"6px",children:o[t]}):r[t]!==void 0&&n[t]!==void 0?f.jsx(Q,{minWidth:"12px",width:"12px",height:"12px",sx:{background:n[t],color:"#fff"},display:"flex",alignItems:"center"}):null},CJ=e=>{const t=ye(),{values:n,labels:o,palette:r,icons:i=[],legend:s,setHoveredArcIndex:a,hoveredArcIndex:c,onLegendHover:d}=e,u=_y(n??[]),p=(g,m)=>{m&&(d?d(g):a(g))},h=()=>{d?d(null):a(null)};return f.jsx(ve,{alignItems:"center",justifyContent:"center",sx:{width:"100%",alignItems:"flex-start"},className:"doughnut-chart-legend-wrapper",children:f.jsx(ve,{width:"100%",children:o.map((g,m)=>{const b=!!n&&n[m]!==void 0,C=(s==null?void 0:s.actions)&&(s==null?void 0:s.seeMore)&&(s==null?void 0:s.actions[m])&&s;return f.jsx(ve,{direction:"row",alignItems:"center",gap:"12px",onMouseEnter:()=>p(m,b),onMouseLeave:()=>h(),onClick:()=>{var x,v;C&&(x=s==null?void 0:s.actions)!=null&&x[m]&&((v=s==null?void 0:s.actions)==null||v[m]())},sx:{borderBottom:"1px solid #e3e2e0","&:last-of-type":{borderBottom:"none"}},children:f.jsxs(ve,{direction:"row",gap:"8px",sx:{width:"100%",padding:".4rem",alignItems:"center",backgroundColor:c!==m?"unset":t.custom.grey[500]},className:"doughnut-chart-legend-item",children:[f.jsx(Ry,{index:m,palette:r,icons:i,values:n}),f.jsx(ie,{variant:"h5",sx:{marginLeft:"4px"},className:"doughnut-chart-legend-item-label",children:g}),g?"- ":"",f.jsx(ie,{fontWeight:400,sx:{fontSize:".8rem",display:"flex",flexDirection:"row",whiteSpace:"pre",alignItems:"center"},className:"doughnut-chart-legend-item-value",children:f.jsx(Q,{component:"span",alignItems:"center",sx:{display:"flex",borderRadius:t.spacing(.75),background:t.custom.grey[400],padding:t.spacing(.25,1.25),minWidth:t.spacing(6),justifyContent:"center",fontWeight:t.typography.fontWeightMedium,fontSize:t.typography["body-medium"],whiteSpace:"nowrap"},children:b?`${u[m]} %`:"--%"})}),C&&f.jsx(Rp,{action:s.actions[m],seeMore:s.seeMore})]})},m)})})})},xJ=e=>{const{values:t,labels:n,palette:o,legend:r,hoveredArcIndex:i,setHoveredArcIndex:s,icons:a=[],onLegendHover:c}=e,d=JSON.stringify(n);return F.useEffect(()=>{s(null)},[d,s]),!n||!n.length?null:(r==null?void 0:r.position)==="bottom"?f.jsx(bJ,{labels:n,hoveredArcIndex:i,setHoveredArcIndex:s,values:t,palette:o,legend:r,onLegendHover:c}):(r==null?void 0:r.position)==="right"?f.jsx(CJ,{labels:n,setHoveredArcIndex:s,hoveredArcIndex:i,values:t,palette:o,legend:r,icons:a,onLegendHover:c}):null};Cc.register(zs);const yJ=e=>{const{values:t,labels:n,colors:o,legend:r,children:i,valuesUnit:s,className:a,valuesFormatterFn:c,createPalette:d=!0,isLoading:u=!1,displayTotal:p=!0,fullWidthLegend:h=!1,displayTotalVariant:g="number-big",spacing:m=0,hoverOffset:b=0}=e,[C,x]=F.useState(null),[v,S]=F.useState(!1),[T,w]=F.useState(),[k,E]=F.useState(null),[O,_]=F.useState(null),[R,P]=F.useState("top"),[L,j]=F.useState(!1),V=F.useRef(null),I=F.useRef({x:null,y:null}),N=F.useRef(null),B=F.useCallback((q,J,re,G)=>{if(q!==null&&J!==null){if(I.current={x:q,y:J},V.current&&(clearTimeout(V.current),V.current=null),re!==void 0&&G!==void 0){const U=Py(q,J,re,G);P(U)}E(q),_(J)}else V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{E(null),_(null),V.current=null},50)},[]),D=F.useCallback(q=>{if(x(q),q!==null&&N.current&&t&&t.length>0){j(!0);const J=N.current.getBoundingClientRect(),re=mJ(q,t,J,{x:0,y:0});re.x&&re.y&&(I.current={x:re.x,y:re.y},E(re.x),_(re.y),P(re.placement))}else j(!1)},[t,x]);F.useEffect(()=>()=>{V.current&&clearTimeout(V.current)},[]),F.useEffect(()=>{if(!n||!t)return;const q=k!==null&&O!==null&&C!==null;q!==v&&S(q)},[n,t,k,O,C,v]);const A=ye(),$=hJ(A,100,700),Z=(r==null?void 0:r.position)??"bottom",ae=d?gJ(o&&o.length?o:$,t??[]):o??$,oe=pJ({values:t,labels:n,spacing:m,hoverOffset:b,legend:!!r,theme:A,palette:ae,hoveredArcIndex:C,setHoveredArcIndex:x,handleChartHover:B}),W=(q,J=35)=>q.length<=J?q:q.substring(0,J-3)+"...";F.useEffect(()=>{C!==null&&n&&n[C]!==void 0&&t&&t[C]!==void 0?(w(f.jsxs(ve,{direction:"column",spacing:1,children:[f.jsxs(ve,{direction:"row",alignItems:"center",spacing:1,children:[f.jsx(Ry,{index:C,palette:ae,icons:e.icons,values:t}),f.jsx(ie,{fontWeight:700,fontSize:"0.75rem",children:r!==void 0?W(n[C]):n[C]})]}),f.jsxs(ie,{fontWeight:700,sx:{fontSize:"1.5rem",lineHeight:A.spacing(1.5),pt:A.spacing(1)},children:[c?c(t[C]):t[C],s&&f.jsx(ie,{component:"span",fontWeight:500,fontSize:"0.75rem",color:ke[1400],sx:{wordBreak:"break-word",whiteSpace:"break-spaces",marginLeft:"4px"},children:s})]})]})),S(!0)):(w(null),S(!1))},[C]);const Y=p&&(t==null?void 0:t.reduce((q,J)=>q+J,0)),K=i??(p&&typeof p=="string"?p:Y);return f.jsxs(ve,{direction:Z==="bottom"?"column":"row",gap:"3rem",className:`doughnut-chart ${a}`,children:[f.jsx(ve,{children:f.jsx(Q,{position:"relative",margin:"28px auto",sx:Z==="bottom"?{maxWidth:"300px"}:{minWidth:"300px"},className:"doughnut-chart-wrapper",id:"doughnut-chart-wrapper",ref:N,children:f.jsxs(Q,{position:"relative",children:[f.jsx(RY,{...oe,style:{maxWidth:"100%"}}),v&&T&&f.jsx(Q,{sx:{position:"absolute",pointerEvents:"none",left:0,top:0,width:0,height:0,overflow:"visible",zIndex:1e3},children:f.jsx("div",{style:{position:"fixed",left:k?`${k}px`:0,top:O?`${O}px`:0,pointerEvents:"none"},children:f.jsx(ji,{open:v,align:"start",title:T,width:"220px",padding:A.spacing(2),arrow:!0,placement:R,PopperProps:{disablePortal:!0,modifiers:[{name:"preventOverflow",enabled:!0,options:{boundary:document.body}},{name:"offset",options:{offset:L?[8,0]:[0,14]}}]},children:f.jsx("div",{})})})}),f.jsx(Q,{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:f.jsx(Q,{display:"flex",flexDirection:"column",children:u?f.jsx(Ps,{}):f.jsxs(f.Fragment,{children:[f.jsx(ie,{variant:g,children:K},"content-1"),s?p&&f.jsx(Q,{sx:{color:ke[1400]},children:s}):f.jsx(f.Fragment,{})]})})})]})})}),f.jsx(Q,{display:"flex",width:h?"100%":"inherit",onMouseEnter:()=>S(!1),sx:{width:h?"100%":"inherit"},children:f.jsx(xJ,{labels:n,hoveredArcIndex:C,setHoveredArcIndex:x,values:t,palette:ae,legend:r,icons:e.icons,onLegendHover:D})})]})};/*!
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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "0.5.13",
4
+ "version": "0.5.15",
5
5
  "type": "module",
6
6
  "main": "./dist/main.umd.cjs",
7
7
  "module": "./dist/main.js",