BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chart.min.js 164KB

12345678910111213
  1. /*!
  2. * Chart.js v3.0.0-beta.7
  3. * https://www.chartjs.org
  4. * (c) 2020 Chart.js Contributors
  5. * Released under the MIT License
  6. */
  7. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";const t="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function e(e,i,n){const o=n||(t=>Array.prototype.slice.call(t));let s=!1,a=[];return function(...n){a=o(n),s||(s=!0,t.call(window,(()=>{s=!1,e.apply(i,a)})))}}var i=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n]||[],s=e.duration;o.forEach((n=>n({chart:t,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){const e=this;e._request||(e._running=!0,e._request=t.call(window,(()=>{e._update(),e._request=null,e._running&&e._refresh()})))}_update(){const t=this,e=Date.now();let i=0;t._charts.forEach(((n,o)=>{if(!n.running||!n.items.length)return;const s=n.items;let a,r=s.length-1,l=!1;for(;r>=0;--r)a=s[r],a._active?(a.tick(e),l=!0):(s[r]=s[s.length-1],s.pop());l&&(o.draw(),t._notify(o,n,e,"progress")),o.options.animation.debug&&function(t,e,i,n){const o=1e3/(i-n)|0,s=t.ctx;s.save(),s.clearRect(0,0,50,24),s.fillStyle="black",s.textAlign="right",e&&(s.fillText(e,50,8),s.fillText(o+" fps",50,18)),s.restore()}(o,s.length,e,t._lastDate),s.length||(n.running=!1,t._notify(o,n,e,"complete")),i+=s.length})),t._lastDate=e,0===i&&(t._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};function n(){}const o=function(){let t=0;return function(){return t++}}();function s(t){return null==t}function a(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.substr(0,7)&&"Array]"===e.substr(-6)}function r(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const l=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function c(t,e){return l(t)?t:e}function h(t,e){return void 0===t?e:t}function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function u(t,e,i,n){let o,s,l;if(a(t))if(s=t.length,n)for(o=s-1;o>=0;o--)e.call(i,t[o],o);else for(o=0;o<s;o++)e.call(i,t[o],o);else if(r(t))for(l=Object.keys(t),s=l.length,o=0;o<s;o++)e.call(i,t[l[o]],l[o])}function g(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function f(t){if(a(t))return t.map(f);if(r(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=f(t[i[o]]);return e}return t}function p(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function m(t,e,i,n){if(!p(t))return;const o=e[t],s=i[t];r(o)&&r(s)?x(o,s,n):e[t]=f(s)}function x(t,e,i){const n=a(e)?e:[e],o=n.length;if(!r(t))return t;const s=(i=i||{}).merger||m;for(let a=0;a<o;++a){if(!r(e=n[a]))continue;const o=Object.keys(e);for(let n=0,a=o.length;n<a;++n)s(o[n],t,e,i)}return t}function b(t,e){return x(t,e,{merger:_})}function _(t,e,i){if(!p(t))return;const n=e[t],o=i[t];r(n)&&r(o)?b(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=f(o))}function y(t,e){if("x"===e)return t.x;if("y"===e)return t.y;const i=e.split(".");for(let e=0,n=i.length;e<n&&t;++e){const n=i[e];if(!n)break;t=t[n]}return t}function v(t){return t.charAt(0).toUpperCase()+t.slice(1)}function M(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}var w=new class{constructor(){this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.controllers={},this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={onHover:null},this.interaction={mode:"nearest",intersect:!0},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0}set(t,e){return"string"==typeof t?x(M(this,t),e):x(M(this,""),t)}get(t){return M(this,t)}route(t,e,i,n){const o=M(this,t),s=M(this,i),a="_"+e;Object.defineProperties(o,{[a]:{writable:!0},[e]:{enumerable:!0,get(){return h(this[a],s[n])},set(t){this[a]=t}}})}};const k=Math.PI,P=2*k,S=P+k,D=Number.POSITIVE_INFINITY,O=k/180,T=k/2,A=k/4,C=2*k/3;function L(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}const R=Math.log10||function(t){const e=Math.log(t)*Math.LOG10E,i=Math.round(e);return t===Math.pow(10,i)?i:e};function E(t){return!isNaN(parseFloat(t))&&isFinite(t)}function F(t,e,i){return Math.abs(t-e)<i}function z(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function I(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}const V=Math.sign?function(t){return Math.sign(t)}:function(t){return 0===(t=+t)||isNaN(t)?t:t>0?1:-1};function B(t){return t*(k/180)}function W(t){return t*(180/k)}function N(t){if(!l(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function H(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*k&&(s+=P),{angle:s,distance:o}}function j(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Y(t,e){return(t-e+S)%P-k}function U(t){return(t%P+P)%P}function $(t,e,i){const n=U(t),o=U(e),s=U(i),a=U(o-n),r=U(s-n),l=U(n-o),c=U(n-s);return n===o||n===s||a>r&&l<c}function X(t,e,i){return Math.max(e,Math.min(i,t))}function K(t){return X(t,-32768,32767)}function q(t){return!t||s(t.size)||s(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function G(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function Z(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const l=i.length;let c,h,d,u,g;for(c=0;c<l;c++)if(u=i[c],null!=u&&!0!==a(u))r=G(t,o,s,r,u);else if(a(u))for(h=0,d=u.length;h<d;h++)g=u[h],null==g||a(g)||(r=G(t,o,s,r,g));t.restore();const f=s.length/2;if(f>i.length){for(c=0;c<f;c++)delete o[s[c]];s.splice(0,f)}return r}function Q(t,e,i){const n=t.currentDevicePixelRatio,o=i/2;return Math.round((e-o)*n)/n+o}function J(t){t.ctx.clearRect(0,0,t.width,t.height)}function tt(t,e,i,n){let o,s,a,r,l;const c=e.pointStyle,h=e.rotation,d=e.radius;let u=(h||0)*O;if(c&&"object"==typeof c&&(o=c.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,n),t.rotate(u),t.drawImage(c,-c.width/2,-c.height/2,c.width,c.height),void t.restore();if(!(isNaN(d)||d<=0)){switch(t.beginPath(),c){default:t.arc(i,n,d,0,P),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(u)*d,n-Math.cos(u)*d),u+=C,t.lineTo(i+Math.sin(u)*d,n-Math.cos(u)*d),u+=C,t.lineTo(i+Math.sin(u)*d,n-Math.cos(u)*d),t.closePath();break;case"rectRounded":l=.516*d,r=d-l,s=Math.cos(u+A)*r,a=Math.sin(u+A)*r,t.arc(i-s,n-a,l,u-k,u-T),t.arc(i+a,n-s,l,u-T,u),t.arc(i+s,n+a,l,u,u+T),t.arc(i-a,n+s,l,u+T,u+k),t.closePath();break;case"rect":if(!h){r=Math.SQRT1_2*d,t.rect(i-r,n-r,2*r,2*r);break}u+=A;case"rectRot":s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+a,n-s),t.lineTo(i+s,n+a),t.lineTo(i-a,n+s),t.closePath();break;case"crossRot":u+=A;case"cross":s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+s,n+a),t.moveTo(i+a,n-s),t.lineTo(i-a,n+s);break;case"star":s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+s,n+a),t.moveTo(i+a,n-s),t.lineTo(i-a,n+s),u+=A,s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+s,n+a),t.moveTo(i+a,n-s),t.lineTo(i-a,n+s);break;case"line":s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+s,n+a);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(u)*d,n+Math.sin(u)*d)}t.fill(),e.borderWidth>0&&t.stroke()}}function et(t,e){const i=.5;return t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function it(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function nt(t){t.restore()}function ot(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function st(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.controlPointPreviousX:e.controlPointNextX,n?e.controlPointPreviousY:e.controlPointNextY,n?i.controlPointNextX:i.controlPointPreviousX,n?i.controlPointNextY:i.controlPointPreviousY,i.x,i.y)}function at(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)n=s+o>>1,i(n)?s=n:o=n;return{lo:s,hi:o}}const rt=(t,e,i)=>at(t,i,(n=>t[n][e]<i)),lt=(t,e,i)=>at(t,i,(n=>t[n][e]>=i));function ct(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}const ht=["push","pop","shift","splice","unshift"];function dt(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ht.forEach((e=>{const i="_onData"+v(e),n=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const o=n.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),o}})})))}function ut(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(ht.forEach((e=>{delete t[e]})),delete t._chartjs)}function gt(t){const e=new Set;let i,n;for(i=0,n=t.length;i<n;++i)e.add(t[i]);if(e.size===n)return t;const o=[];return e.forEach((t=>{o.push(t)})),o}function ft(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function pt(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const mt=t=>window.getComputedStyle(t,null);function xt(t,e){return mt(t).getPropertyValue(e)}const bt=["top","right","bottom","left"];function _t(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=bt[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}function yt(t,e){const{canvas:i,currentDevicePixelRatio:n}=e,o=mt(i),s="border-box"===o.boxSizing,a=_t(o,"padding"),r=_t(o,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.originalEvent||t,n=i.touches,o=n&&n.length?n[0]:i,{offsetX:s,offsetY:a}=o;let r,l,c=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(s,a,i.target))r=s,l=a;else{const t=e.getBoundingClientRect();r=o.clientX-t.left,l=o.clientY-t.top,c=!0}return{x:r,y:l,box:c}}(t,i),d=a.left+(h&&r.left),u=a.top+(h&&r.top);let{width:g,height:f}=e;return s&&(g-=a.width+r.width,f-=a.height+r.height),{x:Math.round((l-d)/g*i.width/n),y:Math.round((c-u)/f*i.height/n)}}function vt(t,e,i,n){const o=mt(t),s=_t(o,"margin"),a=pt(o.maxWidth,t,"clientWidth")||D,r=pt(o.maxHeight,t,"clientHeight")||D,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=ft(t);if(s){const t=s.getBoundingClientRect(),a=mt(s),r=_t(a,"border","width"),l=_t(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,n=pt(a.maxWidth,s,"clientWidth"),o=pt(a.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||D,maxHeight:o||D}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=_t(o,"border","width"),e=_t(o,"padding");c-=e.width+t.width,h-=e.height+t.height}return c=Math.max(0,c-s.width),h=Math.max(0,n?Math.floor(c/n):h-s.height),{width:Math.min(c,a,l.maxWidth),height:Math.min(h,r,l.maxHeight)}}function Mt(t,e){const i=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1,{canvas:n,width:o,height:s}=t;n.height=s*i,n.width=o*i,t.ctx.setTransform(i,0,0,i,0,0),!n.style||n.style.height||n.style.width||(n.style.height=s+"px",n.style.width=o+"px")}const wt=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function kt(t,e){const i=xt(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Pt(t,e){return"native"in t?{x:t.x,y:t.y}:yt(t,e)}function St(t,e,i,n){const{controller:o,data:s,_sorted:a}=t,r=o._cachedMeta.iScale;if(r&&e===r.axis&&a&&s.length){const t=r._reversePixels?lt:rt;if(!n)return t(s,e,i);if(o._sharedOptions){const n=s[0],o="function"==typeof n.getRange&&n.getRange(e);if(o){const n=t(s,e,i-o),a=t(s,e,i+o);return{lo:n.lo,hi:a.hi}}}}return{lo:0,hi:s.length-1}}function Dt(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:r}=s[t],{lo:l,hi:c}=St(s[t],e,a,o);for(let t=l;t<=c;++t){const e=r[t];e.skip||n(e,i,t)}}}function Ot(t,e,i,n){const o=[];if(!et(e,t.chartArea))return o;return Dt(t,i,e,(function(t,i,s){t.inRange(e.x,e.y,n)&&o.push({element:t,datasetIndex:i,index:s})}),!0),o}function Tt(t,e,i,n,o){const s=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let a=Number.POSITIVE_INFINITY,r=[];if(!et(e,t.chartArea))return r;return Dt(t,i,e,(function(t,i,l){if(n&&!t.inRange(e.x,e.y,o))return;const c=t.getCenterPoint(o),h=s(e,c);h<a?(r=[{element:t,datasetIndex:i,index:l}],a=h):h===a&&r.push({element:t,datasetIndex:i,index:l})})),r}function At(t,e,i,n){const o=Pt(e,t),s=[],a=i.axis,r="x"===a?"inXRange":"inYRange";let l=!1;return function(t,e){const i=t.getSortedVisibleDatasetMetas();let n,o,s;for(let t=0,a=i.length;t<a;++t){({index:n,data:o}=i[t]);for(let t=0,i=o.length;t<i;++t)s=o[t],s.skip||e(s,n,t)}}(t,((t,e,i)=>{t[r](o[a],n)&&s.push({element:t,datasetIndex:e,index:i}),t.inRange(o.x,o.y,n)&&(l=!0)})),i.intersect&&!l?[]:s}var Ct={modes:{index(t,e,i,n){const o=Pt(e,t),s=i.axis||"x",a=i.intersect?Ot(t,o,s,n):Tt(t,o,s,!1,n),r=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&r.push({element:i,datasetIndex:t.index,index:e})})),r):[]},dataset(t,e,i,n){const o=Pt(e,t),s=i.axis||"xy";let a=i.intersect?Ot(t,o,s,n):Tt(t,o,s,!1,n);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,n)=>Ot(t,Pt(e,t),i.axis||"xy",n),nearest:(t,e,i,n)=>Tt(t,Pt(e,t),i.axis||"xy",i.intersect,n),x:(t,e,i,n)=>(i.axis="x",At(t,e,i,n)),y:(t,e,i,n)=>(i.axis="y",At(t,e,i,n))}};function Lt(t,e){const i=(""+t).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const Rt=t=>+t||0;function Et(t){let e,i,n,o;return r(t)?(e=Rt(t.top),i=Rt(t.right),n=Rt(t.bottom),o=Rt(t.left)):e=i=n=o=Rt(t),{top:e,right:i,bottom:n,left:o}}function Ft(t){let e,i,n,o;return r(t)?(e=Rt(t.topLeft),i=Rt(t.topRight),n=Rt(t.bottomLeft),o=Rt(t.bottomRight)):e=i=n=o=Rt(t),{topLeft:e,topRight:i,bottomLeft:n,bottomRight:o}}function zt(t){const e=Et(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function It(t,e){t=t||{},e=e||w.font;let i=h(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));const n={family:h(t.family,e.family),lineHeight:Lt(h(t.lineHeight,e.lineHeight),i),size:i,style:h(t.style,e.style),weight:h(t.weight,e.weight),string:""};return n.string=q(n),n}function Vt(t,e,i,n){let o,s,r,l=!0;for(o=0,s=t.length;o<s;++o)if(r=t[o],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),l=!1),void 0!==i&&a(r)&&(r=r[i%r.length],l=!1),void 0!==r))return n&&!l&&(n.cacheable=!1),r}const Bt=["left","top","right","bottom"];function Wt(t,e){return t.filter((t=>t.pos===e))}function Nt(t,e){return t.filter((t=>-1===Bt.indexOf(t.pos)&&t.box.axis===e))}function Ht(t,e){return t.sort(((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight}))}function jt(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function Yt(t,e,i){const n=i.box,o=t.maxPadding;if(r(i.pos))return;if(i.size&&(t[i.pos]-=i.size),i.size=i.horizontal?n.height:n.width,t[i.pos]+=i.size,n.getPadding){const t=n.getPadding();o.top=Math.max(o.top,t.top),o.left=Math.max(o.left,t.left),o.bottom=Math.max(o.bottom,t.bottom),o.right=Math.max(o.right,t.right)}const s=e.outerWidth-jt(o,t,"left","right"),a=e.outerHeight-jt(o,t,"top","bottom");return s!==t.w||a!==t.h?(t.w=s,t.h=a,i.horizontal?s!==t.w:a!==t.h):void 0}function Ut(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}return n(t?["left","right"]:["top","bottom"])}function $t(t,e,i){const n=[];let o,s,a,r,l,c;for(o=0,s=t.length;o<s;++o)a=t[o],r=a.box,r.update(a.width||e.w,a.height||e.h,Ut(a.horizontal,e)),Yt(e,i,a)&&(c=!0,n.length&&(l=!0)),r.fullWidth||n.push(a);return l&&$t(n,e,i)||c}function Xt(t,e,i){const n=i.padding;let o,s,a,r,l=e.x,c=e.y;for(o=0,s=t.length;o<s;++o)a=t[o],r=a.box,a.horizontal?(r.left=r.fullWidth?n.left:e.left,r.right=r.fullWidth?i.outerWidth-n.right:e.left+e.w,r.top=c,r.bottom=c+r.height,r.width=r.right-r.left,c=r.bottom):(r.left=l,r.right=l+r.width,r.top=r.fullWidth?n.top:e.top,r.bottom=r.fullWidth?i.outerHeight-n.right:e.top+e.h,r.height=r.bottom-r.top,l=r.right);e.x=l,e.y=c}w.set("layout",{padding:{top:0,right:0,bottom:0,left:0}});var Kt={addBox(t,e){t.boxes||(t.boxes=[]),e.fullWidth=e.fullWidth||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){const n=["fullWidth","position","weight"],o=n.length;let s,a=0;for(;a<o;++a)s=n[a],Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])},update(t,e,i){if(!t)return;const n=t.options.layout||{},o={chart:t},s=zt(Vt([n.padding],o)),a=e-s.width,r=i-s.height,l=function(t){const e=function(t){const e=[];let i,n,o;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],e.push({index:i,box:o,pos:o.position,horizontal:o.isHorizontal(),weight:o.weight});return e}(t),i=Ht(Wt(e,"left"),!0),n=Ht(Wt(e,"right")),o=Ht(Wt(e,"top"),!0),s=Ht(Wt(e,"bottom")),a=Nt(e,"x"),r=Nt(e,"y");return{leftAndTop:i.concat(o),rightAndBottom:n.concat(r).concat(s).concat(a),chartArea:Wt(e,"chartArea"),vertical:i.concat(n).concat(r),horizontal:o.concat(s).concat(a)}}(t.boxes),c=l.vertical,h=l.horizontal,d=Object.freeze({outerWidth:e,outerHeight:i,padding:s,availableWidth:a,availableHeight:r,vBoxMaxWidth:a/2/c.length,hBoxMaxHeight:r/2}),g=Object.assign({maxPadding:Object.assign({},s),w:a,h:r,x:s.left,y:s.top},s);!function(t,e){let i,n,o;for(i=0,n=t.length;i<n;++i)o=t[i],o.horizontal?(o.width=o.box.fullWidth&&e.availableWidth,o.height=e.hBoxMaxHeight):(o.width=e.vBoxMaxWidth,o.height=o.box.fullWidth&&e.availableHeight)}(c.concat(h),d),$t(c,g,d),$t(h,g,d)&&$t(c,g,d),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(g),Xt(l.leftAndTop,g,d),g.x+=g.w,g.y+=g.h,Xt(l.rightAndBottom,g,d),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},u(l.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(g.w,g.h)}))}};class qt{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}}class Gt extends qt{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}}const Zt={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Qt=t=>null===t||""===t;const Jt=!!wt&&{passive:!0};function te(t,e,i){t.canvas.removeEventListener(e,i,Jt)}function ee(t,e,i){const n=t.canvas,o=n&&ft(n)||n,s=new MutationObserver((t=>{const e=ft(o);t.forEach((t=>{for(let n=0;n<t.addedNodes.length;n++){const s=t.addedNodes[n];s!==o&&s!==e||i(t.target)}}))}));return s.observe(document,{childList:!0,subtree:!0}),s}function ie(t,e,i){const n=t.canvas,o=n&&ft(n);if(!o)return;const s=new MutationObserver((t=>{t.forEach((t=>{for(let e=0;e<t.removedNodes.length;e++)if(t.removedNodes[e]===n){i();break}}))}));return s.observe(o,{childList:!0}),s}const ne=new Map;let oe=0;function se(){const t=window.devicePixelRatio;t!==oe&&(oe=t,ne.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ae(t,i,n){const o=t.canvas,s=o&&ft(o);if(!s)return;const a=e(((t,e)=>{const i=s.clientWidth;n(t,e),i<s.clientWidth&&n()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||a(i,n)}));return r.observe(s),function(t,e){ne.size||window.addEventListener("resize",se),ne.set(t,e)}(t,a),r}function re(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){ne.delete(t),ne.size||window.removeEventListener("resize",se)}(t)}function le(t,i,n){const o=t.canvas,s=e((e=>{null!==t.ctx&&n(function(t,e){const i=Zt[t.type]||t.type,{x:n,y:o}=yt(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,Jt)}(o,i,s),s}class ce extends qt{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t.$chartjs={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Qt(o)){const e=kt(t,"width");void 0!==e&&(t.width=e)}if(Qt(n))if(""===t.style.height)t.height=t.width/(e.options.aspectRatio||2);else{const e=kt(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const i=e.$chartjs.initial;["height","width"].forEach((t=>{const n=i[t];s(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:ee,detach:ie,resize:ae}[e]||le;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:re,detach:re,resize:re}[e]||te)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return vt(t,e,i,n)}isAttached(t){const e=ft(t);return!(!e||!ft(e))}}var he=Object.freeze({__proto__:null,BasePlatform:qt,BasicPlatform:Gt,DomPlatform:ce});const de={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*T),easeOutSine:t=>Math.sin(t*T),easeInOutSine:t=>-.5*(Math.cos(k*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t)),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic(t){let e=1.70158,i=0;return 0===t?0:1===t?1:(i||(i=.3),e=i/P*Math.asin(1),-1*Math.pow(2,10*(t-=1))*Math.sin((t-e)*P/i))},easeOutElastic(t){let e=1.70158,i=0;return 0===t?0:1===t?1:(i||(i=.3),e=i/P*Math.asin(1),1*Math.pow(2,-10*t)*Math.sin((t-e)*P/i)+1)},easeInOutElastic(t){let e=1.70158,i=0;return 0===t?0:2==(t/=.5)?1:(i||(i=.45),e=i/P*Math.asin(1),t<1?1*Math.pow(2,10*(t-=1))*Math.sin((t-e)*P/i)*-.5:1*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*P/i)*.5+1)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-de.easeOutBounce(1-t),easeOutBounce:t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,easeInOutBounce:t=>t<.5?.5*de.easeInBounce(2*t):.5*de.easeOutBounce(2*t-1)+.5},ue={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ge="0123456789ABCDEF",fe=t=>ge[15&t],pe=t=>ge[(240&t)>>4]+ge[15&t],me=t=>(240&t)>>4==(15&t);
  8. /*!
  9. * @kurkle/color v0.1.9
  10. * https://github.com/kurkle/color#readme
  11. * (c) 2020 Jukka Kurkela
  12. * Released under the MIT License
  13. */function xe(t){var e=function(t){return me(t.r)&&me(t.g)&&me(t.b)&&me(t.a)}(t)?fe:pe;return t?"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):""):t}function be(t){return t+.5|0}const _e=(t,e,i)=>Math.max(Math.min(t,i),e);function ye(t){return _e(be(2.55*t),0,255)}function ve(t){return _e(be(255*t),0,255)}function Me(t){return _e(be(t/2.55)/100,0,1)}function we(t){return _e(be(100*t),0,100)}const ke=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Pe=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Se(t,e,i){const n=e*Math.min(i,1-i),o=(e,o=(e+t/30)%12)=>i-n*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function De(t,e,i){const n=(n,o=(n+t/60)%6)=>i-i*e*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Oe(t,e,i){const n=Se(t,1,.5);let o;for(e+i>1&&(o=1/(e+i),e*=o,i*=o),o=0;o<3;o++)n[o]*=1-e-i,n[o]+=e;return n}function Te(t){const e=t.r/255,i=t.g/255,n=t.b/255,o=Math.max(e,i,n),s=Math.min(e,i,n),a=(o+s)/2;let r,l,c;return o!==s&&(c=o-s,l=a>.5?c/(2-o-s):c/(o+s),r=o===e?(i-n)/c+(i<n?6:0):o===i?(n-e)/c+2:(e-i)/c+4,r=60*r+.5),[0|r,l||0,a]}function Ae(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(ve)}function Ce(t,e,i){return Ae(Se,t,e,i)}function Le(t){return(t%360+360)%360}function Re(t){const e=Pe.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?ye(+e[5]):ve(+e[5]));const o=Le(+e[2]),s=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Ae(Oe,t,e,i)}(o,s,a):"hsv"===e[1]?function(t,e,i){return Ae(De,t,e,i)}(o,s,a):Ce(o,s,a),{r:i[0],g:i[1],b:i[2],a:n}}const Ee={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Fe={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let ze;function Ie(t){ze||(ze=function(){const t={},e=Object.keys(Fe),i=Object.keys(Ee);let n,o,s,a,r;for(n=0;n<e.length;n++){for(a=r=e[n],o=0;o<i.length;o++)s=i[o],r=r.replace(s,Ee[s]);s=parseInt(Fe[a],16),t[r]=[s>>16&255,s>>8&255,255&s]}return t}(),ze.transparent=[0,0,0,0]);const e=ze[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}function Ve(t,e,i){if(t){let n=Te(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=Ce(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function Be(t,e){return t?Object.assign(e||{},t):t}function We(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=ve(t[3]))):(e=Be(t,{r:0,g:0,b:0,a:1})).a=ve(e.a),e}function Ne(t){return"r"===t.charAt(0)?function(t){const e=ke.exec(t);let i,n,o,s=255;if(e){if(e[7]!==i){const t=+e[7];s=255&(e[8]?ye(t):255*t)}return i=+e[1],n=+e[3],o=+e[5],i=255&(e[2]?ye(i):i),n=255&(e[4]?ye(n):n),o=255&(e[6]?ye(o):o),{r:i,g:n,b:o,a:s}}}(t):Re(t)}class He{constructor(t){if(t instanceof He)return t;const e=typeof t;let i;var n,o,s;"object"===e?i=We(t):"string"===e&&(s=(n=t).length,"#"===n[0]&&(4===s||5===s?o={r:255&17*ue[n[1]],g:255&17*ue[n[2]],b:255&17*ue[n[3]],a:5===s?17*ue[n[4]]:255}:7!==s&&9!==s||(o={r:ue[n[1]]<<4|ue[n[2]],g:ue[n[3]]<<4|ue[n[4]],b:ue[n[5]]<<4|ue[n[6]],a:9===s?ue[n[7]]<<4|ue[n[8]]:255})),i=o||Ie(t)||Ne(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Be(this._rgb);return t&&(t.a=Me(t.a)),t}set rgb(t){this._rgb=We(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${Me(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):this._rgb;var t}hexString(){return this._valid?xe(this._rgb):this._rgb}hslString(){return this._valid?function(t){if(!t)return;const e=Te(t),i=e[0],n=we(e[1]),o=we(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${o}%, ${Me(t.a)})`:`hsl(${i}, ${n}%, ${o}%)`}(this._rgb):this._rgb}mix(t,e){const i=this;if(t){const n=i.rgb,o=t.rgb;let s;const a=e===s?.5:e,r=2*a-1,l=n.a-o.a,c=((r*l==-1?r:(r+l)/(1+r*l))+1)/2;s=1-c,n.r=255&c*n.r+s*o.r+.5,n.g=255&c*n.g+s*o.g+.5,n.b=255&c*n.b+s*o.b+.5,n.a=a*n.a+(1-a)*o.a,i.rgb=n}return i}clone(){return new He(this.rgb)}alpha(t){return this._rgb.a=ve(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=be(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Ve(this._rgb,2,t),this}darken(t){return Ve(this._rgb,2,-t),this}saturate(t){return Ve(this._rgb,1,t),this}desaturate(t){return Ve(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Te(t);i[0]=Le(i[0]+e),i=Ce(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function je(t){return new He(t)}const Ye=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function Ue(t){return Ye(t)?t:je(t)}function $e(t){return Ye(t)?t:je(t).saturate(.5).darken(.1).hexString()}const Xe="transparent",Ke={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=Ue(t||Xe),o=n.valid&&Ue(e||Xe);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class qe{constructor(t,e,i,n){const o=e[i];n=Vt([t.to,n,o,t.from]);const s=Vt([t.from,o,n]);this._active=!0,this._fn=t.fn||Ke[t.type||typeof s],this._easing=de[t.easing||"linear"],this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){const n=this;if(n._active){const o=n._target[n._prop],s=i-n._start,a=n._duration-s;n._start=i,n._duration=Math.floor(Math.max(a,t.duration)),n._loop=!!t.loop,n._to=Vt([t.to,e,o,t.from]),n._from=Vt([t.from,o,e])}}cancel(){const t=this;t._active&&(t.tick(Date.now()),t._active=!1,t._notify(!1))}tick(t){const e=this,i=t-e._start,n=e._duration,o=e._prop,s=e._from,a=e._loop,r=e._to;let l;if(e._active=s!==r&&(a||i<n),!e._active)return e._target[o]=r,void e._notify(!0);i<0?e._target[o]=s:(l=i/n%2,l=a&&l>1?2-l:l,l=e._easing(Math.min(1,Math.max(0,l))),e._target[o]=e._fn(s,r,l))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}const Ge=["borderColor","backgroundColor"];w.set("animation",{duration:1e3,easing:"easeOutQuart",onProgress:n,onComplete:n,colors:{type:"color",properties:Ge},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]},active:{duration:400},resize:{duration:0},show:{colors:{type:"color",properties:Ge,from:"transparent"},visible:{type:"boolean",duration:0}},hide:{colors:{type:"color",properties:Ge,to:"transparent"},visible:{type:"boolean",easing:"easeInExpo"}}});class Ze{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!r(t))return;const e=this._properties,i=function(t){const e={};return Object.keys(t).forEach((i=>{const n=t[i];r(n)||(e[i]=n)})),e}(t);Object.keys(t).forEach((n=>{const o=t[n];r(o)&&(o.properties||[n]).forEach((t=>{if(e.has(t)){if(t===n){const{properties:i,...n}=e.get(t);e.set(t,Object.assign({},n,o))}}else e.set(t,Object.assign({},i,o))}))}))}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&!e.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&!n.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i})),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),a=Date.now();let r;for(r=s.length-1;r>=0;--r){const l=s[r];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=o[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,a);continue}h.cancel()}d&&d.duration?(o[l]=h=new qe(d,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return function(t,e){const i=t.options,n=e.options;i&&n&&(i.$shared&&!n.$shared?t.options=Object.assign({},i,n,{$shared:!1}):Object.assign(i,n),delete e.options)}(t,e),void Object.assign(t,e);const n=this._createAnimations(t,e);return n.length?(i.add(this._chart,n),!0):void 0}}function Qe(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function Je(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function ti(t,e,i,n){const o=t.keys;let s,a,r,l;for(s=0,a=o.length;s<a;++s){if(r=+o[s],r===i){if(n)continue;break}l=t.values[r],isNaN(l)||0!==e&&V(e)!==V(l)||(e+=l)}return e}function ei(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function ii(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function ni(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:a,index:r}=n,l=s.axis,c=a.axis,h=function(t,e,i){return t.id+"."+e.id+"."+i.stack+"."+i.type}(s,a,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:n,[c]:s}=i;u=(i._stacks||(i._stacks={}))[c]=ii(o,h,n),u[r]=s}}function oi(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function si(t,e){(e=e||t._parsed).forEach((e=>{delete e._stacks[t.vScale.id][t.index]}))}const ai=(t,e)=>e?"hover"+v(t):t,ri=t=>"reset"===t||"none"===t;class li{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedAnimations={},this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this._config=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.$context=void 0,this.initialize()}initialize(){const t=this,e=t._cachedMeta;t.configure(),t.linkScales(),e._stacked=ei(e.vScale,e),t.addElements()}updateIndex(t){this.index=t}linkScales(){const t=this,e=t.chart,i=t._cachedMeta,n=t.getDataset(),o=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,s=i.xAxisID=h(n.xAxisID,oi(e,"x")),a=i.yAxisID=h(n.yAxisID,oi(e,"y")),r=i.rAxisID=h(n.rAxisID,oi(e,"r")),l=i.indexAxis,c=i.iAxisID=o(l,s,a,r),d=i.vAxisID=o(l,a,s,r);i.xScale=t.getScaleForId(s),i.yScale=t.getScaleForId(a),i.rScale=t.getScaleForId(r),i.iScale=t.getScaleForId(c),i.vScale=t.getScaleForId(d)}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 e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ut(this._data,this),t._stacked&&si(t)}_dataCheck(){const t=this,e=t.getDataset(),i=e.data||(e.data=[]);r(i)?t._data=function(t){const e=Object.keys(t),i=new Array(e.length);let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n],i[n]={x:s,y:t[s]};return i}(i):t._data!==i&&(t._data&&ut(t._data,t),i&&Object.isExtensible(i)&&dt(i,t),t._data=i)}addElements(){const t=this,e=t._cachedMeta;t._dataCheck();const i=t._data,n=e.data=new Array(i.length);for(let e=0,o=i.length;e<o;++e)n[e]=new t.dataElementType;t.datasetElementType&&(e.dataset=new t.datasetElementType)}buildOrUpdateElements(){const t=this,e=t._cachedMeta,i=t.getDataset();let n=!1;t._dataCheck(),e._stacked=ei(e.vScale,e),e.stack!==i.stack&&(n=!0,si(e),e.stack=i.stack),t._resyncElements(),n&&ni(t,e._parsed)}configure(){const t=this;t._config=x(Object.create(null),[w.controllers[t._type].datasets,(t.chart.options.datasets||{})[t._type],t.getDataset()],{merger(t,e,i){"data"!==t&&m(t,e,i)}}),t._parsing=Vt([t._config.parsing,t.chart.options.parsing,!0])}parse(t,e){const i=this,{_cachedMeta:n,_data:o}=i,{iScale:s,vScale:l,_stacked:c}=n,h=s.axis;let d,u,g,f,p=!0;if(t>0&&(p=n._sorted,f=n._parsed[t-1]),!1===i._parsing)n._parsed=o,n._sorted=!0;else{u=a(o[t])?i.parseArrayData(n,o,t,e):r(o[t])?i.parseObjectData(n,o,t,e):i.parsePrimitiveData(n,o,t,e);const s=()=>isNaN(g[h])||f&&g[h]<f[h];for(d=0;d<e;++d)n._parsed[d+t]=g=u[d],p&&(s()&&(p=!1),f=g);n._sorted=p}c&&ni(i,u),s.invalidateCaches(),l.invalidateCaches()}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,a=o.axis,r=s.axis,l=o.getLabels(),c=o===s,h=new Array(n);let d,u,g;for(d=0,u=n;d<u;++d)g=d+i,h[d]={[a]:c||o.parse(l[g],g),[r]:s.parse(e[g],g)};return h}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,a=new Array(n);let r,l,c,h;for(r=0,l=n;r<l;++r)c=r+i,h=e[c],a[r]={x:o.parse(h[0],c),y:s.parse(h[1],c)};return a}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(n);let c,h,d,u;for(c=0,h=n;c<h;++c)d=c+i,u=e[d],l[c]={x:o.parse(y(u,a),d),y:s.parse(y(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e){const i=this.chart,n=this._cachedMeta,o=e[t.axis];return ti({keys:Je(i,!0),values:e._stacks[t.axis]},o,n.index)}updateRangeFromParsed(t,e,i,n){let o=i[e.axis];const s=n&&i._stacks[e.axis];n&&s&&(n.values=s,t.min=Math.min(t.min,o),t.max=Math.max(t.max,o),o=ti(n,o,this._cachedMeta.index,!0)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this,n=i._cachedMeta,o=n._parsed,s=n._sorted&&t===n.iScale,a=o.length,r=i._getOtherScale(t),l=e&&n._stacked&&{keys:Je(i.chart,!0),values:null},c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let u,g,f,p;function m(){return f=o[u],g=f[t.axis],p=f[r.axis],isNaN(g)||isNaN(p)||h>p||d<p}for(u=0;u<a&&(m()||(i.updateRangeFromParsed(c,t,f,l),!s));++u);if(s)for(u=a-1;u>=0;--u)if(!m()){i.updateRangeFromParsed(c,t,f,l);break}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],isNaN(s)||i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this,i=e._cachedMeta;e.configure(),e._cachedAnimations={},e._cachedDataOpts={},e.update(t||"default"),i._clip=function(t){let e,i,n,o;return r(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o}}(h(e._config.clip,function(t,e,i){if(!1===i)return!1;const n=Qe(t,i),o=Qe(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(i.xScale,i.yScale,e.getMaxOverflow())))}update(t){}draw(){const t=this,e=t._ctx,i=t.chart,n=t._cachedMeta,o=n.data||[],s=i.chartArea,a=[],r=t._drawStart||0,l=t._drawCount||o.length-r;let c;for(n.dataset&&n.dataset.draw(e,s,r,l),c=r;c<r+l;++c){const t=o[c];t.active?a.push(t):t.draw(e,s)}for(c=0;c<a.length;++c)a[c].draw(e,s)}_addAutomaticHoverColors(t,e){const i=this.getStyle(t),n=Object.keys(i).filter((t=>-1!==t.indexOf("Color")&&!(t in e)));let o,s=n.length-1;for(;s>=0;s--)o=n[s],e[o]=$e(i[o])}getStyle(t,e){const i=this,n=i._cachedMeta.dataset;i._config||i.configure();const o=n&&void 0===t?i.resolveDatasetElementOptions(e):i.resolveDataElementOptions(t||0,e&&"active");return e&&i._addAutomaticHoverColors(t,o),o}getContext(t,e){const i=this;let n;if(t>=0&&t<i._cachedMeta.data.length){const e=i._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i,n){return Object.create(t,{active:{writable:!0,value:!1},dataIndex:{value:e},dataPoint:{value:i},element:{value:n},index:{get(){return this.dataIndex}},type:{value:"data"}})}(i.getContext(),t,i.getParsed(t),e))}else n=i.$context||(i.$context=function(t,e,i){return Object.create(t,{active:{writable:!0,value:!1},dataset:{value:i},datasetIndex:{value:e},index:{get(){return this.datasetIndex}},type:{value:"dataset"}})}(i.chart.getContext(),i.index,i.getDataset()));return n.active=!!e,n}resolveDatasetElementOptions(t){return this._resolveOptions(this.datasetElementOptions,{active:t,type:this.datasetElementType.id})}resolveDataElementOptions(t,e){const i=this,n="active"===(e=e||"default"),o=i._cachedDataOpts,s=o[e],a=i.enableOptionSharing;if(s)return((t,e)=>e?t:Object.assign({},t))(s,a);const r={cacheable:!n},l=i._resolveOptions(i.dataElementOptions,{index:t,active:n,info:r,type:i.dataElementType.id});return r.cacheable&&(l.$shared=a,o[e]=((t,e)=>e?Object.freeze(t):t)(l,a)),l}_resolveOptions(t,e){const i=this,{index:n,active:o,type:s,info:r}=e,l=i._config,c=i.chart.options.elements[s]||{},h={},d=i.getContext(n,o),u=(t=>a(t)?t:Object.keys(t))(t);for(let e=0,i=u.length;e<i;++e){const i=u[e],s=ai(i,o),a=Vt([l[t[s]],l[s],c[s]],d,n,r);void 0!==a&&(h[i]=a)}return h}_resolveAnimations(t,e,i){const n=this,o=n.chart,s=n._cachedAnimations;if(s[e=e||"default"])return s[e];const a={cacheable:!0},r=n.getContext(t,i),l=Vt([o.options.animation],r,t,a),c=Vt([n._config.animation],r,t,a);let h=l&&b({},[c,l]);h[e]&&(h=Object.assign({},h,h[e]));const d=new Ze(o,h);return a.cacheable&&(s[e]=d&&Object.freeze(d)),d}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ri(t)}updateElement(t,e,i,n){ri(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&this._resolveAnimations(void 0,e).update({options:t},{options:i})}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){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(){const t=this,e=t._cachedMeta.data.length,i=t._data.length;i>e?t._insertElements(e,i-e):i<e&&t._removeElements(i,e-i),t.parse(0,Math.min(i,e))}_insertElements(t,e){const i=this,n=new Array(e),o=i._cachedMeta,s=o.data;let a;for(a=0;a<e;++a)n[a]=new i.dataElementType;s.splice(t,0,...n),i._parsing&&o._parsed.splice(t,0,...new Array(e)),i.parse(t,e),i.updateElements(s,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&si(i,n)}i.data.splice(t,e)}_onDataPush(){const t=arguments.length;this._insertElements(this.getDataset().data.length-t,t)}_onDataPop(){this._removeElements(this._cachedMeta.data.length-1,1)}_onDataShift(){this._removeElements(0,1)}_onDataSplice(t,e){this._removeElements(t,e),this._insertElements(t,arguments.length-2)}_onDataUnshift(){this._insertElements(0,arguments.length)}}li.defaults={},li.prototype.datasetElementType=null,li.prototype.dataElementType=null,li.prototype.datasetElementOptions=["backgroundColor","borderCapStyle","borderColor","borderDash","borderDashOffset","borderJoinStyle","borderWidth"],li.prototype.dataElementOptions=["backgroundColor","borderColor","borderWidth","pointStyle"];class ci{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return E(this.x)&&E(this.y)}getProps(t,e){const i=this,n=this.$animations;if(!e||!n)return i;const o={};return t.forEach((t=>{o[t]=n[t]&&n[t].active?n[t]._to:i[t]})),o}}ci.defaults={},ci.defaultRoutes=void 0;const hi=new Map,di={values:t=>a(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale,o=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));let s;(o<1e-4||o>1e15)&&(s="scientific");let a=i.length>3?i[2].value-i[1].value:i[1].value-i[0].value;Math.abs(a)>1&&t!==Math.floor(t)&&(a=t-Math.floor(t));const r=R(Math.abs(a)),l=Math.max(Math.min(-1*Math.floor(r),20),0),c={notation:s,minimumFractionDigits:l,maximumFractionDigits:l};Object.assign(c,this.options.ticks.format);const h=n+JSON.stringify(c);let d=hi.get(h);return d||(d=new Intl.NumberFormat(n,c),hi.set(h,d)),d.format(t)},logarithmic:function(t,e,i){if(0===t)return"0";const n=t/Math.pow(10,Math.floor(R(t)));return 1===n||2===n||5===n?di.numeric.call(this,t,e,i):""}};var ui={formatters:di};function gi(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function fi(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,a=t._endPixel,r=1e-6;let l,c=t.getPixelForTick(o);if(!(i&&(l=1===n?Math.max(c-s,a-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<s-r||c>a+r)))return c}function pi(t){return t.drawTicks?t.tickMarkLength:0}function mi(t,e){if(!t.display)return 0;const i=It(t.font,e),n=zt(t.padding);return i.lineHeight+n.height}function xi(t,e,i,n,o){const s=h(n,0),a=Math.min(h(o,t.length),t.length);let r,l,c,d=0;for(i=Math.ceil(i),o&&(r=o-n,i=r/Math.floor(r/i)),c=s;c<0;)d++,c=Math.round(s+d*i);for(l=Math.max(s,0);l<a;l++)l===c&&(e.push(t[l]),d++,c=Math.round(s+d*i))}w.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",gridLines:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{display:!1,labelString:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,lineWidth:0,strokeStyle:"",padding:0,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:ui.formatters.values,minor:{},major:{},align:"center",crossAlign:"near"}}),w.route("scale.ticks","color","","color"),w.route("scale.gridLines","color","","borderColor"),w.route("scale.scaleLabel","color","","color");class bi extends ci{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.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=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.$context=void 0}init(t){const e=this;e.options=t,e.axis=e.isHorizontal()?"x":"y",e._userMin=e.parse(t.min),e._userMax=e.parse(t.max),e._suggestedMin=e.parse(t.suggestedMin),e._suggestedMax=e.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=c(t,Number.POSITIVE_INFINITY),e=c(e,Number.NEGATIVE_INFINITY),i=c(i,Number.POSITIVE_INFINITY),n=c(n,Number.NEGATIVE_INFINITY),{min:c(t,i),max:c(e,n),minDefined:l(t),maxDefined:l(e)}}getMinMax(t){const e=this;let i,{min:n,max:o,minDefined:s,maxDefined:a}=e.getUserBounds();if(s&&a)return{min:n,max:o};const r=e.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)i=r[l].controller.getMinMax(e,t),s||(n=Math.min(n,i.min)),a||(o=Math.max(o,i.max));return{min:c(n,c(o,n)),max:c(o,c(n,o))}}invalidateCaches(){this._cache={}}getPadding(){const t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeUpdate(){d(this.options.beforeUpdate,[this])}update(t,e,i){const n=this,o=n.options.ticks,s=o.sampleSize;n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n._margins=Object.assign({left:0,right:0,top:0,bottom:0},i),n.ticks=null,n._labelSizes=null,n._gridLineItems=null,n._labelItems=null,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeDataLimits(),n.determineDataLimits(),n.afterDataLimits(),n.beforeBuildTicks(),n.ticks=n.buildTicks()||[],n.afterBuildTicks();const a=s<n.ticks.length;n._convertTicksToLabels(a?gi(n.ticks,s):n.ticks),n.configure(),n.beforeCalculateLabelRotation(),n.calculateLabelRotation(),n.afterCalculateLabelRotation(),n.beforeFit(),n.fit(),n.afterFit(),n.ticks=o.display&&(o.autoSkip||"auto"===o.source)?n._autoSkip(n.ticks):n.ticks,a&&n._convertTicksToLabels(n.ticks),n.afterUpdate()}configure(){const t=this;let e,i,n=t.options.reverse;t.isHorizontal()?(e=t.left,i=t.right):(e=t.top,i=t.bottom,n=!n),t._startPixel=e,t._endPixel=i,t._reversePixels=n,t._length=i-e}afterUpdate(){d(this.options.afterUpdate,[this])}beforeSetDimensions(){d(this.options.beforeSetDimensions,[this])}setDimensions(){const t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0}afterSetDimensions(){d(this.options.afterSetDimensions,[this])}_callHooks(t){const e=this;e.chart.notifyPlugins(t,e.getContext()),d(e.options[t],[e])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){d(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this,i=e.options.ticks;let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n],s.label=d(i.callback,[s.value,n,t],e)}afterTickToLabelConversion(){d(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){d(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this,e=t.options,i=e.ticks,n=t.ticks.length,o=i.minRotation||0,s=i.maxRotation;let a,r,l,c=o;if(!t._isVisible()||!i.display||o>=s||n<=1||!t.isHorizontal())return void(t.labelRotation=o);const h=t._getLabelSizes(),d=h.widest.width,u=h.highest.height-h.highest.offset,g=Math.min(t.maxWidth,t.chart.width-d);a=e.offset?t.maxWidth/n:g/(n-1),d+6>a&&(a=g/(n-(e.offset?.5:1)),r=t.maxHeight-pi(e.gridLines)-i.padding-mi(e.scaleLabel,t.chart.options.font),l=Math.sqrt(d*d+u*u),c=W(Math.min(Math.asin(Math.min((h.highest.height+6)/a,1)),Math.asin(Math.min(r/l,1))-Math.asin(u/l))),c=Math.max(o,Math.min(s,c))),t.labelRotation=c}afterCalculateLabelRotation(){d(this.options.afterCalculateLabelRotation,[this])}beforeFit(){d(this.options.beforeFit,[this])}fit(){const t=this,e={width:0,height:0},i=t.chart,n=t.options,o=n.ticks,s=n.scaleLabel,a=n.gridLines,r=t._isVisible(),l="top"!==n.position&&"x"===t.axis,c=t.isHorizontal(),h=r&&mi(s,i.options.font);if(c?e.width=t.maxWidth:r&&(e.width=pi(a)+h),c?r&&(e.height=pi(a)+h):e.height=t.maxHeight,o.display&&r&&t.ticks.length){const i=t._getLabelSizes(),n=i.first,s=i.last,a=i.widest,r=i.highest,h=.8*r.offset,d=o.padding;if(c){const i=0!==t.labelRotation,c=B(t.labelRotation),u=Math.cos(c),g=Math.sin(c),f=g*a.width+u*(r.height-(i?r.offset:0))+(i?0:h);e.height=Math.min(t.maxHeight,e.height+f+d);const p=t.getPixelForTick(0)-t.left,m=t.right-t.getPixelForTick(t.ticks.length-1);let x,b;i?(x=l?u*n.width+g*n.offset:g*(n.height-n.offset),b=l?g*(s.height-s.offset):u*s.width+g*s.offset):"start"===o.align?(x=0,b=s.width):"end"===o.align?(x=n.width,b=0):(x=n.width/2,b=s.width/2),t.paddingLeft=Math.max((x-p)*t.width/(t.width-p),0)+3,t.paddingRight=Math.max((b-m)*t.width/(t.width-m),0)+3}else{const i=o.mirror?0:a.width+d+h;e.width=Math.min(t.maxWidth,e.width+i);let r=s.height/2,l=n.height/2;"start"===o.align?(r=0,l=n.height):"end"===o.align&&(r=s.height,l=0),t.paddingTop=r,t.paddingBottom=l}}t._handleMargins(),c?(t.width=t._length=i.width-t._margins.left-t._margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=i.height-t._margins.top-t._margins.bottom)}_handleMargins(){const t=this;t._margins&&(t._margins.left=Math.max(t.paddingLeft,t._margins.left),t._margins.top=Math.max(t.paddingTop,t._margins.top),t._margins.right=Math.max(t.paddingRight,t._margins.right),t._margins.bottom=Math.max(t.paddingBottom,t._margins.bottom))}afterFit(){d(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullWidth(){return this.options.fullWidth}_convertTicksToLabels(t){const e=this;e.beforeTickToLabelConversion(),e.generateTickLabels(t),e.afterTickToLabelConversion()}_getLabelSizes(){const t=this;let e=t._labelSizes;return e||(t._labelSizes=e=t._computeLabelSizes()),e}_computeLabelSizes(){const t=this,e=t.ctx,i=t._longestTextCache,n=t.options.ticks.sampleSize,o=[],r=[],l=[];let c=0,h=0,d=t.ticks;n<d.length&&(d=gi(d,n));const g=d.length;let f,p,m,x,b,_,y,v,M,w,k;for(f=0;f<g;++f){if(x=d[f].label,b=t._resolveTickFontOptions(f),e.font=_=b.string,y=i[_]=i[_]||{data:{},gc:[]},v=b.lineHeight,M=w=0,s(x)||a(x)){if(a(x))for(p=0,m=x.length;p<m;++p)k=x[p],s(k)||a(k)||(M=G(e,y.data,y.gc,M,k),w+=v)}else M=G(e,y.data,y.gc,M,x),w=v;o.push(M),r.push(w),l.push(v/2),c=Math.max(M,c),h=Math.max(w,h)}!function(t,e){u(t,(t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}}))}(i,g);const P=o.indexOf(c),S=r.indexOf(h);function D(t){return{width:o[t]||0,height:r[t]||0,offset:l[t]||0}}return{first:D(0),last:D(g-1),widest:D(P),highest:D(S)}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){const e=this;return e._reversePixels&&(t=1-t),K(e._startPixel+t*e._length)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this,i=e.ticks||[];if(t>=0&&t<i.length){const n=i[t];return n.$context||(n.$context=function(t,e,i){return Object.create(t,{tick:{value:i},index:{value:e},type:{value:"tick"}})}(e.getContext(),t,n))}return e.$context||(e.$context=(n=e.chart.getContext(),o=e,Object.create(n,{scale:{value:o},type:{value:"scale"}})));var n,o}_autoSkip(t){const e=this,i=e.options.ticks,n=i.maxTicksLimit||e._length/e._tickSize(),o=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return function(t,e,i,n){let o,s=0,a=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===a&&(e.push(t[o]),s++,a=i[s*n])}(t,c,o,a/n),c;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=L(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(o,t,n);if(a>0){let e,i;const n=a>1?Math.round((l-r)/(a-1)):null;for(xi(t,c,h,s(n)?0:r-n,r),e=0,i=a-1;e<i;e++)xi(t,c,h,o[e],o[e+1]);return xi(t,c,h,l,s(n)?t.length:l+n),c}return xi(t,c,h),c}_tickSize(){const t=this,e=t.options.ticks,i=B(t.labelRotation),n=Math.abs(Math.cos(i)),o=Math.abs(Math.sin(i)),s=t._getLabelSizes(),a=e.autoSkipPadding||0,r=s?s.widest.width+a:0,l=s?s.highest.height+a:0;return t.isHorizontal()?l*n>r*o?r/n:l/o:l*o<r*n?l/n:r/o}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this,i=e.axis,n=e.chart,o=e.options,{gridLines:s,position:a}=o,l=s.offsetGridLines,c=e.isHorizontal(),h=e.ticks.length+(l?1:0),d=pi(s),u=[];let g=this.getContext(0);const f=s.drawBorder?Vt([s.borderWidth,s.lineWidth,0],g,0):0,p=f/2,m=function(t){return Q(n,t,f)};let x,b,_,y,v,M,w,k,P,S,D,O;if("top"===a)x=m(e.bottom),M=e.bottom-d,k=x-p,S=m(t.top)+p,O=t.bottom;else if("bottom"===a)x=m(e.top),S=t.top,O=m(t.bottom)-p,M=x+p,k=e.top+d;else if("left"===a)x=m(e.right),v=e.right-d,w=x-p,P=m(t.left)+p,D=t.right;else if("right"===a)x=m(e.left),P=t.left,D=m(t.right)-p,v=x+p,w=e.left+d;else if("x"===i){if("center"===a)x=m((t.top+t.bottom)/2);else if(r(a)){const t=Object.keys(a)[0],i=a[t];x=m(e.chart.scales[t].getPixelForValue(i))}S=t.top,O=t.bottom,M=x+p,k=M+d}else if("y"===i){if("center"===a)x=m((t.left+t.right)/2);else if(r(a)){const t=Object.keys(a)[0],i=a[t];x=m(e.chart.scales[t].getPixelForValue(i))}v=x-p,w=v-d,P=t.left,D=t.right}for(b=0;b<h;++b){g=this.getContext(b);const t=Vt([s.lineWidth],g,b),i=Vt([s.color],g,b),o=s.borderDash||[],a=Vt([s.borderDashOffset],g,b);_=fi(e,b,l),void 0!==_&&(y=Q(n,_,t),c?v=w=P=D=y:M=k=S=O=y,u.push({tx1:v,ty1:M,tx2:w,ty2:k,x1:P,y1:S,x2:D,y2:O,width:t,color:i,borderDash:o,borderDashOffset:a}))}return e._ticksLength=h,e._borderValue=x,u}_computeLabelItems(t){const e=this,i=e.axis,n=e.options,{position:o,ticks:s}=n,l=e.isHorizontal(),c=e.ticks,{align:h,crossAlign:d,padding:u}=s,g=pi(n.gridLines),f=g+u,p=-B(e.labelRotation),m=[];let x,b,_,y,v,M,w,k,P,S,D,O,T="middle";if("top"===o)M=e.bottom-f,w=e._getXAxisLabelAlignment();else if("bottom"===o)M=e.top+f,w=e._getXAxisLabelAlignment();else if("left"===o){const t=this._getYAxisLabelAlignment(g);w=t.textAlign,v=t.x}else if("right"===o){const t=this._getYAxisLabelAlignment(g);w=t.textAlign,v=t.x}else if("x"===i){if("center"===o)M=(t.top+t.bottom)/2+f;else if(r(o)){const t=Object.keys(o)[0],i=o[t];M=e.chart.scales[t].getPixelForValue(i)+f}w=e._getXAxisLabelAlignment()}else if("y"===i){if("center"===o)v=(t.left+t.right)/2-f;else if(r(o)){const t=Object.keys(o)[0],i=o[t];v=e.chart.scales[t].getPixelForValue(i)}w=this._getYAxisLabelAlignment(g).textAlign}"y"===i&&("start"===h?T="top":"end"===h&&(T="bottom"));const A=e._getLabelSizes();for(x=0,b=c.length;x<b;++x){_=c[x],y=_.label,k=e.getPixelForTick(x)+s.labelOffset,P=e._resolveTickFontOptions(x),S=P.lineHeight,D=a(y)?y.length:1;const t=D/2;l?(v=k,"top"===o?"near"===d||0!==p?(O=(Math.sin(p)*t+.5)*S,O-=(0===p?D-.5:Math.cos(p)*t)*S):"center"===d?(O=A.highest.height/2*-1,O-=t*S):O=-1*A.highest.height+.5*S:"bottom"===o&&("near"===d||0!==p?(O=Math.sin(p)*t*S,O+=(0===p?.5:Math.cos(p)*t)*S):"center"===d?(O=A.highest.height/2,O-=t*S):O=A.highest.height-(D-.5)*S)):(M=k,O=(1-D)*S/2),m.push({x:v,y:M,rotation:p,label:y,font:P,color:s.color,textOffset:O,textAlign:w,textBaseline:T})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-B(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align&&(i="right"),i}_getYAxisLabelAlignment(t){const e=this,{position:i,ticks:n}=e.options,{crossAlign:o,mirror:s,padding:a}=n,r=t+a,l=e._getLabelSizes().widest.width;let c,h;return"left"===i?s?(c="left",h=e.right-a):(h=e.right-r,"near"===o?c="right":"center"===o?(c="center",h-=l/2):(c="left",h-=l)):"right"===i?s?(c="right",h=e.left+a):(h=e.left+r,"near"===o?c="left":"center"===o?(c="center",h+=l/2):(c="right",h+=l)):c="right",{textAlign:c,x:h}}drawGrid(t){const e=this,i=e.options.gridLines,n=e.ctx,o=e.chart;let s=e.getContext(0);const a=i.drawBorder?Vt([i.borderWidth,i.lineWidth,0],s,0):0,r=e._gridLineItems||(e._gridLineItems=e._computeGridLineItems(t));let l,c;if(i.display)for(l=0,c=r.length;l<c;++l){const t=r[l],e=t.width,o=t.color;e&&o&&(n.save(),n.lineWidth=e,n.strokeStyle=o,n.setLineDash&&(n.setLineDash(t.borderDash),n.lineDashOffset=t.borderDashOffset),n.beginPath(),i.drawTicks&&(n.moveTo(t.tx1,t.ty1),n.lineTo(t.tx2,t.ty2)),i.drawOnChartArea&&(n.moveTo(t.x1,t.y1),n.lineTo(t.x2,t.y2)),n.stroke(),n.restore())}if(a){const t=a;s=e.getContext(e._ticksLength-1);const r=Vt([i.lineWidth,1],s,e._ticksLength-1),l=e._borderValue;let c,h,d,u;e.isHorizontal()?(c=Q(o,e.left,t)-t/2,h=Q(o,e.right,r)+r/2,d=u=l):(d=Q(o,e.top,t)-t/2,u=Q(o,e.bottom,r)+r/2,c=h=l),n.lineWidth=a,n.strokeStyle=Vt([i.borderColor,i.color],s,0),n.beginPath(),n.moveTo(c,d),n.lineTo(h,u),n.stroke()}}drawLabels(t){const e=this,i=e.options.ticks;if(!i.display)return;const n=e.ctx,o=e._labelItems||(e._labelItems=e._computeLabelItems(t));let s,r,l,c;for(s=0,l=o.length;s<l;++s){const t=o[s],e=t.font,l=i.textStrokeWidth>0&&""!==i.textStrokeColor;n.save(),n.translate(t.x,t.y),n.rotate(t.rotation),n.font=e.string,n.fillStyle=t.color,n.textAlign=t.textAlign,n.textBaseline=t.textBaseline,l&&(n.strokeStyle=i.textStrokeColor,n.lineWidth=i.textStrokeWidth);const h=t.label;let d=t.textOffset;if(a(h))for(r=0,c=h.length;r<c;++r)l&&n.strokeText(""+h[r],0,d),n.fillText(""+h[r],0,d),d+=e.lineHeight;else l&&n.strokeText(h,0,d),n.fillText(h,0,d);n.restore()}}drawTitle(t){const e=this,i=e.ctx,n=e.options,o=n.scaleLabel;if(!o.display)return;const s=It(o.font,e.chart.options.font),a=zt(o.padding),r=s.lineHeight/2,l=o.align,c=n.position,h=e.options.reverse;let d,u,g,f=0;if(e.isHorizontal()){switch(l){case"start":u=e.left+(h?e.width:0),d=h?"right":"left";break;case"end":u=e.left+(h?0:e.width),d=h?"left":"right";break;default:u=e.left+e.width/2,d="center"}g="top"===c?e.top+r+a.top:e.bottom-r-a.bottom}else{const t="left"===c;switch(u=t?e.left+r+a.top:e.right-r-a.top,l){case"start":g=e.top+(h?0:e.height),d=h===t?"right":"left";break;case"end":g=e.top+(h?e.height:0),d=h===t?"left":"right";break;default:g=e.top+e.height/2,d="center"}f=t?-T:T}i.save(),i.translate(u,g),i.rotate(f),i.textAlign=d,i.textBaseline="middle",i.fillStyle=o.color,i.font=s.string,i.fillText(o.labelString,0,0),i.restore()}draw(t){const e=this;e._isVisible()&&(e.drawGrid(t),e.drawTitle(),e.drawLabels(t))}_layers(){const t=this,e=t.options,i=e.ticks&&e.ticks.z||0,n=e.gridLines&&e.gridLines.z||0;return t._isVisible()&&i!==n&&t.draw===t._draw?[{z:n,draw(e){t.drawGrid(e),t.drawTitle()}},{z:i,draw(e){t.drawLabels(e)}}]:[{z:i,draw(e){t.draw(e)}}]}getMatchingVisibleMetas(t){const e=this,i=e.chart.getSortedVisibleDatasetMetas(),n=e.axis+"AxisID",o=[];let s,a;for(s=0,a=i.length;s<a;++s){const a=i[s];a[n]!==e.id||t&&a.type!==t||o.push(a)}return o}_resolveTickFontOptions(t){const e=this,i=e.chart,n=e.options.ticks,o=e.getContext(t);return It(Vt([n.font],o),i.options.font)}}bi.prototype._draw=bi.prototype.draw;class _i{constructor(t,e){this.type=t,this.scope=e,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,o=t.id,s=this.scope,a=s?s+"."+o:o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,function(t,e,i){const n=Object.assign(Object.create(null),i&&w.get(i),t.defaults,w.get(e));w.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");w.route(s,o,l,r)}))}(e,t.defaultRoutes)}(t,a,i)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in w[n]&&delete w[n][i]}}var yi=new class{constructor(){this.controllers=new _i(li,"controllers"),this.elements=new _i(ci,"elements"),this.plugins=new _i(Object,"plugins"),this.scales=new _i(bi,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){const n=this;[...e].forEach((e=>{const o=i||n._getRegistryForType(e);i||o.isForType(e)||o===n.plugins&&e.id?n._exec(t,o,e):u(e,(e=>{const o=i||n._getRegistryForType(e);n._exec(t,o,e)}))}))}_exec(t,e,i){const n=v(t);d(i["before"+n],[],i),e[t](i),d(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}};class vi{constructor(){this._init=[]}notify(t,e,i){const n=this;"beforeInit"===e&&(n._init=n._createDescriptors(t,!0),n._notify(n._init,t,"install"));const o=n._descriptors(t),s=n._notify(o,t,e,i);return"destroy"===e&&(n._notify(o,t,"stop"),n._notify(n._init,t,"uninstall")),s}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===d(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){this._oldCache=this._cache,this._cache=void 0}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=h(i.options&&i.options.plugins,{}),o=function(t){const e=[],i=Object.keys(yi.plugins.items);for(let t=0;t<i.length;t++)e.push(yi.getPlugin(i[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const i=n[t];-1===e.indexOf(i)&&e.push(i)}return e}(i);return!1!==n||e?function(t,e,i){const n=[];for(let o=0;o<t.length;o++){const s=t[o],a=s.id,r=Mi(e[a],i);null!==r&&n.push({plugin:s,options:b({},[r,w.plugins[a]])})}return n}(o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function Mi(t,e){return e||!1!==t?!0===t?{}:t:null}function wi(t,e){const i=(w.controllers[t]||{}).datasets||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function ki(t,e){return"x"===t||"y"===t||"r"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function Pi(t,e){const i=function(t,e){const i=w.controllers[t.type]||{scales:{}},n=e.scales||{},o=wi(t.type,e),s=Object.create(null),a=Object.create(null);return Object.keys(n).forEach((t=>{const e=n[t],r=ki(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(r,o);s[r]=s[r]||t,a[t]=b(Object.create(null),[{axis:r},e,i.scales[r],i.scales[l]])})),e.scale&&(a[e.scale.id||"r"]=b(Object.create(null),[{axis:"r"},e.scale,i.scales.r]),s.r=s.r||e.scale.id||"r"),t.data.datasets.forEach((i=>{const o=i.type||t.type,r=i.indexAxis||wi(o,e),l=(w.controllers[o]||{}).scales||{};Object.keys(l).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),o=i[e+"AxisID"]||s[e]||e;a[o]=a[o]||Object.create(null),b(a[o],[{axis:e},n[o],l[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];b(e,[w.scales[e.type],w.scale])})),a}(t,e=e||{}),n=!1!==e.interaction&&!1!==e.hover;return(e=function(...t){return x(Object.create(null),t,{merger(t,e,i,n){"scales"!==t&&"scale"!==t&&"controllers"!==t&&m(t,e,i,n)}})}(w,w.controllers[t.type],e)).hover=n&&x(Object.create(null),[w.interaction,w.hover,e.interaction,e.hover]),e.scales=i,!1!==e.plugins&&function(t){t.plugins=t.plugins||{},t.plugins.title=!1!==t.plugins.title&&x(Object.create(null),[w.plugins.title,t.plugins.title]),t.plugins.tooltip=!1!==t.plugins.tooltip&&x(Object.create(null),[w.interaction,w.plugins.tooltip,t.interaction,t.plugins.tooltip])}(e),e}class Si{constructor(t){this._config=function(t){const e=(t=t||{}).data=t.data||{datasets:[],labels:[]};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=Pi(t,t.options),t}(t)}get type(){return this._config.type}get data(){return this._config.data}set data(t){this._config.data=t}get options(){return this._config.options}get plugins(){return this._config.plugins}update(t){const e=this._config;e.options=Pi(e,t)}}const Di=["top","bottom","left","right","chartArea"];function Oi(t,e){return"top"===t||"bottom"===t||-1===Di.indexOf(t)&&"x"===e}function Ti(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function Ai(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),d(i&&i.onComplete,[t],e)}function Ci(t){const e=t.chart,i=e.options.animation;d(i&&i.onProgress,[t],e)}function Li(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Ri(t){return Li()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}class Ei{constructor(t,e){const n=this;this.config=e=new Si(e);const s=Ri(t),a=Ei.getChart(s);if(a)throw new Error("Canvas is already in use. Chart with ID '"+a.id+"' must be destroyed before the canvas can be reused.");this.platform=n._initializePlatform(s,e);const r=n.platform.acquireContext(s,e),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;this.id=o(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this.aspectRatio=c?h/c:null,this.options=e.options,this._layers=[],this._metasets=[],this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._sortedMetasets=[],this.scales={},this.scale=void 0,this._plugins=new vi,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,Ei.instances[n.id]=n,r&&l?(i.listen(n,"complete",Ai),i.listen(n,"progress",Ci),n._initialize(),n.attached&&n.update()):console.error("Failed to create chart: can't acquire context from the given item")}get data(){return this.config.data}set data(t){this.config.data=t}_initialize(){const t=this;return t.notifyPlugins("beforeInit"),t.options.responsive?t.resize():Mt(t,t.options.devicePixelRatio),t.bindEvents(),t.notifyPlugins("afterInit"),t}_initializePlatform(t,e){return e.platform?new e.platform:!Li()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?new Gt:new ce}clear(){return J(this),this}stop(){return i.stop(this),this}resize(t,e){i.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this,n=i.options,o=i.canvas,s=n.maintainAspectRatio&&i.aspectRatio,a=i.platform.getMaximumSize(o,t,e,s),r=i.currentDevicePixelRatio,l=n.devicePixelRatio||i.platform.getDevicePixelRatio();i.width===a.width&&i.height===a.height&&r===l||(o.width=i.width=a.width,o.height=i.height=a.height,o.style&&(o.style.width=a.width+"px",o.style.height=a.height+"px"),Mt(i,l),i.notifyPlugins("resize",{size:a}),d(n.onResize,[a],i),i.attached&&i.update("resize"))}ensureScalesHaveIDs(){const t=this.options,e=t.scales||{},i=t.scale;u(e,((t,e)=>{t.id=e})),i&&(i.id=i.id||"scale")}buildOrUpdateScales(){const t=this,e=t.options,i=e.scales,n=t.scales||{},o=Object.keys(n).reduce(((t,e)=>(t[e]=!1,t)),{});let s=[];i&&(s=s.concat(Object.keys(i).map((t=>{const e=i[t],n=ki(t,e),o="r"===n,s="x"===n;return{options:e,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}})))),u(s,(i=>{const s=i.options,a=s.id,r=ki(a,s),l=h(s.type,i.dtype);void 0!==s.position&&Oi(s.position,r)===Oi(i.dposition)||(s.position=i.dposition),o[a]=!0;let c=null;if(a in n&&n[a].type===l)c=n[a];else{c=new(yi.getScale(l))({id:a,type:l,ctx:t.ctx,chart:t}),n[c.id]=c}c.init(s,e),i.isDefault&&(t.scale=c)})),u(o,((t,e)=>{t||delete n[e]})),t.scales=n,u(n,(e=>{e.fullWidth=e.options.fullWidth,e.position=e.options.position,e.weight=e.options.weight,Kt.addBox(t,e)}))}_updateMetasetIndex(t,e){const i=this._metasets,n=t.index;n!==e&&(i[n]=i[e],i[e]=t,t.index=e)}_updateMetasets(){const t=this,e=t._metasets,i=t.data.datasets.length,n=e.length;if(n>i){for(let e=i;e<n;++e)t._destroyDatasetMeta(e);e.splice(i,n-i)}t._sortedMetasets=e.slice(0).sort(Ti("order","index"))}_removeUnreferencedMetasets(){const t=this,e=t.data.datasets;t._metasets.forEach(((i,n)=>{0===e.filter((t=>t===i._dataset)).length&&t._destroyDatasetMeta(n)}))}buildOrUpdateControllers(){const t=this,e=[],i=t.data.datasets;let n,o;for(t._removeUnreferencedMetasets(),n=0,o=i.length;n<o;n++){const o=i[n];let s=t.getDatasetMeta(n);const a=o.type||t.config.type;if(s.type&&s.type!==a&&(t._destroyDatasetMeta(n),s=t.getDatasetMeta(n)),s.type=a,s.indexAxis=o.indexAxis||wi(a,t.options),s.order=o.order||0,t._updateMetasetIndex(s,n),s.label=""+o.label,s.visible=t.isDatasetVisible(n),s.controller)s.controller.updateIndex(n),s.controller.linkScales();else{const i=w.controllers[a],o=yi.getController(a);Object.assign(o.prototype,{dataElementType:yi.getElement(i.dataElementType),datasetElementType:i.datasetElementType&&yi.getElement(i.datasetElementType),dataElementOptions:i.dataElementOptions,datasetElementOptions:i.datasetElementOptions}),s.controller=new o(t,n),e.push(s.controller)}}return t._updateMetasets(),e}_resetElements(){const t=this;u(t.data.datasets,((e,i)=>{t.getDatasetMeta(i).controller.reset()}),t)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this;let i,n;if(u(e.scales,(t=>{Kt.removeBox(e,t)})),e.config.update(e.options),e.options=e.config.options,e._animationsDisabled=!e.options.animation,e.ensureScalesHaveIDs(),e.buildOrUpdateScales(),e._plugins.invalidate(),!1===e.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=e.buildOrUpdateControllers();for(i=0,n=e.data.datasets.length;i<n;i++)e.getDatasetMeta(i).controller.buildOrUpdateElements();e._updateLayout(),u(o,(t=>{t.reset()})),e._updateDatasets(t),e.notifyPlugins("afterUpdate",{mode:t}),e._layers.sort(Ti("z","_idx")),e._lastEvent&&e._eventHandler(e._lastEvent,!0),e.render()}_updateLayout(){const t=this;!1!==t.notifyPlugins("beforeLayout",{cancelable:!0})&&(Kt.update(t,t.width,t.height),t._layers=[],u(t.boxes,(e=>{e.configure&&e.configure(),t._layers.push(...e._layers())}),t),t._layers.forEach(((t,e)=>{t._idx=e})),t.notifyPlugins("afterLayout"))}_updateDatasets(t){const e=this,i="function"==typeof t;if(!1!==e.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let n=0,o=e.data.datasets.length;n<o;++n)e._updateDataset(n,i?t({datasetIndex:n}):t);e.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this,n=i.getDatasetMeta(t),o={meta:n,index:t,mode:e,cancelable:!0};!1!==i.notifyPlugins("beforeDatasetUpdate",o)&&(n.controller._update(e),o.cancelable=!1,i.notifyPlugins("afterDatasetUpdate",o))}render(){const t=this;!1!==t.notifyPlugins("beforeRender",{cancelable:!0})&&(i.has(t)?t.attached&&!i.running(t)&&i.start(t):(t.draw(),Ai({chart:t})))}draw(){const t=this;let e;if(t._resizeBeforeDraw){const{width:e,height:i}=t._resizeBeforeDraw;t._resize(e,i),t._resizeBeforeDraw=null}if(t.clear(),t.width<=0||t.height<=0)return;if(!1===t.notifyPlugins("beforeDraw",{cancelable:!0}))return;const i=t._layers;for(e=0;e<i.length&&i[e].z<=0;++e)i[e].draw(t.chartArea);for(t._drawDatasets();e<i.length;++e)i[e].draw(t.chartArea);t.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){const t=this;if(!1===t.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const e=t.getSortedVisibleDatasetMetas();for(let i=e.length-1;i>=0;--i)t._drawDataset(e[i]);t.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this,i=e.ctx,n=t._clip,o=e.chartArea,s={meta:t,index:t.index,cancelable:!0};!1!==e.notifyPlugins("beforeDatasetDraw",s)&&(it(i,{left:!1===n.left?0:o.left-n.left,right:!1===n.right?e.width:o.right+n.right,top:!1===n.top?0:o.top-n.top,bottom:!1===n.bottom?e.height:o.bottom+n.bottom}),t.controller.draw(),nt(i),s.cancelable=!1,e.notifyPlugins("afterDatasetDraw",s))}getElementsAtEventForMode(t,e,i,n){const o=Ct.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n=i[t]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1}),n}getContext(){return this.$context||(this.$context=Object.create(null,{chart:{value:this},type:{value:"chart"}}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateDatasetVisibility(t,e){const i=this,n=e?"show":"hide",o=i.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);i.setDatasetVisibility(t,e),s.update(o,{visible:e}),i.update((e=>e.datasetIndex===t?n:void 0))}hide(t){this._updateDatasetVisibility(t,!1)}show(t){this._updateDatasetVisibility(t,!0)}_destroyDatasetMeta(t){const e=this,i=e._metasets&&e._metasets[t];i&&(i.controller._destroy(),delete e._metasets[t])}destroy(){const t=this,e=t.canvas;let n,o;for(t.stop(),i.remove(t),n=0,o=t.data.datasets.length;n<o;++n)t._destroyDatasetMeta(n);e&&(t.unbindEvents(),J(t),t.platform.releaseContext(t.ctx),t.canvas=null,t.ctx=null),t.notifyPlugins("destroy"),delete Ei.instances[t.id]}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){const t=this,e=t._listeners,i=t.platform,n=(n,o)=>{i.addEventListener(t,n,o),e[n]=o},o=(n,o)=>{e[n]&&(i.removeEventListener(t,n,o),delete e[n])};let s=function(e,i,n){e.offsetX=i,e.offsetY=n,t._eventHandler(e)};if(u(t.options.events,(t=>n(t,s))),t.options.responsive){let e;s=(e,i)=>{t.canvas&&t.resize(e,i)};const a=()=>{o("attach",a),t.attached=!0,t.resize(),n("resize",s),n("detach",e)};e=()=>{t.attached=!1,o("resize",s),n("attach",a)},i.isAttached(t.canvas)?a():e()}else t.attached=!0}unbindEvents(){const t=this,e=t._listeners;e&&(delete t._listeners,u(e,((e,i)=>{t.platform.removeEventListener(t,i,e)})))}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,a,r;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a)s=t[a],s&&this.getDatasetMeta(s.datasetIndex).controller[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this,i=e._active||[],n=t.map((({datasetIndex:t,index:i})=>{const n=e.getDatasetMeta(t);if(!n)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:n.data[i],index:i}}));!g(n,i)&&(e._active=n,e._updateHoverStyles(n,i))}notifyPlugins(t,e){return this._plugins.notify(this,t,e)}_updateHoverStyles(t,e){const i=this,n=(i.options||{}).hover;e.length&&i.updateHoverStyle(e,n.mode,!1),t.length&&n.mode&&i.updateHoverStyle(t,n.mode,!0)}_eventHandler(t,e){const i=this,n={event:t,replay:e,cancelable:!0};if(!1===i.notifyPlugins("beforeEvent",n))return;const o=i._handleEvent(t,e);return n.cancelable=!1,i.notifyPlugins("afterEvent",n),o&&i.render(),i}_handleEvent(t,e){const i=this,n=i._active||[],o=i.options,s=o.hover,a=e;let r=[],l=!1;return"mouseout"===t.type?i._lastEvent=null:(r=i.getElementsAtEventForMode(t,s.mode,s,a),i._lastEvent="click"===t.type?i._lastEvent:t),d(o.onHover||o.hover.onHover,[t,r,i],i),"mouseup"!==t.type&&"click"!==t.type&&"contextmenu"!==t.type||et(t,i.chartArea)&&d(o.onClick,[t,r,i],i),l=!g(r,n),(l||e)&&(i._active=r,i._updateHoverStyles(r,n)),l}}Ei.defaults=w,Ei.instances={},Ei.registry=yi,Ei.version="3.0.0-beta.7",Ei.getChart=t=>{const e=Ri(t);return Object.values(Ei.instances).filter((t=>t.canvas===e)).pop()};const Fi=()=>u(Ei.instances,(t=>t._plugins.invalidate()));Ei.register=(...t)=>{yi.add(...t),Fi()},Ei.unregister=(...t)=>{yi.remove(...t),Fi()};const zi=Number.EPSILON||1e-14;function Ii(t,e,i,n){const o=t.skip?e:t,s=e,a=i.skip?e:i,r=Math.sqrt(Math.pow(s.x-o.x,2)+Math.pow(s.y-o.y,2)),l=Math.sqrt(Math.pow(a.x-s.x,2)+Math.pow(a.y-s.y,2));let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:s.x-d*(a.x-o.x),y:s.y-d*(a.y-o.y)},next:{x:s.x+u*(a.x-o.x),y:s.y+u*(a.y-o.y)}}}function Vi(t){const e=(t||[]).map((t=>({model:t,deltaK:0,mK:0}))),i=e.length;let n,o,s,a,r,l,c,h,d;for(n=0;n<i;++n)if(s=e[n],!s.model.skip){if(o=n>0?e[n-1]:null,a=n<i-1?e[n+1]:null,a&&!a.model.skip){const t=a.model.x-s.model.x;s.deltaK=0!==t?(a.model.y-s.model.y)/t:0}!o||o.model.skip?s.mK=s.deltaK:!a||a.model.skip?s.mK=o.deltaK:V(o.deltaK)!==V(s.deltaK)?s.mK=0:s.mK=(o.deltaK+s.deltaK)/2}for(n=0;n<i-1;++n)s=e[n],a=e[n+1],s.model.skip||a.model.skip||(F(s.deltaK,0,zi)?s.mK=a.mK=0:(r=s.mK/s.deltaK,l=a.mK/s.deltaK,h=Math.pow(r,2)+Math.pow(l,2),h<=9||(c=3/Math.sqrt(h),s.mK=r*c*s.deltaK,a.mK=l*c*s.deltaK)));for(n=0;n<i;++n)s=e[n],s.model.skip||(o=n>0?e[n-1]:null,a=n<i-1?e[n+1]:null,o&&!o.model.skip&&(d=(s.model.x-o.model.x)/3,s.model.controlPointPreviousX=s.model.x-d,s.model.controlPointPreviousY=s.model.y-d*s.mK),a&&!a.model.skip&&(d=(a.model.x-s.model.x)/3,s.model.controlPointNextX=s.model.x+d,s.model.controlPointNextY=s.model.y+d*s.mK))}function Bi(t,e,i){return Math.max(Math.min(t,i),e)}function Wi(t,e,i,n){let o,s,a,r;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)Vi(t);else{let i=n?t[t.length-1]:t[0];for(o=0,s=t.length;o<s;++o)a=t[o],r=Ii(i,a,t[Math.min(o+1,s-(n?0:1))%s],e.tension),a.controlPointPreviousX=r.previous.x,a.controlPointPreviousY=r.previous.y,a.controlPointNextX=r.next.x,a.controlPointNextY=r.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o;for(i=0,n=t.length;i<n;++i)o=t[i],et(o,e)&&(i>0&&et(t[i-1],e)&&(o.controlPointPreviousX=Bi(o.controlPointPreviousX,e.left,e.right),o.controlPointPreviousY=Bi(o.controlPointPreviousY,e.top,e.bottom)),i<t.length-1&&et(t[i+1],e)&&(o.controlPointNextX=Bi(o.controlPointNextX,e.left,e.right),o.controlPointNextY=Bi(o.controlPointNextY,e.top,e.bottom)))}(t,i)}function Ni(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Hi(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function ji(t,e,i,n){const o={x:t.controlPointNextX,y:t.controlPointNextY},s={x:e.controlPointPreviousX,y:e.controlPointPreviousY},a=Ni(t,o,i),r=Ni(o,s,i),l=Ni(s,e,i),c=Ni(a,r,i),h=Ni(r,l,i);return Ni(c,h,i)}function Yi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ui(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function $i(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Xi(t){return"angle"===t?{between:$,compare:Y,normalize:U}:{between:(t,e,i)=>t>=e&&t<=i,compare:(t,e)=>t-e,normalize:t=>t}}function Ki(t,e,i,n){return{start:t%n,end:e%n,loop:i&&(e-t+1)%n==0}}function qi(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,a=e.length,{compare:r,between:l,normalize:c}=Xi(n),{start:h,end:d,loop:u}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:a,normalize:r}=Xi(n),l=e.length;let c,h,{start:d,end:u,loop:g}=t;if(g){for(d+=l,u+=l,c=0,h=l;c<h&&a(r(e[d%l][n]),o,s);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:g}}(t,e,i),g=[];let f,p,m,x=!1,b=null;const _=()=>x||l(o,m,f)&&0!==r(o,m),y=()=>!x||0===r(s,f)||l(s,m,f);for(let t=h,i=h;t<=d;++t)p=e[t%a],p.skip||(f=c(p[n]),x=l(f,o,s),null===b&&_()&&(b=0===r(f,o)?t:i),null!==b&&y()&&(g.push(Ki(b,t,u,a)),b=null),i=t,m=f);return null!==b&&g.push(Ki(b,d,u,a)),g}function Gi(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=qi(n[o],t.points,e);s.length&&i.push(...s)}return i}function Zi(t){const e=t.points,i=t.options.spanGaps,n=e.length;if(!n)return[];const o=!!t._loop,{start:s,end:a}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return s%=e,{start:o,end:s}}(e,n,o,i);if(!0===i)return[{start:s,end:a,loop:o}];return function(t,e,i,n){const o=t.length,s=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(a-1)%o,loop:n}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&s.push({start:e%o,end:r%o,loop:n}),s}(e,s,a<s?a+n:a,!!t._fullLoop&&0===s&&a===n-1)}var Qi=Object.freeze({__proto__:null,easingEffects:de,color:Ue,getHoverColor:$e,requestAnimFrame:t,fontString:function(t,e,i){return e+" "+t+"px "+i},noop:n,uid:o,isNullOrUndef:s,isArray:a,isObject:r,isFinite:l,finiteOrDefault:c,valueOrDefault:h,callback:d,each:u,_elementsEqual:g,clone:f,_merger:m,merge:x,mergeIf:b,_mergerIf:_,_deprecated:function(t,e,i,n){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+n+'" instead')},resolveObjectKey:y,_capitalize:v,toFontString:q,_measureText:G,_longestText:Z,_alignPixel:Q,clear:J,drawPoint:tt,_isPointInArea:et,clipArea:it,unclipArea:nt,_steppedLineTo:ot,_bezierCurveTo:st,_lookup:at,_lookupByKey:rt,_rlookupByKey:lt,_filterBetween:ct,listenArrayEvents:dt,unlistenArrayEvents:ut,_arrayUnique:gt,splineCurve:Ii,splineCurveMonotone:Vi,_updateBezierControlPoints:Wi,_getParentNode:ft,getStyle:xt,getRelativePosition:yt,getMaximumSize:vt,retinaScale:Mt,supportsEventListenerOptions:wt,readUsedSize:kt,_pointInLine:Ni,_steppedInterpolation:Hi,_bezierInterpolation:ji,toLineHeight:Lt,toTRBL:Et,toTRBLCorners:Ft,toPadding:zt,toFont:It,resolve:Vt,PI:k,TAU:P,PITAU:S,INFINITY:D,RAD_PER_DEG:O,HALF_PI:T,QUARTER_PI:A,TWO_THIRDS_PI:C,_factorize:L,log10:R,isNumber:E,almostEquals:F,almostWhole:z,_setMinAndMaxByKey:I,sign:V,toRadians:B,toDegrees:W,_decimalPlaces:N,getAngleFromPoint:H,distanceBetweenPoints:j,_angleDiff:Y,_normalizeAngle:U,_angleBetween:$,_limitValue:X,_int16Range:K,getRtlAdapter:Yi,overrideTextDirection:Ui,restoreTextDirection:$i,_boundSegment:qi,_boundSegments:Gi,_computeSegments:Zi});function Ji(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}class tn{constructor(t){this.options=t||{}}formats(){return Ji()}parse(t,e){return Ji()}format(t,e){return Ji()}add(t,e,i){return Ji()}diff(t,e,i){return Ji()}startOf(t,e,i){return Ji()}endOf(t,e){return Ji()}}tn.override=function(t){Object.assign(tn.prototype,t)};var en={_date:tn};function nn(t){const e=function(t){if(!t._cache.$bar){const e=t.getMatchingVisibleMetas("bar");let i=[];for(let n=0,o=e.length;n<o;n++)i=i.concat(e[n].controller.getAllParsedValues(t));t._cache.$bar=gt(i.sort(((t,e)=>t-e)))}return t._cache.$bar}(t);let i,n,o,s,a=t._length;const r=()=>{a=Math.min(a,i&&Math.abs(o-s)||a),s=o};for(i=0,n=e.length;i<n;++i)o=t.getPixelForValue(e[i]),r();for(i=0,n=t.ticks.length;i<n;++i)o=t.getPixelForTick(i),r();return a}function on(t,e,i,n){return a(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),a=Math.min(o,s),r=Math.max(o,s);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:s,min:a,max:r}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function sn(t,e,i,n){const o=t.iScale,s=t.vScale,a=o.getLabels(),r=o===s,l=[];let c,h,d,u;for(c=i,h=i+n;c<h;++c)u=e[c],d={},d[o.axis]=r||o.parse(a[c],c),l.push(on(u,d,s,c));return l}function an(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}class rn extends li{parsePrimitiveData(t,e,i,n){return sn(t,e,i,n)}parseArrayData(t,e,i,n){return sn(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===o.axis?a:r,c="x"===s.axis?a:r,h=[];let d,u,g,f;for(d=i,u=i+n;d<u;++d)f=e[d],g={},g[o.axis]=o.parse(y(f,l),d),h.push(on(y(f,c),g,s,d));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,a=an(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:a}}initialize(){const t=this;t.enableOptionSharing=!0,super.initialize();t._cachedMeta.stack=t.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o=this,s="reset"===n,a=o._cachedMeta.vScale,r=a.getBasePixel(),l=a.isHorizontal(),c=o._getRuler(),h=o.resolveDataElementOptions(e,n),d=o.getSharedOptions(h),u=o.includeOptions(n,d);o.updateSharedOptions(d,n,h);for(let a=e;a<e+i;a++){const e=d||o.resolveDataElementOptions(a,n),i=o._calculateBarValuePixels(a,e),h=o._calculateBarIndexPixels(a,c,e),g={horizontal:l,base:s?r:i.base,x:l?s?r:i.head:h.center,y:l?h.center:s?r:i.head,height:l?h.size:void 0,width:l?void 0:h.size};u&&(g.options=e),o.updateElement(t[a],a,g,n)}}_getStacks(t,e){const i=this._cachedMeta.iScale,n=i.getMatchingVisibleMetas(this._type),o=i.options.stacked,a=n.length,r=[];let l,c;for(l=0;l<a;++l){if(c=n[l],void 0!==e){const t=c.controller.getParsed(e)[c.controller._cachedMeta.vScale.axis];if(s(t)||isNaN(t))continue}if((!1===o||-1===r.indexOf(c.stack)||void 0===o&&void 0===c.stack)&&r.push(c.stack),c.index===t)break}return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e){const i=this._getStacks(t),n=void 0!==e?i.indexOf(e):-1;return-1===n?i.length-1:n}_getRuler(){const t=this,e=t._cachedMeta,i=e.iScale,n=[];let o,s;for(o=0,s=e.data.length;o<s;++o)n.push(i.getPixelForValue(t.getParsed(o)[i.axis],o));return{min:nn(i),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:t._getStackCount(),scale:i}}_calculateBarValuePixels(t,e){const i=this,n=i._cachedMeta,o=n.vScale,{base:a,minBarLength:r}=e,l=i.getParsed(t),c=l._custom,h=an(c);let d,u,g=l[o.axis],f=0,p=n._stacked?i.applyStack(o,l):g;p!==g&&(f=p-g,p=g),h&&(g=c.barStart,p=c.barEnd-c.barStart,0!==g&&V(g)!==V(c.barEnd)&&(f=0),f+=g);const m=s(a)||h?f:a;let x=o.getPixelForValue(m);return d=this.chart.getDataVisibility(t)?o.getPixelForValue(f+p):x,u=d-x,void 0!==r&&Math.abs(u)<r&&(u=u<0?-r:r,0===g&&(x-=u/2),d=x+u),{size:u,base:x,head:d,center:d+u/2}}_calculateBarIndexPixels(t,e,i){const n=this,o=n.chart.options.skipNull?n._getStackCount(t):e.stackCount,a="flex"===i.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let a=t>0?o[t-1]:null,r=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===a&&(a=s-(null===r?e.end-e.start:r-s)),null===r&&(r=s+s-a);const c=s-(s-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,i,o):function(t,e,i,n){const o=i.barThickness;let a,r;return s(o)?(a=e.min*i.categoryPercentage,r=i.barPercentage):(a=o*n,r=1),{chunk:a/n,ratio:r,start:e.pixels[t]-a/2}}(t,e,i,o),r=n._getStackIndex(n.index,n._cachedMeta.stack),l=a.start+a.chunk*r+a.chunk/2,c=Math.min(h(i.maxBarThickness,1/0),a.chunk*a.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){const t=this,e=t.chart,i=t._cachedMeta,n=i.vScale,o=i.data,s=o.length;let a=0;for(it(e.ctx,e.chartArea);a<s;++a)isNaN(t.getParsed(a)[n.axis])||o[a].draw(t._ctx);nt(e.ctx)}}rn.id="bar",rn.defaults={datasetElementType:!1,dataElementType:"bar",dataElementOptions:["backgroundColor","borderColor","borderSkipped","borderWidth","borderRadius","barPercentage","barThickness","base","categoryPercentage","maxBarThickness","minBarLength"],interaction:{mode:"index"},hover:{},datasets:{categoryPercentage:.8,barPercentage:.9,animation:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},scales:{_index_:{type:"category",offset:!0,gridLines:{offsetGridLines:!0}},_value_:{type:"linear",beginAtZero:!0}}};class ln extends li{initialize(){this.enableOptionSharing=!0,super.initialize()}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=[];let c,h,d;for(c=i,h=i+n;c<h;++c)d=e[c],l.push({x:o.parse(y(d,a),c),y:s.parse(y(d,r),c),_custom:d&&d.r&&+d.r});return l}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size());return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:n}=e,o=this.getParsed(t),s=i.getLabelForValue(o.x),a=n.getLabelForValue(o.y),r=o._custom;return{label:e.label,value:"("+s+", "+a+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o=this,s="reset"===n,{xScale:a,yScale:r}=o._cachedMeta,l=o.resolveDataElementOptions(e,n),c=o.getSharedOptions(l),h=o.includeOptions(n,c);for(let l=e;l<e+i;l++){const e=t[l],i=!s&&o.getParsed(l),c=s?a.getPixelForDecimal(.5):a.getPixelForValue(i.x),d=s?r.getBasePixel():r.getPixelForValue(i.y),u={x:c,y:d,skip:isNaN(c)||isNaN(d)};h&&(u.options=o.resolveDataElementOptions(l,n),s&&(u.options.radius=0)),o.updateElement(e,l,u,n)}o.updateSharedOptions(c,n,l)}resolveDataElementOptions(t,e){const i=this,n=i.chart,o=i.getParsed(t);let s=super.resolveDataElementOptions(t,e);const a=i.getContext(t,"active"===e);return s.$shared&&(s=Object.assign({},s,{$shared:!1})),"active"!==e&&(s.radius=0),s.radius+=Vt([o&&o._custom,i._config.radius,n.options.elements.point.radius],a,t),s}}ln.id="bubble",ln.defaults={datasetElementType:!1,dataElementType:"point",dataElementOptions:["backgroundColor","borderColor","borderWidth","hitRadius","radius","pointStyle","rotation"],animation:{numbers:{properties:["x","y","borderWidth","radius"]}},scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class cn extends li{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;let o,s;for(o=t,s=t+e;o<s;++o)n._parsed[o]=+i[o]}getRingIndex(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&++e;return e}_getRotation(){return B(h(this._config.rotation,this.chart.options.rotation)-90)}_getCircumference(){return B(h(this._config.circumference,this.chart.options.circumference))}_getRotationExtents(){let t=P,e=-P;const i=this;for(let n=0;n<i.chart.data.datasets.length;++n)if(i.chart.isDatasetVisible(n)){const o=i.chart.getDatasetMeta(n).controller,s=o._getRotation(),a=o._getCircumference();t=Math.min(t,s),e=Math.max(e,s+a)}return{rotation:t,circumference:e-t}}update(t){const e=this,i=e.chart,{chartArea:n,options:o}=i,s=e._cachedMeta,a=s.data,r=o.cutoutPercentage/100||0,l=e._getRingWeight(e.index),{circumference:c,rotation:h}=e._getRotationExtents(),{ratioX:d,ratioY:u,offsetX:g,offsetY:f}=function(t,e,i){let n=1,o=1,s=0,a=0;if(e<P){let r=t%P;r+=r>=k?-P:r<-k?P:0;const l=r+e,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),g=r<=0&&l>=0||l>=P,f=r<=T&&l>=T||l>=P+T,p=r<=-T&&l>=-T||l>=k+T,m=r===-k||l>=k?-1:Math.min(c,c*i,d,d*i),x=p?-1:Math.min(h,h*i,u,u*i),b=g?1:Math.max(c,c*i,d,d*i),_=f?1:Math.max(h,h*i,u,u*i);n=(b-m)/2,o=(_-x)/2,s=-(b+m)/2,a=-(_+x)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:a}}(h,c,r),p=e.getMaxBorderWidth()+e.getMaxOffset(a),m=(n.right-n.left-p)/d,x=(n.bottom-n.top-p)/u,b=Math.max(Math.min(m,x)/2,0),_=(b-Math.max(b*r,0))/e._getVisibleDatasetWeightTotal();e.offsetX=g*b,e.offsetY=f*b,s.total=e.calculateTotal(),e.outerRadius=b-_*e._getRingWeightOffset(e.index),e.innerRadius=Math.max(e.outerRadius-_*l,0),e.updateElements(a,0,a.length,t)}_circumference(t,e){const i=this,n=i.chart.options,o=i._cachedMeta,s=i._getCircumference();return e&&n.animation.animateRotate?0:this.chart.getDataVisibility(t)?i.calculateCircumference(o._parsed[t]*s/P):0}updateElements(t,e,i,n){const o=this,s="reset"===n,a=o.chart,r=a.chartArea,l=a.options.animation,c=(r.left+r.right)/2,h=(r.top+r.bottom)/2,d=s&&l.animateScale,u=d?0:o.innerRadius,g=d?0:o.outerRadius,f=o.resolveDataElementOptions(e,n),p=o.getSharedOptions(f),m=o.includeOptions(n,p);let x,b=o._getRotation();for(x=0;x<e;++x)b+=o._circumference(x,s);for(x=e;x<e+i;++x){const e=o._circumference(x,s),i=t[x],a={x:c+o.offsetX,y:h+o.offsetY,startAngle:b,endAngle:b+e,circumference:e,outerRadius:g,innerRadius:u};m&&(a.options=p||o.resolveDataElementOptions(x,n)),b+=e,o.updateElement(i,x,a,n)}o.updateSharedOptions(p,n,f)}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const e=t._parsed[i];!isNaN(e)&&this.chart.getDataVisibility(i)&&(n+=Math.abs(e))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?P*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta;return{label:(this.chart.data.labels||[])[t]||"",value:e._parsed[t]}}getMaxBorderWidth(t){const e=this;let i=0;const n=e.chart;let o,s,a,r,l;if(!t)for(o=0,s=n.data.datasets.length;o<s;++o)if(n.isDatasetVisible(o)){a=n.getDatasetMeta(o),t=a.data,r=a.controller,r!==e&&r.configure();break}if(!t)return 0;for(o=0,s=t.length;o<s;++o)l=r.resolveDataElementOptions(o),"inner"!==l.borderAlign&&(i=Math.max(i,l.borderWidth||0,l.hoverBorderWidth||0));return i}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(h(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}cn.id="doughnut",cn.defaults={datasetElementType:!1,dataElementType:"arc",dataElementOptions:["backgroundColor","borderColor","borderWidth","borderAlign","offset"],animation:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth"]},animateRotate:!0,animateScale:!1},aspectRatio:1,cutoutPercentage:50,rotation:0,circumference:360,plugins:{legend:{labels:{generateLabels(t){const e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(((e,i)=>{const n=t.getDatasetMeta(0).controller.getStyle(i);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,hidden:!t.getDataVisibility(i),index:i}})):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return a(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class hn extends li{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this,i=e._cachedMeta,{dataset:n,data:o=[]}=i,s=e.chart._animationsDisabled;let{start:a,count:r}=function(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:a,_parsed:r}=t,l=a.axis,{min:c,max:h,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(o=X(Math.min(rt(r,a.axis,c).lo,i?n:rt(e,l,a.getPixelForValue(c)).lo),0,n-1)),s=u?X(Math.max(rt(r,a.axis,h).hi+1,i?0:rt(e,l,a.getPixelForValue(h)).hi+1),o,n)-o:n-o}return{start:o,count:s}}(i,o,s);if(e._drawStart=a,e._drawCount=r,function(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}(i)&&!s&&(a=0,r=o.length),"resize"!==t){const i={points:o,options:e.resolveDatasetElementOptions()};e.updateElement(n,void 0,i,t)}e.updateElements(o,a,r,t)}updateElements(t,e,i,n){const o=this,s="reset"===n,{xScale:a,yScale:r,_stacked:l}=o._cachedMeta,c=o.resolveDataElementOptions(e,n),d=o.getSharedOptions(c),u=o.includeOptions(n,d),g=h(o._config.spanGaps,o.chart.options.spanGaps),f=E(g)?g:Number.POSITIVE_INFINITY;let p=e>0&&o.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=o.getParsed(c),h=a.getPixelForValue(i.x,c),g=s?r.getBasePixel():r.getPixelForValue(l?o.applyStack(r,i):i.y,c),m={x:h,y:g,skip:isNaN(h)||isNaN(g),stop:c>0&&i.x-p.x>f};u&&(m.options=d||o.resolveDataElementOptions(c,n)),o.updateElement(e,c,m,n),p=i}o.updateSharedOptions(d,n,c)}resolveDatasetElementOptions(t){const e=this._config,i=this.chart.options,n=i.elements.line,o=super.resolveDatasetElementOptions(t),s=h(e.showLine,i.showLine);return o.spanGaps=h(e.spanGaps,i.spanGaps),o.tension=h(e.tension,n.tension),o.stepped=Vt([e.stepped,n.stepped]),s||(o.borderWidth=0),o}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset.options.borderWidth||0,i=t.data||[];if(!i.length)return e;const n=i[0].size(),o=i[i.length-1].size();return Math.max(e,n,o)/2}draw(){this._cachedMeta.dataset.updateControlPoints(this.chart.chartArea),super.draw()}}hn.id="line",hn.defaults={datasetElementType:"line",datasetElementOptions:["backgroundColor","borderCapStyle","borderColor","borderDash","borderDashOffset","borderJoinStyle","borderWidth","capBezierPoints","cubicInterpolationMode","fill"],dataElementType:"point",dataElementOptions:{backgroundColor:"pointBackgroundColor",borderColor:"pointBorderColor",borderWidth:"pointBorderWidth",hitRadius:"pointHitRadius",hoverHitRadius:"pointHitRadius",hoverBackgroundColor:"pointHoverBackgroundColor",hoverBorderColor:"pointHoverBorderColor",hoverBorderWidth:"pointHoverBorderWidth",hoverRadius:"pointHoverRadius",pointStyle:"pointStyle",radius:"pointRadius",rotation:"pointRotation"},showLine:!0,spanGaps:!1,interaction:{mode:"index"},hover:{},scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class dn extends li{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}_updateRadius(){const t=this,e=t.chart,i=e.chartArea,n=e.options,o=Math.min(i.right-i.left,i.bottom-i.top),s=Math.max(o/2,0),a=(s-Math.max(n.cutoutPercentage?s/100*n.cutoutPercentage:1,0))/e.getVisibleDatasetCount();t.outerRadius=s-a*t.index,t.innerRadius=t.outerRadius-a}updateElements(t,e,i,n){const o=this,s="reset"===n,a=o.chart,r=o.getDataset(),l=a.options,c=l.animation,h=o._cachedMeta.rScale,d=h.xCenter,u=h.yCenter,g=B(l.startAngle)-.5*k;let f,p=g;for(o._cachedMeta.count=o.countVisibleElements(),f=0;f<e;++f)p+=o._computeAngle(f,n);for(f=e;f<e+i;f++){const e=t[f];let i=p,a=p+o._computeAngle(f,n),l=this.chart.getDataVisibility(f)?h.getDistanceFromCenterForValue(r.data[f]):0;p=a,s&&(c.animateScale&&(l=0),c.animateRotate&&(i=g,a=g));const m={x:d,y:u,innerRadius:0,outerRadius:l,startAngle:i,endAngle:a,options:o.resolveDataElementOptions(f,n)};o.updateElement(e,f,m,n)}}countVisibleElements(){const t=this.getDataset(),e=this._cachedMeta;let i=0;return e.data.forEach(((e,n)=>{!isNaN(t.data[n])&&this.chart.getDataVisibility(n)&&i++})),i}_computeAngle(t,e){const i=this,n=i._cachedMeta.count,o=i.getDataset();if(isNaN(o.data[t])||!this.chart.getDataVisibility(t))return 0;const s=i.getContext(t,"active"===e);return B(Vt([i.chart.options.elements.arc.angle,360/n],s,t))}}dn.id="polarArea",dn.defaults={dataElementType:"arc",dataElementOptions:["backgroundColor","borderColor","borderWidth","borderAlign","offset"],animation:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]},animateRotate:!0,animateScale:!0},aspectRatio:1,datasets:{indexAxis:"r"},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,gridLines:{circular:!0},pointLabels:{display:!1}}},startAngle:0,plugins:{legend:{labels:{generateLabels(t){const e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(((e,i)=>{const n=t.getDatasetMeta(0).controller.getStyle(i);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,hidden:!t.getDataVisibility(i),index:i}})):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}}};class un extends cn{}un.id="pie",un.defaults={cutoutPercentage:0};class gn extends li{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}update(t){const e=this,i=e._cachedMeta,n=i.dataset,o=i.data||[],s=i.iScale.getLabels();if("resize"!==t){const i={points:o,_loop:!0,_fullLoop:s.length===o.length,options:e.resolveDatasetElementOptions()};e.updateElement(n,void 0,i,t)}e.updateElements(o,0,o.length,t)}updateElements(t,e,i,n){const o=this,s=o.getDataset(),a=o._cachedMeta.rScale,r="reset"===n;for(let l=e;l<e+i;l++){const e=t[l],i=o.resolveDataElementOptions(l,n),c=a.getPointPositionForValue(l,s.data[l]),h=r?a.xCenter:c.x,d=r?a.yCenter:c.y,u={x:h,y:d,angle:c.angle,skip:isNaN(h)||isNaN(d),options:i};o.updateElement(e,l,u,n)}}resolveDatasetElementOptions(t){const e=this._config,i=this.chart.options,n=super.resolveDatasetElementOptions(t),o=h(e.showLine,i.showLine);return n.spanGaps=h(e.spanGaps,i.spanGaps),n.tension=h(e.tension,i.elements.line.tension),o||(n.borderWidth=0),n}}gn.id="radar",gn.defaults={datasetElementType:"line",datasetElementOptions:["backgroundColor","borderColor","borderCapStyle","borderDash","borderDashOffset","borderJoinStyle","borderWidth","fill"],dataElementType:"point",dataElementOptions:{backgroundColor:"pointBackgroundColor",borderColor:"pointBorderColor",borderWidth:"pointBorderWidth",hitRadius:"pointHitRadius",hoverBackgroundColor:"pointHoverBackgroundColor",hoverBorderColor:"pointHoverBorderColor",hoverBorderWidth:"pointHoverBorderWidth",hoverRadius:"pointHoverRadius",pointStyle:"pointStyle",radius:"pointRadius",rotation:"pointRotation"},aspectRatio:1,spanGaps:!1,scales:{r:{type:"radialLinear"}},datasets:{indexAxis:"r"},elements:{line:{fill:"start",tension:0}}};class fn extends hn{}fn.id="scatter",fn.defaults={scales:{x:{type:"linear"},y:{type:"linear"}},datasets:{showLine:!1,fill:!1},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}}};var pn=Object.freeze({__proto__:null,BarController:rn,BubbleController:ln,DoughnutController:cn,LineController:hn,PolarAreaController:dn,PieController:un,RadarController:gn,ScatterController:fn});function mn(t,e){const{startAngle:i,endAngle:n,pixelMargin:o,x:s,y:a,outerRadius:r,innerRadius:l}=e;let c=o/r;t.beginPath(),t.arc(s,a,r,i-c,n+c),l>o?(c=o/l,t.arc(s,a,l,n+c,i-c,!0)):t.arc(s,a,o,n+T,i-T),t.closePath(),t.clip()}function xn(t,e){const{x:i,y:n,startAngle:o,endAngle:s,pixelMargin:a}=e,r=Math.max(e.outerRadius-a,0),l=e.innerRadius+a;t.beginPath(),t.arc(i,n,r,o,s),t.arc(i,n,l,s,o,!0),t.closePath()}function bn(t,e){const{x:i,y:n,startAngle:o,endAngle:s,pixelMargin:a,options:r}=e,l=e.outerRadius,c=e.innerRadius+a,h="inner"===r.borderAlign;r.borderWidth&&(h?(t.lineWidth=2*r.borderWidth,t.lineJoin="round"):(t.lineWidth=r.borderWidth,t.lineJoin="bevel"),e.fullCircles&&function(t,e,i){const{x:n,y:o,startAngle:s,endAngle:a,pixelMargin:r}=e,l=Math.max(e.outerRadius-r,0),c=e.innerRadius+r;let h;for(i&&(e.endAngle=e.startAngle+P,mn(t,e),e.endAngle=a,e.endAngle===e.startAngle&&(e.endAngle+=P,e.fullCircles--)),t.beginPath(),t.arc(n,o,c,s+P,s,!0),h=0;h<e.fullCircles;++h)t.stroke();for(t.beginPath(),t.arc(n,o,l,s,s+P),h=0;h<e.fullCircles;++h)t.stroke()}(t,e,h),h&&mn(t,e),t.beginPath(),t.arc(i,n,l,o,s),t.arc(i,n,c,s,o,!0),t.closePath(),t.stroke())}class _n extends ci{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=H(n,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i);return(h>=P||$(o,a,r))&&(s>=l&&s<=c)}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),r=(n+o)/2,l=(s+a)/2;return{x:e+Math.cos(r)*l,y:i+Math.sin(r)*l}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const e=this,i=e.options,n=i.offset||0;if(e.pixelMargin="inner"===i.borderAlign?.33:0,e.fullCircles=Math.floor(e.circumference/P),0!==e.circumference){if(t.save(),n&&e.circumference<P){const i=(e.startAngle+e.endAngle)/2;t.translate(Math.cos(i)*n,Math.sin(i)*n)}t.fillStyle=i.backgroundColor,t.strokeStyle=i.borderColor,function(t,e){if(e.fullCircles){e.endAngle=e.startAngle+P,xn(t,e);for(let i=0;i<e.fullCircles;++i)t.fill();e.endAngle=e.startAngle+e.circumference%P}xn(t,e),t.fill()}(t,e),bn(t,e),t.restore()}}}function yn(t,e,i){t.lineTo(i.x,i.y)}function vn(t,e,i){i=i||{};const n=t.length,o=Math.max(i.start||0,e.start),s=Math.min(i.end||n-1,e.end);return{count:n,start:o,loop:e.loop,ilen:s<o?n+s-o:s-o}}function Mn(t,e,i,n){const{points:o,options:s}=e,{count:a,start:r,loop:l,ilen:c}=vn(o,i,n),h=function(t){return t.stepped?ot:t.tension?st:yn}(s);let d,u,g,{move:f=!0,reverse:p}=n||{};for(d=0;d<=c;++d)u=o[(r+(p?c-d:d))%a],u.skip||(f?(t.moveTo(u.x,u.y),f=!1):h(t,g,u,p,s.stepped),g=u);return l&&(u=o[(r+(p?c:0))%a],h(t,g,u,p,s.stepped)),!!l}function wn(t,e,i,n){const o=e.points,{count:s,start:a,ilen:r}=vn(o,i,n),{move:l=!0,reverse:c}=n||{};let h,d,u,g,f,p,m=0,x=0;const b=t=>(a+(c?r-t:t))%s,_=()=>{g!==f&&(t.lineTo(m,f),t.lineTo(m,g),t.lineTo(m,p))};for(l&&(d=o[b(0)],t.moveTo(d.x,d.y)),h=0;h<=r;++h){if(d=o[b(h)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<g?g=i:i>f&&(f=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=n,x=0,g=f=i),p=i}_()}function kn(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._loop||e.tension||e.stepped||i)?wn:Mn}_n.id="arc",_n.defaults={borderAlign:"center",borderColor:"#fff",borderWidth:2,offset:0},_n.defaultRoutes={backgroundColor:"backgroundColor"};class Pn extends ci{constructor(t){super(),this.options=void 0,this._loop=void 0,this._fullLoop=void 0,this._points=void 0,this._segments=void 0,this._pointsUpdated=!1,t&&Object.assign(this,t)}updateControlPoints(t){const e=this,i=e.options;if(i.tension&&!i.stepped&&!e._pointsUpdated){const n=i.spanGaps?e._loop:e._fullLoop;Wi(e._points,i,t,n),e._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments}get points(){return this._points}get segments(){return this._segments||(this._segments=Zi(this))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this,n=i.options,o=t[e],s=i.points,a=Gi(i,{property:e,start:o,end:o});if(!a.length)return;const r=[],l=function(t){return t.stepped?Hi:t.tension?ji:Ni}(n);let c,h;for(c=0,h=a.length;c<h;++c){const{start:i,end:h}=a[c],d=s[i],u=s[h];if(d===u){r.push(d);continue}const g=l(d,u,Math.abs((o-d[e])/(u[e]-d[e])),n.stepped);g[e]=t[e],r.push(g)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return kn(this)(t,this,e,i)}path(t,e,i){const n=this,o=n.segments,s=o.length,a=kn(n);let r=n._loop;e=e||0,i=i||n.points.length-e;for(let l=0;l<s;++l)r&=a(t,n,o[l],{start:e,end:e+i-1});return!!r}draw(t,e,i,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),function(t,e){t.lineCap=e.borderCapStyle,t.setLineDash(e.borderDash),t.lineDashOffset=e.borderDashOffset,t.lineJoin=e.borderJoinStyle,t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor}(t,o),t.beginPath(),this.path(t,i,n)&&t.closePath(),t.stroke(),t.restore(),this._pointsUpdated=!1)}}Pn.id="line",Pn.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,fill:!1,tension:0},Pn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class Sn extends ci{constructor(t){super(),this.options=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){const i=this.options,{x:n}=this.getProps(["x"],e);return Math.abs(t-n)<i.radius+i.hitRadius}inYRange(t,e){const i=this.options,{y:n}=this.getProps(["x"],e);return Math.abs(t-n)<i.radius+i.hitRadius}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(){const t=this.options||{},e=Math.max(t.radius,t.hoverRadius)||0;return 2*(e+(e&&t.borderWidth||0))}draw(t){const e=this,i=e.options;e.skip||i.radius<=0||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,tt(t,i,e.x,e.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Dn(t,e){const{x:i,y:n,base:o,width:s,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,c,h,d;return t.horizontal?(d=a/2,r=Math.min(i,o),l=Math.max(i,o),c=n-d,h=n+d):(d=s/2,r=i-d,l=i+d,c=Math.min(n,o),h=Math.max(n,o)),{left:r,top:c,right:l,bottom:h}}function On(t){let e=t.options.borderSkipped;const i={};return e?(e=t.horizontal?Tn(e,"left","right",t.base>t.x):Tn(e,"bottom","top",t.base<t.y),i[e]=!0,i):i}function Tn(t,e,i,n){var o,s,a;return n?(a=i,t=An(t=(o=t)===(s=e)?a:o===a?s:o,i,e)):t=An(t,e,i),t}function An(t,e,i){return"start"===t?e:"end"===t?i:t}function Cn(t,e,i,n){return t?0:Math.max(Math.min(e,n),i)}function Ln(t){const e=Dn(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=On(t),s=Et(n);return{t:Cn(o.top,s.top,0,i),r:Cn(o.right,s.right,0,e),b:Cn(o.bottom,s.bottom,0,i),l:Cn(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const n=Ft(t.options.borderRadius),o=Math.min(e,i),s=On(t);return{topLeft:Cn(s.top||s.left,n.topLeft,0,o),topRight:Cn(s.top||s.right,n.topRight,0,o),bottomLeft:Cn(s.bottom||s.left,n.bottomLeft,0,o),bottomRight:Cn(s.bottom||s.right,n.bottomRight,0,o)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function Rn(t,e,i,n){const o=null===e,s=null===i,a=t&&!(o&&s)&&Dn(t,n);return a&&(o||e>=a.left&&e<=a.right)&&(s||i>=a.top&&i<=a.bottom)}function En(t,e){const{x:i,y:n,w:o,h:s,radius:a}=e;t.arc(i+a.topLeft,n+a.topLeft,a.topLeft,-T,k,!0),t.lineTo(i,n+s-a.bottomLeft),t.arc(i+a.bottomLeft,n+s-a.bottomLeft,a.bottomLeft,k,T,!0),t.lineTo(i+o-a.bottomRight,n+s),t.arc(i+o-a.bottomRight,n+s-a.bottomRight,a.bottomRight,T,0,!0),t.lineTo(i+o,n+a.topRight),t.arc(i+o-a.topRight,n+a.topRight,a.topRight,0,-T,!0),t.lineTo(i+a.topLeft,n)}function Fn(t,e){t.rect(e.x,e.y,e.w,e.h)}Sn.id="point",Sn.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3},Sn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class zn extends ci{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,t&&Object.assign(this,t)}draw(t){const e=this.options,{inner:i,outer:n}=Ln(this),o=(s=n.radius).topLeft||s.topRight||s.bottomLeft||s.bottomRight?En:Fn;var s;t.save(),n.w===i.w&&n.h===i.h||(t.beginPath(),o(t,n),t.clip(),o(t,i),t.fillStyle=e.borderColor,t.fill("evenodd")),t.beginPath(),o(t,i),t.fillStyle=e.backgroundColor,t.fill(),t.restore()}inRange(t,e,i){return Rn(this,t,e,i)}inXRange(t,e){return Rn(this,t,null,e)}inYRange(t,e){return Rn(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}zn.id="bar",zn.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0},zn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var In=Object.freeze({__proto__:null,ArcElement:_n,LineElement:Pn,PointElement:Sn,BarElement:zn});function Vn(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=h(i&&i.target,i);return void 0===n&&(n=!!e.backgroundColor),!1!==n&&null!==n&&(!0===n?"origin":n)}(t);if(r(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return l(o)&&Math.floor(o)===o?("-"!==n[0]&&"+"!==n[0]||(o=e+o),!(o===e||o<0||o>=i)&&o):["origin","start","end","stack"].indexOf(n)>=0&&n}class Bn{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:P},i.reverse?t.arc(n,o,s,e.end,e.start,!0):t.arc(n,o,s,e.start,e.end),!i.bounds}interpolate(t,e){const{x:i,y:n,radius:o}=this,s=t.angle;if("angle"===e)return{x:i+Math.cos(s)*o,y:n+Math.sin(s)*o,angle:s}}}function Wn(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=[],a=n.reverse?e.max:e.min,l=n.reverse?e.min:e.max;let c,h,d;if(d="start"===i?a:"end"===i?l:r(i)?i.value:e.getBaseValue(),n.gridLines.circular)return h=e.getPointPositionForValue(0,a),new Bn({x:h.x,y:h.y,radius:e.getDistanceFromCenterForValue(d)});for(c=0;c<o;++c)s.push(e.getPointPositionForValue(c,d));return s}(t):function(t){const{scale:e={},fill:i}=t;let n,o=null;return"start"===i?o=e.bottom:"end"===i?o=e.top:r(i)?o=e.getPixelForValue(i.value):e.getBasePixel&&(o=e.getBasePixel()),l(o)?(n=e.isHorizontal(),{x:n?o:null,y:n?null:o}):null}(t)}function Nn(t){const{chart:e,scale:i,index:n,line:o}=t,s=[],a=o.segments,r=o.points,l=function(t,e){const i=[],n=t.getSortedVisibleDatasetMetas();for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;Hn(o)&&i.unshift(o.dataset)}return i}(e,n);l.push(Un({x:null,y:i.bottom},o));for(let t=0;t<a.length;t++){const e=a[t];for(let t=e.start;t<=e.end;t++)jn(s,r[t],l)}return new Pn({points:s,options:{}})}const Hn=t=>"line"===t.type&&!t.hidden;function jn(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:a,last:r,point:l}=Yn(s,e,"x");if(!(!l||a&&r))if(a)n.unshift(l);else if(t.push(l),!r)break}t.push(...n)}function Yn(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,a=t.points;let r=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=a[e.start][i],c=a[e.end][i];if(o>=n&&o<=c){r=o===n,l=o===c;break}}return{first:r,last:l,point:n}}function Un(t,e){let i=[],n=!1;return a(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach((t=>{const e=o[t.start],a=o[t.end];null!==n?(s.push({x:e.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:e.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new Pn({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function $n(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!l(n))return n;if(s=t[n],!s)return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function Xn(t,e,i){t.beginPath(),e.path(t),t.lineTo(e.last().x,i),t.lineTo(e.first().x,i),t.closePath(),t.clip()}function Kn(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=U(o),s=U(s)),{property:t,start:o,end:s}}function qn(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function Gn(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:a,end:r}=i||{};"x"===s&&(t.beginPath(),t.rect(a,n,r-a,o-n),t.clip())}function Zn(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}function Qn(t,e){const{line:i,target:n,property:o,color:s,scale:a}=e,r=function(t,e,i){const n=t.segments,o=t.points,s=e.points,a=[];for(let t=0;t<n.length;t++){const r=n[t],l=Kn(i,o[r.start],o[r.end],r.loop);if(!e.segments){a.push({source:r,target:l,start:o[r.start],end:o[r.end]});continue}const c=Gi(e,l);for(let t=0;t<c.length;++t){const e=c[t],n=Kn(i,s[e.start],s[e.end],e.loop),h=qi(r,o,n);for(let t=0;t<h.length;t++)a.push({source:h[t],target:e,start:{[i]:qn(l,n,"start",Math.max)},end:{[i]:qn(l,n,"end",Math.min)}})}}return a}(i,n,o);t.fillStyle=s;for(let e=0,s=r.length;e<s;++e){const{source:s,target:l,start:c,end:h}=r[e];t.save(),Gn(t,a,Kn(o,c,h)),t.beginPath();const d=!!i.pathSegment(t,s);d?t.closePath():Zn(t,n,h,o);const u=!!n.pathSegment(t,l,{move:d,reverse:!0}),g=d&&u;g||Zn(t,n,c,o),t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}var Jn={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=i.propagate,s=[];let a,r,l,c;for(r=0;r<n;++r)a=t.getDatasetMeta(r),l=a.dataset,c=null,l&&l.options&&l instanceof Pn&&(c={visible:t.isDatasetVisible(r),index:r,fill:Vn(l,r,n),chart:t,scale:a.vScale,line:l}),a.$filler=c,s.push(c);for(r=0;r<n;++r)c=s[r],c&&!1!==c.fill&&(c.fill=$n(s,r,o))},beforeDatasetsDraw(t){const e=t.getSortedVisibleDatasetMetas(),i=t.chartArea;let n,o;for(n=e.length-1;n>=0;--n)o=e[n].$filler,o&&o.line.updateControlPoints(i)},beforeDatasetDraw(t,e){const i=t.chartArea,n=t.ctx,o=e.meta.$filler;if(!o||!1===o.fill)return;const s=function(t){const{chart:e,fill:i,line:n}=t;if(l(i))return function(t,e){const i=t.getDatasetMeta(e);return i&&t.isDatasetVisible(e)?i.dataset:null}(e,i);if("stack"===i)return Nn(t);const o=Wn(t);return o instanceof Bn?o:Un(o,n)}(o),{line:a,scale:r}=o,c=a.options,h=c.fill,d=c.backgroundColor,{above:u=d,below:g=d}=h||{};s&&a.points.length&&(it(n,i),function(t,e){const{line:i,target:n,above:o,below:s,area:a,scale:r}=e,l=i._loop?"angle":"x";t.save(),"x"===l&&s!==o&&(Xn(t,n,a.top),Qn(t,{line:i,target:n,color:o,scale:r,property:l}),t.restore(),t.save(),Xn(t,n,a.bottom)),Qn(t,{line:i,target:n,color:s,scale:r,property:l}),t.restore()}(n,{line:a,target:s,above:u,below:g,area:i,scale:r}),nt(n))},defaults:{propagate:!0}};function to(t,e){const{boxWidth:i}=t;return t.usePointStyle&&i>e||s(i)?e:i}function eo(t,e){const{boxHeight:i}=t;return t.usePointStyle&&i>e||s(i)?e:i}class io extends ci{constructor(t){super(),Object.assign(this,t),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.columnWidths=void 0,this.columnHeights=void 0,this.lineWidths=void 0,this._minSize=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.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.position=void 0,this.weight=void 0,this.fullWidth=void 0}beforeUpdate(){}update(t,e,i){const n=this;n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n._margins=i,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n.beforeBuildLabels(),n.buildLabels(),n.afterBuildLabels(),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate()}afterUpdate(){}beforeSetDimensions(){}setDimensions(){const t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t._minSize={width:0,height:0}}afterSetDimensions(){}beforeBuildLabels(){}buildLabels(){const t=this,e=t.options.labels||{};let i=d(e.generateLabels,[t.chart],t)||[];e.filter&&(i=i.filter((i=>e.filter(i,t.chart.data)))),e.sort&&(i=i.sort(((i,n)=>e.sort(i,n,t.chart.data)))),t.options.reverse&&i.reverse(),t.legendItems=i}afterBuildLabels(){}beforeFit(){}fit(){const t=this,e=t.options,i=e.labels,n=e.display,o=t.ctx,s=It(i.font,t.chart.options.font),a=s.size,r=to(i,a),l=eo(i,a),c=Math.max(l,a),h=t.legendHitBoxes=[],d=t._minSize,u=t.isHorizontal(),g=t._computeTitleHeight();if(u?(d.width=t.maxWidth,d.height=n?10:0):(d.width=n?10:0,d.height=t.maxHeight),n){if(o.font=s.string,u){const e=t.lineWidths=[0];let n=g;o.textAlign="left",o.textBaseline="middle",t.legendItems.forEach(((t,s)=>{const l=r+a/2+o.measureText(t.text).width;(0===s||e[e.length-1]+l+2*i.padding>d.width)&&(n+=c+i.padding,e[e.length-(s>0?0:1)]=0),h[s]={left:0,top:0,width:l,height:c},e[e.length-1]+=l+i.padding})),d.height+=n}else{const e=i.padding,n=t.columnWidths=[],s=t.columnHeights=[];let l=i.padding,u=0,f=0;const p=d.height-g;t.legendItems.forEach(((t,d)=>{const g=r+a/2+o.measureText(t.text).width;d>0&&f+a+2*e>p&&(l+=u+i.padding,n.push(u),s.push(f),u=0,f=0),u=Math.max(u,g),f+=a+e,h[d]={left:0,top:0,width:g,height:c}})),l+=u,n.push(u),s.push(f),d.width+=l}t.width=Math.min(d.width,e.maxWidth||D),t.height=Math.min(d.height,e.maxHeight||D)}else t.width=d.width=t.height=d.height=0}afterFit(){}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){const t=this,e=t.options,i=e.labels,n=w.color,o=t.height,s=t.columnHeights,a=t.width,r=t.lineWidths;if(!e.display)return;t.drawTitle();const l=Yi(e.rtl,t.left,t._minSize.width),c=t.ctx,d=It(i.font,t.chart.options.font),u=i.color,g=d.size;let f;c.textAlign=l.textAlign("left"),c.textBaseline="middle",c.lineWidth=.5,c.strokeStyle=u,c.fillStyle=u,c.font=d.string;const p=to(i,g),m=eo(i,g),x=Math.max(g,m),b=t.legendHitBoxes,_=function(t,n){switch(e.align){case"start":return i.padding;case"end":return t-n;default:return(t-n+i.padding)/2}},y=t.isHorizontal(),v=this._computeTitleHeight();f=y?{x:t.left+_(a,r[0]),y:t.top+i.padding+v,line:0}:{x:t.left+i.padding,y:t.top+_(o,s[0])+v,line:0},Ui(t.ctx,e.textDirection);const M=x+i.padding;t.legendItems.forEach(((e,d)=>{const u=c.measureText(e.text).width,v=p+g/2+u;let w=f.x,k=f.y;l.setWidth(t._minSize.width),y?d>0&&w+v+i.padding>t.left+t._minSize.width&&(k=f.y+=M,f.line++,w=f.x=t.left+_(a,r[f.line])):d>0&&k+M>t.top+t._minSize.height&&(w=f.x=w+t.columnWidths[f.line]+i.padding,f.line++,k=f.y=t.top+_(o,s[f.line]));const P=l.x(w);!function(t,e,o){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;c.save();const s=h(o.lineWidth,1);if(c.fillStyle=h(o.fillStyle,n),c.lineCap=h(o.lineCap,"butt"),c.lineDashOffset=h(o.lineDashOffset,0),c.lineJoin=h(o.lineJoin,"miter"),c.lineWidth=s,c.strokeStyle=h(o.strokeStyle,n),c.setLineDash(h(o.lineDash,[])),i&&i.usePointStyle){const i={radius:p*Math.SQRT2/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:s},n=l.xPlus(t,p/2);tt(c,i,n,e+g/2)}else{const i=e+Math.max((g-m)/2,0);c.fillRect(l.leftForLtr(t,p),i,p,m),0!==s&&c.strokeRect(l.leftForLtr(t,p),i,p,m)}c.restore()}(P,k,e),b[d].left=l.leftForLtr(P,b[d].width),b[d].top=k,function(t,e,i,n){const o=g/2,s=l.xPlus(t,p+o),a=e+x/2;c.fillText(i.text,s,a),i.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(s,a),c.lineTo(l.xPlus(s,n),a),c.stroke())}(P,k,e,u),y?f.x+=v+i.padding:f.y+=M})),$i(t.ctx,e.textDirection)}drawTitle(){const t=this,e=t.options,i=e.title,n=It(i.font,t.chart.options.font),o=zt(i.padding);if(!i.display)return;const s=Yi(e.rtl,t.left,t._minSize.width),a=t.ctx,r=i.position;let l,c;const h=n.size/2;let d=t.top+o.top+h,u=t.left,g=t.width;if(this.isHorizontal())switch(g=Math.max(...t.lineWidths),e.align){case"start":break;case"end":u=t.right-g;break;default:u=(t.left+t.right)/2-g/2}else{const i=Math.max(...t.columnHeights);switch(e.align){case"start":break;case"end":d+=t.height-i;break;default:d+=(t.height-i)/2}}switch(r){case"start":l=u,c="left";break;case"end":l=u+g,c="right";break;default:l=u+g/2,c="center"}a.textAlign=s.textAlign(c),a.textBaseline="middle",a.strokeStyle=i.color,a.fillStyle=i.color,a.font=n.string,a.fillText(i.text,l,d)}_computeTitleHeight(){const t=this.options.title,e=It(t.font,this.chart.options.font),i=zt(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){const i=this;let n,o,s;if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)for(s=i.legendHitBoxes,n=0;n<s.length;++n)if(o=s[n],t>=o.left&&t<=o.left+o.width&&e>=o.top&&e<=o.top+o.height)return i.legendItems[n];return null}handleEvent(t){const e=this,i=e.options,n="mouseup"===t.type?"click":t.type;if("mousemove"===n){if(!i.onHover&&!i.onLeave)return}else{if("click"!==n)return;if(!i.onClick)return}const o=e._getLegendItemAt(t.x,t.y);"click"===n?o&&d(i.onClick,[t,o,e],e):(i.onLeave&&o!==e._hoveredItem&&(e._hoveredItem&&d(i.onLeave,[t,e._hoveredItem,e],e),e._hoveredItem=o),o&&d(i.onHover,[t,o,e],e))}}function no(t){return!1!==t&&x(Object.create(null),[w.plugins.legend,t])}function oo(t,e){const i=new io({ctx:t.ctx,options:e,chart:t});Kt.configure(t,i,e),Kt.addBox(t,i),t.legend=i}var so={id:"legend",_element:io,start(t){oo(t,no(t.options.plugins.legend))},stop(t){Kt.removeBox(t,t.legend),delete t.legend},beforeUpdate(t){const e=no(t.options.plugins.legend),i=t.legend;e?i?(Kt.configure(t,i,e),i.options=e):oo(t,e):i&&(Kt.removeBox(t,i),delete t.legend)},afterUpdate(t){t.legend&&t.legend.buildLabels()},afterEvent(t,e){const i=t.legend;i&&i.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:i}=t.legend.options,n=i.usePointStyle,o=i.pointStyle;return t._getSortedDatasetMetas().map((t=>{const i=t.controller.getStyle(n?0:void 0),s=r(i.borderWidth)?(h(i.borderWidth.top,0)+h(i.borderWidth.left,0)+h(i.borderWidth.bottom,0)+h(i.borderWidth.right,0))/4:i.borderWidth;return{text:e[t.index].label,fillStyle:i.backgroundColor,hidden:!t.visible,lineCap:i.borderCapStyle,lineDash:i.borderDash,lineDashOffset:i.borderDashOffset,lineJoin:i.borderJoinStyle,lineWidth:s,strokeStyle:i.borderColor,pointStyle:o||i.pointStyle,rotation:i.rotation,datasetIndex:t.index}}),this)}},title:{display:!1,position:"center",text:""}}};const ao=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;class ro extends ci{constructor(t){super(),Object.assign(this,t),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._margins=void 0,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.maxWidth=void 0,this.maxHeight=void 0,this.position=void 0,this.weight=void 0,this.fullWidth=void 0}update(t,e,i){const n=this;n.maxWidth=t,n.maxHeight=e,n._margins=i,n.setDimensions(),n.fit()}setDimensions(){const t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height)}fit(){const t=this,e=t.options,i={},n=t.isHorizontal();if(!e.display)return void(t.width=i.width=t.height=i.height=0);const o=a(e.text)?e.text.length:1;t._padding=zt(e.padding);const s=o*It(e.font,t.chart.options.font).lineHeight+t._padding.height;t.width=i.width=n?t.maxWidth:s,t.height=i.height=n?s:t.maxHeight}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:s}=this,a=s.align;let r,l,c,h=0;return this.isHorizontal()?(l=ao(a,i,o),c=e+t,r=o-i):("left"===s.position?(l=i+t,c=ao(a,n,e),h=-.5*k):(l=o-t,c=ao(a,e,n),h=.5*k),r=n-e),{titleX:l,titleY:c,maxWidth:r,rotation:h}}draw(){const t=this,e=t.ctx,i=t.options;if(!i.display)return;const n=It(i.font,t.chart.options.font),o=n.lineHeight,s=o/2+t._padding.top,{titleX:r,titleY:l,maxWidth:c,rotation:h}=t._drawArgs(s);var d;e.save(),e.fillStyle=i.color,e.font=n.string,e.translate(r,l),e.rotate(h),e.textAlign="start"===(d=i.align)?"left":"end"===d?"right":"center",e.textBaseline="middle";const u=i.text;if(a(u)){let t=0;for(let i=0;i<u.length;++i)e.fillText(u[i],0,t,c),t+=o}else e.fillText(u,0,0,c);e.restore()}}function lo(t,e){const i=new ro({ctx:t.ctx,options:e,chart:t});Kt.configure(t,i,e),Kt.addBox(t,i),t.titleBlock=i}var co={id:"title",_element:ro,start(t,e,i){lo(t,i)},stop(t){const e=t.titleBlock;Kt.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){!1===i?function(t){const e=t.titleBlock;e&&(Kt.removeBox(t,e),delete t.titleBlock)}(t):function(t,e){const i=t.titleBlock;i?(Kt.configure(t,i,e),i.options=e):lo(t,e)}(t,i)},defaults:{align:"center",display:!1,font:{style:"bold"},fullWidth:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"}};const ho={average(t){if(!t.length)return!1;let e,i,n=0,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n+=t.x,o+=t.y,++s}}return{x:n/s,y:o/s}},nearest(t,e){let i,n,o,s=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=j(e,n.getCenterPoint());t<r&&(r=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,a=t.y}return{x:s,y:a}}};function uo(t,e){return e&&(a(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function go(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function fo(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:a,value:r}=s.getLabelAndValue(o);return{chart:t,label:a,dataPoint:s.getParsed(o),formattedValue:r,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function po(t){const e=t._chart.ctx,{body:i,footer:n,options:o,title:s}=t,{bodyFont:a,footerFont:r,titleFont:l,boxWidth:c,boxHeight:h}=o,d=s.length,g=n.length,f=i.length;let p=2*o.yPadding,m=0,x=i.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(x+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*l.size+(d-1)*o.titleSpacing+o.titleMarginBottom),x){p+=f*(o.displayColors?Math.max(h,a.size):a.size)+(x-f)*a.size+(x-1)*o.bodySpacing}g&&(p+=o.footerMarginTop+g*r.size+(g-1)*o.footerSpacing);let b=0;const _=function(t){m=Math.max(m,e.measureText(t).width+b)};return e.save(),e.font=l.string,u(t.title,_),e.font=a.string,u(t.beforeBody.concat(t.afterBody),_),b=o.displayColors?c+2:0,u(i,(t=>{u(t.before,_),u(t.lines,_),u(t.after,_)})),b=0,e.font=r.string,u(t.footer,_),e.restore(),m+=2*o.xPadding,{width:m,height:p}}function mo(t,e,i){const{x:n,y:o,width:s,height:a}=i,r=t.chartArea;let l,c,h="center",d="center";o<a/2?d="top":o>t.height-a/2&&(d="bottom");const u=(r.left+r.right)/2,g=(r.top+r.bottom)/2;"center"===d?(l=t=>t<=u,c=t=>t>u):(l=t=>t<=s/2,c=e=>e>=t.width-s/2);const f=t=>t<=g?"top":"bottom";return l(n)?(h="left",n+s+e.caretSize+e.caretPadding>t.width&&(h="center",d=f(o))):c(n)&&(h="right",(t=>t-s-e.caretSize-e.caretPadding<0)(n)&&(h="center",d=f(o))),{xAlign:e.xAlign?e.xAlign:h,yAlign:e.yAlign?e.yAlign:d}}function xo(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,c=o+s,h=a+s;let d=function(t,e,i){let{x:n,width:o}=t;return"right"===e?n-=o:"center"===e&&(n-=o/2,n+o>i&&(n=i-o),n<0&&(n=0)),n}(e,r,n.width);return"center"===l?"left"===r?d+=c:"right"===r&&(d-=c):"left"===r?d-=h:"right"===r&&(d+=h),{x:d,y:function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,c)}}function bo(t,e){const i=t.options;return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.xPadding:t.x+i.xPadding}function _o(t){return uo([],go(t))}class yo extends ci{constructor(t){super(),this.opacity=0,this._active=[],this._chart=t._chart,this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this.$animations=void 0,this.options=void 0,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,this.initialize()}initialize(){const t=this,e=t._chart.options;var i,n;t.options=(i=e.plugins.tooltip,n=e.font,(i=x(Object.create(null),[w.plugins.tooltip,i])).bodyFont=It(i.bodyFont,n),i.titleFont=It(i.titleFont,n),i.footerFont=It(i.footerFont,n),i.boxHeight=h(i.boxHeight,i.bodyFont.size),i.boxWidth=h(i.boxWidth,i.bodyFont.size),i),t._cachedAnimations=void 0}_resolveAnimations(){const t=this,e=t._cachedAnimations;if(e)return e;const i=t._chart,n=t.options,o=n.enabled&&i.options.animation&&n.animation,s=new Ze(t._chart,o);return t._cachedAnimations=Object.freeze(s),s}getTitle(t){const e=this,i=e.options.callbacks,n=i.beforeTitle.apply(e,[t]),o=i.title.apply(e,[t]),s=i.afterTitle.apply(e,[t]);let a=[];return a=uo(a,go(n)),a=uo(a,go(o)),a=uo(a,go(s)),a}getBeforeBody(t){return _o(this.options.callbacks.beforeBody.apply(this,[t]))}getBody(t){const e=this,i=e.options.callbacks,n=[];return u(t,(t=>{const o={before:[],lines:[],after:[]};uo(o.before,go(i.beforeLabel.call(e,t))),uo(o.lines,i.label.call(e,t)),uo(o.after,go(i.afterLabel.call(e,t))),n.push(o)})),n}getAfterBody(t){return _o(this.options.callbacks.afterBody.apply(this,[t]))}getFooter(t){const e=this,i=e.options.callbacks,n=i.beforeFooter.apply(e,[t]),o=i.footer.apply(e,[t]),s=i.afterFooter.apply(e,[t]);let a=[];return a=uo(a,go(n)),a=uo(a,go(o)),a=uo(a,go(s)),a}_createItems(){const t=this,e=t._active,i=t.options,n=t._chart.data,o=[],s=[],a=[];let r,l,c=[];for(r=0,l=e.length;r<l;++r)c.push(fo(t._chart,e[r]));return i.filter&&(c=c.filter(((t,e,o)=>i.filter(t,e,o,n)))),i.itemSort&&(c=c.sort(((t,e)=>i.itemSort(t,e,n)))),u(c,(e=>{o.push(i.callbacks.labelColor.call(t,e)),s.push(i.callbacks.labelPointStyle.call(t,e)),a.push(i.callbacks.labelTextColor.call(t,e))})),t.labelColors=o,t.labelPointStyles=s,t.labelTextColors=a,t.dataPoints=c,c}update(t){const e=this,i=e.options,n=e._active;let o;if(n.length){const t=ho[i.position].call(e,n,e._eventPosition),s=e._createItems();e.title=e.getTitle(s),e.beforeBody=e.getBeforeBody(s),e.body=e.getBody(s),e.afterBody=e.getAfterBody(s),e.footer=e.getFooter(s);const a=e._size=po(e),r=Object.assign({},t,a),l=mo(e._chart,i,r),c=xo(i,r,l,e._chart);e.xAlign=l.xAlign,e.yAlign=l.yAlign,o={opacity:1,x:c.x,y:c.y,width:a.width,height:a.height,caretX:t.x,caretY:t.y}}else 0!==e.opacity&&(o={opacity:0});o&&e._resolveAnimations().update(e,o),t&&i.custom&&i.custom.call(e,{chart:e._chart,tooltip:e})}drawCaret(t,e,i){const n=this.getCaretPosition(t,i);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e){const{xAlign:i,yAlign:n,options:o}=this,{cornerRadius:s,caretSize:a}=o,{x:r,y:l}=t,{width:c,height:h}=e;let d,u,g,f,p,m;return"center"===n?(p=l+h/2,"left"===i?(d=r,u=d-a,f=p+a,m=p-a):(d=r+c,u=d+a,f=p-a,m=p+a),g=d):(u="left"===i?r+s+a:"right"===i?r+c-s-a:this.caretX,"top"===n?(f=l,p=f-a,d=u-a,g=u+a):(f=l+h,p=f+a,d=u+a,g=u-a),m=f),{x1:d,x2:u,x3:g,y1:f,y2:p,y3:m}}drawTitle(t,e){const i=this,n=i.options,o=i.title,s=o.length;let a,r,l;if(s){const c=Yi(n.rtl,i.x,i.width);for(t.x=bo(i,n.titleAlign),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",a=n.titleFont,r=n.titleSpacing,e.fillStyle=n.titleColor,e.font=a.string,l=0;l<s;++l)e.fillText(o[l],c.x(t.x),t.y+a.size/2),t.y+=a.size+r,l+1===s&&(t.y+=n.titleMarginBottom-r)}}_drawColorBox(t,e,i,n){const o=this,s=o.options,a=o.labelColors[i],r=o.labelPointStyles[i],{boxHeight:l,boxWidth:c,bodyFont:h}=s,d=bo(o,"left"),u=n.x(d),g=l<h.size?(h.size-l)/2:0,f=e.y+g;if(s.usePointStyle){const e={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(u,c)+c/2,o=f+l/2;t.strokeStyle=s.multiKeyBackground,t.fillStyle=s.multiKeyBackground,tt(t,e,i,o),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,tt(t,e,i,o)}else t.fillStyle=s.multiKeyBackground,t.fillRect(n.leftForLtr(u,c),f,c,l),t.lineWidth=1,t.strokeStyle=a.borderColor,t.strokeRect(n.leftForLtr(u,c),f,c,l),t.fillStyle=a.backgroundColor,t.fillRect(n.leftForLtr(n.xPlus(u,1),c-2),f+1,c-2,l-2);t.fillStyle=o.labelTextColors[i]}drawBody(t,e){const i=this,{body:n,options:o}=i,{bodyFont:s,bodySpacing:a,bodyAlign:r,displayColors:l,boxHeight:c,boxWidth:h}=o;let d=s.size,g=0;const f=Yi(o.rtl,i.x,i.width),p=function(i){e.fillText(i,f.x(t.x+g),t.y+d/2),t.y+=d+a},m=f.textAlign(r);let x,b,_,y,v,M,w;for(e.textAlign=r,e.textBaseline="middle",e.font=s.string,t.x=bo(i,m),e.fillStyle=o.bodyColor,u(i.beforeBody,p),g=l&&"right"!==m?"center"===r?h/2+1:h+2:0,y=0,M=n.length;y<M;++y){for(x=n[y],b=i.labelTextColors[y],e.fillStyle=b,u(x.before,p),_=x.lines,l&&_.length&&(i._drawColorBox(e,t,y,f),d=Math.max(s.size,c)),v=0,w=_.length;v<w;++v)p(_[v]),d=s.size;u(x.after,p)}g=0,d=s.size,u(i.afterBody,p),t.y-=a}drawFooter(t,e){const i=this,n=i.options,o=i.footer,s=o.length;let a,r;if(s){const l=Yi(n.rtl,i.x,i.width);for(t.x=bo(i,n.footerAlign),t.y+=n.footerMarginTop,e.textAlign=l.textAlign(n.footerAlign),e.textBaseline="middle",a=n.footerFont,e.fillStyle=n.footerColor,e.font=a.string,r=0;r<s;++r)e.fillText(o[r],l.x(t.x),t.y+a.size/2),t.y+=a.size+n.footerSpacing}}drawBackground(t,e,i){const{xAlign:n,yAlign:o,options:s}=this,{x:a,y:r}=t,{width:l,height:c}=i,h=s.cornerRadius;e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+h,r),"top"===o&&this.drawCaret(t,e,i),e.lineTo(a+l-h,r),e.quadraticCurveTo(a+l,r,a+l,r+h),"center"===o&&"right"===n&&this.drawCaret(t,e,i),e.lineTo(a+l,r+c-h),e.quadraticCurveTo(a+l,r+c,a+l-h,r+c),"bottom"===o&&this.drawCaret(t,e,i),e.lineTo(a+h,r+c),e.quadraticCurveTo(a,r+c,a,r+c-h),"center"===o&&"left"===n&&this.drawCaret(t,e,i),e.lineTo(a,r+h),e.quadraticCurveTo(a,r,a+h,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(){const t=this,e=t._chart,i=t.options,n=t.$animations,o=n&&n.x,s=n&&n.y;if(o||s){const n=ho[i.position].call(t,t._active,t._eventPosition);if(!n)return;const a=t._size=po(t),r=Object.assign({},n,t._size),l=mo(e,i,r),c=xo(i,r,l,e);o._to===c.x&&s._to===c.y||(t.xAlign=l.xAlign,t.yAlign=l.yAlign,t.width=a.width,t.height=a.height,t.caretX=n.x,t.caretY=n.y,t._resolveAnimations().update(t,c))}}draw(t){const e=this,i=e.options;let n=e.opacity;if(!n)return;e._updateAnimationTarget();const o={width:e.width,height:e.height},s={x:e.x,y:e.y};n=Math.abs(n)<.001?0:n;const a=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;i.enabled&&a&&(t.save(),t.globalAlpha=n,e.drawBackground(s,t,o),Ui(t,i.textDirection),s.y+=i.yPadding,e.drawTitle(s,t),e.drawBody(s,t),e.drawFooter(s,t),$i(t,i.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this,n=i._active,o=t.map((({datasetIndex:t,index:e})=>{const n=i._chart.getDatasetMeta(t);if(!n)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:n.data[e],index:e}})),s=!g(n,o),a=i._positionChanged(o,e);(s||a)&&(i._active=o,i._eventPosition=e,i.update(!0))}handleEvent(t,e){const i=this,n=i.options,o=i._active||[];let s=!1,a=[];"mouseout"!==t.type&&(a=i._chart.getElementsAtEventForMode(t,n.mode,n,e),n.reverse&&a.reverse());const r=i._positionChanged(a,t);return s=e||!g(a,o)||r,s&&(i._active=a,(n.enabled||n.custom)&&(i._eventPosition={x:t.x,y:t.y},i.update(!0))),s}_positionChanged(t,e){const i=this,n=ho[i.options.position].call(i,t,e);return i.caretX!==n.x||i.caretY!==n.y}}yo.positioners=ho;var vo={id:"tooltip",_element:yo,positioners:ho,afterInit(t){t.options.plugins.tooltip&&(t.tooltip=new yo({_chart:t}))},beforeUpdate(t){t.tooltip&&t.tooltip.initialize()},reset(t){t.tooltip&&t.tooltip.initialize()},afterDraw(t){const e=t.tooltip,i={tooltip:e};!1!==t.notifyPlugins("beforeTooltipDraw",i)&&(e&&e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i))},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i)}},defaults:{enabled:!0,custom:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{style:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{style:"bold"},footerAlign:"left",yPadding:6,xPadding:6,caretPadding:2,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart",numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:n,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:n,beforeBody:n,beforeLabel:n,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return s(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:n,afterBody:n,beforeFooter:n,footer:n,afterFooter:n}}},Mo=Object.freeze({__proto__:null,Filler:Jn,Legend:so,Title:co,Tooltip:vo});class wo extends bi{constructor(t){super(t),this._startValue=void 0,this._valueRange=0}parse(t,e){const i=this.getLabels();return isFinite(e)&&i[e]===t?e:function(t,e,i){const n=t.indexOf(e);return-1===n?"string"==typeof e?t.push(e)-1:i:n!==t.lastIndexOf(e)?i:n}(i,t,e)}determineDataLimits(){const t=this,{minDefined:e,maxDefined:i}=t.getUserBounds();let{min:n,max:o}=t.getMinMax(!0);"ticks"===t.options.bounds&&(e||(n=0),i||(o=t.getLabels().length-1)),t.min=n,t.max=o}buildTicks(){const t=this,e=t.min,i=t.max,n=t.options.offset,o=[];let s=t.getLabels();s=0===e&&i===s.length-1?s:s.slice(e,i+1),t._valueRange=Math.max(s.length-(n?0:1),1),t._startValue=t.min-(n?.5:0);for(let t=e;t<=i;t++)o.push({value:t});return o}getLabelForValue(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){const t=this;super.configure(),t.isHorizontal()||(t._reversePixels=!t._reversePixels)}getPixelForValue(t){const e=this;return"number"!=typeof t&&(t=e.parse(t)),e.getPixelForDecimal((t-e._startValue)/e._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){const e=this;return Math.round(e._startValue+e.getDecimalForPixel(t)*e._valueRange)}getBasePixel(){return this.bottom}}function ko(t){const e=Math.floor(R(t)),i=t/Math.pow(10,e);let n;return n=i<=1?1:i<=2?2:i<=5?5:10,n*Math.pow(10,e)}wo.id="category",wo.defaults={ticks:{callback:wo.prototype.getLabelForValue}};class Po extends bi{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return s(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?NaN:+t}handleTickRangeOptions(){const t=this,{beginAtZero:e,stacked:i}=t.options,{minDefined:n,maxDefined:o}=t.getUserBounds();let{min:s,max:a}=t;const r=t=>s=n?s:t,l=t=>a=o?a:t;if(e||i){const t=V(s),e=V(a);t<0&&e<0?l(0):t>0&&e>0&&r(0)}s===a&&(l(a+1),e||r(s-1)),t.min=s,t.max=a}getTickLimit(){const t=this,e=t.options.ticks;let i,{maxTicksLimit:n,stepSize:o}=e;return o?i=Math.ceil(t.max/o)-Math.floor(t.min/o)+1:(i=t.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this,e=t.options,i=e.ticks;let n=t.getTickLimit();n=Math.max(2,n);const o=function(t,e){const i=[],{stepSize:n,min:o,max:a,precision:r}=t,l=n||1,c=t.maxTicks-1,{min:h,max:d}=e;let u,g,f,p,m=ko((d-h)/c/l)*l;if(m<1e-14&&s(o)&&s(a))return[{value:h},{value:d}];p=Math.ceil(d/m)-Math.floor(h/m),p>c&&(m=ko(p*m/c/l)*l),n||s(r)?u=Math.pow(10,N(m)):(u=Math.pow(10,r),m=Math.ceil(m*u)/u),g=Math.floor(h/m)*m,f=Math.ceil(d/m)*m,!n||s(o)||s(a)||z((a-o)/n,m/1e3)&&(g=o,f=a),p=(f-g)/m,p=F(p,Math.round(p),m/1e3)?Math.round(p):Math.ceil(p),g=Math.round(g*u)/u,f=Math.round(f*u)/u,i.push({value:s(o)?g:o});for(let t=1;t<p;++t)i.push({value:Math.round((g+t*m)*u)/u});return i.push({value:s(a)?f:a}),i}({maxTicks:n,min:e.min,max:e.max,precision:i.precision,stepSize:h(i.fixedStepSize,i.stepSize)},t);return"ticks"===e.bounds&&I(o,t,"value"),e.reverse?(o.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),o}configure(){const t=this,e=t.ticks;let i=t.min,n=t.max;if(super.configure(),t.options.offset&&e.length){const t=(n-i)/Math.max(e.length-1,1)/2;i-=t,n+=t}t._startValue=i,t._endValue=n,t._valueRange=n-i}getLabelForValue(t){return new Intl.NumberFormat(this.options.locale).format(t)}}class So extends Po{determineDataLimits(){const t=this,{min:e,max:i}=t.getMinMax(!0);t.min=l(e)?e:0,t.max=l(i)?i:1,t.handleTickRangeOptions()}computeTickLimit(){const t=this;if(t.isHorizontal())return Math.ceil(t.width/40);const e=t._resolveTickFontOptions(0);return Math.ceil(t.height/e.lineHeight)}getPixelForValue(t){return this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}function Do(t){return 1===t/Math.pow(10,Math.floor(R(t)))}So.id="linear",So.defaults={ticks:{callback:ui.formatters.numeric}};class Oo extends bi{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Po.prototype.parse.apply(this,[t,e]);if(0!==i)return l(i)&&i>0?i:NaN;this._zero=!0}determineDataLimits(){const t=this,{min:e,max:i}=t.getMinMax(!0);t.min=l(e)?Math.max(0,e):null,t.max=l(i)?Math.max(0,i):null,t.options.beginAtZero&&(t._zero=!0),t.handleTickRangeOptions()}handleTickRangeOptions(){const t=this,{minDefined:e,maxDefined:i}=t.getUserBounds();let n=t.min,o=t.max;const s=t=>n=e?n:t,a=t=>o=i?o:t,r=(t,e)=>Math.pow(10,Math.floor(R(t))+e);n===o&&(n<=0?(s(1),a(10)):(s(r(n,-1)),a(r(o,1)))),n<=0&&s(r(o,-1)),o<=0&&a(r(n,1)),t._zero&&t.min!==t._suggestedMin&&n===r(t.min,0)&&s(r(n,-1)),t.min=n,t.max=o}buildTicks(){const t=this,e=t.options,i=function(t,e){const i=Math.floor(R(e.max)),n=Math.ceil(e.max/Math.pow(10,i)),o=[];let s=c(t.min,Math.pow(10,Math.floor(R(e.min)))),a=Math.floor(R(s)),r=Math.floor(s/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do{o.push({value:s,major:Do(s)}),++r,10===r&&(r=1,++a,l=a>=0?1:l),s=Math.round(r*Math.pow(10,a)*l)/l}while(a<i||a===i&&r<n);const h=c(t.max,s);return o.push({value:h,major:Do(s)}),o}({min:t._userMin,max:t._userMax},t);return"ticks"===e.bounds&&I(i,t,"value"),e.reverse?(i.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),i}getLabelForValue(t){return void 0===t?"0":new Intl.NumberFormat(this.options.locale).format(t)}configure(){const t=this,e=t.min;super.configure(),t._startValue=R(e),t._valueRange=R(t.max)-R(e)}getPixelForValue(t){const e=this;return void 0!==t&&0!==t||(t=e.min),e.getPixelForDecimal(t===e.min?0:(R(t)-e._startValue)/e._valueRange)}getValueForPixel(t){const e=this,i=e.getDecimalForPixel(t);return Math.pow(10,e._startValue+i*e._valueRange)}}function To(t){const e=t.ticks;return e.display&&t.display?h(e.font&&e.font.size,w.font.size)+2*e.backdropPaddingY:0}function Ao(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function Co(t){return 0===t||180===t?"center":t<180?"left":"right"}function Lo(t,e,i,n){let o,s,r=i.y+n/2;if(a(e))for(o=0,s=e.length;o<s;++o)t.fillText(e[o],i.x,r),r+=n;else t.fillText(e,i.x,r)}function Ro(t,e,i){90===t||270===t?i.y-=e.h/2:(t>270||t<90)&&(i.y-=e.h)}function Eo(t){return E(t)?t:0}Oo.id="logarithmic",Oo.defaults={ticks:{callback:ui.formatters.logarithmic,major:{enabled:!0}}};class Fo extends Po{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this.pointLabels=[]}init(t){super.init(t),this.axis="r"}setDimensions(){const t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=To(t.options)/2,t.xCenter=Math.floor(t.width/2),t.yCenter=Math.floor((t.height-t.paddingTop)/2),t.drawingArea=Math.min(t.height-t.paddingTop,t.width)/2}determineDataLimits(){const t=this,{min:e,max:i}=t.getMinMax(!1);t.min=l(e)&&!isNaN(e)?e:0,t.max=l(i)&&!isNaN(i)?i:0,t.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/To(this.options))}generateTickLabels(t){const e=this;Po.prototype.generateTickLabels.call(e,t),e.pointLabels=e.chart.data.labels.map(((t,i)=>{const n=d(e.options.pointLabels.callback,[t,i],e);return n||0===n?n:""}))}fit(){const t=this,e=t.options;e.display&&e.pointLabels.display?function(t){const e={l:0,r:t.width,t:0,b:t.height-t.paddingTop},i={};let n,o,s;t._pointLabelSizes=[];const r=t.chart.data.labels.length;for(n=0;n<r;n++){s=t.getPointPosition(n,t.drawingArea+5);const r=t.getContext(n),d=It(Vt([t.options.pointLabels.font],r,n),t.chart.options.font);t.ctx.font=d.string,l=t.ctx,c=d.lineHeight,o=a(h=t.pointLabels[n])?{w:Z(l,l.font,h),h:h.length*c}:{w:l.measureText(h).width,h:c},t._pointLabelSizes[n]=o;const u=t.getIndexAngle(n),g=W(u),f=Ao(g,s.x,o.w,0,180),p=Ao(g,s.y,o.h,90,270);f.start<e.l&&(e.l=f.start,i.l=u),f.end>e.r&&(e.r=f.end,i.r=u),p.start<e.t&&(e.t=p.start,i.t=u),p.end>e.b&&(e.b=p.end,i.b=u)}var l,c,h;t._setReductions(t.drawingArea,e,i)}(t):t.setCenterPoint(0,0,0,0)}_setReductions(t,e,i){const n=this;let o=e.l/Math.sin(i.l),s=Math.max(e.r-n.width,0)/Math.sin(i.r),a=-e.t/Math.cos(i.t),r=-Math.max(e.b-(n.height-n.paddingTop),0)/Math.cos(i.b);o=Eo(o),s=Eo(s),a=Eo(a),r=Eo(r),n.drawingArea=Math.min(Math.floor(t-(o+s)/2),Math.floor(t-(a+r)/2)),n.setCenterPoint(o,s,a,r)}setCenterPoint(t,e,i,n){const o=this,s=o.width-e-o.drawingArea,a=t+o.drawingArea,r=i+o.drawingArea,l=o.height-o.paddingTop-n-o.drawingArea;o.xCenter=Math.floor((a+s)/2+o.left),o.yCenter=Math.floor((r+l)/2+o.top+o.paddingTop)}getIndexAngle(t){const e=this.chart;return U(t*(P/e.data.labels.length)+B((e.options||{}).startAngle||0))}getDistanceFromCenterForValue(t){const e=this;if(s(t))return NaN;const i=e.drawingArea/(e.max-e.min);return e.options.reverse?(e.max-t)*i:(t-e.min)*i}getValueForDistanceFromCenter(t){if(s(t))return NaN;const e=this,i=t/(e.drawingArea/(e.max-e.min));return e.options.reverse?e.max-i:e.min+i}getPointPosition(t,e){const i=this,n=i.getIndexAngle(t)-T;return{x:Math.cos(n)*e+i.xCenter,y:Math.sin(n)*e+i.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}drawGrid(){const t=this,e=t.ctx,i=t.options,n=i.gridLines,o=i.angleLines;let s,a,r;if(i.pointLabels.display&&function(t){const e=t.ctx,i=t.options,n=i.pointLabels,o=To(i),s=t.getDistanceFromCenterForValue(i.ticks.reverse?t.min:t.max);e.save(),e.textBaseline="middle";for(let i=t.chart.data.labels.length-1;i>=0;i--){const a=0===i?o/2:0,r=t.getPointPosition(i,s+a+5),l=t.getContext(i),c=It(Vt([n.font],l,i),t.chart.options.font);e.font=c.string,e.fillStyle=n.color;const h=W(t.getIndexAngle(i));e.textAlign=Co(h),Ro(h,t._pointLabelSizes[i],r),Lo(e,t.pointLabels[i],r,c.lineHeight)}e.restore()}(t),n.display&&t.ticks.forEach(((e,i)=>{0!==i&&(a=t.getDistanceFromCenterForValue(t.ticks[i].value),function(t,e,i,n){const o=t.ctx,s=e.circular,a=t.chart.data.labels.length,r=t.getContext(n),l=Vt([e.color],r,n-1),c=Vt([e.lineWidth],r,n-1);let h;if((s||a)&&l&&c){if(o.save(),o.strokeStyle=l,o.lineWidth=c,o.setLineDash&&(o.setLineDash(Vt([e.borderDash,[]],r)),o.lineDashOffset=Vt([e.borderDashOffset],r,n-1)),o.beginPath(),s)o.arc(t.xCenter,t.yCenter,i,0,P);else{h=t.getPointPosition(0,i),o.moveTo(h.x,h.y);for(let e=1;e<a;e++)h=t.getPointPosition(e,i),o.lineTo(h.x,h.y)}o.closePath(),o.stroke(),o.restore()}}(t,n,a,i))})),o.display){for(e.save(),s=t.chart.data.labels.length-1;s>=0;s--){const l=t.getContext(s),c=Vt([o.lineWidth,n.lineWidth],l,s),h=Vt([o.color,n.color],l,s);c&&h&&(e.lineWidth=c,e.strokeStyle=h,e.setLineDash&&(e.setLineDash(Vt([o.borderDash,n.borderDash,[]],l)),e.lineDashOffset=Vt([o.borderDashOffset,n.borderDashOffset,0],l,s)),a=t.getDistanceFromCenterForValue(i.ticks.reverse?t.min:t.max),r=t.getPointPosition(s,a),e.beginPath(),e.moveTo(t.xCenter,t.yCenter),e.lineTo(r.x,r.y),e.stroke())}e.restore()}}drawLabels(){const t=this,e=t.ctx,i=t.options,n=i.ticks;if(!n.display)return;const o=t.getIndexAngle(0);let s,a;e.save(),e.translate(t.xCenter,t.yCenter),e.rotate(o),e.textAlign="center",e.textBaseline="middle",t.ticks.forEach(((o,r)=>{if(0===r&&!i.reverse)return;const l=t.getContext(r),c=t._resolveTickFontOptions(r);e.font=c.string,s=t.getDistanceFromCenterForValue(t.ticks[r].value);Vt([n.showLabelBackdrop],l,r)&&(a=e.measureText(o.label).width,e.fillStyle=Vt([n.backdropColor],l,r),e.fillRect(-a/2-n.backdropPaddingX,-s-c.size/2-n.backdropPaddingY,a+2*n.backdropPaddingX,c.size+2*n.backdropPaddingY)),e.fillStyle=n.color,e.fillText(o.label,0,-s)})),e.restore()}drawTitle(){}}Fo.id="radialLinear",Fo.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:ui.formatters.numeric},pointLabels:{display:!0,font:{size:10},callback:t=>t}},Fo.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};const zo=Number.MAX_SAFE_INTEGER||9007199254740991,Io={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}},Vo=Object.keys(Io);function Bo(t,e){return t-e}function Wo(t,e){if(s(e))return null;const i=t._adapter,n=t.options.time,{parser:o,round:a,isoWeekday:r}=n;let c=e;return"function"==typeof o&&(c=o(c)),l(c)||(c="string"==typeof o?i.parse(c,o):i.parse(c)),null===c?c:(a&&(c="week"!==a||!E(r)&&!0!==r?t._adapter.startOf(c,a):t._adapter.startOf(c,"isoWeek",r)),+c)}function No(t,e,i,n){const o=Vo.length;for(let s=Vo.indexOf(t);s<o-1;++s){const t=Io[Vo[s]],o=t.steps?t.steps:zo;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return Vo[s]}return Vo[o-1]}function Ho(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=at(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function jo(t,e,i){const n=[],o={},s=e.length;let a,r;for(a=0;a<s;++a)r=e[a],o[r]=a,n.push({value:r,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),a=e[e.length-1].value;let r,l;for(r=s;r<=a;r=+o.add(r,1,n))l=i[r],l>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class Yo extends bi{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1}init(t,e){const i=t.time||(t.time={}),n=this._adapter=new en._date(t.adapters.date);b(i.displayFormats,n.formats()),super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?NaN:Wo(this,t)}invalidateCaches(){this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this,e=t.options,i=t._adapter,n=e.time.unit||"day";let{min:o,max:s,minDefined:a,maxDefined:r}=t.getUserBounds();function c(t){a||isNaN(t.min)||(o=Math.min(o,t.min)),r||isNaN(t.max)||(s=Math.max(s,t.max))}a&&r||(c(t._getLabelBounds()),"ticks"===e.bounds&&"labels"===e.ticks.source||c(t.getMinMax(!1))),o=l(o)&&!isNaN(o)?o:+i.startOf(Date.now(),n),s=l(s)&&!isNaN(s)?s:+i.endOf(Date.now(),n)+1,t.min=Math.min(o,s),t.max=Math.max(o+1,s)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this,e=t.options,i=e.time,n=e.ticks,o="labels"===n.source?t.getLabelTimestamps():t._generate();"ticks"===e.bounds&&o.length&&(t.min=t._userMin||o[0],t.max=t._userMax||o[o.length-1]);const s=t.min,a=ct(o,s,t.max);return t._unit=i.unit||(n.autoSkip?No(i.minUnit,t.min,t.max,t._getLabelCapacity(s)):function(t,e,i,n,o){for(let s=Vo.length-1;s>=Vo.indexOf(i);s--){const i=Vo[s];if(Io[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return Vo[i?Vo.indexOf(i):0]}(t,a.length,i.minUnit,t.min,t.max)),t._majorUnit=n.major.enabled&&"year"!==t._unit?function(t){for(let e=Vo.indexOf(t)+1,i=Vo.length;e<i;++e)if(Io[Vo[e]].common)return Vo[e]}(t._unit):void 0,t.initOffsets(o),e.reverse&&a.reverse(),jo(t,a,t._majorUnit)}initOffsets(t){const e=this;let i,n,o=0,s=0;e.options.offset&&t.length&&(i=e.getDecimalForValue(t[0]),o=1===t.length?1-i:(e.getDecimalForValue(t[1])-i)/2,n=e.getDecimalForValue(t[t.length-1]),s=1===t.length?n:(n-e.getDecimalForValue(t[t.length-2]))/2),e._offsets={start:o,end:s,factor:1/(o+1+s)}}_generate(){const t=this,e=t._adapter,i=t.min,n=t.max,o=t.options,s=o.time,a=s.unit||No(s.minUnit,i,n,t._getLabelCapacity(i)),r=h(s.stepSize,1),l="week"===a&&s.isoWeekday,c=E(l)||!0===l,d={};let u,g=i;if(c&&(g=+e.startOf(g,"isoWeek",l)),g=+e.startOf(g,c?"day":a),e.diff(n,i,a)>1e5*r)throw new Error(i+" and "+n+" are too far apart with stepSize of "+r+" "+a);const f="data"===o.ticks.source&&t.getDataTimestamps();for(u=g;u<n;u=+e.add(u,r,a))Ho(d,u,f);return u!==n&&"ticks"!==o.bounds||Ho(d,u,f),Object.keys(d).sort(((t,e)=>t-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,n){const o=this,s=o.options,a=s.time.displayFormats,r=o._unit,l=o._majorUnit,c=r&&a[r],h=l&&a[l],d=i[e],u=l&&h&&d&&d.major,g=o._adapter.format(t,n||(u?h:c)),f=s.ticks.callback;return f?f(g,e,i):g}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){const e=this;return(t-e.min)/(e.max-e.min)}getPixelForValue(t){const e=this,i=e._offsets,n=e.getDecimalForValue(t);return e.getPixelForDecimal((i.start+n)*i.factor)}getValueForPixel(t){const e=this,i=e._offsets,n=e.getDecimalForPixel(t)/i.factor-i.end;return e.min+n*(e.max-e.min)}_getLabelSize(t){const e=this,i=e.options.ticks,n=e.ctx.measureText(t).width,o=B(e.isHorizontal()?i.maxRotation:i.minRotation),s=Math.cos(o),a=Math.sin(o),r=e._resolveTickFontOptions(0).size;return{w:n*s+r*a,h:n*a+r*s}}_getLabelCapacity(t){const e=this,i=e.options.time,n=i.displayFormats,o=n[i.unit]||n.millisecond,s=e._tickFormatFunction(t,0,jo(e,[t],e._majorUnit),o),a=e._getLabelSize(s),r=Math.floor(e.isHorizontal()?e.width/a.w:e.height/a.h)-1;return r>0?r:1}getDataTimestamps(){const t=this;let e,i,n=t._cache.data||[];if(n.length)return n;const o=t.getMatchingVisibleMetas();if(t._normalized&&o.length)return t._cache.data=o[0].controller.getAllParsedValues(t);for(e=0,i=o.length;e<i;++e)n=n.concat(o[e].controller.getAllParsedValues(t));return t._cache.data=t.normalize(n)}getLabelTimestamps(){const t=this,e=t._cache.labels||[];let i,n;if(e.length)return e;const o=t.getLabels();for(i=0,n=o.length;i<n;++i)e.push(Wo(t,o[i]));return t._cache.labels=t._normalized?e:t.normalize(e)}normalize(t){return gt(t.sort(Bo))}}function Uo(t,e,i){let n,o,s,a;if(i)n=Math.floor(e),o=Math.ceil(e),s=t[n],a=t[o];else{const i=at(t,e);s=i.lo,a=i.hi,n=t[s],o=t[a]}const r=o-n;return r?s+(a-s)*(e-n)/r:s}Yo.id="time",Yo.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class $o extends Yo{constructor(t){super(t),this._table=[],this._maxIndex=void 0}initOffsets(){const t=this,e=t._getTimestampsForTable();t._table=t.buildLookupTable(e),t._maxIndex=t._table.length-1,super.initOffsets(e)}buildLookupTable(t){const{min:e,max:i}=this;if(!t.length)return[{time:e,pos:0},{time:i,pos:1}];const n=[e];let o,s,a;for(o=0,s=t.length;o<s;++o)a=t[o],a>e&&a<i&&n.push(a);return n.push(i),n}_getTimestampsForTable(){const t=this;let e=t._cache.all||[];if(e.length)return e;const i=t.getDataTimestamps(),n=t.getLabelTimestamps();return e=i.length&&n.length?t.normalize(i.concat(n)):i.length?i:n,e=t._cache.all=e,e}getPixelForValue(t,e){const i=this,n=i._offsets,o=i._normalized&&i._maxIndex>0&&!s(e)?e/i._maxIndex:i.getDecimalForValue(t);return i.getPixelForDecimal((n.start+o)*n.factor)}getDecimalForValue(t){return Uo(this._table,t)/this._maxIndex}getValueForPixel(t){const e=this,i=e._offsets,n=e.getDecimalForPixel(t)/i.factor-i.end;return Uo(e._table,n*this._maxIndex,!0)}}$o.id="timeseries",$o.defaults=Yo.defaults;var Xo=Object.freeze({__proto__:null,CategoryScale:wo,LinearScale:So,LogarithmicScale:Oo,RadialLinearScale:Fo,TimeScale:Yo,TimeSeriesScale:$o});return Ei.register(pn,Xo,In,Mo),Ei.helpers={...Qi},Ei._adapters=en,Ei.Animation=qe,Ei.Animations=Ze,Ei.animator=i,Ei.controllers=yi.controllers.items,Ei.DatasetController=li,Ei.Element=ci,Ei.elements=In,Ei.Interaction=Ct,Ei.layouts=Kt,Ei.platforms=he,Ei.Scale=bi,Ei.Ticks=ui,Object.assign(Ei,pn,Xo,In,Mo,he),Ei.Chart=Ei,"undefined"!=typeof window&&(window.Chart=Ei),Ei}));