File "chart.esm-BtPCRWEo.js"

Full Path: /home/adniftyx/public_html/wp-content/plugins/fc-loan-calculator/dist/js/chart.esm-BtPCRWEo.js
File size: 202.04 KB
MIME-type: text/plain
Charset: utf-8

"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var t={exports:{}},C=getDefaultExportFromCjs(t.exports=function(){var t=Object.freeze({__proto__:null,get Colors(){return ma},get Decimation(){return ya},get Filler(){return Ma},get Legend(){return wa},get SubTitle(){return za},get Title(){return ka},get Tooltip(){return Ha}});function e(){}const C=(()=>{let t=0;return()=>t++})();function s(t){return null==t}function n(t){if(Array.isArray&&Array.isArray(t))return!0;const C=Object.prototype.toString.call(t);return"[object"===C.slice(0,7)&&"Array]"===C.slice(-6)}function o(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function r(t,C){return a(t)?t:C}function l(t,C){return void 0===t?C:t}const h=(t,C)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/C,c=(t,C)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*C:+t;function d(t,C,O){if(t&&"function"==typeof t.call)return t.apply(O,C)}function u(t,C,O,A){let T,L,E;if(n(t))if(L=t.length,A)for(T=L-1;T>=0;T--)C.call(O,t[T],T);else for(T=0;T<L;T++)C.call(O,t[T],T);else if(o(t))for(E=Object.keys(t),L=E.length,T=0;T<L;T++)C.call(O,t[E[T]],E[T])}function f(t,C){let O,A,T,L;if(!t||!C||t.length!==C.length)return!1;for(O=0,A=t.length;O<A;++O)if(T=t[O],L=C[O],T.datasetIndex!==L.datasetIndex||T.index!==L.index)return!1;return!0}function g(t){if(n(t))return t.map(g);if(o(t)){const C=Object.create(null),O=Object.keys(t),A=O.length;let T=0;for(;T<A;++T)C[O[T]]=g(t[O[T]]);return C}return t}function p(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function m(t,C,O,A){if(!p(t))return;const T=C[t],L=O[t];o(T)&&o(L)?x(T,L,A):C[t]=g(L)}function x(t,C,O){const A=n(C)?C:[C],T=A.length;if(!o(t))return t;const L=(O=O||{}).merger||m;let E;for(let C=0;C<T;++C){if(E=A[C],!o(E))continue;const T=Object.keys(E);for(let C=0,A=T.length;C<A;++C)L(T[C],t,E,O)}return t}function b(t,C){return x(t,C,{merger:_})}function _(t,C,O){if(!p(t))return;const A=C[t],T=O[t];o(A)&&o(T)?b(A,T):Object.prototype.hasOwnProperty.call(C,t)||(C[t]=g(T))}const O={"":t=>t,x:t=>t.x,y:t=>t.y};function v(t){const C=t.split("."),O=[];let A="";for(const t of C)A+=t,A.endsWith("\\")?A=A.slice(0,-1)+".":(O.push(A),A="");return O}function M(t,C){const A=O[C]||(O[C]=function(t){const C=v(t);return t=>{for(const O of C){if(""===O)break;t=t&&t[O]}return t}}(C));return A(t)}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}const k=t=>void 0!==t,S=t=>"function"==typeof t,P=(t,C)=>{if(t.size!==C.size)return!1;for(const O of t)if(!C.has(O))return!1;return!0};function D(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const A=Math.PI,T=2*A,L=T+A,E=Number.POSITIVE_INFINITY,R=A/180,I=A/2,F=A/4,z=2*A/3,ot=Math.log10,ht=Math.sign;function V(t,C,O){return Math.abs(t-C)<O}function B(t){const C=Math.round(t);t=V(t,C,t/1e3)?C:t;const O=Math.pow(10,Math.floor(ot(t))),A=t/O;return(A<=1?1:A<=2?2:A<=5?5:10)*O}function W(t){const C=[],O=Math.sqrt(t);let A;for(A=1;A<O;A++)t%A==0&&(C.push(A),C.push(t/A));return O===(0|O)&&C.push(O),C.sort((t,C)=>t-C).pop(),C}function N(t){return!isNaN(parseFloat(t))&&isFinite(t)}function H(t,C){const O=Math.round(t);return O-C<=t&&O+C>=t}function j(t,C,O){let A,T,L;for(A=0,T=t.length;A<T;A++)L=t[A][O],isNaN(L)||(C.min=Math.min(C.min,L),C.max=Math.max(C.max,L))}function $(t){return t*(A/180)}function Y(t){return t*(180/A)}function U(t){if(!a(t))return;let C=1,O=0;for(;Math.round(t*C)/C!==t;)C*=10,O++;return O}function X(t,C){const O=C.x-t.x,L=C.y-t.y,E=Math.sqrt(O*O+L*L);let R=Math.atan2(L,O);return R<-.5*A&&(R+=T),{angle:R,distance:E}}function q(t,C){return Math.sqrt(Math.pow(C.x-t.x,2)+Math.pow(C.y-t.y,2))}function K(t,C){return(t-C+L)%T-A}function G(t){return(t%T+T)%T}function Z(t,C,O,A){const T=G(t),L=G(C),E=G(O),R=G(L-T),I=G(E-T),F=G(T-L),z=G(T-E);return T===L||T===E||A&&L===E||R>I&&F<z}function J(t,C,O){return Math.max(C,Math.min(O,t))}function Q(t){return J(t,-32768,32767)}function tt(t,C,O,A=1e-6){return t>=Math.min(C,O)-A&&t<=Math.max(C,O)+A}function et(t,C,O){O=O||(O=>t[O]<C);let A,T=t.length-1,L=0;for(;T-L>1;)A=L+T>>1,O(A)?L=A:T=A;return{lo:L,hi:T}}const it=(t,C,O,A)=>et(t,O,A?A=>{const T=t[A][C];return T<O||T===O&&t[A+1][C]===O}:A=>t[A][C]<O),st=(t,C,O)=>et(t,O,A=>t[A][C]>=O);function nt(t,C,O){let A=0,T=t.length;for(;A<T&&t[A]<C;)A++;for(;T>A&&t[T-1]>O;)T--;return A>0||T<t.length?t.slice(A,T):t}const bt=["push","pop","shift","splice","unshift"];function at(t,C){t._chartjs?t._chartjs.listeners.push(C):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[C]}}),bt.forEach(C=>{const O="_onData"+w(C),A=t[C];Object.defineProperty(t,C,{configurable:!0,enumerable:!1,value(...C){const T=A.apply(this,C);return t._chartjs.listeners.forEach(t=>{"function"==typeof t[O]&&t[O](...C)}),T}})}))}function rt(t,C){const O=t._chartjs;if(!O)return;const A=O.listeners,T=A.indexOf(C);-1!==T&&A.splice(T,1),A.length>0||(bt.forEach(C=>{delete t[C]}),delete t._chartjs)}function lt(t){const C=new Set(t);return C.size===t.length?t:Array.from(C)}const St="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function ct(t,C){let O=[],A=!1;return function(...T){O=T,A||(A=!0,St.call(window,()=>{A=!1,t.apply(C,O)}))}}function dt(t,C){let O;return function(...A){return C?(clearTimeout(O),O=setTimeout(t,C,A)):t.apply(this,A),C}}const ut=t=>"start"===t?"left":"end"===t?"right":"center",ft=(t,C,O)=>"start"===t?C:"end"===t?O:(C+O)/2,gt=(t,C,O,A)=>t===(A?"left":"right")?O:"center"===t?(C+O)/2:C;function pt(t,C,O){const A=C.length;let T=0,L=A;if(t._sorted){const{iScale:E,_parsed:R}=t,I=E.axis,{min:F,max:z,minDefined:ot,maxDefined:ht}=E.getUserBounds();ot&&(T=J(Math.min(it(R,I,F).lo,O?A:it(C,I,E.getPixelForValue(F)).lo),0,A-1)),L=ht?J(Math.max(it(R,E.axis,z,!0).hi+1,O?0:it(C,I,E.getPixelForValue(z),!0).hi+1),T,A)-T:A-T}return{start:T,count:L}}function mt(t){const{xScale:C,yScale:O,_scaleRanges:A}=t,T={xmin:C.min,xmax:C.max,ymin:O.min,ymax:O.max};if(!A)return t._scaleRanges=T,!0;const L=A.xmin!==C.min||A.xmax!==C.max||A.ymin!==O.min||A.ymax!==O.max;return Object.assign(A,T),L}class xt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,C,O,A){const T=C.listeners[A],L=C.duration;T.forEach(A=>A({chart:t,initial:C.initial,numSteps:L,currentStep:Math.min(O-C.start,L)}))}_refresh(){this._request||(this._running=!0,this._request=St.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let C=0;this._charts.forEach((O,A)=>{if(!O.running||!O.items.length)return;const T=O.items;let L,E=T.length-1,R=!1;for(;E>=0;--E)L=T[E],L._active?(L._total>O.duration&&(O.duration=L._total),L.tick(t),R=!0):(T[E]=T[T.length-1],T.pop());R&&(A.draw(),this._notify(A,O,t,"progress")),T.length||(O.running=!1,this._notify(A,O,t,"complete"),O.initial=!1),C+=T.length}),this._lastDate=t,0===C&&(this._running=!1)}_getAnims(t){const C=this._charts;let O=C.get(t);return O||(O={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},C.set(t,O)),O}listen(t,C,O){this._getAnims(t).listeners[C].push(O)}add(t,C){C&&C.length&&this._getAnims(t).items.push(...C)}has(t){return this._getAnims(t).items.length>0}start(t){const C=this._charts.get(t);C&&(C.running=!0,C.start=Date.now(),C.duration=C.items.reduce((t,C)=>Math.max(t,C._duration),0),this._refresh())}running(t){if(!this._running)return!1;const C=this._charts.get(t);return!!(C&&C.running&&C.items.length)}stop(t){const C=this._charts.get(t);if(!C||!C.items.length)return;const O=C.items;let A=O.length-1;for(;A>=0;--A)O[A].cancel();C.items=[],this._notify(t,C,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Pt=new xt;
/*!
	 * @kurkle/color v0.3.2
	 * https://github.com/kurkle/color#readme
	 * (c) 2023 Jukka Kurkela
	 * Released under the MIT License
	 */function _t(t){return t+.5|0}const yt=(t,C,O)=>Math.max(Math.min(t,O),C);function vt(t){return yt(_t(2.55*t),0,255)}function Mt(t){return yt(_t(255*t),0,255)}function wt(t){return yt(_t(t/2.55)/100,0,1)}function kt(t){return yt(_t(100*t),0,100)}const Tt={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},Nt=[..."0123456789ABCDEF"],Dt=t=>Nt[15&t],Ct=t=>Nt[(240&t)>>4]+Nt[15&t],Ot=t=>(240&t)>>4==(15&t);function At(t){var C=(t=>Ot(t.r)&&Ot(t.g)&&Ot(t.b)&&Ot(t.a))(t)?Dt:Ct;return t?"#"+C(t.r)+C(t.g)+C(t.b)+((t,C)=>t<255?C(t):"")(t.a,C):void 0}const Ht=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Lt(t,C,O){const A=C*Math.min(O,1-O),n=(C,T=(C+t/30)%12)=>O-A*Math.max(Math.min(T-3,9-T,1),-1);return[n(0),n(8),n(4)]}function Et(t,C,O){const s=(A,T=(A+t/60)%6)=>O-O*C*Math.max(Math.min(T,4-T,1),0);return[s(5),s(3),s(1)]}function Rt(t,C,O){const A=Lt(t,1,.5);let T;for(C+O>1&&(T=1/(C+O),C*=T,O*=T),T=0;T<3;T++)A[T]*=1-C-O,A[T]+=C;return A}function It(t){const C=t.r/255,O=t.g/255,A=t.b/255,T=Math.max(C,O,A),L=Math.min(C,O,A),E=(T+L)/2;let R,I,F;return T!==L&&(F=T-L,I=E>.5?F/(2-T-L):F/(T+L),R=function(t,C,O,A,T){return t===T?(C-O)/A+(C<O?6:0):C===T?(O-t)/A+2:(t-C)/A+4}(C,O,A,F,T),R=60*R+.5),[0|R,I||0,E]}function zt(t,C,O,A){return(Array.isArray(C)?t(C[0],C[1],C[2]):t(C,O,A)).map(Mt)}function Ft(t,C,O){return zt(Lt,t,C,O)}function Vt(t){return(t%360+360)%360}function Bt(t){const C=Ht.exec(t);let O,A=255;if(!C)return;C[5]!==O&&(A=C[6]?vt(+C[5]):Mt(+C[5]));const T=Vt(+C[2]),L=+C[3]/100,E=+C[4]/100;return O="hwb"===C[1]?function(t,C,O){return zt(Rt,t,C,O)}(T,L,E):"hsv"===C[1]?function(t,C,O){return zt(Et,t,C,O)}(T,L,E):Ft(T,L,E),{r:O[0],g:O[1],b:O[2],a:A}}const Wt={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"},$t={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 ee;function jt(t){ee||(ee=function(){const t={},C=Object.keys($t),O=Object.keys(Wt);let A,T,L,E,R;for(A=0;A<C.length;A++){for(E=R=C[A],T=0;T<O.length;T++)L=O[T],R=R.replace(L,Wt[L]);L=parseInt($t[E],16),t[R]=[L>>16&255,L>>8&255,255&L]}return t}(),ee.transparent=[0,0,0,0]);const C=ee[t.toLowerCase()];return C&&{r:C[0],g:C[1],b:C[2],a:4===C.length?C[3]:255}}const ie=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,Yt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Ut=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Xt(t,C,O){if(t){let A=It(t);A[C]=Math.max(0,Math.min(A[C]+A[C]*O,0===C?360:1)),A=Ft(A),t.r=A[0],t.g=A[1],t.b=A[2]}}function qt(t,C){return t?Object.assign(C||{},t):t}function Kt(t){var C={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(C={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(C.a=Mt(t[3]))):(C=qt(t,{r:0,g:0,b:0,a:1})).a=Mt(C.a),C}function Gt(t){return"r"===t.charAt(0)?function(t){const C=ie.exec(t);let O,A,T,L=255;if(C){if(C[7]!==O){const t=+C[7];L=C[8]?vt(t):yt(255*t,0,255)}return O=+C[1],A=+C[3],T=+C[5],O=255&(C[2]?vt(O):yt(O,0,255)),A=255&(C[4]?vt(A):yt(A,0,255)),T=255&(C[6]?vt(T):yt(T,0,255)),{r:O,g:A,b:T,a:L}}}(t):Bt(t)}class Zt{constructor(t){if(t instanceof Zt)return t;const C=typeof t;let O;var A,T,L;"object"===C?O=Kt(t):"string"===C&&(L=(A=t).length,"#"===A[0]&&(4===L||5===L?T={r:255&17*Tt[A[1]],g:255&17*Tt[A[2]],b:255&17*Tt[A[3]],a:5===L?17*Tt[A[4]]:255}:7!==L&&9!==L||(T={r:Tt[A[1]]<<4|Tt[A[2]],g:Tt[A[3]]<<4|Tt[A[4]],b:Tt[A[5]]<<4|Tt[A[6]],a:9===L?Tt[A[7]]<<4|Tt[A[8]]:255})),O=T||jt(t)||Gt(t)),this._rgb=O,this._valid=!!O}get valid(){return this._valid}get rgb(){var t=qt(this._rgb);return t&&(t.a=wt(t.a)),t}set rgb(t){this._rgb=Kt(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${wt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?At(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const C=It(t),O=C[0],A=kt(C[1]),T=kt(C[2]);return t.a<255?`hsla(${O}, ${A}%, ${T}%, ${wt(t.a)})`:`hsl(${O}, ${A}%, ${T}%)`}(this._rgb):void 0}mix(t,C){if(t){const O=this.rgb,A=t.rgb;let T;const L=C===T?.5:C,E=2*L-1,R=O.a-A.a,I=((E*R==-1?E:(E+R)/(1+E*R))+1)/2;T=1-I,O.r=255&I*O.r+T*A.r+.5,O.g=255&I*O.g+T*A.g+.5,O.b=255&I*O.b+T*A.b+.5,O.a=L*O.a+(1-L)*A.a,this.rgb=O}return this}interpolate(t,C){return t&&(this._rgb=function(t,C,O){const A=Ut(wt(t.r)),T=Ut(wt(t.g)),L=Ut(wt(t.b));return{r:Mt(Yt(A+O*(Ut(wt(C.r))-A))),g:Mt(Yt(T+O*(Ut(wt(C.g))-T))),b:Mt(Yt(L+O*(Ut(wt(C.b))-L))),a:t.a+O*(C.a-t.a)}}(this._rgb,t._rgb,C)),this}clone(){return new Zt(this.rgb)}alpha(t){return this._rgb.a=Mt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,C=_t(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=C,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 Xt(this._rgb,2,t),this}darken(t){return Xt(this._rgb,2,-t),this}saturate(t){return Xt(this._rgb,1,t),this}desaturate(t){return Xt(this._rgb,1,-t),this}rotate(t){return function(t,C){var O=It(t);O[0]=Vt(O[0]+C),O=Ft(O),t.r=O[0],t.g=O[1],t.b=O[2]}(this._rgb,t),this}}function Jt(t){if(t&&"object"==typeof t){const C=t.toString();return"[object CanvasPattern]"===C||"[object CanvasGradient]"===C}return!1}function Qt(t){return Jt(t)?t:new Zt(t)}function te(t){return Jt(t)?t:new Zt(t).saturate(.5).darken(.1).hexString()}const se=["x","y","borderWidth","radius","tension"],oe=["color","borderColor","backgroundColor"],ae=new Map;function ne(t,C,O){return function(t,C){C=C||{};const O=t+JSON.stringify(C);let A=ae.get(O);return A||(A=new Intl.NumberFormat(t,C),ae.set(O,A)),A}(C,O).format(t)}const re={values:t=>n(t)?t:""+t,numeric(t,C,O){if(0===t)return"0";const A=this.chart.options.locale;let T,L=t;if(O.length>1){const C=Math.max(Math.abs(O[0].value),Math.abs(O[O.length-1].value));(C<1e-4||C>1e15)&&(T="scientific"),L=function(t,C){let O=C.length>3?C[2].value-C[1].value:C[1].value-C[0].value;return Math.abs(O)>=1&&t!==Math.floor(t)&&(O=t-Math.floor(t)),O}(t,O)}const E=ot(Math.abs(L)),R=isNaN(E)?1:Math.max(Math.min(-1*Math.floor(E),20),0),I={notation:T,minimumFractionDigits:R,maximumFractionDigits:R};return Object.assign(I,this.options.ticks.format),ne(t,A,I)},logarithmic(t,C,O){if(0===t)return"0";const A=O[C].significand||t/Math.pow(10,Math.floor(ot(t)));return[1,2,3,5,10,15].includes(A)||C>.8*O.length?re.numeric.call(this,t,C,O):""}};var le={formatters:re};const ue=Object.create(null),be=Object.create(null);function he(t,C){if(!C)return t;const O=C.split(".");for(let C=0,A=O.length;C<A;++C){const A=O[C];t=t[A]||(t[A]=Object.create(null))}return t}function ce(t,C,O){return"string"==typeof C?x(he(t,C),O):x(he(t,""),C)}class de{constructor(t,C){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),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={},this.hoverBackgroundColor=(t,C)=>te(C.backgroundColor),this.hoverBorderColor=(t,C)=>te(C.borderColor),this.hoverColor=(t,C)=>te(C.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(C)}set(t,C){return ce(this,t,C)}get(t){return he(this,t)}describe(t,C){return ce(be,t,C)}override(t,C){return ce(ue,t,C)}route(t,C,O,A){const T=he(this,t),L=he(this,O),E="_"+C;Object.defineProperties(T,{[E]:{value:T[C],writable:!0},[C]:{enumerable:!0,get(){const t=this[E],C=L[A];return o(t)?Object.assign({},C,t):l(t,C)},set(t){this[E]=t}}})}apply(t){t.forEach(t=>t(this))}}var Se=new de({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:oe},numbers:{type:"number",properties:se}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,C)=>C.lineWidth,tickColor:(t,C)=>C.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:le.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function fe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ge(t){let C=t.parentNode;return C&&"[object ShadowRoot]"===C.toString()&&(C=C.host),C}function pe(t,C,O){let A;return"string"==typeof t?(A=parseInt(t,10),-1!==t.indexOf("%")&&(A=A/100*C.parentNode[O])):A=t,A}const me=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function xe(t,C){return me(t).getPropertyValue(C)}const si=["top","right","bottom","left"];function _e(t,C,O){const A={};O=O?"-"+O:"";for(let T=0;T<4;T++){const L=si[T];A[L]=parseFloat(t[C+"-"+L+O])||0}return A.width=A.left+A.right,A.height=A.top+A.bottom,A}const ye=(t,C,O)=>(t>0||C>0)&&(!O||!O.shadowRoot);function ve(t,C){if("native"in t)return t;const{canvas:O,currentDevicePixelRatio:A}=C,T=me(O),L="border-box"===T.boxSizing,E=_e(T,"padding"),R=_e(T,"border","width"),{x:I,y:F,box:z}=function(t,C){const O=t.touches,A=O&&O.length?O[0]:t,{offsetX:T,offsetY:L}=A;let E,R,I=!1;if(ye(T,L,t.target))E=T,R=L;else{const t=C.getBoundingClientRect();E=A.clientX-t.left,R=A.clientY-t.top,I=!0}return{x:E,y:R,box:I}}(t,O),ot=E.left+(z&&R.left),ht=E.top+(z&&R.top);let{width:bt,height:St}=C;return L&&(bt-=E.width+R.width,St-=E.height+R.height),{x:Math.round((I-ot)/bt*O.width/A),y:Math.round((F-ht)/St*O.height/A)}}const Me=t=>Math.round(10*t)/10;function we(t,C,O,A){const T=me(t),L=_e(T,"margin"),R=pe(T.maxWidth,t,"clientWidth")||E,I=pe(T.maxHeight,t,"clientHeight")||E,F=function(t,C,O){let A,T;if(void 0===C||void 0===O){const L=t&&ge(t);if(L){const t=L.getBoundingClientRect(),E=me(L),R=_e(E,"border","width"),I=_e(E,"padding");C=t.width-I.width-R.width,O=t.height-I.height-R.height,A=pe(E.maxWidth,L,"clientWidth"),T=pe(E.maxHeight,L,"clientHeight")}else C=t.clientWidth,O=t.clientHeight}return{width:C,height:O,maxWidth:A||E,maxHeight:T||E}}(t,C,O);let{width:z,height:ot}=F;if("content-box"===T.boxSizing){const t=_e(T,"border","width"),C=_e(T,"padding");z-=C.width+t.width,ot-=C.height+t.height}return z=Math.max(0,z-L.width),ot=Math.max(0,A?z/A:ot-L.height),z=Me(Math.min(z,R,F.maxWidth)),ot=Me(Math.min(ot,I,F.maxHeight)),z&&!ot&&(ot=Me(z/2)),(void 0!==C||void 0!==O)&&A&&F.height&&ot>F.height&&(ot=F.height,z=Me(Math.floor(ot*A))),{width:z,height:ot}}function ke(t,C,O){const A=C||1,T=Math.floor(t.height*A),L=Math.floor(t.width*A);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const E=t.canvas;return E.style&&(O||!E.style.height&&!E.style.width)&&(E.style.height=`${t.height}px`,E.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==A||E.height!==T||E.width!==L)&&(t.currentDevicePixelRatio=A,E.height=T,E.width=L,t.ctx.setTransform(A,0,0,A,0,0),!0)}const fi=function(){let t=!1;try{const C={get passive(){return t=!0,!1}};fe()&&(window.addEventListener("test",null,C),window.removeEventListener("test",null,C))}catch(t){}return t}();function Pe(t,C){const O=xe(t,C),A=O&&O.match(/^(\d+)(\.\d+)?px$/);return A?+A[1]:void 0}function De(t){return!t||s(t.size)||s(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Ce(t,C,O,A,T){let L=C[T];return L||(L=C[T]=t.measureText(T).width,O.push(T)),L>A&&(A=L),A}function Oe(t,C,O,A){let T=(A=A||{}).data=A.data||{},L=A.garbageCollect=A.garbageCollect||[];A.font!==C&&(T=A.data={},L=A.garbageCollect=[],A.font=C),t.save(),t.font=C;let E=0;const R=O.length;let I,F,z,ot,ht;for(I=0;I<R;I++)if(ot=O[I],null==ot||n(ot)){if(n(ot))for(F=0,z=ot.length;F<z;F++)ht=ot[F],null==ht||n(ht)||(E=Ce(t,T,L,E,ht))}else E=Ce(t,T,L,E,ot);t.restore();const bt=L.length/2;if(bt>O.length){for(I=0;I<bt;I++)delete T[L[I]];L.splice(0,bt)}return E}function Ae(t,C,O){const A=t.currentDevicePixelRatio,T=0!==O?Math.max(O/2,.5):0;return Math.round((C-T)*A)/A+T}function Te(t,C){(C||t)&&((C=C||t.getContext("2d")).save(),C.resetTransform(),C.clearRect(0,0,t.width,t.height),C.restore())}function Le(t,C,O,A){Ee(t,C,O,A,null)}function Ee(t,C,O,L,E){let ot,ht,bt,St,Pt,Tt,Nt,Ht;const Wt=C.pointStyle,$t=C.rotation,ee=C.radius;let ie=($t||0)*R;if(Wt&&"object"==typeof Wt&&(ot=Wt.toString(),"[object HTMLImageElement]"===ot||"[object HTMLCanvasElement]"===ot))return t.save(),t.translate(O,L),t.rotate(ie),t.drawImage(Wt,-Wt.width/2,-Wt.height/2,Wt.width,Wt.height),void t.restore();if(!(isNaN(ee)||ee<=0)){switch(t.beginPath(),Wt){default:E?t.ellipse(O,L,E/2,ee,0,0,T):t.arc(O,L,ee,0,T),t.closePath();break;case"triangle":Tt=E?E/2:ee,t.moveTo(O+Math.sin(ie)*Tt,L-Math.cos(ie)*ee),ie+=z,t.lineTo(O+Math.sin(ie)*Tt,L-Math.cos(ie)*ee),ie+=z,t.lineTo(O+Math.sin(ie)*Tt,L-Math.cos(ie)*ee),t.closePath();break;case"rectRounded":Pt=.516*ee,St=ee-Pt,ht=Math.cos(ie+F)*St,Nt=Math.cos(ie+F)*(E?E/2-Pt:St),bt=Math.sin(ie+F)*St,Ht=Math.sin(ie+F)*(E?E/2-Pt:St),t.arc(O-Nt,L-bt,Pt,ie-A,ie-I),t.arc(O+Ht,L-ht,Pt,ie-I,ie),t.arc(O+Nt,L+bt,Pt,ie,ie+I),t.arc(O-Ht,L+ht,Pt,ie+I,ie+A),t.closePath();break;case"rect":if(!$t){St=Math.SQRT1_2*ee,Tt=E?E/2:St,t.rect(O-Tt,L-St,2*Tt,2*St);break}ie+=F;case"rectRot":Nt=Math.cos(ie)*(E?E/2:ee),ht=Math.cos(ie)*ee,bt=Math.sin(ie)*ee,Ht=Math.sin(ie)*(E?E/2:ee),t.moveTo(O-Nt,L-bt),t.lineTo(O+Ht,L-ht),t.lineTo(O+Nt,L+bt),t.lineTo(O-Ht,L+ht),t.closePath();break;case"crossRot":ie+=F;case"cross":Nt=Math.cos(ie)*(E?E/2:ee),ht=Math.cos(ie)*ee,bt=Math.sin(ie)*ee,Ht=Math.sin(ie)*(E?E/2:ee),t.moveTo(O-Nt,L-bt),t.lineTo(O+Nt,L+bt),t.moveTo(O+Ht,L-ht),t.lineTo(O-Ht,L+ht);break;case"star":Nt=Math.cos(ie)*(E?E/2:ee),ht=Math.cos(ie)*ee,bt=Math.sin(ie)*ee,Ht=Math.sin(ie)*(E?E/2:ee),t.moveTo(O-Nt,L-bt),t.lineTo(O+Nt,L+bt),t.moveTo(O+Ht,L-ht),t.lineTo(O-Ht,L+ht),ie+=F,Nt=Math.cos(ie)*(E?E/2:ee),ht=Math.cos(ie)*ee,bt=Math.sin(ie)*ee,Ht=Math.sin(ie)*(E?E/2:ee),t.moveTo(O-Nt,L-bt),t.lineTo(O+Nt,L+bt),t.moveTo(O+Ht,L-ht),t.lineTo(O-Ht,L+ht);break;case"line":ht=E?E/2:Math.cos(ie)*ee,bt=Math.sin(ie)*ee,t.moveTo(O-ht,L-bt),t.lineTo(O+ht,L+bt);break;case"dash":t.moveTo(O,L),t.lineTo(O+Math.cos(ie)*(E?E/2:ee),L+Math.sin(ie)*ee);break;case!1:t.closePath()}t.fill(),C.borderWidth>0&&t.stroke()}}function Re(t,C,O){return O=O||.5,!C||t&&t.x>C.left-O&&t.x<C.right+O&&t.y>C.top-O&&t.y<C.bottom+O}function Ie(t,C){t.save(),t.beginPath(),t.rect(C.left,C.top,C.right-C.left,C.bottom-C.top),t.clip()}function ze(t){t.restore()}function Fe(t,C,O,A,T){if(!C)return t.lineTo(O.x,O.y);if("middle"===T){const A=(C.x+O.x)/2;t.lineTo(A,C.y),t.lineTo(A,O.y)}else"after"===T!=!!A?t.lineTo(C.x,O.y):t.lineTo(O.x,C.y);t.lineTo(O.x,O.y)}function Ve(t,C,O,A){if(!C)return t.lineTo(O.x,O.y);t.bezierCurveTo(A?C.cp1x:C.cp2x,A?C.cp1y:C.cp2y,A?O.cp2x:O.cp1x,A?O.cp2y:O.cp1y,O.x,O.y)}function Be(t,C,O,A,T){if(T.strikethrough||T.underline){const L=t.measureText(A),E=C-L.actualBoundingBoxLeft,R=C+L.actualBoundingBoxRight,I=O-L.actualBoundingBoxAscent,F=O+L.actualBoundingBoxDescent,z=T.strikethrough?(I+F)/2:F;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=T.decorationWidth||2,t.moveTo(E,z),t.lineTo(R,z),t.stroke()}}function We(t,C){const O=t.fillStyle;t.fillStyle=C.color,t.fillRect(C.left,C.top,C.width,C.height),t.fillStyle=O}function Ne(t,C,O,A,T,L={}){const E=n(C)?C:[C],R=L.strokeWidth>0&&""!==L.strokeColor;let I,F;for(t.save(),t.font=T.string,function(t,C){C.translation&&t.translate(C.translation[0],C.translation[1]),s(C.rotation)||t.rotate(C.rotation),C.color&&(t.fillStyle=C.color),C.textAlign&&(t.textAlign=C.textAlign),C.textBaseline&&(t.textBaseline=C.textBaseline)}(t,L),I=0;I<E.length;++I)F=E[I],L.backdrop&&We(t,L.backdrop),R&&(L.strokeColor&&(t.strokeStyle=L.strokeColor),s(L.strokeWidth)||(t.lineWidth=L.strokeWidth),t.strokeText(F,O,A,L.maxWidth)),t.fillText(F,O,A,L.maxWidth),Be(t,O,A,F,L),A+=Number(T.lineHeight);t.restore()}function He(t,C){const{x:O,y:T,w:L,h:E,radius:R}=C;t.arc(O+R.topLeft,T+R.topLeft,R.topLeft,1.5*A,A,!0),t.lineTo(O,T+E-R.bottomLeft),t.arc(O+R.bottomLeft,T+E-R.bottomLeft,R.bottomLeft,A,I,!0),t.lineTo(O+L-R.bottomRight,T+E),t.arc(O+L-R.bottomRight,T+E-R.bottomRight,R.bottomRight,I,0,!0),t.lineTo(O+L,T+R.topRight),t.arc(O+L-R.topRight,T+R.topRight,R.topRight,0,-I,!0),t.lineTo(O+R.topLeft,T)}function je(t,C=[""],O,A,T=()=>t[0]){const L=O||t;void 0===A&&(A=ti("_fallback",t));const E={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:L,_fallback:A,_getTarget:T,override:O=>je([O,...t],C,L,A)};return new Proxy(E,{deleteProperty:(C,O)=>(delete C[O],delete C._keys,delete t[0][O],!0),get:(O,A)=>qe(O,A,()=>function(t,C,O,A){let T;for(const L of C)if(T=ti(Ue(L,t),O),void 0!==T)return Xe(t,T)?Je(O,A,t,T):T}(A,C,t,O)),getOwnPropertyDescriptor:(t,C)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],C),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,C)=>ei(t).includes(C),ownKeys:t=>ei(t),set(t,C,O){const A=t._storage||(t._storage=T());return t[C]=A[C]=O,delete t._keys,!0}})}function $e(t,C,O,A){const T={_cacheable:!1,_proxy:t,_context:C,_subProxy:O,_stack:new Set,_descriptors:Ye(t,A),setContext:C=>$e(t,C,O,A),override:T=>$e(t.override(T),C,O,A)};return new Proxy(T,{deleteProperty:(C,O)=>(delete C[O],delete t[O],!0),get:(t,C,O)=>qe(t,C,()=>function(t,C,O){const{_proxy:A,_context:T,_subProxy:L,_descriptors:E}=t;let R=A[C];return S(R)&&E.isScriptable(C)&&(R=function(t,C,O,A){const{_proxy:T,_context:L,_subProxy:E,_stack:R}=O;if(R.has(t))throw new Error("Recursion detected: "+Array.from(R).join("->")+"->"+t);R.add(t);let I=C(L,E||A);return R.delete(t),Xe(t,I)&&(I=Je(T._scopes,T,t,I)),I}(C,R,t,O)),n(R)&&R.length&&(R=function(t,C,O,A){const{_proxy:T,_context:L,_subProxy:E,_descriptors:R}=O;if(void 0!==L.index&&A(t))return C[L.index%C.length];if(o(C[0])){const O=C,A=T._scopes.filter(t=>t!==O);C=[];for(const I of O){const O=Je(A,T,t,I);C.push($e(O,L,E&&E[t],R))}}return C}(C,R,t,E.isIndexable)),Xe(C,R)&&(R=$e(R,T,L&&L[C],E)),R}(t,C,O)),getOwnPropertyDescriptor:(C,O)=>C._descriptors.allKeys?Reflect.has(t,O)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,O),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(C,O)=>Reflect.has(t,O),ownKeys:()=>Reflect.ownKeys(t),set:(C,O,A)=>(t[O]=A,delete C[O],!0)})}function Ye(t,C={scriptable:!0,indexable:!0}){const{_scriptable:O=C.scriptable,_indexable:A=C.indexable,_allKeys:T=C.allKeys}=t;return{allKeys:T,scriptable:O,indexable:A,isScriptable:S(O)?O:()=>O,isIndexable:S(A)?A:()=>A}}const Ue=(t,C)=>t?t+w(C):C,Xe=(t,C)=>o(C)&&"adapters"!==t&&(null===Object.getPrototypeOf(C)||C.constructor===Object);function qe(t,C,O){if(Object.prototype.hasOwnProperty.call(t,C)||"constructor"===C)return t[C];const A=O();return t[C]=A,A}function Ke(t,C,O){return S(t)?t(C,O):t}const Ge=(t,C)=>!0===t?C:"string"==typeof t?M(C,t):void 0;function Ze(t,C,O,A,T){for(const L of C){const C=Ge(O,L);if(C){t.add(C);const L=Ke(C._fallback,O,T);if(void 0!==L&&L!==O&&L!==A)return L}else if(!1===C&&void 0!==A&&O!==A)return null}return!1}function Je(t,C,O,A){const T=C._rootScopes,L=Ke(C._fallback,O,A),E=[...t,...T],R=new Set;R.add(A);let I=Qe(R,E,O,L||O,A);return null!==I&&(void 0===L||L===O||(I=Qe(R,E,L,I,A),null!==I))&&je(Array.from(R),[""],T,L,()=>function(t,C,O){const A=t._getTarget();C in A||(A[C]={});const T=A[C];return n(T)&&o(O)?O:T||{}}(C,O,A))}function Qe(t,C,O,A,T){for(;O;)O=Ze(t,C,O,A,T);return O}function ti(t,C){for(const O of C){if(!O)continue;const C=O[t];if(void 0!==C)return C}}function ei(t){let C=t._keys;return C||(C=t._keys=function(t){const C=new Set;for(const O of t)for(const t of Object.keys(O).filter(t=>!t.startsWith("_")))C.add(t);return Array.from(C)}(t._scopes)),C}function ii(t,C,O,A){const{iScale:T}=t,{key:L="r"}=this._parsing,E=new Array(A);let R,I,F,z;for(R=0,I=A;R<I;++R)F=R+O,z=C[F],E[R]={r:T.parse(M(z,L),F)};return E}const xi=Number.EPSILON||1e-14,ni=(t,C)=>C<t.length&&!t[C].skip&&t[C],oi=t=>"x"===t?"y":"x";function ai(t,C,O,A){const T=t.skip?C:t,L=C,E=O.skip?C:O,R=q(L,T),I=q(E,L);let F=R/(R+I),z=I/(R+I);F=isNaN(F)?0:F,z=isNaN(z)?0:z;const ot=A*F,ht=A*z;return{previous:{x:L.x-ot*(E.x-T.x),y:L.y-ot*(E.y-T.y)},next:{x:L.x+ht*(E.x-T.x),y:L.y+ht*(E.y-T.y)}}}function ri(t,C="x"){const O=oi(C),A=t.length,T=Array(A).fill(0),L=Array(A);let E,R,I,F=ni(t,0);for(E=0;E<A;++E)if(R=I,I=F,F=ni(t,E+1),I){if(F){const t=F[C]-I[C];T[E]=0!==t?(F[O]-I[O])/t:0}L[E]=R?F?ht(T[E-1])!==ht(T[E])?0:(T[E-1]+T[E])/2:T[E-1]:T[E]}!function(t,C,O){const A=t.length;let T,L,E,R,I,F=ni(t,0);for(let z=0;z<A-1;++z)I=F,F=ni(t,z+1),I&&F&&(V(C[z],0,xi)?O[z]=O[z+1]=0:(T=O[z]/C[z],L=O[z+1]/C[z],R=Math.pow(T,2)+Math.pow(L,2),R<=9||(E=3/Math.sqrt(R),O[z]=T*E*C[z],O[z+1]=L*E*C[z])))}(t,T,L),function(t,C,O="x"){const A=oi(O),T=t.length;let L,E,R,I=ni(t,0);for(let F=0;F<T;++F){if(E=R,R=I,I=ni(t,F+1),!R)continue;const T=R[O],z=R[A];E&&(L=(T-E[O])/3,R[`cp1${O}`]=T-L,R[`cp1${A}`]=z-L*C[F]),I&&(L=(I[O]-T)/3,R[`cp2${O}`]=T+L,R[`cp2${A}`]=z+L*C[F])}}(t,L,C)}function li(t,C,O){return Math.max(Math.min(t,O),C)}function hi(t,C,O,A,T){let L,E,R,I;if(C.spanGaps&&(t=t.filter(t=>!t.skip)),"monotone"===C.cubicInterpolationMode)ri(t,T);else{let O=A?t[t.length-1]:t[0];for(L=0,E=t.length;L<E;++L)R=t[L],I=ai(O,R,t[Math.min(L+1,E-(A?0:1))%E],C.tension),R.cp1x=I.previous.x,R.cp1y=I.previous.y,R.cp2x=I.next.x,R.cp2y=I.next.y,O=R}C.capBezierPoints&&function(t,C){let O,A,T,L,E,R=Re(t[0],C);for(O=0,A=t.length;O<A;++O)E=L,L=R,R=O<A-1&&Re(t[O+1],C),L&&(T=t[O],E&&(T.cp1x=li(T.cp1x,C.left,C.right),T.cp1y=li(T.cp1y,C.top,C.bottom)),R&&(T.cp2x=li(T.cp2x,C.left,C.right),T.cp2y=li(T.cp2y,C.top,C.bottom)))}(t,O)}const ci=t=>0===t||1===t,di=(t,C,O)=>-Math.pow(2,10*(t-=1))*Math.sin((t-C)*T/O),ui=(t,C,O)=>Math.pow(2,-10*t)*Math.sin((t-C)*T/O)+1,bi={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*I),easeOutSine:t=>Math.sin(t*I),easeInOutSine:t=>-.5*(Math.cos(A*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=>ci(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),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=>ci(t)?t:di(t,.075,.3),easeOutElastic:t=>ci(t)?t:ui(t,.075,.3),easeInOutElastic(t){const C=.1125;return ci(t)?t:t<.5?.5*di(2*t,C,.45):.5+.5*ui(2*t-1,C,.45)},easeInBack(t){const C=1.70158;return t*t*((C+1)*t-C)},easeOutBack(t){const C=1.70158;return(t-=1)*t*((C+1)*t+C)+1},easeInOutBack(t){let C=1.70158;return(t/=.5)<1?t*t*((1+(C*=1.525))*t-C)*.5:.5*((t-=2)*t*((1+(C*=1.525))*t+C)+2)},easeInBounce:t=>1-bi.easeOutBounce(1-t),easeOutBounce(t){const C=7.5625,O=2.75;return t<1/O?C*t*t:t<2/O?C*(t-=1.5/O)*t+.75:t<2.5/O?C*(t-=2.25/O)*t+.9375:C*(t-=2.625/O)*t+.984375},easeInOutBounce:t=>t<.5?.5*bi.easeInBounce(2*t):.5*bi.easeOutBounce(2*t-1)+.5};function gi(t,C,O,A){return{x:t.x+O*(C.x-t.x),y:t.y+O*(C.y-t.y)}}function pi(t,C,O,A){return{x:t.x+O*(C.x-t.x),y:"middle"===A?O<.5?t.y:C.y:"after"===A?O<1?t.y:C.y:O>0?C.y:t.y}}function mi(t,C,O,A){const T={x:t.cp2x,y:t.cp2y},L={x:C.cp1x,y:C.cp1y},E=gi(t,T,O),R=gi(T,L,O),I=gi(L,C,O),F=gi(E,R,O),z=gi(R,I,O);return gi(F,z,O)}const Wi=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Xi=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _i(t,C){const O=(""+t).match(Wi);if(!O||"normal"===O[1])return 1.2*C;switch(t=+O[2],O[3]){case"px":return t;case"%":t/=100}return C*t}const yi=t=>+t||0;function vi(t,C){const O={},A=o(C),T=A?Object.keys(C):C,L=o(t)?A?O=>l(t[O],t[C[O]]):C=>t[C]:()=>t;for(const t of T)O[t]=yi(L(t));return O}function Mi(t){return vi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function wi(t){return vi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ki(t){const C=Mi(t);return C.width=C.left+C.right,C.height=C.top+C.bottom,C}function Si(t,C){t=t||{},C=C||Se.font;let O=l(t.size,C.size);"string"==typeof O&&(O=parseInt(O,10));let A=l(t.style,C.style);A&&!(""+A).match(Xi)&&(console.warn('Invalid font style specified: "'+A+'"'),A=void 0);const T={family:l(t.family,C.family),lineHeight:_i(l(t.lineHeight,C.lineHeight),O),size:O,style:A,weight:l(t.weight,C.weight),string:""};return T.string=De(T),T}function Pi(t,C,O,A){let T,L,E,R=!0;for(T=0,L=t.length;T<L;++T)if(E=t[T],void 0!==E&&(void 0!==C&&"function"==typeof E&&(E=E(C),R=!1),void 0!==O&&n(E)&&(E=E[O%E.length],R=!1),void 0!==E))return A&&!R&&(A.cacheable=!1),E}function Di(t,C,O){const{min:A,max:T}=t,L=c(C,(T-A)/2),a=(t,C)=>O&&0===t?0:t+C;return{min:a(A,-Math.abs(L)),max:a(T,L)}}function Ci(t,C){return Object.assign(Object.create(t),C)}function Oi(t,C,O){return t?function(t,C){return{x:O=>t+t+C-O,setWidth(t){C=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,C)=>t-C,leftForLtr:(t,C)=>t-C}}(C,O):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,C)=>t+C,leftForLtr:(t,C)=>t}}function Ai(t,C){let O,A;"ltr"!==C&&"rtl"!==C||(O=t.canvas.style,A=[O.getPropertyValue("direction"),O.getPropertyPriority("direction")],O.setProperty("direction",C,"important"),t.prevTextDirection=A)}function Ti(t,C){void 0!==C&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",C[0],C[1]))}function Li(t){return"angle"===t?{between:Z,compare:K,normalize:G}:{between:tt,compare:(t,C)=>t-C,normalize:t=>t}}function Ei({start:t,end:C,count:O,loop:A,style:T}){return{start:t%O,end:C%O,loop:A&&(C-t+1)%O==0,style:T}}function Ri(t,C,O){if(!O)return[t];const{property:A,start:T,end:L}=O,E=C.length,{compare:R,between:I,normalize:F}=Li(A),{start:z,end:ot,loop:ht,style:bt}=function(t,C,O){const{property:A,start:T,end:L}=O,{between:E,normalize:R}=Li(A),I=C.length;let F,z,{start:ot,end:ht,loop:bt}=t;if(bt){for(ot+=I,ht+=I,F=0,z=I;F<z&&E(R(C[ot%I][A]),T,L);++F)ot--,ht--;ot%=I,ht%=I}return ht<ot&&(ht+=I),{start:ot,end:ht,loop:bt,style:t.style}}(t,C,O),St=[];let Pt,Tt,Nt,Ht=!1,Wt=null;const y=()=>Ht||I(T,Nt,Pt)&&0!==R(T,Nt),v=()=>!Ht||0===R(L,Pt)||I(L,Nt,Pt);for(let t=z,O=z;t<=ot;++t)Tt=C[t%E],Tt.skip||(Pt=F(Tt[A]),Pt!==Nt&&(Ht=I(Pt,T,L),null===Wt&&y()&&(Wt=0===R(Pt,T)?t:O),null!==Wt&&v()&&(St.push(Ei({start:Wt,end:t,loop:ht,count:E,style:bt})),Wt=null),O=t,Nt=Pt));return null!==Wt&&St.push(Ei({start:Wt,end:ot,loop:ht,count:E,style:bt})),St}function Ii(t,C){const O=[],A=t.segments;for(let T=0;T<A.length;T++){const L=Ri(A[T],t.points,C);L.length&&O.push(...L)}return O}function zi(t,C){const O=t.points,A=t.options.spanGaps,T=O.length;if(!T)return[];const L=!!t._loop,{start:E,end:R}=function(t,C,O,A){let T=0,L=C-1;if(O&&!A)for(;T<C&&!t[T].skip;)T++;for(;T<C&&t[T].skip;)T++;for(T%=C,O&&(L+=T);L>T&&t[L%C].skip;)L--;return L%=C,{start:T,end:L}}(O,T,L,A);return Fi(t,!0===A?[{start:E,end:R,loop:L}]:function(t,C,O,A){const T=t.length,L=[];let E,R=C,I=t[C];for(E=C+1;E<=O;++E){const O=t[E%T];O.skip||O.stop?I.skip||(A=!1,L.push({start:C%T,end:(E-1)%T,loop:A}),C=R=O.stop?E:null):(R=E,I.skip&&(C=E)),I=O}return null!==R&&L.push({start:C%T,end:R%T,loop:A}),L}(O,E,R<E?R+T:R,!!t._fullLoop&&0===E&&R===T-1),O,C)}function Fi(t,C,O,A){return A&&A.setContext&&O?function(t,C,O,A){const T=t._chart.getContext(),L=Vi(t.options),{_datasetIndex:E,options:{spanGaps:R}}=t,I=O.length,F=[];let z=L,ot=C[0].start,ht=ot;function f(t,C,A,T){const L=R?-1:1;if(t!==C){for(t+=I;O[t%I].skip;)t-=L;for(;O[C%I].skip;)C+=L;t%I!=C%I&&(F.push({start:t%I,end:C%I,loop:A,style:T}),z=T,ot=C%I)}}for(const t of C){ot=R?ot:t.start;let C,L=O[ot%I];for(ht=ot+1;ht<=t.end;ht++){const R=O[ht%I];C=Vi(A.setContext(Ci(T,{type:"segment",p0:L,p1:R,p0DataIndex:(ht-1)%I,p1DataIndex:ht%I,datasetIndex:E}))),Bi(C,z)&&f(ot,ht-1,t.loop,z),L=R,z=C}ot<ht-1&&f(ot,ht-1,t.loop,z)}return F}(t,C,O,A):C}function Vi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Bi(t,C){if(!C)return!1;const O=[],s=function(t,C){return Jt(C)?(O.includes(C)||O.push(C),O.indexOf(C)):C};return JSON.stringify(t,s)!==JSON.stringify(C,s)}var qi=Object.freeze({__proto__:null,HALF_PI:I,INFINITY:E,PI:A,PITAU:L,QUARTER_PI:F,RAD_PER_DEG:R,TAU:T,TWO_THIRDS_PI:z,_addGrace:Di,_alignPixel:Ae,_alignStartEnd:ft,_angleBetween:Z,_angleDiff:K,_arrayUnique:lt,_attachContext:$e,_bezierCurveTo:Ve,_bezierInterpolation:mi,_boundSegment:Ri,_boundSegments:Ii,_capitalize:w,_computeSegments:zi,_createResolver:je,_decimalPlaces:U,_deprecated:function(t,C,O,A){void 0!==C&&console.warn(t+': "'+O+'" is deprecated. Please use "'+A+'" instead')},_descriptors:Ye,_elementsEqual:f,_factorize:W,_filterBetween:nt,_getParentNode:ge,_getStartAndCountOfVisiblePoints:pt,_int16Range:Q,_isBetween:tt,_isClickEvent:D,_isDomSupported:fe,_isPointInArea:Re,_limitValue:J,_longestText:Oe,_lookup:et,_lookupByKey:it,_measureText:Ce,_merger:m,_mergerIf:_,_normalizeAngle:G,_parseObjectDataRadialScale:ii,_pointInLine:gi,_readValueToProps:vi,_rlookupByKey:st,_scaleRangesChanged:mt,_setMinAndMaxByKey:j,_splitKey:v,_steppedInterpolation:pi,_steppedLineTo:Fe,_textX:gt,_toLeftRightCenter:ut,_updateBezierControlPoints:hi,addRoundedRectPath:He,almostEquals:V,almostWhole:H,callback:d,clearCanvas:Te,clipArea:Ie,clone:g,color:Qt,createContext:Ci,debounce:dt,defined:k,distanceBetweenPoints:q,drawPoint:Le,drawPointLegend:Ee,each:u,easingEffects:bi,finiteOrDefault:r,fontString:function(t,C,O){return C+" "+t+"px "+O},formatNumber:ne,getAngleFromPoint:X,getHoverColor:te,getMaximumSize:we,getRelativePosition:ve,getRtlAdapter:Oi,getStyle:xe,isArray:n,isFinite:a,isFunction:S,isNullOrUndef:s,isNumber:N,isObject:o,isPatternOrGradient:Jt,listenArrayEvents:at,log10:ot,merge:x,mergeIf:b,niceNum:B,noop:e,overrideTextDirection:Ai,readUsedSize:Pe,renderText:Ne,requestAnimFrame:St,resolve:Pi,resolveObjectKey:M,restoreTextDirection:Ti,retinaScale:ke,setsEqual:P,sign:ht,splineCurve:ai,splineCurveMonotone:ri,supportsEventListenerOptions:fi,throttled:ct,toDegrees:Y,toDimension:c,toFont:Si,toFontString:De,toLineHeight:_i,toPadding:ki,toPercentage:h,toRadians:$,toTRBL:Mi,toTRBLCorners:wi,uid:C,unclipArea:ze,unlistenArrayEvents:rt,valueOrDefault:l});function Ni(t,C,O,A){const{controller:T,data:L,_sorted:E}=t,R=T._cachedMeta.iScale;if(R&&C===R.axis&&"r"!==C&&E&&L.length){const t=R._reversePixels?st:it;if(!A)return t(L,C,O);if(T._sharedOptions){const A=L[0],T="function"==typeof A.getRange&&A.getRange(C);if(T){const A=t(L,C,O-T),E=t(L,C,O+T);return{lo:A.lo,hi:E.hi}}}}return{lo:0,hi:L.length-1}}function Hi(t,C,O,A,T){const L=t.getSortedVisibleDatasetMetas(),E=O[C];for(let t=0,O=L.length;t<O;++t){const{index:O,data:R}=L[t],{lo:I,hi:F}=Ni(L[t],C,E,T);for(let t=I;t<=F;++t){const C=R[t];C.skip||A(C,O,t)}}}function ji(t,C,O,A,T){const L=[];return T||t.isPointInArea(C)?(Hi(t,O,C,function(O,E,R){(T||Re(O,t.chartArea,0))&&O.inRange(C.x,C.y,A)&&L.push({element:O,datasetIndex:E,index:R})},!0),L):L}function $i(t,C,O,A,T,L){let E=[];const R=function(t){const C=-1!==t.indexOf("x"),O=-1!==t.indexOf("y");return function(t,A){const T=C?Math.abs(t.x-A.x):0,L=O?Math.abs(t.y-A.y):0;return Math.sqrt(Math.pow(T,2)+Math.pow(L,2))}}(O);let I=Number.POSITIVE_INFINITY;return Hi(t,O,C,function(O,F,z){const ot=O.inRange(C.x,C.y,T);if(A&&!ot)return;const ht=O.getCenterPoint(T);if(!L&&!t.isPointInArea(ht)&&!ot)return;const bt=R(C,ht);bt<I?(E=[{element:O,datasetIndex:F,index:z}],I=bt):bt===I&&E.push({element:O,datasetIndex:F,index:z})}),E}function Yi(t,C,O,A,T,L){return L||t.isPointInArea(C)?"r"!==O||A?$i(t,C,O,A,T,L):function(t,C,O,A){let T=[];return Hi(t,O,C,function(t,O,L){const{startAngle:E,endAngle:R}=t.getProps(["startAngle","endAngle"],A),{angle:I}=X(t,{x:C.x,y:C.y});Z(I,E,R)&&T.push({element:t,datasetIndex:O,index:L})}),T}(t,C,O,T):[]}function Ui(t,C,O,A,T){const L=[],E="x"===O?"inXRange":"inYRange";let R=!1;return Hi(t,O,C,(t,A,I)=>{t[E](C[O],T)&&(L.push({element:t,datasetIndex:A,index:I}),R=R||t.inRange(C.x,C.y,T))}),A&&!R?[]:L}var as={evaluateInteractionItems:Hi,modes:{index(t,C,O,A){const T=ve(C,t),L=O.axis||"x",E=O.includeInvisible||!1,R=O.intersect?ji(t,T,L,A,E):Yi(t,T,L,!1,A,E),I=[];return R.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{const C=R[0].index,O=t.data[C];O&&!O.skip&&I.push({element:O,datasetIndex:t.index,index:C})}),I):[]},dataset(t,C,O,A){const T=ve(C,t),L=O.axis||"xy",E=O.includeInvisible||!1;let R=O.intersect?ji(t,T,L,A,E):Yi(t,T,L,!1,A,E);if(R.length>0){const C=R[0].datasetIndex,O=t.getDatasetMeta(C).data;R=[];for(let t=0;t<O.length;++t)R.push({element:O[t],datasetIndex:C,index:t})}return R},point:(t,C,O,A)=>ji(t,ve(C,t),O.axis||"xy",A,O.includeInvisible||!1),nearest(t,C,O,A){const T=ve(C,t),L=O.axis||"xy",E=O.includeInvisible||!1;return Yi(t,T,L,O.intersect,A,E)},x:(t,C,O,A)=>Ui(t,ve(C,t),"x",O.intersect,A),y:(t,C,O,A)=>Ui(t,ve(C,t),"y",O.intersect,A)}};const hs=["left","top","right","bottom"];function Ki(t,C){return t.filter(t=>t.pos===C)}function Gi(t,C){return t.filter(t=>-1===hs.indexOf(t.pos)&&t.box.axis===C)}function Zi(t,C){return t.sort((t,O)=>{const A=C?O:t,T=C?t:O;return A.weight===T.weight?A.index-T.index:A.weight-T.weight})}function Ji(t,C){const O=function(t){const C={};for(const O of t){const{stack:t,pos:A,stackWeight:T}=O;if(!t||!hs.includes(A))continue;const L=C[t]||(C[t]={count:0,placed:0,weight:0,size:0});L.count++,L.weight+=T}return C}(t),{vBoxMaxWidth:A,hBoxMaxHeight:T}=C;let L,E,R;for(L=0,E=t.length;L<E;++L){R=t[L];const{fullSize:E}=R.box,I=O[R.stack],F=I&&R.stackWeight/I.weight;R.horizontal?(R.width=F?F*A:E&&C.availableWidth,R.height=T):(R.width=A,R.height=F?F*T:E&&C.availableHeight)}return O}function Qi(t,C,O,A){return Math.max(t[O],C[O])+Math.max(t[A],C[A])}function ts(t,C){t.top=Math.max(t.top,C.top),t.left=Math.max(t.left,C.left),t.bottom=Math.max(t.bottom,C.bottom),t.right=Math.max(t.right,C.right)}function es(t,C,O,A){const{pos:T,box:L}=O,E=t.maxPadding;if(!o(T)){O.size&&(t[T]-=O.size);const C=A[O.stack]||{size:0,count:1};C.size=Math.max(C.size,O.horizontal?L.height:L.width),O.size=C.size/C.count,t[T]+=O.size}L.getPadding&&ts(E,L.getPadding());const R=Math.max(0,C.outerWidth-Qi(E,t,"left","right")),I=Math.max(0,C.outerHeight-Qi(E,t,"top","bottom")),F=R!==t.w,z=I!==t.h;return t.w=R,t.h=I,O.horizontal?{same:F,other:z}:{same:z,other:F}}function is(t,C){const O=C.maxPadding;function s(t){const A={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{A[t]=Math.max(C[t],O[t])}),A}return s(t?["left","right"]:["top","bottom"])}function ss(t,C,O,A){const T=[];let L,E,R,I,F,z;for(L=0,E=t.length,F=0;L<E;++L){R=t[L],I=R.box,I.update(R.width||C.w,R.height||C.h,is(R.horizontal,C));const{same:E,other:ot}=es(C,O,R,A);F|=E&&T.length,z=z||ot,I.fullSize||T.push(R)}return F&&ss(T,C,O,A)||z}function ns(t,C,O,A,T){t.top=O,t.left=C,t.right=C+A,t.bottom=O+T,t.width=A,t.height=T}function os(t,C,O,A){const T=O.padding;let{x:L,y:E}=C;for(const R of t){const t=R.box,I=A[R.stack]||{placed:0,weight:1},F=R.stackWeight/I.weight||1;if(R.horizontal){const A=C.w*F,L=I.size||t.height;k(I.start)&&(E=I.start),t.fullSize?ns(t,T.left,E,O.outerWidth-T.right-T.left,L):ns(t,C.left+I.placed,E,A,L),I.start=E,I.placed+=A,E=t.bottom}else{const A=C.h*F,E=I.size||t.width;k(I.start)&&(L=I.start),t.fullSize?ns(t,L,T.top,E,O.outerHeight-T.bottom-T.top):ns(t,L,C.top+I.placed,E,A),I.start=L,I.placed+=A,L=t.right}}C.x=L,C.y=E}var cs={addBox(t,C){t.boxes||(t.boxes=[]),C.fullSize=C.fullSize||!1,C.position=C.position||"top",C.weight=C.weight||0,C._layers=C._layers||function(){return[{z:0,draw(t){C.draw(t)}}]},t.boxes.push(C)},removeBox(t,C){const O=t.boxes?t.boxes.indexOf(C):-1;-1!==O&&t.boxes.splice(O,1)},configure(t,C,O){C.fullSize=O.fullSize,C.position=O.position,C.weight=O.weight},update(t,C,O,A){if(!t)return;const T=ki(t.options.layout.padding),L=Math.max(C-T.width,0),E=Math.max(O-T.height,0),R=function(t){const C=function(t){const C=[];let O,A,T,L,E,R;for(O=0,A=(t||[]).length;O<A;++O)T=t[O],({position:L,options:{stack:E,stackWeight:R=1}}=T),C.push({index:O,box:T,pos:L,horizontal:T.isHorizontal(),weight:T.weight,stack:E&&L+E,stackWeight:R});return C}(t),O=Zi(C.filter(t=>t.box.fullSize),!0),A=Zi(Ki(C,"left"),!0),T=Zi(Ki(C,"right")),L=Zi(Ki(C,"top"),!0),E=Zi(Ki(C,"bottom")),R=Gi(C,"x"),I=Gi(C,"y");return{fullSize:O,leftAndTop:A.concat(L),rightAndBottom:T.concat(I).concat(E).concat(R),chartArea:Ki(C,"chartArea"),vertical:A.concat(T).concat(I),horizontal:L.concat(E).concat(R)}}(t.boxes),I=R.vertical,F=R.horizontal;u(t.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});const z=I.reduce((t,C)=>C.box.options&&!1===C.box.options.display?t:t+1,0)||1,ot=Object.freeze({outerWidth:C,outerHeight:O,padding:T,availableWidth:L,availableHeight:E,vBoxMaxWidth:L/2/z,hBoxMaxHeight:E/2}),ht=Object.assign({},T);ts(ht,ki(A));const bt=Object.assign({maxPadding:ht,w:L,h:E,x:T.left,y:T.top},T),St=Ji(I.concat(F),ot);ss(R.fullSize,bt,ot,St),ss(I,bt,ot,St),ss(F,bt,ot,St)&&ss(I,bt,ot,St),function(t){const C=t.maxPadding;function i(O){const A=Math.max(C[O]-t[O],0);return t[O]+=A,A}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(bt),os(R.leftAndTop,bt,ot,St),bt.x+=bt.w,bt.y+=bt.h,os(R.rightAndBottom,bt,ot,St),t.chartArea={left:bt.left,top:bt.top,right:bt.left+bt.w,bottom:bt.top+bt.h,height:bt.h,width:bt.w},u(R.chartArea,C=>{const O=C.box;Object.assign(O,t.chartArea),O.update(bt.w,bt.h,{left:0,top:0,right:0,bottom:0})})}};class rs{acquireContext(t,C){}releaseContext(t){return!1}addEventListener(t,C,O){}removeEventListener(t,C,O){}getDevicePixelRatio(){return 1}getMaximumSize(t,C,O,A){return C=Math.max(0,C||t.width),O=O||t.height,{width:C,height:Math.max(0,A?Math.floor(C/A):O)}}isAttached(t){return!0}updateConfig(t){}}class ls extends rs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const us="$chartjs",xs={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ds=t=>null===t||""===t,bs=!!fi&&{passive:!0};function fs(t,C,O){t&&t.canvas&&t.canvas.removeEventListener(C,O,bs)}function gs(t,C){for(const O of t)if(O===C||O.contains(C))return!0}function ps(t,C,O){const A=t.canvas,T=new MutationObserver(t=>{let C=!1;for(const O of t)C=C||gs(O.addedNodes,A),C=C&&!gs(O.removedNodes,A);C&&O()});return T.observe(document,{childList:!0,subtree:!0}),T}function ms(t,C,O){const A=t.canvas,T=new MutationObserver(t=>{let C=!1;for(const O of t)C=C||gs(O.removedNodes,A),C=C&&!gs(O.addedNodes,A);C&&O()});return T.observe(document,{childList:!0,subtree:!0}),T}const Ss=new Map;let Ps=0;function _s(){const t=window.devicePixelRatio;t!==Ps&&(Ps=t,Ss.forEach((C,O)=>{O.currentDevicePixelRatio!==t&&C()}))}function ys(t,C,O){const A=t.canvas,T=A&&ge(A);if(!T)return;const L=ct((t,C)=>{const A=T.clientWidth;O(t,C),A<T.clientWidth&&O()},window),E=new ResizeObserver(t=>{const C=t[0],O=C.contentRect.width,A=C.contentRect.height;0===O&&0===A||L(O,A)});return E.observe(T),function(t,C){Ss.size||window.addEventListener("resize",_s),Ss.set(t,C)}(t,L),E}function vs(t,C,O){O&&O.disconnect(),"resize"===C&&function(t){Ss.delete(t),Ss.size||window.removeEventListener("resize",_s)}(t)}function Ms(t,C,O){const A=t.canvas,T=ct(C=>{null!==t.ctx&&O(function(t,C){const O=xs[t.type]||t.type,{x:A,y:T}=ve(t,C);return{type:O,chart:C,native:t,x:void 0!==A?A:null,y:void 0!==T?T:null}}(C,t))},t);return function(t,C,O){t&&t.addEventListener(C,O,bs)}(A,C,T),T}class ws extends rs{acquireContext(t,C){const O=t&&t.getContext&&t.getContext("2d");return O&&O.canvas===t?(function(t,C){const O=t.style,A=t.getAttribute("height"),T=t.getAttribute("width");if(t[us]={initial:{height:A,width:T,style:{display:O.display,height:O.height,width:O.width}}},O.display=O.display||"block",O.boxSizing=O.boxSizing||"border-box",ds(T)){const C=Pe(t,"width");void 0!==C&&(t.width=C)}if(ds(A))if(""===t.style.height)t.height=t.width/(C||2);else{const C=Pe(t,"height");void 0!==C&&(t.height=C)}}(t,C),O):null}releaseContext(t){const C=t.canvas;if(!C[us])return!1;const O=C[us].initial;["height","width"].forEach(t=>{const A=O[t];s(A)?C.removeAttribute(t):C.setAttribute(t,A)});const A=O.style||{};return Object.keys(A).forEach(t=>{C.style[t]=A[t]}),C.width=C.width,delete C[us],!0}addEventListener(t,C,O){this.removeEventListener(t,C);const A=t.$proxies||(t.$proxies={}),T={attach:ps,detach:ms,resize:ys}[C]||Ms;A[C]=T(t,C,O)}removeEventListener(t,C){const O=t.$proxies||(t.$proxies={}),A=O[C];A&&(({attach:vs,detach:vs,resize:vs}[C]||fs)(t,C,A),O[C]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,C,O,A){return we(t,C,O,A)}isAttached(t){const C=t&&ge(t);return!(!C||!C.isConnected)}}function ks(t){return!fe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?ls:ws}var Ds=Object.freeze({__proto__:null,BasePlatform:rs,BasicPlatform:ls,DomPlatform:ws,_detectPlatform:ks});const en="transparent",fn={boolean:(t,C,O)=>O>.5?C:t,color(t,C,O){const A=Qt(t||en),T=A.valid&&Qt(C||en);return T&&T.valid?T.mix(A,O).hexString():C},number:(t,C,O)=>t+(C-t)*O};class Cs{constructor(t,C,O,A){const T=C[O];A=Pi([t.to,A,T,t.from]);const L=Pi([t.from,T,A]);this._active=!0,this._fn=t.fn||fn[t.type||typeof L],this._easing=bi[t.easing]||bi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=C,this._prop=O,this._from=L,this._to=A,this._promises=void 0}active(){return this._active}update(t,C,O){if(this._active){this._notify(!1);const A=this._target[this._prop],T=O-this._start,L=this._duration-T;this._start=O,this._duration=Math.floor(Math.max(L,t.duration)),this._total+=T,this._loop=!!t.loop,this._to=Pi([t.to,C,A,t.from]),this._from=Pi([t.from,A,C])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const C=t-this._start,O=this._duration,A=this._prop,T=this._from,L=this._loop,E=this._to;let R;if(this._active=T!==E&&(L||C<O),!this._active)return this._target[A]=E,void this._notify(!0);C<0?this._target[A]=T:(R=C/O%2,R=L&&R>1?2-R:R,R=this._easing(Math.min(1,Math.max(0,R))),this._target[A]=this._fn(T,E,R))}wait(){const t=this._promises||(this._promises=[]);return new Promise((C,O)=>{t.push({res:C,rej:O})})}_notify(t){const C=t?"res":"rej",O=this._promises||[];for(let t=0;t<O.length;t++)O[t][C]()}}class Os{constructor(t,C){this._chart=t,this._properties=new Map,this.configure(C)}configure(t){if(!o(t))return;const C=Object.keys(Se.animation),O=this._properties;Object.getOwnPropertyNames(t).forEach(A=>{const T=t[A];if(!o(T))return;const L={};for(const t of C)L[t]=T[t];(n(T.properties)&&T.properties||[A]).forEach(t=>{t!==A&&O.has(t)||O.set(t,L)})})}_animateOptions(t,C){const O=C.options,A=function(t,C){if(!C)return;let O=t.options;if(O)return O.$shared&&(t.options=O=Object.assign({},O,{$shared:!1,$animations:{}})),O;t.options=C}(t,O);if(!A)return[];const T=this._createAnimations(A,O);return O.$shared&&function(t,C){const O=[],A=Object.keys(C);for(let C=0;C<A.length;C++){const T=t[A[C]];T&&T.active()&&O.push(T.wait())}return Promise.all(O)}(t.options.$animations,O).then(()=>{t.options=O},()=>{}),T}_createAnimations(t,C){const O=this._properties,A=[],T=t.$animations||(t.$animations={}),L=Object.keys(C),E=Date.now();let R;for(R=L.length-1;R>=0;--R){const I=L[R];if("$"===I.charAt(0))continue;if("options"===I){A.push(...this._animateOptions(t,C));continue}const F=C[I];let z=T[I];const ot=O.get(I);if(z){if(ot&&z.active()){z.update(ot,F,E);continue}z.cancel()}ot&&ot.duration?(T[I]=z=new Cs(ot,t,I,F),A.push(z)):t[I]=F}return A}update(t,C){if(0===this._properties.size)return void Object.assign(t,C);const O=this._createAnimations(t,C);return O.length?(Pt.add(this._chart,O),!0):void 0}}function As(t,C){const O=t&&t.options||{},A=O.reverse,T=void 0===O.min?C:0,L=void 0===O.max?C:0;return{start:A?L:T,end:A?T:L}}function Ts(t,C){const O=[],A=t._getSortedDatasetMetas(C);let T,L;for(T=0,L=A.length;T<L;++T)O.push(A[T].index);return O}function Ls(t,C,O,A={}){const T=t.keys,L="single"===A.mode;let E,R,I,F;if(null!==C){for(E=0,R=T.length;E<R;++E){if(I=+T[E],I===O){if(A.all)continue;break}F=t.values[I],a(F)&&(L||0===C||ht(C)===ht(F))&&(C+=F)}return C}}function Es(t,C){const O=t&&t.options.stacked;return O||void 0===O&&void 0!==C.stack}function Rs(t,C,O){const A=t[C]||(t[C]={});return A[O]||(A[O]={})}function Is(t,C,O,A){for(const T of C.getMatchingVisibleMetas(A).reverse()){const C=t[T.index];if(O&&C>0||!O&&C<0)return T.index}return null}function zs(t,C){const{chart:O,_cachedMeta:A}=t,T=O._stacks||(O._stacks={}),{iScale:L,vScale:E,index:R}=A,I=L.axis,F=E.axis,z=function(t,C,O){return`${t.id}.${C.id}.${O.stack||O.type}`}(L,E,A),ot=C.length;let ht;for(let t=0;t<ot;++t){const O=C[t],{[I]:L,[F]:ot}=O;ht=(O._stacks||(O._stacks={}))[F]=Rs(T,z,L),ht[R]=ot,ht._top=Is(ht,E,!0,A.type),ht._bottom=Is(ht,E,!1,A.type),(ht._visualValues||(ht._visualValues={}))[R]=ot}}function Fs(t,C){const O=t.scales;return Object.keys(O).filter(t=>O[t].axis===C).shift()}function Vs(t,C){const O=t.controller.index,A=t.vScale&&t.vScale.axis;if(A){C=C||t._parsed;for(const t of C){const C=t._stacks;if(!C||void 0===C[A]||void 0===C[A][O])return;delete C[A][O],void 0!==C[A]._visualValues&&void 0!==C[A]._visualValues[O]&&delete C[A]._visualValues[O]}}}const Bs=t=>"reset"===t||"none"===t,Ws=(t,C)=>C?t:Object.assign({},t);class Ns{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,C){this.chart=t,this._ctx=t.ctx,this.index=C,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Es(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Vs(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,C=this._cachedMeta,O=this.getDataset(),s=(t,C,O,A)=>"x"===t?C:"r"===t?A:O,A=C.xAxisID=l(O.xAxisID,Fs(t,"x")),T=C.yAxisID=l(O.yAxisID,Fs(t,"y")),L=C.rAxisID=l(O.rAxisID,Fs(t,"r")),E=C.indexAxis,R=C.iAxisID=s(E,A,T,L),I=C.vAxisID=s(E,T,A,L);C.xScale=this.getScaleForId(A),C.yScale=this.getScaleForId(T),C.rScale=this.getScaleForId(L),C.iScale=this.getScaleForId(R),C.vScale=this.getScaleForId(I)}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 C=this._cachedMeta;return t===C.iScale?C.vScale:C.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&rt(this._data,this),t._stacked&&Vs(t)}_dataCheck(){const t=this.getDataset(),C=t.data||(t.data=[]),O=this._data;if(o(C)){const t=this._cachedMeta;this._data=function(t,C){const{iScale:O,vScale:A}=C,T="x"===O.axis?"x":"y",L="x"===A.axis?"x":"y",E=Object.keys(t),R=new Array(E.length);let I,F,z;for(I=0,F=E.length;I<F;++I)z=E[I],R[I]={[T]:z,[L]:t[z]};return R}(C,t)}else if(O!==C){if(O){rt(O,this);const t=this._cachedMeta;Vs(t),t._parsed=[]}C&&Object.isExtensible(C)&&at(C,this),this._syncList=[],this._data=C}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const C=this._cachedMeta,O=this.getDataset();let A=!1;this._dataCheck();const T=C._stacked;C._stacked=Es(C.vScale,C),C.stack!==O.stack&&(A=!0,Vs(C),C.stack=O.stack),this._resyncElements(t),(A||T!==C._stacked)&&zs(this,C._parsed)}configure(){const t=this.chart.config,C=t.datasetScopeKeys(this._type),O=t.getOptionScopes(this.getDataset(),C,!0);this.options=t.createResolver(O,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,C){const{_cachedMeta:O,_data:A}=this,{iScale:T,_stacked:L}=O,E=T.axis;let R,I,F,z=0===t&&C===A.length||O._sorted,ot=t>0&&O._parsed[t-1];if(!1===this._parsing)O._parsed=A,O._sorted=!0,F=A;else{F=n(A[t])?this.parseArrayData(O,A,t,C):o(A[t])?this.parseObjectData(O,A,t,C):this.parsePrimitiveData(O,A,t,C);const a=()=>null===I[E]||ot&&I[E]<ot[E];for(R=0;R<C;++R)O._parsed[R+t]=I=F[R],z&&(a()&&(z=!1),ot=I);O._sorted=z}L&&zs(this,F)}parsePrimitiveData(t,C,O,A){const{iScale:T,vScale:L}=t,E=T.axis,R=L.axis,I=T.getLabels(),F=T===L,z=new Array(A);let ot,ht,bt;for(ot=0,ht=A;ot<ht;++ot)bt=ot+O,z[ot]={[E]:F||T.parse(I[bt],bt),[R]:L.parse(C[bt],bt)};return z}parseArrayData(t,C,O,A){const{xScale:T,yScale:L}=t,E=new Array(A);let R,I,F,z;for(R=0,I=A;R<I;++R)F=R+O,z=C[F],E[R]={x:T.parse(z[0],F),y:L.parse(z[1],F)};return E}parseObjectData(t,C,O,A){const{xScale:T,yScale:L}=t,{xAxisKey:E="x",yAxisKey:R="y"}=this._parsing,I=new Array(A);let F,z,ot,ht;for(F=0,z=A;F<z;++F)ot=F+O,ht=C[ot],I[F]={x:T.parse(M(ht,E),ot),y:L.parse(M(ht,R),ot)};return I}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,C,O){const A=this.chart,T=this._cachedMeta,L=C[t.axis];return Ls({keys:Ts(A,!0),values:C._stacks[t.axis]._visualValues},L,T.index,{mode:O})}updateRangeFromParsed(t,C,O,A){const T=O[C.axis];let L=null===T?NaN:T;const E=A&&O._stacks[C.axis];A&&E&&(A.values=E,L=Ls(A,T,this._cachedMeta.index)),t.min=Math.min(t.min,L),t.max=Math.max(t.max,L)}getMinMax(t,C){const O=this._cachedMeta,A=O._parsed,T=O._sorted&&t===O.iScale,L=A.length,E=this._getOtherScale(t),R=((t,C,O)=>t&&!C.hidden&&C._stacked&&{keys:Ts(O,!0),values:null})(C,O,this.chart),I={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:F,max:z}=function(t){const{min:C,max:O,minDefined:A,maxDefined:T}=t.getUserBounds();return{min:A?C:Number.NEGATIVE_INFINITY,max:T?O:Number.POSITIVE_INFINITY}}(E);let ot,ht;function g(){ht=A[ot];const C=ht[E.axis];return!a(ht[t.axis])||F>C||z<C}for(ot=0;ot<L&&(g()||(this.updateRangeFromParsed(I,t,ht,R),!T));++ot);if(T)for(ot=L-1;ot>=0;--ot)if(!g()){this.updateRangeFromParsed(I,t,ht,R);break}return I}getAllParsedValues(t){const C=this._cachedMeta._parsed,O=[];let A,T,L;for(A=0,T=C.length;A<T;++A)L=C[A][t.axis],a(L)&&O.push(L);return O}getMaxOverflow(){return!1}getLabelAndValue(t){const C=this._cachedMeta,O=C.iScale,A=C.vScale,T=this.getParsed(t);return{label:O?""+O.getLabelForValue(T[O.axis]):"",value:A?""+A.getLabelForValue(T[A.axis]):""}}_update(t){const C=this._cachedMeta;this.update(t||"default"),C._clip=function(t){let C,O,A,T;return o(t)?(C=t.top,O=t.right,A=t.bottom,T=t.left):C=O=A=T=t,{top:C,right:O,bottom:A,left:T,disabled:!1===t}}(l(this.options.clip,function(t,C,O){if(!1===O)return!1;const A=As(t,O),T=As(C,O);return{top:T.end,right:A.end,bottom:T.start,left:A.start}}(C.xScale,C.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,C=this.chart,O=this._cachedMeta,A=O.data||[],T=C.chartArea,L=[],E=this._drawStart||0,R=this._drawCount||A.length-E,I=this.options.drawActiveElementsOnTop;let F;for(O.dataset&&O.dataset.draw(t,T,E,R),F=E;F<E+R;++F){const C=A[F];C.hidden||(C.active&&I?L.push(C):C.draw(t,T))}for(F=0;F<L.length;++F)L[F].draw(t,T)}getStyle(t,C){const O=C?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(O):this.resolveDataElementOptions(t||0,O)}getContext(t,C,O){const A=this.getDataset();let T;if(t>=0&&t<this._cachedMeta.data.length){const C=this._cachedMeta.data[t];T=C.$context||(C.$context=function(t,C,O){return Ci(t,{active:!1,dataIndex:C,parsed:void 0,raw:void 0,element:O,index:C,mode:"default",type:"data"})}(this.getContext(),t,C)),T.parsed=this.getParsed(t),T.raw=A.data[t],T.index=T.dataIndex=t}else T=this.$context||(this.$context=function(t,C){return Ci(t,{active:!1,dataset:void 0,datasetIndex:C,index:C,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),T.dataset=A,T.index=T.datasetIndex=this.index;return T.active=!!C,T.mode=O,T}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,C){return this._resolveElementOptions(this.dataElementType.id,C,t)}_resolveElementOptions(t,C="default",O){const A="active"===C,T=this._cachedDataOpts,L=t+"-"+C,E=T[L],R=this.enableOptionSharing&&k(O);if(E)return Ws(E,R);const I=this.chart.config,F=I.datasetElementScopeKeys(this._type,t),z=A?[`${t}Hover`,"hover",t,""]:[t,""],ot=I.getOptionScopes(this.getDataset(),F),ht=Object.keys(Se.elements[t]),bt=I.resolveNamedOptions(ot,ht,()=>this.getContext(O,A,C),z);return bt.$shared&&(bt.$shared=R,T[L]=Object.freeze(Ws(bt,R))),bt}_resolveAnimations(t,C,O){const A=this.chart,T=this._cachedDataOpts,L=`animation-${C}`,E=T[L];if(E)return E;let R;if(!1!==A.options.animation){const A=this.chart.config,T=A.datasetAnimationScopeKeys(this._type,C),L=A.getOptionScopes(this.getDataset(),T);R=A.createResolver(L,this.getContext(t,O,C))}const I=new Os(A,R&&R.animations);return R&&R._cacheable&&(T[L]=Object.freeze(I)),I}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,C){return!C||Bs(t)||this.chart._animationsDisabled}_getSharedOptions(t,C){const O=this.resolveDataElementOptions(t,C),A=this._sharedOptions,T=this.getSharedOptions(O),L=this.includeOptions(C,T)||T!==A;return this.updateSharedOptions(T,C,O),{sharedOptions:T,includeOptions:L}}updateElement(t,C,O,A){Bs(A)?Object.assign(t,O):this._resolveAnimations(C,A).update(t,O)}updateSharedOptions(t,C,O){t&&!Bs(C)&&this._resolveAnimations(void 0,C).update(t,O)}_setStyle(t,C,O,A){t.active=A;const T=this.getStyle(C,A);this._resolveAnimations(C,O,A).update(t,{options:!A&&this.getSharedOptions(T)||T})}removeHoverStyle(t,C,O){this._setStyle(t,O,"active",!1)}setHoverStyle(t,C,O){this._setStyle(t,O,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const C=this._data,O=this._cachedMeta.data;for(const[t,C,O]of this._syncList)this[t](C,O);this._syncList=[];const A=O.length,T=C.length,L=Math.min(T,A);L&&this.parse(0,L),T>A?this._insertElements(A,T-A,t):T<A&&this._removeElements(T,A-T)}_insertElements(t,C,O=!0){const A=this._cachedMeta,T=A.data,L=t+C;let E;const r=t=>{for(t.length+=C,E=t.length-1;E>=L;E--)t[E]=t[E-C]};for(r(T),E=t;E<L;++E)T[E]=new this.dataElementType;this._parsing&&r(A._parsed),this.parse(t,C),O&&this.updateElements(T,t,C,"reset")}updateElements(t,C,O,A){}_removeElements(t,C){const O=this._cachedMeta;if(this._parsing){const A=O._parsed.splice(t,C);O._stacked&&Vs(O,A)}O.data.splice(t,C)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[C,O,A]=t;this[C](O,A)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,C){C&&this._sync(["_removeElements",t,C]);const O=arguments.length-2;O&&this._sync(["_insertElements",t,O])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class Hs{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:C,y:O}=this.getProps(["x","y"],t);return{x:C,y:O}}hasValue(){return N(this.x)&&N(this.y)}getProps(t,C){const O=this.$animations;if(!C||!O)return this;const A={};return t.forEach(t=>{A[t]=O[t]&&O[t].active()?O[t]._to:this[t]}),A}}function js(t,C){const O=t.options.ticks,A=function(t){const C=t.options.offset,O=t._tickSize(),A=t._length/O+(C?0:1),T=t._maxLength/O;return Math.floor(Math.min(A,T))}(t),T=Math.min(O.maxTicksLimit||A,A),L=O.major.enabled?function(t){const C=[];let O,A;for(O=0,A=t.length;O<A;O++)t[O].major&&C.push(O);return C}(C):[],E=L.length,R=L[0],I=L[E-1],F=[];if(E>T)return function(t,C,O,A){let T,L=0,E=O[0];for(A=Math.ceil(A),T=0;T<t.length;T++)T===E&&(C.push(t[T]),L++,E=O[L*A])}(C,F,L,E/T),F;const z=function(t,C,O){const A=function(t){const C=t.length;let O,A;if(C<2)return!1;for(A=t[0],O=1;O<C;++O)if(t[O]-t[O-1]!==A)return!1;return A}(t),T=C.length/O;if(!A)return Math.max(T,1);const L=W(A);for(let t=0,C=L.length-1;t<C;t++){const C=L[t];if(C>T)return C}return Math.max(T,1)}(L,C,T);if(E>0){let t,O;const A=E>1?Math.round((I-R)/(E-1)):null;for($s(C,F,z,s(A)?0:R-A,R),t=0,O=E-1;t<O;t++)$s(C,F,z,L[t],L[t+1]);return $s(C,F,z,I,s(A)?C.length:I+A),F}return $s(C,F,z),F}function $s(t,C,O,A,T){const L=l(A,0),E=Math.min(l(T,t.length),t.length);let R,I,F,z=0;for(O=Math.ceil(O),T&&(R=T-A,O=R/Math.floor(R/O)),F=L;F<0;)z++,F=Math.round(L+z*O);for(I=Math.max(L,0);I<E;I++)I===F&&(C.push(t[I]),z++,F=Math.round(L+z*O))}const Ys=(t,C,O)=>"top"===C||"left"===C?t[C]+O:t[C]-O,Us=(t,C)=>Math.min(C||t,t);function Xs(t,C){const O=[],A=t.length/C,T=t.length;let L=0;for(;L<T;L+=A)O.push(t[Math.floor(L)]);return O}function qs(t,C,O){const A=t.ticks.length,T=Math.min(C,A-1),L=t._startPixel,E=t._endPixel,R=1e-6;let I,F=t.getPixelForTick(T);if(!(O&&(I=1===A?Math.max(F-L,E-F):0===C?(t.getPixelForTick(1)-F)/2:(F-t.getPixelForTick(T-1))/2,F+=T<C?I:-I,F<L-R||F>E+R)))return F}function Ks(t){return t.drawTicks?t.tickLength:0}function Gs(t,C){if(!t.display)return 0;const O=Si(t.font,C),A=ki(t.padding);return(n(t.text)?t.text.length:1)*O.lineHeight+A.height}function Zs(t,C,O){let A=ut(t);return(O&&"right"!==C||!O&&"right"===C)&&(A=(t=>"left"===t?"right":"right"===t?"left":t)(A)),A}class Js extends Hs{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,C){return t}getUserBounds(){let{_userMin:t,_userMax:C,_suggestedMin:O,_suggestedMax:A}=this;return t=r(t,Number.POSITIVE_INFINITY),C=r(C,Number.NEGATIVE_INFINITY),O=r(O,Number.POSITIVE_INFINITY),A=r(A,Number.NEGATIVE_INFINITY),{min:r(t,O),max:r(C,A),minDefined:a(t),maxDefined:a(C)}}getMinMax(t){let C,{min:O,max:A,minDefined:T,maxDefined:L}=this.getUserBounds();if(T&&L)return{min:O,max:A};const E=this.getMatchingVisibleMetas();for(let R=0,I=E.length;R<I;++R)C=E[R].controller.getMinMax(this,t),T||(O=Math.min(O,C.min)),L||(A=Math.max(A,C.max));return O=L&&O>A?A:O,A=T&&O>A?O:A,{min:r(O,r(A,O)),max:r(A,r(O,A))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){d(this.options.beforeUpdate,[this])}update(t,C,O){const{beginAtZero:A,grace:T,ticks:L}=this.options,E=L.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=C,this._margins=O=Object.assign({left:0,right:0,top:0,bottom:0},O),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+O.left+O.right:this.height+O.top+O.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Di(this,T,A),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const R=E<this.ticks.length;this._convertTicksToLabels(R?Xs(this.ticks,E):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),L.display&&(L.autoSkip||"auto"===L.source)&&(this.ticks=js(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),R&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,C,O=this.options.reverse;this.isHorizontal()?(t=this.left,C=this.right):(t=this.top,C=this.bottom,O=!O),this._startPixel=t,this._endPixel=C,this._reversePixels=O,this._length=C-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){d(this.options.afterUpdate,[this])}beforeSetDimensions(){d(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){d(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),d(this.options[t],[this])}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 C=this.options.ticks;let O,A,T;for(O=0,A=t.length;O<A;O++)T=t[O],T.label=d(C.callback,[T.value,O,t],this)}afterTickToLabelConversion(){d(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){d(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,C=t.ticks,O=Us(this.ticks.length,t.ticks.maxTicksLimit),A=C.minRotation||0,T=C.maxRotation;let L,E,R,I=A;if(!this._isVisible()||!C.display||A>=T||O<=1||!this.isHorizontal())return void(this.labelRotation=A);const F=this._getLabelSizes(),z=F.widest.width,ot=F.highest.height,ht=J(this.chart.width-z,0,this.maxWidth);L=t.offset?this.maxWidth/O:ht/(O-1),z+6>L&&(L=ht/(O-(t.offset?.5:1)),E=this.maxHeight-Ks(t.grid)-C.padding-Gs(t.title,this.chart.options.font),R=Math.sqrt(z*z+ot*ot),I=Y(Math.min(Math.asin(J((F.highest.height+6)/L,-1,1)),Math.asin(J(E/R,-1,1))-Math.asin(J(ot/R,-1,1)))),I=Math.max(A,Math.min(T,I))),this.labelRotation=I}afterCalculateLabelRotation(){d(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){d(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:C,options:{ticks:O,title:A,grid:T}}=this,L=this._isVisible(),E=this.isHorizontal();if(L){const L=Gs(A,C.options.font);if(E?(t.width=this.maxWidth,t.height=Ks(T)+L):(t.height=this.maxHeight,t.width=Ks(T)+L),O.display&&this.ticks.length){const{first:C,last:A,widest:T,highest:L}=this._getLabelSizes(),R=2*O.padding,I=$(this.labelRotation),F=Math.cos(I),z=Math.sin(I);if(E){const C=O.mirror?0:z*T.width+F*L.height;t.height=Math.min(this.maxHeight,t.height+C+R)}else{const C=O.mirror?0:F*T.width+z*L.height;t.width=Math.min(this.maxWidth,t.width+C+R)}this._calculatePadding(C,A,z,F)}}this._handleMargins(),E?(this.width=this._length=C.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=C.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,C,O,A){const{ticks:{align:T,padding:L},position:E}=this.options,R=0!==this.labelRotation,I="top"!==E&&"x"===this.axis;if(this.isHorizontal()){const E=this.getPixelForTick(0)-this.left,F=this.right-this.getPixelForTick(this.ticks.length-1);let z=0,ot=0;R?I?(z=A*t.width,ot=O*C.height):(z=O*t.height,ot=A*C.width):"start"===T?ot=C.width:"end"===T?z=t.width:"inner"!==T&&(z=t.width/2,ot=C.width/2),this.paddingLeft=Math.max((z-E+L)*this.width/(this.width-E),0),this.paddingRight=Math.max((ot-F+L)*this.width/(this.width-F),0)}else{let O=C.height/2,A=t.height/2;"start"===T?(O=0,A=t.height):"end"===T&&(O=C.height,A=0),this.paddingTop=O+L,this.paddingBottom=A+L}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){d(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:C}=this.options;return"top"===C||"bottom"===C||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let C,O;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),C=0,O=t.length;C<O;C++)s(t[C].label)&&(t.splice(C,1),O--,C--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const C=this.options.ticks.sampleSize;let O=this.ticks;C<O.length&&(O=Xs(O,C)),this._labelSizes=t=this._computeLabelSizes(O,O.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,C,O){const{ctx:A,_longestTextCache:T}=this,L=[],E=[],R=Math.floor(C/Us(C,O));let I,F,z,ot,ht,bt,St,Pt,Tt,Nt,Ht,Wt=0,$t=0;for(I=0;I<C;I+=R){if(ot=t[I].label,ht=this._resolveTickFontOptions(I),A.font=bt=ht.string,St=T[bt]=T[bt]||{data:{},gc:[]},Pt=ht.lineHeight,Tt=Nt=0,s(ot)||n(ot)){if(n(ot))for(F=0,z=ot.length;F<z;++F)Ht=ot[F],s(Ht)||n(Ht)||(Tt=Ce(A,St.data,St.gc,Tt,Ht),Nt+=Pt)}else Tt=Ce(A,St.data,St.gc,Tt,ot),Nt=Pt;L.push(Tt),E.push(Nt),Wt=Math.max(Tt,Wt),$t=Math.max(Nt,$t)}!function(t,C){u(t,t=>{const O=t.gc,A=O.length/2;let T;if(A>C){for(T=0;T<A;++T)delete t.data[O[T]];O.splice(0,A)}})}(T,C);const ee=L.indexOf(Wt),ie=E.indexOf($t),P=t=>({width:L[t]||0,height:E[t]||0});return{first:P(0),last:P(C-1),widest:P(ee),highest:P(ie),widths:L,heights:E}}getLabelForValue(t){return t}getPixelForValue(t,C){return NaN}getValueForPixel(t){}getPixelForTick(t){const C=this.ticks;return t<0||t>C.length-1?null:this.getPixelForValue(C[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const C=this._startPixel+t*this._length;return Q(this._alignToPixels?Ae(this.chart,C,0):C)}getDecimalForPixel(t){const C=(t-this._startPixel)/this._length;return this._reversePixels?1-C:C}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:C}=this;return t<0&&C<0?C:t>0&&C>0?t:0}getContext(t){const C=this.ticks||[];if(t>=0&&t<C.length){const O=C[t];return O.$context||(O.$context=function(t,C,O){return Ci(t,{tick:O,index:C,type:"tick"})}(this.getContext(),t,O))}return this.$context||(this.$context=Ci(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,C=$(this.labelRotation),O=Math.abs(Math.cos(C)),A=Math.abs(Math.sin(C)),T=this._getLabelSizes(),L=t.autoSkipPadding||0,E=T?T.widest.width+L:0,R=T?T.highest.height+L:0;return this.isHorizontal()?R*O>E*A?E/O:R/A:R*A<E*O?R/O:E/A}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const C=this.axis,O=this.chart,A=this.options,{grid:T,position:L,border:E}=A,R=T.offset,I=this.isHorizontal(),F=this.ticks.length+(R?1:0),z=Ks(T),ot=[],ht=E.setContext(this.getContext()),bt=ht.display?ht.width:0,St=bt/2,x=function(t){return Ae(O,t,bt)};let Pt,Tt,Nt,Ht,Wt,$t,ee,ie,se,oe,ae,re;if("top"===L)Pt=x(this.bottom),$t=this.bottom-z,ie=Pt-St,oe=x(t.top)+St,re=t.bottom;else if("bottom"===L)Pt=x(this.top),oe=t.top,re=x(t.bottom)-St,$t=Pt+St,ie=this.top+z;else if("left"===L)Pt=x(this.right),Wt=this.right-z,ee=Pt-St,se=x(t.left)+St,ae=t.right;else if("right"===L)Pt=x(this.left),se=t.left,ae=x(t.right)-St,Wt=Pt+St,ee=this.left+z;else if("x"===C){if("center"===L)Pt=x((t.top+t.bottom)/2+.5);else if(o(L)){const t=Object.keys(L)[0],C=L[t];Pt=x(this.chart.scales[t].getPixelForValue(C))}oe=t.top,re=t.bottom,$t=Pt+St,ie=$t+z}else if("y"===C){if("center"===L)Pt=x((t.left+t.right)/2);else if(o(L)){const t=Object.keys(L)[0],C=L[t];Pt=x(this.chart.scales[t].getPixelForValue(C))}Wt=Pt-St,ee=Wt-z,se=t.left,ae=t.right}const le=l(A.ticks.maxTicksLimit,F),ue=Math.max(1,Math.ceil(F/le));for(Tt=0;Tt<F;Tt+=ue){const t=this.getContext(Tt),C=T.setContext(t),A=E.setContext(t),L=C.lineWidth,F=C.color,z=A.dash||[],ht=A.dashOffset,bt=C.tickWidth,St=C.tickColor,Pt=C.tickBorderDash||[],le=C.tickBorderDashOffset;Nt=qs(this,Tt,R),void 0!==Nt&&(Ht=Ae(O,Nt,L),I?Wt=ee=se=ae=Ht:$t=ie=oe=re=Ht,ot.push({tx1:Wt,ty1:$t,tx2:ee,ty2:ie,x1:se,y1:oe,x2:ae,y2:re,width:L,color:F,borderDash:z,borderDashOffset:ht,tickWidth:bt,tickColor:St,tickBorderDash:Pt,tickBorderDashOffset:le}))}return this._ticksLength=F,this._borderValue=Pt,ot}_computeLabelItems(t){const C=this.axis,O=this.options,{position:A,ticks:T}=O,L=this.isHorizontal(),E=this.ticks,{align:R,crossAlign:I,padding:F,mirror:z}=T,ot=Ks(O.grid),ht=ot+F,bt=z?-F:ht,St=-$(this.labelRotation),Pt=[];let Tt,Nt,Ht,Wt,$t,ee,ie,se,oe,ae,re,le,ue="middle";if("top"===A)ee=this.bottom-bt,ie=this._getXAxisLabelAlignment();else if("bottom"===A)ee=this.top+bt,ie=this._getXAxisLabelAlignment();else if("left"===A){const t=this._getYAxisLabelAlignment(ot);ie=t.textAlign,$t=t.x}else if("right"===A){const t=this._getYAxisLabelAlignment(ot);ie=t.textAlign,$t=t.x}else if("x"===C){if("center"===A)ee=(t.top+t.bottom)/2+ht;else if(o(A)){const t=Object.keys(A)[0],C=A[t];ee=this.chart.scales[t].getPixelForValue(C)+ht}ie=this._getXAxisLabelAlignment()}else if("y"===C){if("center"===A)$t=(t.left+t.right)/2-ht;else if(o(A)){const t=Object.keys(A)[0],C=A[t];$t=this.chart.scales[t].getPixelForValue(C)}ie=this._getYAxisLabelAlignment(ot).textAlign}"y"===C&&("start"===R?ue="top":"end"===R&&(ue="bottom"));const be=this._getLabelSizes();for(Tt=0,Nt=E.length;Tt<Nt;++Tt){Ht=E[Tt],Wt=Ht.label;const t=T.setContext(this.getContext(Tt));se=this.getPixelForTick(Tt)+T.labelOffset,oe=this._resolveTickFontOptions(Tt),ae=oe.lineHeight,re=n(Wt)?Wt.length:1;const C=re/2,O=t.color,R=t.textStrokeColor,F=t.textStrokeWidth;let ot,ht=ie;if(L?($t=se,"inner"===ie&&(ht=Tt===Nt-1?this.options.reverse?"left":"right":0===Tt?this.options.reverse?"right":"left":"center"),le="top"===A?"near"===I||0!==St?-re*ae+ae/2:"center"===I?-be.highest.height/2-C*ae+ae:-be.highest.height+ae/2:"near"===I||0!==St?ae/2:"center"===I?be.highest.height/2-C*ae:be.highest.height-re*ae,z&&(le*=-1),0===St||t.showLabelBackdrop||($t+=ae/2*Math.sin(St))):(ee=se,le=(1-re)*ae/2),t.showLabelBackdrop){const C=ki(t.backdropPadding),O=be.heights[Tt],A=be.widths[Tt];let T=le-C.top,L=0-C.left;switch(ue){case"middle":T-=O/2;break;case"bottom":T-=O}switch(ie){case"center":L-=A/2;break;case"right":L-=A;break;case"inner":Tt===Nt-1?L-=A:Tt>0&&(L-=A/2)}ot={left:L,top:T,width:A+C.width,height:O+C.height,color:t.backdropColor}}Pt.push({label:Wt,font:oe,textOffset:le,options:{rotation:St,color:O,strokeColor:R,strokeWidth:F,textAlign:ht,textBaseline:ue,translation:[$t,ee],backdrop:ot}})}return Pt}_getXAxisLabelAlignment(){const{position:t,ticks:C}=this.options;if(-$(this.labelRotation))return"top"===t?"left":"right";let O="center";return"start"===C.align?O="left":"end"===C.align?O="right":"inner"===C.align&&(O="inner"),O}_getYAxisLabelAlignment(t){const{position:C,ticks:{crossAlign:O,mirror:A,padding:T}}=this.options,L=t+T,E=this._getLabelSizes().widest.width;let R,I;return"left"===C?A?(I=this.right+T,"near"===O?R="left":"center"===O?(R="center",I+=E/2):(R="right",I+=E)):(I=this.right-L,"near"===O?R="right":"center"===O?(R="center",I-=E/2):(R="left",I=this.left)):"right"===C?A?(I=this.left+T,"near"===O?R="right":"center"===O?(R="center",I-=E/2):(R="left",I-=E)):(I=this.left+L,"near"===O?R="left":"center"===O?(R="center",I+=E/2):(R="right",I=this.right)):R="right",{textAlign:R,x:I}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,C=this.options.position;return"left"===C||"right"===C?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===C||"bottom"===C?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:C},left:O,top:A,width:T,height:L}=this;C&&(t.save(),t.fillStyle=C,t.fillRect(O,A,T,L),t.restore())}getLineWidthForValue(t){const C=this.options.grid;if(!this._isVisible()||!C.display)return 0;const O=this.ticks.findIndex(C=>C.value===t);return O>=0?C.setContext(this.getContext(O)).lineWidth:0}drawGrid(t){const C=this.options.grid,O=this.ctx,A=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let T,L;const a=(t,C,A)=>{A.width&&A.color&&(O.save(),O.lineWidth=A.width,O.strokeStyle=A.color,O.setLineDash(A.borderDash||[]),O.lineDashOffset=A.borderDashOffset,O.beginPath(),O.moveTo(t.x,t.y),O.lineTo(C.x,C.y),O.stroke(),O.restore())};if(C.display)for(T=0,L=A.length;T<L;++T){const t=A[T];C.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),C.drawTicks&&a({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:C,options:{border:O,grid:A}}=this,T=O.setContext(this.getContext()),L=O.display?T.width:0;if(!L)return;const E=A.setContext(this.getContext(0)).lineWidth,R=this._borderValue;let I,F,z,ot;this.isHorizontal()?(I=Ae(t,this.left,L)-L/2,F=Ae(t,this.right,E)+E/2,z=ot=R):(z=Ae(t,this.top,L)-L/2,ot=Ae(t,this.bottom,E)+E/2,I=F=R),C.save(),C.lineWidth=T.width,C.strokeStyle=T.color,C.beginPath(),C.moveTo(I,z),C.lineTo(F,ot),C.stroke(),C.restore()}drawLabels(t){if(!this.options.ticks.display)return;const C=this.ctx,O=this._computeLabelArea();O&&Ie(C,O);const A=this.getLabelItems(t);for(const t of A){const O=t.options,A=t.font;Ne(C,t.label,0,t.textOffset,A,O)}O&&ze(C)}drawTitle(){const{ctx:t,options:{position:C,title:O,reverse:A}}=this;if(!O.display)return;const T=Si(O.font),L=ki(O.padding),E=O.align;let R=T.lineHeight/2;"bottom"===C||"center"===C||o(C)?(R+=L.bottom,n(O.text)&&(R+=T.lineHeight*(O.text.length-1))):R+=L.top;const{titleX:F,titleY:z,maxWidth:ot,rotation:ht}=function(t,C,O,A){const{top:T,left:L,bottom:E,right:R,chart:F}=t,{chartArea:z,scales:ot}=F;let ht,bt,St,Pt=0;const Tt=E-T,Nt=R-L;if(t.isHorizontal()){if(bt=ft(A,L,R),o(O)){const t=Object.keys(O)[0],A=O[t];St=ot[t].getPixelForValue(A)+Tt-C}else St="center"===O?(z.bottom+z.top)/2+Tt-C:Ys(t,O,C);ht=R-L}else{if(o(O)){const t=Object.keys(O)[0],A=O[t];bt=ot[t].getPixelForValue(A)-Nt+C}else bt="center"===O?(z.left+z.right)/2-Nt+C:Ys(t,O,C);St=ft(A,E,T),Pt="left"===O?-I:I}return{titleX:bt,titleY:St,maxWidth:ht,rotation:Pt}}(this,R,C,E);Ne(t,O.text,0,0,T,{color:O.color,maxWidth:ot,rotation:ht,textAlign:Zs(E,C,A),textBaseline:"middle",translation:[F,z]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,C=t.ticks&&t.ticks.z||0,O=l(t.grid&&t.grid.z,-1),A=l(t.border&&t.border.z,0);return this._isVisible()&&this.draw===Js.prototype.draw?[{z:O,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:A,draw:()=>{this.drawBorder()}},{z:C,draw:t=>{this.drawLabels(t)}}]:[{z:C,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const C=this.chart.getSortedVisibleDatasetMetas(),O=this.axis+"AxisID",A=[];let T,L;for(T=0,L=C.length;T<L;++T){const L=C[T];L[O]!==this.id||t&&L.type!==t||A.push(L)}return A}_resolveTickFontOptions(t){return Si(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Qs{constructor(t,C,O){this.type=t,this.scope=C,this.override=O,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const C=Object.getPrototypeOf(t);let O;(function(t){return"id"in t&&"defaults"in t})(C)&&(O=this.register(C));const A=this.items,T=t.id,L=this.scope+"."+T;if(!T)throw new Error("class does not have id: "+t);return T in A||(A[T]=t,function(t,C,O){const A=x(Object.create(null),[O?Se.get(O):{},Se.get(C),t.defaults]);Se.set(C,A),t.defaultRoutes&&function(t,C){Object.keys(C).forEach(O=>{const A=O.split("."),T=A.pop(),L=[t].concat(A).join("."),E=C[O].split("."),R=E.pop(),I=E.join(".");Se.route(L,T,I,R)})}(C,t.defaultRoutes),t.descriptors&&Se.describe(C,t.descriptors)}(t,L,O),this.override&&Se.override(t.id,t.overrides)),L}get(t){return this.items[t]}unregister(t){const C=this.items,O=t.id,A=this.scope;O in C&&delete C[O],A&&O in Se[A]&&(delete Se[A][O],this.override&&delete ue[O])}}class tn{constructor(){this.controllers=new Qs(Ns,"datasets",!0),this.elements=new Qs(Hs,"elements"),this.plugins=new Qs(Object,"plugins"),this.scales=new Qs(Js,"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,C,O){[...C].forEach(C=>{const A=O||this._getRegistryForType(C);O||A.isForType(C)||A===this.plugins&&C.id?this._exec(t,A,C):u(C,C=>{const A=O||this._getRegistryForType(C);this._exec(t,A,C)})})}_exec(t,C,O){const A=w(t);d(O["before"+A],[],O),C[t](O),d(O["after"+A],[],O)}_getRegistryForType(t){for(let C=0;C<this._typedRegistries.length;C++){const O=this._typedRegistries[C];if(O.isForType(t))return O}return this.plugins}_get(t,C,O){const A=C.get(t);if(void 0===A)throw new Error('"'+t+'" is not a registered '+O+".");return A}}var gn=new tn;class sn{constructor(){this._init=[]}notify(t,C,O,A){"beforeInit"===C&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const T=A?this._descriptors(t).filter(A):this._descriptors(t),L=this._notify(T,t,C,O);return"afterDestroy"===C&&(this._notify(T,t,"stop"),this._notify(this._init,t,"uninstall")),L}_notify(t,C,O,A){A=A||{};for(const T of t){const t=T.plugin;if(!1===d(t[O],[C,A,T.options],t)&&A.cancelable)return!1}return!0}invalidate(){s(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const C=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),C}_createDescriptors(t,C){const O=t&&t.config,A=l(O.options&&O.options.plugins,{}),T=function(t){const C={},O=[],A=Object.keys(gn.plugins.items);for(let t=0;t<A.length;t++)O.push(gn.getPlugin(A[t]));const T=t.plugins||[];for(let t=0;t<T.length;t++){const A=T[t];-1===O.indexOf(A)&&(O.push(A),C[A.id]=!0)}return{plugins:O,localIds:C}}(O);return!1!==A||C?function(t,{plugins:C,localIds:O},A,T){const L=[],E=t.getContext();for(const R of C){const C=R.id,I=nn(A[C],T);null!==I&&L.push({plugin:R,options:on(t.config,{plugin:R,local:O[C]},I,E)})}return L}(t,T,A,C):[]}_notifyStateChanges(t){const C=this._oldCache||[],O=this._cache,s=(t,C)=>t.filter(t=>!C.some(C=>t.plugin.id===C.plugin.id));this._notify(s(C,O),t,"stop"),this._notify(s(O,C),t,"start")}}function nn(t,C){return C||!1!==t?!0===t?{}:t:null}function on(t,{plugin:C,local:O},A,T){const L=t.pluginScopeKeys(C),E=t.getOptionScopes(A,L);return O&&C.defaults&&E.push(C.defaults),t.createResolver(E,T,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function an(t,C){const O=Se.datasets[t]||{};return((C.datasets||{})[t]||{}).indexAxis||C.indexAxis||O.indexAxis||"x"}function rn(t){if("x"===t||"y"===t||"r"===t)return t}function ln(t,...C){if(rn(t))return t;for(const A of C){const C=A.axis||("top"===(O=A.position)||"bottom"===O?"x":"left"===O||"right"===O?"y":void 0)||t.length>1&&rn(t[0].toLowerCase());if(C)return C}var O;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function hn(t,C,O){if(O[C+"AxisID"]===t)return{axis:C}}function cn(t,C){const O=ue[t.type]||{scales:{}},A=C.scales||{},T=an(t.type,C),L=Object.create(null);return Object.keys(A).forEach(C=>{const E=A[C];if(!o(E))return console.error(`Invalid scale configuration for scale: ${C}`);if(E._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${C}`);const R=ln(C,E,function(t,C){if(C.data&&C.data.datasets){const O=C.data.datasets.filter(C=>C.xAxisID===t||C.yAxisID===t);if(O.length)return hn(t,"x",O[0])||hn(t,"y",O[0])}return{}}(C,t),Se.scales[E.type]),I=function(t,C){return t===C?"_index_":"_value_"}(R,T),F=O.scales||{};L[C]=b(Object.create(null),[{axis:R},E,F[R],F[I]])}),t.data.datasets.forEach(O=>{const T=O.type||t.type,E=O.indexAxis||an(T,C),R=(ue[T]||{}).scales||{};Object.keys(R).forEach(t=>{const C=function(t,C){let O=t;return"_index_"===t?O=C:"_value_"===t&&(O="x"===C?"y":"x"),O}(t,E),T=O[C+"AxisID"]||C;L[T]=L[T]||Object.create(null),b(L[T],[{axis:C},A[T],R[t]])})}),Object.keys(L).forEach(t=>{const C=L[t];b(C,[Se.scales[C.type],Se.scale])}),L}function dn(t){const C=t.options||(t.options={});C.plugins=l(C.plugins,{}),C.scales=cn(t,C)}function un(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const yn=new Map,Pn=new Set;function pn(t,C){let O=yn.get(t);return O||(O=C(),yn.set(t,O),Pn.add(O)),O}const mn=(t,C,O)=>{const A=M(C,O);void 0!==A&&t.add(A)};class xn{constructor(t){this._config=function(t){return(t=t||{}).data=un(t.data),dn(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=un(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),dn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return pn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,C){return pn(`${t}.transition.${C}`,()=>[[`datasets.${t}.transitions.${C}`,`transitions.${C}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,C){return pn(`${t}-${C}`,()=>[[`datasets.${t}.elements.${C}`,`datasets.${t}`,`elements.${C}`,""]])}pluginScopeKeys(t){const C=t.id;return pn(`${this.type}-plugin-${C}`,()=>[[`plugins.${C}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,C){const O=this._scopeCache;let A=O.get(t);return A&&!C||(A=new Map,O.set(t,A)),A}getOptionScopes(t,C,O){const{options:A,type:T}=this,L=this._cachedScopes(t,O),E=L.get(C);if(E)return E;const R=new Set;C.forEach(C=>{t&&(R.add(t),C.forEach(C=>mn(R,t,C))),C.forEach(t=>mn(R,A,t)),C.forEach(t=>mn(R,ue[T]||{},t)),C.forEach(t=>mn(R,Se,t)),C.forEach(t=>mn(R,be,t))});const I=Array.from(R);return 0===I.length&&I.push(Object.create(null)),Pn.has(C)&&L.set(C,I),I}chartOptionScopes(){const{options:t,type:C}=this;return[t,ue[C]||{},Se.datasets[C]||{},{type:C},Se,be]}resolveNamedOptions(t,C,O,A=[""]){const T={$shared:!0},{resolver:L,subPrefixes:E}=bn(this._resolverCache,t,A);let R=L;(function(t,C){const{isScriptable:O,isIndexable:A}=Ye(t);for(const T of C){const C=O(T),L=A(T),E=(L||C)&&t[T];if(C&&(S(E)||_n(E))||L&&n(E))return!0}return!1})(L,C)&&(T.$shared=!1,R=$e(L,O=S(O)?O():O,this.createResolver(t,O,E)));for(const t of C)T[t]=R[t];return T}createResolver(t,C,O=[""],A){const{resolver:T}=bn(this._resolverCache,t,O);return o(C)?$e(T,C,void 0,A):T}}function bn(t,C,O){let A=t.get(C);A||(A=new Map,t.set(C,A));const T=O.join();let L=A.get(T);return L||(L={resolver:je(C,O),subPrefixes:O.filter(t=>!t.toLowerCase().includes("hover"))},A.set(T,L)),L}const _n=t=>o(t)&&Object.getOwnPropertyNames(t).some(C=>S(t[C])),Rn=["top","bottom","left","right","chartArea"];function vn(t,C){return"top"===t||"bottom"===t||-1===Rn.indexOf(t)&&"x"===C}function Mn(t,C){return function(O,A){return O[t]===A[t]?O[C]-A[C]:O[t]-A[t]}}function wn(t){const C=t.chart,O=C.options.animation;C.notifyPlugins("afterRender"),d(O&&O.onComplete,[t],C)}function kn(t){const C=t.chart,O=C.options.animation;d(O&&O.onProgress,[t],C)}function Sn(t){return fe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Yn={},Dn=t=>{const C=Sn(t);return Object.values(Yn).filter(t=>t.canvas===C).pop()};function Cn(t,C,O){const A=Object.keys(t);for(const T of A){const A=+T;if(A>=C){const L=t[T];delete t[T],(O>0||A>C)&&(t[A+O]=L)}}}function On(t,C,O){return t.options.clip?t[O]:C[O]}class An{static defaults=Se;static instances=Yn;static overrides=ue;static registry=gn;static version="4.4.3";static getChart=Dn;static register(...t){gn.add(...t),Tn()}static unregister(...t){gn.remove(...t),Tn()}constructor(t,O){const A=this.config=new xn(O),T=Sn(t),L=Dn(T);if(L)throw new Error("Canvas is already in use. Chart with ID '"+L.id+"' must be destroyed before the canvas with ID '"+L.canvas.id+"' can be reused.");const E=A.createResolver(A.chartOptionScopes(),this.getContext());this.platform=new(A.platform||ks(T)),this.platform.updateConfig(A);const R=this.platform.acquireContext(T,E.aspectRatio),I=R&&R.canvas,F=I&&I.height,z=I&&I.width;this.id=C(),this.ctx=R,this.canvas=I,this.width=z,this.height=F,this._options=E,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new sn,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=dt(t=>this.update(t),E.resizeDelay||0),this._dataChanges=[],Yn[this.id]=this,R&&I?(Pt.listen(this,"complete",wn),Pt.listen(this,"progress",kn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:C},width:O,height:A,_aspectRatio:T}=this;return s(t)?C&&T?T:A?O/A:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return gn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ke(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Te(this.canvas,this.ctx),this}stop(){return Pt.stop(this),this}resize(t,C){Pt.running(this)?this._resizeBeforeDraw={width:t,height:C}:this._resize(t,C)}_resize(t,C){const O=this.options,A=this.canvas,T=O.maintainAspectRatio&&this.aspectRatio,L=this.platform.getMaximumSize(A,t,C,T),E=O.devicePixelRatio||this.platform.getDevicePixelRatio(),R=this.width?"resize":"attach";this.width=L.width,this.height=L.height,this._aspectRatio=this.aspectRatio,ke(this,E,!0)&&(this.notifyPlugins("resize",{size:L}),d(O.onResize,[this,L],this),this.attached&&this._doResize(R)&&this.render())}ensureScalesHaveIDs(){u(this.options.scales||{},(t,C)=>{t.id=C})}buildOrUpdateScales(){const t=this.options,C=t.scales,O=this.scales,A=Object.keys(O).reduce((t,C)=>(t[C]=!1,t),{});let T=[];C&&(T=T.concat(Object.keys(C).map(t=>{const O=C[t],A=ln(t,O),T="r"===A,L="x"===A;return{options:O,dposition:T?"chartArea":L?"bottom":"left",dtype:T?"radialLinear":L?"category":"linear"}}))),u(T,C=>{const T=C.options,L=T.id,E=ln(L,T),R=l(T.type,C.dtype);void 0!==T.position&&vn(T.position,E)===vn(C.dposition)||(T.position=C.dposition),A[L]=!0;let I=null;L in O&&O[L].type===R?I=O[L]:(I=new(gn.getScale(R))({id:L,type:R,ctx:this.ctx,chart:this}),O[I.id]=I),I.init(T,t)}),u(A,(t,C)=>{t||delete O[C]}),u(O,t=>{cs.configure(this,t,t.options),cs.addBox(this,t)})}_updateMetasets(){const t=this._metasets,C=this.data.datasets.length,O=t.length;if(t.sort((t,C)=>t.index-C.index),O>C){for(let t=C;t<O;++t)this._destroyDatasetMeta(t);t.splice(C,O-C)}this._sortedMetasets=t.slice(0).sort(Mn("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:C}}=this;t.length>C.length&&delete this._stacks,t.forEach((t,O)=>{0===C.filter(C=>C===t._dataset).length&&this._destroyDatasetMeta(O)})}buildOrUpdateControllers(){const t=[],C=this.data.datasets;let O,A;for(this._removeUnreferencedMetasets(),O=0,A=C.length;O<A;O++){const A=C[O];let T=this.getDatasetMeta(O);const L=A.type||this.config.type;if(T.type&&T.type!==L&&(this._destroyDatasetMeta(O),T=this.getDatasetMeta(O)),T.type=L,T.indexAxis=A.indexAxis||an(L,this.options),T.order=A.order||0,T.index=O,T.label=""+A.label,T.visible=this.isDatasetVisible(O),T.controller)T.controller.updateIndex(O),T.controller.linkScales();else{const C=gn.getController(L),{datasetElementType:A,dataElementType:E}=Se.datasets[L];Object.assign(C,{dataElementType:gn.getElement(E),datasetElementType:A&&gn.getElement(A)}),T.controller=new C(this,O),t.push(T.controller)}}return this._updateMetasets(),t}_resetElements(){u(this.data.datasets,(t,C)=>{this.getDatasetMeta(C).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const C=this.config;C.update();const O=this._options=C.createResolver(C.chartOptionScopes(),this.getContext()),A=this._animationsDisabled=!O.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const T=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let L=0;for(let t=0,C=this.data.datasets.length;t<C;t++){const{controller:C}=this.getDatasetMeta(t),O=!A&&-1===T.indexOf(C);C.buildOrUpdateElements(O),L=Math.max(+C.getMaxOverflow(),L)}L=this._minPadding=O.layout.autoPadding?L:0,this._updateLayout(L),A||u(T,t=>{t.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Mn("z","_idx"));const{_active:E,_lastEvent:R}=this;R?this._eventHandler(R,!0):E.length&&this._updateHoverStyles(E,E,!0),this.render()}_updateScales(){u(this.scales,t=>{cs.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,C=new Set(Object.keys(this._listeners)),O=new Set(t.events);P(C,O)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,C=this._getUniformDataChanges()||[];for(const{method:O,start:A,count:T}of C)Cn(t,A,"_removeElements"===O?-T:T)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const C=this.data.datasets.length,i=C=>new Set(t.filter(t=>t[0]===C).map((t,C)=>C+","+t.splice(1).join(","))),O=i(0);for(let t=1;t<C;t++)if(!P(O,i(t)))return;return Array.from(O).map(t=>t.split(",")).map(t=>({method:t[1],start:+t[2],count:+t[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;cs.update(this,this.width,this.height,t);const C=this.chartArea,O=C.width<=0||C.height<=0;this._layers=[],u(this.boxes,t=>{O&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))},this),this._layers.forEach((t,C)=>{t._idx=C}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,C=this.data.datasets.length;t<C;++t)this.getDatasetMeta(t).controller.configure();for(let C=0,O=this.data.datasets.length;C<O;++C)this._updateDataset(C,S(t)?t({datasetIndex:C}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,C){const O=this.getDatasetMeta(t),A={meta:O,index:t,mode:C,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",A)&&(O.controller._update(C),A.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",A))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(Pt.has(this)?this.attached&&!Pt.running(this)&&Pt.start(this):(this.draw(),wn({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:C}=this._resizeBeforeDraw;this._resize(t,C),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const C=this._layers;for(t=0;t<C.length&&C[t].z<=0;++t)C[t].draw(this.chartArea);for(this._drawDatasets();t<C.length;++t)C[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const C=this._sortedMetasets,O=[];let A,T;for(A=0,T=C.length;A<T;++A){const T=C[A];t&&!T.visible||O.push(T)}return O}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let C=t.length-1;C>=0;--C)this._drawDataset(t[C]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const C=this.ctx,O=t._clip,A=!O.disabled,T=function(t,C){const{xScale:O,yScale:A}=t;return O&&A?{left:On(O,C,"left"),right:On(O,C,"right"),top:On(A,C,"top"),bottom:On(A,C,"bottom")}:C}(t,this.chartArea),L={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",L)&&(A&&Ie(C,{left:!1===O.left?0:T.left-O.left,right:!1===O.right?this.width:T.right+O.right,top:!1===O.top?0:T.top-O.top,bottom:!1===O.bottom?this.height:T.bottom+O.bottom}),t.controller.draw(),A&&ze(C),L.cancelable=!1,this.notifyPlugins("afterDatasetDraw",L))}isPointInArea(t){return Re(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,C,O,A){const T=as.modes[C];return"function"==typeof T?T(this,t,O,A):[]}getDatasetMeta(t){const C=this.data.datasets[t],O=this._metasets;let A=O.filter(t=>t&&t._dataset===C).pop();return A||(A={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:C&&C.order||0,index:t,_dataset:C,_parsed:[],_sorted:!1},O.push(A)),A}getContext(){return this.$context||(this.$context=Ci(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const C=this.data.datasets[t];if(!C)return!1;const O=this.getDatasetMeta(t);return"boolean"==typeof O.hidden?!O.hidden:!C.hidden}setDatasetVisibility(t,C){this.getDatasetMeta(t).hidden=!C}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,C,O){const A=O?"show":"hide",T=this.getDatasetMeta(t),L=T.controller._resolveAnimations(void 0,A);k(C)?(T.data[C].hidden=!O,this.update()):(this.setDatasetVisibility(t,O),L.update(T,{visible:O}),this.update(C=>C.datasetIndex===t?A:void 0))}hide(t,C){this._updateVisibility(t,C,!1)}show(t,C){this._updateVisibility(t,C,!0)}_destroyDatasetMeta(t){const C=this._metasets[t];C&&C.controller&&C.controller._destroy(),delete this._metasets[t]}_stop(){let t,C;for(this.stop(),Pt.remove(this),t=0,C=this.data.datasets.length;t<C;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:C}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Te(t,C),this.platform.releaseContext(C),this.canvas=null,this.ctx=null),delete Yn[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,C=this.platform,i=(O,A)=>{C.addEventListener(this,O,A),t[O]=A},s=(t,C,O)=>{t.offsetX=C,t.offsetY=O,this._eventHandler(t)};u(this.options.events,t=>i(t,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,C=this.platform,i=(O,A)=>{C.addEventListener(this,O,A),t[O]=A},s=(O,A)=>{t[O]&&(C.removeEventListener(this,O,A),delete t[O])},n=(t,C)=>{this.canvas&&this.resize(t,C)};let O;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",O)};O=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},C.isAttached(this.canvas)?a():O()}unbindEvents(){u(this._listeners,(t,C)=>{this.platform.removeEventListener(this,C,t)}),this._listeners={},u(this._responsiveListeners,(t,C)=>{this.platform.removeEventListener(this,C,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,C,O){const A=O?"set":"remove";let T,L,E,R;for("dataset"===C&&(T=this.getDatasetMeta(t[0].datasetIndex),T.controller["_"+A+"DatasetHoverStyle"]()),E=0,R=t.length;E<R;++E){L=t[E];const C=L&&this.getDatasetMeta(L.datasetIndex).controller;C&&C[A+"HoverStyle"](L.element,L.datasetIndex,L.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const C=this._active||[],O=t.map(({datasetIndex:t,index:C})=>{const O=this.getDatasetMeta(t);if(!O)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:O.data[C],index:C}});!f(O,C)&&(this._active=O,this._lastEvent=null,this._updateHoverStyles(O,C))}notifyPlugins(t,C,O){return this._plugins.notify(this,t,C,O)}isPluginEnabled(t){return 1===this._plugins._cache.filter(C=>C.plugin.id===t).length}_updateHoverStyles(t,C,O){const A=this.options.hover,n=(t,C)=>t.filter(t=>!C.some(C=>t.datasetIndex===C.datasetIndex&&t.index===C.index)),T=n(C,t),L=O?t:n(t,C);T.length&&this.updateHoverStyle(T,A.mode,!1),L.length&&A.mode&&this.updateHoverStyle(L,A.mode,!0)}_eventHandler(t,C){const O={event:t,replay:C,cancelable:!0,inChartArea:this.isPointInArea(t)},s=C=>(C.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",O,s))return;const A=this._handleEvent(t,C,O.inChartArea);return O.cancelable=!1,this.notifyPlugins("afterEvent",O,s),(A||O.changed)&&this.render(),this}_handleEvent(t,C,O){const{_active:A=[],options:T}=this,L=C,E=this._getActiveElements(t,A,O,L),R=D(t),I=function(t,C,O,A){return O&&"mouseout"!==t.type?A?C:t:null}(t,this._lastEvent,O,R);O&&(this._lastEvent=null,d(T.onHover,[t,E,this],this),R&&d(T.onClick,[t,E,this],this));const F=!f(E,A);return(F||C)&&(this._active=E,this._updateHoverStyles(E,A,C)),this._lastEvent=I,F}_getActiveElements(t,C,O,A){if("mouseout"===t.type)return[];if(!O)return C;const T=this.options.hover;return this.getElementsAtEventForMode(t,T.mode,T,A)}}function Tn(){return u(An.instances,t=>t._plugins.invalidate())}function Ln(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class En{static override(t){Object.assign(En.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return Ln()}parse(){return Ln()}format(){return Ln()}add(){return Ln()}diff(){return Ln()}startOf(){return Ln()}endOf(){return Ln()}}var io={_date:En};function In(t){const C=t.iScale,O=function(t,C){if(!t._cache.$bar){const O=t.getMatchingVisibleMetas(C);let A=[];for(let C=0,T=O.length;C<T;C++)A=A.concat(O[C].controller.getAllParsedValues(t));t._cache.$bar=lt(A.sort((t,C)=>t-C))}return t._cache.$bar}(C,t.type);let A,T,L,E,R=C._length;const l=()=>{32767!==L&&-32768!==L&&(k(E)&&(R=Math.min(R,Math.abs(L-E)||R)),E=L)};for(A=0,T=O.length;A<T;++A)L=C.getPixelForValue(O[A]),l();for(E=void 0,A=0,T=C.ticks.length;A<T;++A)L=C.getPixelForTick(A),l();return R}function zn(t,C,O,A){return n(t)?function(t,C,O,A){const T=O.parse(t[0],A),L=O.parse(t[1],A),E=Math.min(T,L),R=Math.max(T,L);let I=E,F=R;Math.abs(E)>Math.abs(R)&&(I=R,F=E),C[O.axis]=F,C._custom={barStart:I,barEnd:F,start:T,end:L,min:E,max:R}}(t,C,O,A):C[O.axis]=O.parse(t,A),C}function Fn(t,C,O,A){const T=t.iScale,L=t.vScale,E=T.getLabels(),R=T===L,I=[];let F,z,ot,ht;for(F=O,z=O+A;F<z;++F)ht=C[F],ot={},ot[T.axis]=R||T.parse(E[F],F),I.push(zn(ht,ot,L,F));return I}function Vn(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Bn(t,C,O,A){let T=C.borderSkipped;const L={};if(!T)return void(t.borderSkipped=L);if(!0===T)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:E,end:R,reverse:I,top:F,bottom:z}=function(t){let C,O,A,T,L;return t.horizontal?(C=t.base>t.x,O="left",A="right"):(C=t.base<t.y,O="bottom",A="top"),C?(T="end",L="start"):(T="start",L="end"),{start:O,end:A,reverse:C,top:T,bottom:L}}(t);"middle"===T&&O&&(t.enableBorderRadius=!0,(O._top||0)===A?T=F:(O._bottom||0)===A?T=z:(L[Wn(z,E,R,I)]=!0,T=F)),L[Wn(T,E,R,I)]=!0,t.borderSkipped=L}function Wn(t,C,O,A){var T,L,E;return A?(E=O,t=Nn(t=(T=t)===(L=C)?E:T===E?L:T,O,C)):t=Nn(t,C,O),t}function Nn(t,C,O){return"start"===t?C:"end"===t?O:t}function Hn(t,{inflateAmount:C},O){t.inflateAmount="auto"===C?1===O?.33:0:C}class jn extends Ns{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const C=t.data;if(C.labels.length&&C.datasets.length){const{labels:{pointStyle:O,color:A}}=t.legend.options;return C.labels.map((C,T)=>{const L=t.getDatasetMeta(0).controller.getStyle(T);return{text:C,fillStyle:L.backgroundColor,strokeStyle:L.borderColor,fontColor:A,lineWidth:L.borderWidth,pointStyle:O,hidden:!t.getDataVisibility(T),index:T}})}return[]}},onClick(t,C,O){O.chart.toggleDataVisibility(C.index),O.chart.update()}}}};constructor(t,C){super(t,C),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,C){const O=this.getDataset().data,A=this._cachedMeta;if(!1===this._parsing)A._parsed=O;else{let T,L,r=t=>+O[t];if(o(O[t])){const{key:t="value"}=this._parsing;r=C=>+M(O[C],t)}for(T=t,L=t+C;T<L;++T)A._parsed[T]=r(T)}}_getRotation(){return $(this.options.rotation-90)}_getCircumference(){return $(this.options.circumference)}_getRotationExtents(){let t=T,C=-T;for(let O=0;O<this.chart.data.datasets.length;++O)if(this.chart.isDatasetVisible(O)&&this.chart.getDatasetMeta(O).type===this._type){const A=this.chart.getDatasetMeta(O).controller,T=A._getRotation(),L=A._getCircumference();t=Math.min(t,T),C=Math.max(C,T+L)}return{rotation:t,circumference:C-t}}update(t){const C=this.chart,{chartArea:O}=C,L=this._cachedMeta,E=L.data,R=this.getMaxBorderWidth()+this.getMaxOffset(E)+this.options.spacing,F=Math.max((Math.min(O.width,O.height)-R)/2,0),z=Math.min(h(this.options.cutout,F),1),ot=this._getRingWeight(this.index),{circumference:ht,rotation:bt}=this._getRotationExtents(),{ratioX:St,ratioY:Pt,offsetX:Tt,offsetY:Nt}=function(t,C,O){let L=1,E=1,R=0,F=0;if(C<T){const T=t,z=T+C,ot=Math.cos(T),ht=Math.sin(T),bt=Math.cos(z),St=Math.sin(z),f=(t,C,A)=>Z(t,T,z,!0)?1:Math.max(C,C*O,A,A*O),g=(t,C,A)=>Z(t,T,z,!0)?-1:Math.min(C,C*O,A,A*O),Pt=f(0,ot,bt),Tt=f(I,ht,St),Nt=g(A,ot,bt),Ht=g(A+I,ht,St);L=(Pt-Nt)/2,E=(Tt-Ht)/2,R=-(Pt+Nt)/2,F=-(Tt+Ht)/2}return{ratioX:L,ratioY:E,offsetX:R,offsetY:F}}(bt,ht,z),Ht=(O.width-R)/St,Wt=(O.height-R)/Pt,$t=Math.max(Math.min(Ht,Wt)/2,0),ee=c(this.options.radius,$t),ie=(ee-Math.max(ee*z,0))/this._getVisibleDatasetWeightTotal();this.offsetX=Tt*ee,this.offsetY=Nt*ee,L.total=this.calculateTotal(),this.outerRadius=ee-ie*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-ie*ot,0),this.updateElements(E,0,E.length,t)}_circumference(t,C){const O=this.options,A=this._cachedMeta,L=this._getCircumference();return C&&O.animation.animateRotate||!this.chart.getDataVisibility(t)||null===A._parsed[t]||A.data[t].hidden?0:this.calculateCircumference(A._parsed[t]*L/T)}updateElements(t,C,O,A){const T="reset"===A,L=this.chart,E=L.chartArea,R=L.options.animation,I=(E.left+E.right)/2,F=(E.top+E.bottom)/2,z=T&&R.animateScale,ot=z?0:this.innerRadius,ht=z?0:this.outerRadius,{sharedOptions:bt,includeOptions:St}=this._getSharedOptions(C,A);let Pt,Tt=this._getRotation();for(Pt=0;Pt<C;++Pt)Tt+=this._circumference(Pt,T);for(Pt=C;Pt<C+O;++Pt){const C=this._circumference(Pt,T),O=t[Pt],L={x:I+this.offsetX,y:F+this.offsetY,startAngle:Tt,endAngle:Tt+C,circumference:C,outerRadius:ht,innerRadius:ot};St&&(L.options=bt||this.resolveDataElementOptions(Pt,O.active?"active":A)),Tt+=C,this.updateElement(O,Pt,L,A)}}calculateTotal(){const t=this._cachedMeta,C=t.data;let O,A=0;for(O=0;O<C.length;O++){const T=t._parsed[O];null===T||isNaN(T)||!this.chart.getDataVisibility(O)||C[O].hidden||(A+=Math.abs(T))}return A}calculateCircumference(t){const C=this._cachedMeta.total;return C>0&&!isNaN(t)?T*(Math.abs(t)/C):0}getLabelAndValue(t){const C=this._cachedMeta,O=this.chart,A=O.data.labels||[],T=ne(C._parsed[t],O.options.locale);return{label:A[t]||"",value:T}}getMaxBorderWidth(t){let C=0;const O=this.chart;let A,T,L,E,R;if(!t)for(A=0,T=O.data.datasets.length;A<T;++A)if(O.isDatasetVisible(A)){L=O.getDatasetMeta(A),t=L.data,E=L.controller;break}if(!t)return 0;for(A=0,T=t.length;A<T;++A)R=E.resolveDataElementOptions(A),"inner"!==R.borderAlign&&(C=Math.max(C,R.borderWidth||0,R.hoverBorderWidth||0));return C}getMaxOffset(t){let C=0;for(let O=0,A=t.length;O<A;++O){const t=this.resolveDataElementOptions(O);C=Math.max(C,t.offset||0,t.hoverOffset||0)}return C}_getRingWeightOffset(t){let C=0;for(let O=0;O<t;++O)this.chart.isDatasetVisible(O)&&(C+=this._getRingWeight(O));return C}_getRingWeight(t){return Math.max(l(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class $n extends Ns{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const C=t.data;if(C.labels.length&&C.datasets.length){const{labels:{pointStyle:O,color:A}}=t.legend.options;return C.labels.map((C,T)=>{const L=t.getDatasetMeta(0).controller.getStyle(T);return{text:C,fillStyle:L.backgroundColor,strokeStyle:L.borderColor,fontColor:A,lineWidth:L.borderWidth,pointStyle:O,hidden:!t.getDataVisibility(T),index:T}})}return[]}},onClick(t,C,O){O.chart.toggleDataVisibility(C.index),O.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,C){super(t,C),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const C=this._cachedMeta,O=this.chart,A=O.data.labels||[],T=ne(C._parsed[t].r,O.options.locale);return{label:A[t]||"",value:T}}parseObjectData(t,C,O,A){return ii.bind(this)(t,C,O,A)}update(t){const C=this._cachedMeta.data;this._updateRadius(),this.updateElements(C,0,C.length,t)}getMinMax(){const t=this._cachedMeta,C={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((t,O)=>{const A=this.getParsed(O).r;!isNaN(A)&&this.chart.getDataVisibility(O)&&(A<C.min&&(C.min=A),A>C.max&&(C.max=A))}),C}_updateRadius(){const t=this.chart,C=t.chartArea,O=t.options,A=Math.min(C.right-C.left,C.bottom-C.top),T=Math.max(A/2,0),L=(T-Math.max(O.cutoutPercentage?T/100*O.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=T-L*this.index,this.innerRadius=this.outerRadius-L}updateElements(t,C,O,T){const L="reset"===T,E=this.chart,R=E.options.animation,I=this._cachedMeta.rScale,F=I.xCenter,z=I.yCenter,ot=I.getIndexAngle(0)-.5*A;let ht,bt=ot;const St=360/this.countVisibleElements();for(ht=0;ht<C;++ht)bt+=this._computeAngle(ht,T,St);for(ht=C;ht<C+O;ht++){const C=t[ht];let O=bt,A=bt+this._computeAngle(ht,T,St),Pt=E.getDataVisibility(ht)?I.getDistanceFromCenterForValue(this.getParsed(ht).r):0;bt=A,L&&(R.animateScale&&(Pt=0),R.animateRotate&&(O=A=ot));const Tt={x:F,y:z,innerRadius:0,outerRadius:Pt,startAngle:O,endAngle:A,options:this.resolveDataElementOptions(ht,C.active?"active":T)};this.updateElement(C,ht,Tt,T)}}countVisibleElements(){const t=this._cachedMeta;let C=0;return t.data.forEach((t,O)=>{!isNaN(this.getParsed(O).r)&&this.chart.getDataVisibility(O)&&C++}),C}_computeAngle(t,C,O){return this.chart.getDataVisibility(t)?$(this.resolveDataElementOptions(t,C).angle||O):0}}var fo=Object.freeze({__proto__:null,BarController:class extends Ns{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,C,O,A){return Fn(t,C,O,A)}parseArrayData(t,C,O,A){return Fn(t,C,O,A)}parseObjectData(t,C,O,A){const{iScale:T,vScale:L}=t,{xAxisKey:E="x",yAxisKey:R="y"}=this._parsing,I="x"===T.axis?E:R,F="x"===L.axis?E:R,z=[];let ot,ht,bt,St;for(ot=O,ht=O+A;ot<ht;++ot)St=C[ot],bt={},bt[T.axis]=T.parse(M(St,I),ot),z.push(zn(M(St,F),bt,L,ot));return z}updateRangeFromParsed(t,C,O,A){super.updateRangeFromParsed(t,C,O,A);const T=O._custom;T&&C===this._cachedMeta.vScale&&(t.min=Math.min(t.min,T.min),t.max=Math.max(t.max,T.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const C=this._cachedMeta,{iScale:O,vScale:A}=C,T=this.getParsed(t),L=T._custom,E=Vn(L)?"["+L.start+", "+L.end+"]":""+A.getLabelForValue(T[A.axis]);return{label:""+O.getLabelForValue(T[O.axis]),value:E}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){const C=this._cachedMeta;this.updateElements(C.data,0,C.data.length,t)}updateElements(t,C,O,A){const T="reset"===A,{index:L,_cachedMeta:{vScale:E}}=this,R=E.getBasePixel(),I=E.isHorizontal(),F=this._getRuler(),{sharedOptions:z,includeOptions:ot}=this._getSharedOptions(C,A);for(let ht=C;ht<C+O;ht++){const C=this.getParsed(ht),O=T||s(C[E.axis])?{base:R,head:R}:this._calculateBarValuePixels(ht),bt=this._calculateBarIndexPixels(ht,F),St=(C._stacks||{})[E.axis],Pt={horizontal:I,base:O.base,enableBorderRadius:!St||Vn(C._custom)||L===St._top||L===St._bottom,x:I?O.head:bt.center,y:I?bt.center:O.head,height:I?bt.size:Math.abs(O.size),width:I?Math.abs(O.size):bt.size};ot&&(Pt.options=z||this.resolveDataElementOptions(ht,t[ht].active?"active":A));const Tt=Pt.options||t[ht].options;Bn(Pt,Tt,St,L),Hn(Pt,Tt,F.ratio),this.updateElement(t[ht],ht,Pt,A)}}_getStacks(t,C){const{iScale:O}=this._cachedMeta,A=O.getMatchingVisibleMetas(this._type).filter(t=>t.controller.options.grouped),T=O.options.stacked,L=[],r=t=>{const O=t.controller.getParsed(C),A=O&&O[t.vScale.axis];if(s(A)||isNaN(A))return!0};for(const O of A)if((void 0===C||!r(O))&&((!1===T||-1===L.indexOf(O.stack)||void 0===T&&void 0===O.stack)&&L.push(O.stack),O.index===t))break;return L.length||L.push(void 0),L}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,C,O){const A=this._getStacks(t,O),T=void 0!==C?A.indexOf(C):-1;return-1===T?A.length-1:T}_getRuler(){const t=this.options,C=this._cachedMeta,O=C.iScale,A=[];let T,L;for(T=0,L=C.data.length;T<L;++T)A.push(O.getPixelForValue(this.getParsed(T)[O.axis],T));const E=t.barThickness;return{min:E||In(C),pixels:A,start:O._startPixel,end:O._endPixel,stackCount:this._getStackCount(),scale:O,grouped:t.grouped,ratio:E?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:C,_stacked:O,index:A},options:{base:T,minBarLength:L}}=this,E=T||0,R=this.getParsed(t),I=R._custom,F=Vn(I);let z,ot,bt=R[C.axis],St=0,Pt=O?this.applyStack(C,R,O):bt;Pt!==bt&&(St=Pt-bt,Pt=bt),F&&(bt=I.barStart,Pt=I.barEnd-I.barStart,0!==bt&&ht(bt)!==ht(I.barEnd)&&(St=0),St+=bt);const Tt=s(T)||F?St:T;let Nt=C.getPixelForValue(Tt);if(z=this.chart.getDataVisibility(t)?C.getPixelForValue(St+Pt):Nt,ot=z-Nt,Math.abs(ot)<L){ot=function(t,C,O){return 0!==t?ht(t):(C.isHorizontal()?1:-1)*(C.min>=O?1:-1)}(ot,C,E)*L,bt===E&&(Nt-=ot/2);const t=C.getPixelForDecimal(0),T=C.getPixelForDecimal(1),I=Math.min(t,T),St=Math.max(t,T);Nt=Math.max(Math.min(Nt,St),I),z=Nt+ot,O&&!F&&(R._stacks[C.axis]._visualValues[A]=C.getValueForPixel(z)-C.getValueForPixel(Nt))}if(Nt===C.getPixelForValue(E)){const t=ht(ot)*C.getLineWidthForValue(E)/2;Nt+=t,ot-=t}return{size:ot,base:Nt,head:z,center:z+ot/2}}_calculateBarIndexPixels(t,C){const O=C.scale,A=this.options,T=A.skipNull,L=l(A.maxBarThickness,1/0);let E,R;if(C.grouped){const O=T?this._getStackCount(t):C.stackCount,I="flex"===A.barThickness?function(t,C,O,A){const T=C.pixels,L=T[t];let E=t>0?T[t-1]:null,R=t<T.length-1?T[t+1]:null;const I=O.categoryPercentage;null===E&&(E=L-(null===R?C.end-C.start:R-L)),null===R&&(R=L+L-E);const F=L-(L-Math.min(E,R))/2*I;return{chunk:Math.abs(R-E)/2*I/A,ratio:O.barPercentage,start:F}}(t,C,A,O):function(t,C,O,A){const T=O.barThickness;let L,E;return s(T)?(L=C.min*O.categoryPercentage,E=O.barPercentage):(L=T*A,E=1),{chunk:L/A,ratio:E,start:C.pixels[t]-L/2}}(t,C,A,O),F=this._getStackIndex(this.index,this._cachedMeta.stack,T?t:void 0);E=I.start+I.chunk*F+I.chunk/2,R=Math.min(L,I.chunk*I.ratio)}else E=O.getPixelForValue(this.getParsed(t)[O.axis],t),R=Math.min(L,C.min*C.ratio);return{base:E-R/2,head:E+R/2,center:E,size:R}}draw(){const t=this._cachedMeta,C=t.vScale,O=t.data,A=O.length;let T=0;for(;T<A;++T)null===this.getParsed(T)[C.axis]||O[T].hidden||O[T].draw(this._ctx)}},BubbleController:class extends Ns{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,C,O,A){const T=super.parsePrimitiveData(t,C,O,A);for(let t=0;t<T.length;t++)T[t]._custom=this.resolveDataElementOptions(t+O).radius;return T}parseArrayData(t,C,O,A){const T=super.parseArrayData(t,C,O,A);for(let t=0;t<T.length;t++){const A=C[O+t];T[t]._custom=l(A[2],this.resolveDataElementOptions(t+O).radius)}return T}parseObjectData(t,C,O,A){const T=super.parseObjectData(t,C,O,A);for(let t=0;t<T.length;t++){const A=C[O+t];T[t]._custom=l(A&&A.r&&+A.r,this.resolveDataElementOptions(t+O).radius)}return T}getMaxOverflow(){const t=this._cachedMeta.data;let C=0;for(let O=t.length-1;O>=0;--O)C=Math.max(C,t[O].size(this.resolveDataElementOptions(O))/2);return C>0&&C}getLabelAndValue(t){const C=this._cachedMeta,O=this.chart.data.labels||[],{xScale:A,yScale:T}=C,L=this.getParsed(t),E=A.getLabelForValue(L.x),R=T.getLabelForValue(L.y),I=L._custom;return{label:O[t]||"",value:"("+E+", "+R+(I?", "+I:"")+")"}}update(t){const C=this._cachedMeta.data;this.updateElements(C,0,C.length,t)}updateElements(t,C,O,A){const T="reset"===A,{iScale:L,vScale:E}=this._cachedMeta,{sharedOptions:R,includeOptions:I}=this._getSharedOptions(C,A),F=L.axis,z=E.axis;for(let ot=C;ot<C+O;ot++){const C=t[ot],O=!T&&this.getParsed(ot),ht={},bt=ht[F]=T?L.getPixelForDecimal(.5):L.getPixelForValue(O[F]),St=ht[z]=T?E.getBasePixel():E.getPixelForValue(O[z]);ht.skip=isNaN(bt)||isNaN(St),I&&(ht.options=R||this.resolveDataElementOptions(ot,C.active?"active":A),T&&(ht.options.radius=0)),this.updateElement(C,ot,ht,A)}}resolveDataElementOptions(t,C){const O=this.getParsed(t);let A=super.resolveDataElementOptions(t,C);A.$shared&&(A=Object.assign({},A,{$shared:!1}));const T=A.radius;return"active"!==C&&(A.radius=0),A.radius+=l(O&&O._custom,T),A}},DoughnutController:jn,LineController:class extends Ns{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const C=this._cachedMeta,{dataset:O,data:A=[],_dataset:T}=C,L=this.chart._animationsDisabled;let{start:E,count:R}=pt(C,A,L);this._drawStart=E,this._drawCount=R,mt(C)&&(E=0,R=A.length),O._chart=this.chart,O._datasetIndex=this.index,O._decimated=!!T._decimated,O.points=A;const I=this.resolveDatasetElementOptions(t);this.options.showLine||(I.borderWidth=0),I.segment=this.options.segment,this.updateElement(O,void 0,{animated:!L,options:I},t),this.updateElements(A,E,R,t)}updateElements(t,C,O,A){const T="reset"===A,{iScale:L,vScale:E,_stacked:R,_dataset:I}=this._cachedMeta,{sharedOptions:F,includeOptions:z}=this._getSharedOptions(C,A),ot=L.axis,ht=E.axis,{spanGaps:bt,segment:St}=this.options,Pt=N(bt)?bt:Number.POSITIVE_INFINITY,Tt=this.chart._animationsDisabled||T||"none"===A,Nt=C+O,Ht=t.length;let Wt=C>0&&this.getParsed(C-1);for(let O=0;O<Ht;++O){const bt=t[O],Ht=Tt?bt:{};if(O<C||O>=Nt){Ht.skip=!0;continue}const $t=this.getParsed(O),ee=s($t[ht]),ie=Ht[ot]=L.getPixelForValue($t[ot],O),se=Ht[ht]=T||ee?E.getBasePixel():E.getPixelForValue(R?this.applyStack(E,$t,R):$t[ht],O);Ht.skip=isNaN(ie)||isNaN(se)||ee,Ht.stop=O>0&&Math.abs($t[ot]-Wt[ot])>Pt,St&&(Ht.parsed=$t,Ht.raw=I.data[O]),z&&(Ht.options=F||this.resolveDataElementOptions(O,bt.active?"active":A)),Tt||this.updateElement(bt,O,Ht,A),Wt=$t}}getMaxOverflow(){const t=this._cachedMeta,C=t.dataset,O=C.options&&C.options.borderWidth||0,A=t.data||[];if(!A.length)return O;const T=A[0].size(this.resolveDataElementOptions(0)),L=A[A.length-1].size(this.resolveDataElementOptions(A.length-1));return Math.max(O,T,L)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends jn{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:$n,RadarController:class extends Ns{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const C=this._cachedMeta.vScale,O=this.getParsed(t);return{label:C.getLabels()[t],value:""+C.getLabelForValue(O[C.axis])}}parseObjectData(t,C,O,A){return ii.bind(this)(t,C,O,A)}update(t){const C=this._cachedMeta,O=C.dataset,A=C.data||[],T=C.iScale.getLabels();if(O.points=A,"resize"!==t){const C=this.resolveDatasetElementOptions(t);this.options.showLine||(C.borderWidth=0);const L={_loop:!0,_fullLoop:T.length===A.length,options:C};this.updateElement(O,void 0,L,t)}this.updateElements(A,0,A.length,t)}updateElements(t,C,O,A){const T=this._cachedMeta.rScale,L="reset"===A;for(let E=C;E<C+O;E++){const C=t[E],O=this.resolveDataElementOptions(E,C.active?"active":A),R=T.getPointPositionForValue(E,this.getParsed(E).r),I=L?T.xCenter:R.x,F=L?T.yCenter:R.y,z={x:I,y:F,angle:R.angle,skip:isNaN(I)||isNaN(F),options:O};this.updateElement(C,E,z,A)}}},ScatterController:class extends Ns{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const C=this._cachedMeta,O=this.chart.data.labels||[],{xScale:A,yScale:T}=C,L=this.getParsed(t),E=A.getLabelForValue(L.x),R=T.getLabelForValue(L.y);return{label:O[t]||"",value:"("+E+", "+R+")"}}update(t){const C=this._cachedMeta,{data:O=[]}=C,A=this.chart._animationsDisabled;let{start:T,count:L}=pt(C,O,A);if(this._drawStart=T,this._drawCount=L,mt(C)&&(T=0,L=O.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:T,_dataset:L}=C;T._chart=this.chart,T._datasetIndex=this.index,T._decimated=!!L._decimated,T.points=O;const E=this.resolveDatasetElementOptions(t);E.segment=this.options.segment,this.updateElement(T,void 0,{animated:!A,options:E},t)}else this.datasetElementType&&(delete C.dataset,this.datasetElementType=!1);this.updateElements(O,T,L,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,C,O,A){const T="reset"===A,{iScale:L,vScale:E,_stacked:R,_dataset:I}=this._cachedMeta,F=this.resolveDataElementOptions(C,A),z=this.getSharedOptions(F),ot=this.includeOptions(A,z),ht=L.axis,bt=E.axis,{spanGaps:St,segment:Pt}=this.options,Tt=N(St)?St:Number.POSITIVE_INFINITY,Nt=this.chart._animationsDisabled||T||"none"===A;let Ht=C>0&&this.getParsed(C-1);for(let F=C;F<C+O;++F){const C=t[F],O=this.getParsed(F),St=Nt?C:{},Wt=s(O[bt]),$t=St[ht]=L.getPixelForValue(O[ht],F),ee=St[bt]=T||Wt?E.getBasePixel():E.getPixelForValue(R?this.applyStack(E,O,R):O[bt],F);St.skip=isNaN($t)||isNaN(ee)||Wt,St.stop=F>0&&Math.abs(O[ht]-Ht[ht])>Tt,Pt&&(St.parsed=O,St.raw=I.data[F]),ot&&(St.options=z||this.resolveDataElementOptions(F,C.active?"active":A)),Nt||this.updateElement(C,F,St,A),Ht=O}this.updateSharedOptions(z,A,F)}getMaxOverflow(){const t=this._cachedMeta,C=t.data||[];if(!this.options.showLine){let t=0;for(let O=C.length-1;O>=0;--O)t=Math.max(t,C[O].size(this.resolveDataElementOptions(O))/2);return t>0&&t}const O=t.dataset,A=O.options&&O.options.borderWidth||0;if(!C.length)return A;const T=C[0].size(this.resolveDataElementOptions(0)),L=C[C.length-1].size(this.resolveDataElementOptions(C.length-1));return Math.max(A,T,L)/2}}});function Un(t,C,O,A){const T=vi(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]),L=(O-C)/2,E=Math.min(L,A*C/2),r=t=>{const C=(O-Math.min(L,t))*A/2;return J(t,0,Math.min(L,C))};return{outerStart:r(T.outerStart),outerEnd:r(T.outerEnd),innerStart:J(T.innerStart,0,E),innerEnd:J(T.innerEnd,0,E)}}function Xn(t,C,O,A){return{x:O+t*Math.cos(C),y:A+t*Math.sin(C)}}function qn(t,C,O,T,L,E){const{x:R,y:F,startAngle:z,pixelMargin:ot,innerRadius:ht}=C,bt=Math.max(C.outerRadius+T+O-ot,0),St=ht>0?ht+T+O+ot:0;let Pt=0;const Tt=L-z;if(T){const t=((ht>0?ht-T:0)+(bt>0?bt-T:0))/2;Pt=(Tt-(0!==t?Tt*t/(t+T):Tt))/2}const Nt=(Tt-Math.max(.001,Tt*bt-O/A)/bt)/2,Ht=z+Nt+Pt,Wt=L-Nt-Pt,{outerStart:$t,outerEnd:ee,innerStart:ie,innerEnd:se}=Un(C,St,bt,Wt-Ht),oe=bt-$t,ae=bt-ee,re=Ht+$t/oe,le=Wt-ee/ae,ue=St+ie,be=St+se,Se=Ht+ie/ue,si=Wt-se/be;if(t.beginPath(),E){const C=(re+le)/2;if(t.arc(R,F,bt,re,C),t.arc(R,F,bt,C,le),ee>0){const C=Xn(ae,le,R,F);t.arc(C.x,C.y,ee,le,Wt+I)}const O=Xn(be,Wt,R,F);if(t.lineTo(O.x,O.y),se>0){const C=Xn(be,si,R,F);t.arc(C.x,C.y,se,Wt+I,si+Math.PI)}const A=(Wt-se/St+(Ht+ie/St))/2;if(t.arc(R,F,St,Wt-se/St,A,!0),t.arc(R,F,St,A,Ht+ie/St,!0),ie>0){const C=Xn(ue,Se,R,F);t.arc(C.x,C.y,ie,Se+Math.PI,Ht-I)}const T=Xn(oe,Ht,R,F);if(t.lineTo(T.x,T.y),$t>0){const C=Xn(oe,re,R,F);t.arc(C.x,C.y,$t,Ht-I,re)}}else{t.moveTo(R,F);const C=Math.cos(re)*bt+R,O=Math.sin(re)*bt+F;t.lineTo(C,O);const A=Math.cos(le)*bt+R,T=Math.sin(le)*bt+F;t.lineTo(A,T)}t.closePath()}function Kn(t,C,O,A,L){const{fullCircles:E,startAngle:R,circumference:F,options:z}=C,{borderWidth:ot,borderJoinStyle:ht,borderDash:bt,borderDashOffset:St}=z,Pt="inner"===z.borderAlign;if(!ot)return;t.setLineDash(bt||[]),t.lineDashOffset=St,Pt?(t.lineWidth=2*ot,t.lineJoin=ht||"round"):(t.lineWidth=ot,t.lineJoin=ht||"bevel");let Tt=C.endAngle;if(E){qn(t,C,O,A,Tt,L);for(let C=0;C<E;++C)t.stroke();isNaN(F)||(Tt=R+(F%T||T))}Pt&&function(t,C,O){const{startAngle:A,pixelMargin:T,x:L,y:E,outerRadius:R,innerRadius:F}=C;let z=T/R;t.beginPath(),t.arc(L,E,R,A-z,O+z),F>T?(z=T/F,t.arc(L,E,F,O+z,A-z,!0)):t.arc(L,E,T,O+I,A-I),t.closePath(),t.clip()}(t,C,Tt),E||(qn(t,C,O,A,Tt,L),t.stroke())}function Gn(t,C,O=C){t.lineCap=l(O.borderCapStyle,C.borderCapStyle),t.setLineDash(l(O.borderDash,C.borderDash)),t.lineDashOffset=l(O.borderDashOffset,C.borderDashOffset),t.lineJoin=l(O.borderJoinStyle,C.borderJoinStyle),t.lineWidth=l(O.borderWidth,C.borderWidth),t.strokeStyle=l(O.borderColor,C.borderColor)}function Zn(t,C,O){t.lineTo(O.x,O.y)}function Jn(t,C,O={}){const A=t.length,{start:T=0,end:L=A-1}=O,{start:E,end:R}=C,I=Math.max(T,E),F=Math.min(L,R),z=T<E&&L<E||T>R&&L>R;return{count:A,start:I,loop:C.loop,ilen:F<I&&!z?A+F-I:F-I}}function Qn(t,C,O,A){const{points:T,options:L}=C,{count:E,start:R,loop:I,ilen:F}=Jn(T,O,A),z=function(t){return t.stepped?Fe:t.tension||"monotone"===t.cubicInterpolationMode?Ve:Zn}(L);let ot,ht,bt,{move:St=!0,reverse:Pt}=A||{};for(ot=0;ot<=F;++ot)ht=T[(R+(Pt?F-ot:ot))%E],ht.skip||(St?(t.moveTo(ht.x,ht.y),St=!1):z(t,bt,ht,Pt,L.stepped),bt=ht);return I&&(ht=T[(R+(Pt?F:0))%E],z(t,bt,ht,Pt,L.stepped)),!!I}function to(t,C,O,A){const T=C.points,{count:L,start:E,ilen:R}=Jn(T,O,A),{move:I=!0,reverse:F}=A||{};let z,ot,ht,bt,St,Pt,Tt=0,Nt=0;const b=t=>(E+(F?R-t:t))%L,_=()=>{bt!==St&&(t.lineTo(Tt,St),t.lineTo(Tt,bt),t.lineTo(Tt,Pt))};for(I&&(ot=T[b(0)],t.moveTo(ot.x,ot.y)),z=0;z<=R;++z){if(ot=T[b(z)],ot.skip)continue;const C=ot.x,O=ot.y,A=0|C;A===ht?(O<bt?bt=O:O>St&&(St=O),Tt=(Nt*Tt+C)/++Nt):(_(),t.lineTo(C,O),ht=A,Nt=0,bt=St=O),Pt=O}_()}function eo(t){const C=t.options,O=C.borderDash&&C.borderDash.length;return t._decimated||t._loop||C.tension||"monotone"===C.cubicInterpolationMode||C.stepped||O?Qn:to}const Ro="function"==typeof Path2D;function so(t,C,O,A){Ro&&!C.options.segment?function(t,C,O,A){let T=C._path;T||(T=C._path=new Path2D,C.path(T,O,A)&&T.closePath()),Gn(t,C.options),t.stroke(T)}(t,C,O,A):function(t,C,O,A){const{segments:T,options:L}=C,E=eo(C);for(const R of T)Gn(t,L,R.style),t.beginPath(),E(t,C,R,{start:O,end:O+A-1})&&t.closePath(),t.stroke()}(t,C,O,A)}class no extends Hs{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,C){const O=this.options;if((O.tension||"monotone"===O.cubicInterpolationMode)&&!O.stepped&&!this._pointsUpdated){const A=O.spanGaps?this._loop:this._fullLoop;hi(this._points,O,t,A,C),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=zi(this,this.options.segment))}first(){const t=this.segments,C=this.points;return t.length&&C[t[0].start]}last(){const t=this.segments,C=this.points,O=t.length;return O&&C[t[O-1].end]}interpolate(t,C){const O=this.options,A=t[C],T=this.points,L=Ii(this,{property:C,start:A,end:A});if(!L.length)return;const E=[],R=function(t){return t.stepped?pi:t.tension||"monotone"===t.cubicInterpolationMode?mi:gi}(O);let I,F;for(I=0,F=L.length;I<F;++I){const{start:F,end:z}=L[I],ot=T[F],ht=T[z];if(ot===ht){E.push(ot);continue}const bt=R(ot,ht,Math.abs((A-ot[C])/(ht[C]-ot[C])),O.stepped);bt[C]=t[C],E.push(bt)}return 1===E.length?E[0]:E}pathSegment(t,C,O){return eo(this)(t,this,C,O)}path(t,C,O){const A=this.segments,T=eo(this);let L=this._loop;C=C||0,O=O||this.points.length-C;for(const E of A)L&=T(t,this,E,{start:C,end:C+O-1});return!!L}draw(t,C,O,A){const T=this.options||{};(this.points||[]).length&&T.borderWidth&&(t.save(),so(t,this,O,A),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function oo(t,C,O,A){const T=t.options,{[O]:L}=t.getProps([O],A);return Math.abs(C-L)<T.radius+T.hitRadius}function ao(t,C){const{x:O,y:A,base:T,width:L,height:E}=t.getProps(["x","y","base","width","height"],C);let R,I,F,z,ot;return t.horizontal?(ot=E/2,R=Math.min(O,T),I=Math.max(O,T),F=A-ot,z=A+ot):(ot=L/2,R=O-ot,I=O+ot,F=Math.min(A,T),z=Math.max(A,T)),{left:R,top:F,right:I,bottom:z}}function ro(t,C,O,A){return t?0:J(C,O,A)}function lo(t){const C=ao(t),O=C.right-C.left,A=C.bottom-C.top,T=function(t,C,O){const A=t.options.borderWidth,T=t.borderSkipped,L=Mi(A);return{t:ro(T.top,L.top,0,O),r:ro(T.right,L.right,0,C),b:ro(T.bottom,L.bottom,0,O),l:ro(T.left,L.left,0,C)}}(t,O/2,A/2),L=function(t,C,O){const{enableBorderRadius:A}=t.getProps(["enableBorderRadius"]),T=t.options.borderRadius,L=wi(T),E=Math.min(C,O),R=t.borderSkipped,I=A||o(T);return{topLeft:ro(!I||R.top||R.left,L.topLeft,0,E),topRight:ro(!I||R.top||R.right,L.topRight,0,E),bottomLeft:ro(!I||R.bottom||R.left,L.bottomLeft,0,E),bottomRight:ro(!I||R.bottom||R.right,L.bottomRight,0,E)}}(t,O/2,A/2);return{outer:{x:C.left,y:C.top,w:O,h:A,radius:L},inner:{x:C.left+T.l,y:C.top+T.t,w:O-T.l-T.r,h:A-T.t-T.b,radius:{topLeft:Math.max(0,L.topLeft-Math.max(T.t,T.l)),topRight:Math.max(0,L.topRight-Math.max(T.t,T.r)),bottomLeft:Math.max(0,L.bottomLeft-Math.max(T.b,T.l)),bottomRight:Math.max(0,L.bottomRight-Math.max(T.b,T.r))}}}}function ho(t,C,O,A){const T=null===C,L=null===O,E=t&&!(T&&L)&&ao(t,A);return E&&(T||tt(C,E.left,E.right))&&(L||tt(O,E.top,E.bottom))}function co(t,C){t.rect(C.x,C.y,C.w,C.h)}function uo(t,C,O={}){const A=t.x!==O.x?-C:0,T=t.y!==O.y?-C:0,L=(t.x+t.w!==O.x+O.w?C:0)-A,E=(t.y+t.h!==O.y+O.h?C:0)-T;return{x:t.x+A,y:t.y+T,w:t.w+L,h:t.h+E,radius:t.radius}}var Io=Object.freeze({__proto__:null,ArcElement:class extends Hs{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,C,O){const A=this.getProps(["x","y"],O),{angle:L,distance:E}=X(A,{x:t,y:C}),{startAngle:R,endAngle:I,innerRadius:F,outerRadius:z,circumference:ot}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],O),ht=(this.options.spacing+this.options.borderWidth)/2,bt=l(ot,I-R)>=T||Z(L,R,I),St=tt(E,F+ht,z+ht);return bt&&St}getCenterPoint(t){const{x:C,y:O,startAngle:A,endAngle:T,innerRadius:L,outerRadius:E}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:R,spacing:I}=this.options,F=(A+T)/2,z=(L+E+I+R)/2;return{x:C+Math.cos(F)*z,y:O+Math.sin(F)*z}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:C,circumference:O}=this,L=(C.offset||0)/4,E=(C.spacing||0)/2,R=C.circular;if(this.pixelMargin="inner"===C.borderAlign?.33:0,this.fullCircles=O>T?Math.floor(O/T):0,0===O||this.innerRadius<0||this.outerRadius<0)return;t.save();const I=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(I)*L,Math.sin(I)*L);const F=L*(1-Math.sin(Math.min(A,O||0)));t.fillStyle=C.backgroundColor,t.strokeStyle=C.borderColor,function(t,C,O,A,L){const{fullCircles:E,startAngle:R,circumference:I}=C;let F=C.endAngle;if(E){qn(t,C,O,A,F,L);for(let C=0;C<E;++C)t.fill();isNaN(I)||(F=R+(I%T||T))}qn(t,C,O,A,F,L),t.fill()}(t,this,F,E,R),Kn(t,this,F,E,R),t.restore()}},BarElement:class extends Hs{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:C,options:{borderColor:O,backgroundColor:A}}=this,{inner:T,outer:L}=lo(this),E=(R=L.radius).topLeft||R.topRight||R.bottomLeft||R.bottomRight?He:co;var R;t.save(),L.w===T.w&&L.h===T.h||(t.beginPath(),E(t,uo(L,C,T)),t.clip(),E(t,uo(T,-C,L)),t.fillStyle=O,t.fill("evenodd")),t.beginPath(),E(t,uo(T,C)),t.fillStyle=A,t.fill(),t.restore()}inRange(t,C,O){return ho(this,t,C,O)}inXRange(t,C){return ho(this,t,null,C)}inYRange(t,C){return ho(this,null,t,C)}getCenterPoint(t){const{x:C,y:O,base:A,horizontal:T}=this.getProps(["x","y","base","horizontal"],t);return{x:T?(C+A)/2:C,y:T?O:(O+A)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:no,PointElement:class extends Hs{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,C,O){const A=this.options,{x:T,y:L}=this.getProps(["x","y"],O);return Math.pow(t-T,2)+Math.pow(C-L,2)<Math.pow(A.hitRadius+A.radius,2)}inXRange(t,C){return oo(this,t,"x",C)}inYRange(t,C){return oo(this,t,"y",C)}getCenterPoint(t){const{x:C,y:O}=this.getProps(["x","y"],t);return{x:C,y:O}}size(t){let C=(t=t||this.options||{}).radius||0;return C=Math.max(C,C&&t.hoverRadius||0),2*(C+(C&&t.borderWidth||0))}draw(t,C){const O=this.options;this.skip||O.radius<.1||!Re(this,C,this.size(O)/2)||(t.strokeStyle=O.borderColor,t.lineWidth=O.borderWidth,t.fillStyle=O.backgroundColor,Le(t,O,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});function go(t,C,O,A){const T=t.indexOf(C);return-1===T?((t,C,O,A)=>("string"==typeof C?(O=t.push(C)-1,A.unshift({index:O,label:C})):isNaN(C)&&(O=null),O))(t,C,O,A):T!==t.lastIndexOf(C)?O:T}function po(t){const C=this.getLabels();return t>=0&&t<C.length?C[t]:t}function mo(t,C,{horizontal:O,minRotation:A}){const T=$(A),L=(O?Math.sin(T):Math.cos(T))||.001,E=.75*C*(""+t).length;return Math.min(C/L,E)}class xo extends Js{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,C){return s(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:C,maxDefined:O}=this.getUserBounds();let{min:A,max:T}=this;const o=t=>A=C?A:t,a=t=>T=O?T:t;if(t){const t=ht(A),C=ht(T);t<0&&C<0?a(0):t>0&&C>0&&o(0)}if(A===T){let C=0===T?1:Math.abs(.05*T);a(T+C),t||o(A-C)}this.min=A,this.max=T}getTickLimit(){const t=this.options.ticks;let C,{maxTicksLimit:O,stepSize:A}=t;return A?(C=Math.ceil(this.max/A)-Math.floor(this.min/A)+1,C>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${A} would result generating up to ${C} ticks. Limiting to 1000.`),C=1e3)):(C=this.computeTickLimit(),O=O||11),O&&(C=Math.min(O,C)),C}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,C=t.ticks;let O=this.getTickLimit();O=Math.max(2,O);const A=function(t,C){const O=[],{bounds:A,step:T,min:L,max:E,precision:R,count:I,maxTicks:F,maxDigits:z,includeBounds:ot}=t,ht=T||1,bt=F-1,{min:St,max:Pt}=C,Tt=!s(L),Nt=!s(E),Ht=!s(I),Wt=(Pt-St)/(z+1);let $t,ee,ie,se,oe=B((Pt-St)/bt/ht)*ht;if(oe<1e-14&&!Tt&&!Nt)return[{value:St},{value:Pt}];se=Math.ceil(Pt/oe)-Math.floor(St/oe),se>bt&&(oe=B(se*oe/bt/ht)*ht),s(R)||($t=Math.pow(10,R),oe=Math.ceil(oe*$t)/$t),"ticks"===A?(ee=Math.floor(St/oe)*oe,ie=Math.ceil(Pt/oe)*oe):(ee=St,ie=Pt),Tt&&Nt&&T&&H((E-L)/T,oe/1e3)?(se=Math.round(Math.min((E-L)/oe,F)),oe=(E-L)/se,ee=L,ie=E):Ht?(ee=Tt?L:ee,ie=Nt?E:ie,se=I-1,oe=(ie-ee)/se):(se=(ie-ee)/oe,se=V(se,Math.round(se),oe/1e3)?Math.round(se):Math.ceil(se));const ae=Math.max(U(oe),U(ee));$t=Math.pow(10,s(R)?ae:R),ee=Math.round(ee*$t)/$t,ie=Math.round(ie*$t)/$t;let re=0;for(Tt&&(ot&&ee!==L?(O.push({value:L}),ee<L&&re++,V(Math.round((ee+re*oe)*$t)/$t,L,mo(L,Wt,t))&&re++):ee<L&&re++);re<se;++re){const t=Math.round((ee+re*oe)*$t)/$t;if(Nt&&t>E)break;O.push({value:t})}return Nt&&ot&&ie!==E?O.length&&V(O[O.length-1].value,E,mo(E,Wt,t))?O[O.length-1].value=E:O.push({value:E}):Nt&&ie!==E||O.push({value:ie}),O}({maxTicks:O,bounds:t.bounds,min:t.min,max:t.max,precision:C.precision,step:C.stepSize,count:C.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:C.minRotation||0,includeBounds:!1!==C.includeBounds},this._range||this);return"ticks"===t.bounds&&j(A,this,"value"),t.reverse?(A.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),A}configure(){const t=this.ticks;let C=this.min,O=this.max;if(super.configure(),this.options.offset&&t.length){const A=(O-C)/Math.max(t.length-1,1)/2;C-=A,O+=A}this._startValue=C,this._endValue=O,this._valueRange=O-C}getLabelForValue(t){return ne(t,this.chart.options.locale,this.options.ticks.format)}}class bo extends xo{static id="linear";static defaults={ticks:{callback:le.formatters.numeric}};determineDataLimits(){const{min:t,max:C}=this.getMinMax(!0);this.min=a(t)?t:0,this.max=a(C)?C:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),C=t?this.width:this.height,O=$(this.options.ticks.minRotation),A=(t?Math.sin(O):Math.cos(O))||.001,T=this._resolveTickFontOptions(0);return Math.ceil(C/Math.min(40,T.lineHeight/A))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const _o=t=>Math.floor(ot(t)),yo=(t,C)=>Math.pow(10,_o(t)+C);function vo(t){return 1===t/Math.pow(10,_o(t))}function Mo(t,C,O){const A=Math.pow(10,O),T=Math.floor(t/A);return Math.ceil(C/A)-T}function wo(t,{min:C,max:O}){C=r(t.min,C);const A=[],T=_o(C);let L=function(t,C){let O=_o(C-t);for(;Mo(t,C,O)>10;)O++;for(;Mo(t,C,O)<10;)O--;return Math.min(O,_o(t))}(C,O),E=L<0?Math.pow(10,Math.abs(L)):1;const R=Math.pow(10,L),I=T>L?Math.pow(10,T):0,F=Math.round((C-I)*E)/E,z=Math.floor((C-I)/R/10)*R*10;let ot=Math.floor((F-z)/Math.pow(10,L)),ht=r(t.min,Math.round((I+z+ot*Math.pow(10,L))*E)/E);for(;ht<O;)A.push({value:ht,major:vo(ht),significand:ot}),ot>=10?ot=ot<15?15:20:ot++,ot>=20&&(L++,ot=2,E=L>=0?1:E),ht=Math.round((I+z+ot*Math.pow(10,L))*E)/E;const bt=r(t.max,ht);return A.push({value:bt,major:vo(bt),significand:ot}),A}class ko extends Js{static id="logarithmic";static defaults={ticks:{callback:le.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,C){const O=xo.prototype.parse.apply(this,[t,C]);if(0!==O)return a(O)&&O>0?O:null;this._zero=!0}determineDataLimits(){const{min:t,max:C}=this.getMinMax(!0);this.min=a(t)?Math.max(0,t):null,this.max=a(C)?Math.max(0,C):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!a(this._userMin)&&(this.min=t===yo(this.min,0)?yo(this.min,-1):yo(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:C}=this.getUserBounds();let O=this.min,A=this.max;const n=C=>O=t?O:C,o=t=>A=C?A:t;O===A&&(O<=0?(n(1),o(10)):(n(yo(O,-1)),o(yo(A,1)))),O<=0&&n(yo(A,-1)),A<=0&&o(yo(O,1)),this.min=O,this.max=A}buildTicks(){const t=this.options,C=wo({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&j(C,this,"value"),t.reverse?(C.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),C}getLabelForValue(t){return void 0===t?"0":ne(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=ot(t),this._valueRange=ot(this.max)-ot(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ot(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const C=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+C*this._valueRange)}}function So(t){const C=t.ticks;if(C.display&&t.display){const t=ki(C.backdropPadding);return l(C.font&&C.font.size,Se.font.size)+t.height}return 0}function Po(t,C,O,A,T){return t===A||t===T?{start:C-O/2,end:C+O/2}:t<A||t>T?{start:C-O,end:C}:{start:C,end:C+O}}function Do(t){const C={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},O=Object.assign({},C),T=[],L=[],E=t._pointLabels.length,R=t.options.pointLabels,I=R.centerPointLabels?A/E:0;for(let A=0;A<E;A++){const E=R.setContext(t.getPointLabelContext(A));L[A]=E.padding;const ht=t.getPointPosition(A,t.drawingArea+L[A],I),bt=Si(E.font),St=(F=t.ctx,z=bt,ot=n(ot=t._pointLabels[A])?ot:[ot],{w:Oe(F,z.string,ot),h:ot.length*z.lineHeight});T[A]=St;const Pt=G(t.getIndexAngle(A)+I),Tt=Math.round(Y(Pt));Co(O,C,Pt,Po(Tt,ht.x,St.w,0,180),Po(Tt,ht.y,St.h,90,270))}var F,z,ot;t.setCenterPoint(C.l-O.l,O.r-C.r,C.t-O.t,O.b-C.b),t._pointLabelItems=function(t,C,O){const T=[],L=t._pointLabels.length,E=t.options,{centerPointLabels:R,display:I}=E.pointLabels,F={extra:So(E)/2,additionalAngle:R?A/L:0};let z;for(let A=0;A<L;A++){F.padding=O[A],F.size=C[A];const L=Oo(t,A,F);T.push(L),"auto"===I&&(L.visible=Ao(L,z),L.visible&&(z=L))}return T}(t,T,L)}function Co(t,C,O,A,T){const L=Math.abs(Math.sin(O)),E=Math.abs(Math.cos(O));let R=0,I=0;A.start<C.l?(R=(C.l-A.start)/L,t.l=Math.min(t.l,C.l-R)):A.end>C.r&&(R=(A.end-C.r)/L,t.r=Math.max(t.r,C.r+R)),T.start<C.t?(I=(C.t-T.start)/E,t.t=Math.min(t.t,C.t-I)):T.end>C.b&&(I=(T.end-C.b)/E,t.b=Math.max(t.b,C.b+I))}function Oo(t,C,O){const A=t.drawingArea,{extra:T,additionalAngle:L,padding:E,size:R}=O,F=t.getPointPosition(C,A+T+E,L),z=Math.round(Y(G(F.angle+I))),ot=function(t,C,O){return 90===O||270===O?t-=C/2:(O>270||O<90)&&(t-=C),t}(F.y,R.h,z),ht=function(t){return 0===t||180===t?"center":t<180?"left":"right"}(z),bt=function(t,C,O){return"right"===O?t-=C:"center"===O&&(t-=C/2),t}(F.x,R.w,ht);return{visible:!0,x:F.x,y:ot,textAlign:ht,left:bt,top:ot,right:bt+R.w,bottom:ot+R.h}}function Ao(t,C){if(!C)return!0;const{left:O,top:A,right:T,bottom:L}=t;return!(Re({x:O,y:A},C)||Re({x:O,y:L},C)||Re({x:T,y:A},C)||Re({x:T,y:L},C))}function To(t,C,O){const{left:A,top:T,right:L,bottom:E}=O,{backdropColor:R}=C;if(!s(R)){const O=wi(C.borderRadius),I=ki(C.backdropPadding);t.fillStyle=R;const F=A-I.left,z=T-I.top,ot=L-A+I.width,ht=E-T+I.height;Object.values(O).some(t=>0!==t)?(t.beginPath(),He(t,{x:F,y:z,w:ot,h:ht,radius:O}),t.fill()):t.fillRect(F,z,ot,ht)}}function Lo(t,C,O,A){const{ctx:L}=t;if(O)L.arc(t.xCenter,t.yCenter,C,0,T);else{let O=t.getPointPosition(0,C);L.moveTo(O.x,O.y);for(let T=1;T<A;T++)O=t.getPointPosition(T,C),L.lineTo(O.x,O.y)}}class Eo extends xo{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:le.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=ki(So(this.options)/2),C=this.width=this.maxWidth-t.width,O=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+C/2+t.left),this.yCenter=Math.floor(this.top+O/2+t.top),this.drawingArea=Math.floor(Math.min(C,O)/2)}determineDataLimits(){const{min:t,max:C}=this.getMinMax(!1);this.min=a(t)&&!isNaN(t)?t:0,this.max=a(C)&&!isNaN(C)?C:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/So(this.options))}generateTickLabels(t){xo.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((t,C)=>{const O=d(this.options.pointLabels.callback,[t,C],this);return O||0===O?O:""}).filter((t,C)=>this.chart.getDataVisibility(C))}fit(){const t=this.options;t.display&&t.pointLabels.display?Do(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,C,O,A){this.xCenter+=Math.floor((t-C)/2),this.yCenter+=Math.floor((O-A)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,C,O,A))}getIndexAngle(t){return G(t*(T/(this._pointLabels.length||1))+$(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(s(t))return NaN;const C=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*C:(t-this.min)*C}getValueForDistanceFromCenter(t){if(s(t))return NaN;const C=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-C:this.min+C}getPointLabelContext(t){const C=this._pointLabels||[];if(t>=0&&t<C.length){const O=C[t];return function(t,C,O){return Ci(t,{label:O,index:C,type:"pointLabel"})}(this.getContext(),t,O)}}getPointPosition(t,C,O=0){const A=this.getIndexAngle(t)-I+O;return{x:Math.cos(A)*C+this.xCenter,y:Math.sin(A)*C+this.yCenter,angle:A}}getPointPositionForValue(t,C){return this.getPointPosition(t,this.getDistanceFromCenterForValue(C))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:C,top:O,right:A,bottom:T}=this._pointLabelItems[t];return{left:C,top:O,right:A,bottom:T}}drawBackground(){const{backgroundColor:t,grid:{circular:C}}=this.options;if(t){const O=this.ctx;O.save(),O.beginPath(),Lo(this,this.getDistanceFromCenterForValue(this._endValue),C,this._pointLabels.length),O.closePath(),O.fillStyle=t,O.fill(),O.restore()}}drawGrid(){const t=this.ctx,C=this.options,{angleLines:O,grid:A,border:T}=C,L=this._pointLabels.length;let E,R,I;if(C.pointLabels.display&&function(t,C){const{ctx:O,options:{pointLabels:A}}=t;for(let T=C-1;T>=0;T--){const C=t._pointLabelItems[T];if(!C.visible)continue;const L=A.setContext(t.getPointLabelContext(T));To(O,L,C);const E=Si(L.font),{x:R,y:I,textAlign:F}=C;Ne(O,t._pointLabels[T],R,I+E.lineHeight/2,E,{color:L.color,textAlign:F,textBaseline:"middle"})}}(this,L),A.display&&this.ticks.forEach((t,C)=>{if(0!==C||0===C&&this.min<0){R=this.getDistanceFromCenterForValue(t.value);const O=this.getContext(C),E=A.setContext(O),I=T.setContext(O);!function(t,C,O,A,T){const L=t.ctx,E=C.circular,{color:R,lineWidth:I}=C;!E&&!A||!R||!I||O<0||(L.save(),L.strokeStyle=R,L.lineWidth=I,L.setLineDash(T.dash),L.lineDashOffset=T.dashOffset,L.beginPath(),Lo(t,O,E,A),L.closePath(),L.stroke(),L.restore())}(this,E,R,L,I)}}),O.display){for(t.save(),E=L-1;E>=0;E--){const A=O.setContext(this.getPointLabelContext(E)),{color:T,lineWidth:L}=A;L&&T&&(t.lineWidth=L,t.strokeStyle=T,t.setLineDash(A.borderDash),t.lineDashOffset=A.borderDashOffset,R=this.getDistanceFromCenterForValue(C.ticks.reverse?this.min:this.max),I=this.getPointPosition(E,R),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(I.x,I.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,C=this.options,O=C.ticks;if(!O.display)return;const A=this.getIndexAngle(0);let T,L;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(A),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((A,E)=>{if(0===E&&this.min>=0&&!C.reverse)return;const R=O.setContext(this.getContext(E)),I=Si(R.font);if(T=this.getDistanceFromCenterForValue(this.ticks[E].value),R.showLabelBackdrop){t.font=I.string,L=t.measureText(A.label).width,t.fillStyle=R.backdropColor;const C=ki(R.backdropPadding);t.fillRect(-L/2-C.left,-T-I.size/2-C.top,L+C.width,I.size+C.height)}Ne(t,A.label,0,-T,I,{color:R.color,strokeColor:R.textStrokeColor,strokeWidth:R.textStrokeWidth})}),t.restore()}drawTitle(){}}const jo={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}},$o=Object.keys(jo);function zo(t,C){return t-C}function Fo(t,C){if(s(C))return null;const O=t._adapter,{parser:A,round:T,isoWeekday:L}=t._parseOpts;let E=C;return"function"==typeof A&&(E=A(E)),a(E)||(E="string"==typeof A?O.parse(E,A):O.parse(E)),null===E?null:(T&&(E="week"!==T||!N(L)&&!0!==L?O.startOf(E,T):O.startOf(E,"isoWeek",L)),+E)}function Vo(t,C,O,A){const T=$o.length;for(let L=$o.indexOf(t);L<T-1;++L){const t=jo[$o[L]],T=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((O-C)/(T*t.size))<=A)return $o[L]}return $o[T-1]}function Bo(t,C,O){if(O){if(O.length){const{lo:A,hi:T}=et(O,C);t[O[A]>=C?O[A]:O[T]]=!0}}else t[C]=!0}function Wo(t,C,O){const A=[],T={},L=C.length;let E,R;for(E=0;E<L;++E)R=C[E],T[R]=E,A.push({value:R,major:!1});return 0!==L&&O?function(t,C,O,A){const T=t._adapter,L=+T.startOf(C[0].value,A),E=C[C.length-1].value;let R,I;for(R=L;R<=E;R=+T.add(R,1,A))I=O[R],I>=0&&(C[I].major=!0);return C}(t,A,T,O):A}class No extends Js{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,C={}){const O=t.time||(t.time={}),A=this._adapter=new io._date(t.adapters.date);A.init(C),b(O.displayFormats,A.formats()),this._parseOpts={parser:O.parser,round:O.round,isoWeekday:O.isoWeekday},super.init(t),this._normalized=C.normalized}parse(t,C){return void 0===t?null:Fo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,C=this._adapter,O=t.time.unit||"day";let{min:A,max:T,minDefined:L,maxDefined:E}=this.getUserBounds();function l(t){L||isNaN(t.min)||(A=Math.min(A,t.min)),E||isNaN(t.max)||(T=Math.max(T,t.max))}L&&E||(l(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||l(this.getMinMax(!1))),A=a(A)&&!isNaN(A)?A:+C.startOf(Date.now(),O),T=a(T)&&!isNaN(T)?T:+C.endOf(Date.now(),O)+1,this.min=Math.min(A,T-1),this.max=Math.max(A+1,T)}_getLabelBounds(){const t=this.getLabelTimestamps();let C=Number.POSITIVE_INFINITY,O=Number.NEGATIVE_INFINITY;return t.length&&(C=t[0],O=t[t.length-1]),{min:C,max:O}}buildTicks(){const t=this.options,C=t.time,O=t.ticks,A="labels"===O.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&A.length&&(this.min=this._userMin||A[0],this.max=this._userMax||A[A.length-1]);const T=this.min,L=nt(A,T,this.max);return this._unit=C.unit||(O.autoSkip?Vo(C.minUnit,this.min,this.max,this._getLabelCapacity(T)):function(t,C,O,A,T){for(let L=$o.length-1;L>=$o.indexOf(O);L--){const O=$o[L];if(jo[O].common&&t._adapter.diff(T,A,O)>=C-1)return O}return $o[O?$o.indexOf(O):0]}(this,L.length,C.minUnit,this.min,this.max)),this._majorUnit=O.major.enabled&&"year"!==this._unit?function(t){for(let C=$o.indexOf(t)+1,O=$o.length;C<O;++C)if(jo[$o[C]].common)return $o[C]}(this._unit):void 0,this.initOffsets(A),t.reverse&&L.reverse(),Wo(this,L,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let C,O,A=0,T=0;this.options.offset&&t.length&&(C=this.getDecimalForValue(t[0]),A=1===t.length?1-C:(this.getDecimalForValue(t[1])-C)/2,O=this.getDecimalForValue(t[t.length-1]),T=1===t.length?O:(O-this.getDecimalForValue(t[t.length-2]))/2);const L=t.length<3?.5:.25;A=J(A,0,L),T=J(T,0,L),this._offsets={start:A,end:T,factor:1/(A+1+T)}}_generate(){const t=this._adapter,C=this.min,O=this.max,A=this.options,T=A.time,L=T.unit||Vo(T.minUnit,C,O,this._getLabelCapacity(C)),E=l(A.ticks.stepSize,1),R="week"===L&&T.isoWeekday,I=N(R)||!0===R,F={};let z,ot,ht=C;if(I&&(ht=+t.startOf(ht,"isoWeek",R)),ht=+t.startOf(ht,I?"day":L),t.diff(O,C,L)>1e5*E)throw new Error(C+" and "+O+" are too far apart with stepSize of "+E+" "+L);const bt="data"===A.ticks.source&&this.getDataTimestamps();for(z=ht,ot=0;z<O;z=+t.add(z,E,L),ot++)Bo(F,z,bt);return z!==O&&"ticks"!==A.bounds&&1!==ot||Bo(F,z,bt),Object.keys(F).sort(zo).map(t=>+t)}getLabelForValue(t){const C=this._adapter,O=this.options.time;return O.tooltipFormat?C.format(t,O.tooltipFormat):C.format(t,O.displayFormats.datetime)}format(t,C){const O=this.options.time.displayFormats,A=this._unit,T=C||O[A];return this._adapter.format(t,T)}_tickFormatFunction(t,C,O,A){const T=this.options,L=T.ticks.callback;if(L)return d(L,[t,C,O],this);const E=T.time.displayFormats,R=this._unit,I=this._majorUnit,F=R&&E[R],z=I&&E[I],ot=O[C],ht=I&&z&&ot&&ot.major;return this._adapter.format(t,A||(ht?z:F))}generateTickLabels(t){let C,O,A;for(C=0,O=t.length;C<O;++C)A=t[C],A.label=this._tickFormatFunction(A.value,C,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const C=this._offsets,O=this.getDecimalForValue(t);return this.getPixelForDecimal((C.start+O)*C.factor)}getValueForPixel(t){const C=this._offsets,O=this.getDecimalForPixel(t)/C.factor-C.end;return this.min+O*(this.max-this.min)}_getLabelSize(t){const C=this.options.ticks,O=this.ctx.measureText(t).width,A=$(this.isHorizontal()?C.maxRotation:C.minRotation),T=Math.cos(A),L=Math.sin(A),E=this._resolveTickFontOptions(0).size;return{w:O*T+E*L,h:O*L+E*T}}_getLabelCapacity(t){const C=this.options.time,O=C.displayFormats,A=O[C.unit]||O.millisecond,T=this._tickFormatFunction(t,0,Wo(this,[t],this._majorUnit),A),L=this._getLabelSize(T),E=Math.floor(this.isHorizontal()?this.width/L.w:this.height/L.h)-1;return E>0?E:1}getDataTimestamps(){let t,C,O=this._cache.data||[];if(O.length)return O;const A=this.getMatchingVisibleMetas();if(this._normalized&&A.length)return this._cache.data=A[0].controller.getAllParsedValues(this);for(t=0,C=A.length;t<C;++t)O=O.concat(A[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(O)}getLabelTimestamps(){const t=this._cache.labels||[];let C,O;if(t.length)return t;const A=this.getLabels();for(C=0,O=A.length;C<O;++C)t.push(Fo(this,A[C]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return lt(t.sort(zo))}}function Ho(t,C,O){let A,T,L,E,R=0,I=t.length-1;O?(C>=t[R].pos&&C<=t[I].pos&&({lo:R,hi:I}=it(t,"pos",C)),({pos:A,time:L}=t[R]),({pos:T,time:E}=t[I])):(C>=t[R].time&&C<=t[I].time&&({lo:R,hi:I}=it(t,"time",C)),({time:A,pos:L}=t[R]),({time:T,pos:E}=t[I]));const F=T-A;return F?L+(E-L)*(C-A)/F:L}var Yo=Object.freeze({__proto__:null,CategoryScale:class extends Js{static id="category";static defaults={ticks:{callback:po}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const C=this._addedLabels;if(C.length){const t=this.getLabels();for(const{index:O,label:A}of C)t[O]===A&&t.splice(O,1);this._addedLabels=[]}super.init(t)}parse(t,C){if(s(t))return null;const O=this.getLabels();return((t,C)=>null===t?null:J(Math.round(t),0,C))(C=isFinite(C)&&O[C]===t?C:go(O,t,l(C,t),this._addedLabels),O.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:C}=this.getUserBounds();let{min:O,max:A}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(O=0),C||(A=this.getLabels().length-1)),this.min=O,this.max=A}buildTicks(){const t=this.min,C=this.max,O=this.options.offset,A=[];let T=this.getLabels();T=0===t&&C===T.length-1?T:T.slice(t,C+1),this._valueRange=Math.max(T.length-(O?0:1),1),this._startValue=this.min-(O?.5:0);for(let O=t;O<=C;O++)A.push({value:O});return A}getLabelForValue(t){return po.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const C=this.ticks;return t<0||t>C.length-1?null:this.getPixelForValue(C[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:bo,LogarithmicScale:ko,RadialLinearScale:Eo,TimeScale:No,TimeSeriesScale:class extends No{static id="timeseries";static defaults=No.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),C=this._table=this.buildLookupTable(t);this._minPos=Ho(C,this.min),this._tableRange=Ho(C,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:C,max:O}=this,A=[],T=[];let L,E,R,I,F;for(L=0,E=t.length;L<E;++L)I=t[L],I>=C&&I<=O&&A.push(I);if(A.length<2)return[{time:C,pos:0},{time:O,pos:1}];for(L=0,E=A.length;L<E;++L)F=A[L+1],R=A[L-1],I=A[L],Math.round((F+R)/2)!==I&&T.push({time:I,pos:L/(E-1)});return T}_generate(){const t=this.min,C=this.max;let O=super.getDataTimestamps();return O.includes(t)&&O.length||O.splice(0,0,t),O.includes(C)&&1!==O.length||O.push(C),O.sort((t,C)=>t-C)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const C=this.getDataTimestamps(),O=this.getLabelTimestamps();return t=C.length&&O.length?this.normalize(C.concat(O)):C.length?C:O,t=this._cache.all=t,t}getDecimalForValue(t){return(Ho(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const C=this._offsets,O=this.getDecimalForPixel(t)/C.factor-C.end;return Ho(this._table,O*this._tableRange+this._minPos,!0)}}});const Go=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Qo=Go.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function Uo(t){return Go[t%Go.length]}function Xo(t){return Qo[t%Qo.length]}function qo(t){let C=0;return(O,A)=>{const T=t.getDatasetMeta(A).controller;T instanceof jn?C=function(t,C){return t.backgroundColor=t.data.map(()=>Uo(C++)),C}(O,C):T instanceof $n?C=function(t,C){return t.backgroundColor=t.data.map(()=>Xo(C++)),C}(O,C):T&&(C=function(t,C){return t.borderColor=Uo(C),t.backgroundColor=Xo(C),++C}(O,C))}}function Ko(t){let C;for(C in t)if(t[C].borderColor||t[C].backgroundColor)return!0;return!1}var ma={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,C,O){if(!O.enabled)return;const{data:{datasets:A},options:T}=t.config,{elements:L}=T;if(!O.forceOverride&&(Ko(A)||(E=T)&&(E.borderColor||E.backgroundColor)||L&&Ko(L)))return;var E;const R=qo(t);A.forEach(R)}};function Zo(t){if(t._decimated){const C=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:C})}}function Jo(t){t.data.datasets.forEach(t=>{Zo(t)})}var ya={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,C,O)=>{if(!O.enabled)return void Jo(t);const A=t.width;t.data.datasets.forEach((C,T)=>{const{_data:L,indexAxis:E}=C,R=t.getDatasetMeta(T),I=L||C.data;if("y"===Pi([E,t.options.indexAxis]))return;if(!R.controller.supportsDecimation)return;const F=t.scales[R.xAxisID];if("linear"!==F.type&&"time"!==F.type)return;if(t.options.parsing)return;let z,{start:ot,count:ht}=function(t,C){const O=C.length;let A,T=0;const{iScale:L}=t,{min:E,max:R,minDefined:I,maxDefined:F}=L.getUserBounds();return I&&(T=J(it(C,L.axis,E).lo,0,O-1)),A=F?J(it(C,L.axis,R).hi+1,T,O)-T:O-T,{start:T,count:A}}(R,I);if(ht<=(O.threshold||4*A))Zo(C);else{switch(s(L)&&(C._data=I,delete C.data,Object.defineProperty(C,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),O.algorithm){case"lttb":z=function(t,C,O,A,T){const L=T.samples||A;if(L>=O)return t.slice(C,C+O);const E=[],R=(O-2)/(L-2);let I=0;const F=C+O-1;let z,ot,ht,bt,St,Pt=C;for(E[I++]=t[Pt],z=0;z<L-2;z++){let A,T=0,L=0;const F=Math.floor((z+1)*R)+1+C,Tt=Math.min(Math.floor((z+2)*R)+1,O)+C,Nt=Tt-F;for(A=F;A<Tt;A++)T+=t[A].x,L+=t[A].y;T/=Nt,L/=Nt;const Ht=Math.floor(z*R)+1+C,Wt=Math.min(Math.floor((z+1)*R)+1,O)+C,{x:$t,y:ee}=t[Pt];for(ht=bt=-1,A=Ht;A<Wt;A++)bt=.5*Math.abs(($t-T)*(t[A].y-ee)-($t-t[A].x)*(L-ee)),bt>ht&&(ht=bt,ot=t[A],St=A);E[I++]=ot,Pt=St}return E[I++]=t[F],E}(I,ot,ht,A,O);break;case"min-max":z=function(t,C,O,A){let T,L,E,R,I,F,z,ot,ht,bt,St=0,Pt=0;const Tt=[],Nt=C+O-1,Ht=t[C].x,Wt=t[Nt].x-Ht;for(T=C;T<C+O;++T){L=t[T],E=(L.x-Ht)/Wt*A,R=L.y;const C=0|E;if(C===I)R<ht?(ht=R,F=T):R>bt&&(bt=R,z=T),St=(Pt*St+L.x)/++Pt;else{const O=T-1;if(!s(F)&&!s(z)){const C=Math.min(F,z),A=Math.max(F,z);C!==ot&&C!==O&&Tt.push({...t[C],x:St}),A!==ot&&A!==O&&Tt.push({...t[A],x:St})}T>0&&O!==ot&&Tt.push(t[O]),Tt.push(L),I=C,Pt=0,ht=bt=R,F=z=ot=T}}return Tt}(I,ot,ht,A);break;default:throw new Error(`Unsupported decimation algorithm '${O.algorithm}'`)}C._decimated=z}})},destroy(t){Jo(t)}};function ta(t,C,O,A){if(A)return;let T=C[t],L=O[t];return"angle"===t&&(T=G(T),L=G(L)),{property:t,start:T,end:L}}function ea(t,C,O){for(;C>t;C--){const t=O[C];if(!isNaN(t.x)&&!isNaN(t.y))break}return C}function ia(t,C,O,A){return t&&C?A(t[O],C[O]):t?t[O]:C?C[O]:0}function sa(t,C){let O=[],A=!1;return n(t)?(A=!0,O=t):O=function(t,C){const{x:O=null,y:A=null}=t||{},T=C.points,L=[];return C.segments.forEach(({start:t,end:C})=>{C=ea(t,C,T);const E=T[t],R=T[C];null!==A?(L.push({x:E.x,y:A}),L.push({x:R.x,y:A})):null!==O&&(L.push({x:O,y:E.y}),L.push({x:O,y:R.y}))}),L}(t,C),O.length?new no({points:O,options:{tension:0},_loop:A,_fullLoop:A}):null}function na(t){return t&&!1!==t.fill}function oa(t,C,O){let A=t[C].fill;const T=[C];let L;if(!O)return A;for(;!1!==A&&-1===T.indexOf(A);){if(!a(A))return A;if(L=t[A],!L)return!1;if(L.visible)return A;T.push(A),A=L.fill}return!1}function aa(t,C,O){const A=function(t){const C=t.options,O=C.fill;let A=l(O&&O.target,O);return void 0===A&&(A=!!C.backgroundColor),!1!==A&&null!==A&&(!0===A?"origin":A)}(t);if(o(A))return!isNaN(A.value)&&A;let T=parseFloat(A);return a(T)&&Math.floor(T)===T?function(t,C,O,A){return"-"!==t&&"+"!==t||(O=C+O),!(O===C||O<0||O>=A)&&O}(A[0],C,T,O):["origin","start","end","stack","shape"].indexOf(A)>=0&&A}function ra(t,C,O){const A=[];for(let T=0;T<O.length;T++){const L=O[T],{first:E,last:R,point:I}=la(L,C,"x");if(!(!I||E&&R))if(E)A.unshift(I);else if(t.push(I),!R)break}t.push(...A)}function la(t,C,O){const A=t.interpolate(C,O);if(!A)return{};const T=A[O],L=t.segments,E=t.points;let R=!1,I=!1;for(let t=0;t<L.length;t++){const C=L[t],A=E[C.start][O],F=E[C.end][O];if(tt(T,A,F)){R=T===A,I=T===F;break}}return{first:R,last:I,point:A}}class ha{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,C,O){const{x:A,y:L,radius:E}=this;return C=C||{start:0,end:T},t.arc(A,L,E,C.end,C.start,!0),!O.bounds}interpolate(t){const{x:C,y:O,radius:A}=this,T=t.angle;return{x:C+Math.cos(T)*A,y:O+Math.sin(T)*A,angle:T}}}function ca(t){const{chart:C,fill:O,line:A}=t;if(a(O))return function(t,C){const O=t.getDatasetMeta(C);return O&&t.isDatasetVisible(C)?O.dataset:null}(C,O);if("stack"===O)return function(t){const{scale:C,index:O,line:A}=t,T=[],L=A.segments,E=A.points,R=function(t,C){const O=[],A=t.getMatchingVisibleMetas("line");for(let t=0;t<A.length;t++){const T=A[t];if(T.index===C)break;T.hidden||O.unshift(T.dataset)}return O}(C,O);R.push(sa({x:null,y:C.bottom},A));for(let t=0;t<L.length;t++){const C=L[t];for(let t=C.start;t<=C.end;t++)ra(T,E[t],R)}return new no({points:T,options:{}})}(t);if("shape"===O)return!0;const T=function(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:C,fill:O}=t,A=C.options,T=C.getLabels().length,L=A.reverse?C.max:C.min,E=function(t,C,O){let A;return A="start"===t?O:"end"===t?C.options.reverse?C.min:C.max:o(t)?t.value:C.getBaseValue(),A}(O,C,L),R=[];if(A.grid.circular){const t=C.getPointPositionForValue(0,L);return new ha({x:t.x,y:t.y,radius:C.getDistanceFromCenterForValue(E)})}for(let t=0;t<T;++t)R.push(C.getPointPositionForValue(t,E));return R}(t):function(t){const{scale:C={},fill:O}=t,A=function(t,C){let O=null;return"start"===t?O=C.bottom:"end"===t?O=C.top:o(t)?O=C.getPixelForValue(t.value):C.getBasePixel&&(O=C.getBasePixel()),O}(O,C);if(a(A)){const t=C.isHorizontal();return{x:t?A:null,y:t?null:A}}return null}(t)}(t);return T instanceof ha?T:sa(T,A)}function da(t,C,O){const A=ca(C),{line:T,scale:L,axis:E}=C,R=T.options,I=R.fill,F=R.backgroundColor,{above:z=F,below:ot=F}=I||{};A&&T.points.length&&(Ie(t,O),function(t,C){const{line:O,target:A,above:T,below:L,area:E,scale:R}=C,I=O._loop?"angle":C.axis;t.save(),"x"===I&&L!==T&&(ua(t,A,E.top),fa(t,{line:O,target:A,color:T,scale:R,property:I}),t.restore(),t.save(),ua(t,A,E.bottom)),fa(t,{line:O,target:A,color:L,scale:R,property:I}),t.restore()}(t,{line:T,target:A,above:z,below:ot,area:O,scale:L,axis:E}),ze(t))}function ua(t,C,O){const{segments:A,points:T}=C;let L=!0,E=!1;t.beginPath();for(const R of A){const{start:A,end:I}=R,F=T[A],z=T[ea(A,I,T)];L?(t.moveTo(F.x,F.y),L=!1):(t.lineTo(F.x,O),t.lineTo(F.x,F.y)),E=!!C.pathSegment(t,R,{move:E}),E?t.closePath():t.lineTo(z.x,O)}t.lineTo(C.first().x,O),t.closePath(),t.clip()}function fa(t,C){const{line:O,target:A,property:T,color:L,scale:E}=C,R=function(t,C,O){const A=t.segments,T=t.points,L=C.points,E=[];for(const t of A){let{start:A,end:R}=t;R=ea(A,R,T);const I=ta(O,T[A],T[R],t.loop);if(!C.segments){E.push({source:t,target:I,start:T[A],end:T[R]});continue}const F=Ii(C,I);for(const C of F){const A=ta(O,L[C.start],L[C.end],C.loop),R=Ri(t,T,A);for(const t of R)E.push({source:t,target:C,start:{[O]:ia(I,A,"start",Math.max)},end:{[O]:ia(I,A,"end",Math.min)}})}}return E}(O,A,T);for(const{source:C,target:I,start:F,end:z}of R){const{style:{backgroundColor:R=L}={}}=C,ot=!0!==A;t.save(),t.fillStyle=R,ga(t,E,ot&&ta(T,F,z)),t.beginPath();const ht=!!O.pathSegment(t,C);let bt;if(ot){ht?t.closePath():pa(t,A,z,T);const C=!!A.pathSegment(t,I,{move:ht,reverse:!0});bt=ht&&C,bt||pa(t,A,F,T)}t.closePath(),t.fill(bt?"evenodd":"nonzero"),t.restore()}}function ga(t,C,O){const{top:A,bottom:T}=C.chart.chartArea,{property:L,start:E,end:R}=O||{};"x"===L&&(t.beginPath(),t.rect(E,A,R-E,T-A),t.clip())}function pa(t,C,O,A){const T=C.interpolate(O,A);T&&t.lineTo(T.x,T.y)}var Ma={id:"filler",afterDatasetsUpdate(t,C,O){const A=(t.data.datasets||[]).length,T=[];let L,E,R,I;for(E=0;E<A;++E)L=t.getDatasetMeta(E),R=L.dataset,I=null,R&&R.options&&R instanceof no&&(I={visible:t.isDatasetVisible(E),index:E,fill:aa(R,E,A),chart:t,axis:L.controller.options.indexAxis,scale:L.vScale,line:R}),L.$filler=I,T.push(I);for(E=0;E<A;++E)I=T[E],I&&!1!==I.fill&&(I.fill=oa(T,E,O.propagate))},beforeDraw(t,C,O){const A="beforeDraw"===O.drawTime,T=t.getSortedVisibleDatasetMetas(),L=t.chartArea;for(let C=T.length-1;C>=0;--C){const O=T[C].$filler;O&&(O.line.updateControlPoints(L,O.axis),A&&O.fill&&da(t.ctx,O,L))}},beforeDatasetsDraw(t,C,O){if("beforeDatasetsDraw"!==O.drawTime)return;const A=t.getSortedVisibleDatasetMetas();for(let C=A.length-1;C>=0;--C){const O=A[C].$filler;na(O)&&da(t.ctx,O,t.chartArea)}},beforeDatasetDraw(t,C,O){const A=C.meta.$filler;na(A)&&"beforeDatasetDraw"===O.drawTime&&da(t.ctx,A,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const xa=(t,C)=>{let{boxHeight:O=C,boxWidth:A=C}=t;return t.usePointStyle&&(O=Math.min(O,C),A=t.pointStyleWidth||Math.min(A,C)),{boxWidth:A,boxHeight:O,itemHeight:Math.max(C,O)}};class ba extends Hs{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,C,O){this.maxWidth=t,this.maxHeight=C,this._margins=O,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let C=d(t.generateLabels,[this.chart],this)||[];t.filter&&(C=C.filter(C=>t.filter(C,this.chart.data))),t.sort&&(C=C.sort((C,O)=>t.sort(C,O,this.chart.data))),this.options.reverse&&C.reverse(),this.legendItems=C}fit(){const{options:t,ctx:C}=this;if(!t.display)return void(this.width=this.height=0);const O=t.labels,A=Si(O.font),T=A.size,L=this._computeTitleHeight(),{boxWidth:E,itemHeight:R}=xa(O,T);let I,F;C.font=A.string,this.isHorizontal()?(I=this.maxWidth,F=this._fitRows(L,T,E,R)+10):(F=this.maxHeight,I=this._fitCols(L,A,E,R)+10),this.width=Math.min(I,t.maxWidth||this.maxWidth),this.height=Math.min(F,t.maxHeight||this.maxHeight)}_fitRows(t,C,O,A){const{ctx:T,maxWidth:L,options:{labels:{padding:E}}}=this,R=this.legendHitBoxes=[],I=this.lineWidths=[0],F=A+E;let z=t;T.textAlign="left",T.textBaseline="middle";let ot=-1,ht=-F;return this.legendItems.forEach((t,bt)=>{const St=O+C/2+T.measureText(t.text).width;(0===bt||I[I.length-1]+St+2*E>L)&&(z+=F,I[I.length-(bt>0?0:1)]=0,ht+=F,ot++),R[bt]={left:0,top:ht,row:ot,width:St,height:A},I[I.length-1]+=St+E}),z}_fitCols(t,C,O,A){const{ctx:T,maxHeight:L,options:{labels:{padding:E}}}=this,R=this.legendHitBoxes=[],I=this.columnSizes=[],F=L-t;let z=E,ot=0,ht=0,bt=0,St=0;return this.legendItems.forEach((t,L)=>{const{itemWidth:Pt,itemHeight:Tt}=function(t,C,O,A,T){const L=function(t,C,O,A){let T=t.text;return T&&"string"!=typeof T&&(T=T.reduce((t,C)=>t.length>C.length?t:C)),C+O.size/2+A.measureText(T).width}(A,t,C,O),E=function(t,C,O){let A=t;return"string"!=typeof C.text&&(A=_a(C,O)),A}(T,A,C.lineHeight);return{itemWidth:L,itemHeight:E}}(O,C,T,t,A);L>0&&ht+Tt+2*E>F&&(z+=ot+E,I.push({width:ot,height:ht}),bt+=ot+E,St++,ot=ht=0),R[L]={left:bt,top:ht,col:St,width:Pt,height:Tt},ot=Math.max(ot,Pt),ht+=Tt+E}),z+=ot,I.push({width:ot,height:ht}),z}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:C,options:{align:O,labels:{padding:A},rtl:T}}=this,L=Oi(T,this.left,this.width);if(this.isHorizontal()){let T=0,E=ft(O,this.left+A,this.right-this.lineWidths[T]);for(const R of C)T!==R.row&&(T=R.row,E=ft(O,this.left+A,this.right-this.lineWidths[T])),R.top+=this.top+t+A,R.left=L.leftForLtr(L.x(E),R.width),E+=R.width+A}else{let T=0,E=ft(O,this.top+t+A,this.bottom-this.columnSizes[T].height);for(const R of C)R.col!==T&&(T=R.col,E=ft(O,this.top+t+A,this.bottom-this.columnSizes[T].height)),R.top=E,R.left+=this.left+A,R.left=L.leftForLtr(L.x(R.left),R.width),E+=R.height+A}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Ie(t,this),this._draw(),ze(t)}}_draw(){const{options:t,columnSizes:C,lineWidths:O,ctx:A}=this,{align:T,labels:L}=t,E=Se.color,R=Oi(t.rtl,this.left,this.width),I=Si(L.font),{padding:F}=L,z=I.size,ot=z/2;let ht;this.drawTitle(),A.textAlign=R.textAlign("left"),A.textBaseline="middle",A.lineWidth=.5,A.font=I.string;const{boxWidth:bt,boxHeight:St,itemHeight:Pt}=xa(L,z),Tt=this.isHorizontal(),Nt=this._computeTitleHeight();ht=Tt?{x:ft(T,this.left+F,this.right-O[0]),y:this.top+F+Nt,line:0}:{x:this.left+F,y:ft(T,this.top+Nt+F,this.bottom-C[0].height),line:0},Ai(this.ctx,t.textDirection);const Ht=Pt+F;this.legendItems.forEach((Wt,$t)=>{A.strokeStyle=Wt.fontColor,A.fillStyle=Wt.fontColor;const ee=A.measureText(Wt.text).width,ie=R.textAlign(Wt.textAlign||(Wt.textAlign=L.textAlign)),se=bt+ot+ee;let oe=ht.x,ae=ht.y;if(R.setWidth(this.width),Tt?$t>0&&oe+se+F>this.right&&(ae=ht.y+=Ht,ht.line++,oe=ht.x=ft(T,this.left+F,this.right-O[ht.line])):$t>0&&ae+Ht>this.bottom&&(oe=ht.x=oe+C[ht.line].width+F,ht.line++,ae=ht.y=ft(T,this.top+Nt+F,this.bottom-C[ht.line].height)),function(t,C,O){if(isNaN(bt)||bt<=0||isNaN(St)||St<0)return;A.save();const T=l(O.lineWidth,1);if(A.fillStyle=l(O.fillStyle,E),A.lineCap=l(O.lineCap,"butt"),A.lineDashOffset=l(O.lineDashOffset,0),A.lineJoin=l(O.lineJoin,"miter"),A.lineWidth=T,A.strokeStyle=l(O.strokeStyle,E),A.setLineDash(l(O.lineDash,[])),L.usePointStyle){const E={radius:St*Math.SQRT2/2,pointStyle:O.pointStyle,rotation:O.rotation,borderWidth:T},I=R.xPlus(t,bt/2);Ee(A,E,I,C+ot,L.pointStyleWidth&&bt)}else{const L=C+Math.max((z-St)/2,0),E=R.leftForLtr(t,bt),I=wi(O.borderRadius);A.beginPath(),Object.values(I).some(t=>0!==t)?He(A,{x:E,y:L,w:bt,h:St,radius:I}):A.rect(E,L,bt,St),A.fill(),0!==T&&A.stroke()}A.restore()}(R.x(oe),ae,Wt),oe=gt(ie,oe+bt+ot,Tt?oe+se:this.right,t.rtl),function(t,C,O){Ne(A,O.text,t,C+Pt/2,I,{strikethrough:O.hidden,textAlign:R.textAlign(O.textAlign)})}(R.x(oe),ae,Wt),Tt)ht.x+=se+F;else if("string"!=typeof Wt.text){const t=I.lineHeight;ht.y+=_a(Wt,t)+F}else ht.y+=Ht}),Ti(this.ctx,t.textDirection)}drawTitle(){const t=this.options,C=t.title,O=Si(C.font),A=ki(C.padding);if(!C.display)return;const T=Oi(t.rtl,this.left,this.width),L=this.ctx,E=C.position,R=O.size/2,I=A.top+R;let F,z=this.left,ot=this.width;if(this.isHorizontal())ot=Math.max(...this.lineWidths),F=this.top+I,z=ft(t.align,z,this.right-ot);else{const C=this.columnSizes.reduce((t,C)=>Math.max(t,C.height),0);F=I+ft(t.align,this.top,this.bottom-C-t.labels.padding-this._computeTitleHeight())}const ht=ft(E,z,z+ot);L.textAlign=T.textAlign(ut(E)),L.textBaseline="middle",L.strokeStyle=C.color,L.fillStyle=C.color,L.font=O.string,Ne(L,C.text,ht,F,O)}_computeTitleHeight(){const t=this.options.title,C=Si(t.font),O=ki(t.padding);return t.display?C.lineHeight+O.height:0}_getLegendItemAt(t,C){let O,A,T;if(tt(t,this.left,this.right)&&tt(C,this.top,this.bottom))for(T=this.legendHitBoxes,O=0;O<T.length;++O)if(A=T[O],tt(t,A.left,A.left+A.width)&&tt(C,A.top,A.top+A.height))return this.legendItems[O];return null}handleEvent(t){const C=this.options;if(!function(t,C){return!("mousemove"!==t&&"mouseout"!==t||!C.onHover&&!C.onLeave)||!(!C.onClick||"click"!==t&&"mouseup"!==t)}(t.type,C))return;const O=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const L=this._hoveredItem,E=(T=O,null!==(A=L)&&null!==T&&A.datasetIndex===T.datasetIndex&&A.index===T.index);L&&!E&&d(C.onLeave,[t,L,this],this),this._hoveredItem=O,O&&!E&&d(C.onHover,[t,O,this],this)}else O&&d(C.onClick,[t,O,this],this);var A,T}}function _a(t,C){return C*(t.text?t.text.length:0)}var wa={id:"legend",_element:ba,start(t,C,O){const A=t.legend=new ba({ctx:t.ctx,options:O,chart:t});cs.configure(t,A,O),cs.addBox(t,A)},stop(t){cs.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,C,O){const A=t.legend;cs.configure(t,A,O),A.options=O},afterUpdate(t){const C=t.legend;C.buildLabels(),C.adjustHitBoxes()},afterEvent(t,C){C.replay||t.legend.handleEvent(C.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,C,O){const A=C.datasetIndex,T=O.chart;T.isDatasetVisible(A)?(T.hide(A),C.hidden=!0):(T.show(A),C.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const C=t.data.datasets,{labels:{usePointStyle:O,pointStyle:A,textAlign:T,color:L,useBorderRadius:E,borderRadius:R}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{const I=t.controller.getStyle(O?0:void 0),F=ki(I.borderWidth);return{text:C[t.index].label,fillStyle:I.backgroundColor,fontColor:L,hidden:!t.visible,lineCap:I.borderCapStyle,lineDash:I.borderDash,lineDashOffset:I.borderDashOffset,lineJoin:I.borderJoinStyle,lineWidth:(F.width+F.height)/4,strokeStyle:I.borderColor,pointStyle:A||I.pointStyle,rotation:I.rotation,textAlign:T||I.textAlign,borderRadius:E&&(R||I.borderRadius),datasetIndex:t.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class va extends Hs{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,C){const O=this.options;if(this.left=0,this.top=0,!O.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=C;const A=n(O.text)?O.text.length:1;this._padding=ki(O.padding);const T=A*Si(O.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=T:this.width=T}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:C,left:O,bottom:T,right:L,options:E}=this,R=E.align;let I,F,z,ot=0;return this.isHorizontal()?(F=ft(R,O,L),z=C+t,I=L-O):("left"===E.position?(F=O+t,z=ft(R,T,C),ot=-.5*A):(F=L-t,z=ft(R,C,T),ot=.5*A),I=T-C),{titleX:F,titleY:z,maxWidth:I,rotation:ot}}draw(){const t=this.ctx,C=this.options;if(!C.display)return;const O=Si(C.font),A=O.lineHeight/2+this._padding.top,{titleX:T,titleY:L,maxWidth:E,rotation:R}=this._drawArgs(A);Ne(t,C.text,0,0,O,{color:C.color,maxWidth:E,rotation:R,textAlign:ut(C.align),textBaseline:"middle",translation:[T,L]})}}var ka={id:"title",_element:va,start(t,C,O){!function(t,C){const O=new va({ctx:t.ctx,options:C,chart:t});cs.configure(t,O,C),cs.addBox(t,O),t.titleBlock=O}(t,O)},stop(t){const C=t.titleBlock;cs.removeBox(t,C),delete t.titleBlock},beforeUpdate(t,C,O){const A=t.titleBlock;cs.configure(t,A,O),A.options=O},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Sa=new WeakMap;var za={id:"subtitle",start(t,C,O){const A=new va({ctx:t.ctx,options:O,chart:t});cs.configure(t,A,O),cs.addBox(t,A),Sa.set(t,A)},stop(t){cs.removeBox(t,Sa.get(t)),Sa.delete(t)},beforeUpdate(t,C,O){const A=Sa.get(t);cs.configure(t,A,O),A.options=O},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ba={average(t){if(!t.length)return!1;let C,O,A=new Set,T=0,L=0;for(C=0,O=t.length;C<O;++C){const O=t[C].element;if(O&&O.hasValue()){const t=O.tooltipPosition();A.add(t.x),T+=t.y,++L}}return{x:[...A].reduce((t,C)=>t+C)/A.size,y:T/L}},nearest(t,C){if(!t.length)return!1;let O,A,T,L=C.x,E=C.y,R=Number.POSITIVE_INFINITY;for(O=0,A=t.length;O<A;++O){const A=t[O].element;if(A&&A.hasValue()){const t=q(C,A.getCenterPoint());t<R&&(R=t,T=A)}}if(T){const t=T.tooltipPosition();L=t.x,E=t.y}return{x:L,y:E}}};function Pa(t,C){return C&&(n(C)?Array.prototype.push.apply(t,C):t.push(C)),t}function Da(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Ca(t,C){const{element:O,datasetIndex:A,index:T}=C,L=t.getDatasetMeta(A).controller,{label:E,value:R}=L.getLabelAndValue(T);return{chart:t,label:E,parsed:L.getParsed(T),raw:t.data.datasets[A].data[T],formattedValue:R,dataset:L.getDataset(),dataIndex:T,datasetIndex:A,element:O}}function Oa(t,C){const O=t.chart.ctx,{body:A,footer:T,title:L}=t,{boxWidth:E,boxHeight:R}=C,I=Si(C.bodyFont),F=Si(C.titleFont),z=Si(C.footerFont),ot=L.length,ht=T.length,bt=A.length,St=ki(C.padding);let Pt=St.height,Tt=0,Nt=A.reduce((t,C)=>t+C.before.length+C.lines.length+C.after.length,0);Nt+=t.beforeBody.length+t.afterBody.length,ot&&(Pt+=ot*F.lineHeight+(ot-1)*C.titleSpacing+C.titleMarginBottom),Nt&&(Pt+=bt*(C.displayColors?Math.max(R,I.lineHeight):I.lineHeight)+(Nt-bt)*I.lineHeight+(Nt-1)*C.bodySpacing),ht&&(Pt+=C.footerMarginTop+ht*z.lineHeight+(ht-1)*C.footerSpacing);let Ht=0;const y=function(t){Tt=Math.max(Tt,O.measureText(t).width+Ht)};return O.save(),O.font=F.string,u(t.title,y),O.font=I.string,u(t.beforeBody.concat(t.afterBody),y),Ht=C.displayColors?E+2+C.boxPadding:0,u(A,t=>{u(t.before,y),u(t.lines,y),u(t.after,y)}),Ht=0,O.font=z.string,u(t.footer,y),O.restore(),Tt+=St.width,{width:Tt,height:Pt}}function Aa(t,C,O,A){const{x:T,width:L}=O,{width:E,chartArea:{left:R,right:I}}=t;let F="center";return"center"===A?F=T<=(R+I)/2?"left":"right":T<=L/2?F="left":T>=E-L/2&&(F="right"),function(t,C,O,A){const{x:T,width:L}=A,E=O.caretSize+O.caretPadding;return"left"===t&&T+L+E>C.width||"right"===t&&T-L-E<0||void 0}(F,t,C,O)&&(F="center"),F}function Ta(t,C,O){const A=O.yAlign||C.yAlign||function(t,C){const{y:O,height:A}=C;return O<A/2?"top":O>t.height-A/2?"bottom":"center"}(t,O);return{xAlign:O.xAlign||C.xAlign||Aa(t,C,O,A),yAlign:A}}function La(t,C,O,A){const{caretSize:T,caretPadding:L,cornerRadius:E}=t,{xAlign:R,yAlign:I}=O,F=T+L,{topLeft:z,topRight:ot,bottomLeft:ht,bottomRight:bt}=wi(E);let St=function(t,C){let{x:O,width:A}=t;return"right"===C?O-=A:"center"===C&&(O-=A/2),O}(C,R);const Pt=function(t,C,O){let{y:A,height:T}=t;return"top"===C?A+=O:A-="bottom"===C?T+O:T/2,A}(C,I,F);return"center"===I?"left"===R?St+=F:"right"===R&&(St-=F):"left"===R?St-=Math.max(z,ht)+T:"right"===R&&(St+=Math.max(ot,bt)+T),{x:J(St,0,A.width-C.width),y:J(Pt,0,A.height-C.height)}}function Ea(t,C,O){const A=ki(O.padding);return"center"===C?t.x+t.width/2:"right"===C?t.x+t.width-A.right:t.x+A.left}function Ra(t){return Pa([],Da(t))}function Ia(t,C){const O=C&&C.dataset&&C.dataset.tooltip&&C.dataset.tooltip.callbacks;return O?t.override(O):t}const Na={beforeTitle:e,title(t){if(t.length>0){const C=t[0],O=C.chart.data.labels,A=O?O.length:0;if(this&&this.options&&"dataset"===this.options.mode)return C.dataset.label||"";if(C.label)return C.label;if(A>0&&C.dataIndex<A)return O[C.dataIndex]}return""},afterTitle:e,beforeBody:e,beforeLabel:e,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let C=t.dataset.label||"";C&&(C+=": ");const O=t.formattedValue;return s(O)||(C+=O),C},labelColor(t){const C=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:C.borderColor,backgroundColor:C.backgroundColor,borderWidth:C.borderWidth,borderDash:C.borderDash,borderDashOffset:C.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const C=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:C.pointStyle,rotation:C.rotation}},afterLabel:e,afterBody:e,beforeFooter:e,footer:e,afterFooter:e};function Fa(t,C,O,A){const T=t[C].call(O,A);return void 0===T?Na[C].call(O,A):T}class Va extends Hs{static positioners=Ba;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const C=this.chart,O=this.options.setContext(this.getContext()),A=O.enabled&&C.options.animation&&O.animations,T=new Os(this.chart,A);return A._cacheable&&(this._cachedAnimations=Object.freeze(T)),T}getContext(){return this.$context||(this.$context=Ci(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"}))}getTitle(t,C){const{callbacks:O}=C,A=Fa(O,"beforeTitle",this,t),T=Fa(O,"title",this,t),L=Fa(O,"afterTitle",this,t);let E=[];return E=Pa(E,Da(A)),E=Pa(E,Da(T)),E=Pa(E,Da(L)),E}getBeforeBody(t,C){return Ra(Fa(C.callbacks,"beforeBody",this,t))}getBody(t,C){const{callbacks:O}=C,A=[];return u(t,t=>{const C={before:[],lines:[],after:[]},T=Ia(O,t);Pa(C.before,Da(Fa(T,"beforeLabel",this,t))),Pa(C.lines,Fa(T,"label",this,t)),Pa(C.after,Da(Fa(T,"afterLabel",this,t))),A.push(C)}),A}getAfterBody(t,C){return Ra(Fa(C.callbacks,"afterBody",this,t))}getFooter(t,C){const{callbacks:O}=C,A=Fa(O,"beforeFooter",this,t),T=Fa(O,"footer",this,t),L=Fa(O,"afterFooter",this,t);let E=[];return E=Pa(E,Da(A)),E=Pa(E,Da(T)),E=Pa(E,Da(L)),E}_createItems(t){const C=this._active,O=this.chart.data,A=[],T=[],L=[];let E,R,I=[];for(E=0,R=C.length;E<R;++E)I.push(Ca(this.chart,C[E]));return t.filter&&(I=I.filter((C,A,T)=>t.filter(C,A,T,O))),t.itemSort&&(I=I.sort((C,A)=>t.itemSort(C,A,O))),u(I,C=>{const O=Ia(t.callbacks,C);A.push(Fa(O,"labelColor",this,C)),T.push(Fa(O,"labelPointStyle",this,C)),L.push(Fa(O,"labelTextColor",this,C))}),this.labelColors=A,this.labelPointStyles=T,this.labelTextColors=L,this.dataPoints=I,I}update(t,C){const O=this.options.setContext(this.getContext()),A=this._active;let T,L=[];if(A.length){const t=Ba[O.position].call(this,A,this._eventPosition);L=this._createItems(O),this.title=this.getTitle(L,O),this.beforeBody=this.getBeforeBody(L,O),this.body=this.getBody(L,O),this.afterBody=this.getAfterBody(L,O),this.footer=this.getFooter(L,O);const C=this._size=Oa(this,O),E=Object.assign({},t,C),R=Ta(this.chart,O,E),I=La(O,E,R,this.chart);this.xAlign=R.xAlign,this.yAlign=R.yAlign,T={opacity:1,x:I.x,y:I.y,width:C.width,height:C.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(T={opacity:0});this._tooltipItems=L,this.$context=void 0,T&&this._resolveAnimations().update(this,T),t&&O.external&&O.external.call(this,{chart:this.chart,tooltip:this,replay:C})}drawCaret(t,C,O,A){const T=this.getCaretPosition(t,O,A);C.lineTo(T.x1,T.y1),C.lineTo(T.x2,T.y2),C.lineTo(T.x3,T.y3)}getCaretPosition(t,C,O){const{xAlign:A,yAlign:T}=this,{caretSize:L,cornerRadius:E}=O,{topLeft:R,topRight:I,bottomLeft:F,bottomRight:z}=wi(E),{x:ot,y:ht}=t,{width:bt,height:St}=C;let Pt,Tt,Nt,Ht,Wt,$t;return"center"===T?(Wt=ht+St/2,"left"===A?(Pt=ot,Tt=Pt-L,Ht=Wt+L,$t=Wt-L):(Pt=ot+bt,Tt=Pt+L,Ht=Wt-L,$t=Wt+L),Nt=Pt):(Tt="left"===A?ot+Math.max(R,F)+L:"right"===A?ot+bt-Math.max(I,z)-L:this.caretX,"top"===T?(Ht=ht,Wt=Ht-L,Pt=Tt-L,Nt=Tt+L):(Ht=ht+St,Wt=Ht+L,Pt=Tt+L,Nt=Tt-L),$t=Ht),{x1:Pt,x2:Tt,x3:Nt,y1:Ht,y2:Wt,y3:$t}}drawTitle(t,C,O){const A=this.title,T=A.length;let L,E,R;if(T){const I=Oi(O.rtl,this.x,this.width);for(t.x=Ea(this,O.titleAlign,O),C.textAlign=I.textAlign(O.titleAlign),C.textBaseline="middle",L=Si(O.titleFont),E=O.titleSpacing,C.fillStyle=O.titleColor,C.font=L.string,R=0;R<T;++R)C.fillText(A[R],I.x(t.x),t.y+L.lineHeight/2),t.y+=L.lineHeight+E,R+1===T&&(t.y+=O.titleMarginBottom-E)}}_drawColorBox(t,C,O,A,T){const L=this.labelColors[O],E=this.labelPointStyles[O],{boxHeight:R,boxWidth:I}=T,F=Si(T.bodyFont),z=Ea(this,"left",T),ot=A.x(z),ht=R<F.lineHeight?(F.lineHeight-R)/2:0,bt=C.y+ht;if(T.usePointStyle){const C={radius:Math.min(I,R)/2,pointStyle:E.pointStyle,rotation:E.rotation,borderWidth:1},O=A.leftForLtr(ot,I)+I/2,F=bt+R/2;t.strokeStyle=T.multiKeyBackground,t.fillStyle=T.multiKeyBackground,Le(t,C,O,F),t.strokeStyle=L.borderColor,t.fillStyle=L.backgroundColor,Le(t,C,O,F)}else{t.lineWidth=o(L.borderWidth)?Math.max(...Object.values(L.borderWidth)):L.borderWidth||1,t.strokeStyle=L.borderColor,t.setLineDash(L.borderDash||[]),t.lineDashOffset=L.borderDashOffset||0;const C=A.leftForLtr(ot,I),O=A.leftForLtr(A.xPlus(ot,1),I-2),E=wi(L.borderRadius);Object.values(E).some(t=>0!==t)?(t.beginPath(),t.fillStyle=T.multiKeyBackground,He(t,{x:C,y:bt,w:I,h:R,radius:E}),t.fill(),t.stroke(),t.fillStyle=L.backgroundColor,t.beginPath(),He(t,{x:O,y:bt+1,w:I-2,h:R-2,radius:E}),t.fill()):(t.fillStyle=T.multiKeyBackground,t.fillRect(C,bt,I,R),t.strokeRect(C,bt,I,R),t.fillStyle=L.backgroundColor,t.fillRect(O,bt+1,I-2,R-2))}t.fillStyle=this.labelTextColors[O]}drawBody(t,C,O){const{body:A}=this,{bodySpacing:T,bodyAlign:L,displayColors:E,boxHeight:R,boxWidth:I,boxPadding:F}=O,z=Si(O.bodyFont);let ot=z.lineHeight,ht=0;const bt=Oi(O.rtl,this.x,this.width),p=function(O){C.fillText(O,bt.x(t.x+ht),t.y+ot/2),t.y+=ot+T},St=bt.textAlign(L);let Pt,Tt,Nt,Ht,Wt,$t,ee;for(C.textAlign=L,C.textBaseline="middle",C.font=z.string,t.x=Ea(this,St,O),C.fillStyle=O.bodyColor,u(this.beforeBody,p),ht=E&&"right"!==St?"center"===L?I/2+F:I+2+F:0,Ht=0,$t=A.length;Ht<$t;++Ht){for(Pt=A[Ht],Tt=this.labelTextColors[Ht],C.fillStyle=Tt,u(Pt.before,p),Nt=Pt.lines,E&&Nt.length&&(this._drawColorBox(C,t,Ht,bt,O),ot=Math.max(z.lineHeight,R)),Wt=0,ee=Nt.length;Wt<ee;++Wt)p(Nt[Wt]),ot=z.lineHeight;u(Pt.after,p)}ht=0,ot=z.lineHeight,u(this.afterBody,p),t.y-=T}drawFooter(t,C,O){const A=this.footer,T=A.length;let L,E;if(T){const R=Oi(O.rtl,this.x,this.width);for(t.x=Ea(this,O.footerAlign,O),t.y+=O.footerMarginTop,C.textAlign=R.textAlign(O.footerAlign),C.textBaseline="middle",L=Si(O.footerFont),C.fillStyle=O.footerColor,C.font=L.string,E=0;E<T;++E)C.fillText(A[E],R.x(t.x),t.y+L.lineHeight/2),t.y+=L.lineHeight+O.footerSpacing}}drawBackground(t,C,O,A){const{xAlign:T,yAlign:L}=this,{x:E,y:R}=t,{width:I,height:F}=O,{topLeft:z,topRight:ot,bottomLeft:ht,bottomRight:bt}=wi(A.cornerRadius);C.fillStyle=A.backgroundColor,C.strokeStyle=A.borderColor,C.lineWidth=A.borderWidth,C.beginPath(),C.moveTo(E+z,R),"top"===L&&this.drawCaret(t,C,O,A),C.lineTo(E+I-ot,R),C.quadraticCurveTo(E+I,R,E+I,R+ot),"center"===L&&"right"===T&&this.drawCaret(t,C,O,A),C.lineTo(E+I,R+F-bt),C.quadraticCurveTo(E+I,R+F,E+I-bt,R+F),"bottom"===L&&this.drawCaret(t,C,O,A),C.lineTo(E+ht,R+F),C.quadraticCurveTo(E,R+F,E,R+F-ht),"center"===L&&"left"===T&&this.drawCaret(t,C,O,A),C.lineTo(E,R+z),C.quadraticCurveTo(E,R,E+z,R),C.closePath(),C.fill(),A.borderWidth>0&&C.stroke()}_updateAnimationTarget(t){const C=this.chart,O=this.$animations,A=O&&O.x,T=O&&O.y;if(A||T){const O=Ba[t.position].call(this,this._active,this._eventPosition);if(!O)return;const L=this._size=Oa(this,t),E=Object.assign({},O,this._size),R=Ta(C,t,E),I=La(t,E,R,C);A._to===I.x&&T._to===I.y||(this.xAlign=R.xAlign,this.yAlign=R.yAlign,this.width=L.width,this.height=L.height,this.caretX=O.x,this.caretY=O.y,this._resolveAnimations().update(this,I))}}_willRender(){return!!this.opacity}draw(t){const C=this.options.setContext(this.getContext());let O=this.opacity;if(!O)return;this._updateAnimationTarget(C);const A={width:this.width,height:this.height},T={x:this.x,y:this.y};O=Math.abs(O)<.001?0:O;const L=ki(C.padding),E=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;C.enabled&&E&&(t.save(),t.globalAlpha=O,this.drawBackground(T,t,A,C),Ai(t,C.textDirection),T.y+=L.top,this.drawTitle(T,t,C),this.drawBody(T,t,C),this.drawFooter(T,t,C),Ti(t,C.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,C){const O=this._active,A=t.map(({datasetIndex:t,index:C})=>{const O=this.chart.getDatasetMeta(t);if(!O)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:O.data[C],index:C}}),T=!f(O,A),L=this._positionChanged(A,C);(T||L)&&(this._active=A,this._eventPosition=C,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,C,O=!0){if(C&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const A=this.options,T=this._active||[],L=this._getActiveElements(t,T,C,O),E=this._positionChanged(L,t),R=C||!f(L,T)||E;return R&&(this._active=L,(A.enabled||A.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,C))),R}_getActiveElements(t,C,O,A){const T=this.options;if("mouseout"===t.type)return[];if(!A)return C.filter(t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index));const L=this.chart.getElementsAtEventForMode(t,T.mode,T,O);return T.reverse&&L.reverse(),L}_positionChanged(t,C){const{caretX:O,caretY:A,options:T}=this,L=Ba[T.position].call(this,t,C);return!1!==L&&(O!==L.x||A!==L.y)}}var Ha={id:"tooltip",_element:Va,positioners:Ba,afterInit(t,C,O){O&&(t.tooltip=new Va({chart:t,options:O}))},beforeUpdate(t,C,O){t.tooltip&&t.tooltip.initialize(O)},reset(t,C,O){t.tooltip&&t.tooltip.initialize(O)},afterDraw(t){const C=t.tooltip;if(C&&C._willRender()){const O={tooltip:C};if(!1===t.notifyPlugins("beforeTooltipDraw",{...O,cancelable:!0}))return;C.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",O)}},afterEvent(t,C){if(t.tooltip){const O=C.replay;t.tooltip.handleEvent(C.event,O,C.inChartArea)&&(C.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,C)=>C.bodyFont.size,boxWidth:(t,C)=>C.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Na},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};return An.register(fo,Yo,Io,t),An.helpers={...qi},An._adapters=io,An.Animation=Cs,An.Animations=Os,An.animator=Pt,An.controllers=gn.controllers.items,An.DatasetController=Ns,An.Element=Hs,An.elements=Io,An.Interaction=as,An.layouts=cs,An.platforms=Ds,An.Scale=Js,An.Ticks=le,Object.assign(An,fo,Yo,Io,t,Ds),An.Chart=An,"undefined"!=typeof window&&(window.Chart=An),An}());
/*!
 * Chart.js v4.4.3
 * https://www.chartjs.org
 * (c) 2024 Chart.js Contributors
 * Released under the MIT License
 */export{C as default};