-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path666.257e357e82ba204f.js
1 lines (1 loc) · 320 KB
/
666.257e357e82ba204f.js
1
"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[666],{7722:(Ie,Ut,H)=>{H.d(Ut,{G:()=>xt});var d=H(1635),A=H(1626),Z=H(5440),o=H(4419),_t=H(1148),Pt=H(4438);class xt{constructor(at){this.httpClient=at,this.headers=(new A.Lr).set("Content-Type","application/json"),this.apipatch="/patchs"}getPatchs(){return this.httpClient.get(`${Z.p}${this.apipatch}`)}static#t=this.\u0275fac=function(st){return new(st||xt)(Pt.KVO(A.Qq))};static#e=this.\u0275prov=Pt.jDH({token:xt,factory:xt.\u0275fac,providedIn:"root"})}(0,d.Cg)([(0,o.R)({storageStrategy:_t.G,maxAge:108e5,maxCacheCount:12})],xt.prototype,"getPatchs",null)},8608:(Ie,Ut,H)=>{H.d(Ut,{H:()=>A});var d=H(4438);let A=(()=>{class Z{setData(_t){this.data=_t}getData(){return this.data}static#t=this.\u0275fac=function(Pt){return new(Pt||Z)};static#e=this.\u0275prov=d.jDH({token:Z,factory:Z.\u0275fac,providedIn:"root"})}return Z})()},2427:(Ie,Ut,H)=>{H.d(Ut,{x:()=>xt});var d=H(1626),A=H(7673),Z=H(8141),o=H(9437),_t=H(5440),Pt=H(4438);let xt=(()=>{class Mt{constructor(st,it){this.httpClient=st,this.zone=it,this.cacheDuration=18e4,this.headers=(new d.Lr).set("Content-Type","application/json"),this.apiPlayers="/player/playerlist",this.apiPlayersActive="/player/playerlistactive",this.apiPlayersNameLike="/player/playerautocomplete",this.apileaderboardStats="/player/leaderboardstats",this.apiLeaderboard="/player/leaderboard",this.apiPlayerlistfull="/player/playerlistfull",this.apiPlayerlistElo="/player/getEloForList",this.cache={},this.localStorageKey="playersListTrunc"}getLeaderboard(st){const it=(new d.Nl).set("gameMode",st.toString()),lt={headers:this.headers,params:it},mt="getLeaderboard_"+st,Ot=this.localStorageKey+"_"+st,At=this.cache[mt];return this.isCacheExpired(st)?this.httpClient.get(_t.p+this.apiLeaderboard,lt).pipe((0,Z.M)(Gt=>{this.cache[mt]={data:Gt,expiry:new Date(Date.now()+this.cacheDuration)};const jt=Gt.slice(0,100),ee=Ot+"_expiration";localStorage.setItem(Ot,JSON.stringify(jt)),localStorage.setItem(ee,new Date(Date.now()+this.cacheDuration).toISOString())}),(0,o.W)(this.handleError)):(0,A.of)(At.data)}isCacheExpired(st){const lt=this.cache["getLeaderboard_"+st];return!lt||Date.now()>=lt.expiry.getTime()}handleError(st){let it="";return it=st.error instanceof ErrorEvent?"An error occurred: "+st.error.message:`Backend returned code ${st.status}: ${st.body}`,console.error(it),(0,A.of)([])}getLeaderboardList(st,it,lt,mt,Ot,At){let Gt=(new d.Nl).set("gameMode",st.toString()).set("search",it).set("page",lt.toString()).set("size",mt.toString()).set("sortField",Ot).set("sortOrder",At);return this.httpClient.get(_t.p+this.apiPlayers,{headers:this.headers,params:Gt})}getLeaderboardActiveList(st,it,lt,mt,Ot,At){let Gt=(new d.Nl).set("gameMode",st.toString()).set("search",it).set("page",lt.toString()).set("size",mt.toString()).set("orderBy",Ot).set("direction",At);return this.httpClient.get(_t.p+this.apiPlayersActive,{headers:this.headers,params:Gt})}getPlayerNameLikeList(st){let it=(new d.Nl).set("name",st.toString());return this.httpClient.get(_t.p+this.apiPlayersNameLike,{headers:this.headers,params:it})}getLeaderboardStats(st){let it=(new d.Nl).set("gameMode",st.toString());return this.httpClient.get(_t.p+this.apileaderboardStats,{headers:this.headers,params:it})}getPlayerList(){return this.httpClient.get(_t.p+this.apiPlayerlistfull,{headers:this.headers})}getEloForList(st,it){let lt=(new d.Nl).set("players",st.join(",")).set("gameMode",it);return this.httpClient.get(`${_t.p}${this.apiPlayerlistElo}`,{headers:this.headers,params:lt})}static#t=this.\u0275fac=function(it){return new(it||Mt)(Pt.KVO(d.Qq),Pt.KVO(Pt.SKi))};static#e=this.\u0275prov=Pt.jDH({token:Mt,factory:Mt.\u0275fac,providedIn:"root"})}return Mt})()},14:(Ie,Ut,H)=>{H.d(Ut,{$:()=>xt});var d=H(1635),A=H(1626),Z=H(5440),o=H(4419),_t=H(1148),Pt=H(4438);class xt{constructor(at,st){this.httpClient=at,this.zone=st,this.headers=(new A.Lr).set("Content-Type","application/json"),this.api="/games",this.apiAdvanced="/gamesAdvanced",this.apiAdvanced2="/gamesAdvanced2",this.apiAdvancedWins="/gamesAdvancedWins",this.apiAdvancedWins2="/gamesAdvancedWins2",this.apiName="/games_name",this.apiLastUpdate="/matchhistorylastupdatedate"}getMatchHistory(at,st,it,lt){let mt=(new A.Nl).set("playerId",at).set("gameMode",st).set("page",it.toString()).set("size",lt.toString());return this.httpClient.get(Z.p+this.api,{headers:this.headers,params:mt})}getMatchHistoryByName(at,st,it,lt,mt){let Ot=(new A.Nl).set("playerId",at).set("gameMode",st).set("name",it).set("page",lt.toString()).set("size",mt.toString());return this.httpClient.get(Z.p+this.apiName,{headers:this.headers,params:Ot})}getLastUpdate(){return this.httpClient.get(Z.p+this.apiLastUpdate,{headers:this.headers})}getMatchsAdvancedFilter(at,st,it,lt,mt,Ot,At,Gt,jt,ee,se,Yt,Ct,Wt,J,ot){let ct=(new A.Nl).set("gameMode",at).set("patch",st).set("eloMin",it).set("eloMax",lt).set("player1",mt).set("civ1",Ot).set("player2",At).set("team2",Gt).set("civ2",jt).set("player3",ee).set("team3",se).set("civ3",Yt).set("player4",Ct).set("team4",Wt).set("civ4",J).set("page",ot);return this.httpClient.get(Z.p+this.apiAdvanced2,{headers:this.headers,params:ct})}getMatchsAdvancedFilter2(at,st,it,lt,mt,Ot,At,Gt,jt,ee,se,Yt,Ct,Wt,J,ot,ct,kt,oe,ce,Zt,we){let _e=(new A.Nl).set("gameMode",at).set("patch",st).set("eloMin",it).set("eloMax",lt).set("player1",mt).set("civ1",Ot).set("player2",At).set("civ2",Gt).set("player3",jt).set("civ3",ee).set("player4",se).set("civ4",Yt).set("player5",Ct).set("civ5",Wt).set("player6",J).set("civ6",ot).set("player7",ct).set("civ7",kt).set("player8",oe).set("civ8",ce).set("page",Zt).set("size",we);return this.httpClient.get(Z.p+this.apiAdvanced2,{headers:this.headers,params:_e})}getMatchsAdvancedFilterWinCount(at,st,it,lt,mt,Ot,At,Gt,jt,ee,se,Yt,Ct,Wt,J){let ot=(new A.Nl).set("gameMode",at).set("patch",st).set("eloMin",it).set("eloMax",lt).set("player1",mt).set("civ1",Ot).set("player2",At).set("team2",Gt).set("civ2",jt).set("player3",ee).set("team3",se).set("civ3",Yt).set("player4",Ct).set("team4",Wt).set("civ4",J);return this.httpClient.get(Z.p+this.apiAdvancedWins,{headers:this.headers,params:ot})}getMatchsAdvancedFilterWinCount2(at,st,it,lt,mt,Ot,At,Gt,jt,ee,se,Yt,Ct,Wt,J,ot,ct,kt,oe,ce){let Zt=(new A.Nl).set("gameMode",at).set("patch",st).set("eloMin",it).set("eloMax",lt).set("player1",mt).set("civ1",Ot).set("player2",At).set("civ2",Gt).set("player3",jt).set("civ3",ee).set("player4",se).set("civ4",Yt).set("player5",Ct).set("civ5",Wt).set("player6",J).set("civ6",ot).set("player7",ct).set("civ7",kt).set("player8",oe).set("civ8",ce).set("civ4",Yt);return this.httpClient.get(Z.p+this.apiAdvancedWins2,{headers:this.headers,params:Zt})}static#t=this.\u0275fac=function(st){return new(st||xt)(Pt.KVO(A.Qq),Pt.KVO(Pt.SKi))};static#e=this.\u0275prov=Pt.jDH({token:xt,factory:xt.\u0275fac,providedIn:"root"})}(0,d.Cg)([(0,o.R)({storageStrategy:_t.G,maxAge:4e4,maxCacheCount:10})],xt.prototype,"getMatchHistory",null)},7097:(Ie,Ut,H)=>{H.d(Ut,{A:()=>Mi});var d=H(9763),A=H(6604),Z=H(141),o=function(){if(typeof window<"u"){if(window.devicePixelRatio)return window.devicePixelRatio;var C=window.screen;if(C)return(C.deviceXDPI||1)/(C.logicalXDPI||1)}return 1}(),_t_textSize=function(C,T,v){var K,M=[].concat(T),E=M.length,F=C.font,N=0;for(C.font=v.string,K=0;K<E;++K)N=Math.max(C.measureText(M[K]).width,N);return C.font=F,{height:E*v.lineHeight,width:N}};function Pt(C,T){var v=T.x,M=T.y;if(null===v)return{x:0,y:-1};if(null===M)return{x:1,y:0};var E=C.x-v,F=C.y-M,N=Math.sqrt(E*E+F*F);return{x:N?E/N:0,y:N?F/N:-1}}var Mt=0,at=1,st=2,it=4,lt=8;function mt(C,T,v){var M=Mt;return C<v.left?M|=at:C>v.right&&(M|=st),T<v.top?M|=lt:T>v.bottom&&(M|=it),M}function At(C,T){var E,F,v=T.anchor,M=C;return T.clamp&&(M=function Ot(C,T){for(var ut,ht,yt,v=C.x0,M=C.y0,E=C.x1,F=C.y1,N=mt(v,M,T),K=mt(E,F,T);N|K&&!(N&K);)(ut=N||K)<?(ht=v+(E-v)*(T.top-M)/(F-M),yt=T.top):ut&it?(ht=v+(E-v)*(T.bottom-M)/(F-M),yt=T.bottom):ut&st?(yt=M+(F-M)*(T.right-v)/(E-v),ht=T.right):ut&at&&(yt=M+(F-M)*(T.left-v)/(E-v),ht=T.left),ut===N?N=mt(v=ht,M=yt,T):K=mt(E=ht,F=yt,T);return{x0:v,x1:E,y0:M,y1:F}}(M,T.area)),"start"===v?(E=M.x0,F=M.y0):"end"===v?(E=M.x1,F=M.y1):(E=(M.x0+M.x1)/2,F=(M.y0+M.y1)/2),function xt(C,T,v,M,E){switch(E){case"center":v=M=0;break;case"bottom":v=0,M=1;break;case"right":v=1,M=0;break;case"left":v=-1,M=0;break;case"top":v=0,M=-1;break;case"start":v=-v,M=-M;break;case"end":break;default:E*=Math.PI/180,v=Math.cos(E),M=Math.sin(E)}return{x:C,y:T,vx:v,vy:M}}(E,F,C.vx,C.vy,T.align)}var Gt={arc:function(C,T){var v=(C.startAngle+C.endAngle)/2,M=Math.cos(v),E=Math.sin(v),F=C.innerRadius,N=C.outerRadius;return At({x0:C.x+M*F,y0:C.y+E*F,x1:C.x+M*N,y1:C.y+E*N,vx:M,vy:E},T)},point:function(C,T){var v=Pt(C,T.origin),M=v.x*C.options.radius,E=v.y*C.options.radius;return At({x0:C.x-M,y0:C.y-E,x1:C.x+M,y1:C.y+E,vx:v.x,vy:v.y},T)},bar:function(C,T){var v=Pt(C,T.origin),M=C.x,E=C.y,F=0,N=0;return C.horizontal?(M=Math.min(C.x,C.base),F=Math.abs(C.base-C.x)):(E=Math.min(C.y,C.base),N=Math.abs(C.base-C.y)),At({x0:M,y0:E+N,x1:M+F,y1:E,vx:v.x,vy:v.y},T)},fallback:function(C,T){var v=Pt(C,T.origin);return At({x0:C.x,y0:C.y,x1:C.x+(C.width||0),y1:C.y+(C.height||0),vx:v.x,vy:v.y},T)}},jt=function(C){return Math.round(C*o)/o};function se(C,T){var v=T.chart.getDatasetMeta(T.datasetIndex).vScale;if(!v)return null;if(void 0!==v.xCenter&&void 0!==v.yCenter)return{x:v.xCenter,y:v.yCenter};var M=v.getBasePixel();return C.horizontal?{x:M,y:null}:{x:null,y:M}}function Yt(C){return C instanceof d.Bs?Gt.arc:C instanceof d.FN?Gt.point:C instanceof d.E8?Gt.bar:Gt.fallback}function ot(C,T,v){var M=C.shadowBlur,E=v.stroked,F=jt(v.x),N=jt(v.y),K=jt(v.w);E&&C.strokeText(T,F,N,K),v.filled&&(M&&E&&(C.shadowBlur=0),C.fillText(T,F,N,K),M&&E&&(C.shadowBlur=M))}var kt=function(C,T,v,M){var E=this;E._config=C,E._index=M,E._model=null,E._rects=null,E._ctx=T,E._el=v};(0,Z.a4)(kt.prototype,{_modelize:function(C,T,v,M){var E=this,F=E._index,N=(0,Z.a0)((0,Z.a)([v.font,{}],M,F)),K=(0,Z.a)([v.color,Z.d.color],M,F);return{align:(0,Z.a)([v.align,"center"],M,F),anchor:(0,Z.a)([v.anchor,"center"],M,F),area:M.chart.chartArea,backgroundColor:(0,Z.a)([v.backgroundColor,null],M,F),borderColor:(0,Z.a)([v.borderColor,null],M,F),borderRadius:(0,Z.a)([v.borderRadius,0],M,F),borderWidth:(0,Z.a)([v.borderWidth,0],M,F),clamp:(0,Z.a)([v.clamp,!1],M,F),clip:(0,Z.a)([v.clip,!1],M,F),color:K,display:C,font:N,lines:T,offset:(0,Z.a)([v.offset,4],M,F),opacity:(0,Z.a)([v.opacity,1],M,F),origin:se(E._el,M),padding:(0,Z.E)((0,Z.a)([v.padding,4],M,F)),positioner:Yt(E._el),rotation:(0,Z.a)([v.rotation,0],M,F)*(Math.PI/180),size:_t_textSize(E._ctx,T,N),textAlign:(0,Z.a)([v.textAlign,"start"],M,F),textShadowBlur:(0,Z.a)([v.textShadowBlur,0],M,F),textShadowColor:(0,Z.a)([v.textShadowColor,K],M,F),textStrokeColor:(0,Z.a)([v.textStrokeColor,K],M,F),textStrokeWidth:(0,Z.a)([v.textStrokeWidth,0],M,F)}},update:function(C){var N,K,ut,T=this,v=null,M=null,E=T._index,F=T._config,ht=(0,Z.a)([F.display,!0],C,E);ht&&(K=(0,Z.v)((0,Z.Q)(F.formatter,[N=C.dataset.data[E],C]),N),(ut=(0,Z.k)(K)?[]:function(C){var v,T=[];for(C=[].concat(C);C.length;)"string"==typeof(v=C.pop())?T.unshift.apply(T,v.split("\n")):Array.isArray(v)?C.push.apply(C,v):(0,Z.k)(C)||T.unshift(""+v);return T}(K)).length&&(M=function ee(C){var T=C.borderWidth||0,v=C.padding,M=C.size.height,E=C.size.width,F=-E/2,N=-M/2;return{frame:{x:F-v.left-T,y:N-v.top-T,w:E+v.width+2*T,h:M+v.height+2*T},text:{x:F,y:N,w:E,h:M}}}(v=T._modelize(ht,ut,F,C)))),T._model=v,T._rects=M},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(C,T){var N,M=C.ctx,E=this._model,F=this._rects;this.visible()&&(M.save(),E.clip&&(N=E.area,M.beginPath(),M.rect(N.left,N.top,N.right-N.left,N.bottom-N.top),M.clip()),M.globalAlpha=function(C,T,v){return Math.max(C,Math.min(T,v))}(0,E.opacity,1),M.translate(jt(T.x),jt(T.y)),M.rotate(E.rotation),function Wt(C,T,v){var M=v.backgroundColor,E=v.borderColor,F=v.borderWidth;!M&&(!E||!F)||(C.beginPath(),function Ct(C,T,v,M,E,F){var N=Math.PI/2;if(F){var K=Math.min(F,E/2,M/2),ut=T+K,ht=v+K,yt=T+M-K,Lt=v+E-K;C.moveTo(T,ht),ut<yt&&ht<Lt?(C.arc(ut,ht,K,-Math.PI,-N),C.arc(yt,ht,K,-N,0),C.arc(yt,Lt,K,0,N),C.arc(ut,Lt,K,N,Math.PI)):ut<yt?(C.moveTo(ut,v),C.arc(yt,ht,K,-N,N),C.arc(ut,ht,K,N,Math.PI+N)):ht<Lt?(C.arc(ut,ht,K,-Math.PI,0),C.arc(ut,Lt,K,0,Math.PI)):C.arc(ut,ht,K,-Math.PI,Math.PI),C.closePath(),C.moveTo(T,v)}else C.rect(T,v,M,E)}(C,jt(T.x)+F/2,jt(T.y)+F/2,jt(T.w)-F,jt(T.h)-F,v.borderRadius),C.closePath(),M&&(C.fillStyle=M,C.fill()),E&&F&&(C.strokeStyle=E,C.lineWidth=F,C.lineJoin="miter",C.stroke()))}(M,F.frame,E),function ct(C,T,v,M){var Ft,E=M.textAlign,F=M.color,N=!!F,K=M.font,ut=T.length,ht=M.textStrokeColor,yt=M.textStrokeWidth,Lt=ht&&yt;if(ut&&(N||Lt))for(v=function J(C,T,v){var M=v.lineHeight,E=C.w,F=C.x;return"center"===T?F+=E/2:("end"===T||"right"===T)&&(F+=E),{h:M,w:E,x:F,y:C.y+M/2}}(v,E,K),C.font=K.string,C.textAlign=E,C.textBaseline="middle",C.shadowBlur=M.textShadowBlur,C.shadowColor=M.textShadowColor,N&&(C.fillStyle=F),Lt&&(C.lineJoin="round",C.lineWidth=yt,C.strokeStyle=ht),Ft=0,ut=T.length;Ft<ut;++Ft)ot(C,T[Ft],{stroked:Lt,filled:N,w:v.w,x:v.x,y:v.y+v.h*Ft})}(M,E.lines,F.text,E),M.restore())}});var oe=Number.MIN_SAFE_INTEGER||-9007199254740991,ce=Number.MAX_SAFE_INTEGER||9007199254740991;function Zt(C,T,v){var M=Math.cos(v),E=Math.sin(v),F=T.x,N=T.y;return{x:F+M*(C.x-F)-E*(C.y-N),y:N+E*(C.x-F)+M*(C.y-N)}}function we(C,T){var F,N,ht,v=ce,M=oe,E=T.origin;for(F=0;F<C.length;++F)ht=T.vx*((N=C[F]).x-E.x)+T.vy*(N.y-E.y),v=Math.min(v,ht),M=Math.max(M,ht);return{min:v,max:M}}function _e(C,T){var v=T.x-C.x,M=T.y-C.y,E=Math.sqrt(v*v+M*M);return{vx:(T.x-C.x)/E,vy:(T.y-C.y)/E,origin:C,ln:E}}var Ae=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function si(C,T,v){var M=T.positioner(C,T),E=M.vx,F=M.vy;if(!E&&!F)return{x:M.x,y:M.y};var N=v.w,K=v.h,ut=T.rotation,ht=Math.abs(N/2*Math.cos(ut))+Math.abs(K/2*Math.sin(ut)),yt=Math.abs(N/2*Math.sin(ut))+Math.abs(K/2*Math.cos(ut)),Lt=1/Math.max(Math.abs(E),Math.abs(F));return ht*=E*Lt,yt*=F*Lt,{x:M.x+(ht+=T.offset*E),y:M.y+(yt+=T.offset*F)}}(0,Z.a4)(Ae.prototype,{center:function(){var C=this._rect;return{x:C.x+C.w/2,y:C.y+C.h/2}},update:function(C,T,v){this._rotation=v,this._rect={x:T.x+C.x,y:T.y+C.y,w:T.w,h:T.h}},contains:function(C){var T=this,M=T._rect;return!((C=Zt(C,T.center(),-T._rotation)).x<M.x-1||C.y<M.y-1||C.x>M.x+M.w+2||C.y>M.y+M.h+2)},intersects:function(C){var E,F,N,T=this._points(),v=C._points(),M=[_e(T[0],T[1]),_e(T[0],T[3])];for(this._rotation!==C._rotation&&M.push(_e(v[0],v[1]),_e(v[0],v[3])),E=0;E<M.length;++E)if(F=we(T,M[E]),N=we(v,M[E]),F.max<N.min||N.max<F.min)return!1;return!0},_points:function(){var C=this,T=C._rect,v=C._rotation,M=C.center();return[Zt({x:T.x,y:T.y},M,v),Zt({x:T.x+T.w,y:T.y},M,v),Zt({x:T.x+T.w,y:T.y+T.h},M,v),Zt({x:T.x,y:T.y+T.h},M,v)]}});var ke={prepare:function(C){var v,M,E,F,N,T=[];for(v=0,E=C.length;v<E;++v)for(M=0,F=C[v].length;M<F;++M)T.push(N=C[v][M]),N.$layout={_box:new Ae,_hidable:!1,_visible:!0,_set:v,_idx:N._index};return T.sort(function(K,ut){var ht=K.$layout,yt=ut.$layout;return ht._idx===yt._idx?yt._set-ht._set:yt._idx-ht._idx}),this.update(T),T},update:function(C){var v,M,E,F,N,T=!1;for(v=0,M=C.length;v<M;++v)F=(E=C[v]).model(),(N=E.$layout)._hidable=F&&"auto"===F.display,N._visible=E.visible(),T|=N._hidable;T&&function ai(C){var T,v,M,E,F,N,K;for(T=0,v=C.length;T<v;++T)(E=(M=C[T]).$layout)._visible&&(K=new Proxy(M._el,{get:(ut,ht)=>ut.getProps([ht],!0)[ht]}),F=M.geometry(),N=si(K,M.model(),F),E._box.update(N,F,M.rotation()));(function Ne(C,T){var v,M,E,F;for(v=C.length-1;v>=0;--v)for(E=C[v].$layout,M=v-1;M>=0&&E._visible;--M)(F=C[M].$layout)._visible&&E._box.intersects(F._box)&&T(E,F)})(C,function(ut,ht){var yt=ut._hidable,Lt=ht._hidable;yt&&Lt||Lt?ht._visible=!1:yt&&(ut._visible=!1)})}(C)},lookup:function(C,T){var v,M;for(v=C.length-1;v>=0;--v)if((M=C[v].$layout)&&M._visible&&M._box.contains(T))return C[v];return null},draw:function(C,T){var v,M,E,F,N,K;for(v=0,M=T.length;v<M;++v)(F=(E=T[v]).$layout)._visible&&(N=E.geometry(),K=si(E._el,E.model(),N),F._box.update(K,N,E.rotation()),E.draw(C,K))}},qt="$datalabels",xe="$default";function Se(C,T,v,M){if(T){var N,E=v.$context,F=v.$groups;T[F._set]&&(N=T[F._set][F._key])&&!0===(0,Z.Q)(N,[E,M])&&(C[qt]._dirty=!0,v.update(E))}}var Oe={id:"datalabels",defaults:{align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(C){if((0,Z.k)(C))return null;var v,M,E,T=C;if((0,Z.i)(C))if((0,Z.k)(C.label))if((0,Z.k)(C.r))for(T="",E=0,M=(v=Object.keys(C)).length;E<M;++E)T+=(0!==E?", ":"")+v[E]+": "+C[v[E]];else T=C.r;else T=C.label;return""+T},labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},beforeInit:function(C){C[qt]={_actives:[]}},beforeUpdate:function(C){var T=C[qt];T._listened=!1,T._listeners={},T._datasets=[],T._labels=[]},afterDatasetUpdate:function(C,T,v){var Lt,Ft,wt,$t,Tt,Xt,Vt,vt,M=T.index,E=C[qt],F=E._datasets[M]=[],N=C.isDatasetVisible(M),K=C.data.datasets[M],ut=function oi(C,T){var F,N,v=C.datalabels,M={},E=[];return!1===v?null:(!0===v&&(v={}),T=(0,Z.a4)({},[T,v]),F=T.labels||{},N=Object.keys(F),delete T.labels,N.length?N.forEach(function(K){F[K]&&E.push((0,Z.a4)({},[T,F[K],{_key:K}]))}):E.push(T),M=E.reduce(function(K,ut){return(0,Z.F)(ut.listeners||{},function(ht,yt){K[yt]=K[yt]||{},K[yt][ut._key||xe]=ht}),delete ut.listeners,K},{}),{labels:E,listeners:M})}(K,v),ht=T.meta.data||[],yt=C.ctx;for(yt.save(),Lt=0,wt=ht.length;Lt<wt;++Lt)if((Vt=ht[Lt])[qt]=[],N&&Vt&&C.getDataVisibility(Lt)&&!Vt.skip)for(Ft=0,$t=ut.labels.length;Ft<$t;++Ft)Xt=(Tt=ut.labels[Ft])._key,(vt=new kt(Tt,yt,Vt,Lt)).$groups={_set:M,_key:Xt||xe},vt.$context={active:!1,chart:C,dataIndex:Lt,dataset:K,datasetIndex:M},vt.update(vt.$context),Vt[qt].push(vt),F.push(vt);yt.restore(),(0,Z.a4)(E._listeners,ut.listeners,{merger:function(Rt,It,ae){It[Rt]=It[Rt]||{},It[Rt][T.index]=ae[Rt],E._listened=!0}})},afterUpdate:function(C){C[qt]._labels=ke.prepare(C[qt]._datasets)},afterDatasetsDraw:function(C){ke.draw(C,C[qt]._labels)},beforeEvent:function(C,T){if(C[qt]._listened){var v=T.event;switch(v.type){case"mousemove":case"mouseout":!function ri(C,T){var E,F,v=C[qt],M=v._listeners;if(M.enter||M.leave){if("mousemove"===T.type)F=ke.lookup(v._labels,T);else if("mouseout"!==T.type)return;E=v._hovered,v._hovered=F,function Ye(C,T,v,M,E){var F,N;!v&&!M||(v?M?v!==M&&(N=F=!0):N=!0:F=!0,N&&Se(C,T.leave,v,E),F&&Se(C,T.enter,M,E))}(C,M,E,F,T)}}(C,v);break;case"click":!function li(C,T){var v=C[qt],M=v._listeners.click,E=M&&ke.lookup(v._labels,T);E&&Se(C,M,E,T)}(C,v)}}},afterEvent:function(C){var F,N,K,ut,ht,yt,Lt,T=C[qt],E=function(C,T){var E,F,N,K,v=C.slice(),M=[];for(E=0,N=T.length;E<N;++E)-1===(F=v.indexOf(K=T[E]))?M.push([K,1]):v.splice(F,1);for(E=0,N=v.length;E<N;++E)M.push([v[E],-1]);return M}(T._actives,T._actives=C.getActiveElements());for(F=0,N=E.length;F<N;++F)if((ht=E[F])[1])for(K=0,ut=(Lt=ht[0].element[qt]||[]).length;K<ut;++K)(yt=Lt[K]).$context.active=1===ht[1],yt.update(yt.$context);(T._dirty||E.length)&&(ke.update(T._labels),C.render()),delete T._dirty}},q=H(4438),Ue=H(4727),bi=H(7722),Ee=H(177),he=H(5427),ie=H(9183),Xe=H(3881);const xi=["patchpicker"],ne=["modepicker"],Ke=["lowerslider"],Qe=["upperslider"];function vi(C,T){1&C&&(q.j41(0,"div",13),q.EFF(1,"Civilization game count"),q.k0s())}function Be(C,T){if(1&C){const v=q.RV6();q.qex(0),q.j41(1,"div")(2,"mat-slider",14),q.bIt("change",function(E){q.eBV(v);const F=q.XpG();return q.Njj(F.onSliderChange(E))}),q.nrm(3,"input",15,2)(5,"input",16,3),q.k0s()(),q.bVm()}if(2&C){const v=q.XpG();q.R7$(),q.HbH(v.isProfile?"slider-container":"slider-container2"),q.R7$(2),q.Y8G("value",v._eloLowerBound),q.R7$(2),q.Y8G("value",v._eloUpperBound)}}function Pi(C,T){1&C&&(q.qex(0),q.nrm(1,"mat-spinner",17),q.bVm())}function Te(C,T){1&C&&(q.j41(0,"div",18),q.nrm(1,"canvas",19),q.k0s())}d.t1.register(d.PP,d.kc,d.A6,d.E8);let ve=[],Mi=(()=>{class C{constructor(v,M,E){this.chartsService=v,this.patchService=M,this.cdr=E,this.isProfile=!1,this.data=[],this._selectedValue=1,this.patchs=[],this.patchIds=[],this.patchNumbers=[],this._selectedPatch=0,this.minElo=0,this.maxElo=2500,this._eloLowerBound=this.minElo,this._eloUpperBound=this.maxElo,this.isLoading=!0,this.flagWidth=40,this.subscriptions=[],this.modeNameList=A.Fy,this.modeValueList=A.nQ,this.modeStorageKey="winrate_game_count_mode_storage_key",this.eloLowerBoundStorageKey="winrate_game_count_elo_lower_storage_key",this.eloUpperBoundStorageKey="winrate_game_count_elo_upper_storage_key",this.userCLicked=!1,this.labelGameCount="Game Count",this.labelWinRate="Win Rate",this.barHeight=70}ngAfterViewInit(){this.isLoading=!0;const v=localStorage.getItem(this.modeStorageKey);if(v&&(this._selectedValue=+v,this.modepicker.updateItem(this._selectedValue)),!this.isProfile){const M=localStorage.getItem(this.eloLowerBoundStorageKey);M&&(this._eloLowerBound=+M,this.lowerslider.nativeElement.value=M);const E=localStorage.getItem(this.eloUpperBoundStorageKey);E&&(this._eloUpperBound=+E,this.upperslider.nativeElement.value=E)}this.getPatchs(),this.cdr.detectChanges()}ngOnDestroy(){this.subscriptions.forEach(v=>{v.unsubscribe()}),this.winrateChart&&this.winrateChart.destroy()}ngOnChanges(v){this.isLoading||this.getPatchs()}getPatchs(){this.subscriptions.push(this.patchService.getPatchs().subscribe({next:this.handleResponsePatch.bind(this),error:this.handleErrorPatch.bind(this)}))}handleResponsePatch(v){v?(this.patchs=v,this.patchNumbers=this.patchs.map(M=>M.number),this.patchIds=this.patchs.map(M=>M.id),this._selectedPatch=Math.max(...this.patchs.map(M=>M.id)),this.patchpicker.updateOptions(this.patchNumbers,this.patchIds,this._selectedPatch),this.getDatas(),this.cdr.detectChanges()):this.isLoading=!1}handleErrorPatch(v){console.error("There was an error fetching the patch data",v),this.isLoading=!1}getDatas(){this.isLoading=!0,this.subscriptions.push(this.chartsService.getWinrateByCivByEloAndElo(this._selectedValue,this._selectedPatch,this._eloLowerBound,this._eloUpperBound,this.idPlayer).subscribe({next:this.handleResponse.bind(this),error:this.handleError.bind(this)}))}handleResponse(v){v&&(this.data=v,0===this.data.length&&0!=this._selectedValue&&(this._selectedValue=0,this.userCLicked?confirm("No data available for this mode!")&&setTimeout(()=>{this.modepicker.updateItem(this._selectedValue),this.getDatas()}):(this.modepicker.updateItem(this._selectedValue),this.userCLicked=!1,this.getDatas())),this.userCLicked=!1,this.data.sort((M,E)=>E.totalGames-M.totalGames),this.formatAndGenerateChart(),this.isLoading=!1,this.cdr.detectChanges())}handleError(v){console.error("There was an error fetching the data",v),this.isLoading=!1}OnModeChanged(v){this.userCLicked=!0,this._selectedValue=v,localStorage.setItem(this.modeStorageKey,this._selectedValue.toString()),this.getDatas()}OnPatchChanged(v){this.userCLicked=!0,this._selectedPatch=v,this.getDatas()}get eloLowerBound(){return this._eloLowerBound}set eloLowerBound(v){this._eloLowerBound=v,localStorage.setItem(this.eloLowerBoundStorageKey,this._eloLowerBound.toString()),this.getDatas()}get eloUpperBound(){return this._eloUpperBound}set eloUpperBound(v){this._eloUpperBound=v,localStorage.setItem(this.eloUpperBoundStorageKey,this._eloUpperBound.toString()),this.getDatas()}onSliderChange(v){"mdc-slider__input"===v.target.className?this.eloLowerBound=v.srcElement.ariaValueText:"mdc-slider__input mat-slider__right-input"===v.target.className&&(this.eloUpperBound=v.srcElement.ariaValueText)}getFlag(v){return(0,A.sQ)(v)}getName(v){return(0,A.JH)(v)}createChart(){this.winrateChart&&this.winrateChart.destroy();const v=this.data.map(wt=>this.getFlag(wt.idciv)),M=this.data.map(wt=>wt.totalGames),E=this.data.map(wt=>wt.winPercentage),F=[],K=[],ut=[];F.push("#DAAB3A"),[].push("#00000000"),K.push("#DA7B27"),ut.push("#00000000");const ht={labels:v,datasets:[{label:this.labelGameCount,data:M,xAxisID:"x-gamecount",backgroundColor:F,borderColor:"#80DAAB3A",borderWidth:1,barThickness:25,borderRadius:5,fill:!1},{label:this.labelWinRate,data:E,xAxisID:"x-winrate",backgroundColor:K,borderColor:ut,borderWidth:1,barThickness:25,borderRadius:5,fill:!1}]},yt={id:"flagImagePlugin",afterDraw:wt=>{const $t=wt.ctx,Tt=wt.scales.y;Tt.ticks.forEach((Xt,Vt)=>{const vt=ve[Vt],Rt=Tt.getPixelForTick(Vt);var ge=50;vt.height&&vt.width&&(ge=50/(vt.height/vt.width)),this.flagWidth=ge,$t.save(),$t.beginPath(),$t.moveTo(Tt.right-ge+5-8,Rt-25),$t.arcTo(Tt.right-8,Rt-25,Tt.right-8,Rt-25+5,5),$t.arcTo(Tt.right-8,Rt+25,Tt.right-ge+5-8,Rt+25,5),$t.arcTo(Tt.right-ge+5-8,Rt+25,Tt.right-ge+5-8,Rt-25+5,5),$t.arcTo(Tt.right-ge+5-8,Rt-25,Tt.right-8,Rt-25,5),$t.closePath(),$t.clip(),$t.drawImage(vt,Tt.right-ge+5-8,Rt-25,ge,50),$t.restore()})}},Ft=(this.getName.bind(this),{maintainAspectRatio:!1,indexAxis:"y",scales:{"x-winrate":{position:"bottom",beginAtZero:!0,min:0,suggestedMin:100,suggestedMax:100},"x-gamecount":{position:"top",beginAtZero:!0},y:{ticks:{callback:(wt,$t,Tt)=>"",padding:35}}},plugins:{legend:{labels:{color:"#fcf0ae",font:{size:this.calculateLegendFontSize(window.innerWidth),weight:"bold"},padding:25},display:!0,onClick:(wt,$t,Tt)=>{const Xt=$t.datasetIndex;if(void 0===Xt)return;let Vt=!1;this.winrateChart.data.datasets.forEach(Rt=>{Rt.hidden&&(Vt=!0)});const vt=this.winrateChart.data.datasets[Xt];!vt.hidden&&Vt?(this.winrateChart.data.datasets.forEach(Rt=>{Rt.hidden=!1}),this.data.sort((Rt,It)=>(It.totalGames??0)-(Rt.totalGames??0))):(this.winrateChart.data.datasets.forEach((Rt,It)=>{Rt.hidden=It!==Xt}),vt.label===this.labelGameCount?this.data.sort((Rt,It)=>(It.totalGames??0)-(Rt.totalGames??0)):vt.label===this.labelWinRate&&this.data.sort((Rt,It)=>(It.winPercentage??0)-(Rt.winPercentage??0))),this.updateChartDataAndLabels()}},datalabels:{display:!0,align:wt=>{if(wt.dataset.label===this.labelWinRate)return"start";const Tt=this.data.map(Xt=>Xt.totalGames);if(Tt&&Tt.length>wt.dataIndex){const Xt=Tt[wt.dataIndex];return Xt?this.calculateAlign(Xt,window.innerWidth):"start"}return"start"},anchor:"end",color:"white",font:{size:this.calculateLegendFontSize(window.innerWidth)},formatter:(wt,$t)=>$t.dataset.label===this.labelGameCount?wt:$t.dataset.label===this.labelWinRate?wt+"%":void 0},tooltip:{callbacks:{title:function(wt){if(0===wt.length)return"Unknown";const Xt=function Pe(C){for(let T in A.FM){const v=A.FM[T];if(v.urlRectanle===C.split("/").pop())return v.idCiv}return null}(wt[0].label);return null===Xt?"Unknown":A.FM[Xt].name},label:function(wt){return`${wt.dataset.label||""}: ${wt.formattedValue}`}}}}});this.winrateChart&&this.winrateChart.destroy(),this.winrateChart=new d.t1("winrateChart",{type:"bar",data:ht,options:Ft,plugins:[Oe,yt]})}updateChartDataAndLabels(){this.winrateChart&&(this.winrateChart.data.labels=this.data.map(v=>this.getFlag(v.idciv)),this.winrateChart.data.datasets.forEach((v,M)=>{v.data=this.data.map(E=>v.label===this.labelGameCount?E.totalGames??0:v.label===this.labelWinRate?E.winPercentage??0:0)}),this.UpdateImages())}UpdateImages(){if(!this.winrateChart)return;const v=this.data.map(E=>this.getFlag(E.idciv)),M=new Map;v.forEach((E,F)=>{let N=new Image;N.src=E,N.onload=()=>{M.set(E,N),M.size===v.length&&(ve=v.map(K=>M.get(K)),this.winrateChart.update())},N.onerror=()=>{console.error(`Error loading image from ${E}`)}})}formatAndGenerateChart(){this.winrateChart&&this.winrateChart.destroy();const v=this.data.map(M=>this.getFlag(M.idciv));ve=[],v.forEach((M,E)=>{let F=new Image;F.src=M,F.onload=()=>{ve[E]=F;var N=document.getElementById("parent");ve.filter(Boolean).length===v.length&&v.length>0?(this.createChart(),this.adjustCanvasHeight(),N&&(N.style.display="")):ve.filter(Boolean).length===v.length&&0===v.length&&N&&(N.style.display="none")},F.onerror=()=>{console.error(`Error loading image from ${M}`)}})}adjustCanvasHeight(){var v=document.getElementById("winrateChart");v&&(v.style.height=` ${(0===this.data.length?1:this.data.length)*this.barHeight+100}px`)}onResize(v){this.winrateChart.options&&(this.winrateChart.options.plugins.legend.labels.font.size=this.calculateLegendFontSize(window.innerWidth),this.winrateChart.options.plugins.datalabels.font.size=this.calculateLegendFontSize(window.innerWidth)),this.adjustCanvasHeight(),this.winrateChart.update()}calculateAlign(v,M){var E;E=M>1500?5:M<1500&&M>1200?10:M<1200&&M>800?20:30;const F=this.data.map(K=>K.totalGames);return Math.max(...F)>=E?v>=E?"start":"end":"start"}calculateLegendFontSize(v){return v>1200?18:v<1200&&v>700?16:v<700&&v>500?14:12}static#t=this.\u0275fac=function(M){return new(M||C)(q.rXU(Ue.p),q.rXU(bi.G),q.rXU(q.gRc))};static#e=this.\u0275cmp=q.VBU({type:C,selectors:[["app-winrate-and-game-count"]],viewQuery:function(M,E){if(1&M&&(q.GBs(xi,5),q.GBs(ne,5),q.GBs(Ke,5),q.GBs(Qe,5)),2&M){let F;q.mGM(F=q.lsd())&&(E.patchpicker=F.first),q.mGM(F=q.lsd())&&(E.modepicker=F.first),q.mGM(F=q.lsd())&&(E.lowerslider=F.first),q.mGM(F=q.lsd())&&(E.upperslider=F.first)}},hostBindings:function(M,E){1&M&&q.bIt("resize",function(N){return E.onResize(N)},!1,q.tSv)},inputs:{isProfile:"isProfile",idPlayer:"idPlayer"},features:[q.OA$],decls:14,vars:12,consts:[["patchpicker",""],["modepicker",""],["lowerslider",""],["upperslider",""],["id","parent",1,"custom-parent"],["class","subheading",4,"ngIf"],[1,"filter-general-container"],[1,"filter-general-columns"],[4,"ngIf"],[1,"pickers"],[3,"OnPageChanged","Name","List","Values"],[1,"pt-10",2,"width","100%"],["class","chart-container",4,"ngIf"],[1,"subheading"],["discrete","","showTickMarks","","step","100","min","0","max","2500",1,"slider",3,"change"],["matSliderStartThumb","",3,"value"],["matSliderEndThumb","",3,"value"],["color","primary",2,"margin","auto"],[1,"chart-container"],["id","winrateChart",2,"display","block","width","100% !important"]],template:function(M,E){if(1&M){const F=q.RV6();q.j41(0,"div",4)(1,"div"),q.DNE(2,vi,2,0,"div",5),q.j41(3,"div",6)(4,"div",7),q.DNE(5,Be,7,4,"ng-container",8),q.j41(6,"div",9)(7,"app-picker",10,0),q.bIt("OnPageChanged",function(K){return q.eBV(F),q.Njj(E.OnPatchChanged(K))}),q.k0s(),q.j41(9,"app-picker",10,1),q.bIt("OnPageChanged",function(K){return q.eBV(F),q.Njj(E.OnModeChanged(K))}),q.k0s()()()()(),q.j41(11,"div",11),q.DNE(12,Pi,2,0,"ng-container",8)(13,Te,2,0,"div",12),q.k0s()()}2&M&&(q.R7$(),q.HbH(E.isProfile?"filter-row":"filter-row2"),q.R7$(),q.Y8G("ngIf",E.isProfile),q.R7$(3),q.Y8G("ngIf",!E.isProfile),q.R7$(2),q.Y8G("Name","Patch:")("List",E.patchNumbers)("Values",E.patchIds),q.R7$(2),q.Y8G("Name","Mode:")("List",E.modeNameList)("Values",E.modeValueList),q.R7$(3),q.Y8G("ngIf",E.isLoading),q.R7$(),q.Y8G("ngIf",!E.isLoading))},dependencies:[Ee.bT,he.I,ie.LG,Xe.IV,Xe.XM],styles:[".filter-row[_ngcontent-%COMP%]{display:flex;gap:.2rem}.filter-row2[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:.2rem}.filter-general-container[_ngcontent-%COMP%]{margin:0;padding:0;justify-content:flex-end;flex:1}.filter-general-columns[_ngcontent-%COMP%]{display:flex;width:100%;flex:1}.pickers[_ngcontent-%COMP%]{display:flex;gap:1rem}.slider-container[_ngcontent-%COMP%]{display:flex;width:50%}.slider-container2[_ngcontent-%COMP%]{display:flex;flex:1}.slider[_ngcontent-%COMP%]{width:calc(100% - 2rem)}@media only screen and (max-width: 1400px){.filter-row2[_ngcontent-%COMP%]{flex-direction:column;align-items:flex-start;justify-content:space-between}.filter-general-container[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:flex-end}.slider-container[_ngcontent-%COMP%], .slider-container2[_ngcontent-%COMP%]{flex:1;width:100%;justify-content:center}.slider[_ngcontent-%COMP%]{width:calc(100% - 2rem);margin:0 1rem}}@media only screen and (max-width:900px){.filter-row[_ngcontent-%COMP%]{flex-direction:column;align-items:flex-start;justify-content:space-between;gap:1rem}.filter-general-container[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:flex-end}.pickers[_ngcontent-%COMP%]{width:100%;justify-content:flex-end}.filter-general-columns[_ngcontent-%COMP%]{flex-direction:column}}@media only screen and (max-width:400px){.pickers[_ngcontent-%COMP%]{flex-direction:column;align-items:flex-start}.filter-general-columns[_ngcontent-%COMP%]{gap:0}}"]})}return C})()},8925:(Ie,Ut,H)=>{H.d(Ut,{b:()=>Yt});var d=H(6604),A=H(4438),Z=H(4727),o=H(7722),_t=H(177),Pt=H(5427),xt=H(9183),Mt=H(3881);const at=["patchpicker"],st=["modepicker"],it=["lowerslider"],lt=["upperslider"];function mt(Ct,Wt){1&Ct&&(A.qex(0),A.nrm(1,"mat-spinner",17),A.bVm())}function Ot(Ct,Wt){if(1&Ct&&(A.j41(0,"th",19),A.nrm(1,"img",22),A.k0s()),2&Ct){const J=Wt.$implicit,ot=A.XpG(2);A.R7$(),A.FS9("src",ot.getFlag(J),A.B4B)}}function At(Ct,Wt){if(1&Ct&&(A.qex(0),A.j41(1,"div")(2,"div",28),A.EFF(3),A.k0s(),A.j41(4,"div",29),A.EFF(5),A.nI1(6,"number"),A.k0s()(),A.bVm()),2&Ct){const J=Wt.ngIf,ot=A.XpG(5);A.R7$(2),A.Y8G("ngClass",ot.getCssClass(J.winPercentage)),A.R7$(),A.SpI(" ",ot.getRoundedWinPercentage(J.winPercentage),"% "),A.R7$(2),A.SpI(" ",A.bMT(6,3,J.totalGames)," ")}}function Gt(Ct,Wt){if(1&Ct&&(A.j41(0,"td",27),A.DNE(1,At,7,5,"ng-container",14),A.k0s()),2&Ct){let J;const ot=Wt.$implicit,ct=A.XpG(2).$implicit,kt=A.XpG(2);A.R7$(),A.Y8G("ngIf",null==(J=kt.tableData.get(ct))?null:J.get(ot))}}function jt(Ct,Wt){if(1&Ct){const J=A.RV6();A.j41(0,"tr",24),A.bIt("click",function(){A.eBV(J);const ct=A.XpG().$implicit,kt=A.XpG(2);return A.Njj(kt.toggleRowVisibility(ct))}),A.j41(1,"td",25),A.nrm(2,"img",22),A.k0s(),A.DNE(3,Gt,2,1,"td",26),A.k0s()}if(2&Ct){const J=A.XpG().$implicit,ot=A.XpG(2);A.R7$(2),A.FS9("src",ot.getFlag(J),A.B4B),A.R7$(),A.Y8G("ngForOf",ot.civOpponents)}}function ee(Ct,Wt){if(1&Ct&&(A.qex(0),A.DNE(1,jt,4,2,"tr",23),A.bVm()),2&Ct){const J=Wt.$implicit,ot=A.XpG(2);A.R7$(),A.Y8G("ngIf",ot.showAllRows||null!==ot.selectedPlayer&&ot.selectedPlayer.toString()===J.toString())}}function se(Ct,Wt){if(1&Ct&&(A.j41(0,"table",18)(1,"thead")(2,"tr"),A.nrm(3,"th",19),A.DNE(4,Ot,2,1,"th",20),A.k0s()(),A.j41(5,"tbody"),A.DNE(6,ee,2,1,"ng-container",21),A.k0s()()),2&Ct){const J=A.XpG();A.R7$(4),A.Y8G("ngForOf",J.civOpponents),A.R7$(2),A.Y8G("ngForOf",J.civPlayers)}}let Yt=(()=>{class Ct{constructor(J,ot,ct,kt){this.chartsService=J,this.cdr=ot,this.patchService=ct,this.elRef=kt,this.idPlayer=0,this.subscriptions=[],this.gameMode=1,this.ratingKeys=[],this.data=[],this._selectedValue=1,this.minElo=0,this.maxElo=2500,this._eloLowerBound=this.minElo,this._eloUpperBound=this.maxElo,this.patchs=[],this.patchIds=[],this.patchNumbers=[],this.isLoading=!0,this.civPlayers=[],this.civOpponents=[],this.tableData=new Map,this.displayedColumns=["civPlayer"],this.showAllRows=!0,this.selectedPlayer=null,this.modeNameList=["Solo"],this.modeValueList=[1],this.eloLowerBoundStorageKey="winrate_by_matchup_elo_lower_storage_key",this.eloUpperBoundStorageKey="winrate_by_matchup_elo_upper_storage_key"}ngAfterViewInit(){this.isLoading=!0;const J=localStorage.getItem(this.eloLowerBoundStorageKey);J&&(this._eloLowerBound=+J,this.lowerslider.nativeElement.value=J);const ot=localStorage.getItem(this.eloUpperBoundStorageKey);ot&&(this._eloUpperBound=+ot,this.upperslider.nativeElement.value=ot),this.cdr.detectChanges(),this.getPatchs()}getPatchs(){this.subscriptions.push(this.patchService.getPatchs().subscribe({next:this.handleResponsePatch.bind(this),error:this.handleErrorPatch.bind(this)}))}handleResponsePatch(J){J?(this.patchs=J,this.patchNumbers=this.patchs.map(ot=>ot.number),this.patchIds=this.patchs.map(ot=>ot.id),this._selectedPatch=Math.max(...this.patchs.map(ot=>ot.id)),this.patchpicker.updateOptions(this.patchNumbers,this.patchIds,this._selectedPatch),this.getDatas(),this.cdr.detectChanges()):this.isLoading=!1}OnModeChanged(J){this._selectedValue=J,this.getDatas()}OnPatchChanged(J){this._selectedPatch=J,this.getDatas()}handleErrorPatch(J){console.error("There was an error fetching the patch data",J),this.isLoading=!1}getDatas(){this.isLoading=!0,this.subscriptions.push(0===this.idPlayer?this.chartsService.getWinrateByCivByMatchup(this._selectedValue,this._eloLowerBound,this._eloUpperBound,this._selectedPatch).subscribe({next:this.handleResponse.bind(this),error:this.handleError.bind(this)}):this.chartsService.getWinrateByCivByMatchupPlayer(this._selectedValue,this._eloLowerBound,this._eloUpperBound,this._selectedPatch,this.idPlayer).subscribe({next:this.handleResponse.bind(this),error:this.handleError.bind(this)}))}handleResponse(J){if(!J)return void(this.isLoading=!1);this.data=[...J],this.tableData=new Map;const ot=new Map;J.forEach(ct=>{this.civPlayers.includes(ct.civPlayer)||this.civPlayers.push(ct.civPlayer),this.civOpponents.includes(ct.civOpponent)||this.civOpponents.push(ct.civOpponent),this.tableData.has(ct.civPlayer)||this.tableData.set(ct.civPlayer,new Map),this.tableData.get(ct.civPlayer).set(ct.civOpponent,ct),ot.has(ct.civPlayer)||ot.set(ct.civPlayer,0),ot.set(ct.civPlayer,ot.get(ct.civPlayer)+ct.totalGames)}),this.civPlayers.sort((ct,kt)=>0!==this.idPlayer?(ot.get(kt)||0)-(ot.get(ct)||0):ct-kt),this.civOpponents.sort((ct,kt)=>ct-kt),this.displayedColumns=["civPlayer",...this.civOpponents.map(ct=>ct.toString())],this.isLoading=!1,this.cdr.detectChanges()}handleError(J){console.error("There was an error fetching chartsService",J),this.isLoading=!1}getFlag(J){return(0,d.sQ)(J)}getCssClass(J){return J>60?"very-green":J<=60&&J>50?"light-green":J<50&&J>=40?"light-red":J<40?"very-red":(J=50)?"grey":""}getRoundedWinPercentage(J){return Math.ceil(J)}get eloLowerBound(){return this._eloLowerBound}set eloLowerBound(J){this._eloLowerBound=J,localStorage.setItem(this.eloLowerBoundStorageKey,this._eloLowerBound.toString()),this.getDatas()}get eloUpperBound(){return this._eloUpperBound}set eloUpperBound(J){this._eloUpperBound=J,localStorage.setItem(this.eloUpperBoundStorageKey,this._eloUpperBound.toString()),this.getDatas()}onSliderChange(J){"mdc-slider__input"===J.target.className?this.eloLowerBound=J.srcElement.ariaValueText:"mdc-slider__input mat-slider__right-input"===J.target.className&&(this.eloUpperBound=J.srcElement.ariaValueText),this.cdr.detectChanges()}toggleRowVisibility(J){if(this.selectedPlayer=J===this.selectedPlayer?null:J,this.showAllRows=!this.showAllRows,!this.showAllRows&&this.selectedPlayer===J){const ot=this.elRef.nativeElement.querySelector(".filter-row");if(ot){const oe=ot.getBoundingClientRect().top+window.pageYOffset-20;setTimeout(()=>{window.scrollTo({top:oe,behavior:"smooth"})},300)}}}ngOnDestroy(){this.subscriptions.forEach(J=>{J.unsubscribe()})}static#t=this.\u0275fac=function(ot){return new(ot||Ct)(A.rXU(Z.p),A.rXU(A.gRc),A.rXU(o.G),A.rXU(A.aKT))};static#e=this.\u0275cmp=A.VBU({type:Ct,selectors:[["app-winrate-by-matchup"]],viewQuery:function(ot,ct){if(1&ot&&(A.GBs(at,5),A.GBs(st,5),A.GBs(it,5),A.GBs(lt,5)),2&ot){let kt;A.mGM(kt=A.lsd())&&(ct.patchpicker=kt.first),A.mGM(kt=A.lsd())&&(ct.modepicker=kt.first),A.mGM(kt=A.lsd())&&(ct.lowerslider=kt.first),A.mGM(kt=A.lsd())&&(ct.upperslider=kt.first)}},inputs:{idPlayer:"idPlayer"},decls:18,vars:10,consts:[["lowerslider",""],["upperslider",""],["patchpicker",""],["modepicker",""],[1,"custom-parent"],[1,"filter-row","#top-scroll"],[1,"filter-general-container"],[1,"filter-general-columns"],[1,"slider-container"],["discrete","","showTickMarks","","step","100","min","0","max","2500",1,"slider",3,"change"],["matSliderStartThumb","",3,"value"],["matSliderEndThumb","",3,"value"],[1,"pickers"],[3,"OnPageChanged","Name","List","Values"],[4,"ngIf"],[1,"table-container"],["style","\n border-radius: 5px !important;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.25) !important;\n ","class","table table-dark noborder-table",4,"ngIf"],[2,"margin","auto"],[1,"table","table-dark","noborder-table",2,"border-radius","5px !important","box-shadow","2px 2px 4px rgba(0, 0, 0, 0.25) !important"],[1,"table-th","flag-td"],["class","table-th flag-td",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],[1,"flag-icon",3,"src"],[3,"click",4,"ngIf"],[3,"click"],[1,"table-td","flag-td"],["class","table-td winrate-td",4,"ngFor","ngForOf"],[1,"table-td","winrate-td"],[1,"percent-text",3,"ngClass"],[1,"totalgames-text"]],template:function(ot,ct){if(1&ot){const kt=A.RV6();A.j41(0,"div",4)(1,"div",5)(2,"div",6)(3,"div",7)(4,"div",8)(5,"mat-slider",9),A.bIt("change",function(ce){return A.eBV(kt),A.Njj(ct.onSliderChange(ce))}),A.nrm(6,"input",10,0)(8,"input",11,1),A.k0s()(),A.j41(10,"div",12)(11,"app-picker",13,2),A.bIt("OnPageChanged",function(ce){return A.eBV(kt),A.Njj(ct.OnPatchChanged(ce))}),A.k0s(),A.j41(13,"app-picker",13,3),A.bIt("OnPageChanged",function(ce){return A.eBV(kt),A.Njj(ct.OnModeChanged(ce))}),A.k0s()()()()(),A.DNE(15,mt,2,0,"ng-container",14),A.j41(16,"div",15),A.DNE(17,se,7,2,"table",16),A.k0s()()}2&ot&&(A.R7$(6),A.Y8G("value",ct._eloLowerBound),A.R7$(2),A.Y8G("value",ct._eloUpperBound),A.R7$(3),A.Y8G("Name","Patch:")("List",ct.patchNumbers)("Values",ct.patchIds),A.R7$(2),A.Y8G("Name","Mode:")("List",ct.modeNameList)("Values",ct.modeValueList),A.R7$(2),A.Y8G("ngIf",ct.isLoading),A.R7$(2),A.Y8G("ngIf",!ct.isLoading))},dependencies:[_t.YU,_t.Sq,_t.bT,Pt.I,xt.LG,Mt.IV,Mt.XM,_t.QX],styles:['.filter-row[_ngcontent-%COMP%]{display:flex}.filter-general-container[_ngcontent-%COMP%]{margin:0;padding:0;justify-content:flex-end;flex:1}.filter-general-columns[_ngcontent-%COMP%]{display:flex;width:100%;flex:1}.pickers[_ngcontent-%COMP%]{display:flex;gap:1rem}.slider-container[_ngcontent-%COMP%]{display:flex;flex:1}.slider[_ngcontent-%COMP%]{width:calc(100% - 2rem)}.table-container[_ngcontent-%COMP%]{overflow-x:auto;border-radius:5px;margin-top:.5rem}.winrate-table[_ngcontent-%COMP%]{border-radius:5px!important;box-shadow:2px 2px 4px #00000040!important}.winrate-td[_ngcontent-%COMP%]{background-color:#4545454d!important;margin:1px;box-shadow:0 2px 2px #00000040}.flag-td[_ngcontent-%COMP%]{background-color:#1818184d!important}.flag-icon[_ngcontent-%COMP%]{max-width:42px;border-radius:5px;box-shadow:2px 2px 4px #00000080}.flag-icon[_ngcontent-%COMP%]:hover{scale:1.05}.flag-icon[_ngcontent-%COMP%]:active{scale:.95}.percent-text[_ngcontent-%COMP%], .totalgames-text[_ngcontent-%COMP%]{font-family:"Source Sans 3";text-shadow:2px 2px 2px rgba(0,0,0,.5)}.percent-text[_ngcontent-%COMP%]{font-size:clamp(.9rem,2vw,1.1rem);font-weight:700;letter-spacing:1px}.totalgames-text[_ngcontent-%COMP%]{font-size:clamp(.7rem,2vw,1rem);color:#ccc}.very-green[_ngcontent-%COMP%]{color:#0f0}.light-green[_ngcontent-%COMP%]{color:#90ee90}.light-red[_ngcontent-%COMP%]{color:tomato}.very-red[_ngcontent-%COMP%]{color:red}.grey[_ngcontent-%COMP%]{color:gray}.table-dark[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:#ffffff1a;cursor:pointer}.align-right[_ngcontent-%COMP%]{display:flex;margin-left:auto}@media only screen and (max-width: 1300px){.filter-row[_ngcontent-%COMP%]{flex-direction:column}.slider-container[_ngcontent-%COMP%]{flex:1;width:100%;justify-content:center}.slider[_ngcontent-%COMP%]{width:calc(100% - 2rem);margin:0 1rem}}@media only screen and (max-width: 900px){.filter-row[_ngcontent-%COMP%]{flex-direction:column;align-items:flex-start;justify-content:space-between;gap:1rem}.filter-general-container[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:flex-end}.pickers[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;width:100%}.filter-general-columns[_ngcontent-%COMP%]{flex:1;flex-direction:column}}@media only screen and (max-width: 600px){.align-right[_ngcontent-%COMP%]{width:100%}}@media only screen and (max-width: 400px){.pickers[_ngcontent-%COMP%]{flex-direction:column}.filter-general-columns[_ngcontent-%COMP%]{gap:0}}']})}return Ct})()},4727:(Ie,Ut,H)=>{H.d(Ut,{p:()=>xt});var d=H(1635),A=H(1626),Z=H(5440),o=H(4419),_t=H(1148),Pt=H(4438);class xt{constructor(at){this.httpClient=at,this.headers=(new A.Lr).set("Content-Type","application/json"),this.apiwinrateglobal="/chart/chartwinrateglobal",this.apiwinrategamecount="/chart/chartwinrategamecount",this.apiwinratematchup="/chart/chartwinratematchup"}getWinrateByCivByMatchup(at,st,it,lt){let mt=(new A.Nl).set("gameMode",at).set("eloMin",st).set("eloMax",it).set("idPatch",lt);return this.httpClient.get(Z.p+this.apiwinratematchup,{headers:this.headers,params:mt})}getWinrateByCivByMatchupPlayer(at,st,it,lt,mt){let Ot=(new A.Nl).set("gameMode",at).set("eloMin",st).set("eloMax",it).set("idPatch",lt).set("idPlayer",mt);return this.httpClient.get(Z.p+this.apiwinratematchup,{headers:this.headers,params:Ot})}getWinrateByCivByElo(at,st){let it=(new A.Nl).set("gameMode",at).set("idPatch",st);return this.httpClient.get(Z.p+this.apiwinrateglobal,{headers:this.headers,params:it})}getWinrateByCivByEloAndElo(at,st,it,lt,mt){let Ot=(new A.Nl).set("gameMode",at).set("idPatch",st).set("ratingMin",it).set("ratingMax",lt).set("idPlayer",mt);return this.httpClient.get(Z.p+this.apiwinrategamecount,{headers:this.headers,params:Ot})}static#t=this.\u0275fac=function(st){return new(st||xt)(Pt.KVO(A.Qq))};static#e=this.\u0275prov=Pt.jDH({token:xt,factory:xt.\u0275fac,providedIn:"root"})}(0,d.Cg)([(0,o.R)({storageStrategy:_t.G,maxAge:864e5,maxCacheCount:200})],xt.prototype,"getWinrateByCivByMatchup",null),(0,d.Cg)([(0,o.R)({storageStrategy:_t.G,maxAge:36e5,maxCacheCount:200})],xt.prototype,"getWinrateByCivByMatchupPlayer",null),(0,d.Cg)([(0,o.R)({storageStrategy:_t.G,maxAge:864e5,maxCacheCount:200})],xt.prototype,"getWinrateByCivByElo",null),(0,d.Cg)([(0,o.R)({storageStrategy:_t.G,maxAge:864e5,maxCacheCount:200})],xt.prototype,"getWinrateByCivByEloAndElo",null)},8666:(Ie,Ut,H)=>{H.r(Ut),H.d(Ut,{StatisticsModule:()=>di});var d=H(177),A=H(7315),Z=H(4710),o=H(4438),_t=H(8608),Pt=H(6713),xt=H(467),Mt=H(6604);function at(L,tt){if(1&L&&(o.j41(0,"div",6),o.EFF(1),o.k0s()),2&L){const g=o.XpG();o.R7$(),o.JRh(g.optionSelected.label)}}function st(L,tt){if(1&L&&(o.j41(0,"div",6),o.EFF(1),o.k0s()),2&L){const g=o.XpG().$implicit;o.R7$(),o.JRh(g.label)}}function it(L,tt){if(1&L){const g=o.RV6();o.j41(0,"li",9),o.bIt("click",function(x){const z=o.eBV(g).$implicit,et=o.XpG(2);return o.Njj(et.selectOption(x,z))}),o.nrm(1,"img",2),o.DNE(2,st,2,1,"div",3),o.k0s()}if(2&L){const g=tt.$implicit,S=o.XpG(2);o.R7$(),o.Y8G("src",g.img,o.B4B),o.R7$(),o.Y8G("ngIf",S.showLabel)}}function lt(L,tt){if(1&L&&(o.j41(0,"ul",7),o.DNE(1,it,3,2,"li",8),o.k0s()),2&L){const g=o.XpG();o.R7$(),o.Y8G("ngForOf",g.options)}}let mt=(()=>{class L{constructor(g){this.elementRef=g,this.dropdownWidth=0,this.options=[],this.showLabel=!0,this.OnPageChanged=new o.bkB,this.showDropdown=!1}ngOnChanges(g){if(g.options){const S=g.options.currentValue;S.length>0&&(this.optionSelected=S[0])}}toggleDropdown(){this.showDropdown=!this.showDropdown}selectOption(g,S){this.optionSelected=S,this.showDropdown=!1,this.OnPageChanged.emit(this.optionSelected),g.stopPropagation()}reset(){this.options&&this.options.length>0&&(this.optionSelected=this.options[0])}onClick(g){this.elementRef.nativeElement.contains(g.target)||(this.showDropdown=!1)}static#t=this.\u0275fac=function(S){return new(S||L)(o.rXU(o.aKT))};static#e=this.\u0275cmp=o.VBU({type:L,selectors:[["app-picker-image"]],hostBindings:function(S,x){1&S&&o.bIt("click",function(et){return x.onClick(et)},!1,o.EBC)},inputs:{options:"options",showLabel:"showLabel"},outputs:{OnPageChanged:"OnPageChanged"},features:[o.OA$],decls:6,vars:3,consts:[[1,"custom-dropdown",3,"click"],[1,"selected-option"],[1,"image",3,"src"],["class","label",4,"ngIf"],[1,"arrow"],["class","options",4,"ngIf"],[1,"label"],[1,"options"],[3,"click",4,"ngFor","ngForOf"],[3,"click"]],template:function(S,x){1&S&&(o.j41(0,"div",0),o.bIt("click",function(){return x.toggleDropdown()}),o.j41(1,"div",1),o.nrm(2,"img",2),o.DNE(3,at,2,1,"div",3),o.nrm(4,"div",4),o.k0s(),o.DNE(5,lt,2,1,"ul",5),o.k0s()),2&S&&(o.R7$(2),o.Y8G("src",x.optionSelected.img,o.B4B),o.R7$(),o.Y8G("ngIf",x.showLabel),o.R7$(2),o.Y8G("ngIf",x.showDropdown))},dependencies:[d.Sq,d.bT],styles:[".custom-dropdown[_ngcontent-%COMP%]{position:relative;display:inline-block;background-color:var(--button-bg-solid);padding-left:.2rem;padding-right:.2rem;align-items:flex-start;width:auto;border-radius:5px}.custom-dropdown[_ngcontent-%COMP%]:hover{background-color:var(--yellow-brand-hover)}.selected-option[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;width:100%;box-sizing:border-box;padding:.2rem .5rem .2rem .3rem;flex-grow:1;gap:.5rem}.arrow[_ngcontent-%COMP%]{width:.8rem;height:.8rem;justify-self:flex-end;background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m2 5 6 6 6-6'/%3e%3c/svg%3e\")}.options[_ngcontent-%COMP%]{position:absolute;top:100%;left:0;width:100%;border-top:none;overflow:auto;background-color:var(--button-bg-solid);list-style:none;border-radius:5px;padding:.5rem;margin-top:1px;z-index:1;max-height:15rem;overflow-y:auto}.options[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;white-space:nowrap;width:100%;text-align:left}.options[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:hover{background-color:#dddddd81;border-radius:5px}.label[_ngcontent-%COMP%]{flex:1;white-space:pre;overflow-wrap:break-word;font-family:\"Source Sans 3\";font-weight:700;font-variant:normal;font-size:clamp(.7rem,2vw,1.15rem)}.image[_ngcontent-%COMP%]{margin-right:5px;max-height:clamp(1.4rem,4vw,2rem);max-width:clamp(1.4rem,4vw,2rem);width:auto;height:auto}.options[_ngcontent-%COMP%]::-webkit-scrollbar{width:1rem}.options[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:var(--yellow-brand);border-radius:5px}.options[_ngcontent-%COMP%]::-webkit-scrollbar-track{background-color:gray}.options[_ngcontent-%COMP%]::-moz-scrollbar-thumb{background-color:var(--yellow-brand);border-radius:5px}.options[_ngcontent-%COMP%]::-moz-scrollbar-track{background-color:gray}"]})}return L})();var Ot=H(7722),At=H(2427),Gt=H(14),jt=H(8010),ee=H(5665),se=H(5427),Yt=H(9417),Ct=H(850),Wt=H(6600),J=H(3881),ot=H(9198),ct=H(728),kt=H(78),oe=H(4815),ce=H(3044),Zt=H(9031),we=H(1959),_e=H(9183),Ae=H(4823);const si=["sizepicker"];function Ne(L,tt){1&L&&(o.qex(0),o.nrm(1,"mat-spinner",21)(2,"div",22),o.bVm())}function ai(L,tt){if(1&L&&(o.j41(0,"span"),o.nrm(1,"ng-icon",39),o.EFF(2),o.k0s()),2&L){const g=o.XpG().$implicit,S=o.XpG().$implicit,x=o.XpG();o.R7$(),o.Y8G("name",S.isWin?"heroArrowUpRight":"heroArrowDownRight"),o.R7$(),o.SpI(" ",x.getEloDiffAbsolute(g.eloDiff)," ")}}function ke(L,tt){1&L&&(o.j41(0,"span"),o.EFF(1,"-"),o.k0s())}function He(L,tt){if(1&L&&(o.qex(0),o.j41(1,"div"),o.DNE(2,ai,3,2,"span",3)(3,ke,2,0,"span",3),o.k0s(),o.bVm()),2&L){const g=tt.$implicit,S=o.XpG().$implicit;o.R7$(),o.AVh("green",S.isWin)("red",!S.isWin),o.R7$(),o.Y8G("ngIf",void 0!==g.eloDiff&&0!==g.eloDiff),o.R7$(),o.Y8G("ngIf",!g.eloDiff||0===g.eloDiff)}}function yi(L,tt){if(1&L&&(o.qex(0),o.j41(1,"div"),o.nrm(2,"img",40),o.k0s(),o.bVm()),2&L){const g=tt.$implicit;o.R7$(2),o.Y8G("src",g.civFlagUrl,o.B4B)}}function qt(L,tt){if(1&L&&(o.qex(0),o.j41(1,"div"),o.nrm(2,"img",40),o.k0s(),o.bVm()),2&L){const g=tt.$implicit;o.R7$(2),o.Y8G("src",g.civFlagUrl,o.B4B)}}function xe(L,tt){if(1&L&&(o.j41(0,"span"),o.nrm(1,"ng-icon",39),o.EFF(2),o.k0s()),2&L){const g=o.XpG().$implicit,S=o.XpG().$implicit,x=o.XpG();o.R7$(),o.Y8G("name",S.isWin?"heroArrowDownRight":"heroArrowUpRight"),o.R7$(),o.SpI(" ",x.getEloDiffAbsolute(g.eloDiff)," ")}}function oi(L,tt){1&L&&(o.j41(0,"span"),o.EFF(1,"-"),o.k0s())}function Se(L,tt){if(1&L&&(o.qex(0),o.j41(1,"div"),o.DNE(2,xe,3,2,"span",3)(3,oi,2,0,"span",3),o.k0s(),o.bVm()),2&L){const g=tt.$implicit,S=o.XpG().$implicit;o.R7$(),o.AVh("green",!S.isWin)("red",S.isWin),o.R7$(),o.Y8G("ngIf",void 0!==g.eloDiff&&0!==g.eloDiff),o.R7$(),o.Y8G("ngIf",!g.eloDiff||0===g.eloDiff)}}function Ye(L,tt){if(1&L&&o.nrm(0,"img",52),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isHigestScoreTip)}}function ri(L,tt){if(1&L&&o.nrm(0,"img",53),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isLeastResourcesTip)}}function li(L,tt){if(1&L&&o.nrm(0,"img",54),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostImprovementsTip)}}function Oe(L,tt){if(1&L&&o.nrm(0,"img",55),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostKillsTip)}}function q(L,tt){if(1&L&&o.nrm(0,"img",56),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostLossesTip)}}function Ue(L,tt){if(1&L&&o.nrm(0,"img",57),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostMilitaryTip)}}function bi(L,tt){if(1&L&&o.nrm(0,"img",58),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostResourcesTip)}}function Ee(L,tt){if(1&L&&o.nrm(0,"img",59),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostTreasuresTip)}}function he(L,tt){if(1&L&&(o.j41(0,"tr",36)(1,"td",41),o.EFF(2),o.k0s(),o.j41(3,"td",42),o.EFF(4),o.k0s(),o.j41(5,"td",42),o.EFF(6),o.k0s(),o.j41(7,"td",42),o.EFF(8),o.k0s(),o.j41(9,"td",42),o.EFF(10),o.k0s(),o.j41(11,"td",42),o.EFF(12),o.k0s(),o.j41(13,"td",42),o.EFF(14),o.k0s(),o.j41(15,"td",42),o.EFF(16),o.k0s(),o.j41(17,"td",42),o.EFF(18),o.k0s(),o.j41(19,"td",43),o.DNE(20,Ye,1,1,"img",44)(21,ri,1,1,"img",45)(22,li,1,1,"img",46)(23,Oe,1,1,"img",47)(24,q,1,1,"img",48)(25,Ue,1,1,"img",49)(26,bi,1,1,"img",50)(27,Ee,1,1,"img",51),o.k0s()()),2&L){const g=tt.$implicit;o.R7$(2),o.JRh(g.playerName),o.R7$(2),o.JRh(g.scoreEconomic),o.R7$(2),o.JRh(g.scoreMilitary),o.R7$(2),o.JRh(g.scoreTotal),o.R7$(2),o.JRh(g.buildingLost),o.R7$(2),o.JRh(g.buildingRazed),o.R7$(2),o.JRh(g.unitsConverted),o.R7$(2),o.JRh(g.unitsKilled),o.R7$(2),o.JRh(g.unitsLost),o.R7$(2),o.Y8G("ngIf",g.isHigestScore),o.R7$(),o.Y8G("ngIf",g.isLeastResources),o.R7$(),o.Y8G("ngIf",g.isMostImprovements),o.R7$(),o.Y8G("ngIf",g.isMostKills),o.R7$(),o.Y8G("ngIf",g.isMostLosses),o.R7$(),o.Y8G("ngIf",g.isMostMilitary),o.R7$(),o.Y8G("ngIf",g.isMostResources),o.R7$(),o.Y8G("ngIf",g.isMostTreasures)}}function ie(L,tt){if(1&L&&o.nrm(0,"img",52),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isHigestScoreTip)}}function Xe(L,tt){if(1&L&&o.nrm(0,"img",53),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isLeastResourcesTip)}}function xi(L,tt){if(1&L&&o.nrm(0,"img",54),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostImprovementsTip)}}function ne(L,tt){if(1&L&&o.nrm(0,"img",55),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostKillsTip)}}function Ke(L,tt){if(1&L&&o.nrm(0,"img",56),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostLossesTip)}}function Qe(L,tt){if(1&L&&o.nrm(0,"img",57),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostMilitaryTip)}}function vi(L,tt){if(1&L&&o.nrm(0,"img",58),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostResourcesTip)}}function Be(L,tt){if(1&L&&o.nrm(0,"img",59),2&L){const g=o.XpG(3);o.Y8G("matTooltip",g.isMostTreasuresTip)}}function Pi(L,tt){if(1&L&&(o.j41(0,"tr",36)(1,"td",41),o.EFF(2),o.k0s(),o.j41(3,"td",42),o.EFF(4),o.k0s(),o.j41(5,"td",42),o.EFF(6),o.k0s(),o.j41(7,"td",42),o.EFF(8),o.k0s(),o.j41(9,"td",42),o.EFF(10),o.k0s(),o.j41(11,"td",42),o.EFF(12),o.k0s(),o.j41(13,"td",42),o.EFF(14),o.k0s(),o.j41(15,"td",42),o.EFF(16),o.k0s(),o.j41(17,"td",42),o.EFF(18),o.k0s(),o.j41(19,"td",43),o.DNE(20,ie,1,1,"img",44)(21,Xe,1,1,"img",45)(22,xi,1,1,"img",46)(23,ne,1,1,"img",47)(24,Ke,1,1,"img",48)(25,Qe,1,1,"img",49)(26,vi,1,1,"img",50)(27,Be,1,1,"img",51),o.k0s()()),2&L){const g=tt.$implicit;o.R7$(2),o.JRh(g.playerName),o.R7$(2),o.JRh(g.scoreEconomic),o.R7$(2),o.JRh(g.scoreMilitary),o.R7$(2),o.JRh(g.scoreTotal),o.R7$(2),o.JRh(g.buildingLost),o.R7$(2),o.JRh(g.buildingRazed),o.R7$(2),o.JRh(g.unitsConverted),o.R7$(2),o.JRh(g.unitsKilled),o.R7$(2),o.JRh(g.unitsLost),o.R7$(2),o.Y8G("ngIf",g.isHigestScore),o.R7$(),o.Y8G("ngIf",g.isLeastResources),o.R7$(),o.Y8G("ngIf",g.isMostImprovements),o.R7$(),o.Y8G("ngIf",g.isMostKills),o.R7$(),o.Y8G("ngIf",g.isMostLosses),o.R7$(),o.Y8G("ngIf",g.isMostMilitary),o.R7$(),o.Y8G("ngIf",g.isMostResources),o.R7$(),o.Y8G("ngIf",g.isMostTreasures)}}function Te(L,tt){if(1&L){const g=o.RV6();o.j41(0,"tbody",23),o.bIt("click",function(){const x=o.eBV(g).index,z=o.XpG();return o.Njj(z.showHideRow(x))}),o.j41(1,"tr")(2,"td",24),o.EFF(3),o.k0s(),o.j41(4,"td",24)(5,"div"),o.EFF(6),o.k0s(),o.j41(7,"div"),o.EFF(8),o.k0s()(),o.j41(9,"td",25),o.nrm(10,"app-match-history-player",26),o.k0s(),o.j41(11,"td",27),o.DNE(12,He,4,6,"ng-container",28),o.k0s(),o.j41(13,"td",29),o.DNE(14,yi,3,1,"ng-container",28),o.k0s(),o.j41(15,"td",30)(16,"div"),o.nrm(17,"img",31),o.k0s()(),o.j41(18,"td",29),o.DNE(19,qt,3,1,"ng-container",28),o.k0s(),o.j41(20,"td",27),o.DNE(21,Se,4,6,"ng-container",28),o.k0s(),o.j41(22,"td",32),o.nrm(23,"app-match-history-opponent",33),o.k0s(),o.j41(24,"td",24),o.EFF(25),o.k0s(),o.j41(26,"td",24)(27,"span"),o.EFF(28),o.k0s()()(),o.j41(29,"tr")(30,"td",34)(31,"table",35)(32,"tr",36)(33,"th",37),o.EFF(34),o.k0s(),o.j41(35,"th",37),o.EFF(36),o.k0s(),o.j41(37,"th",37),o.EFF(38),o.k0s(),o.j41(39,"th",37),o.EFF(40),o.k0s(),o.j41(41,"th",37),o.EFF(42),o.k0s(),o.j41(43,"th",37),o.EFF(44),o.k0s(),o.j41(45,"th",37),o.EFF(46),o.k0s(),o.j41(47,"th",37),o.EFF(48),o.k0s(),o.j41(49,"th",37),o.EFF(50),o.k0s(),o.j41(51,"th",37),o.EFF(52),o.k0s()(),o.DNE(53,he,28,17,"tr",38)(54,Pi,28,17,"tr",38),o.k0s()()()()}if(2&L){const g=tt.$implicit,S=tt.index,x=o.XpG();o.R7$(3),o.SpI(" ",x.getGameMode(g.gameMode)," "),o.R7$(3),o.JRh(x.formatDate(g.StartDate)),o.R7$(2),o.JRh(g.StartDate.toLocaleTimeString("en-GB")),o.R7$(2),o.Y8G("PlayerList",g.PlayerList)("isWin",g.isWin)("idPlayer",x.idPlayer),o.R7$(2),o.Y8G("ngForOf",g.PlayerList),o.R7$(2),o.Y8G("ngForOf",g.PlayerList),o.R7$(3),o.Y8G("src",g.MapUrl,o.B4B),o.R7$(2),o.Y8G("ngForOf",g.OpponentList),o.R7$(2),o.Y8G("ngForOf",g.OpponentList),o.R7$(2),o.Y8G("OpponentList",g.OpponentList)("isWin",!g.isWin)("idPlayer",x.idPlayer),o.R7$(2),o.SpI(" ",g.MapName," "),o.R7$(3),o.JRh(g.Length),o.R7$(2),o.Y8G("id","hidden_row"+S),o.R7$(4),o.SpI(" ",x.playerNameText," "),o.R7$(2),o.SpI(" ",x.scoreEconomicText," "),o.R7$(2),o.SpI(" ",x.scoreMilitaryText," "),o.R7$(2),o.SpI(" ",x.scoreTotalText," "),o.R7$(2),o.SpI(" ",x.buildingLostText," "),o.R7$(2),o.SpI(" ",x.buildingRazedText," "),o.R7$(2),o.SpI(" ",x.unitsConvertedText," "),o.R7$(2),o.SpI(" ",x.unitsKilledText," "),o.R7$(2),o.SpI(" ",x.unitsLostText," "),o.R7$(2),o.SpI(" ",x.trophyText," "),o.R7$(),o.Y8G("ngForOf",g.PlayerList),o.R7$(),o.Y8G("ngForOf",g.OpponentList)}}let ve=(()=>{class L{constructor(g,S){this.stringTableService=g,this.jsonService=S,this.isLoading=!1,this.newPageEvent=new o.bkB,this.newSizeEvent=new o.bkB,this.showTable=!1,this.page=0,this.showUnrated=!1,this.show1v1Ranked=!0,this.showTeamGameRanked=!0,this.maxPage=0,this.totalElements=0,this.size=10,this.isDetailExpanded=!1,this.sizeList=[5,6,7,8,9,10,15,20,30,40,50],this.sizeStorageKey="matches_size_storage_key"}ngOnInit(){var g=this;return(0,xt.A)(function*(){g.mapInfos=yield(0,ot.re)(g.jsonService),g.stringTableService.setLanguage((0,ot.xd)()),yield g.stringTableService.loadStringTable();let x=yield g.stringTableService.getLocalizedStrings([32710,31560,31389,31395,31457,31394,31559,31558,36490,36491,19060,19070,19068,49322,19067,19069,42314,21255,19830,20513,70752,30078,19103,20510]);g.isHigestScoreTip=x[32710],g.isLeastResourcesTip=x[31560],g.isMostImprovementsTip=x[31389],g.isMostKillsTip=x[31395],g.isMostLossesTip=x[31457],g.isMostMilitaryTip=x[31394],g.isMostResourcesTip=x[31559],g.isMostTreasuresTip=x[31558],g.scoreEconomicText=x[36490],g.scoreMilitaryText=x[36491],g.scoreTotalText=x[19060],g.buildingLostText=x[19070],g.buildingRazedText=x[19068],g.unitsConvertedText=x[49322],g.unitsKilledText=x[19067],g.unitsLostText=x[19069],g.trophyText=x[42314],g.playerNameText=x[21255],g.moreText=x[19830],g.timeText=x[20513],g.alliesText=x[70752],g.mapText=x[30078],g.opponentText=x[19103],g.durationText=x[20510]})()}ngAfterViewInit(){var g=localStorage.getItem(this.sizeStorageKey);g&&(this.size=+g),this.sizepicker.updateItem(this.size)}ngOnChanges(g){"incomingMatchs"in g&&null!=this.incomingMatchs?this.newMatchsDetected():this.showTable=!1}OnSizeChanged(g){this.size=g,this.page=0,localStorage.setItem(this.sizeStorageKey,this.size.toString()),this.newSizeEvent.emit(this.size)}newMatchsDetected(){var g=this;return(0,xt.A)(function*(){if(0===Object.keys(g.incomingMatchs).length)return void(g.showTable=!1);g.totalElements=g.incomingMatchs.totalElements,g.maxPage=Math.floor(g.totalElements/g.size),g.showPage=g.page+1,g.showPageMax=g.maxPage+1,g.matchArray=[],g.detailHeight=[];let S=g.incomingMatchs.content;for(let x=0;x<S.length;x++){let Re,z=S[x],et=[],Bt=[];if(!z.matchPlayerInfo||!z.playerCount)continue;for(let le=0;le<z.matchPlayerInfo.length;le++)if(null!=g.idPlayer&&z.matchPlayerInfo[le].idPlayer==g.idPlayer||null!=g.idCiv&&z.matchPlayerInfo[le].idCiv==g.idCiv){Re=z.matchPlayerInfo[le].team;break}if(null==Re)continue;let Ze,qe,Qt=null,ui=!1;for(let le=0;le<z.matchPlayerInfo.length;le++){let De,zt=z.matchPlayerInfo[le],Le=zt.idCiv,ji=zt.playerName+"",me="";Le?(0,Mt.JH)(Le)?(De=(0,Mt.JH)(Le),me+=(0,Mt.HH)(Le)):(De="CivId: "+Le,me+="flag_hc_random.png",ji+=" ["+De+"]"):(De="Unknown",Le=-1);let ti=0!=g.idPlayer&&zt.idPlayer==g.idPlayer||0!=g.idCiv&&zt.idCiv==g.idCiv;ti&&(Qt=zt);let zi={playerName:ji,idPlayer:zt.idPlayer,civName:De,civFlagUrl:me,elo:zt.eloBefore,eloDiff:zt.eloAfter-zt.eloBefore,isThisPlayer:ti,isHigestScore:1==zt.isHigestScore,isLeastResources:1==zt.isLeastResources,isMostImprovements:1==zt.isMostImprovements,isMostKills:1==zt.isMostKills,isMostLosses:1==zt.isMostLosses,isMostMilitary:1==zt.isMostMilitary,isMostResources:1==zt.isMostResources,isMostTreasures:1==zt.isMostTreasures,scoreEconomic:zt.scoreEconomic,scoreMilitary:zt.scoreMilitary,scoreTotal:zt.scoreTotal,buildingLost:zt.buildingLost,buildingRazed:zt.buildingRazed,unitsConverted:zt.unitsConverted,unitsKilled:zt.unitsKilled,unitsLost:zt.unitsLost};zt.team==Re?et.push(zi):Bt.push(zi)}z.idMap?(0,ot.oY)(g.mapInfos,z.idMap)?(Ze=yield(0,ot.Sq)(g.stringTableService,g.mapInfos,z.idMap),qe=(0,ot.oY)(g.mapInfos,z.idMap)):(Ze=-1==z.idMap?"":"MapId: "+z.idMap,qe=(0,ot.MR)(g.mapInfos)):(Ze=yield(0,ot.Sq)(g.stringTableService,g.mapInfos,43),z.idMap=0,qe=(0,ot.MR)(g.mapInfos)),ui=1==Qt?.result;let Ci,fi,fe,Ai=new Date(z.startDate),Bi=new Date(z.endDate);if(Ci=!!z.isRanked&&z.isRanked,fe=Math.floor(z.gameLength/60),0==fe)fi=z.gameLength%60+"s";else{let le=Math.floor(fe/60);fi=0==le?`${fe}m`:`${le}h ${fe}m`}g.matchArray.push({MapName:Ze,MapUrl:qe,StartDate:Ai,EndDate:Bi,Length:fi,PlayerList:et,OpponentList:Bt,playerCount:z.playerCount,isWin:ui,isRanked:Ci,hidden:!1,gameMode:z.gameMode}),g.detailHeight.push(0)}g.showTable=g.matchArray.length>0})()}goToPage(){!this.page||this.page<0?this.page=0:this.page>this.maxPage&&(this.page=this.maxPage),this.addnewPageEvent(this.page)}nextPage(){this.page!=this.maxPage&&(this.page++,this.addnewPageEvent(this.page))}previousPage(){0!=this.page&&(this.page--,this.addnewPageEvent(this.page))}lastPage(){this.page=this.maxPage,this.addnewPageEvent(this.page)}firstPage(){this.page=0,this.addnewPageEvent(this.page)}get pagePlusOne(){return this.page+1}set pagePlusOne(g){this.page=g-1,this.addnewPageEvent(this.page)}get maxPagePlusOne(){return this.maxPage+1}addnewPageEvent(g){this.newPageEvent.emit(g)}OnPageChanged(g){this.page=g,this.addnewPageEvent(g)}showHideRow(g){var S=document.getElementById("hidden_row"+g);this.isDetailExpanded?S&&(S.style.display="none"):S&&(S.style.display=""),this.isDetailExpanded=!this.isDetailExpanded}getGameMode(g){switch(g){case 1:return"Solo";case 2:return"Team";case 3:return"Treaty";case 4:return"DM";case 5:return"EW Solo";case 6:return"EW Team";case 8:return"2v2";case 9:return"3v3";case 10:return"4v4";default:return""}}formatDate(g){const x=g.getDate(),z=g.getMonth(),et=g.getFullYear();return`${x} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][z]} ${et}`}getEloDiffAbsolute(g){return Math.abs(g)}static#t=this.\u0275fac=function(S){return new(S||L)(o.rXU(ct.N),o.rXU(kt.W))};static#e=this.\u0275cmp=o.VBU({type:L,selectors:[["app-matches-table"]],viewQuery:function(S,x){if(1&S&&o.GBs(si,5),2&S){let z;o.mGM(z=o.lsd())&&(x.sizepicker=z.first)}},inputs:{incomingMatchs:"incomingMatchs",isLoading:"isLoading",idCiv:"idCiv",idPlayer:"idPlayer"},outputs:{newPageEvent:"newPageEvent",newSizeEvent:"newSizeEvent"},features:[o.OA$],decls:41,vars:14,consts:[["sizepicker",""],["pagepagination",""],[1,"custom-container"],[4,"ngIf"],[1,"table-container"],[1,"custom-parent-sides","mb-10"],[1,"filter-general-container"],[1,"filter-general-columns"],[3,"OnPageChanged","Name","List"],[3,"OnPageChanged","Page","MaxPage"],[1,"table","table-dark","table-responsive","mt-15"],["scope","col",1,"visible","table-th"],["scope","col",1,"table-th-right"],["scope","col",1,"table-th",2,"width","min-content !important"],["scope","col",1,"table-th"],["scope","col",1,"table-th-left"],[1,"tr-spacer"],[1,"manual-border"],[3,"click",4,"ngFor","ngForOf"],[1,"custom-parent-sides","mt-20","mb-20"],[1,"total-pages","mt-10"],["diameter","50",2,"margin","auto"],[2,"height","2rem"],[3,"click"],[1,"visible","table-td","date-time"],[1,"table-td-right","player-width"],[3,"PlayerList","isWin","idPlayer"],[1,"table-td",2,"max-width","3rem"],[4,"ngFor","ngForOf"],[1,"table-td","flag-container-min"],[1,"table-td","map-icon-container"],["alt","...",1,"map-icon",3,"src"],[1,"table-td-left","player-width"],[3,"OpponentList","isWin","idPlayer"],["colspan","11",1,"table-td",2,"display","none",3,"id"],[1,"table-detail"],[2,"border","solid 1px grey"],[1,"detail-column-header",2,"border","solid 1px grey"],["style","border: solid 1px grey",4,"ngFor","ngForOf"],[3,"name"],["alt","...",1,"flag-min",3,"src"],[1,"detail-text-player"],[1,"detail-text"],[1,"badge-icons",2,"border","none"],["src","assets/Data/wpfg/resources/images/icons/post_game/fame.png",3,"matTooltip",4,"ngIf"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_least_resources.png",3,"matTooltip",4,"ngIf"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_tech.png",3,"matTooltip",4,"ngIf"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_kills.png",3,"matTooltip",4,"ngIf"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_losses.png",3,"matTooltip",4,"ngIf"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_largest_army.png",3,"matTooltip",4,"ngIf"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_resources.png",3,"matTooltip",4,"ngIf"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_treasures.png",3,"matTooltip",4,"ngIf"],["src","assets/Data/wpfg/resources/images/icons/post_game/fame.png",3,"matTooltip"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_least_resources.png",3,"matTooltip"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_tech.png",3,"matTooltip"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_kills.png",3,"matTooltip"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_losses.png",3,"matTooltip"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_largest_army.png",3,"matTooltip"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_resources.png",3,"matTooltip"],["src","assets/Data/wpfg/resources/images/icons/post_game/awards_most_treasures.png",3,"matTooltip"]],template:function(S,x){if(1&S){const z=o.RV6();o.j41(0,"div",2),o.DNE(1,Ne,3,0,"ng-container",3),o.k0s(),o.j41(2,"div",4)(3,"div",5)(4,"div",6)(5,"div",7)(6,"app-picker",8,0),o.bIt("OnPageChanged",function(Bt){return o.eBV(z),o.Njj(x.OnSizeChanged(Bt))}),o.k0s(),o.j41(8,"app-pagination",9,1),o.bIt("OnPageChanged",function(Bt){return o.eBV(z),o.Njj(x.OnPageChanged(Bt))}),o.k0s()()()(),o.j41(10,"table",10)(11,"thead")(12,"tr")(13,"th",11),o.EFF(14,"Mode"),o.k0s(),o.j41(15,"th",11),o.EFF(16,"Date/Time"),o.k0s(),o.j41(17,"th",12),o.EFF(18,"Allies"),o.k0s(),o.nrm(19,"th",13)(20,"th",13),o.j41(21,"th",14),o.EFF(22),o.k0s(),o.nrm(23,"th",13)(24,"th",13),o.j41(25,"th",15),o.EFF(26,"Opponents"),o.k0s(),o.j41(27,"th",11),o.EFF(28,"Map Name"),o.k0s(),o.j41(29,"th",11),o.EFF(30),o.k0s()(),o.nrm(31,"tr",16)(32,"tr",17),o.k0s(),o.DNE(33,Te,55,29,"tbody",18),o.k0s(),o.j41(34,"div",19)(35,"div",6)(36,"div",7)(37,"app-pagination",9,1),o.bIt("OnPageChanged",function(Bt){return o.eBV(z),o.Njj(x.OnPageChanged(Bt))}),o.k0s()(),o.j41(39,"div",20),o.EFF(40),o.k0s()()()()}2&S&&(o.R7$(),o.Y8G("ngIf",x.isLoading),o.R7$(),o.AVh("hidden",!x.showTable||x.isLoading),o.R7$(4),o.Y8G("Name","Display:")("List",x.sizeList),o.R7$(2),o.Y8G("Page",x.page)("MaxPage",x.maxPage),o.R7$(14),o.JRh(x.mapText),o.R7$(8),o.JRh(x.durationText),o.R7$(3),o.Y8G("ngForOf",x.matchArray),o.R7$(4),o.Y8G("Page",x.page)("MaxPage",x.maxPage),o.R7$(3),o.Lme(" ",x.pagePlusOne," of ",x.maxPagePlusOne," pages "))},dependencies:[d.Sq,d.bT,oe.e,se.I,ce.$e,Zt.w,we.Q,_e.LG,Ae.oV],styles:['.table-container[_ngcontent-%COMP%]{padding-top:0;margin-top:-10}.visible[_ngcontent-%COMP%]{display:""}.hidden[_ngcontent-%COMP%]{display:none}@media only screen and (max-width: 800px){.visible[_ngcontent-%COMP%]{display:none}}.manual-border[_ngcontent-%COMP%]{border-bottom:1px solid rgba(255,255,255,.1);width:100%}.tr-spacer[_ngcontent-%COMP%]{height:.4rem}.custom-space[_ngcontent-%COMP%]{position:relative;vertical-align:middle!important;padding-inline:0;width:10rem}.map-icon-container[_ngcontent-%COMP%]{width:7rem}.map-icon[_ngcontent-%COMP%]{max-width:7rem;max-height:7rem;width:auto;height:auto}.duration[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.duration-text[_ngcontent-%COMP%]{display:flex;align-items:center}.expand-icon[_ngcontent-%COMP%]{position:absolute;transform:scale(1.2) translateY(-50%);transition-duration:.5s;transition-property:transform;font-variant:normal;margin-left:auto;right:0;top:50%}.expand-icon-rotate[_ngcontent-%COMP%]{position:absolute;transform:rotate(-180deg);font-variant:normal;right:calc(50% - 2rem);top:50%}.table-detail[_ngcontent-%COMP%]{width:100%}.table-detail[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:solid 1px grey}.player-width[_ngcontent-%COMP%]{min-width:clamp(10rem,20vw,20rem)!important}.flag-container-min[_ngcontent-%COMP%]{width:2rem}.flag-min[_ngcontent-%COMP%]{max-width:2rem;max-height:2rem;width:auto;height:auto}.detail-column-header[_ngcontent-%COMP%]{vertical-align:middle;color:#999;text-shadow:2px solid black;min-height:2rem;padding-left:.2rem;padding-right:.2rem}.detail-text-player[_ngcontent-%COMP%]{border:solid 1px grey;color:gray;vertical-align:middle;min-width:165px}.detail-text[_ngcontent-%COMP%]{border:solid 1px grey;color:gray;text-align:center;vertical-align:middle}.badge-icons[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;min-width:5.5rem}.badge-icons[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:clamp(1.5rem,2vw,2rem);padding:2px}.game-mode-select[_ngcontent-%COMP%]{background:transparent}.game-mode[_ngcontent-%COMP%]{position:absolute;inset:3px 0 0;z-index:150;text-align:center;color:#fff;font-family:"Source Sans 3";font-size:1.2rem;font-weight:700;text-shadow:1px 2px 2px rgb(0,0,0),1px 2px 2px rgb(0,0,0),2px 5px 5px rgb(0,0,0)}.search-match-history[_ngcontent-%COMP%]{display:flex;font-family:Open Sans,sans-serif;font-variant:normal;align-items:flex-end;flex:1;justify-content:flex-end;margin-right:20px}.date-time[_ngcontent-%COMP%]{font-size:1rem!important}@media only screen and (max-width:1400px){.date-time[_ngcontent-%COMP%]{font-size:.9rem!important}.flag-container-min[_ngcontent-%COMP%]{width:1.5rem}.flag-min[_ngcontent-%COMP%]{max-width:1.5rem;max-height:1.5rem}.map-icon-container[_ngcontent-%COMP%]{width:5rem}.map-icon[_ngcontent-%COMP%]{max-width:5rem;max-height:5rem}}@media only screen and (max-width:1200px){.date-time[_ngcontent-%COMP%]{font-size:.7rem!important}.flag-container-min[_ngcontent-%COMP%]{width:1rem}.flag-min[_ngcontent-%COMP%]{max-width:1rem;max-height:1rem}.map-icon-container[_ngcontent-%COMP%]{width:3rem}.map-icon[_ngcontent-%COMP%]{max-width:3rem;max-height:3rem}}@media only screen and (max-width:900px){.filter-row[_ngcontent-%COMP%]{padding-left:1rem}.date-time[_ngcontent-%COMP%]{font-size:.5rem!important}.flag-container-min[_ngcontent-%COMP%]{width:.8rem}.flag-min[_ngcontent-%COMP%]{max-width:.8rem;max-height:.8rem}.map-icon-container[_ngcontent-%COMP%]{width:2rem}}@media only screen and (max-width:700px){.subheading[_ngcontent-%COMP%]{padding-left:1rem}}@media only screen and (max-width:600px){.subheading[_ngcontent-%COMP%]{padding-left:.5rem}}']})}return L})();const Mi=["patchpicker"],Pe=["modepicker"],C=["lowerslider"],T=["upperslider"],v=["myForm"];function M(L,tt){if(1&L&&(o.j41(0,"mat-option",34),o.EFF(1),o.k0s()),2&L){const g=tt.$implicit,S=o.XpG(3);o.Y8G("value",g),o.R7$(),o.Lme(" #",S.getRankByGamemode(g)," ",g.name," ")}}function E(L,tt){if(1&L){const g=o.RV6();o.j41(0,"div",27)(1,"div",28),o.nrm(2,"img",29),o.j41(3,"input",30),o.mxI("ngModelChange",function(x){o.eBV(g);const z=o.XpG().$implicit;return o.DH7(z.player,x)||(z.player=x),o.Njj(x)}),o.bIt("ngModelChange",function(x){o.eBV(g);const z=o.XpG().index,et=o.XpG();return o.Njj(et.searchPlayer(x,z))}),o.k0s(),o.j41(4,"mat-autocomplete",31,5),o.bIt("optionSelected",function(){o.eBV(g);const x=o.XpG(2);return o.Njj(x.onOptionSelected())}),o.DNE(6,M,2,3,"mat-option",32),o.k0s()(),o.j41(7,"app-picker-image",33),o.bIt("OnPageChanged",function(x){o.eBV(g);const z=o.XpG().index,et=o.XpG();return o.Njj(et.OnFlagChanged(x,z,1))}),o.k0s()()}if(2&L){const g=o.sdS(5),S=o.XpG(),x=S.$implicit,z=S.index,et=o.XpG();o.R7$(2),o.FS9("src",et.getSteamAvatar(null==x.player?null:x.player.avatarSteam),o.B4B),o.R7$(),o.AVh("disabled-placeholder",x.disabled),o.Mz_("id","team1.player",z,""),o.Mz_("name","player1",z,""),o.Y8G("matAutocomplete",g),o.R50("ngModel",x.player),o.Y8G("placeholder",et.placeHolder[z])("readonly",x.disabled),o.R7$(),o.Y8G("displayWith",et.displayFn),o.R7$(2),o.Y8G("ngForOf",et.filteredPlayers[z]),o.R7$(),o.Y8G("options",et.options)("showLabel",!1)}}function F(L,tt){if(1&L&&(o.j41(0,"div"),o.DNE(1,E,8,15,"div",26),o.k0s()),2&L){const g=tt.$implicit;o.R7$(),o.Y8G("ngIf",g.show)}}function N(L,tt){if(1&L&&(o.j41(0,"mat-option",34),o.EFF(1),o.k0s()),2&L){const g=tt.$implicit,S=o.XpG(3);o.Y8G("value",g),o.R7$(),o.Lme(" #",S.getRankByGamemode(g)," ",g.name," ")}}function K(L,tt){if(1&L){const g=o.RV6();o.j41(0,"div",27)(1,"div",28),o.nrm(2,"img",29),o.j41(3,"input",30),o.mxI("ngModelChange",function(x){o.eBV(g);const z=o.XpG().$implicit;return o.DH7(z.player,x)||(z.player=x),o.Njj(x)}),o.bIt("ngModelChange",function(x){o.eBV(g);const z=o.XpG().index,et=o.XpG();return o.Njj(et.searchPlayer(x,z))}),o.k0s(),o.j41(4,"mat-autocomplete",31,5),o.bIt("optionSelected",function(){o.eBV(g);const x=o.XpG(2);return o.Njj(x.onOptionSelected())}),o.DNE(6,N,2,3,"mat-option",32),o.k0s()(),o.j41(7,"app-picker-image",33,6),o.bIt("OnPageChanged",function(x){o.eBV(g);const z=o.XpG().index,et=o.XpG();return o.Njj(et.OnFlagChanged(x,z,2))}),o.k0s()()}if(2&L){const g=o.sdS(5),S=o.XpG(),x=S.$implicit,z=S.index,et=o.XpG();o.R7$(2),o.FS9("src",et.getSteamAvatar(null==x.player?null:x.player.avatarSteam),o.B4B),o.R7$(),o.AVh("disabled-placeholder",x.disabled),o.Mz_("id","team2.player",z,""),o.Mz_("name","player2",z,""),o.Y8G("matAutocomplete",g),o.R50("ngModel",x.player),o.Y8G("placeholder",et.placeHolder[z+4])("readonly",x.disabled),o.R7$(),o.Y8G("displayWith",et.displayFn),o.R7$(2),o.Y8G("ngForOf",et.filteredPlayers[z]),o.R7$(),o.Y8G("options",et.options)("showLabel",!1)}}function ut(L,tt){if(1&L&&(o.j41(0,"div"),o.DNE(1,K,9,15,"div",26),o.k0s()),2&L){const g=tt.$implicit;o.R7$(),o.Y8G("ngIf",g.show)}}function ht(L,tt){1&L&&o.nrm(0,"div",35)}function yt(L,tt){if(1&L&&(o.j41(0,"div",36)(1,"div",37),o.nrm(2,"img",38),o.j41(3,"div"),o.EFF(4),o.k0s()(),o.j41(5,"div",37),o.nrm(6,"img",39),o.j41(7,"div"),o.EFF(8),o.k0s()(),o.j41(9,"div",37),o.nrm(10,"img",40),o.j41(11,"div"),o.EFF(12),o.k0s()(),o.j41(13,"div",37),o.nrm(14,"img",41),o.j41(15,"div"),o.EFF(16),o.k0s()()()),2&L){const g=o.XpG();o.R7$(4),o.Lme("",g.winCount," ",g.winCount>0?"WINS":"WIN",""),o.R7$(4),o.Lme(" ",g.getLosses()," ",g.getLosses()>1?"LOSSES":"LOSS"," "),o.R7$(4),o.Lme("",g.totalCount," ",g.totalCount>1?"GAMES":"GAME",""),o.R7$(4),o.SpI("",g.getWinRatio(g.winCount,g.totalCount)," WINRATE")}}function Lt(L,tt){1&L&&(o.j41(0,"div",35),o.nrm(1,"img",39),o.j41(2,"div"),o.EFF(3,"invalid criteria."),o.k0s()())}function Ft(L,tt){1&L&&(o.j41(0,"div",35),o.nrm(1,"img",39),o.j41(2,"div"),o.EFF(3," Sorry, we couldn't find any results matching your search parameters. "),o.k0s()())}class wt{constructor(tt,g,S,x,z){this.id=tt,this.gamemode=g,this.patch=S,this.eloMin=x,this.eloMax=z}}let $t=(()=>{class L{constructor(g,S,x,z,et,Bt,Re){this.patchService=g,this.leaderboardService=S,this.playerMatchsService=x,this.authService=z,this.cdr=et,this.steamService=Bt,this.sharedDataService=Re,this.minElo=0,this.maxElo=2500,this._eloLowerBound=this.minElo,this._eloUpperBound=this.maxElo,this.modeStorageKey="matches_mode_storage_key",this.sizeStorageKey="matches_size_storage_key",this.eloLowerBoundStorageKey="matches_lower_storage_key",this.eloUpperBoundStorageKey="matches_upper_storage_key",this.options=Mt.TR,this.patchIds=[],this.patchNumbers=[],this.modeNameList=Mt.Fy,this.modeValueList=Mt.nQ,this._selectedPatch=0,this.isLoading=!1,this.civOptions=[],this.page=0,this.playerList=[],this.playerListInit=[],this.placeHolder=["Search player 1...","Search player 2...","Search player 3...","Search player 4...","Search opponent 1...","Search opponent 2...","Search opponent 3...","Search opponent 4..."],this.isLogged=!1,this.filteredPlayers=[[]],this.hasResults=!1,this.noResults=!1,this.badCriteria=!1,this.team1Players=[{player:null,civ:0,team:1,show:!0,disabled:!1},{player:null,civ:0,team:1,show:!1,disabled:!0},{player:null,civ:0,team:1,show:!1,disabled:!0},{player:null,civ:0,team:1,show:!1,disabled:!0}],this.team2Players=[{player:null,civ:0,team:2,show:!0,disabled:!0},{player:null,civ:0,team:2,show:!1,disabled:!0},{player:null,civ:0,team:2,show:!1,disabled:!0},{player:null,civ:0,team:2,show:!1,disabled:!0}],this.model=new wt(1,0,0,0,2500),this.submitted=!1,this.subscriptions=[],this.setButtonStyles();for(let Qt in Mt.Wv)isNaN(Number(Qt))||(0==+Qt&&(Qt="49"),this.civOptions.push({value:+Qt,label:Mt.Wv[Qt],flag:(0,Mt.sQ)(+Qt)}));this.isLoggedIn$=this.authService.isLoggedIn,this.subscriptions.push(this.isLoggedIn$.subscribe(Qt=>{Qt&&this.subscriptions.push(this.authService.getUserProfile().subscribe(ui=>{this.currentUser=ui}))}))}ngOnInit(){var g=localStorage.getItem(this.sizeStorageKey);this.size=g?parseInt(g,10):10}ngAfterViewInit(){setTimeout(()=>{let g=this.sharedDataService.getData();if(g){var S=g.players,x=g.opponents;if(S&&x){switch(S.length){case 1:this.model.gamemode=1;break;case 2:this.model.gamemode=8;break;case 3:this.model.gamemode=9;break;case 4:this.model.gamemode=10}this.modepicker?.updateItem(this.model.gamemode);for(var et=0;et<S.length;et++)this.team1Players[et].show=!0,this.team1Players[et].disabled=!1,this.team1Players[et].player={idPlayer:S[et].idPlayer,rank:0,rank2:0,rank3:0,rank4:0,rank5:0,rank6:0,rank8:0,rank9:0,rank10:0,name:S[et].playerName,avatarSteam:""},this.team2Players[et].show=!0,this.team2Players[et].disabled=!1,this.team2Players[et].player={idPlayer:x[et].idPlayer,rank:0,rank2:0,rank3:0,rank4:0,rank5:0,rank6:0,rank8:0,rank9:0,rank10:0,name:x[et].playerName,avatarSteam:""};return this.cdr.detectChanges(),this.getPatchs(),this.getPlayerList(),void this.OnClicked(1)}}const Bt=localStorage.getItem(this.modeStorageKey);Bt&&(this.model.gamemode=+Bt,this.modepicker.updateItem(+Bt)),this.updateFieldDisplay(this.model.gamemode);const Re=localStorage.getItem(this.eloLowerBoundStorageKey);Re&&(this._eloLowerBound=+Re,this.lowerslider.nativeElement.value=Re,this.model.eloMin=this._eloLowerBound);const Qt=localStorage.getItem(this.eloUpperBoundStorageKey);Qt&&(this._eloUpperBound=+Qt,this.upperslider.nativeElement.value=Qt,this.model.eloMax=this._eloUpperBound),this.cdr.detectChanges(),this.getPatchs(),this.getPlayerList()})}getRankByGamemode(g){switch(this.model.gamemode){case 1:default:return g.rank;case 2:return g.rank2;case 3:return g.rank3;case 4:return g.rank4;case 5:return g.rank5;case 6:return g.rank6;case 8:return g.rank8;case 9:return g.rank9;case 10:return g.rank10}}getSteamAvatar(g){return g||"assets/icons/no_avatar.jpg"}OnClicked(g){if(1===g){if(!this.team1Players[0].player&&!this.team1Players[0].civ)return void(this.badCriteria=!0);this.submitted=!0,this.isLoading=!0,this.totalCount=0,this.page=0,this.getMatchs(),this.getWinCount()}else if(2===g){this.myForm?.resetForm(),this.pickerImages?.forEach(S=>{S.reset()}),this.isLoading=!1,this.hasResults=!1,this.noResults=!1;for(let S=0;S<8;S++)this.filteredPlayers[S]=this.playerList.slice(0,25);this.team1Players.forEach((S,x)=>{S.player=null,S.civ=0,S.team=1,S.show=0===x,S.disabled=0!==x}),this.team2Players.forEach((S,x)=>{S.player=null,S.civ=0,S.team=1,S.show=0===x,S.disabled=!0}),this.updateFieldDisplay(this.model.gamemode)}}setButtonStyles(){const g=window.innerWidth;this.buttonStyle=g<600?{"padding-left":"1rem","padding-right":"1rem","min-height":"1rem"}:g<900?{"padding-left":"3rem","padding-right":"3rem","min-height":"2rem"}:{"padding-left":"5rem","padding-right":"5rem","min-height":"2.5rem"}}getPatchs(){this.subscriptions.push(this.patchService.getPatchs().subscribe({next:this.handleResponsePatch.bind(this),error:this.handleErrorPatch.bind(this)}))}getPlayerList(){this.subscriptions.push(this.leaderboardService.getPlayerList().subscribe({next:this.handleResponsePlayer.bind(this),error:this.handleErrorPlayer.bind(this)}))}handleResponsePlayer(g){var S=this;return(0,xt.A)(function*(){g&&(S.playerListInit=g,S.playerList=g,S.sortFilteredListByGameMode())})()}handleErrorPlayer(g){console.error("There was an error fetching the player list data",g),this.isLoading=!1}getWinCount(){this.subscriptions.push(this.playerMatchsService.getMatchsAdvancedFilterWinCount2(this.model.gamemode,this.model.patch,this.model.eloMin,this.model.eloMax,this.team1Players[0].player?this.team1Players[0].player.idPlayer:0,this.team1Players[0].civ,this.team1Players[1].player?this.team1Players[1].player.idPlayer:0,this.team1Players[1].civ,this.team1Players[2].player?this.team1Players[2].player.idPlayer:0,this.team1Players[2].civ,this.team1Players[3].player?this.team1Players[3].player.idPlayer:0,this.team1Players[3].civ,this.team2Players[0].player?this.team2Players[0].player.idPlayer:0,this.team2Players[0].civ,this.team2Players[1].player?this.team2Players[1].player.idPlayer:0,this.team2Players[1].civ,this.team2Players[2].player?this.team2Players[2].player.idPlayer:0,this.team2Players[2].civ,this.team2Players[3].player?this.team2Players[3].player.idPlayer:0,this.team2Players[3].civ).subscribe({next:this.handleResponseMatchWinCount.bind(this),error:this.handleErrorMatchWinCount.bind(this)}))}handleResponseMatchWinCount(g){var S=this;return(0,xt.A)(function*(){g?(S.isLoading=!1,S.winCount=g):S.isLoading=!1})()}handleErrorMatchWinCount(g){console.error("There was an error fetching the WinCount data",g),this.winCount=0,this.isLoading=!1,this.noResults=!0}getMatchs(){this.isLoading=!0,this.subscriptions.push(this.playerMatchsService.getMatchsAdvancedFilter2(this.model.gamemode,this.model.patch,this.model.eloMin,this.model.eloMax,this.team1Players[0].player?this.team1Players[0].player.idPlayer:0,this.team1Players[0].civ,this.team1Players[1].player?this.team1Players[1].player.idPlayer:0,this.team1Players[1].civ,this.team1Players[2].player?this.team1Players[2].player.idPlayer:0,this.team1Players[2].civ,this.team1Players[3].player?this.team1Players[3].player.idPlayer:0,this.team1Players[3].civ,this.team2Players[0].player?this.team2Players[0].player.idPlayer:0,this.team2Players[0].civ,this.team2Players[1].player?this.team2Players[1].player.idPlayer:0,this.team2Players[1].civ,this.team2Players[2].player?this.team2Players[2].player.idPlayer:0,this.team2Players[2].civ,this.team2Players[3].player?this.team2Players[3].player.idPlayer:0,this.team2Players[3].civ,this.page,this.size).subscribe({next:this.handleResponseMatch.bind(this),error:this.handleErrorMatch.bind(this)}))}handleResponseMatch(g){var S=this;return(0,xt.A)(function*(){if(!g||0==g.totalElements)return S.isLoading=!1,S.hasResults=!1,void(S.noResults=!0);S.matchs=g,S.totalCount=S.matchs.totalElements,S.isLoading=!1,S.hasResults=!0,S.noResults=!1})()}handleErrorMatch(g){console.error("There was an error fetching the match data",g),this.isLoading=!1,this.hasResults=!1,this.noResults=!0}handleResponsePatch(g){g&&(this.patchs=g,this.patchNumbers=this.patchs.map(S=>S.number),this.patchIds=this.patchs.map(S=>S.id),this._selectedPatch=Math.max(...this.patchs.map(S=>S.id)),this.model.patch=this._selectedPatch,this.patchpicker.updateOptions(this.patchNumbers,this.patchIds,this._selectedPatch))}handleErrorPatch(g){console.error("There was an error fetching the patch data",g),this.isLoading=!1}getLosses(){return this.totalCount&&this.winCount?this.totalCount-this.winCount:0}searchPlayer(g,S){this.badCriteria=!1,this.filteredPlayers[S]=this.playerList&&"string"==typeof g&&""!==g.trim()?this.playerList.filter(x=>x&&x.name&&x.name.toLowerCase().includes(g.toLowerCase().trim())).slice(0,25):this.playerListInit.slice(0,25),this.updateFieldDisabled()}onOptionSelected(){this.updateFieldDisabled(),this.noResults=!1,this.isLoading=!1,this.hasResults=!1,this.matchs={}}updateFieldDisabled(){const g=this.model.gamemode;1===g||5===g?this.team2Players[0].disabled=!this.team1Players[0].player||!this.team1Players[0].player.name||0===this.team1Players[0].player.name.length:8===g?(this.team1Players[1].disabled=!this.team1Players[0].player||!this.team1Players[0].player.name||0===this.team1Players[0].player.name.length,this.team2Players[0].disabled=!this.team1Players[0].player||!this.team1Players[0].player.name||0===this.team1Players[0].player.name.length,this.team2Players[1].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length&&this.team2Players[0].player&&this.team2Players[0].player.name&&0!==this.team2Players[0].player.name.length)):9===g?(this.team1Players[1].disabled=!this.team1Players[0].player||!this.team1Players[0].player.name||0===this.team1Players[0].player.name.length,this.team1Players[2].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length),this.team2Players[0].disabled=!this.team1Players[0].player||!this.team1Players[0].player.name||0===this.team1Players[0].player.name.length,this.team2Players[1].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length&&this.team2Players[0].player&&this.team2Players[0].player.name&&0!==this.team2Players[0].player.name.length),this.team2Players[2].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length&&this.team1Players[2].player&&this.team1Players[2].player.name&&0!==this.team1Players[2].player.name.length&&this.team2Players[0].player&&this.team2Players[0].player.name&&0!==this.team2Players[0].player.name.length&&this.team2Players[1].player&&this.team2Players[1].player.name&&0!==this.team2Players[1].player.name.length)):(this.team1Players[1].disabled=!this.team1Players[0].player||!this.team1Players[0].player.name||0===this.team1Players[0].player.name.length,this.team1Players[2].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length),this.team1Players[3].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length&&this.team1Players[2].player&&this.team1Players[2].player.name&&0!==this.team1Players[2].player.name.length),this.team2Players[0].disabled=!this.team1Players[0].player||!this.team1Players[0].player.name||0===this.team1Players[0].player.name.length,this.team2Players[1].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length&&this.team2Players[0].player&&this.team2Players[0].player.name&&0!==this.team2Players[0].player.name.length),this.team2Players[2].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length&&this.team1Players[2].player&&this.team1Players[2].player.name&&0!==this.team1Players[2].player.name.length&&this.team2Players[0].player&&this.team2Players[0].player.name&&0!==this.team2Players[0].player.name.length&&this.team2Players[1].player&&this.team2Players[1].player.name&&0!==this.team2Players[1].player.name.length),this.team2Players[3].disabled=!(this.team1Players[0].player&&this.team1Players[0].player.name&&0!==this.team1Players[0].player.name.length&&this.team1Players[1].player&&this.team1Players[1].player.name&&0!==this.team1Players[1].player.name.length&&this.team1Players[2].player&&this.team1Players[2].player.name&&0!==this.team1Players[2].player.name.length&&this.team1Players[3].player&&this.team1Players[3].player.name&&0!==this.team1Players[3].player.name.length&&this.team2Players[0].player&&this.team2Players[0].player.name&&0!==this.team2Players[0].player.name.length&&this.team2Players[1].player&&this.team2Players[1].player.name&&0!==this.team2Players[1].player.name.length&&this.team2Players[2].player&&this.team2Players[2].player.name&&0!==this.team2Players[2].player.name.length)),this.team1Players.forEach(S=>{S.disabled&&(S.player=null)}),this.team2Players.forEach(S=>{S.disabled&&(S.player=null)})}displayFn(g){return g&&g.name?g.name:g}getPlayerRankActive(g){const S=g.playerElo.find(x=>1===x.gameMode);return S?S.rankActive:0}changePage(g){this.page=g,this.getMatchs()}changeSize(g){this.size=g,this.page=0,this.getMatchs()}getWinRatio(g,S){if(!g||!S||0===S)return"0";let x=g/S;return x*=100,Math.trunc(x).toString()+"%"}sortFilteredListByGameMode(){if(this.playerList){let g=null;if(this.currentUser){const S=this.playerList.findIndex(x=>x.idPlayer===this.currentUser.idAge);-1!==S&&(g=this.playerList.splice(S,1)[0])}switch(this.model.gamemode){case 1:this.playerList.sort((S,x)=>this.compareRank(S.rank,x.rank));break;case 2:this.playerList.sort((S,x)=>this.compareRank(S.rank2,x.rank2));break;case 3:this.playerList.sort((S,x)=>this.compareRank(S.rank3,x.rank3));break;case 4:this.playerList.sort((S,x)=>this.compareRank(S.rank4,x.rank4));break;case 5:this.playerList.sort((S,x)=>this.compareRank(S.rank5,x.rank5));break;case 6:this.playerList.sort((S,x)=>this.compareRank(S.rank6,x.rank6));break;case 8:this.playerList.sort((S,x)=>this.compareRank(S.rank8,x.rank8));break;case 9:this.playerList.sort((S,x)=>this.compareRank(S.rank9,x.rank9));break;case 10:this.playerList.sort((S,x)=>this.compareRank(S.rank10,x.rank10))}g&&this.playerList.unshift(g);for(let S=0;S<8;S++)this.filteredPlayers[S]=this.playerList.slice(0,25)}}compareRank(g,S){return null==g?1:null==S?-1:g-S}OnModeChanged(g){this.model.gamemode=Number(g),localStorage.setItem(this.modeStorageKey,g.toString()),this.updateFieldDisplay(this.model.gamemode),this.updateFieldDisabled(),this.sortFilteredListByGameMode()}updateFieldDisplay(g){1===g||5===g?(this.team1Players.forEach((S,x)=>{S.show=0===x}),this.team2Players.forEach((S,x)=>{S.show=0===x}),this.team1Players=this.team1Players.map((S,x)=>0!==x?{...S,player:null,civ:0,team:1,show:!1,disabled:!0}:S),this.team2Players=this.team2Players.map((S,x)=>0!==x?{...S,player:null,civ:0,team:1,show:!1,disabled:!0}:S)):8===g?(this.team1Players.forEach((S,x)=>{S.show=0===x||1===x}),this.team2Players.forEach((S,x)=>{S.show=0===x||1===x}),this.team1Players=this.team1Players.map((S,x)=>0!==x&&1!==x?{...S,player:null,civ:0,team:1,show:!1,disabled:!0}:S),this.team2Players=this.team2Players.map((S,x)=>0!==x&&1!==x?{...S,player:null,civ:0,team:1,show:!1,disabled:!0}:S)):9===g?(this.team1Players.forEach((S,x)=>{S.show=0===x||1===x||2===x}),this.team2Players.forEach((S,x)=>{S.show=0===x||1===x||2===x}),this.team1Players=this.team1Players.map((S,x)=>0!==x&&1!==x&&2!==x?{...S,player:null,civ:0,team:1,show:!1,disabled:!0}:S),this.team2Players=this.team2Players.map((S,x)=>0!==x&&1!==x&&2!==x?{...S,player:null,civ:0,team:1,show:!1,disabled:!0}:S)):(this.team1Players.forEach(S=>{S.show=!0}),this.team2Players.forEach((S,x)=>{S.show=!0}))}OnPatchChanged(g){this.model.patch=g}onSliderChange(g){"mdc-slider__input"===g.target.className?(this._eloLowerBound=g.srcElement.ariaValueText,this.model.eloMin=this._eloLowerBound,localStorage.setItem(this.eloLowerBoundStorageKey,this._eloLowerBound.toString())):"mdc-slider__input mat-slider__right-input"===g.target.className&&(this._eloUpperBound=g.srcElement.ariaValueText,this.model.eloMax=this._eloUpperBound,localStorage.setItem(this.eloUpperBoundStorageKey,this._eloUpperBound.toString())),this.cdr.detectChanges()}OnFlagChanged(g,S,x){this.badCriteria=!1,1===x?this.team1Players[S].civ=g.id:2===x&&(this.team2Players[S].civ=g.id)}ngOnDestroy(){this.subscriptions.forEach(g=>{g.unsubscribe()})}static#t=this.\u0275fac=function(S){return new(S||L)(o.rXU(Ot.G),o.rXU(At.x),o.rXU(Gt.$),o.rXU(jt.uR),o.rXU(o.gRc),o.rXU(ee.m),o.rXU(_t.H))};static#e=this.\u0275cmp=o.VBU({type:L,selectors:[["app-matches"]],viewQuery:function(S,x){if(1&S&&(o.GBs(Mi,5),o.GBs(Pe,5),o.GBs(C,5),o.GBs(T,5),o.GBs(v,5),o.GBs(mt,5)),2&S){let z;o.mGM(z=o.lsd())&&(x.patchpicker=z.first),o.mGM(z=o.lsd())&&(x.modepicker=z.first),o.mGM(z=o.lsd())&&(x.lowerslider=z.first),o.mGM(z=o.lsd())&&(x.upperslider=z.first),o.mGM(z=o.lsd())&&(x.myForm=z.first),o.mGM(z=o.lsd())&&(x.pickerImages=z)}},decls:34,vars:26,consts:[["myForm","ngForm"],["lowerslider",""],["upperslider",""],["patchpicker",""],["modepicker",""],["auto","matAutocomplete"],["pickerImage2",""],[1,"custom-parent"],[1,"filter-generasd-container"],[1,"filter-general-columns"],[1,"slider-container"],["discrete","","showTickMarks","","step","100","min","0","max","2500",1,"slider",3,"change"],["matSliderStartThumb","",3,"value"],["matSliderEndThumb","",3,"value"],[1,"pickers"],[3,"OnPageChanged","Name","List","Values"],[1,"search-players"],[1,"search-col"],[1,"subheading"],[4,"ngFor","ngForOf"],[1,"submit-buttons"],[3,"OnButtonClicked","buttonStyle","InputIndex","Name","ActiveEnabled"],["class","no-results",4,"ngIf"],["class","results",4,"ngIf"],[1,"matches-parent"],[3,"newPageEvent","newSizeEvent","incomingMatchs","idPlayer","idCiv","isLoading"],["class","form-row",4,"ngIf"],[1,"form-row"],[1,"form-group"],[1,"steam-avatar",3,"src"],["type","search","required","",1,"form-control",3,"ngModelChange","id","matAutocomplete","ngModel","name","placeholder","readonly"],[3,"optionSelected","displayWith"],[3,"value",4,"ngFor","ngForOf"],[3,"OnPageChanged","options","showLabel"],[3,"value"],[1,"no-results"],[1,"results"],[1,"results-div"],["src","assets/icons/match_history_wins.png"],["src","assets/icons/match_history_losses.png"],["src","assets/icons/match_history_games.png"],["src","assets/icons/match_history_winrate.png"]],template:function(S,x){if(1&S){const z=o.RV6();o.j41(0,"div",7)(1,"form",null,0)(3,"div",8)(4,"div",9)(5,"div",10)(6,"mat-slider",11),o.bIt("change",function(Bt){return o.eBV(z),o.Njj(x.onSliderChange(Bt))}),o.nrm(7,"input",12,1)(9,"input",13,2),o.k0s()(),o.j41(11,"div",14)(12,"app-picker",15,3),o.bIt("OnPageChanged",function(Bt){return o.eBV(z),o.Njj(x.OnPatchChanged(Bt))}),o.k0s(),o.j41(14,"app-picker",15,4),o.bIt("OnPageChanged",function(Bt){return o.eBV(z),o.Njj(x.OnModeChanged(Bt))}),o.k0s()()()(),o.j41(16,"div",16)(17,"div",17)(18,"div",18),o.EFF(19,"Allies"),o.k0s(),o.DNE(20,F,2,1,"div",19),o.k0s(),o.j41(21,"div",17)(22,"div",18),o.EFF(23,"Opponents"),o.k0s(),o.DNE(24,ut,2,1,"div",19),o.k0s()()(),o.j41(25,"div",20)(26,"app-custom-button",21),o.bIt("OnButtonClicked",function(){return o.eBV(z),o.Njj(x.OnClicked(1))}),o.k0s(),o.j41(27,"app-custom-button",21),o.bIt("OnButtonClicked",function(){return o.eBV(z),o.Njj(x.OnClicked(2))}),o.k0s()(),o.DNE(28,ht,1,0,"div",22)(29,yt,17,7,"div",23)(30,Lt,4,0,"div",22)(31,Ft,4,0,"div",22),o.k0s(),o.j41(32,"div",24)(33,"app-matches-table",25),o.bIt("newPageEvent",function(Bt){return o.eBV(z),o.Njj(x.changePage(Bt))})("newSizeEvent",function(Bt){return o.eBV(z),o.Njj(x.changeSize(Bt))}),o.k0s()()}2&S&&(o.R7$(7),o.Y8G("value",x._eloLowerBound),o.R7$(2),o.Y8G("value",x._eloUpperBound),o.R7$(3),o.Y8G("Name","Patch:")("List",x.patchNumbers)("Values",x.patchIds),o.R7$(2),o.Y8G("Name","Mode:")("List",x.modeNameList)("Values",x.modeValueList),o.R7$(6),o.Y8G("ngForOf",x.team1Players),o.R7$(4),o.Y8G("ngForOf",x.team2Players),o.R7$(2),o.Y8G("buttonStyle",x.buttonStyle)("InputIndex",1)("Name","Search")("ActiveEnabled",!1),o.R7$(),o.Y8G("buttonStyle",x.buttonStyle)("InputIndex",1)("Name","Reset")("ActiveEnabled",!1),o.R7$(),o.Y8G("ngIf",!x.hasResults&&!x.isLoading&&!x.noResults),o.R7$(),o.Y8G("ngIf",x.hasResults&&!x.isLoading&&!x.noResults),o.R7$(),o.Y8G("ngIf",x.badCriteria),o.R7$(),o.Y8G("ngIf",x.noResults),o.R7$(2),o.Y8G("incomingMatchs",x.matchs)("idPlayer",x.team1Players[0]&&x.team1Players[0].player?x.team1Players[0].player.idPlayer:0)("idCiv",x.team1Players[0]?x.team1Players[0].civ:0)("isLoading",x.isLoading))},dependencies:[d.Sq,d.bT,Pt.z,se.I,mt,Yt.qT,Yt.me,Yt.BC,Yt.cb,Yt.YS,Yt.vS,Yt.cV,Ct.$3,Wt.wT,Ct.pN,J.IV,J.XM,ve],styles:['.filter-general-container[_ngcontent-%COMP%]{margin:0;padding:0;justify-content:flex-end;flex:1}.filter-general-columns[_ngcontent-%COMP%]{display:flex;width:100%;flex:1}.pickers[_ngcontent-%COMP%]{display:flex;gap:1rem}.slider-container[_ngcontent-%COMP%]{display:flex;flex:1}.slider[_ngcontent-%COMP%]{width:calc(100% - 2rem)}.steam-avatar[_ngcontent-%COMP%]{max-width:2.5rem;max-height:2.5rem;min-width:2.5rem;min-height:2.5rem;width:100%;height:100%;object-fit:cover;border-radius:5px;border:1px solid black;margin-left:.5rem}input[_ngcontent-%COMP%]{background-color:#18181880;color:#fff;font-family:"Source Sans 3";font-variant:normal;font-size:1.2rem;border:0;padding:.5rem .8rem;box-shadow:1px 1px 4px 4px #0003 inset}input[_ngcontent-%COMP%]:focus{background-color:transparent;color:#fff;font-family:"Source Sans 3";font-variant:normal;font-size:1.2rem;border:0;padding:.5rem .8rem;box-shadow:1px 1px 4px 4px #0003 inset!important}[_ngcontent-%COMP%]::placeholder{color:#888;opacity:1}input[type=search i][_ngcontent-%COMP%]::-webkit-search-cancel-button{filter:hue-rotate(200deg) brightness(200%)}.form-control[_ngcontent-%COMP%]::placeholder{overflow:hidden;white-space:nowrap}.search-players[_ngcontent-%COMP%]{display:flex;gap:3rem;margin-top:.5rem;padding-left:5rem;padding-right:5rem}.search-col[_ngcontent-%COMP%]{flex:1}.form-group[_ngcontent-%COMP%]{display:flex;flex:1;align-items:center;gap:.5rem}.form-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.5rem}.submit-buttons[_ngcontent-%COMP%]{display:flex;gap:1rem;justify-content:center;margin-top:1rem}.disabled-placeholder[_ngcontent-%COMP%]::placeholder{color:#303030}.results[_ngcontent-%COMP%]{display:flex;justify-content:center;margin-top:1.5rem;align-items:center;gap:1.2rem}.results[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:1.5rem}.results-div[_ngcontent-%COMP%]{display:flex;gap:.5rem}.no-results[_ngcontent-%COMP%]{display:flex;gap:.5rem;padding-left:2rem;padding-right:2rem;justify-content:center;font-size:clamp(1rem,2vw,1.5rem);height:15rem;align-items:center}@media only screen and (max-width: 1600px){.search-players[_ngcontent-%COMP%]{padding-left:2rem;padding-right:2rem}}@media only screen and (max-width: 1000px){.search-players[_ngcontent-%COMP%]{padding-left:0;padding-right:0;gap:1rem}.no-results[_ngcontent-%COMP%]{height:5rem}}@media only screen and (max-width: 900px){.filter-general-container[_ngcontent-%COMP%]{width:100%;display:flex;justify-content:flex-end}.slider-container[_ngcontent-%COMP%]{width:100%;justify-content:center;padding:0}.pickers[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;width:100%}.filter-general-columns[_ngcontent-%COMP%]{flex:1;flex-direction:column;margin-top:0}.search-players[_ngcontent-%COMP%]{display:flex;gap:1.2rem;margin-top:.5rem;flex-direction:column}}@media only screen and (max-width: 900px){.results[_ngcontent-%COMP%]{flex-direction:column;margin-bottom:1rem;gap:.5rem}}@media only screen and (max-width: 400px){.pickers[_ngcontent-%COMP%]{flex-direction:column;align-items:flex-start}}']})}return L})();var Tt=H(7097),Xt=H(4727);const Vt=["patchpicker"],vt=["modepicker"];function Rt(L,tt){if(1&L&&(o.j41(0,"span")(1,"i",10),o.EFF(2,"arrow_upward"),o.k0s()()),2&L){const g=o.XpG();o.R7$(),o.xc7("transform","asc"==g.sortOrder?"":"rotate(180deg)")}}function It(L,tt){if(1&L&&(o.j41(0,"span")(1,"i",10),o.EFF(2,"arrow_upward"),o.k0s()()),2&L){const g=o.XpG();o.R7$(),o.xc7("transform","asc"==g.sortOrder?"":"rotate(180deg)")}}function ae(L,tt){if(1&L&&(o.j41(0,"span")(1,"i",10),o.EFF(2,"arrow_upward"),o.k0s()()),2&L){const g=o.XpG();o.R7$(),o.xc7("transform","asc"==g.sortOrder?"":"rotate(180deg)")}}function re(L,tt){if(1&L&&(o.j41(0,"span")(1,"i",10),o.EFF(2,"arrow_upward"),o.k0s()()),2&L){const g=o.XpG();o.R7$(),o.xc7("transform","asc"==g.sortOrder?"":"rotate(180deg)")}}function Je(L,tt){if(1&L&&(o.j41(0,"span")(1,"i",10),o.EFF(2,"arrow_upward"),o.k0s()()),2&L){const g=o.XpG();o.R7$(),o.xc7("transform","asc"==g.sortOrder?"":"rotate(180deg)")}}function ge(L,tt){if(1&L&&(o.j41(0,"span")(1,"i",10),o.EFF(2,"arrow_upward"),o.k0s()()),2&L){const g=o.XpG();o.R7$(),o.xc7("transform","asc"==g.sortOrder?"":"rotate(180deg)")}}function Li(L,tt){if(1&L&&(o.qex(0),o.j41(1,"div",12),o.nrm(2,"img",13),o.k0s(),o.j41(3,"div",14)(4,"div",15),o.EFF(5),o.k0s(),o.j41(6,"div",16),o.EFF(7),o.nI1(8,"number"),o.k0s()(),o.j41(9,"div",14)(10,"div",15),o.EFF(11),o.k0s(),o.j41(12,"div",16),o.EFF(13),o.nI1(14,"number"),o.k0s()(),o.j41(15,"div",14)(16,"div",15),o.EFF(17),o.k0s(),o.j41(18,"div",16),o.EFF(19),o.nI1(20,"number"),o.k0s()(),o.j41(21,"div",14)(22,"div",15),o.EFF(23),o.k0s(),o.j41(24,"div",16),o.EFF(25),o.nI1(26,"number"),o.k0s()(),o.j41(27,"div",14)(28,"div",15),o.EFF(29),o.k0s(),o.j41(30,"div",16),o.EFF(31),o.nI1(32,"number"),o.k0s()(),o.j41(33,"div",14)(34,"div",15),o.EFF(35),o.k0s(),o.j41(36,"div",16),o.EFF(37),o.nI1(38,"number"),o.k0s()(),o.bVm()),2&L){const g=tt.$implicit,S=o.XpG(2);o.R7$(2),o.FS9("src",S.getFlag(g.idciv),o.B4B),o.R7$(2),o.Y8G("ngClass",S.getCssClass(g.winPercentage0)),o.R7$(),o.SpI(" ",S.getPercentage(g.winPercentage0),"% "),o.R7$(2),o.JRh(o.bMT(8,19,g.totalGames0)),o.R7$(3),o.Y8G("ngClass",S.getCssClass(g.winPercentage1)),o.R7$(),o.SpI(" ",S.getPercentage(g.winPercentage1),"% "),o.R7$(2),o.JRh(o.bMT(14,21,g.totalGames1)),o.R7$(3),o.Y8G("ngClass",S.getCssClass(g.winPercentage2)),o.R7$(),o.SpI(" ",S.getPercentage(g.winPercentage2),"% "),o.R7$(2),o.JRh(o.bMT(20,23,g.totalGames2)),o.R7$(3),o.Y8G("ngClass",S.getCssClass(g.winPercentage3)),o.R7$(),o.SpI(" ",S.getPercentage(g.winPercentage3),"% "),o.R7$(2),o.JRh(o.bMT(26,25,g.totalGames3)),o.R7$(3),o.Y8G("ngClass",S.getCssClass(g.winPercentage4)),o.R7$(),o.SpI(" ",S.getPercentage(g.winPercentage4),"% "),o.R7$(2),o.JRh(o.bMT(32,27,g.totalGames4)),o.R7$(3),o.Y8G("ngClass",S.getCssClass(g.winPercentage5)),o.R7$(),o.SpI(" ",S.getPercentage(g.winPercentage5),"% "),o.R7$(2),o.JRh(o.bMT(38,29,g.totalGames5))}}function tn(L,tt){if(1&L&&(o.qex(0),o.DNE(1,Li,39,31,"ng-container",11),o.bVm()),2&L){const g=o.XpG();o.R7$(),o.Y8G("ngForOf",g.formatedData)}}function en(L,tt){1&L&&(o.qex(0),o.nrm(1,"mat-spinner",17),o.bVm())}let nn=(()=>{class L{constructor(g,S,x){this.chartsService=g,this.patchService=S,this.cdr=x,this.data=[],this._selectedValue=1,this.formatedDataLeft=[],this.formatedDataRight=[],this.patchs=[],this._selectedPatch=0,this.isLoading=!0,this.sortField="0",this.sortOrder="desc",this.subscriptions=[],this.modeNameList=Mt.Fy,this.modeValueList=Mt.nQ,this.patchIds=[],this.patchNumbers=[],this.modeStorageKey="winrate_by_civ_by_elo_mode_storage_key"}ngAfterViewInit(){this.isLoading=!0;const g=localStorage.getItem(this.modeStorageKey);g&&(this._selectedValue=+g,this.modepicker.updateItem(this._selectedValue)),this.cdr.detectChanges(),this.getPatchs()}getPatchs(){this.subscriptions.push(this.patchService.getPatchs().subscribe({next:this.handleResponsePatch.bind(this),error:this.handleErrorPatch.bind(this)}))}handleResponsePatch(g){g?(this.patchs=g,this.patchNumbers=this.patchs.map(S=>S.number),this.patchIds=this.patchs.map(S=>S.id),this._selectedPatch=Math.max(...this.patchs.map(S=>S.id)),this.patchpicker.updateOptions(this.patchNumbers,this.patchIds,this._selectedPatch),this.getDatas(),this.cdr.detectChanges()):this.isLoading=!1}handleErrorPatch(g){console.error("There was an error fetching the patch data",g),this.isLoading=!1}OnModeChanged(g){this._selectedValue=g,localStorage.setItem(this.modeStorageKey,this._selectedValue.toString()),this.getDatas()}OnPatchChanged(g){this._selectedPatch=g,this.getDatas()}getDatas(){this.isLoading=!0,this.subscriptions.push(this.chartsService.getWinrateByCivByElo(this._selectedValue,this._selectedPatch).subscribe({next:this.handleResponse.bind(this),error:this.handleError.bind(this)}))}handleResponse(g){g&&(this.data=g,this.formatData(),this.isLoading=!1,this.cdr.detectChanges())}formatData(){const g={};this.data.forEach(x=>{g[x.idciv]||(g[x.idciv]={idciv:x.idciv,winPercentage0:0,winPercentage1:0,winPercentage2:0,winPercentage3:0,winPercentage4:0,winPercentage5:0,totalGames0:0,totalGames1:0,totalGames2:0,totalGames3:0,totalGames4:0,totalGames5:0});const et=`totalGames${x.rating}`;g[x.idciv][`winPercentage${x.rating}`]=x.winPercentage,g[x.idciv][et]=x.totalGames}),this.formatedData=Object.values(g),"0"==this.sortField&&this.formatedData.sort("desc"==this.sortOrder?(x,z)=>z.winPercentage0-x.winPercentage0:(x,z)=>x.winPercentage0-z.winPercentage0),"1"==this.sortField&&this.formatedData.sort("desc"==this.sortOrder?(x,z)=>z.winPercentage1-x.winPercentage1:(x,z)=>x.winPercentage1-z.winPercentage1),"2"==this.sortField&&this.formatedData.sort("desc"==this.sortOrder?(x,z)=>z.winPercentage2-x.winPercentage2:(x,z)=>x.winPercentage2-z.winPercentage2),"3"==this.sortField&&this.formatedData.sort("desc"==this.sortOrder?(x,z)=>z.winPercentage3-x.winPercentage3:(x,z)=>x.winPercentage3-z.winPercentage3),"4"==this.sortField&&this.formatedData.sort("desc"==this.sortOrder?(x,z)=>z.winPercentage4-x.winPercentage4:(x,z)=>x.winPercentage4-z.winPercentage4),"5"==this.sortField&&this.formatedData.sort("desc"==this.sortOrder?(x,z)=>z.winPercentage5-x.winPercentage5:(x,z)=>x.winPercentage5-z.winPercentage5);const S=Math.ceil(this.formatedData.length/2);this.formatedDataLeft=this.formatedData.slice(0,S),this.formatedDataRight=this.formatedData.slice(S)}handleError(g){console.error("There was an error fetching chartsService",g),this.isLoading=!1}sortData(g){this.sortOrder=this.sortField===g?"asc"===this.sortOrder?"desc":"asc":"desc",this.sortField=g,this.formatData()}getFlag(g){return(0,Mt.sQ)(g)}getCssClass(g){return g>60?"very-green":g<=60&&g>=50?"light-green":g<50&&g>=40?"light-red":g<40?"very-red":""}getPercentage(g){return g%1==0?g.toString():g.toFixed(1).replace(/\.0$/,"")}ngOnDestroy(){this.subscriptions.forEach(g=>{g.unsubscribe()})}static#t=this.\u0275fac=function(S){return new(S||L)(o.rXU(Xt.p),o.rXU(Ot.G),o.rXU(o.gRc))};static#e=this.\u0275cmp=o.VBU({type:L,selectors:[["app-winrate-by-civ-by-elo"]],viewQuery:function(S,x){if(1&S&&(o.GBs(Vt,5),o.GBs(vt,5)),2&S){let z;o.mGM(z=o.lsd())&&(x.patchpicker=z.first),o.mGM(z=o.lsd())&&(x.modepicker=z.first)}},decls:45,vars:14,consts:[["patchpicker",""],["modepicker",""],[1,"custom-parent"],[1,"filter-row"],[1,"filter-general-columns"],[3,"OnPageChanged","Name","List","Values"],[1,"grid-container"],[1,"grid-header"],[1,"grid-header",3,"click"],[4,"ngIf"],[1,"material-icons"],[4,"ngFor","ngForOf"],[1,"flag-item"],[1,"flag-icon",3,"src"],[1,"grid-item"],[1,"percent-text",3,"ngClass"],[1,"totalgames-text"],[2,"margin","auto"]],template:function(S,x){if(1&S){const z=o.RV6();o.j41(0,"div",2)(1,"div",3)(2,"div",4)(3,"app-picker",5,0),o.bIt("OnPageChanged",function(Bt){return o.eBV(z),o.Njj(x.OnPatchChanged(Bt))}),o.k0s(),o.j41(5,"app-picker",5,1),o.bIt("OnPageChanged",function(Bt){return o.eBV(z),o.Njj(x.OnModeChanged(Bt))}),o.k0s()()(),o.j41(7,"div",6),o.nrm(8,"div",7),o.j41(9,"div",8),o.bIt("click",function(){return o.eBV(z),o.Njj(x.sortData("0"))}),o.EFF(10," All "),o.DNE(11,Rt,3,2,"span",9),o.k0s(),o.j41(12,"div",8),o.bIt("click",function(){return o.eBV(z),o.Njj(x.sortData("1"))}),o.j41(13,"sup"),o.EFF(14,"<"),o.k0s(),o.EFF(15," 1000 "),o.DNE(16,It,3,2,"span",9),o.k0s(),o.j41(17,"div",8),o.bIt("click",function(){return o.eBV(z),o.Njj(x.sortData("2"))}),o.j41(18,"sup"),o.EFF(19,"1000"),o.k0s(),o.EFF(20," / "),o.j41(21,"sub"),o.EFF(22,"1400"),o.k0s(),o.DNE(23,ae,3,2,"span",9),o.k0s(),o.j41(24,"div",8),o.bIt("click",function(){return o.eBV(z),o.Njj(x.sortData("3"))}),o.j41(25,"sup"),o.EFF(26,"1400"),o.k0s(),o.EFF(27," / "),o.j41(28,"sub"),o.EFF(29,"1700"),o.k0s(),o.DNE(30,re,3,2,"span",9),o.k0s(),o.j41(31,"div",8),o.bIt("click",function(){return o.eBV(z),o.Njj(x.sortData("4"))}),o.j41(32,"sup"),o.EFF(33,"1700"),o.k0s(),o.EFF(34," / "),o.j41(35,"sub"),o.EFF(36,"2000"),o.k0s(),o.DNE(37,Je,3,2,"span",9),o.k0s(),o.j41(38,"div",8),o.bIt("click",function(){return o.eBV(z),o.Njj(x.sortData("5"))}),o.EFF(39," 2000 "),o.j41(40,"sup"),o.EFF(41,"+"),o.k0s(),o.DNE(42,ge,3,2,"span",9),o.k0s(),o.DNE(43,tn,2,1,"ng-container",9)(44,en,2,0,"ng-container",9),o.k0s()()}2&S&&(o.R7$(3),o.Y8G("Name","Patch:")("List",x.patchNumbers)("Values",x.patchIds),o.R7$(2),o.Y8G("Name","Mode:")("List",x.modeNameList)("Values",x.modeValueList),o.R7$(6),o.Y8G("ngIf","0"==x.sortField),o.R7$(5),o.Y8G("ngIf","1"==x.sortField),o.R7$(7),o.Y8G("ngIf","2"==x.sortField),o.R7$(7),o.Y8G("ngIf","3"==x.sortField),o.R7$(7),o.Y8G("ngIf","4"==x.sortField),o.R7$(5),o.Y8G("ngIf","5"==x.sortField),o.R7$(),o.Y8G("ngIf",!x.isLoading),o.R7$(),o.Y8G("ngIf",x.isLoading))},dependencies:[d.YU,d.Sq,d.bT,se.I,_e.LG,d.QX],styles:['.filter-row[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;flex:1;flex-wrap:wrap}.filter-general-columns[_ngcontent-%COMP%]{flex-wrap:wrap}.grid-container[_ngcontent-%COMP%]{margin-top:1rem;display:grid;grid-template-columns:repeat(7,1fr);overflow-x:auto;border-radius:5px;box-shadow:0 2px 4px #00000040}.grid-header[_ngcontent-%COMP%]{font-family:Trajan Pro;font-size:1rem;color:var(--yellow-brand);text-shadow:2px 2px 4px #00000025;text-align:center;padding:.5rem;cursor:pointer;background-color:#1818184d;white-space:nowrap}.material-icons[_ngcontent-%COMP%]{font-size:clamp(.6rem,2vw,1.2rem);font-weight:700;transition:transform 1s!important;vertical-align:-1px}.grid-item[_ngcontent-%COMP%], .flag-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;padding:.5rem 2rem}.flag-item[_ngcontent-%COMP%]{background-color:#1818184d}.flag-icon[_ngcontent-%COMP%]{max-width:clamp(3rem,20vw,5rem);border-radius:5px;box-shadow:2px 2px 4px #00000080}.grid-item[_ngcontent-%COMP%]{background-color:#4545454d;margin:1px;box-shadow:0 2px 2px #00000040}.grid-item[_ngcontent-%COMP%]:hover{background-color:#a1a19e33}.percent-text[_ngcontent-%COMP%], .totalgames-text[_ngcontent-%COMP%]{font-family:"Source Sans 3";text-shadow:2px 2px 2px rgba(0,0,0,.5)}.percent-text[_ngcontent-%COMP%]{font-size:1.1rem;font-weight:700;letter-spacing:1px}.totalgames-text[_ngcontent-%COMP%]{font-size:1rem;color:#ccc}.very-green[_ngcontent-%COMP%]{color:#0f0}.light-green[_ngcontent-%COMP%]{color:#90ee90}.light-red[_ngcontent-%COMP%]{color:tomato}.very-red[_ngcontent-%COMP%]{color:red}']})}return L})();var ci=H(8925);function sn(L,tt){1&L&&(o.qex(0),o.nrm(1,"app-winrate-by-civ-by-elo"),o.bVm())}function an(L,tt){1&L&&(o.qex(0),o.nrm(1,"app-winrate-by-matchup"),o.bVm())}function je(L,tt){1&L&&(o.qex(0),o.nrm(1,"app-winrate-and-game-count",7),o.bVm()),2&L&&(o.R7$(),o.Y8G("idPlayer",0)("isProfile",!1))}function Fi(L,tt){1&L&&(o.qex(0),o.nrm(1,"app-matches"),o.bVm())}const Ii=[{path:"",component:(()=>{class L{constructor(g){this.sharedDataService=g,this.index=1,this.indexStorageKey="charts_main_index_storage_key",this.setButtonStyles()}ngOnInit(){this.sharedDataService.getData()&&localStorage.setItem(this.indexStorageKey,"4")}ngAfterContentInit(){var g=localStorage.getItem(this.indexStorageKey);g&&(this.index=+g)}setButtonStyles(){const g=window.innerWidth;this.buttonStyle=g<600?{"padding-left":"0.6rem","padding-right":"0.6rem","min-height":"1rem",width:"100%"}:g<900?{"padding-left":"1rem","padding-right":"1rem","min-height":"2rem",width:"100%"}:{"padding-left":"3rem","padding-right":"3rem","min-height":"2.5rem",width:"100%"}}onResize(g){this.setButtonStyles()}OnClicked(g){this.index=g,localStorage.setItem(this.indexStorageKey,this.index.toString())}static#t=this.\u0275fac=function(S){return new(S||L)(o.rXU(_t.H))};static#e=this.\u0275cmp=o.VBU({type:L,selectors:[["app-charts-main"]],hostBindings:function(S,x){1&S&&o.bIt("resize",function(et){return x.onResize(et)},!1,o.tSv)},decls:15,vars:24,consts:[[1,"custom-container"],[1,"main-heading","mb-10"],[1,"dark-bg","rounded"],[1,"custom-parent"],[1,"button-column"],[1,"button",3,"OnButtonClicked","buttonStyle","InputIndex","Name","ActiveEnabled","activeButton"],[4,"ngIf"],[3,"idPlayer","isProfile"]],template:function(S,x){1&S&&(o.j41(0,"div",0)(1,"div",1),o.EFF(2,"Statistics"),o.k0s(),o.j41(3,"div",2)(4,"div",3)(5,"div",4)(6,"app-custom-button",5),o.bIt("OnButtonClicked",function(et){return x.OnClicked(et)}),o.k0s(),o.j41(7,"app-custom-button",5),o.bIt("OnButtonClicked",function(et){return x.OnClicked(et)}),o.k0s()(),o.j41(8,"div",4)(9,"app-custom-button",5),o.bIt("OnButtonClicked",function(et){return x.OnClicked(et)}),o.k0s(),o.j41(10,"app-custom-button",5),o.bIt("OnButtonClicked",function(et){return x.OnClicked(et)}),o.k0s()()(),o.DNE(11,sn,2,0,"ng-container",6)(12,an,2,0,"ng-container",6)(13,je,2,2,"ng-container",6)(14,Fi,2,0,"ng-container",6),o.k0s()()),2&S&&(o.R7$(6),o.Y8G("buttonStyle",x.buttonStyle)("InputIndex",1)("Name","Winrate")("ActiveEnabled",1===x.index)("activeButton",x.index),o.R7$(),o.Y8G("buttonStyle",x.buttonStyle)("InputIndex",2)("Name","Matchups")("ActiveEnabled",2===x.index)("activeButton",x.index),o.R7$(2),o.Y8G("buttonStyle",x.buttonStyle)("InputIndex",3)("Name","Game count")("ActiveEnabled",3===x.index)("activeButton",x.index),o.R7$(),o.Y8G("buttonStyle",x.buttonStyle)("InputIndex",4)("Name","Match history")("ActiveEnabled",4===x.index)("activeButton",x.index),o.R7$(),o.Y8G("ngIf",1===x.index),o.R7$(),o.Y8G("ngIf",2===x.index),o.R7$(),o.Y8G("ngIf",3===x.index),o.R7$(),o.Y8G("ngIf",4===x.index))},dependencies:[d.bT,Pt.z,$t,Tt.A,nn,ci.b],styles:[".custom-parent[_ngcontent-%COMP%]{display:flex;gap:1rem;padding-bottom:0}.button-column[_ngcontent-%COMP%]{display:flex;gap:1rem;flex:1}.button[_ngcontent-%COMP%]{flex:1;width:100%!important}@media only screen and (max-width: 600px){.custom-parent[_ngcontent-%COMP%]{padding-left:.5rem;padding-top:.5rem;gap:.5rem}.button-column[_ngcontent-%COMP%]{flex-direction:column;gap:.5rem}}"]})}return L})()}];let hi=(()=>{class L{static#t=this.\u0275fac=function(S){return new(S||L)};static#e=this.\u0275mod=o.$C({type:L});static#i=this.\u0275inj=o.G2t({imports:[Z.iI.forChild(Ii),Z.iI]})}return L})();var on=H(4719);let di=(()=>{class L{static#t=this.\u0275fac=function(S){return new(S||L)};static#e=this.\u0275mod=o.$C({type:L});static#i=this.\u0275inj=o.G2t({imports:[d.MD,hi,on.G,A.G,Yt.YN]})}return L})()},1959:(Ie,Ut,H)=>{H.d(Ut,{Q:()=>Mt});var d=H(4438),A=H(177),Z=H(4710);const o=()=>["/profile"],_t=at=>({idPlayer:at});function Pt(at,st){if(1&at&&(d.qex(0),d.EFF(1),d.bVm()),2&at){const it=d.XpG().$implicit;d.R7$(),d.SpI(" ",it.elo," ")}}function xt(at,st){if(1&at){const it=d.RV6();d.qex(0),d.j41(1,"div")(2,"div",1)(3,"div",2),d.bIt("click",function(mt){d.eBV(it);const Ot=d.XpG();return d.Njj(Ot.onPlayerLinkClick(mt))}),d.EFF(4),d.k0s(),d.j41(5,"div",3),d.DNE(6,Pt,2,1,"ng-container",4),d.k0s()()(),d.bVm()}if(2&at){const it=st.$implicit,lt=d.XpG();d.R7$(),d.AVh("green",lt.isWin)("red",!lt.isWin),d.R7$(2),d.Y8G("routerLink",d.lJ4(8,o))("queryParams",d.eq3(9,_t,it.idPlayer)),d.R7$(),d.SpI(" ",it.playerName," "),d.R7$(2),d.Y8G("ngIf",null!=it.elo)}}let Mt=(()=>{class at{constructor(){this.isWin=!1}onPlayerLinkClick(it){window.scrollTo(0,0),it.stopPropagation()}static#t=this.\u0275fac=function(lt){return new(lt||at)};static#e=this.\u0275cmp=d.VBU({type:at,selectors:[["app-match-history-opponent"]],inputs:{isWin:"isWin",OpponentList:"OpponentList",idPlayer:"idPlayer"},decls:1,vars:1,consts:[[4,"ngFor","ngForOf"],[1,"player-elo"],[1,"player",3,"click","routerLink","queryParams"],[1,"elo"],[4,"ngIf"]],template:function(lt,mt){1<&&d.DNE(0,xt,7,11,"ng-container",0),2<&&d.Y8G("ngForOf",mt.OpponentList)},dependencies:[A.Sq,A.bT,Z.Wk],styles:[".player[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:700;letter-spacing:.5px;text-shadow:2px 2px 4px rgba(0,0,0,.25)}.player[_ngcontent-%COMP%]:hover{text-decoration:underline;cursor:pointer}.player-elo[_ngcontent-%COMP%]{display:flex;gap:.5rem;height:2rem;justify-content:flex-end;align-items:center}@media (max-width: 480px){.elo[_ngcontent-%COMP%]{display:none}}"]})}return at})()},9031:(Ie,Ut,H)=>{H.d(Ut,{w:()=>Mt});var d=H(4438),A=H(177),Z=H(4710);const o=()=>["/profile"],_t=at=>({idPlayer:at});function Pt(at,st){if(1&at&&(d.qex(0),d.EFF(1),d.bVm()),2&at){const it=d.XpG().$implicit;d.R7$(),d.SpI(" ",it.elo," ")}}function xt(at,st){if(1&at){const it=d.RV6();d.qex(0),d.j41(1,"div")(2,"div",1)(3,"div",2),d.DNE(4,Pt,2,1,"ng-container",3),d.k0s(),d.j41(5,"div",4),d.bIt("click",function(mt){d.eBV(it);const Ot=d.XpG();return d.Njj(Ot.onPlayerLinkClick(mt))}),d.EFF(6),d.k0s()()(),d.bVm()}if(2&at){const it=st.$implicit,lt=d.XpG();d.R7$(),d.AVh("green",lt.isWin)("red",!lt.isWin),d.R7$(3),d.Y8G("ngIf",null!=it.elo),d.R7$(),d.Y8G("routerLink",d.lJ4(8,o))("queryParams",d.eq3(9,_t,it.idPlayer)),d.R7$(),d.SpI(" ",it.playerName," ")}}let Mt=(()=>{class at{constructor(){this.isWin=!1}onPlayerLinkClick(it){window.scrollTo(0,0),it.stopPropagation()}static#t=this.\u0275fac=function(lt){return new(lt||at)};static#e=this.\u0275cmp=d.VBU({type:at,selectors:[["app-match-history-player"]],inputs:{isWin:"isWin",PlayerList:"PlayerList",idPlayer:"idPlayer"},decls:1,vars:1,consts:[[4,"ngFor","ngForOf"],[1,"player-elo"],[1,"elo"],[4,"ngIf"],[1,"player",3,"click","routerLink","queryParams"]],template:function(lt,mt){1<&&d.DNE(0,xt,7,11,"ng-container",0),2<&&d.Y8G("ngForOf",mt.PlayerList)},dependencies:[A.Sq,A.bT,Z.Wk],styles:[".player[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:700;letter-spacing:.5px;text-shadow:2px 2px 4px rgba(0,0,0,.25)}.player[_ngcontent-%COMP%]:hover{text-decoration:underline;cursor:pointer}.player-elo[_ngcontent-%COMP%]{display:flex;gap:.5rem;height:2rem;align-items:center}@media (max-width: 480px){.elo[_ngcontent-%COMP%]{display:none}}"]})}return at})()},9763:(Ie,Ut,H)=>{H.d(Ut,{$L:()=>ao,A6:()=>li,Bs:()=>Wn,E8:()=>Oi,FN:()=>gn,PP:()=>ha,ij:()=>Qe,kc:()=>ua,t1:()=>jn});var d=H(141);class A{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(i,t,e,n){const r=t.duration;t.listeners[n].forEach(c=>c({chart:i,initial:t.initial,numSteps:r,currentStep:Math.min(e-t.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=d.r.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(i=Date.now()){let t=0;this._charts.forEach((e,n)=>{if(!e.running||!e.items.length)return;const a=e.items;let h,r=a.length-1,c=!1;for(;r>=0;--r)h=a[r],h._active?(h._total>e.duration&&(e.duration=h._total),h.tick(i),c=!0):(a[r]=a[a.length-1],a.pop());c&&(n.draw(),this._notify(n,e,i,"progress")),a.length||(e.running=!1,this._notify(n,e,i,"complete"),e.initial=!1),t+=a.length}),this._lastDate=i,0===t&&(this._running=!1)}_getAnims(i){const t=this._charts;let e=t.get(i);return e||(e={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(i,e)),e}listen(i,t,e){this._getAnims(i).listeners[t].push(e)}add(i,t){!t||!t.length||this._getAnims(i).items.push(...t)}has(i){return this._getAnims(i).items.length>0}start(i){const t=this._charts.get(i);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((e,n)=>Math.max(e,n._duration),0),this._refresh())}running(i){if(!this._running)return!1;const t=this._charts.get(i);return!(!t||!t.running||!t.items.length)}stop(i){const t=this._charts.get(i);if(!t||!t.items.length)return;const e=t.items;let n=e.length-1;for(;n>=0;--n)e[n].cancel();t.items=[],this._notify(i,t,Date.now(),"complete")}remove(i){return this._charts.delete(i)}}var Z=new A;const o="transparent",_t={boolean:(s,i,t)=>t>.5?i:s,color(s,i,t){const e=(0,d.c)(s||o),n=e.valid&&(0,d.c)(i||o);return n&&n.valid?n.mix(e,t).hexString():i},number:(s,i,t)=>s+(i-s)*t};class Pt{constructor(i,t,e,n){const a=t[e];n=(0,d.a)([i.to,n,a,i.from]);const r=(0,d.a)([i.from,a,n]);this._active=!0,this._fn=i.fn||_t[i.type||typeof r],this._easing=d.e[i.easing]||d.e.linear,this._start=Math.floor(Date.now()+(i.delay||0)),this._duration=this._total=Math.floor(i.duration),this._loop=!!i.loop,this._target=t,this._prop=e,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(i,t,e){if(this._active){this._notify(!1);const n=this._target[this._prop],a=e-this._start,r=this._duration-a;this._start=e,this._duration=Math.floor(Math.max(r,i.duration)),this._total+=a,this._loop=!!i.loop,this._to=(0,d.a)([i.to,t,n,i.from]),this._from=(0,d.a)([i.from,n,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(i){const t=i-this._start,e=this._duration,n=this._prop,a=this._from,r=this._loop,c=this._to;let h;if(this._active=a!==c&&(r||t<e),!this._active)return this._target[n]=c,void this._notify(!0);t<0?this._target[n]=a:(h=t/e%2,h=r&&h>1?2-h:h,h=this._easing(Math.min(1,Math.max(0,h))),this._target[n]=this._fn(a,c,h))}wait(){const i=this._promises||(this._promises=[]);return new Promise((t,e)=>{i.push({res:t,rej:e})})}_notify(i){const t=i?"res":"rej",e=this._promises||[];for(let n=0;n<e.length;n++)e[n][t]()}}class xt{constructor(i,t){this._chart=i,this._properties=new Map,this.configure(t)}configure(i){if(!(0,d.i)(i))return;const t=Object.keys(d.d.animation),e=this._properties;Object.getOwnPropertyNames(i).forEach(n=>{const a=i[n];if(!(0,d.i)(a))return;const r={};for(const c of t)r[c]=a[c];((0,d.b)(a.properties)&&a.properties||[n]).forEach(c=>{(c===n||!e.has(c))&&e.set(c,r)})})}_animateOptions(i,t){const e=t.options,n=function at(s,i){if(!i)return;let t=s.options;if(t)return t.$shared&&(s.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t;s.options=i}(i,e);if(!n)return[];const a=this._createAnimations(n,e);return e.$shared&&function Mt(s,i){const t=[],e=Object.keys(i);for(let n=0;n<e.length;n++){const a=s[e[n]];a&&a.active()&&t.push(a.wait())}return Promise.all(t)}(i.options.$animations,e).then(()=>{i.options=e},()=>{}),a}_createAnimations(i,t){const e=this._properties,n=[],a=i.$animations||(i.$animations={}),r=Object.keys(t),c=Date.now();let h;for(h=r.length-1;h>=0;--h){const f=r[h];if("$"===f.charAt(0))continue;if("options"===f){n.push(...this._animateOptions(i,t));continue}const m=t[f];let y=a[f];const P=e.get(f);if(y){if(P&&y.active()){y.update(P,m,c);continue}y.cancel()}P&&P.duration?(a[f]=y=new Pt(P,i,f,m),n.push(y)):i[f]=m}return n}update(i,t){if(0===this._properties.size)return void Object.assign(i,t);const e=this._createAnimations(i,t);return e.length?(Z.add(this._chart,e),!0):void 0}}function st(s,i){const t=s&&s.options||{},e=t.reverse,n=void 0===t.min?i:0,a=void 0===t.max?i:0;return{start:e?a:n,end:e?n:a}}function mt(s,i){const t=[],e=s._getSortedDatasetMetas(i);let n,a;for(n=0,a=e.length;n<a;++n)t.push(e[n].index);return t}function Ot(s,i,t,e={}){const n=s.keys,a="single"===e.mode;let r,c,h,f;if(null!==i){for(r=0,c=n.length;r<c;++r){if(h=+n[r],h===t){if(e.all)continue;break}f=s.values[h],(0,d.g)(f)&&(a||0===i||(0,d.s)(i)===(0,d.s)(f))&&(i+=f)}return i}}function Gt(s,i){const t=s&&s.options.stacked;return t||void 0===t&&void 0!==i.stack}function se(s,i,t){const e=s[i]||(s[i]={});return e[t]||(e[t]={})}function Yt(s,i,t,e){for(const n of i.getMatchingVisibleMetas(e).reverse()){const a=s[n.index];if(t&&a>0||!t&&a<0)return n.index}return null}function Ct(s,i){const{chart:t,_cachedMeta:e}=s,n=t._stacks||(t._stacks={}),{iScale:a,vScale:r,index:c}=e,h=a.axis,f=r.axis,m=function jt(s,i,t){return`${s.id}.${i.id}.${t.stack||t.type}`}(a,r,e),y=i.length;let P;for(let k=0;k<y;++k){const R=i[k],{[h]:I,[f]:j}=R;P=(R._stacks||(R._stacks={}))[f]=se(n,m,I),P[c]=j,P._top=Yt(P,r,!0,e.type),P._bottom=Yt(P,r,!1,e.type),(P._visualValues||(P._visualValues={}))[c]=j}}function Wt(s,i){const t=s.scales;return Object.keys(t).filter(e=>t[e].axis===i).shift()}function ct(s,i){const t=s.controller.index,e=s.vScale&&s.vScale.axis;if(e){i=i||s._parsed;for(const n of i){const a=n._stacks;if(!a||void 0===a[e]||void 0===a[e][t])return;delete a[e][t],void 0!==a[e]._visualValues&&void 0!==a[e]._visualValues[t]&&delete a[e]._visualValues[t]}}}const kt=s=>"reset"===s||"none"===s,oe=(s,i)=>i?s:Object.assign({},s);let Zt=(()=>class s{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Gt(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&&ct(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,n=this.getDataset(),a=(P,k,R,I)=>"x"===P?k:"r"===P?I:R,r=e.xAxisID=(0,d.v)(n.xAxisID,Wt(t,"x")),c=e.yAxisID=(0,d.v)(n.yAxisID,Wt(t,"y")),h=e.rAxisID=(0,d.v)(n.rAxisID,Wt(t,"r")),f=e.indexAxis,m=e.iAxisID=a(f,r,c,h),y=e.vAxisID=a(f,c,r,h);e.xScale=this.getScaleForId(r),e.yScale=this.getScaleForId(c),e.rScale=this.getScaleForId(h),e.iScale=this.getScaleForId(m),e.vScale=this.getScaleForId(y)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&(0,d.u)(this._data,this),t._stacked&&ct(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if((0,d.i)(e))this._data=function At(s,i){const{iScale:t,vScale:e}=i,n="x"===t.axis?"x":"y",a="x"===e.axis?"x":"y",r=Object.keys(s),c=new Array(r.length);let h,f,m;for(h=0,f=r.length;h<f;++h)m=r[h],c[h]={[n]:m,[a]:s[m]};return c}(e,this._cachedMeta);else if(n!==e){if(n){(0,d.u)(n,this);const a=this._cachedMeta;ct(a),a._parsed=[]}e&&Object.isExtensible(e)&&(0,d.l)(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,n=this.getDataset();let a=!1;this._dataCheck();const r=e._stacked;e._stacked=Gt(e.vScale,e),e.stack!==n.stack&&(a=!0,ct(e),e.stack=n.stack),this._resyncElements(t),(a||r!==e._stacked)&&Ct(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:n,_data:a}=this,{iScale:r,_stacked:c}=n,h=r.axis;let y,P,k,f=0===t&&e===a.length||n._sorted,m=t>0&&n._parsed[t-1];if(!1===this._parsing)n._parsed=a,n._sorted=!0,k=a;else{k=(0,d.b)(a[t])?this.parseArrayData(n,a,t,e):(0,d.i)(a[t])?this.parseObjectData(n,a,t,e):this.parsePrimitiveData(n,a,t,e);const R=()=>null===P[h]||m&&P[h]<m[h];for(y=0;y<e;++y)n._parsed[y+t]=P=k[y],f&&(R()&&(f=!1),m=P);n._sorted=f}c&&Ct(this,k)}parsePrimitiveData(t,e,n,a){const{iScale:r,vScale:c}=t,h=r.axis,f=c.axis,m=r.getLabels(),y=r===c,P=new Array(a);let k,R,I;for(k=0,R=a;k<R;++k)I=k+n,P[k]={[h]:y||r.parse(m[I],I),[f]:c.parse(e[I],I)};return P}parseArrayData(t,e,n,a){const{xScale:r,yScale:c}=t,h=new Array(a);let f,m,y,P;for(f=0,m=a;f<m;++f)y=f+n,P=e[y],h[f]={x:r.parse(P[0],y),y:c.parse(P[1],y)};return h}parseObjectData(t,e,n,a){const{xScale:r,yScale:c}=t,{xAxisKey:h="x",yAxisKey:f="y"}=this._parsing,m=new Array(a);let y,P,k,R;for(y=0,P=a;y<P;++y)k=y+n,R=e[k],m[y]={x:r.parse((0,d.f)(R,h),k),y:c.parse((0,d.f)(R,f),k)};return m}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,n){const r=this._cachedMeta,c=e[t.axis];return Ot({keys:mt(this.chart,!0),values:e._stacks[t.axis]._visualValues},c,r.index,{mode:n})}updateRangeFromParsed(t,e,n,a){const r=n[e.axis];let c=null===r?NaN:r;const h=a&&n._stacks[e.axis];a&&h&&(a.values=h,c=Ot(a,r,this._cachedMeta.index)),t.min=Math.min(t.min,c),t.max=Math.max(t.max,c)}getMinMax(t,e){const n=this._cachedMeta,a=n._parsed,r=n._sorted&&t===n.iScale,c=a.length,h=this._getOtherScale(t),f=((s,i,t)=>s&&!i.hidden&&i._stacked&&{keys:mt(this.chart,!0),values:null})(e,n),m={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:y,max:P}=function ee(s){const{min:i,max:t,minDefined:e,maxDefined:n}=s.getUserBounds();return{min:e?i:Number.NEGATIVE_INFINITY,max:n?t:Number.POSITIVE_INFINITY}}(h);let k,R;function I(){R=a[k];const j=R[h.axis];return!(0,d.g)(R[t.axis])||y>j||P<j}for(k=0;k<c&&(I()||(this.updateRangeFromParsed(m,t,R,f),!r));++k);if(r)for(k=c-1;k>=0;--k)if(!I()){this.updateRangeFromParsed(m,t,R,f);break}return m}getAllParsedValues(t){const e=this._cachedMeta._parsed,n=[];let a,r,c;for(a=0,r=e.length;a<r;++a)c=e[a][t.axis],(0,d.g)(c)&&n.push(c);return n}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,n=e.iScale,a=e.vScale,r=this.getParsed(t);return{label:n?""+n.getLabelForValue(r[n.axis]):"",value:a?""+a.getLabelForValue(r[a.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function lt(s){let i,t,e,n;return(0,d.i)(s)?(i=s.top,t=s.right,e=s.bottom,n=s.left):i=t=e=n=s,{top:i,right:t,bottom:e,left:n,disabled:!1===s}}((0,d.v)(this.options.clip,function it(s,i,t){if(!1===t)return!1;const e=st(s,t),n=st(i,t);return{top:n.end,right:e.end,bottom:n.start,left:e.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this._cachedMeta,a=n.data||[],r=this.chart.chartArea,c=[],h=this._drawStart||0,f=this._drawCount||a.length-h,m=this.options.drawActiveElementsOnTop;let y;for(n.dataset&&n.dataset.draw(t,r,h,f),y=h;y<h+f;++y){const P=a[y];P.hidden||(P.active&&m?c.push(P):P.draw(t,r))}for(y=0;y<c.length;++y)c[y].draw(t,r)}getStyle(t,e){const n=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(n):this.resolveDataElementOptions(t||0,n)}getContext(t,e,n){const a=this.getDataset();let r;if(t>=0&&t<this._cachedMeta.data.length){const c=this._cachedMeta.data[t];r=c.$context||(c.$context=function ot(s,i,t){return(0,d.j)(s,{active:!1,dataIndex:i,parsed:void 0,raw:void 0,element:t,index:i,mode:"default",type:"data"})}(this.getContext(),t,c)),r.parsed=this.getParsed(t),r.raw=a.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=function J(s,i){return(0,d.j)(s,{active:!1,dataset:void 0,datasetIndex:i,index:i,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),r.dataset=a,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=n,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",n){const a="active"===e,r=this._cachedDataOpts,c=t+"-"+e,h=r[c],f=this.enableOptionSharing&&(0,d.h)(n);if(h)return oe(h,f);const m=this.chart.config,y=m.datasetElementScopeKeys(this._type,t),P=a?[`${t}Hover`,"hover",t,""]:[t,""],k=m.getOptionScopes(this.getDataset(),y),R=Object.keys(d.d.elements[t]),j=m.resolveNamedOptions(k,R,()=>this.getContext(n,a,e),P);return j.$shared&&(j.$shared=f,r[c]=Object.freeze(oe(j,f))),j}_resolveAnimations(t,e,n){const a=this.chart,r=this._cachedDataOpts,c=`animation-${e}`,h=r[c];if(h)return h;let f;if(!1!==a.options.animation){const y=this.chart.config,P=y.datasetAnimationScopeKeys(this._type,e),k=y.getOptionScopes(this.getDataset(),P);f=y.createResolver(k,this.getContext(t,n,e))}const m=new xt(a,f&&f.animations);return f&&f._cacheable&&(r[c]=Object.freeze(m)),m}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||kt(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const n=this.resolveDataElementOptions(t,e),a=this._sharedOptions,r=this.getSharedOptions(n),c=this.includeOptions(e,r)||r!==a;return this.updateSharedOptions(r,e,n),{sharedOptions:r,includeOptions:c}}updateElement(t,e,n,a){kt(a)?Object.assign(t,n):this._resolveAnimations(e,a).update(t,n)}updateSharedOptions(t,e,n){t&&!kt(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,a){t.active=a;const r=this.getStyle(e,a);this._resolveAnimations(e,n,a).update(t,{options:!a&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"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 e=this._data,n=this._cachedMeta.data;for(const[h,f,m]of this._syncList)this[h](f,m);this._syncList=[];const a=n.length,r=e.length,c=Math.min(r,a);c&&this.parse(0,c),r>a?this._insertElements(a,r-a,t):r<a&&this._removeElements(r,a-r)}_insertElements(t,e,n=!0){const a=this._cachedMeta,r=a.data,c=t+e;let h;const f=m=>{for(m.length+=e,h=m.length-1;h>=c;h--)m[h]=m[h-e]};for(f(r),h=t;h<c;++h)r[h]=new this.dataElementType;this._parsing&&f(a._parsed),this.parse(t,e),n&&this.updateElements(r,t,e,"reset")}updateElements(t,e,n,a){}_removeElements(t,e){const n=this._cachedMeta;if(this._parsing){const a=n._parsed.splice(t,e);n._stacked&&ct(n,a)}n.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,n,a]=t;this[e](n,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,e){e&&this._sync(["_removeElements",t,e]);const n=arguments.length-2;n&&this._sync(["_insertElements",t,n])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}})();function _e(s){const i=s.iScale,t=function we(s,i){if(!s._cache.$bar){const t=s.getMatchingVisibleMetas(i);let e=[];for(let n=0,a=t.length;n<a;n++)e=e.concat(t[n].controller.getAllParsedValues(s));s._cache.$bar=(0,d._)(e.sort((n,a)=>n-a))}return s._cache.$bar}(i,s.type);let n,a,r,c,e=i._length;const h=()=>{32767===r||-32768===r||((0,d.h)(c)&&(e=Math.min(e,Math.abs(r-c)||e)),c=r)};for(n=0,a=t.length;n<a;++n)r=i.getPixelForValue(t[n]),h();for(c=void 0,n=0,a=i.ticks.length;n<a;++n)r=i.getPixelForTick(n),h();return e}function ai(s,i,t,e){return(0,d.b)(s)?function Ne(s,i,t,e){const n=t.parse(s[0],e),a=t.parse(s[1],e),r=Math.min(n,a),c=Math.max(n,a);let h=r,f=c;Math.abs(r)>Math.abs(c)&&(h=c,f=r),i[t.axis]=f,i._custom={barStart:h,barEnd:f,start:n,end:a,min:r,max:c}}(s,i,t,e):i[t.axis]=t.parse(s,e),i}function ke(s,i,t,e){const n=s.iScale,a=s.vScale,r=n.getLabels(),c=n===a,h=[];let f,m,y,P;for(f=t,m=t+e;f<m;++f)P=i[f],y={},y[n.axis]=c||n.parse(r[f],f),h.push(ai(P,y,a,f));return h}function He(s){return s&&void 0!==s.barStart&&void 0!==s.barEnd}function xe(s,i,t,e){let n=i.borderSkipped;const a={};if(!n)return void(s.borderSkipped=a);if(!0===n)return void(s.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:c,reverse:h,top:f,bottom:m}=function qt(s){let i,t,e,n,a;return s.horizontal?(i=s.base>s.x,t="left",e="right"):(i=s.base<s.y,t="bottom",e="top"),i?(n="end",a="start"):(n="start",a="end"),{start:t,end:e,reverse:i,top:n,bottom:a}}(s);"middle"===n&&t&&(s.enableBorderRadius=!0,(t._top||0)===e?n=f:(t._bottom||0)===e?n=m:(a[oi(m,r,c,h)]=!0,n=f)),a[oi(n,r,c,h)]=!0,s.borderSkipped=a}function oi(s,i,t,e){return e?(s=function Se(s,i,t){return s===i?t:s===t?i:s}(s,i,t),s=Ye(s,t,i)):s=Ye(s,i,t),s}function Ye(s,i,t){return"start"===s?i:"end"===s?t:s}function ri(s,{inflateAmount:i},t){s.inflateAmount="auto"===i?1===t?.33:0:i}let li=(()=>class s extends Zt{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,e,n,a){return ke(t,e,n,a)}parseArrayData(t,e,n,a){return ke(t,e,n,a)}parseObjectData(t,e,n,a){const{iScale:r,vScale:c}=t,{xAxisKey:h="x",yAxisKey:f="y"}=this._parsing,m="x"===r.axis?h:f,y="x"===c.axis?h:f,P=[];let k,R,I,j;for(k=n,R=n+a;k<R;++k)j=e[k],I={},I[r.axis]=r.parse((0,d.f)(j,m),k),P.push(ai((0,d.f)(j,y),I,c,k));return P}updateRangeFromParsed(t,e,n,a){super.updateRangeFromParsed(t,e,n,a);const r=n._custom;r&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:n,vScale:a}=e,r=this.getParsed(t),c=r._custom,h=He(c)?"["+c.start+", "+c.end+"]":""+a.getLabelForValue(r[a.axis]);return{label:""+n.getLabelForValue(r[n.axis]),value:h}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,n,a){const r="reset"===a,{index:c,_cachedMeta:{vScale:h}}=this,f=h.getBasePixel(),m=h.isHorizontal(),y=this._getRuler(),{sharedOptions:P,includeOptions:k}=this._getSharedOptions(e,a);for(let R=e;R<e+n;R++){const I=this.getParsed(R),j=r||(0,d.k)(I[h.axis])?{base:f,head:f}:this._calculateBarValuePixels(R),V=this._calculateBarIndexPixels(R,y),W=(I._stacks||{})[h.axis],U={horizontal:m,base:j.base,enableBorderRadius:!W||He(I._custom)||c===W._top||c===W._bottom,x:m?j.head:V.center,y:m?V.center:j.head,height:m?V.size:Math.abs(j.size),width:m?Math.abs(j.size):V.size};k&&(U.options=P||this.resolveDataElementOptions(R,t[R].active?"active":a));const Q=U.options||t[R].options;xe(U,Q,W,c),ri(U,Q,y.ratio),this.updateElement(t[R],R,U,a)}}_getStacks(t,e){const{iScale:n}=this._cachedMeta,a=n.getMatchingVisibleMetas(this._type).filter(f=>f.controller.options.grouped),r=n.options.stacked,c=[],h=f=>{const m=f.controller.getParsed(e),y=m&&m[f.vScale.axis];if((0,d.k)(y)||isNaN(y))return!0};for(const f of a)if((void 0===e||!h(f))&&((!1===r||-1===c.indexOf(f.stack)||void 0===r&&void 0===f.stack)&&c.push(f.stack),f.index===t))break;return c.length||c.push(void 0),c}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,n){const a=this._getStacks(t,n),r=void 0!==e?a.indexOf(e):-1;return-1===r?a.length-1:r}_getRuler(){const t=this.options,e=this._cachedMeta,n=e.iScale,a=[];let r,c;for(r=0,c=e.data.length;r<c;++r)a.push(n.getPixelForValue(this.getParsed(r)[n.axis],r));const h=t.barThickness;return{min:h||_e(e),pixels:a,start:n._startPixel,end:n._endPixel,stackCount:this._getStackCount(),scale:n,grouped:t.grouped,ratio:h?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:n,index:a},options:{base:r,minBarLength:c}}=this,h=r||0,f=this.getParsed(t),m=f._custom,y=He(m);let I,j,P=f[e.axis],k=0,R=n?this.applyStack(e,f,n):P;R!==P&&(k=R-P,R=P),y&&(P=m.barStart,R=m.barEnd-m.barStart,0!==P&&(0,d.s)(P)!==(0,d.s)(m.barEnd)&&(k=0),k+=P);const V=(0,d.k)(r)||y?k:r;let W=e.getPixelForValue(V);if(I=this.chart.getDataVisibility(t)?e.getPixelForValue(k+R):W,j=I-W,Math.abs(j)<c){j=function yi(s,i,t){return 0!==s?(0,d.s)(s):(i.isHorizontal()?1:-1)*(i.min>=t?1:-1)}(j,e,h)*c,P===h&&(W-=j/2);const U=e.getPixelForDecimal(0),Q=e.getPixelForDecimal(1),G=Math.min(U,Q),X=Math.max(U,Q);W=Math.max(Math.min(W,X),G),I=W+j,n&&!y&&(f._stacks[e.axis]._visualValues[a]=e.getValueForPixel(I)-e.getValueForPixel(W))}if(W===e.getPixelForValue(h)){const U=(0,d.s)(j)*e.getLineWidthForValue(h)/2;W+=U,j-=U}return{size:j,base:W,head:I,center:I+j/2}}_calculateBarIndexPixels(t,e){const n=e.scale,a=this.options,r=a.skipNull,c=(0,d.v)(a.maxBarThickness,1/0);let h,f;if(e.grouped){const m=r?this._getStackCount(t):e.stackCount,y="flex"===a.barThickness?function si(s,i,t,e){const n=i.pixels,a=n[s];let r=s>0?n[s-1]:null,c=s<n.length-1?n[s+1]:null;const h=t.categoryPercentage;null===r&&(r=a-(null===c?i.end-i.start:c-a)),null===c&&(c=a+a-r);const f=a-(a-Math.min(r,c))/2*h;return{chunk:Math.abs(c-r)/2*h/e,ratio:t.barPercentage,start:f}}(t,e,a,m):function Ae(s,i,t,e){const n=t.barThickness;let a,r;return(0,d.k)(n)?(a=i.min*t.categoryPercentage,r=t.barPercentage):(a=n*e,r=1),{chunk:a/e,ratio:r,start:i.pixels[s]-a/2}}(t,e,a,m),P=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0);h=y.start+y.chunk*P+y.chunk/2,f=Math.min(c,y.chunk*y.ratio)}else h=n.getPixelForValue(this.getParsed(t)[n.axis],t),f=Math.min(c,e.min*e.ratio);return{base:h-f/2,head:h+f/2,center:h,size:f}}draw(){const t=this._cachedMeta,e=t.vScale,n=t.data,a=n.length;let r=0;for(;r<a;++r)null!==this.getParsed(r)[e.axis]&&!n[r].hidden&&n[r].draw(this._ctx)}})(),Oe=(()=>class s extends Zt{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,e,n,a){const r=super.parsePrimitiveData(t,e,n,a);for(let c=0;c<r.length;c++)r[c]._custom=this.resolveDataElementOptions(c+n).radius;return r}parseArrayData(t,e,n,a){const r=super.parseArrayData(t,e,n,a);for(let c=0;c<r.length;c++)r[c]._custom=(0,d.v)(e[n+c][2],this.resolveDataElementOptions(c+n).radius);return r}parseObjectData(t,e,n,a){const r=super.parseObjectData(t,e,n,a);for(let c=0;c<r.length;c++){const h=e[n+c];r[c]._custom=(0,d.v)(h&&h.r&&+h.r,this.resolveDataElementOptions(c+n).radius)}return r}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let n=t.length-1;n>=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:a,yScale:r}=e,c=this.getParsed(t),h=a.getLabelForValue(c.x),f=r.getLabelForValue(c.y),m=c._custom;return{label:n[t]||"",value:"("+h+", "+f+(m?", "+m:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,a){const r="reset"===a,{iScale:c,vScale:h}=this._cachedMeta,{sharedOptions:f,includeOptions:m}=this._getSharedOptions(e,a),y=c.axis,P=h.axis;for(let k=e;k<e+n;k++){const R=t[k],I=!r&&this.getParsed(k),j={},V=j[y]=r?c.getPixelForDecimal(.5):c.getPixelForValue(I[y]),W=j[P]=r?h.getBasePixel():h.getPixelForValue(I[P]);j.skip=isNaN(V)||isNaN(W),m&&(j.options=f||this.resolveDataElementOptions(k,R.active?"active":a),r&&(j.options.radius=0)),this.updateElement(R,k,j,a)}}resolveDataElementOptions(t,e){const n=this.getParsed(t);let a=super.resolveDataElementOptions(t,e);a.$shared&&(a=Object.assign({},a,{$shared:!1}));const r=a.radius;return"active"!==e&&(a.radius=0),a.radius+=(0,d.v)(n&&n._custom,r),a}})(),Ue=(()=>class s extends Zt{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 e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:a}}=t.legend.options;return e.labels.map((r,c)=>{const f=t.getDatasetMeta(0).controller.getStyle(c);return{text:r,fillStyle:f.backgroundColor,strokeStyle:f.borderColor,fontColor:a,lineWidth:f.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(c),index:c}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const n=this.getDataset().data,a=this._cachedMeta;if(!1===this._parsing)a._parsed=n;else{let c,h,r=f=>+n[f];if((0,d.i)(n[t])){const{key:f="value"}=this._parsing;r=m=>+(0,d.f)(n[m],f)}for(c=t,h=t+e;c<h;++c)a._parsed[c]=r(c)}}_getRotation(){return(0,d.t)(this.options.rotation-90)}_getCircumference(){return(0,d.t)(this.options.circumference)}_getRotationExtents(){let t=d.T,e=-d.T;for(let n=0;n<this.chart.data.datasets.length;++n)if(this.chart.isDatasetVisible(n)&&this.chart.getDatasetMeta(n).type===this._type){const a=this.chart.getDatasetMeta(n).controller,r=a._getRotation(),c=a._getCircumference();t=Math.min(t,r),e=Math.max(e,r+c)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:n}=e,a=this._cachedMeta,r=a.data,c=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,h=Math.max((Math.min(n.width,n.height)-c)/2,0),f=Math.min((0,d.m)(this.options.cutout,h),1),m=this._getRingWeight(this.index),{circumference:y,rotation:P}=this._getRotationExtents(),{ratioX:k,ratioY:R,offsetX:I,offsetY:j}=function q(s,i,t){let e=1,n=1,a=0,r=0;if(i<d.T){const c=s,h=c+i,f=Math.cos(c),m=Math.sin(c),y=Math.cos(h),P=Math.sin(h),k=(U,Q,G)=>(0,d.p)(U,c,h,!0)?1:Math.max(Q,Q*t,G,G*t),R=(U,Q,G)=>(0,d.p)(U,c,h,!0)?-1:Math.min(Q,Q*t,G,G*t),I=k(0,f,y),j=k(d.H,m,P),V=R(d.P,f,y),W=R(d.P+d.H,m,P);e=(I-V)/2,n=(j-W)/2,a=-(I+V)/2,r=-(j+W)/2}return{ratioX:e,ratioY:n,offsetX:a,offsetY:r}}(P,y,f),U=Math.max(Math.min((n.width-c)/k,(n.height-c)/R)/2,0),Q=(0,d.n)(this.options.radius,U),X=(Q-Math.max(Q*f,0))/this._getVisibleDatasetWeightTotal();this.offsetX=I*Q,this.offsetY=j*Q,a.total=this.calculateTotal(),this.outerRadius=Q-X*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-X*m,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){const n=this.options,a=this._cachedMeta,r=this._getCircumference();return e&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||null===a._parsed[t]||a.data[t].hidden?0:this.calculateCircumference(a._parsed[t]*r/d.T)}updateElements(t,e,n,a){const r="reset"===a,c=this.chart,h=c.chartArea,y=(h.left+h.right)/2,P=(h.top+h.bottom)/2,k=r&&c.options.animation.animateScale,R=k?0:this.innerRadius,I=k?0:this.outerRadius,{sharedOptions:j,includeOptions:V}=this._getSharedOptions(e,a);let U,W=this._getRotation();for(U=0;U<e;++U)W+=this._circumference(U,r);for(U=e;U<e+n;++U){const Q=this._circumference(U,r),G=t[U],X={x:y+this.offsetX,y:P+this.offsetY,startAngle:W,endAngle:W+Q,circumference:Q,outerRadius:I,innerRadius:R};V&&(X.options=j||this.resolveDataElementOptions(U,G.active?"active":a)),W+=Q,this.updateElement(G,U,X,a)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let a,n=0;for(a=0;a<e.length;a++){const r=t._parsed[a];null!==r&&!isNaN(r)&&this.chart.getDataVisibility(a)&&!e[a].hidden&&(n+=Math.abs(r))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?d.T*(Math.abs(t)/e):0}getLabelAndValue(t){const n=this.chart,a=n.data.labels||[],r=(0,d.o)(this._cachedMeta._parsed[t],n.options.locale);return{label:a[t]||"",value:r}}getMaxBorderWidth(t){let e=0;const n=this.chart;let a,r,c,h,f;if(!t)for(a=0,r=n.data.datasets.length;a<r;++a)if(n.isDatasetVisible(a)){c=n.getDatasetMeta(a),t=c.data,h=c.controller;break}if(!t)return 0;for(a=0,r=t.length;a<r;++a)f=h.resolveDataElementOptions(a),"inner"!==f.borderAlign&&(e=Math.max(e,f.borderWidth||0,f.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let n=0,a=t.length;n<a;++n){const r=this.resolveDataElementOptions(n);e=Math.max(e,r.offset||0,r.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let n=0;n<t;++n)this.chart.isDatasetVisible(n)&&(e+=this._getRingWeight(n));return e}_getRingWeight(t){return Math.max((0,d.v)(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}})(),bi=(()=>class s extends Zt{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 e=this._cachedMeta,{dataset:n,data:a=[],_dataset:r}=e,c=this.chart._animationsDisabled;let{start:h,count:f}=(0,d.q)(e,a,c);this._drawStart=h,this._drawCount=f,(0,d.w)(e)&&(h=0,f=a.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!r._decimated,n.points=a;const m=this.resolveDatasetElementOptions(t);this.options.showLine||(m.borderWidth=0),m.segment=this.options.segment,this.updateElement(n,void 0,{animated:!c,options:m},t),this.updateElements(a,h,f,t)}updateElements(t,e,n,a){const r="reset"===a,{iScale:c,vScale:h,_stacked:f,_dataset:m}=this._cachedMeta,{sharedOptions:y,includeOptions:P}=this._getSharedOptions(e,a),k=c.axis,R=h.axis,{spanGaps:I,segment:j}=this.options,V=(0,d.x)(I)?I:Number.POSITIVE_INFINITY,W=this.chart._animationsDisabled||r||"none"===a,U=e+n,Q=t.length;let G=e>0&&this.getParsed(e-1);for(let X=0;X<Q;++X){const rt=t[X],nt=W?rt:{};if(X<e||X>=U){nt.skip=!0;continue}const ft=this.getParsed(X),Et=(0,d.k)(ft[R]),St=nt[k]=c.getPixelForValue(ft[k],X),Dt=nt[R]=r||Et?h.getBasePixel():h.getPixelForValue(f?this.applyStack(h,ft,f):ft[R],X);nt.skip=isNaN(St)||isNaN(Dt)||Et,nt.stop=X>0&&Math.abs(ft[k]-G[k])>V,j&&(nt.parsed=ft,nt.raw=m.data[X]),P&&(nt.options=y||this.resolveDataElementOptions(X,rt.active?"active":a)),W||this.updateElement(rt,X,nt,a),G=ft}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,a=t.data||[];if(!a.length)return n;const r=a[0].size(this.resolveDataElementOptions(0)),c=a[a.length-1].size(this.resolveDataElementOptions(a.length-1));return Math.max(n,r,c)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}})(),Ee=(()=>class s extends Zt{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 e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:n,color:a}}=t.legend.options;return e.labels.map((r,c)=>{const f=t.getDatasetMeta(0).controller.getStyle(c);return{text:r,fillStyle:f.backgroundColor,strokeStyle:f.borderColor,fontColor:a,lineWidth:f.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(c),index:c}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const n=this.chart,a=n.data.labels||[],r=(0,d.o)(this._cachedMeta._parsed[t].r,n.options.locale);return{label:a[t]||"",value:r}}parseObjectData(t,e,n,a){return d.y.bind(this)(t,e,n,a)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return this._cachedMeta.data.forEach((n,a)=>{const r=this.getParsed(a).r;!isNaN(r)&&this.chart.getDataVisibility(a)&&(r<e.min&&(e.min=r),r>e.max&&(e.max=r))}),e}_updateRadius(){const t=this.chart,e=t.chartArea,n=t.options,a=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(a/2,0),h=(r-Math.max(n.cutoutPercentage?r/100*n.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=r-h*this.index,this.innerRadius=this.outerRadius-h}updateElements(t,e,n,a){const r="reset"===a,c=this.chart,f=c.options.animation,m=this._cachedMeta.rScale,y=m.xCenter,P=m.yCenter,k=m.getIndexAngle(0)-.5*d.P;let I,R=k;const j=360/this.countVisibleElements();for(I=0;I<e;++I)R+=this._computeAngle(I,a,j);for(I=e;I<e+n;I++){const V=t[I];let W=R,U=R+this._computeAngle(I,a,j),Q=c.getDataVisibility(I)?m.getDistanceFromCenterForValue(this.getParsed(I).r):0;R=U,r&&(f.animateScale&&(Q=0),f.animateRotate&&(W=U=k));const G={x:y,y:P,innerRadius:0,outerRadius:Q,startAngle:W,endAngle:U,options:this.resolveDataElementOptions(I,V.active?"active":a)};this.updateElement(V,I,G,a)}}countVisibleElements(){let e=0;return this._cachedMeta.data.forEach((n,a)=>{!isNaN(this.getParsed(a).r)&&this.chart.getDataVisibility(a)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?(0,d.t)(this.resolveDataElementOptions(t,e).angle||n):0}})();var xi=Object.freeze({__proto__:null,BarController:li,BubbleController:Oe,DoughnutController:Ue,LineController:bi,PieController:(()=>class s extends Ue{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}})(),PolarAreaController:Ee,RadarController:(()=>class s extends Zt{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 e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,a){return d.y.bind(this)(t,e,n,a)}update(t){const e=this._cachedMeta,n=e.dataset,a=e.data||[],r=e.iScale.getLabels();if(n.points=a,"resize"!==t){const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),this.updateElement(n,void 0,{_loop:!0,_fullLoop:r.length===a.length,options:c},t)}this.updateElements(a,0,a.length,t)}updateElements(t,e,n,a){const r=this._cachedMeta.rScale,c="reset"===a;for(let h=e;h<e+n;h++){const f=t[h],m=this.resolveDataElementOptions(h,f.active?"active":a),y=r.getPointPositionForValue(h,this.getParsed(h).r),P=c?r.xCenter:y.x,k=c?r.yCenter:y.y,R={x:P,y:k,angle:y.angle,skip:isNaN(P)||isNaN(k),options:m};this.updateElement(f,h,R,a)}}})(),ScatterController:(()=>class s extends Zt{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 e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:a,yScale:r}=e,c=this.getParsed(t),h=a.getLabelForValue(c.x),f=r.getLabelForValue(c.y);return{label:n[t]||"",value:"("+h+", "+f+")"}}update(t){const e=this._cachedMeta,{data:n=[]}=e,a=this.chart._animationsDisabled;let{start:r,count:c}=(0,d.q)(e,n,a);if(this._drawStart=r,this._drawCount=c,(0,d.w)(e)&&(r=0,c=n.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:h,_dataset:f}=e;h._chart=this.chart,h._datasetIndex=this.index,h._decimated=!!f._decimated,h.points=n;const m=this.resolveDatasetElementOptions(t);m.segment=this.options.segment,this.updateElement(h,void 0,{animated:!a,options:m},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(n,r,c,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,n,a){const r="reset"===a,{iScale:c,vScale:h,_stacked:f,_dataset:m}=this._cachedMeta,y=this.resolveDataElementOptions(e,a),P=this.getSharedOptions(y),k=this.includeOptions(a,P),R=c.axis,I=h.axis,{spanGaps:j,segment:V}=this.options,W=(0,d.x)(j)?j:Number.POSITIVE_INFINITY,U=this.chart._animationsDisabled||r||"none"===a;let Q=e>0&&this.getParsed(e-1);for(let G=e;G<e+n;++G){const X=t[G],rt=this.getParsed(G),nt=U?X:{},ft=(0,d.k)(rt[I]),Et=nt[R]=c.getPixelForValue(rt[R],G),St=nt[I]=r||ft?h.getBasePixel():h.getPixelForValue(f?this.applyStack(h,rt,f):rt[I],G);nt.skip=isNaN(Et)||isNaN(St)||ft,nt.stop=G>0&&Math.abs(rt[R]-Q[R])>W,V&&(nt.parsed=rt,nt.raw=m.data[G]),k&&(nt.options=P||this.resolveDataElementOptions(G,X.active?"active":a)),U||this.updateElement(X,G,nt,a),Q=rt}this.updateSharedOptions(P,a,y)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let h=0;for(let f=e.length-1;f>=0;--f)h=Math.max(h,e[f].size(this.resolveDataElementOptions(f))/2);return h>0&&h}const n=t.dataset,a=n.options&&n.options.borderWidth||0;if(!e.length)return a;const r=e[0].size(this.resolveDataElementOptions(0)),c=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(a,r,c)/2}})()});function ne(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ke{static override(i){Object.assign(Ke.prototype,i)}options;constructor(i){this.options=i||{}}init(){}formats(){return ne()}parse(){return ne()}format(){return ne()}add(){return ne()}diff(){return ne()}startOf(){return ne()}endOf(){return ne()}}var Qe={_date:Ke};function vi(s,i,t,e){const{controller:n,data:a,_sorted:r}=s,c=n._cachedMeta.iScale;if(c&&i===c.axis&&"r"!==i&&r&&a.length){const h=c._reversePixels?d.A:d.B;if(!e)return h(a,i,t);if(n._sharedOptions){const f=a[0],m="function"==typeof f.getRange&&f.getRange(i);if(m){const y=h(a,i,t-m),P=h(a,i,t+m);return{lo:y.lo,hi:P.hi}}}}return{lo:0,hi:a.length-1}}function Be(s,i,t,e,n){const a=s.getSortedVisibleDatasetMetas(),r=t[i];for(let c=0,h=a.length;c<h;++c){const{index:f,data:m}=a[c],{lo:y,hi:P}=vi(a[c],i,r,n);for(let k=y;k<=P;++k){const R=m[k];R.skip||e(R,f,k)}}}function Te(s,i,t,e,n){const a=[];return!n&&!s.isPointInArea(i)||Be(s,t,i,function(c,h,f){!n&&!(0,d.C)(c,s.chartArea,0)||c.inRange(i.x,i.y,e)&&a.push({element:c,datasetIndex:h,index:f})},!0),a}function Pe(s,i,t,e,n,a){return a||s.isPointInArea(i)?"r"!==t||e?function Mi(s,i,t,e,n,a){let r=[];const c=function Pi(s){const i=-1!==s.indexOf("x"),t=-1!==s.indexOf("y");return function(e,n){const a=i?Math.abs(e.x-n.x):0,r=t?Math.abs(e.y-n.y):0;return Math.sqrt(Math.pow(a,2)+Math.pow(r,2))}}(t);let h=Number.POSITIVE_INFINITY;return Be(s,t,i,function f(m,y,P){const k=m.inRange(i.x,i.y,n);if(e&&!k)return;const R=m.getCenterPoint(n);if(!a&&!s.isPointInArea(R)&&!k)return;const j=c(i,R);j<h?(r=[{element:m,datasetIndex:y,index:P}],h=j):j===h&&r.push({element:m,datasetIndex:y,index:P})}),r}(s,i,t,e,n,a):function ve(s,i,t,e){let n=[];return Be(s,t,i,function a(r,c,h){const{startAngle:f,endAngle:m}=r.getProps(["startAngle","endAngle"],e),{angle:y}=(0,d.D)(r,{x:i.x,y:i.y});(0,d.p)(y,f,m)&&n.push({element:r,datasetIndex:c,index:h})}),n}(s,i,t,n):[]}function C(s,i,t,e,n){const a=[],r="x"===t?"inXRange":"inYRange";let c=!1;return Be(s,t,i,(h,f,m)=>{h[r](i[t],n)&&(a.push({element:h,datasetIndex:f,index:m}),c=c||h.inRange(i.x,i.y,n))}),e&&!c?[]:a}var T={evaluateInteractionItems:Be,modes:{index(s,i,t,e){const n=(0,d.z)(i,s),a=t.axis||"x",r=t.includeInvisible||!1,c=t.intersect?Te(s,n,a,e,r):Pe(s,n,a,!1,e,r),h=[];return c.length?(s.getSortedVisibleDatasetMetas().forEach(f=>{const m=c[0].index,y=f.data[m];y&&!y.skip&&h.push({element:y,datasetIndex:f.index,index:m})}),h):[]},dataset(s,i,t,e){const n=(0,d.z)(i,s),a=t.axis||"xy",r=t.includeInvisible||!1;let c=t.intersect?Te(s,n,a,e,r):Pe(s,n,a,!1,e,r);if(c.length>0){const h=c[0].datasetIndex,f=s.getDatasetMeta(h).data;c=[];for(let m=0;m<f.length;++m)c.push({element:f[m],datasetIndex:h,index:m})}return c},point:(s,i,t,e)=>Te(s,(0,d.z)(i,s),t.axis||"xy",e,t.includeInvisible||!1),nearest:(s,i,t,e)=>Pe(s,(0,d.z)(i,s),t.axis||"xy",t.intersect,e,t.includeInvisible||!1),x:(s,i,t,e)=>C(s,(0,d.z)(i,s),"x",t.intersect,e),y:(s,i,t,e)=>C(s,(0,d.z)(i,s),"y",t.intersect,e)}};const v=["left","top","right","bottom"];function M(s,i){return s.filter(t=>t.pos===i)}function E(s,i){return s.filter(t=>-1===v.indexOf(t.pos)&&t.box.axis===i)}function F(s,i){return s.sort((t,e)=>{const n=i?e:t,a=i?t:e;return n.weight===a.weight?n.index-a.index:n.weight-a.weight})}function yt(s,i,t,e){return Math.max(s[t],i[t])+Math.max(s[e],i[e])}function Lt(s,i){s.top=Math.max(s.top,i.top),s.left=Math.max(s.left,i.left),s.bottom=Math.max(s.bottom,i.bottom),s.right=Math.max(s.right,i.right)}function Ft(s,i,t,e){const{pos:n,box:a}=t,r=s.maxPadding;if(!(0,d.i)(n)){t.size&&(s[n]-=t.size);const y=e[t.stack]||{size:0,count:1};y.size=Math.max(y.size,t.horizontal?a.height:a.width),t.size=y.size/y.count,s[n]+=t.size}a.getPadding&&Lt(r,a.getPadding());const c=Math.max(0,i.outerWidth-yt(r,s,"left","right")),h=Math.max(0,i.outerHeight-yt(r,s,"top","bottom")),f=c!==s.w,m=h!==s.h;return s.w=c,s.h=h,t.horizontal?{same:f,other:m}:{same:m,other:f}}function $t(s,i){const t=i.maxPadding;return function e(n){const a={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{a[r]=Math.max(i[r],t[r])}),a}(s?["left","right"]:["top","bottom"])}function Tt(s,i,t,e){const n=[];let a,r,c,h,f,m;for(a=0,r=s.length,f=0;a<r;++a){c=s[a],h=c.box,h.update(c.width||i.w,c.height||i.h,$t(c.horizontal,i));const{same:y,other:P}=Ft(i,t,c,e);f|=y&&n.length,m=m||P,h.fullSize||n.push(c)}return f&&Tt(n,i,t,e)||m}function Xt(s,i,t,e,n){s.top=t,s.left=i,s.right=i+e,s.bottom=t+n,s.width=e,s.height=n}function Vt(s,i,t,e){const n=t.padding;let{x:a,y:r}=i;for(const c of s){const h=c.box,f=e[c.stack]||{count:1,placed:0,weight:1},m=c.stackWeight/f.weight||1;if(c.horizontal){const y=i.w*m,P=f.size||h.height;(0,d.h)(f.start)&&(r=f.start),h.fullSize?Xt(h,n.left,r,t.outerWidth-n.right-n.left,P):Xt(h,i.left+f.placed,r,y,P),f.start=r,f.placed+=y,r=h.bottom}else{const y=i.h*m,P=f.size||h.width;(0,d.h)(f.start)&&(a=f.start),h.fullSize?Xt(h,a,n.top,P,t.outerHeight-n.bottom-n.top):Xt(h,a,i.top+f.placed,P,y),f.start=a,f.placed+=y,a=h.right}}i.x=a,i.y=r}var vt={addBox(s,i){s.boxes||(s.boxes=[]),i.fullSize=i.fullSize||!1,i.position=i.position||"top",i.weight=i.weight||0,i._layers=i._layers||function(){return[{z:0,draw(t){i.draw(t)}}]},s.boxes.push(i)},removeBox(s,i){const t=s.boxes?s.boxes.indexOf(i):-1;-1!==t&&s.boxes.splice(t,1)},configure(s,i,t){i.fullSize=t.fullSize,i.position=t.position,i.weight=t.weight},update(s,i,t,e){if(!s)return;const n=(0,d.E)(s.options.layout.padding),a=Math.max(i-n.width,0),r=Math.max(t-n.height,0),c=function ht(s){const i=function N(s){const i=[];let t,e,n,a,r,c;for(t=0,e=(s||[]).length;t<e;++t)n=s[t],({position:a,options:{stack:r,stackWeight:c=1}}=n),i.push({index:t,box:n,pos:a,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&a+r,stackWeight:c});return i}(s),t=F(i.filter(f=>f.box.fullSize),!0),e=F(M(i,"left"),!0),n=F(M(i,"right")),a=F(M(i,"top"),!0),r=F(M(i,"bottom")),c=E(i,"x"),h=E(i,"y");return{fullSize:t,leftAndTop:e.concat(a),rightAndBottom:n.concat(h).concat(r).concat(c),chartArea:M(i,"chartArea"),vertical:e.concat(n).concat(h),horizontal:a.concat(r).concat(c)}}(s.boxes),h=c.vertical,f=c.horizontal;(0,d.F)(s.boxes,I=>{"function"==typeof I.beforeLayout&&I.beforeLayout()});const m=h.reduce((I,j)=>j.box.options&&!1===j.box.options.display?I:I+1,0)||1,y=Object.freeze({outerWidth:i,outerHeight:t,padding:n,availableWidth:a,availableHeight:r,vBoxMaxWidth:a/2/m,hBoxMaxHeight:r/2}),P=Object.assign({},n);Lt(P,(0,d.E)(e));const k=Object.assign({maxPadding:P,w:a,h:r,x:n.left,y:n.top},n),R=function ut(s,i){const t=function K(s){const i={};for(const t of s){const{stack:e,pos:n,stackWeight:a}=t;if(!e||!v.includes(n))continue;const r=i[e]||(i[e]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=a}return i}(s),{vBoxMaxWidth:e,hBoxMaxHeight:n}=i;let a,r,c;for(a=0,r=s.length;a<r;++a){c=s[a];const{fullSize:h}=c.box,f=t[c.stack],m=f&&c.stackWeight/f.weight;c.horizontal?(c.width=m?m*e:h&&i.availableWidth,c.height=n):(c.width=e,c.height=m?m*n:h&&i.availableHeight)}return t}(h.concat(f),y);Tt(c.fullSize,k,y,R),Tt(h,k,y,R),Tt(f,k,y,R)&&Tt(h,k,y,R),function wt(s){const i=s.maxPadding;function t(e){const n=Math.max(i[e]-s[e],0);return s[e]+=n,n}s.y+=t("top"),s.x+=t("left"),t("right"),t("bottom")}(k),Vt(c.leftAndTop,k,y,R),k.x+=k.w,k.y+=k.h,Vt(c.rightAndBottom,k,y,R),s.chartArea={left:k.left,top:k.top,right:k.left+k.w,bottom:k.top+k.h,height:k.h,width:k.w},(0,d.F)(c.chartArea,I=>{const j=I.box;Object.assign(j,s.chartArea),j.update(k.w,k.h,{left:0,top:0,right:0,bottom:0})})}};class Rt{acquireContext(i,t){}releaseContext(i){return!1}addEventListener(i,t,e){}removeEventListener(i,t,e){}getDevicePixelRatio(){return 1}getMaximumSize(i,t,e,n){return t=Math.max(0,t||i.width),e=e||i.height,{width:t,height:Math.max(0,n?Math.floor(t/n):e)}}isAttached(i){return!0}updateConfig(i){}}class It extends Rt{acquireContext(i){return i&&i.getContext&&i.getContext("2d")||null}updateConfig(i){i.options.animation=!1}}const ae="$chartjs",re={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Je=s=>null===s||""===s,Li=!!d.K&&{passive:!0};function en(s,i,t){s&&s.canvas&&s.canvas.removeEventListener(i,t,Li)}function ci(s,i){for(const t of s)if(t===i||t.contains(i))return!0}function sn(s,i,t){const e=s.canvas,n=new MutationObserver(a=>{let r=!1;for(const c of a)r=r||ci(c.addedNodes,e),r=r&&!ci(c.removedNodes,e);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}function an(s,i,t){const e=s.canvas,n=new MutationObserver(a=>{let r=!1;for(const c of a)r=r||ci(c.removedNodes,e),r=r&&!ci(c.addedNodes,e);r&&t()});return n.observe(document,{childList:!0,subtree:!0}),n}const je=new Map;let Fi=0;function Me(){const s=window.devicePixelRatio;s!==Fi&&(Fi=s,je.forEach((i,t)=>{t.currentDevicePixelRatio!==s&&i()}))}function on(s,i,t){const e=s.canvas,n=e&&(0,d.I)(e);if(!n)return;const a=(0,d.L)((c,h)=>{const f=n.clientWidth;t(c,h),f<n.clientWidth&&t()},window),r=new ResizeObserver(c=>{const h=c[0],f=h.contentRect.width,m=h.contentRect.height;0===f&&0===m||a(f,m)});return r.observe(n),function Ii(s,i){je.size||window.addEventListener("resize",Me),je.set(s,i)}(s,a),r}function di(s,i,t){t&&t.disconnect(),"resize"===i&&function hi(s){je.delete(s),je.size||window.removeEventListener("resize",Me)}(s)}function L(s,i,t){const e=s.canvas,n=(0,d.L)(a=>{null!==s.ctx&&t(function nn(s,i){const t=re[s.type]||s.type,{x:e,y:n}=(0,d.z)(s,i);return{type:t,chart:i,native:s,x:void 0!==e?e:null,y:void 0!==n?n:null}}(a,s))},s);return function tn(s,i,t){s&&s.addEventListener(i,t,Li)}(e,i,n),n}class tt extends Rt{acquireContext(i,t){const e=i&&i.getContext&&i.getContext("2d");return e&&e.canvas===i?(function ge(s,i){const t=s.style,e=s.getAttribute("height"),n=s.getAttribute("width");if(s[ae]={initial:{height:e,width:n,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",Je(n)){const a=(0,d.J)(s,"width");void 0!==a&&(s.width=a)}if(Je(e))if(""===s.style.height)s.height=s.width/(i||2);else{const a=(0,d.J)(s,"height");void 0!==a&&(s.height=a)}}(i,t),e):null}releaseContext(i){const t=i.canvas;if(!t[ae])return!1;const e=t[ae].initial;["height","width"].forEach(a=>{const r=e[a];(0,d.k)(r)?t.removeAttribute(a):t.setAttribute(a,r)});const n=e.style||{};return Object.keys(n).forEach(a=>{t.style[a]=n[a]}),t.width=t.width,delete t[ae],!0}addEventListener(i,t,e){this.removeEventListener(i,t),(i.$proxies||(i.$proxies={}))[t]=({attach:sn,detach:an,resize:on}[t]||L)(i,t,e)}removeEventListener(i,t){const e=i.$proxies||(i.$proxies={}),n=e[t];n&&(({attach:di,detach:di,resize:di}[t]||en)(i,t,n),e[t]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(i,t,e,n){return(0,d.G)(i,t,e,n)}isAttached(i){const t=i&&(0,d.I)(i);return!(!t||!t.isConnected)}}class S{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(i){const{x:t,y:e}=this.getProps(["x","y"],i);return{x:t,y:e}}hasValue(){return(0,d.x)(this.x)&&(0,d.x)(this.y)}getProps(i,t){const e=this.$animations;if(!t||!e)return this;const n={};return i.forEach(a=>{n[a]=e[a]&&e[a].active()?e[a]._to:this[a]}),n}}function Qt(s,i,t,e,n){const a=(0,d.v)(e,0),r=Math.min((0,d.v)(n,s.length),s.length);let h,f,m,c=0;for(t=Math.ceil(t),n&&(h=n-e,t=h/Math.floor(h/t)),m=a;m<0;)c++,m=Math.round(a+c*t);for(f=Math.max(a,0);f<r;f++)f===m&&(i.push(s[f]),c++,m=Math.round(a+c*t))}const qe=(s,i,t)=>"top"===i||"left"===i?s[i]+t:s[i]-t,Ai=(s,i)=>Math.min(i||s,s);function Bi(s,i){const t=[],e=s.length/i,n=s.length;let a=0;for(;a<n;a+=e)t.push(s[Math.floor(a)]);return t}function Ci(s,i,t){const e=s.ticks.length,n=Math.min(i,e-1),a=s._startPixel,r=s._endPixel,c=1e-6;let f,h=s.getPixelForTick(n);if(!(t&&(f=1===e?Math.max(h-a,r-h):0===i?(s.getPixelForTick(1)-h)/2:(h-s.getPixelForTick(n-1))/2,h+=n<i?f:-f,h<a-c||h>r+c)))return h}function fe(s){return s.drawTicks?s.tickLength:0}function le(s,i){if(!s.display)return 0;const t=(0,d.a0)(s.font,i),e=(0,d.E)(s.padding);return((0,d.b)(s.text)?s.text.length:1)*t.lineHeight+e.height}function Le(s,i,t){let e=(0,d.a1)(s);return(t&&"right"!==i||!t&&"right"===i)&&(e=(s=>"left"===s?"right":"right"===s?"left":s)(e)),e}class me extends S{constructor(i){super(),this.id=i.id,this.type=i.type,this.options=void 0,this.ctx=i.ctx,this.chart=i.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(i){this.options=i.setContext(this.getContext()),this.axis=i.axis,this._userMin=this.parse(i.min),this._userMax=this.parse(i.max),this._suggestedMin=this.parse(i.suggestedMin),this._suggestedMax=this.parse(i.suggestedMax)}parse(i,t){return i}getUserBounds(){let{_userMin:i,_userMax:t,_suggestedMin:e,_suggestedMax:n}=this;return i=(0,d.O)(i,Number.POSITIVE_INFINITY),t=(0,d.O)(t,Number.NEGATIVE_INFINITY),e=(0,d.O)(e,Number.POSITIVE_INFINITY),n=(0,d.O)(n,Number.NEGATIVE_INFINITY),{min:(0,d.O)(i,e),max:(0,d.O)(t,n),minDefined:(0,d.g)(i),maxDefined:(0,d.g)(t)}}getMinMax(i){let r,{min:t,max:e,minDefined:n,maxDefined:a}=this.getUserBounds();if(n&&a)return{min:t,max:e};const c=this.getMatchingVisibleMetas();for(let h=0,f=c.length;h<f;++h)r=c[h].controller.getMinMax(this,i),n||(t=Math.min(t,r.min)),a||(e=Math.max(e,r.max));return t=a&&t>e?e:t,e=n&&t>e?t:e,{min:(0,d.O)(t,(0,d.O)(e,t)),max:(0,d.O)(e,(0,d.O)(t,e))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const i=this.chart.data;return this.options.labels||(this.isHorizontal()?i.xLabels:i.yLabels)||i.labels||[]}getLabelItems(i=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(i))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){(0,d.Q)(this.options.beforeUpdate,[this])}update(i,t,e){const{beginAtZero:n,grace:a,ticks:r}=this.options,c=r.sampleSize;this.beforeUpdate(),this.maxWidth=i,this.maxHeight=t,this._margins=e=Object.assign({left:0,right:0,top:0,bottom:0},e),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+e.left+e.right:this.height+e.top+e.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=(0,d.R)(this,a,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const h=c<this.ticks.length;this._convertTicksToLabels(h?Bi(this.ticks,c):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||"auto"===r.source)&&(this.ticks=function x(s,i){const t=s.options.ticks,e=function z(s){const i=s.options.offset,t=s._tickSize();return Math.floor(Math.min(s._length/t+(i?0:1),s._maxLength/t))}(s),n=Math.min(t.maxTicksLimit||e,e),a=t.major.enabled?function Bt(s){const i=[];let t,e;for(t=0,e=s.length;t<e;t++)s[t].major&&i.push(t);return i}(i):[],r=a.length,c=a[0],h=a[r-1],f=[];if(r>n)return function Re(s,i,t,e){let r,n=0,a=t[0];for(e=Math.ceil(e),r=0;r<s.length;r++)r===a&&(i.push(s[r]),n++,a=t[n*e])}(i,f,a,r/n),f;const m=function et(s,i,t){const e=function ui(s){const i=s.length;let t,e;if(i<2)return!1;for(e=s[0],t=1;t<i;++t)if(s[t]-s[t-1]!==e)return!1;return e}(s),n=i.length/t;if(!e)return Math.max(n,1);const a=(0,d.N)(e);for(let r=0,c=a.length-1;r<c;r++){const h=a[r];if(h>n)return h}return Math.max(n,1)}(a,i,n);if(r>0){let y,P;const k=r>1?Math.round((h-c)/(r-1)):null;for(Qt(i,f,m,(0,d.k)(k)?0:c-k,c),y=0,P=r-1;y<P;y++)Qt(i,f,m,a[y],a[y+1]);return Qt(i,f,m,h,(0,d.k)(k)?i.length:h+k),f}return Qt(i,f,m),f}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),h&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){(0,d.Q)(this.options.afterUpdate,[this])}beforeSetDimensions(){(0,d.Q)(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(){(0,d.Q)(this.options.afterSetDimensions,[this])}_callHooks(i){this.chart.notifyPlugins(i,this.getContext()),(0,d.Q)(this.options[i],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){(0,d.Q)(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(i){const t=this.options.ticks;let e,n,a;for(e=0,n=i.length;e<n;e++)a=i[e],a.label=(0,d.Q)(t.callback,[a.value,e,i],this)}afterTickToLabelConversion(){(0,d.Q)(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){(0,d.Q)(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const i=this.options,t=i.ticks,e=Ai(this.ticks.length,i.ticks.maxTicksLimit),n=t.minRotation||0,a=t.maxRotation;let c,h,f,r=n;if(!this._isVisible()||!t.display||n>=a||e<=1||!this.isHorizontal())return void(this.labelRotation=n);const m=this._getLabelSizes(),y=m.widest.width,P=m.highest.height,k=(0,d.S)(this.chart.width-y,0,this.maxWidth);c=i.offset?this.maxWidth/e:k/(e-1),y+6>c&&(c=k/(e-(i.offset?.5:1)),h=this.maxHeight-fe(i.grid)-t.padding-le(i.title,this.chart.options.font),f=Math.sqrt(y*y+P*P),r=(0,d.U)(Math.min(Math.asin((0,d.S)((m.highest.height+6)/c,-1,1)),Math.asin((0,d.S)(h/f,-1,1))-Math.asin((0,d.S)(P/f,-1,1)))),r=Math.max(n,Math.min(a,r))),this.labelRotation=r}afterCalculateLabelRotation(){(0,d.Q)(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){(0,d.Q)(this.options.beforeFit,[this])}fit(){const i={width:0,height:0},{chart:t,options:{ticks:e,title:n,grid:a}}=this,r=this._isVisible(),c=this.isHorizontal();if(r){const h=le(n,t.options.font);if(c?(i.width=this.maxWidth,i.height=fe(a)+h):(i.height=this.maxHeight,i.width=fe(a)+h),e.display&&this.ticks.length){const{first:f,last:m,widest:y,highest:P}=this._getLabelSizes(),k=2*e.padding,R=(0,d.t)(this.labelRotation),I=Math.cos(R),j=Math.sin(R);c?i.height=Math.min(this.maxHeight,i.height+(e.mirror?0:j*y.width+I*P.height)+k):i.width=Math.min(this.maxWidth,i.width+(e.mirror?0:I*y.width+j*P.height)+k),this._calculatePadding(f,m,j,I)}}this._handleMargins(),c?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=i.height):(this.width=i.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(i,t,e,n){const{ticks:{align:a,padding:r},position:c}=this.options,h=0!==this.labelRotation,f="top"!==c&&"x"===this.axis;if(this.isHorizontal()){const m=this.getPixelForTick(0)-this.left,y=this.right-this.getPixelForTick(this.ticks.length-1);let P=0,k=0;h?f?(P=n*i.width,k=e*t.height):(P=e*i.height,k=n*t.width):"start"===a?k=t.width:"end"===a?P=i.width:"inner"!==a&&(P=i.width/2,k=t.width/2),this.paddingLeft=Math.max((P-m+r)*this.width/(this.width-m),0),this.paddingRight=Math.max((k-y+r)*this.width/(this.width-y),0)}else{let m=t.height/2,y=i.height/2;"start"===a?(m=0,y=i.height):"end"===a&&(m=t.height,y=0),this.paddingTop=m+r,this.paddingBottom=y+r}}_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(){(0,d.Q)(this.options.afterFit,[this])}isHorizontal(){const{axis:i,position:t}=this.options;return"top"===t||"bottom"===t||"x"===i}isFullSize(){return this.options.fullSize}_convertTicksToLabels(i){let t,e;for(this.beforeTickToLabelConversion(),this.generateTickLabels(i),t=0,e=i.length;t<e;t++)(0,d.k)(i[t].label)&&(i.splice(t,1),e--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let i=this._labelSizes;if(!i){const t=this.options.ticks.sampleSize;let e=this.ticks;t<e.length&&(e=Bi(e,t)),this._labelSizes=i=this._computeLabelSizes(e,e.length,this.options.ticks.maxTicksLimit)}return i}_computeLabelSizes(i,t,e){const{ctx:n,_longestTextCache:a}=this,r=[],c=[],h=Math.floor(t/Ai(t,e));let y,P,k,R,I,j,V,W,U,Q,G,f=0,m=0;for(y=0;y<t;y+=h){if(R=i[y].label,I=this._resolveTickFontOptions(y),n.font=j=I.string,V=a[j]=a[j]||{data:{},gc:[]},W=I.lineHeight,U=Q=0,(0,d.k)(R)||(0,d.b)(R)){if((0,d.b)(R))for(P=0,k=R.length;P<k;++P)G=R[P],!(0,d.k)(G)&&!(0,d.b)(G)&&(U=(0,d.V)(n,V.data,V.gc,U,G),Q+=W)}else U=(0,d.V)(n,V.data,V.gc,U,R),Q=W;r.push(U),c.push(Q),f=Math.max(U,f),m=Math.max(Q,m)}!function fi(s,i){(0,d.F)(s,t=>{const e=t.gc,n=e.length/2;let a;if(n>i){for(a=0;a<n;++a)delete t.data[e[a]];e.splice(0,n)}})}(a,t);const X=r.indexOf(f),rt=c.indexOf(m),nt=ft=>({width:r[ft]||0,height:c[ft]||0});return{first:nt(0),last:nt(t-1),widest:nt(X),highest:nt(rt),widths:r,heights:c}}getLabelForValue(i){return i}getPixelForValue(i,t){return NaN}getValueForPixel(i){}getPixelForTick(i){const t=this.ticks;return i<0||i>t.length-1?null:this.getPixelForValue(t[i].value)}getPixelForDecimal(i){this._reversePixels&&(i=1-i);const t=this._startPixel+i*this._length;return(0,d.W)(this._alignToPixels?(0,d.X)(this.chart,t,0):t)}getDecimalForPixel(i){const t=(i-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:i,max:t}=this;return i<0&&t<0?t:i>0&&t>0?i:0}getContext(i){const t=this.ticks||[];if(i>=0&&i<t.length){const e=t[i];return e.$context||(e.$context=function De(s,i,t){return(0,d.j)(s,{tick:t,index:i,type:"tick"})}(this.getContext(),i,e))}return this.$context||(this.$context=function zt(s,i){return(0,d.j)(s,{scale:i,type:"scale"})}(this.chart.getContext(),this))}_tickSize(){const i=this.options.ticks,t=(0,d.t)(this.labelRotation),e=Math.abs(Math.cos(t)),n=Math.abs(Math.sin(t)),a=this._getLabelSizes(),r=i.autoSkipPadding||0,c=a?a.widest.width+r:0,h=a?a.highest.height+r:0;return this.isHorizontal()?h*e>c*n?c/e:h/n:h*n<c*e?h/e:c/n}_isVisible(){const i=this.options.display;return"auto"!==i?!!i:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(i){const t=this.axis,e=this.chart,n=this.options,{grid:a,position:r,border:c}=n,h=a.offset,f=this.isHorizontal(),y=this.ticks.length+(h?1:0),P=fe(a),k=[],R=c.setContext(this.getContext()),I=R.display?R.width:0,j=I/2,V=function(Kt){return(0,d.X)(e,Kt,I)};let W,U,Q,G,X,rt,nt,ft,Et,St,Dt,ue;if("top"===r)W=V(this.bottom),rt=this.bottom-P,ft=W-j,St=V(i.top)+j,ue=i.bottom;else if("bottom"===r)W=V(this.top),St=i.top,ue=V(i.bottom)-j,rt=W+j,ft=this.top+P;else if("left"===r)W=V(this.right),X=this.right-P,nt=W-j,Et=V(i.left)+j,Dt=i.right;else if("right"===r)W=V(this.left),Et=i.left,Dt=V(i.right)-j,X=W+j,nt=this.left+P;else if("x"===t){if("center"===r)W=V((i.top+i.bottom)/2+.5);else if((0,d.i)(r)){const Kt=Object.keys(r)[0];W=V(this.chart.scales[Kt].getPixelForValue(r[Kt]))}St=i.top,ue=i.bottom,rt=W+j,ft=rt+P}else if("y"===t){if("center"===r)W=V((i.left+i.right)/2);else if((0,d.i)(r)){const Kt=Object.keys(r)[0];W=V(this.chart.scales[Kt].getPixelForValue(r[Kt]))}X=W-j,nt=X-P,Et=i.left,Dt=i.right}const Ce=(0,d.v)(n.ticks.maxTicksLimit,y),Ht=Math.max(1,Math.ceil(y/Ce));for(U=0;U<y;U+=Ht){const Kt=this.getContext(U),te=a.setContext(Kt),ze=c.setContext(Kt),pe=te.lineWidth,Zi=te.color,ds=ze.dash||[],qi=ze.dashOffset,Mn=te.tickWidth,Ri=te.tickColor,Cn=te.tickBorderDash||[],Di=te.tickBorderDashOffset;Q=Ci(this,U,h),void 0!==Q&&(G=(0,d.X)(e,Q,pe),f?X=nt=Et=Dt=G:rt=ft=St=ue=G,k.push({tx1:X,ty1:rt,tx2:nt,ty2:ft,x1:Et,y1:St,x2:Dt,y2:ue,width:pe,color:Zi,borderDash:ds,borderDashOffset:qi,tickWidth:Mn,tickColor:Ri,tickBorderDash:Cn,tickBorderDashOffset:Di}))}return this._ticksLength=y,this._borderValue=W,k}_computeLabelItems(i){const t=this.axis,e=this.options,{position:n,ticks:a}=e,r=this.isHorizontal(),c=this.ticks,{align:h,crossAlign:f,padding:m,mirror:y}=a,P=fe(e.grid),k=P+m,R=y?-m:k,I=-(0,d.t)(this.labelRotation),j=[];let V,W,U,Q,G,X,rt,nt,ft,Et,St,Dt,ue="middle";if("top"===n)X=this.bottom-R,rt=this._getXAxisLabelAlignment();else if("bottom"===n)X=this.top+R,rt=this._getXAxisLabelAlignment();else if("left"===n){const Ht=this._getYAxisLabelAlignment(P);rt=Ht.textAlign,G=Ht.x}else if("right"===n){const Ht=this._getYAxisLabelAlignment(P);rt=Ht.textAlign,G=Ht.x}else if("x"===t){if("center"===n)X=(i.top+i.bottom)/2+k;else if((0,d.i)(n)){const Ht=Object.keys(n)[0];X=this.chart.scales[Ht].getPixelForValue(n[Ht])+k}rt=this._getXAxisLabelAlignment()}else if("y"===t){if("center"===n)G=(i.left+i.right)/2-k;else if((0,d.i)(n)){const Ht=Object.keys(n)[0];G=this.chart.scales[Ht].getPixelForValue(n[Ht])}rt=this._getYAxisLabelAlignment(P).textAlign}"y"===t&&("start"===h?ue="top":"end"===h&&(ue="bottom"));const Ce=this._getLabelSizes();for(V=0,W=c.length;V<W;++V){U=c[V],Q=U.label;const Ht=a.setContext(this.getContext(V));nt=this.getPixelForTick(V)+a.labelOffset,ft=this._resolveTickFontOptions(V),Et=ft.lineHeight,St=(0,d.b)(Q)?Q.length:1;const Kt=St/2,te=Ht.color,ze=Ht.textStrokeColor,pe=Ht.textStrokeWidth;let ds,Zi=rt;if(r?(G=nt,"inner"===rt&&(Zi=V===W-1?this.options.reverse?"left":"right":0===V?this.options.reverse?"right":"left":"center"),Dt="top"===n?"near"===f||0!==I?-St*Et+Et/2:"center"===f?-Ce.highest.height/2-Kt*Et+Et:Et/2-Ce.highest.height:"near"===f||0!==I?Et/2:"center"===f?Ce.highest.height/2-Kt*Et:Ce.highest.height-St*Et,y&&(Dt*=-1),0!==I&&!Ht.showLabelBackdrop&&(G+=Et/2*Math.sin(I))):(X=nt,Dt=(1-St)*Et/2),Ht.showLabelBackdrop){const qi=(0,d.E)(Ht.backdropPadding),Mn=Ce.heights[V],Ri=Ce.widths[V];let Cn=Dt-qi.top,Di=0-qi.left;switch(ue){case"middle":Cn-=Mn/2;break;case"bottom":Cn-=Mn}switch(rt){case"center":Di-=Ri/2;break;case"right":Di-=Ri;break;case"inner":V===W-1?Di-=Ri:V>0&&(Di-=Ri/2)}ds={left:Di,top:Cn,width:Ri+qi.width,height:Mn+qi.height,color:Ht.backdropColor}}j.push({label:Q,font:ft,textOffset:Dt,options:{rotation:I,color:te,strokeColor:ze,strokeWidth:pe,textAlign:Zi,textBaseline:ue,translation:[G,X],backdrop:ds}})}return j}_getXAxisLabelAlignment(){const{position:i,ticks:t}=this.options;if(-(0,d.t)(this.labelRotation))return"top"===i?"left":"right";let n="center";return"start"===t.align?n="left":"end"===t.align?n="right":"inner"===t.align&&(n="inner"),n}_getYAxisLabelAlignment(i){const{position:t,ticks:{crossAlign:e,mirror:n,padding:a}}=this.options,c=i+a,h=this._getLabelSizes().widest.width;let f,m;return"left"===t?n?(m=this.right+a,"near"===e?f="left":"center"===e?(f="center",m+=h/2):(f="right",m+=h)):(m=this.right-c,"near"===e?f="right":"center"===e?(f="center",m-=h/2):(f="left",m=this.left)):"right"===t?n?(m=this.left+a,"near"===e?f="right":"center"===e?(f="center",m-=h/2):(f="left",m-=h)):(m=this.left+c,"near"===e?f="left":"center"===e?(f="center",m+=h/2):(f="right",m=this.right)):f="right",{textAlign:f,x:m}}_computeLabelArea(){if(this.options.ticks.mirror)return;const i=this.chart,t=this.options.position;return"left"===t||"right"===t?{top:0,left:this.left,bottom:i.height,right:this.right}:"top"===t||"bottom"===t?{top:this.top,left:0,bottom:this.bottom,right:i.width}:void 0}drawBackground(){const{ctx:i,options:{backgroundColor:t},left:e,top:n,width:a,height:r}=this;t&&(i.save(),i.fillStyle=t,i.fillRect(e,n,a,r),i.restore())}getLineWidthForValue(i){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;const n=this.ticks.findIndex(a=>a.value===i);return n>=0?t.setContext(this.getContext(n)).lineWidth:0}drawGrid(i){const t=this.options.grid,e=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(i));let a,r;const c=(h,f,m)=>{!m.width||!m.color||(e.save(),e.lineWidth=m.width,e.strokeStyle=m.color,e.setLineDash(m.borderDash||[]),e.lineDashOffset=m.borderDashOffset,e.beginPath(),e.moveTo(h.x,h.y),e.lineTo(f.x,f.y),e.stroke(),e.restore())};if(t.display)for(a=0,r=n.length;a<r;++a){const h=n[a];t.drawOnChartArea&&c({x:h.x1,y:h.y1},{x:h.x2,y:h.y2},h),t.drawTicks&&c({x:h.tx1,y:h.ty1},{x:h.tx2,y:h.ty2},{color:h.tickColor,width:h.tickWidth,borderDash:h.tickBorderDash,borderDashOffset:h.tickBorderDashOffset})}}drawBorder(){const{chart:i,ctx:t,options:{border:e,grid:n}}=this,a=e.setContext(this.getContext()),r=e.display?a.width:0;if(!r)return;const c=n.setContext(this.getContext(0)).lineWidth,h=this._borderValue;let f,m,y,P;this.isHorizontal()?(f=(0,d.X)(i,this.left,r)-r/2,m=(0,d.X)(i,this.right,c)+c/2,y=P=h):(y=(0,d.X)(i,this.top,r)-r/2,P=(0,d.X)(i,this.bottom,c)+c/2,f=m=h),t.save(),t.lineWidth=a.width,t.strokeStyle=a.color,t.beginPath(),t.moveTo(f,y),t.lineTo(m,P),t.stroke(),t.restore()}drawLabels(i){if(!this.options.ticks.display)return;const e=this.ctx,n=this._computeLabelArea();n&&(0,d.Y)(e,n);const a=this.getLabelItems(i);for(const r of a)(0,d.Z)(e,r.label,0,r.textOffset,r.font,r.options);n&&(0,d.$)(e)}drawTitle(){const{ctx:i,options:{position:t,title:e,reverse:n}}=this;if(!e.display)return;const a=(0,d.a0)(e.font),r=(0,d.E)(e.padding),c=e.align;let h=a.lineHeight/2;"bottom"===t||"center"===t||(0,d.i)(t)?(h+=r.bottom,(0,d.b)(e.text)&&(h+=a.lineHeight*(e.text.length-1))):h+=r.top;const{titleX:f,titleY:m,maxWidth:y,rotation:P}=function ji(s,i,t,e){const{top:n,left:a,bottom:r,right:c,chart:h}=s,{chartArea:f,scales:m}=h;let P,k,R,y=0;const I=r-n,j=c-a;if(s.isHorizontal()){if(k=(0,d.a2)(e,a,c),(0,d.i)(t)){const V=Object.keys(t)[0];R=m[V].getPixelForValue(t[V])+I-i}else R="center"===t?(f.bottom+f.top)/2+I-i:qe(s,t,i);P=c-a}else{if((0,d.i)(t)){const V=Object.keys(t)[0];k=m[V].getPixelForValue(t[V])-j+i}else k="center"===t?(f.left+f.right)/2-j+i:qe(s,t,i);R=(0,d.a2)(e,r,n),y="left"===t?-d.H:d.H}return{titleX:k,titleY:R,maxWidth:P,rotation:y}}(this,h,t,c);(0,d.Z)(i,e.text,0,0,a,{color:e.color,maxWidth:y,rotation:P,textAlign:Le(c,t,n),textBaseline:"middle",translation:[f,m]})}draw(i){this._isVisible()&&(this.drawBackground(),this.drawGrid(i),this.drawBorder(),this.drawTitle(),this.drawLabels(i))}_layers(){const i=this.options,t=i.ticks&&i.ticks.z||0,e=(0,d.v)(i.grid&&i.grid.z,-1),n=(0,d.v)(i.border&&i.border.z,0);return this._isVisible()&&this.draw===me.prototype.draw?[{z:e,draw:a=>{this.drawBackground(),this.drawGrid(a),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:t,draw:a=>{this.drawLabels(a)}}]:[{z:t,draw:a=>{this.draw(a)}}]}getMatchingVisibleMetas(i){const t=this.chart.getSortedVisibleDatasetMetas(),e=this.axis+"AxisID",n=[];let a,r;for(a=0,r=t.length;a<r;++a){const c=t[a];c[e]===this.id&&(!i||c.type===i)&&n.push(c)}return n}_resolveTickFontOptions(i){const t=this.options.ticks.setContext(this.getContext(i));return(0,d.a0)(t.font)}_maxDigits(){const i=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/i}}class ti{constructor(i,t,e){this.type=i,this.scope=t,this.override=e,this.items=Object.create(null)}isForType(i){return Object.prototype.isPrototypeOf.call(this.type.prototype,i.prototype)}register(i){const t=Object.getPrototypeOf(i);let e;(function us(s){return"id"in s&&"defaults"in s})(t)&&(e=this.register(t));const n=this.items,a=i.id,r=this.scope+"."+a;if(!a)throw new Error("class does not have id: "+i);return a in n||(n[a]=i,function rn(s,i,t){const e=(0,d.a4)(Object.create(null),[t?d.d.get(t):{},d.d.get(i),s.defaults]);d.d.set(i,e),s.defaultRoutes&&function zi(s,i){Object.keys(i).forEach(t=>{const e=t.split("."),n=e.pop(),a=[s].concat(e).join("."),r=i[t].split("."),c=r.pop(),h=r.join(".");d.d.route(a,n,h,c)})}(i,s.defaultRoutes),s.descriptors&&d.d.describe(i,s.descriptors)}(i,r,e),this.override&&d.d.override(i.id,i.overrides)),r}get(i){return this.items[i]}unregister(i){const t=this.items,e=i.id,n=this.scope;e in t&&delete t[e],n&&e in d.d[n]&&(delete d.d[n][e],this.override&&delete d.a3[e])}}class wn{constructor(){this.controllers=new ti(Zt,"datasets",!0),this.elements=new ti(S,"elements"),this.plugins=new ti(Object,"plugins"),this.scales=new ti(me,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...i){this._each("register",i)}remove(...i){this._each("unregister",i)}addControllers(...i){this._each("register",i,this.controllers)}addElements(...i){this._each("register",i,this.elements)}addPlugins(...i){this._each("register",i,this.plugins)}addScales(...i){this._each("register",i,this.scales)}getController(i){return this._get(i,this.controllers,"controller")}getElement(i){return this._get(i,this.elements,"element")}getPlugin(i){return this._get(i,this.plugins,"plugin")}getScale(i){return this._get(i,this.scales,"scale")}removeControllers(...i){this._each("unregister",i,this.controllers)}removeElements(...i){this._each("unregister",i,this.elements)}removePlugins(...i){this._each("unregister",i,this.plugins)}removeScales(...i){this._each("unregister",i,this.scales)}_each(i,t,e){[...t].forEach(n=>{const a=e||this._getRegistryForType(n);e||a.isForType(n)||a===this.plugins&&n.id?this._exec(i,a,n):(0,d.F)(n,r=>{const c=e||this._getRegistryForType(r);this._exec(i,c,r)})})}_exec(i,t,e){const n=(0,d.a5)(i);(0,d.Q)(e["before"+n],[],e),t[i](e),(0,d.Q)(e["after"+n],[],e)}_getRegistryForType(i){for(let t=0;t<this._typedRegistries.length;t++){const e=this._typedRegistries[t];if(e.isForType(i))return e}return this.plugins}_get(i,t,e){const n=t.get(i);if(void 0===n)throw new Error('"'+i+'" is not a registered '+e+".");return n}}var Fe=new wn;class kn{constructor(){this._init=[]}notify(i,t,e,n){"beforeInit"===t&&(this._init=this._createDescriptors(i,!0),this._notify(this._init,i,"install"));const a=n?this._descriptors(i).filter(n):this._descriptors(i),r=this._notify(a,i,t,e);return"afterDestroy"===t&&(this._notify(a,i,"stop"),this._notify(this._init,i,"uninstall")),r}_notify(i,t,e,n){n=n||{};for(const a of i){const r=a.plugin;if(!1===(0,d.Q)(r[e],[t,n,a.options],r)&&n.cancelable)return!1}return!0}invalidate(){(0,d.k)(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(i){if(this._cache)return this._cache;const t=this._cache=this._createDescriptors(i);return this._notifyStateChanges(i),t}_createDescriptors(i,t){const e=i&&i.config,n=(0,d.v)(e.options&&e.options.plugins,{}),a=function Sn(s){const i={},t=[],e=Object.keys(Fe.plugins.items);for(let a=0;a<e.length;a++)t.push(Fe.getPlugin(e[a]));const n=s.plugins||[];for(let a=0;a<n.length;a++){const r=n[a];-1===t.indexOf(r)&&(t.push(r),i[r.id]=!0)}return{plugins:t,localIds:i}}(e);return!1!==n||t?function On(s,{plugins:i,localIds:t},e,n){const a=[],r=s.getContext();for(const c of i){const h=c.id,f=fs(e[h],n);null!==f&&a.push({plugin:c,options:ps(s.config,{plugin:c,local:t[h]},f,r)})}return a}(i,a,n,t):[]}_notifyStateChanges(i){const t=this._oldCache||[],e=this._cache,n=(a,r)=>a.filter(c=>!r.some(h=>c.plugin.id===h.plugin.id));this._notify(n(t,e),i,"stop"),this._notify(n(e,t),i,"start")}}function fs(s,i){return i||!1!==s?!0===s?{}:s:null}function ps(s,{plugin:i,local:t},e,n){const a=s.pluginScopeKeys(i),r=s.getOptionScopes(e,a);return t&&i.defaults&&r.push(i.defaults),s.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Ni(s,i){return((i.datasets||{})[s]||{}).indexAxis||i.indexAxis||(d.d.datasets[s]||{}).indexAxis||"x"}function Wi(s){if("x"===s||"y"===s||"r"===s)return s}function gs(s){return"top"===s||"bottom"===s?"x":"left"===s||"right"===s?"y":void 0}function $i(s,...i){if(Wi(s))return s;for(const t of i){const e=t.axis||gs(t.position)||s.length>1&&Wi(s[0].toLowerCase());if(e)return e}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function Tn(s,i,t){if(t[i+"AxisID"]===s)return{axis:i}}function Rn(s){const i=s.options||(s.options={});i.plugins=(0,d.v)(i.plugins,{}),i.scales=function ms(s,i){const t=d.a3[s.type]||{scales:{}},e=i.scales||{},n=Ni(s.type,i),a=Object.create(null);return Object.keys(e).forEach(r=>{const c=e[r];if(!(0,d.i)(c))return console.error(`Invalid scale configuration for scale: ${r}`);if(c._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const h=$i(r,c,function ln(s,i){if(i.data&&i.data.datasets){const t=i.data.datasets.filter(e=>e.xAxisID===s||e.yAxisID===s);if(t.length)return Tn(s,"x",t[0])||Tn(s,"y",t[0])}return{}}(r,s),d.d.scales[c.type]),f=function wi(s,i){return s===i?"_index_":"_value_"}(h,n),m=t.scales||{};a[r]=(0,d.ab)(Object.create(null),[{axis:h},c,m[h],m[f]])}),s.data.datasets.forEach(r=>{const c=r.type||s.type,h=r.indexAxis||Ni(c,i),m=(d.a3[c]||{}).scales||{};Object.keys(m).forEach(y=>{const P=function En(s,i){let t=s;return"_index_"===s?t=i:"_value_"===s&&(t="x"===i?"y":"x"),t}(y,h),k=r[P+"AxisID"]||P;a[k]=a[k]||Object.create(null),(0,d.ab)(a[k],[{axis:P},e[k],m[y]])})}),Object.keys(a).forEach(r=>{const c=a[r];(0,d.ab)(c,[d.d.scales[c.type],d.d.scale])}),a}(s,i)}function Dn(s){return(s=s||{}).datasets=s.datasets||[],s.labels=s.labels||[],s}const cn=new Map,Vi=new Set;function Gi(s,i){let t=cn.get(s);return t||(t=i(),cn.set(s,t),Vi.add(t)),t}const ki=(s,i,t)=>{const e=(0,d.f)(i,t);void 0!==e&&s.add(e)};class ys{constructor(i){this._config=function _s(s){return(s=s||{}).data=Dn(s.data),Rn(s),s}(i),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(i){this._config.type=i}get data(){return this._config.data}set data(i){this._config.data=Dn(i)}get options(){return this._config.options}set options(i){this._config.options=i}get plugins(){return this._config.plugins}update(){const i=this._config;this.clearCache(),Rn(i)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(i){return Gi(i,()=>[[`datasets.${i}`,""]])}datasetAnimationScopeKeys(i,t){return Gi(`${i}.transition.${t}`,()=>[[`datasets.${i}.transitions.${t}`,`transitions.${t}`],[`datasets.${i}`,""]])}datasetElementScopeKeys(i,t){return Gi(`${i}-${t}`,()=>[[`datasets.${i}.elements.${t}`,`datasets.${i}`,`elements.${t}`,""]])}pluginScopeKeys(i){const t=i.id;return Gi(`${this.type}-plugin-${t}`,()=>[[`plugins.${t}`,...i.additionalOptionScopes||[]]])}_cachedScopes(i,t){const e=this._scopeCache;let n=e.get(i);return(!n||t)&&(n=new Map,e.set(i,n)),n}getOptionScopes(i,t,e){const{options:n,type:a}=this,r=this._cachedScopes(i,e),c=r.get(t);if(c)return c;const h=new Set;t.forEach(m=>{i&&(h.add(i),m.forEach(y=>ki(h,i,y))),m.forEach(y=>ki(h,n,y)),m.forEach(y=>ki(h,d.a3[a]||{},y)),m.forEach(y=>ki(h,d.d,y)),m.forEach(y=>ki(h,d.a6,y))});const f=Array.from(h);return 0===f.length&&f.push(Object.create(null)),Vi.has(t)&&r.set(t,f),f}chartOptionScopes(){const{options:i,type:t}=this;return[i,d.a3[t]||{},d.d.datasets[t]||{},{type:t},d.d,d.a6]}resolveNamedOptions(i,t,e,n=[""]){const a={$shared:!0},{resolver:r,subPrefixes:c}=Ln(this._resolverCache,i,n);let h=r;if(function xs(s,i){const{isScriptable:t,isIndexable:e}=(0,d.aa)(s);for(const n of i){const a=t(n),r=e(n),c=(r||a)&&s[n];if(a&&((0,d.a7)(c)||bs(c))||r&&(0,d.b)(c))return!0}return!1}(r,t)){a.$shared=!1,e=(0,d.a7)(e)?e():e;const f=this.createResolver(i,e,c);h=(0,d.a8)(r,e,f)}for(const f of t)a[f]=h[f];return a}createResolver(i,t,e=[""],n){const{resolver:a}=Ln(this._resolverCache,i,e);return(0,d.i)(t)?(0,d.a8)(a,t,void 0,n):a}}function Ln(s,i,t){let e=s.get(i);e||(e=new Map,s.set(i,e));const n=t.join();let a=e.get(n);return a||(a={resolver:(0,d.a9)(i,t),subPrefixes:t.filter(c=>!c.toLowerCase().includes("hover"))},e.set(n,a)),a}const bs=s=>(0,d.i)(s)&&Object.getOwnPropertyNames(s).some(i=>(0,d.a7)(s[i])),Ps=["top","bottom","left","right","chartArea"];function Fn(s,i){return"top"===s||"bottom"===s||-1===Ps.indexOf(s)&&"x"===i}function In(s,i){return function(t,e){return t[s]===e[s]?t[i]-e[i]:t[s]-e[s]}}function An(s){const i=s.chart,t=i.options.animation;i.notifyPlugins("afterRender"),(0,d.Q)(t&&t.onComplete,[s],i)}function Ms(s){const i=s.chart,t=i.options.animation;(0,d.Q)(t&&t.onProgress,[s],i)}function Bn(s){return(0,d.M)()&&"string"==typeof s?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}const pi={},hn=s=>{const i=Bn(s);return Object.values(pi).filter(t=>t.canvas===i).pop()};function Cs(s,i,t){const e=Object.keys(s);for(const n of e){const a=+n;if(a>=i){const r=s[n];delete s[n],(t>0||a>i)&&(s[a+t]=r)}}}function Hi(s,i,t){return s.options.clip?s[t]:i[t]}let jn=(()=>class s{static defaults=d.d;static instances=pi;static overrides=d.a3;static registry=Fe;static version="4.4.3";static getChart=hn;static register(...t){Fe.add(...t),dn()}static unregister(...t){Fe.remove(...t),dn()}constructor(t,e){const n=this.config=new ys(e),a=Bn(t),r=hn(a);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const c=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||function g(s){return!(0,d.M)()||typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas?It:tt}(a)),this.platform.updateConfig(n);const h=this.platform.acquireContext(a,c.aspectRatio),f=h&&h.canvas,m=f&&f.height,y=f&&f.width;this.id=(0,d.ac)(),this.ctx=h,this.canvas=f,this.width=y,this.height=m,this._options=c,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 kn,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=(0,d.ad)(P=>this.update(P),c.resizeDelay||0),this._dataChanges=[],pi[this.id]=this,h&&f?(Z.listen(this,"complete",An),Z.listen(this,"progress",Ms),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:e},width:n,height:a,_aspectRatio:r}=this;return(0,d.k)(t)?e&&r?r:a?n/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 Fe}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():(0,d.ae)(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return(0,d.af)(this.canvas,this.ctx),this}stop(){return Z.stop(this),this}resize(t,e){Z.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const n=this.options,c=this.platform.getMaximumSize(this.canvas,t,e,n.maintainAspectRatio&&this.aspectRatio),h=n.devicePixelRatio||this.platform.getDevicePixelRatio(),f=this.width?"resize":"attach";this.width=c.width,this.height=c.height,this._aspectRatio=this.aspectRatio,(0,d.ae)(this,h,!0)&&(this.notifyPlugins("resize",{size:c}),(0,d.Q)(n.onResize,[this,c],this),this.attached&&this._doResize(f)&&this.render())}ensureScalesHaveIDs(){(0,d.F)(this.options.scales||{},(n,a)=>{n.id=a})}buildOrUpdateScales(){const t=this.options,e=t.scales,n=this.scales,a=Object.keys(n).reduce((c,h)=>(c[h]=!1,c),{});let r=[];e&&(r=r.concat(Object.keys(e).map(c=>{const h=e[c],f=$i(c,h),m="r"===f,y="x"===f;return{options:h,dposition:m?"chartArea":y?"bottom":"left",dtype:m?"radialLinear":y?"category":"linear"}}))),(0,d.F)(r,c=>{const h=c.options,f=h.id,m=$i(f,h),y=(0,d.v)(h.type,c.dtype);(void 0===h.position||Fn(h.position,m)!==Fn(c.dposition))&&(h.position=c.dposition),a[f]=!0;let P=null;f in n&&n[f].type===y?P=n[f]:(P=new(Fe.getScale(y))({id:f,type:y,ctx:this.ctx,chart:this}),n[P.id]=P),P.init(h,t)}),(0,d.F)(a,(c,h)=>{c||delete n[h]}),(0,d.F)(n,c=>{vt.configure(this,c,c.options),vt.addBox(this,c)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((a,r)=>a.index-r.index),n>e){for(let a=e;a<n;++a)this._destroyDatasetMeta(a);t.splice(e,n-e)}this._sortedMetasets=t.slice(0).sort(In("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((n,a)=>{0===e.filter(r=>r===n._dataset).length&&this._destroyDatasetMeta(a)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let n,a;for(this._removeUnreferencedMetasets(),n=0,a=e.length;n<a;n++){const r=e[n];let c=this.getDatasetMeta(n);const h=r.type||this.config.type;if(c.type&&c.type!==h&&(this._destroyDatasetMeta(n),c=this.getDatasetMeta(n)),c.type=h,c.indexAxis=r.indexAxis||Ni(h,this.options),c.order=r.order||0,c.index=n,c.label=""+r.label,c.visible=this.isDatasetVisible(n),c.controller)c.controller.updateIndex(n),c.controller.linkScales();else{const f=Fe.getController(h),{datasetElementType:m,dataElementType:y}=d.d.datasets[h];Object.assign(f,{dataElementType:Fe.getElement(y),datasetElementType:m&&Fe.getElement(m)}),c.controller=new f(this,n),t.push(c.controller)}}return this._updateMetasets(),t}_resetElements(){(0,d.F)(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),a=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let c=0;for(let m=0,y=this.data.datasets.length;m<y;m++){const{controller:P}=this.getDatasetMeta(m),k=!a&&-1===r.indexOf(P);P.buildOrUpdateElements(k),c=Math.max(+P.getMaxOverflow(),c)}c=this._minPadding=n.layout.autoPadding?c:0,this._updateLayout(c),a||(0,d.F)(r,m=>{m.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(In("z","_idx"));const{_active:h,_lastEvent:f}=this;f?this._eventHandler(f,!0):h.length&&this._updateHoverStyles(h,h,!0),this.render()}_updateScales(){(0,d.F)(this.scales,t=>{vt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!(0,d.ag)(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:n,start:a,count:r}of e)Cs(t,a,"_removeElements"===n?-r:r)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,n=r=>new Set(t.filter(c=>c[0]===r).map((c,h)=>h+","+c.splice(1).join(","))),a=n(0);for(let r=1;r<e;r++)if(!(0,d.ag)(a,n(r)))return;return Array.from(a).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;vt.update(this,this.width,this.height,t);const e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],(0,d.F)(this.boxes,a=>{n&&"chartArea"===a.position||(a.configure&&a.configure(),this._layers.push(...a._layers()))},this),this._layers.forEach((a,r)=>{a._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let e=0,n=this.data.datasets.length;e<n;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,n=this.data.datasets.length;e<n;++e)this._updateDataset(e,(0,d.a7)(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const n=this.getDatasetMeta(t),a={meta:n,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",a)&&(n.controller._update(e),a.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",a))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(Z.has(this)?this.attached&&!Z.running(this)&&Z.start(this):(this.draw(),An({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:n,height:a}=this._resizeBeforeDraw;this._resize(n,a),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,n=[];let a,r;for(a=0,r=e.length;a<r;++a){const c=e[a];(!t||c.visible)&&n.push(c)}return n}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,n=t._clip,a=!n.disabled,r=function ks(s,i){const{xScale:t,yScale:e}=s;return t&&e?{left:Hi(t,i,"left"),right:Hi(t,i,"right"),top:Hi(e,i,"top"),bottom:Hi(e,i,"bottom")}:i}(t,this.chartArea),c={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",c)&&(a&&(0,d.Y)(e,{left:!1===n.left?0:r.left-n.left,right:!1===n.right?this.width:r.right+n.right,top:!1===n.top?0:r.top-n.top,bottom:!1===n.bottom?this.height:r.bottom+n.bottom}),t.controller.draw(),a&&(0,d.$)(e),c.cancelable=!1,this.notifyPlugins("afterDatasetDraw",c))}isPointInArea(t){return(0,d.C)(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,a){const r=T.modes[e];return"function"==typeof r?r(this,t,n,a):[]}getDatasetMeta(t){const e=this.data.datasets[t],n=this._metasets;let a=n.filter(r=>r&&r._dataset===e).pop();return a||(a={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(a)),a}getContext(){return this.$context||(this.$context=(0,d.j)(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const n=this.getDatasetMeta(t);return"boolean"==typeof n.hidden?!n.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){const a=n?"show":"hide",r=this.getDatasetMeta(t),c=r.controller._resolveAnimations(void 0,a);(0,d.h)(e)?(r.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),c.update(r,{visible:n}),this.update(h=>h.datasetIndex===t?a:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),Z.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),(0,d.af)(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete pi[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,e=this.platform,n=(r,c)=>{e.addEventListener(this,r,c),t[r]=c},a=(r,c,h)=>{r.offsetX=c,r.offsetY=h,this._eventHandler(r)};(0,d.F)(this.options.events,r=>n(r,a))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,n=(f,m)=>{e.addEventListener(this,f,m),t[f]=m},a=(f,m)=>{t[f]&&(e.removeEventListener(this,f,m),delete t[f])},r=(f,m)=>{this.canvas&&this.resize(f,m)};let c;const h=()=>{a("attach",h),this.attached=!0,this.resize(),n("resize",r),n("detach",c)};c=()=>{this.attached=!1,a("resize",r),this._stop(),this._resize(0,0),n("attach",h)},e.isAttached(this.canvas)?h():c()}unbindEvents(){(0,d.F)(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},(0,d.F)(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){const a=n?"set":"remove";let r,c,h,f;for("dataset"===e&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+a+"DatasetHoverStyle"]()),h=0,f=t.length;h<f;++h){c=t[h];const m=c&&this.getDatasetMeta(c.datasetIndex).controller;m&&m[a+"HoverStyle"](c.element,c.datasetIndex,c.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],n=t.map(({datasetIndex:r,index:c})=>{const h=this.getDatasetMeta(r);if(!h)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:h.data[c],index:c}});!(0,d.ah)(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return 1===this._plugins._cache.filter(e=>e.plugin.id===t).length}_updateHoverStyles(t,e,n){const a=this.options.hover,r=(f,m)=>f.filter(y=>!m.some(P=>y.datasetIndex===P.datasetIndex&&y.index===P.index)),c=r(e,t),h=n?t:r(t,e);c.length&&this.updateHoverStyle(c,a.mode,!1),h.length&&a.mode&&this.updateHoverStyle(h,a.mode,!0)}_eventHandler(t,e){const n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},a=c=>(c.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",n,a))return;const r=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,a),(r||n.changed)&&this.render(),this}_handleEvent(t,e,n){const{_active:a=[],options:r}=this,h=this._getActiveElements(t,a,n,e),f=(0,d.ai)(t),m=function ws(s,i,t,e){return t&&"mouseout"!==s.type?e?i:s:null}(t,this._lastEvent,n,f);n&&(this._lastEvent=null,(0,d.Q)(r.onHover,[t,h,this],this),f&&(0,d.Q)(r.onClick,[t,h,this],this));const y=!(0,d.ah)(h,a);return(y||e)&&(this._active=h,this._updateHoverStyles(h,a,e)),this._lastEvent=m,y}_getActiveElements(t,e,n,a){if("mouseout"===t.type)return[];if(!n)return e;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,a)}})();function dn(){return(0,d.F)(jn.instances,s=>s._plugins.invalidate())}function gi(s,i,t,e){return{x:t+s*Math.cos(i),y:e+s*Math.sin(i)}}function mi(s,i,t,e,n,a){const{x:r,y:c,startAngle:h,pixelMargin:f,innerRadius:m}=i,y=Math.max(i.outerRadius+e+t-f,0),P=m>0?m+e+t+f:0;let k=0;const R=n-h;if(e){const te=((m>0?m-e:0)+(y>0?y-e:0))/2;k=(R-(0!==te?R*te/(te+e):R))/2}const j=(R-Math.max(.001,R*y-t/d.P)/y)/2,V=h+j+k,W=n-j-k,{outerStart:U,outerEnd:Q,innerStart:G,innerEnd:X}=function zn(s,i,t,e){const n=function Si(s){return(0,d.ak)(s,["outerStart","outerEnd","innerStart","innerEnd"])}(s.options.borderRadius),a=(t-i)/2,r=Math.min(a,e*i/2),c=h=>{const f=(t-Math.min(a,h))*e/2;return(0,d.S)(h,0,Math.min(a,f))};return{outerStart:c(n.outerStart),outerEnd:c(n.outerEnd),innerStart:(0,d.S)(n.innerStart,0,r),innerEnd:(0,d.S)(n.innerEnd,0,r)}}(i,P,y,W-V),rt=y-U,nt=y-Q,ft=V+U/rt,Et=W-Q/nt,St=P+G,Dt=P+X,ue=V+G/St,Ce=W-X/Dt;if(s.beginPath(),a){const Ht=(ft+Et)/2;if(s.arc(r,c,y,ft,Ht),s.arc(r,c,y,Ht,Et),Q>0){const pe=gi(nt,Et,r,c);s.arc(pe.x,pe.y,Q,Et,W+d.H)}const Kt=gi(Dt,W,r,c);if(s.lineTo(Kt.x,Kt.y),X>0){const pe=gi(Dt,Ce,r,c);s.arc(pe.x,pe.y,X,W+d.H,Ce+Math.PI)}const te=(W-X/P+(V+G/P))/2;if(s.arc(r,c,P,W-X/P,te,!0),s.arc(r,c,P,te,V+G/P,!0),G>0){const pe=gi(St,ue,r,c);s.arc(pe.x,pe.y,G,ue+Math.PI,V-d.H)}const ze=gi(rt,V,r,c);if(s.lineTo(ze.x,ze.y),U>0){const pe=gi(rt,ft,r,c);s.arc(pe.x,pe.y,U,V-d.H,ft)}}else{s.moveTo(r,c);const Ht=Math.cos(ft)*y+r,Kt=Math.sin(ft)*y+c;s.lineTo(Ht,Kt);const te=Math.cos(Et)*y+r,ze=Math.sin(Et)*y+c;s.lineTo(te,ze)}s.closePath()}class Wn extends S{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:i=>"borderDash"!==i};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(i){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,i&&Object.assign(this,i)}inRange(i,t,e){const n=this.getProps(["x","y"],e),{angle:a,distance:r}=(0,d.D)(n,{x:i,y:t}),{startAngle:c,endAngle:h,innerRadius:f,outerRadius:m,circumference:y}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],e),P=(this.options.spacing+this.options.borderWidth)/2,R=(0,d.v)(y,h-c)>=d.T||(0,d.p)(a,c,h),I=(0,d.aj)(r,f+P,m+P);return R&&I}getCenterPoint(i){const{x:t,y:e,startAngle:n,endAngle:a,innerRadius:r,outerRadius:c}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],i),{offset:h,spacing:f}=this.options,m=(n+a)/2,y=(r+c+f+h)/2;return{x:t+Math.cos(m)*y,y:e+Math.sin(m)*y}}tooltipPosition(i){return this.getCenterPoint(i)}draw(i){const{options:t,circumference:e}=this,n=(t.offset||0)/4,a=(t.spacing||0)/2,r=t.circular;if(this.pixelMargin="inner"===t.borderAlign?.33:0,this.fullCircles=e>d.T?Math.floor(e/d.T):0,0===e||this.innerRadius<0||this.outerRadius<0)return;i.save();const c=(this.startAngle+this.endAngle)/2;i.translate(Math.cos(c)*n,Math.sin(c)*n);const f=n*(1-Math.sin(Math.min(d.P,e||0)));i.fillStyle=t.backgroundColor,i.strokeStyle=t.borderColor,function Nn(s,i,t,e,n){const{fullCircles:a,startAngle:r,circumference:c}=i;let h=i.endAngle;if(a){mi(s,i,t,e,h,n);for(let f=0;f<a;++f)s.fill();isNaN(c)||(h=r+(c%d.T||d.T))}mi(s,i,t,e,h,n),s.fill()}(i,this,f,a,r),function Ss(s,i,t,e,n){const{fullCircles:a,startAngle:r,circumference:c,options:h}=i,{borderWidth:f,borderJoinStyle:m,borderDash:y,borderDashOffset:P}=h,k="inner"===h.borderAlign;if(!f)return;s.setLineDash(y||[]),s.lineDashOffset=P,k?(s.lineWidth=2*f,s.lineJoin=m||"round"):(s.lineWidth=f,s.lineJoin=m||"bevel");let R=i.endAngle;if(a){mi(s,i,t,e,R,n);for(let I=0;I<a;++I)s.stroke();isNaN(c)||(R=r+(c%d.T||d.T))}k&&function un(s,i,t){const{startAngle:e,pixelMargin:n,x:a,y:r,outerRadius:c,innerRadius:h}=i;let f=n/c;s.beginPath(),s.arc(a,r,c,e-f,t+f),h>n?(f=n/h,s.arc(a,r,h,t+f,e-f,!0)):s.arc(a,r,n,t+d.H,e-d.H),s.closePath(),s.clip()}(s,i,R),a||(mi(s,i,t,e,R,n),s.stroke())}(i,this,f,a,r),i.restore()}}function $n(s,i,t=i){s.lineCap=(0,d.v)(t.borderCapStyle,i.borderCapStyle),s.setLineDash((0,d.v)(t.borderDash,i.borderDash)),s.lineDashOffset=(0,d.v)(t.borderDashOffset,i.borderDashOffset),s.lineJoin=(0,d.v)(t.borderJoinStyle,i.borderJoinStyle),s.lineWidth=(0,d.v)(t.borderWidth,i.borderWidth),s.strokeStyle=(0,d.v)(t.borderColor,i.borderColor)}function Vn(s,i,t){s.lineTo(t.x,t.y)}function Gn(s,i,t={}){const e=s.length,{start:n=0,end:a=e-1}=t,{start:r,end:c}=i,h=Math.max(n,r),f=Math.min(a,c);return{count:e,start:h,loop:i.loop,ilen:f<h&&!(n<r&&a<r||n>c&&a>c)?e+f-h:f-h}}function fn(s,i,t,e){const{points:n,options:a}=i,{count:r,start:c,loop:h,ilen:f}=Gn(n,t,e),m=function Os(s){return s.stepped?d.ar:s.tension||"monotone"===s.cubicInterpolationMode?d.as:Vn}(a);let k,R,I,{move:y=!0,reverse:P}=e||{};for(k=0;k<=f;++k)R=n[(c+(P?f-k:k))%r],!R.skip&&(y?(s.moveTo(R.x,R.y),y=!1):m(s,I,R,P,a.stepped),I=R);return h&&(R=n[(c+(P?f:0))%r],m(s,I,R,P,a.stepped)),!!h}function Hn(s,i,t,e){const n=i.points,{count:a,start:r,ilen:c}=Gn(n,t,e),{move:h=!0,reverse:f}=e||{};let P,k,R,I,j,V,m=0,y=0;const W=Q=>(r+(f?c-Q:Q))%a,U=()=>{I!==j&&(s.lineTo(m,j),s.lineTo(m,I),s.lineTo(m,V))};for(h&&(k=n[W(0)],s.moveTo(k.x,k.y)),P=0;P<=c;++P){if(k=n[W(P)],k.skip)continue;const Q=k.x,G=k.y,X=0|Q;X===R?(G<I?I=G:G>j&&(j=G),m=(y*m+Q)/++y):(U(),s.lineTo(Q,G),R=X,y=0,I=j=G),V=G}U()}function pn(s){const i=s.options;return s._decimated||s._loop||i.tension||"monotone"===i.cubicInterpolationMode||i.stepped||i.borderDash&&i.borderDash.length?fn:Hn}const Ts="function"==typeof Path2D;let Yi=(()=>class s extends S{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,e){const n=this.options;!n.tension&&"monotone"!==n.cubicInterpolationMode||n.stepped||this._pointsUpdated||((0,d.al)(this._points,n,t,n.spanGaps?this._loop:this._fullLoop,e),this._pointsUpdated=!0)}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=(0,d.am)(this,this.options.segment))}first(){const t=this.segments;return t.length&&this.points[t[0].start]}last(){const t=this.segments,n=t.length;return n&&this.points[t[n-1].end]}interpolate(t,e){const n=this.options,a=t[e],r=this.points,c=(0,d.an)(this,{property:e,start:a,end:a});if(!c.length)return;const h=[],f=function Es(s){return s.stepped?d.ao:s.tension||"monotone"===s.cubicInterpolationMode?d.ap:d.aq}(n);let m,y;for(m=0,y=c.length;m<y;++m){const{start:P,end:k}=c[m],R=r[P],I=r[k];if(R===I){h.push(R);continue}const V=f(R,I,Math.abs((a-R[e])/(I[e]-R[e])),n.stepped);V[e]=t[e],h.push(V)}return 1===h.length?h[0]:h}pathSegment(t,e,n){return pn(this)(t,this,e,n)}path(t,e,n){const a=this.segments,r=pn(this);let c=this._loop;e=e||0,n=n||this.points.length-e;for(const h of a)c&=r(t,this,h,{start:e,end:e+n-1});return!!c}draw(t,e,n,a){(this.points||[]).length&&(this.options||{}).borderWidth&&(t.save(),function Rs(s,i,t,e){Ts&&!i.options.segment?function Yn(s,i,t,e){let n=i._path;n||(n=i._path=new Path2D,i.path(n,t,e)&&n.closePath()),$n(s,i.options),s.stroke(n)}(s,i,t,e):function Un(s,i,t,e){const{segments:n,options:a}=i,r=pn(i);for(const c of n)$n(s,a,c.style),s.beginPath(),r(s,i,c,{start:t,end:t+e-1})&&s.closePath(),s.stroke()}(s,i,t,e)}(t,this,n,a),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}})();function ei(s,i,t,e){const n=s.options,{[t]:a}=s.getProps([t],e);return Math.abs(i-a)<n.radius+n.hitRadius}let gn=(()=>class s extends S{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,e,n){const a=this.options,{x:r,y:c}=this.getProps(["x","y"],n);return Math.pow(t-r,2)+Math.pow(e-c,2)<Math.pow(a.hitRadius+a.radius,2)}inXRange(t,e){return ei(this,t,"x",e)}inYRange(t,e){return ei(this,t,"y",e)}getCenterPoint(t){const{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}size(t){let e=(t=t||this.options||{}).radius||0;return e=Math.max(e,e&&t.hoverRadius||0),2*(e+(e&&t.borderWidth||0))}draw(t,e){const n=this.options;this.skip||n.radius<.1||!(0,d.C)(this,e,this.size(n)/2)||(t.strokeStyle=n.borderColor,t.lineWidth=n.borderWidth,t.fillStyle=n.backgroundColor,(0,d.at)(t,n,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}})();function Xn(s,i){const{x:t,y:e,base:n,width:a,height:r}=s.getProps(["x","y","base","width","height"],i);let c,h,f,m,y;return s.horizontal?(y=r/2,c=Math.min(t,n),h=Math.max(t,n),f=e-y,m=e+y):(y=a/2,c=t-y,h=t+y,f=Math.min(e,n),m=Math.max(e,n)),{left:c,top:f,right:h,bottom:m}}function We(s,i,t,e){return s?0:(0,d.S)(i,t,e)}function mn(s,i,t,e){const n=null===i,a=null===t,c=s&&!(n&&a)&&Xn(s,e);return c&&(n||(0,d.aj)(i,c.left,c.right))&&(a||(0,d.aj)(t,c.top,c.bottom))}function Kn(s,i){s.rect(i.x,i.y,i.w,i.h)}function Xi(s,i,t={}){const e=s.x!==t.x?-i:0,n=s.y!==t.y?-i:0;return{x:s.x+e,y:s.y+n,w:s.w+((s.x+s.w!==t.x+t.w?i:0)-e),h:s.h+((s.y+s.h!==t.y+t.h?i:0)-n),radius:s.radius}}class Oi extends S{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(i){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,i&&Object.assign(this,i)}draw(i){const{inflateAmount:t,options:{borderColor:e,backgroundColor:n}}=this,{inner:a,outer:r}=function Ui(s){const i=Xn(s),t=i.right-i.left,e=i.bottom-i.top,n=function Ds(s,i,t){const n=s.borderSkipped,a=(0,d.av)(s.options.borderWidth);return{t:We(n.top,a.top,0,t),r:We(n.right,a.right,0,i),b:We(n.bottom,a.bottom,0,t),l:We(n.left,a.left,0,i)}}(s,t/2,e/2),a=function Ls(s,i,t){const{enableBorderRadius:e}=s.getProps(["enableBorderRadius"]),n=s.options.borderRadius,a=(0,d.aw)(n),r=Math.min(i,t),c=s.borderSkipped,h=e||(0,d.i)(n);return{topLeft:We(!h||c.top||c.left,a.topLeft,0,r),topRight:We(!h||c.top||c.right,a.topRight,0,r),bottomLeft:We(!h||c.bottom||c.left,a.bottomLeft,0,r),bottomRight:We(!h||c.bottom||c.right,a.bottomRight,0,r)}}(s,t/2,e/2);return{outer:{x:i.left,y:i.top,w:t,h:e,radius:a},inner:{x:i.left+n.l,y:i.top+n.t,w:t-n.l-n.r,h:e-n.t-n.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,a.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(n.b,n.r))}}}}(this),c=function Fs(s){return s.topLeft||s.topRight||s.bottomLeft||s.bottomRight}(r.radius)?d.au:Kn;i.save(),(r.w!==a.w||r.h!==a.h)&&(i.beginPath(),c(i,Xi(r,t,a)),i.clip(),c(i,Xi(a,-t,r)),i.fillStyle=e,i.fill("evenodd")),i.beginPath(),c(i,Xi(a,t)),i.fillStyle=n,i.fill(),i.restore()}inRange(i,t,e){return mn(this,i,t,e)}inXRange(i,t){return mn(this,i,null,t)}inYRange(i,t){return mn(this,null,i,t)}getCenterPoint(i){const{x:t,y:e,base:n,horizontal:a}=this.getProps(["x","y","base","horizontal"],i);return{x:a?(t+n)/2:t,y:a?e:(e+n)/2}}getRange(i){return"x"===i?this.width/2:this.height/2}}var Ki=Object.freeze({__proto__:null,ArcElement:Wn,BarElement:Oi,LineElement:Yi,PointElement:gn});const _n=["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)"],Qn=_n.map(s=>s.replace("rgb(","rgba(").replace(")",", 0.5)"));function $e(s){return _n[s%_n.length]}function Jn(s){return Qn[s%Qn.length]}function Zn(s){let i;for(i in s)if(s[i].borderColor||s[i].backgroundColor)return!0;return!1}var zs={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,i,t){if(!t.enabled)return;const{data:{datasets:e},options:n}=s.config,{elements:a}=n;if(!t.forceOverride&&(Zn(e)||function js(s){return s&&(s.borderColor||s.backgroundColor)}(n)||a&&Zn(a)))return;const r=function Qi(s){let i=0;return(t,e)=>{const n=s.getDatasetMeta(e).controller;n instanceof Ue?i=function As(s,i){return s.backgroundColor=s.data.map(()=>$e(i++)),i}(t,i):n instanceof Ee?i=function Bs(s,i){return s.backgroundColor=s.data.map(()=>Jn(i++)),i}(t,i):n&&(i=function Is(s,i){return s.borderColor=$e(i),s.backgroundColor=Jn(i),++i}(t,i))}}(s);e.forEach(r)}};function qn(s){if(s._decimated){const i=s._data;delete s._decimated,delete s._data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,writable:!0,value:i})}}function ts(s){s.data.datasets.forEach(i=>{qn(i)})}var $s={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(s,i,t)=>{if(!t.enabled)return void ts(s);const e=s.width;s.data.datasets.forEach((n,a)=>{const{_data:r,indexAxis:c}=n,h=s.getDatasetMeta(a),f=r||n.data;if("y"===(0,d.a)([c,s.options.indexAxis])||!h.controller.supportsDecimation)return;const m=s.scales[h.xAxisID];if("linear"!==m.type&&"time"!==m.type||s.options.parsing)return;let R,{start:y,count:P}=function Ws(s,i){const t=i.length;let n,e=0;const{iScale:a}=s,{min:r,max:c,minDefined:h,maxDefined:f}=a.getUserBounds();return h&&(e=(0,d.S)((0,d.B)(i,a.axis,r).lo,0,t-1)),n=f?(0,d.S)((0,d.B)(i,a.axis,c).hi+1,e,t)-e:t-e,{start:e,count:n}}(h,f);if(P<=(t.threshold||4*e))qn(n);else{switch((0,d.k)(r)&&(n._data=f,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(I){this._data=I}})),t.algorithm){case"lttb":R=function Ns(s,i,t,e,n){const a=n.samples||e;if(a>=t)return s.slice(i,i+t);const r=[],c=(t-2)/(a-2);let h=0;const f=i+t-1;let y,P,k,R,I,m=i;for(r[h++]=s[m],y=0;y<a-2;y++){let W,j=0,V=0;const U=Math.floor((y+1)*c)+1+i,Q=Math.min(Math.floor((y+2)*c)+1,t)+i,G=Q-U;for(W=U;W<Q;W++)j+=s[W].x,V+=s[W].y;j/=G,V/=G;const X=Math.floor(y*c)+1+i,rt=Math.min(Math.floor((y+1)*c)+1,t)+i,{x:nt,y:ft}=s[m];for(k=R=-1,W=X;W<rt;W++)R=.5*Math.abs((nt-j)*(s[W].y-ft)-(nt-s[W].x)*(V-ft)),R>k&&(k=R,P=s[W],I=W);r[h++]=P,m=I}return r[h++]=s[f],r}(f,y,P,e,t);break;case"min-max":R=function ii(s,i,t,e){let r,c,h,f,m,y,P,k,R,I,n=0,a=0;const j=[],W=s[i].x,Q=s[i+t-1].x-W;for(r=i;r<i+t;++r){c=s[r],h=(c.x-W)/Q*e,f=c.y;const G=0|h;if(G===m)f<R?(R=f,y=r):f>I&&(I=f,P=r),n=(a*n+c.x)/++a;else{const X=r-1;if(!(0,d.k)(y)&&!(0,d.k)(P)){const rt=Math.min(y,P),nt=Math.max(y,P);rt!==k&&rt!==X&&j.push({...s[rt],x:n}),nt!==k&&nt!==X&&j.push({...s[nt],x:n})}r>0&&X!==k&&j.push(s[X]),j.push(c),m=G,a=0,R=I=f,y=P=k=r}}return j}(f,y,P,e);break;default:throw new Error(`Unsupported decimation algorithm '${t.algorithm}'`)}n._decimated=R}})},destroy(s){ts(s)}};function yn(s,i,t,e){if(e)return;let n=i[s],a=t[s];return"angle"===s&&(n=(0,d.ay)(n),a=(0,d.ay)(a)),{property:s,start:n,end:a}}function Ji(s,i,t){for(;i>s;i--){const e=t[i];if(!isNaN(e.x)&&!isNaN(e.y))break}return i}function bn(s,i,t,e){return s&&i?e(s[t],i[t]):s?s[t]:i?i[t]:0}function es(s,i){let t=[],e=!1;return(0,d.b)(s)?(e=!0,t=s):t=function Gs(s,i){const{x:t=null,y:e=null}=s||{},n=i.points,a=[];return i.segments.forEach(({start:r,end:c})=>{c=Ji(r,c,n);const h=n[r],f=n[c];null!==e?(a.push({x:h.x,y:e}),a.push({x:f.x,y:e})):null!==t&&(a.push({x:t,y:h.y}),a.push({x:t,y:f.y}))}),a}(s,i),t.length?new Yi({points:t,options:{tension:0},_loop:e,_fullLoop:e}):null}function xn(s){return s&&!1!==s.fill}function Hs(s,i,t){let n=s[i].fill;const a=[i];let r;if(!t)return n;for(;!1!==n&&-1===a.indexOf(n);){if(!(0,d.g)(n))return n;if(r=s[n],!r)return!1;if(r.visible)return n;a.push(n),n=r.fill}return!1}function Ys(s,i,t){const e=function Ks(s){const i=s.options,t=i.fill;let e=(0,d.v)(t&&t.target,t);return void 0===e&&(e=!!i.backgroundColor),!1!==e&&null!==e&&(!0===e?"origin":e)}(s);if((0,d.i)(e))return!isNaN(e.value)&&e;let n=parseFloat(e);return(0,d.g)(n)&&Math.floor(n)===n?function Us(s,i,t,e){return("-"===s||"+"===s)&&(t=i+t),!(t===i||t<0||t>=e)&&t}(e[0],i,n,t):["origin","start","end","stack","shape"].indexOf(e)>=0&&e}function l(s,i,t){const e=[];for(let n=0;n<t.length;n++){const a=t[n],{first:r,last:c,point:h}=u(a,i,"x");if(!(!h||r&&c))if(r)e.unshift(h);else if(s.push(h),!c)break}s.push(...e)}function u(s,i,t){const e=s.interpolate(i,t);if(!e)return{};const n=e[t],a=s.segments,r=s.points;let c=!1,h=!1;for(let f=0;f<a.length;f++){const m=a[f],y=r[m.start][t],P=r[m.end][t];if((0,d.aj)(n,y,P)){c=n===y,h=n===P;break}}return{first:c,last:h,point:e}}class p{constructor(i){this.x=i.x,this.y=i.y,this.radius=i.radius}pathSegment(i,t,e){const{x:n,y:a,radius:r}=this;return i.arc(n,a,r,(t=t||{start:0,end:d.T}).end,t.start,!0),!e.bounds}interpolate(i){const{x:t,y:e,radius:n}=this,a=i.angle;return{x:t+Math.cos(a)*n,y:e+Math.sin(a)*n,angle:a}}}function B(s,i,t){const e=function _(s){const{chart:i,fill:t,line:e}=s;if((0,d.g)(t))return function b(s,i){const t=s.getDatasetMeta(i);return t&&s.isDatasetVisible(i)?t.dataset:null}(i,t);if("stack"===t)return function ns(s){const{scale:i,index:t,line:e}=s,n=[],a=e.segments,r=e.points,c=function Qs(s,i){const t=[],e=s.getMatchingVisibleMetas("line");for(let n=0;n<e.length;n++){const a=e[n];if(a.index===i)break;a.hidden||t.unshift(a.dataset)}return t}(i,t);c.push(es({x:null,y:i.bottom},e));for(let h=0;h<a.length;h++){const f=a[h];for(let m=f.start;m<=f.end;m++)l(n,r[m],c)}return new Yi({points:n,options:{}})}(s);if("shape"===t)return!0;const n=function w(s){return(s.scale||{}).getPointPositionForValue?function D(s){const{scale:i,fill:t}=s,e=i.options,n=i.getLabels().length,a=e.reverse?i.max:i.min,r=function is(s,i,t){let e;return e="start"===s?t:"end"===s?i.options.reverse?i.min:i.max:(0,d.i)(s)?s.value:i.getBaseValue(),e}(t,i,a),c=[];if(e.grid.circular){const h=i.getPointPositionForValue(0,a);return new p({x:h.x,y:h.y,radius:i.getDistanceFromCenterForValue(r)})}for(let h=0;h<n;++h)c.push(i.getPointPositionForValue(h,r));return c}(s):function O(s){const{scale:i={},fill:t}=s,e=function Xs(s,i){let t=null;return"start"===s?t=i.bottom:"end"===s?t=i.top:(0,d.i)(s)?t=i.getPixelForValue(s.value):i.getBasePixel&&(t=i.getBasePixel()),t}(t,i);if((0,d.g)(e)){const n=i.isHorizontal();return{x:n?e:null,y:n?null:e}}return null}(s)}(s);return n instanceof p?n:es(n,e)}(i),{line:n,scale:a,axis:r}=i,c=n.options,h=c.fill,f=c.backgroundColor,{above:m=f,below:y=f}=h||{};e&&n.points.length&&((0,d.Y)(s,t),function $(s,i){const{line:t,target:e,above:n,below:a,area:r,scale:c}=i,h=t._loop?"angle":i.axis;s.save(),"x"===h&&a!==n&&(Y(s,e,r.top),pt(s,{line:t,target:e,color:n,scale:c,property:h}),s.restore(),s.save(),Y(s,e,r.bottom)),pt(s,{line:t,target:e,color:a,scale:c,property:h}),s.restore()}(s,{line:n,target:e,above:m,below:y,area:t,scale:a,axis:r}),(0,d.$)(s))}function Y(s,i,t){const{segments:e,points:n}=i;let a=!0,r=!1;s.beginPath();for(const c of e){const{start:h,end:f}=c,m=n[h],y=n[Ji(h,f,n)];a?(s.moveTo(m.x,m.y),a=!1):(s.lineTo(m.x,t),s.lineTo(m.x,m.y)),r=!!i.pathSegment(s,c,{move:r}),r?s.closePath():s.lineTo(y.x,t)}s.lineTo(i.first().x,t),s.closePath(),s.clip()}function pt(s,i){const{line:t,target:e,property:n,color:a,scale:r}=i,c=function Vs(s,i,t){const e=s.segments,n=s.points,a=i.points,r=[];for(const c of e){let{start:h,end:f}=c;f=Ji(h,f,n);const m=yn(t,n[h],n[f],c.loop);if(!i.segments){r.push({source:c,target:m,start:n[h],end:n[f]});continue}const y=(0,d.an)(i,m);for(const P of y){const k=yn(t,a[P.start],a[P.end],P.loop),R=(0,d.ax)(c,n,k);for(const I of R)r.push({source:I,target:P,start:{[t]:bn(m,k,"start",Math.max)},end:{[t]:bn(m,k,"end",Math.min)}})}}return r}(t,e,n);for(const{source:h,target:f,start:m,end:y}of c){const{style:{backgroundColor:P=a}={}}=h,k=!0!==e;s.save(),s.fillStyle=P,gt(s,r,k&&yn(n,m,y)),s.beginPath();const R=!!t.pathSegment(s,h);let I;if(k){R?s.closePath():Nt(s,e,y,n);const j=!!e.pathSegment(s,f,{move:R,reverse:!0});I=R&&j,I||Nt(s,e,m,n)}s.closePath(),s.fill(I?"evenodd":"nonzero"),s.restore()}}function gt(s,i,t){const{top:e,bottom:n}=i.chart.chartArea,{property:a,start:r,end:c}=t||{};"x"===a&&(s.beginPath(),s.rect(r,e,c-r,n-e),s.clip())}function Nt(s,i,t,e){const n=i.interpolate(t,e);n&&s.lineTo(n.x,n.y)}var Jt={id:"filler",afterDatasetsUpdate(s,i,t){const e=(s.data.datasets||[]).length,n=[];let a,r,c,h;for(r=0;r<e;++r)a=s.getDatasetMeta(r),c=a.dataset,h=null,c&&c.options&&c instanceof Yi&&(h={visible:s.isDatasetVisible(r),index:r,fill:Ys(c,r,e),chart:s,axis:a.controller.options.indexAxis,scale:a.vScale,line:c}),a.$filler=h,n.push(h);for(r=0;r<e;++r)h=n[r],h&&!1!==h.fill&&(h.fill=Hs(n,r,t.propagate))},beforeDraw(s,i,t){const e="beforeDraw"===t.drawTime,n=s.getSortedVisibleDatasetMetas(),a=s.chartArea;for(let r=n.length-1;r>=0;--r){const c=n[r].$filler;c&&(c.line.updateControlPoints(a,c.axis),e&&c.fill&&B(s.ctx,c,a))}},beforeDatasetsDraw(s,i,t){if("beforeDatasetsDraw"!==t.drawTime)return;const e=s.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n){const a=e[n].$filler;xn(a)&&B(s.ctx,a,s.chartArea)}},beforeDatasetDraw(s,i,t){const e=i.meta.$filler;!xn(e)||"beforeDatasetDraw"!==t.drawTime||B(s.ctx,e,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const bt=(s,i)=>{let{boxHeight:t=i,boxWidth:e=i}=s;return s.usePointStyle&&(t=Math.min(t,i),e=s.pointStyleWidth||Math.min(e,i)),{boxWidth:e,boxHeight:t,itemHeight:Math.max(i,t)}};class de extends S{constructor(i){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=i.chart,this.options=i.options,this.ctx=i.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(i,t,e){this.maxWidth=i,this.maxHeight=t,this._margins=e,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 i=this.options.labels||{};let t=(0,d.Q)(i.generateLabels,[this.chart],this)||[];i.filter&&(t=t.filter(e=>i.filter(e,this.chart.data))),i.sort&&(t=t.sort((e,n)=>i.sort(e,n,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){const{options:i,ctx:t}=this;if(!i.display)return void(this.width=this.height=0);const e=i.labels,n=(0,d.a0)(e.font),a=n.size,r=this._computeTitleHeight(),{boxWidth:c,itemHeight:h}=bt(e,a);let f,m;t.font=n.string,this.isHorizontal()?(f=this.maxWidth,m=this._fitRows(r,a,c,h)+10):(m=this.maxHeight,f=this._fitCols(r,n,c,h)+10),this.width=Math.min(f,i.maxWidth||this.maxWidth),this.height=Math.min(m,i.maxHeight||this.maxHeight)}_fitRows(i,t,e,n){const{ctx:a,maxWidth:r,options:{labels:{padding:c}}}=this,h=this.legendHitBoxes=[],f=this.lineWidths=[0],m=n+c;let y=i;a.textAlign="left",a.textBaseline="middle";let P=-1,k=-m;return this.legendItems.forEach((R,I)=>{const j=e+t/2+a.measureText(R.text).width;(0===I||f[f.length-1]+j+2*c>r)&&(y+=m,f[f.length-(I>0?0:1)]=0,k+=m,P++),h[I]={left:0,top:k,row:P,width:j,height:n},f[f.length-1]+=j+c}),y}_fitCols(i,t,e,n){const{ctx:a,maxHeight:r,options:{labels:{padding:c}}}=this,h=this.legendHitBoxes=[],f=this.columnSizes=[],m=r-i;let y=c,P=0,k=0,R=0,I=0;return this.legendItems.forEach((j,V)=>{const{itemWidth:W,itemHeight:U}=function _i(s,i,t,e,n){const a=function Ei(s,i,t,e){let n=s.text;return n&&"string"!=typeof n&&(n=n.reduce((a,r)=>a.length>r.length?a:r)),i+t.size/2+e.measureText(n).width}(e,s,i,t),r=function Js(s,i,t){let e=s;return"string"!=typeof i.text&&(e=ss(i,t)),e}(n,e,i.lineHeight);return{itemWidth:a,itemHeight:r}}(e,t,a,j,n);V>0&&k+U+2*c>m&&(y+=P+c,f.push({width:P,height:k}),R+=P+c,I++,P=k=0),h[V]={left:R,top:k,col:I,width:W,height:U},P=Math.max(P,W),k+=U+c}),y+=P,f.push({width:P,height:k}),y}adjustHitBoxes(){if(!this.options.display)return;const i=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:e,labels:{padding:n},rtl:a}}=this,r=(0,d.az)(a,this.left,this.width);if(this.isHorizontal()){let c=0,h=(0,d.a2)(e,this.left+n,this.right-this.lineWidths[c]);for(const f of t)c!==f.row&&(c=f.row,h=(0,d.a2)(e,this.left+n,this.right-this.lineWidths[c])),f.top+=this.top+i+n,f.left=r.leftForLtr(r.x(h),f.width),h+=f.width+n}else{let c=0,h=(0,d.a2)(e,this.top+i+n,this.bottom-this.columnSizes[c].height);for(const f of t)f.col!==c&&(c=f.col,h=(0,d.a2)(e,this.top+i+n,this.bottom-this.columnSizes[c].height)),f.top=h,f.left+=this.left+n,f.left=r.leftForLtr(r.x(f.left),f.width),h+=f.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const i=this.ctx;(0,d.Y)(i,this),this._draw(),(0,d.$)(i)}}_draw(){const{options:i,columnSizes:t,lineWidths:e,ctx:n}=this,{align:a,labels:r}=i,c=d.d.color,h=(0,d.az)(i.rtl,this.left,this.width),f=(0,d.a0)(r.font),{padding:m}=r,y=f.size,P=y/2;let k;this.drawTitle(),n.textAlign=h.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=f.string;const{boxWidth:R,boxHeight:I,itemHeight:j}=bt(r,y),U=this.isHorizontal(),Q=this._computeTitleHeight();k=U?{x:(0,d.a2)(a,this.left+m,this.right-e[0]),y:this.top+m+Q,line:0}:{x:this.left+m,y:(0,d.a2)(a,this.top+Q+m,this.bottom-t[0].height),line:0},(0,d.aA)(this.ctx,i.textDirection);const G=j+m;this.legendItems.forEach((X,rt)=>{n.strokeStyle=X.fontColor,n.fillStyle=X.fontColor;const nt=n.measureText(X.text).width,ft=h.textAlign(X.textAlign||(X.textAlign=r.textAlign)),Et=R+P+nt;let St=k.x,Dt=k.y;h.setWidth(this.width),U?rt>0&&St+Et+m>this.right&&(Dt=k.y+=G,k.line++,St=k.x=(0,d.a2)(a,this.left+m,this.right-e[k.line])):rt>0&&Dt+G>this.bottom&&(St=k.x=St+t[k.line].width+m,k.line++,Dt=k.y=(0,d.a2)(a,this.top+Q+m,this.bottom-t[k.line].height)),function(X,rt,nt){if(isNaN(R)||R<=0||isNaN(I)||I<0)return;n.save();const ft=(0,d.v)(nt.lineWidth,1);if(n.fillStyle=(0,d.v)(nt.fillStyle,c),n.lineCap=(0,d.v)(nt.lineCap,"butt"),n.lineDashOffset=(0,d.v)(nt.lineDashOffset,0),n.lineJoin=(0,d.v)(nt.lineJoin,"miter"),n.lineWidth=ft,n.strokeStyle=(0,d.v)(nt.strokeStyle,c),n.setLineDash((0,d.v)(nt.lineDash,[])),r.usePointStyle){const Et={radius:I*Math.SQRT2/2,pointStyle:nt.pointStyle,rotation:nt.rotation,borderWidth:ft},St=h.xPlus(X,R/2);(0,d.aD)(n,Et,St,rt+P,r.pointStyleWidth&&R)}else{const Et=rt+Math.max((y-I)/2,0),St=h.leftForLtr(X,R),Dt=(0,d.aw)(nt.borderRadius);n.beginPath(),Object.values(Dt).some(ue=>0!==ue)?(0,d.au)(n,{x:St,y:Et,w:R,h:I,radius:Dt}):n.rect(St,Et,R,I),n.fill(),0!==ft&&n.stroke()}n.restore()}(h.x(St),Dt,X),St=(0,d.aB)(ft,St+R+P,U?St+Et:this.right,i.rtl),function(X,rt,nt){(0,d.Z)(n,nt.text,X,rt+j/2,f,{strikethrough:nt.hidden,textAlign:h.textAlign(nt.textAlign)})}(h.x(St),Dt,X),U?k.x+=Et+m:k.y+="string"!=typeof X.text?ss(X,f.lineHeight)+m:G}),(0,d.aC)(this.ctx,i.textDirection)}drawTitle(){const i=this.options,t=i.title,e=(0,d.a0)(t.font),n=(0,d.E)(t.padding);if(!t.display)return;const a=(0,d.az)(i.rtl,this.left,this.width),r=this.ctx,c=t.position,f=n.top+e.size/2;let m,y=this.left,P=this.width;if(this.isHorizontal())P=Math.max(...this.lineWidths),m=this.top+f,y=(0,d.a2)(i.align,y,this.right-P);else{const R=this.columnSizes.reduce((I,j)=>Math.max(I,j.height),0);m=f+(0,d.a2)(i.align,this.top,this.bottom-R-i.labels.padding-this._computeTitleHeight())}const k=(0,d.a2)(c,y,y+P);r.textAlign=a.textAlign((0,d.a1)(c)),r.textBaseline="middle",r.strokeStyle=t.color,r.fillStyle=t.color,r.font=e.string,(0,d.Z)(r,t.text,k,m,e)}_computeTitleHeight(){const i=this.options.title,t=(0,d.a0)(i.font),e=(0,d.E)(i.padding);return i.display?t.lineHeight+e.height:0}_getLegendItemAt(i,t){let e,n,a;if((0,d.aj)(i,this.left,this.right)&&(0,d.aj)(t,this.top,this.bottom))for(a=this.legendHitBoxes,e=0;e<a.length;++e)if(n=a[e],(0,d.aj)(i,n.left,n.left+n.width)&&(0,d.aj)(t,n.top,n.top+n.height))return this.legendItems[e];return null}handleEvent(i){const t=this.options;if(!function Zs(s,i){return!(("mousemove"!==s&&"mouseout"!==s||!i.onHover&&!i.onLeave)&&(!i.onClick||"click"!==s&&"mouseup"!==s))}(i.type,t))return;const e=this._getLegendItemAt(i.x,i.y);if("mousemove"===i.type||"mouseout"===i.type){const n=this._hoveredItem,a=((s,i)=>null!==s&&null!==i&&s.datasetIndex===i.datasetIndex&&s.index===i.index)(n,e);n&&!a&&(0,d.Q)(t.onLeave,[i,n,this],this),this._hoveredItem=e,e&&!a&&(0,d.Q)(t.onHover,[i,e,this],this)}else e&&(0,d.Q)(t.onClick,[i,e,this],this)}}function ss(s,i){return i*(s.text?s.text.length:0)}var qs={id:"legend",_element:de,start(s,i,t){const e=s.legend=new de({ctx:s.ctx,options:t,chart:s});vt.configure(s,e,t),vt.addBox(s,e)},stop(s){vt.removeBox(s,s.legend),delete s.legend},beforeUpdate(s,i,t){const e=s.legend;vt.configure(s,e,t),e.options=t},afterUpdate(s){const i=s.legend;i.buildLabels(),i.adjustHitBoxes()},afterEvent(s,i){i.replay||s.legend.handleEvent(i.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(s,i,t){const e=i.datasetIndex,n=t.chart;n.isDatasetVisible(e)?(n.hide(e),i.hidden=!0):(n.show(e),i.hidden=!1)},onHover:null,onLeave:null,labels:{color:s=>s.chart.options.color,boxWidth:40,padding:10,generateLabels(s){const i=s.data.datasets,{labels:{usePointStyle:t,pointStyle:e,textAlign:n,color:a,useBorderRadius:r,borderRadius:c}}=s.legend.options;return s._getSortedDatasetMetas().map(h=>{const f=h.controller.getStyle(t?0:void 0),m=(0,d.E)(f.borderWidth);return{text:i[h.index].label,fillStyle:f.backgroundColor,fontColor:a,hidden:!h.visible,lineCap:f.borderCapStyle,lineDash:f.borderDash,lineDashOffset:f.borderDashOffset,lineJoin:f.borderJoinStyle,lineWidth:(m.width+m.height)/4,strokeStyle:f.borderColor,pointStyle:e||f.pointStyle,rotation:f.rotation,textAlign:n||f.textAlign,borderRadius:r&&(c||f.borderRadius),datasetIndex:h.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}};class Ve extends S{constructor(i){super(),this.chart=i.chart,this.options=i.options,this.ctx=i.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(i,t){const e=this.options;if(this.left=0,this.top=0,!e.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=i,this.height=this.bottom=t;const n=(0,d.b)(e.text)?e.text.length:1;this._padding=(0,d.E)(e.padding);const a=n*(0,d.a0)(e.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=a:this.width=a}isHorizontal(){const i=this.options.position;return"top"===i||"bottom"===i}_drawArgs(i){const{top:t,left:e,bottom:n,right:a,options:r}=this,c=r.align;let f,m,y,h=0;return this.isHorizontal()?(m=(0,d.a2)(c,e,a),y=t+i,f=a-e):("left"===r.position?(m=e+i,y=(0,d.a2)(c,n,t),h=-.5*d.P):(m=a-i,y=(0,d.a2)(c,t,n),h=.5*d.P),f=n-t),{titleX:m,titleY:y,maxWidth:f,rotation:h}}draw(){const i=this.ctx,t=this.options;if(!t.display)return;const e=(0,d.a0)(t.font),a=e.lineHeight/2+this._padding.top,{titleX:r,titleY:c,maxWidth:h,rotation:f}=this._drawArgs(a);(0,d.Z)(i,t.text,0,0,e,{color:t.color,maxWidth:h,rotation:f,textAlign:(0,d.a1)(t.align),textBaseline:"middle",translation:[r,c]})}}var Pa={id:"title",_element:Ve,start(s,i,t){!function as(s,i){const t=new Ve({ctx:s.ctx,options:i,chart:s});vt.configure(s,t,i),vt.addBox(s,t),s.titleBlock=t}(s,t)},stop(s){vt.removeBox(s,s.titleBlock),delete s.titleBlock},beforeUpdate(s,i,t){const e=s.titleBlock;vt.configure(s,e,t),e.options=t},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 os=new WeakMap;var Ma={id:"subtitle",start(s,i,t){const e=new Ve({ctx:s.ctx,options:t,chart:s});vt.configure(s,e,t),vt.addBox(s,e),os.set(s,e)},stop(s){vt.removeBox(s,os.get(s)),os.delete(s)},beforeUpdate(s,i,t){const e=os.get(s);vt.configure(s,e,t),e.options=t},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 vn={average(s){if(!s.length)return!1;let i,t,e=new Set,n=0,a=0;for(i=0,t=s.length;i<t;++i){const c=s[i].element;if(c&&c.hasValue()){const h=c.tooltipPosition();e.add(h.x),n+=h.y,++a}}return{x:[...e].reduce((c,h)=>c+h)/e.size,y:n/a}},nearest(s,i){if(!s.length)return!1;let a,r,c,t=i.x,e=i.y,n=Number.POSITIVE_INFINITY;for(a=0,r=s.length;a<r;++a){const h=s[a].element;if(h&&h.hasValue()){const f=h.getCenterPoint(),m=(0,d.aE)(i,f);m<n&&(n=m,c=h)}}if(c){const h=c.tooltipPosition();t=h.x,e=h.y}return{x:t,y:e}}};function Ge(s,i){return i&&((0,d.b)(i)?Array.prototype.push.apply(s,i):s.push(i)),s}function ni(s){return("string"==typeof s||s instanceof String)&&s.indexOf("\n")>-1?s.split("\n"):s}function Ca(s,i){const{element:t,datasetIndex:e,index:n}=i,a=s.getDatasetMeta(e).controller,{label:r,value:c}=a.getLabelAndValue(n);return{chart:s,label:r,parsed:a.getParsed(n),raw:s.data.datasets[e].data[n],formattedValue:c,dataset:a.getDataset(),dataIndex:n,datasetIndex:e,element:t}}function ia(s,i){const t=s.chart.ctx,{body:e,footer:n,title:a}=s,{boxWidth:r,boxHeight:c}=i,h=(0,d.a0)(i.bodyFont),f=(0,d.a0)(i.titleFont),m=(0,d.a0)(i.footerFont),y=a.length,P=n.length,k=e.length,R=(0,d.E)(i.padding);let I=R.height,j=0,V=e.reduce((Q,G)=>Q+G.before.length+G.lines.length+G.after.length,0);V+=s.beforeBody.length+s.afterBody.length,y&&(I+=y*f.lineHeight+(y-1)*i.titleSpacing+i.titleMarginBottom),V&&(I+=k*(i.displayColors?Math.max(c,h.lineHeight):h.lineHeight)+(V-k)*h.lineHeight+(V-1)*i.bodySpacing),P&&(I+=i.footerMarginTop+P*m.lineHeight+(P-1)*i.footerSpacing);let W=0;const U=function(Q){j=Math.max(j,t.measureText(Q).width+W)};return t.save(),t.font=f.string,(0,d.F)(s.title,U),t.font=h.string,(0,d.F)(s.beforeBody.concat(s.afterBody),U),W=i.displayColors?r+2+i.boxPadding:0,(0,d.F)(e,Q=>{(0,d.F)(Q.before,U),(0,d.F)(Q.lines,U),(0,d.F)(Q.after,U)}),W=0,t.font=m.string,(0,d.F)(s.footer,U),t.restore(),j+=R.width,{width:j,height:I}}function Sa(s,i,t,e){const{x:n,width:a}=t,{width:r,chartArea:{left:c,right:h}}=s;let f="center";return"center"===e?f=n<=(c+h)/2?"left":"right":n<=a/2?f="left":n>=r-a/2&&(f="right"),function ka(s,i,t,e){const{x:n,width:a}=e,r=t.caretSize+t.caretPadding;if("left"===s&&n+a+r>i.width||"right"===s&&n-a-r<0)return!0}(f,s,i,t)&&(f="center"),f}function na(s,i,t){const e=t.yAlign||i.yAlign||function wa(s,i){const{y:t,height:e}=i;return t<e/2?"top":t>s.height-e/2?"bottom":"center"}(s,t);return{xAlign:t.xAlign||i.xAlign||Sa(s,i,t,e),yAlign:e}}function sa(s,i,t,e){const{caretSize:n,caretPadding:a,cornerRadius:r}=s,{xAlign:c,yAlign:h}=t,f=n+a,{topLeft:m,topRight:y,bottomLeft:P,bottomRight:k}=(0,d.aw)(r);let R=function Oa(s,i){let{x:t,width:e}=s;return"right"===i?t-=e:"center"===i&&(t-=e/2),t}(i,c);const I=function Ea(s,i,t){let{y:e,height:n}=s;return"top"===i?e+=t:e-="bottom"===i?n+t:n/2,e}(i,h,f);return"center"===h?"left"===c?R+=f:"right"===c&&(R-=f):"left"===c?R-=Math.max(m,P)+n:"right"===c&&(R+=Math.max(y,k)+n),{x:(0,d.S)(R,0,e.width-i.width),y:(0,d.S)(I,0,e.height-i.height)}}function rs(s,i,t){const e=(0,d.E)(t.padding);return"center"===i?s.x+s.width/2:"right"===i?s.x+s.width-e.right:s.x+e.left}function aa(s){return Ge([],ni(s))}function oa(s,i){const t=i&&i.dataset&&i.dataset.tooltip&&i.dataset.tooltip.callbacks;return t?s.override(t):s}const ra={beforeTitle:d.aF,title(s){if(s.length>0){const i=s[0],t=i.chart.data.labels,e=t?t.length:0;if(this&&this.options&&"dataset"===this.options.mode)return i.dataset.label||"";if(i.label)return i.label;if(e>0&&i.dataIndex<e)return t[i.dataIndex]}return""},afterTitle:d.aF,beforeBody:d.aF,beforeLabel:d.aF,label(s){if(this&&this.options&&"dataset"===this.options.mode)return s.label+": "+s.formattedValue||s.formattedValue;let i=s.dataset.label||"";i&&(i+=": ");const t=s.formattedValue;return(0,d.k)(t)||(i+=t),i},labelColor(s){const t=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(s){const t=s.chart.getDatasetMeta(s.datasetIndex).controller.getStyle(s.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:d.aF,afterBody:d.aF,beforeFooter:d.aF,footer:d.aF,afterFooter:d.aF};function ye(s,i,t,e){const n=s[i].call(t,e);return typeof n>"u"?ra[i].call(t,e):n}let la=(()=>class s extends S{static positioners=vn;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 e=this.chart,n=this.options.setContext(this.getContext()),a=n.enabled&&e.options.animation&&n.animations,r=new xt(this.chart,a);return a._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=function Ta(s,i,t){return(0,d.j)(s,{tooltip:i,tooltipItems:t,type:"tooltip"})}(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:n}=e,a=ye(n,"beforeTitle",this,t),r=ye(n,"title",this,t),c=ye(n,"afterTitle",this,t);let h=[];return h=Ge(h,ni(a)),h=Ge(h,ni(r)),h=Ge(h,ni(c)),h}getBeforeBody(t,e){return aa(ye(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:n}=e,a=[];return(0,d.F)(t,r=>{const c={before:[],lines:[],after:[]},h=oa(n,r);Ge(c.before,ni(ye(h,"beforeLabel",this,r))),Ge(c.lines,ye(h,"label",this,r)),Ge(c.after,ni(ye(h,"afterLabel",this,r))),a.push(c)}),a}getAfterBody(t,e){return aa(ye(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:n}=e,a=ye(n,"beforeFooter",this,t),r=ye(n,"footer",this,t),c=ye(n,"afterFooter",this,t);let h=[];return h=Ge(h,ni(a)),h=Ge(h,ni(r)),h=Ge(h,ni(c)),h}_createItems(t){const e=this._active,n=this.chart.data,a=[],r=[],c=[];let f,m,h=[];for(f=0,m=e.length;f<m;++f)h.push(Ca(this.chart,e[f]));return t.filter&&(h=h.filter((y,P,k)=>t.filter(y,P,k,n))),t.itemSort&&(h=h.sort((y,P)=>t.itemSort(y,P,n))),(0,d.F)(h,y=>{const P=oa(t.callbacks,y);a.push(ye(P,"labelColor",this,y)),r.push(ye(P,"labelPointStyle",this,y)),c.push(ye(P,"labelTextColor",this,y))}),this.labelColors=a,this.labelPointStyles=r,this.labelTextColors=c,this.dataPoints=h,h}update(t,e){const n=this.options.setContext(this.getContext()),a=this._active;let r,c=[];if(a.length){const h=vn[n.position].call(this,a,this._eventPosition);c=this._createItems(n),this.title=this.getTitle(c,n),this.beforeBody=this.getBeforeBody(c,n),this.body=this.getBody(c,n),this.afterBody=this.getAfterBody(c,n),this.footer=this.getFooter(c,n);const f=this._size=ia(this,n),m=Object.assign({},h,f),y=na(this.chart,n,m),P=sa(n,m,y,this.chart);this.xAlign=y.xAlign,this.yAlign=y.yAlign,r={opacity:1,x:P.x,y:P.y,width:f.width,height:f.height,caretX:h.x,caretY:h.y}}else 0!==this.opacity&&(r={opacity:0});this._tooltipItems=c,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,a){const r=this.getCaretPosition(t,n,a);e.lineTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.lineTo(r.x3,r.y3)}getCaretPosition(t,e,n){const{xAlign:a,yAlign:r}=this,{caretSize:c,cornerRadius:h}=n,{topLeft:f,topRight:m,bottomLeft:y,bottomRight:P}=(0,d.aw)(h),{x:k,y:R}=t,{width:I,height:j}=e;let V,W,U,Q,G,X;return"center"===r?(G=R+j/2,"left"===a?(V=k,W=V-c,Q=G+c,X=G-c):(V=k+I,W=V+c,Q=G-c,X=G+c),U=V):(W="left"===a?k+Math.max(f,y)+c:"right"===a?k+I-Math.max(m,P)-c:this.caretX,"top"===r?(Q=R,G=Q-c,V=W-c,U=W+c):(Q=R+j,G=Q+c,V=W+c,U=W-c),X=Q),{x1:V,x2:W,x3:U,y1:Q,y2:G,y3:X}}drawTitle(t,e,n){const a=this.title,r=a.length;let c,h,f;if(r){const m=(0,d.az)(n.rtl,this.x,this.width);for(t.x=rs(this,n.titleAlign,n),e.textAlign=m.textAlign(n.titleAlign),e.textBaseline="middle",c=(0,d.a0)(n.titleFont),h=n.titleSpacing,e.fillStyle=n.titleColor,e.font=c.string,f=0;f<r;++f)e.fillText(a[f],m.x(t.x),t.y+c.lineHeight/2),t.y+=c.lineHeight+h,f+1===r&&(t.y+=n.titleMarginBottom-h)}}_drawColorBox(t,e,n,a,r){const c=this.labelColors[n],h=this.labelPointStyles[n],{boxHeight:f,boxWidth:m}=r,y=(0,d.a0)(r.bodyFont),P=rs(this,"left",r),k=a.x(P),I=e.y+(f<y.lineHeight?(y.lineHeight-f)/2:0);if(r.usePointStyle){const j={radius:Math.min(m,f)/2,pointStyle:h.pointStyle,rotation:h.rotation,borderWidth:1},V=a.leftForLtr(k,m)+m/2,W=I+f/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,(0,d.at)(t,j,V,W),t.strokeStyle=c.borderColor,t.fillStyle=c.backgroundColor,(0,d.at)(t,j,V,W)}else{t.lineWidth=(0,d.i)(c.borderWidth)?Math.max(...Object.values(c.borderWidth)):c.borderWidth||1,t.strokeStyle=c.borderColor,t.setLineDash(c.borderDash||[]),t.lineDashOffset=c.borderDashOffset||0;const j=a.leftForLtr(k,m),V=a.leftForLtr(a.xPlus(k,1),m-2),W=(0,d.aw)(c.borderRadius);Object.values(W).some(U=>0!==U)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,(0,d.au)(t,{x:j,y:I,w:m,h:f,radius:W}),t.fill(),t.stroke(),t.fillStyle=c.backgroundColor,t.beginPath(),(0,d.au)(t,{x:V,y:I+1,w:m-2,h:f-2,radius:W}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(j,I,m,f),t.strokeRect(j,I,m,f),t.fillStyle=c.backgroundColor,t.fillRect(V,I+1,m-2,f-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){const{body:a}=this,{bodySpacing:r,bodyAlign:c,displayColors:h,boxHeight:f,boxWidth:m,boxPadding:y}=n,P=(0,d.a0)(n.bodyFont);let k=P.lineHeight,R=0;const I=(0,d.az)(n.rtl,this.x,this.width),j=function(ft){e.fillText(ft,I.x(t.x+R),t.y+k/2),t.y+=k+r},V=I.textAlign(c);let W,U,Q,G,X,rt,nt;for(e.textAlign=c,e.textBaseline="middle",e.font=P.string,t.x=rs(this,V,n),e.fillStyle=n.bodyColor,(0,d.F)(this.beforeBody,j),R=h&&"right"!==V?"center"===c?m/2+y:m+2+y:0,G=0,rt=a.length;G<rt;++G){for(W=a[G],U=this.labelTextColors[G],e.fillStyle=U,(0,d.F)(W.before,j),Q=W.lines,h&&Q.length&&(this._drawColorBox(e,t,G,I,n),k=Math.max(P.lineHeight,f)),X=0,nt=Q.length;X<nt;++X)j(Q[X]),k=P.lineHeight;(0,d.F)(W.after,j)}R=0,k=P.lineHeight,(0,d.F)(this.afterBody,j),t.y-=r}drawFooter(t,e,n){const a=this.footer,r=a.length;let c,h;if(r){const f=(0,d.az)(n.rtl,this.x,this.width);for(t.x=rs(this,n.footerAlign,n),t.y+=n.footerMarginTop,e.textAlign=f.textAlign(n.footerAlign),e.textBaseline="middle",c=(0,d.a0)(n.footerFont),e.fillStyle=n.footerColor,e.font=c.string,h=0;h<r;++h)e.fillText(a[h],f.x(t.x),t.y+c.lineHeight/2),t.y+=c.lineHeight+n.footerSpacing}}drawBackground(t,e,n,a){const{xAlign:r,yAlign:c}=this,{x:h,y:f}=t,{width:m,height:y}=n,{topLeft:P,topRight:k,bottomLeft:R,bottomRight:I}=(0,d.aw)(a.cornerRadius);e.fillStyle=a.backgroundColor,e.strokeStyle=a.borderColor,e.lineWidth=a.borderWidth,e.beginPath(),e.moveTo(h+P,f),"top"===c&&this.drawCaret(t,e,n,a),e.lineTo(h+m-k,f),e.quadraticCurveTo(h+m,f,h+m,f+k),"center"===c&&"right"===r&&this.drawCaret(t,e,n,a),e.lineTo(h+m,f+y-I),e.quadraticCurveTo(h+m,f+y,h+m-I,f+y),"bottom"===c&&this.drawCaret(t,e,n,a),e.lineTo(h+R,f+y),e.quadraticCurveTo(h,f+y,h,f+y-R),"center"===c&&"left"===r&&this.drawCaret(t,e,n,a),e.lineTo(h,f+P),e.quadraticCurveTo(h,f,h+P,f),e.closePath(),e.fill(),a.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,n=this.$animations,a=n&&n.x,r=n&&n.y;if(a||r){const c=vn[t.position].call(this,this._active,this._eventPosition);if(!c)return;const h=this._size=ia(this,t),f=Object.assign({},c,this._size),m=na(e,t,f),y=sa(t,f,m,e);(a._to!==y.x||r._to!==y.y)&&(this.xAlign=m.xAlign,this.yAlign=m.yAlign,this.width=h.width,this.height=h.height,this.caretX=c.x,this.caretY=c.y,this._resolveAnimations().update(this,y))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let n=this.opacity;if(!n)return;this._updateAnimationTarget(e);const a={width:this.width,height:this.height},r={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;const c=(0,d.E)(e.padding);e.enabled&&(this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length)&&(t.save(),t.globalAlpha=n,this.drawBackground(r,t,a,e),(0,d.aA)(t,e.textDirection),r.y+=c.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),(0,d.aC)(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const n=this._active,a=t.map(({datasetIndex:h,index:f})=>{const m=this.chart.getDatasetMeta(h);if(!m)throw new Error("Cannot find a dataset at index "+h);return{datasetIndex:h,element:m.data[f],index:f}}),r=!(0,d.ah)(n,a),c=this._positionChanged(a,e);(r||c)&&(this._active=a,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const a=this.options,r=this._active||[],c=this._getActiveElements(t,r,e,n),h=this._positionChanged(c,t),f=e||!(0,d.ah)(c,r)||h;return f&&(this._active=c,(a.enabled||a.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),f}_getActiveElements(t,e,n,a){const r=this.options;if("mouseout"===t.type)return[];if(!a)return e.filter(h=>this.chart.data.datasets[h.datasetIndex]&&void 0!==this.chart.getDatasetMeta(h.datasetIndex).controller.getParsed(h.index));const c=this.chart.getElementsAtEventForMode(t,r.mode,r,n);return r.reverse&&c.reverse(),c}_positionChanged(t,e){const{caretX:n,caretY:a,options:r}=this,c=vn[r.position].call(this,t,e);return!1!==c&&(n!==c.x||a!==c.y)}})();var Da=Object.freeze({__proto__:null,Colors:zs,Decimation:$s,Filler:Jt,Legend:qs,SubTitle:Ma,Title:Pa,Tooltip:{id:"tooltip",_element:la,positioners:vn,afterInit(s,i,t){t&&(s.tooltip=new la({chart:s,options:t}))},beforeUpdate(s,i,t){s.tooltip&&s.tooltip.initialize(t)},reset(s,i,t){s.tooltip&&s.tooltip.initialize(t)},afterDraw(s){const i=s.tooltip;if(i&&i._willRender()){const t={tooltip:i};if(!1===s.notifyPlugins("beforeTooltipDraw",{...t,cancelable:!0}))return;i.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",t)}},afterEvent(s,i){s.tooltip&&s.tooltip.handleEvent(i.event,i.replay,i.inChartArea)&&(i.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:(s,i)=>i.bodyFont.size,boxWidth:(s,i)=>i.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:ra},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>"filter"!==s&&"itemSort"!==s&&"external"!==s,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]}});function ca(s){const i=this.getLabels();return s>=0&&s<i.length?i[s]:s}let ha=(()=>class s extends me{static id="category";static defaults={ticks:{callback:ca}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const n=this.getLabels();for(const{index:a,label:r}of e)n[a]===r&&n.splice(a,1);this._addedLabels=[]}super.init(t)}parse(t,e){if((0,d.k)(t))return null;const n=this.getLabels();return((s,i)=>null===s?null:(0,d.S)(Math.round(s),0,i))(e=isFinite(e)&&n[e]===t?e:function Fa(s,i,t,e){const n=s.indexOf(i);return-1===n?((s,i,t,e)=>("string"==typeof i?(t=s.push(i)-1,e.unshift({index:t,label:i})):isNaN(i)&&(t=null),t))(s,i,t,e):n!==s.lastIndexOf(i)?t:n}(n,t,(0,d.v)(e,t),this._addedLabels),n.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:n,max:a}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(n=0),e||(a=this.getLabels().length-1)),this.min=n,this.max=a}buildTicks(){const t=this.min,e=this.max,n=this.options.offset,a=[];let r=this.getLabels();r=0===t&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let c=t;c<=e;c++)a.push({value:c});return a}getLabelForValue(t){return ca.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 e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}})();function da(s,i,{horizontal:t,minRotation:e}){const n=(0,d.t)(e),a=(t?Math.sin(n):Math.cos(n))||.001;return Math.min(i/a,.75*i*(""+s).length)}class ls extends me{constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(i,t){return(0,d.k)(i)||("number"==typeof i||i instanceof Number)&&!isFinite(+i)?null:+i}handleTickRangeOptions(){const{beginAtZero:i}=this.options,{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:n,max:a}=this;const r=h=>n=t?n:h,c=h=>a=e?a:h;if(i){const h=(0,d.s)(n),f=(0,d.s)(a);h<0&&f<0?c(0):h>0&&f>0&&r(0)}if(n===a){let h=0===a?1:Math.abs(.05*a);c(a+h),i||r(n-h)}this.min=n,this.max=a}getTickLimit(){const i=this.options.ticks;let n,{maxTicksLimit:t,stepSize:e}=i;return e?(n=Math.ceil(this.max/e)-Math.floor(this.min/e)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${e} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),t=t||11),t&&(n=Math.min(t,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const i=this.options,t=i.ticks;let e=this.getTickLimit();e=Math.max(2,e);const r=function Aa(s,i){const t=[],{bounds:n,step:a,min:r,max:c,precision:h,count:f,maxTicks:m,maxDigits:y,includeBounds:P}=s,k=a||1,R=m-1,{min:I,max:j}=i,V=!(0,d.k)(r),W=!(0,d.k)(c),U=!(0,d.k)(f),Q=(j-I)/(y+1);let X,rt,nt,ft,G=(0,d.aH)((j-I)/R/k)*k;if(G<1e-14&&!V&&!W)return[{value:I},{value:j}];ft=Math.ceil(j/G)-Math.floor(I/G),ft>R&&(G=(0,d.aH)(ft*G/R/k)*k),(0,d.k)(h)||(X=Math.pow(10,h),G=Math.ceil(G*X)/X),"ticks"===n?(rt=Math.floor(I/G)*G,nt=Math.ceil(j/G)*G):(rt=I,nt=j),V&&W&&a&&(0,d.aI)((c-r)/a,G/1e3)?(ft=Math.round(Math.min((c-r)/G,m)),G=(c-r)/ft,rt=r,nt=c):U?(rt=V?r:rt,nt=W?c:nt,ft=f-1,G=(nt-rt)/ft):(ft=(nt-rt)/G,ft=(0,d.aJ)(ft,Math.round(ft),G/1e3)?Math.round(ft):Math.ceil(ft));const Et=Math.max((0,d.aK)(G),(0,d.aK)(rt));X=Math.pow(10,(0,d.k)(h)?Et:h),rt=Math.round(rt*X)/X,nt=Math.round(nt*X)/X;let St=0;for(V&&(P&&rt!==r?(t.push({value:r}),rt<r&&St++,(0,d.aJ)(Math.round((rt+St*G)*X)/X,r,da(r,Q,s))&&St++):rt<r&&St++);St<ft;++St){const Dt=Math.round((rt+St*G)*X)/X;if(W&&Dt>c)break;t.push({value:Dt})}return W&&P&&nt!==c?t.length&&(0,d.aJ)(t[t.length-1].value,c,da(c,Q,s))?t[t.length-1].value=c:t.push({value:c}):(!W||nt===c)&&t.push({value:nt}),t}({maxTicks:e,bounds:i.bounds,min:i.min,max:i.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:!1!==t.includeBounds},this._range||this);return"ticks"===i.bounds&&(0,d.aG)(r,this,"value"),i.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const i=this.ticks;let t=this.min,e=this.max;if(super.configure(),this.options.offset&&i.length){const n=(e-t)/Math.max(i.length-1,1)/2;t-=n,e+=n}this._startValue=t,this._endValue=e,this._valueRange=e-t}getLabelForValue(i){return(0,d.o)(i,this.chart.options.locale,this.options.ticks.format)}}class ua extends ls{static id="linear";static defaults={ticks:{callback:d.aL.formatters.numeric}};determineDataLimits(){const{min:i,max:t}=this.getMinMax(!0);this.min=(0,d.g)(i)?i:0,this.max=(0,d.g)(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){const i=this.isHorizontal(),t=i?this.width:this.height,e=(0,d.t)(this.options.ticks.minRotation),n=(i?Math.sin(e):Math.cos(e))||.001,a=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,a.lineHeight/n))}getPixelForValue(i){return null===i?NaN:this.getPixelForDecimal((i-this._startValue)/this._valueRange)}getValueForPixel(i){return this._startValue+this.getDecimalForPixel(i)*this._valueRange}}const Pn=s=>Math.floor((0,d.aM)(s)),Ti=(s,i)=>Math.pow(10,Pn(s)+i);function fa(s){return s/Math.pow(10,Pn(s))==1}function pa(s,i,t){const e=Math.pow(10,t),n=Math.floor(s/e);return Math.ceil(i/e)-n}function ta(s){const i=s.ticks;if(i.display&&s.display){const t=(0,d.E)(i.backdropPadding);return(0,d.v)(i.font&&i.font.size,d.d.font.size)+t.height}return 0}function Na(s,i,t){return t=(0,d.b)(t)?t:[t],{w:(0,d.aN)(s,i.string,t),h:t.length*i.lineHeight}}function ga(s,i,t,e,n){return s===e||s===n?{start:i-t/2,end:i+t/2}:s<e||s>n?{start:i-t,end:i}:{start:i,end:i+t}}function $a(s,i,t,e,n){const a=Math.abs(Math.sin(t)),r=Math.abs(Math.cos(t));let c=0,h=0;e.start<i.l?(c=(i.l-e.start)/a,s.l=Math.min(s.l,i.l-c)):e.end>i.r&&(c=(e.end-i.r)/a,s.r=Math.max(s.r,i.r+c)),n.start<i.t?(h=(i.t-n.start)/r,s.t=Math.min(s.t,i.t-h)):n.end>i.b&&(h=(n.end-i.b)/r,s.b=Math.max(s.b,i.b+h))}function Va(s,i,t){const e=s.drawingArea,{extra:n,additionalAngle:a,padding:r,size:c}=t,h=s.getPointPosition(i,e+n+r,a),f=Math.round((0,d.U)((0,d.ay)(h.angle+d.H))),m=function Xa(s,i,t){return 90===t||270===t?s-=i/2:(t>270||t<90)&&(s-=i),s}(h.y,c.h,f),y=function Ya(s){return 0===s||180===s?"center":s<180?"left":"right"}(f),P=function Ua(s,i,t){return"right"===t?s-=i:"center"===t&&(s-=i/2),s}(h.x,c.w,y);return{visible:!0,x:h.x,y:m,textAlign:y,left:P,top:m,right:P+c.w,bottom:m+c.h}}function Ga(s,i){if(!i)return!0;const{left:t,top:e,right:n,bottom:a}=s;return!((0,d.C)({x:t,y:e},i)||(0,d.C)({x:t,y:a},i)||(0,d.C)({x:n,y:e},i)||(0,d.C)({x:n,y:a},i))}function Ka(s,i,t){const{left:e,top:n,right:a,bottom:r}=t,{backdropColor:c}=i;if(!(0,d.k)(c)){const h=(0,d.aw)(i.borderRadius),f=(0,d.E)(i.backdropPadding);s.fillStyle=c;const m=e-f.left,y=n-f.top,P=a-e+f.width,k=r-n+f.height;Object.values(h).some(R=>0!==R)?(s.beginPath(),(0,d.au)(s,{x:m,y,w:P,h:k,radius:h}),s.fill()):s.fillRect(m,y,P,k)}}function ma(s,i,t,e){const{ctx:n}=s;if(t)n.arc(s.xCenter,s.yCenter,i,0,d.T);else{let a=s.getPointPosition(0,i);n.moveTo(a.x,a.y);for(let r=1;r<e;r++)a=s.getPointPosition(r,i),n.lineTo(a.x,a.y)}}const cs={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}},be=Object.keys(cs);function _a(s,i){return s-i}function ya(s,i){if((0,d.k)(i))return null;const t=s._adapter,{parser:e,round:n,isoWeekday:a}=s._parseOpts;let r=i;return"function"==typeof e&&(r=e(r)),(0,d.g)(r)||(r="string"==typeof e?t.parse(r,e):t.parse(r)),null===r?null:(n&&(r="week"!==n||!(0,d.x)(a)&&!0!==a?t.startOf(r,n):t.startOf(r,"isoWeek",a)),+r)}function ba(s,i,t,e){const n=be.length;for(let a=be.indexOf(s);a<n-1;++a){const r=cs[be[a]];if(r.common&&Math.ceil((t-i)/((r.steps?r.steps:Number.MAX_SAFE_INTEGER)*r.size))<=e)return be[a]}return be[n-1]}function xa(s,i,t){if(t){if(t.length){const{lo:e,hi:n}=(0,d.aP)(t,i);s[t[e]>=i?t[e]:t[n]]=!0}}else s[i]=!0}function va(s,i,t){const e=[],n={},a=i.length;let r,c;for(r=0;r<a;++r)c=i[r],n[c]=r,e.push({value:c,major:!1});return 0!==a&&t?function io(s,i,t,e){const n=s._adapter,a=+n.startOf(i[0].value,e),r=i[i.length-1].value;let c,h;for(c=a;c<=r;c=+n.add(c,1,e))h=t[c],h>=0&&(i[h].major=!0);return i}(s,e,n,t):e}let ea=(()=>class s extends me{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,e={}){const n=t.time||(t.time={}),a=this._adapter=new Qe._date(t.adapters.date);a.init(e),(0,d.ab)(n.displayFormats,a.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:ya(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,n=t.time.unit||"day";let{min:a,max:r,minDefined:c,maxDefined:h}=this.getUserBounds();function f(m){!c&&!isNaN(m.min)&&(a=Math.min(a,m.min)),!h&&!isNaN(m.max)&&(r=Math.max(r,m.max))}(!c||!h)&&(f(this._getLabelBounds()),("ticks"!==t.bounds||"labels"!==t.ticks.source)&&f(this.getMinMax(!1))),a=(0,d.g)(a)&&!isNaN(a)?a:+e.startOf(Date.now(),n),r=(0,d.g)(r)&&!isNaN(r)?r:+e.endOf(Date.now(),n)+1,this.min=Math.min(a,r-1),this.max=Math.max(a+1,r)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){const t=this.options,e=t.time,n=t.ticks,a="labels"===n.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 r=this.min,h=(0,d.aO)(a,r,this.max);return this._unit=e.unit||(n.autoSkip?ba(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):function to(s,i,t,e,n){for(let a=be.length-1;a>=be.indexOf(t);a--){const r=be[a];if(cs[r].common&&s._adapter.diff(n,e,r)>=i-1)return r}return be[t?be.indexOf(t):0]}(this,h.length,e.minUnit,this.min,this.max)),this._majorUnit=n.major.enabled&&"year"!==this._unit?function eo(s){for(let i=be.indexOf(s)+1,t=be.length;i<t;++i)if(cs[be[i]].common)return be[i]}(this._unit):void 0,this.initOffsets(a),t.reverse&&h.reverse(),va(this,h,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let a,r,e=0,n=0;this.options.offset&&t.length&&(a=this.getDecimalForValue(t[0]),e=1===t.length?1-a:(this.getDecimalForValue(t[1])-a)/2,r=this.getDecimalForValue(t[t.length-1]),n=1===t.length?r:(r-this.getDecimalForValue(t[t.length-2]))/2);const c=t.length<3?.5:.25;e=(0,d.S)(e,0,c),n=(0,d.S)(n,0,c),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){const t=this._adapter,e=this.min,n=this.max,a=this.options,r=a.time,c=r.unit||ba(r.minUnit,e,n,this._getLabelCapacity(e)),h=(0,d.v)(a.ticks.stepSize,1),f="week"===c&&r.isoWeekday,m=(0,d.x)(f)||!0===f,y={};let k,R,P=e;if(m&&(P=+t.startOf(P,"isoWeek",f)),P=+t.startOf(P,m?"day":c),t.diff(n,e,c)>1e5*h)throw new Error(e+" and "+n+" are too far apart with stepSize of "+h+" "+c);const I="data"===a.ticks.source&&this.getDataTimestamps();for(k=P,R=0;k<n;k=+t.add(k,h,c),R++)xa(y,k,I);return(k===n||"ticks"===a.bounds||1===R)&&xa(y,k,I),Object.keys(y).sort(_a).map(j=>+j)}getLabelForValue(t){const n=this.options.time;return this._adapter.format(t,n.tooltipFormat?n.tooltipFormat:n.displayFormats.datetime)}format(t,e){return this._adapter.format(t,e||this.options.time.displayFormats[this._unit])}_tickFormatFunction(t,e,n,a){const r=this.options,c=r.ticks.callback;if(c)return(0,d.Q)(c,[t,e,n],this);const h=r.time.displayFormats,f=this._unit,m=this._majorUnit,P=m&&h[m],k=n[e];return this._adapter.format(t,a||(m&&P&&k&&k.major?P:f&&h[f]))}generateTickLabels(t){let e,n,a;for(e=0,n=t.length;e<n;++e)a=t[e],a.label=this._tickFormatFunction(a.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,n=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+n)*e.factor)}getValueForPixel(t){const e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+n*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,n=this.ctx.measureText(t).width,a=(0,d.t)(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(a),c=Math.sin(a),h=this._resolveTickFontOptions(0).size;return{w:n*r+h*c,h:n*c+h*r}}_getLabelCapacity(t){const e=this.options.time,n=e.displayFormats,a=n[e.unit]||n.millisecond,r=this._tickFormatFunction(t,0,va(this,[t],this._majorUnit),a),c=this._getLabelSize(r),h=Math.floor(this.isHorizontal()?this.width/c.w:this.height/c.h)-1;return h>0?h:1}getDataTimestamps(){let e,n,t=this._cache.data||[];if(t.length)return t;const a=this.getMatchingVisibleMetas();if(this._normalized&&a.length)return this._cache.data=a[0].controller.getAllParsedValues(this);for(e=0,n=a.length;e<n;++e)t=t.concat(a[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,n;if(t.length)return t;const a=this.getLabels();for(e=0,n=a.length;e<n;++e)t.push(ya(this,a[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return(0,d._)(t.sort(_a))}})();function hs(s,i,t){let a,r,c,h,e=0,n=s.length-1;t?(i>=s[e].pos&&i<=s[n].pos&&({lo:e,hi:n}=(0,d.B)(s,"pos",i)),({pos:a,time:c}=s[e]),({pos:r,time:h}=s[n])):(i>=s[e].time&&i<=s[n].time&&({lo:e,hi:n}=(0,d.B)(s,"time",i)),({time:a,pos:c}=s[e]),({time:r,pos:h}=s[n]));const f=r-a;return f?c+(h-c)*(i-a)/f:c}const ao=[xi,Ki,Da,Object.freeze({__proto__:null,CategoryScale:ha,LinearScale:ua,LogarithmicScale:class za extends me{static id="logarithmic";static defaults={ticks:{callback:d.aL.formatters.logarithmic,major:{enabled:!0}}};constructor(i){super(i),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(i,t){const e=ls.prototype.parse.apply(this,[i,t]);if(0!==e)return(0,d.g)(e)&&e>0?e:null;this._zero=!0}determineDataLimits(){const{min:i,max:t}=this.getMinMax(!0);this.min=(0,d.g)(i)?Math.max(0,i):null,this.max=(0,d.g)(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!(0,d.g)(this._userMin)&&(this.min=i===Ti(this.min,0)?Ti(this.min,-1):Ti(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:i,maxDefined:t}=this.getUserBounds();let e=this.min,n=this.max;const a=c=>e=i?e:c,r=c=>n=t?n:c;e===n&&(e<=0?(a(1),r(10)):(a(Ti(e,-1)),r(Ti(n,1)))),e<=0&&a(Ti(n,-1)),n<=0&&r(Ti(e,1)),this.min=e,this.max=n}buildTicks(){const i=this.options,e=function ja(s,{min:i,max:t}){i=(0,d.O)(s.min,i);const e=[],n=Pn(i);let a=function Ba(s,i){let e=Pn(i-s);for(;pa(s,i,e)>10;)e++;for(;pa(s,i,e)<10;)e--;return Math.min(e,Pn(s))}(i,t),r=a<0?Math.pow(10,Math.abs(a)):1;const c=Math.pow(10,a),h=n>a?Math.pow(10,n):0,f=Math.round((i-h)*r)/r,m=Math.floor((i-h)/c/10)*c*10;let y=Math.floor((f-m)/Math.pow(10,a)),P=(0,d.O)(s.min,Math.round((h+m+y*Math.pow(10,a))*r)/r);for(;P<t;)e.push({value:P,major:fa(P),significand:y}),y>=10?y=y<15?15:20:y++,y>=20&&(a++,y=2,r=a>=0?1:r),P=Math.round((h+m+y*Math.pow(10,a))*r)/r;const k=(0,d.O)(s.max,P);return e.push({value:k,major:fa(k),significand:y}),e}({min:this._userMin,max:this._userMax},this);return"ticks"===i.bounds&&(0,d.aG)(e,this,"value"),i.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(i){return void 0===i?"0":(0,d.o)(i,this.chart.options.locale,this.options.ticks.format)}configure(){const i=this.min;super.configure(),this._startValue=(0,d.aM)(i),this._valueRange=(0,d.aM)(this.max)-(0,d.aM)(i)}getPixelForValue(i){return(void 0===i||0===i)&&(i=this.min),null===i||isNaN(i)?NaN:this.getPixelForDecimal(i===this.min?0:((0,d.aM)(i)-this._startValue)/this._valueRange)}getValueForPixel(i){const t=this.getDecimalForPixel(i);return Math.pow(10,this._startValue+t*this._valueRange)}},RadialLinearScale:class qa extends ls{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:d.aL.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:i=>i,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(i){super(i),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const i=this._padding=(0,d.E)(ta(this.options)/2),t=this.width=this.maxWidth-i.width,e=this.height=this.maxHeight-i.height;this.xCenter=Math.floor(this.left+t/2+i.left),this.yCenter=Math.floor(this.top+e/2+i.top),this.drawingArea=Math.floor(Math.min(t,e)/2)}determineDataLimits(){const{min:i,max:t}=this.getMinMax(!1);this.min=(0,d.g)(i)&&!isNaN(i)?i:0,this.max=(0,d.g)(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/ta(this.options))}generateTickLabels(i){ls.prototype.generateTickLabels.call(this,i),this._pointLabels=this.getLabels().map((t,e)=>{const n=(0,d.Q)(this.options.pointLabels.callback,[t,e],this);return n||0===n?n:""}).filter((t,e)=>this.chart.getDataVisibility(e))}fit(){const i=this.options;i.display&&i.pointLabels.display?function Wa(s){const i={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},t=Object.assign({},i),e=[],n=[],a=s._pointLabels.length,r=s.options.pointLabels,c=r.centerPointLabels?d.P/a:0;for(let h=0;h<a;h++){const f=r.setContext(s.getPointLabelContext(h));n[h]=f.padding;const m=s.getPointPosition(h,s.drawingArea+n[h],c),y=(0,d.a0)(f.font),P=Na(s.ctx,y,s._pointLabels[h]);e[h]=P;const k=(0,d.ay)(s.getIndexAngle(h)+c),R=Math.round((0,d.U)(k));$a(t,i,k,ga(R,m.x,P.w,0,180),ga(R,m.y,P.h,90,270))}s.setCenterPoint(i.l-t.l,t.r-i.r,i.t-t.t,t.b-i.b),s._pointLabelItems=function Ha(s,i,t){const e=[],n=s._pointLabels.length,a=s.options,{centerPointLabels:r,display:c}=a.pointLabels,h={extra:ta(a)/2,additionalAngle:r?d.P/n:0};let f;for(let m=0;m<n;m++){h.padding=t[m],h.size=i[m];const y=Va(s,m,h);e.push(y),"auto"===c&&(y.visible=Ga(y,f),y.visible&&(f=y))}return e}(s,e,n)}(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(i,t,e,n){this.xCenter+=Math.floor((i-t)/2),this.yCenter+=Math.floor((e-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(i,t,e,n))}getIndexAngle(i){return(0,d.ay)(i*(d.T/(this._pointLabels.length||1))+(0,d.t)(this.options.startAngle||0))}getDistanceFromCenterForValue(i){if((0,d.k)(i))return NaN;const t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-i)*t:(i-this.min)*t}getValueForDistanceFromCenter(i){if((0,d.k)(i))return NaN;const t=i/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(i){const t=this._pointLabels||[];if(i>=0&&i<t.length){const e=t[i];return function Za(s,i,t){return(0,d.j)(s,{label:t,index:i,type:"pointLabel"})}(this.getContext(),i,e)}}getPointPosition(i,t,e=0){const n=this.getIndexAngle(i)-d.H+e;return{x:Math.cos(n)*t+this.xCenter,y:Math.sin(n)*t+this.yCenter,angle:n}}getPointPositionForValue(i,t){return this.getPointPosition(i,this.getDistanceFromCenterForValue(t))}getBasePosition(i){return this.getPointPositionForValue(i||0,this.getBaseValue())}getPointLabelPosition(i){const{left:t,top:e,right:n,bottom:a}=this._pointLabelItems[i];return{left:t,top:e,right:n,bottom:a}}drawBackground(){const{backgroundColor:i,grid:{circular:t}}=this.options;if(i){const e=this.ctx;e.save(),e.beginPath(),ma(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),e.closePath(),e.fillStyle=i,e.fill(),e.restore()}}drawGrid(){const i=this.ctx,t=this.options,{angleLines:e,grid:n,border:a}=t,r=this._pointLabels.length;let c,h,f;if(t.pointLabels.display&&function Qa(s,i){const{ctx:t,options:{pointLabels:e}}=s;for(let n=i-1;n>=0;n--){const a=s._pointLabelItems[n];if(!a.visible)continue;const r=e.setContext(s.getPointLabelContext(n));Ka(t,r,a);const c=(0,d.a0)(r.font),{x:h,y:f,textAlign:m}=a;(0,d.Z)(t,s._pointLabels[n],h,f+c.lineHeight/2,c,{color:r.color,textAlign:m,textBaseline:"middle"})}}(this,r),n.display&&this.ticks.forEach((m,y)=>{if(0!==y||0===y&&this.min<0){h=this.getDistanceFromCenterForValue(m.value);const P=this.getContext(y),k=n.setContext(P),R=a.setContext(P);!function Ja(s,i,t,e,n){const a=s.ctx,r=i.circular,{color:c,lineWidth:h}=i;!r&&!e||!c||!h||t<0||(a.save(),a.strokeStyle=c,a.lineWidth=h,a.setLineDash(n.dash),a.lineDashOffset=n.dashOffset,a.beginPath(),ma(s,t,r,e),a.closePath(),a.stroke(),a.restore())}(this,k,h,r,R)}}),e.display){for(i.save(),c=r-1;c>=0;c--){const m=e.setContext(this.getPointLabelContext(c)),{color:y,lineWidth:P}=m;!P||!y||(i.lineWidth=P,i.strokeStyle=y,i.setLineDash(m.borderDash),i.lineDashOffset=m.borderDashOffset,h=this.getDistanceFromCenterForValue(t.ticks.reverse?this.min:this.max),f=this.getPointPosition(c,h),i.beginPath(),i.moveTo(this.xCenter,this.yCenter),i.lineTo(f.x,f.y),i.stroke())}i.restore()}}drawBorder(){}drawLabels(){const i=this.ctx,t=this.options,e=t.ticks;if(!e.display)return;const n=this.getIndexAngle(0);let a,r;i.save(),i.translate(this.xCenter,this.yCenter),i.rotate(n),i.textAlign="center",i.textBaseline="middle",this.ticks.forEach((c,h)=>{if(0===h&&this.min>=0&&!t.reverse)return;const f=e.setContext(this.getContext(h)),m=(0,d.a0)(f.font);if(a=this.getDistanceFromCenterForValue(this.ticks[h].value),f.showLabelBackdrop){i.font=m.string,r=i.measureText(c.label).width,i.fillStyle=f.backdropColor;const y=(0,d.E)(f.backdropPadding);i.fillRect(-r/2-y.left,-a-m.size/2-y.top,r+y.width,m.size+y.height)}(0,d.Z)(i,c.label,0,-a,m,{color:f.color,strokeColor:f.textStrokeColor,strokeWidth:f.textStrokeWidth})}),i.restore()}drawTitle(){}},TimeScale:ea,TimeSeriesScale:class no extends ea{static id="timeseries";static defaults=ea.defaults;constructor(i){super(i),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const i=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(i);this._minPos=hs(t,this.min),this._tableRange=hs(t,this.max)-this._minPos,super.initOffsets(i)}buildLookupTable(i){const{min:t,max:e}=this,n=[],a=[];let r,c,h,f,m;for(r=0,c=i.length;r<c;++r)f=i[r],f>=t&&f<=e&&n.push(f);if(n.length<2)return[{time:t,pos:0},{time:e,pos:1}];for(r=0,c=n.length;r<c;++r)m=n[r+1],h=n[r-1],f=n[r],Math.round((m+h)/2)!==f&&a.push({time:f,pos:r/(c-1)});return a}_generate(){const i=this.min,t=this.max;let e=super.getDataTimestamps();return(!e.includes(i)||!e.length)&&e.splice(0,0,i),(!e.includes(t)||1===e.length)&&e.push(t),e.sort((n,a)=>n-a)}_getTimestampsForTable(){let i=this._cache.all||[];if(i.length)return i;const t=this.getDataTimestamps(),e=this.getLabelTimestamps();return i=t.length&&e.length?this.normalize(t.concat(e)):t.length?t:e,i=this._cache.all=i,i}getDecimalForValue(i){return(hs(this._table,i)-this._minPos)/this._tableRange}getValueForPixel(i){const t=this._offsets,e=this.getDecimalForPixel(i)/t.factor-t.end;return hs(this._table,e*this._tableRange+this._minPos,!0)}}})]},141:(Ie,Ut,H)=>{function d(l){return l+.5|0}H.d(Ut,{$:()=>ki,A:()=>g,B:()=>tt,C:()=>Vi,D:()=>an,E:()=>ws,F:()=>Be,G:()=>Zn,H:()=>Vt,I:()=>Xi,J:()=>Ns,K:()=>zs,L:()=>ui,M:()=>Kn,N:()=>ge,O:()=>xi,P:()=>Ft,Q:()=>vi,R:()=>jn,S:()=>hi,T:()=>wt,U:()=>ci,V:()=>ln,W:()=>on,X:()=>Rn,Y:()=>Gi,Z:()=>Ps,_:()=>Bt,a:()=>ks,a0:()=>Hi,a1:()=>qe,a2:()=>Ai,a3:()=>Ni,a4:()=>Pe,a5:()=>K,a6:()=>En,a7:()=>ht,a8:()=>Si,a9:()=>un,aA:()=>yn,aB:()=>Bi,aC:()=>Gs,aD:()=>cn,aE:()=>je,aF:()=>Ue,aG:()=>en,aH:()=>Je,aI:()=>tn,aJ:()=>re,aK:()=>sn,aL:()=>On,aM:()=>It,aN:()=>ms,aO:()=>S,aP:()=>L,aa:()=>zn,ab:()=>C,ac:()=>bi,ad:()=>Ze,ae:()=>js,af:()=>Dn,ag:()=>yt,ah:()=>Pi,ai:()=>Lt,aj:()=>di,ak:()=>pi,al:()=>Fs,am:()=>Xs,an:()=>Hs,ao:()=>qn,ap:()=>ts,aq:()=>ii,ar:()=>ys,as:()=>Ln,at:()=>_s,au:()=>Fn,av:()=>hn,aw:()=>Cs,ax:()=>xn,ay:()=>Me,az:()=>Vs,b:()=>he,c:()=>ji,d:()=>$i,e:()=>De,f:()=>N,g:()=>Xe,h:()=>ut,i:()=>ie,j:()=>dn,k:()=>Ee,l:()=>z,m:()=>Ke,n:()=>Qe,o:()=>kn,p:()=>Ii,q:()=>Ci,r:()=>Qt,s:()=>ae,t:()=>nn,u:()=>et,v:()=>ne,w:()=>fi,x:()=>Li,y:()=>Rs,z:()=>As});const A=(l,u,p)=>Math.max(Math.min(l,p),u);function Z(l){return A(d(2.55*l),0,255)}function _t(l){return A(d(255*l),0,255)}function Pt(l){return A(d(l/2.55)/100,0,1)}function xt(l){return A(d(100*l),0,100)}const Mt={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},at=[..."0123456789ABCDEF"],st=l=>at[15&l],it=l=>at[(240&l)>>4]+at[15&l],lt=l=>(240&l)>>4==(15&l);const jt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function ee(l,u,p){const _=u*Math.min(p,1-p),b=(w,O=(w+l/30)%12)=>p-_*Math.max(Math.min(O-3,9-O,1),-1);return[b(0),b(8),b(4)]}function se(l,u,p){const _=(b,w=(b+l/60)%6)=>p-p*u*Math.max(Math.min(w,4-w,1),0);return[_(5),_(3),_(1)]}function Yt(l,u,p){const _=ee(l,1,.5);let b;for(u+p>1&&(b=1/(u+p),u*=b,p*=b),b=0;b<3;b++)_[b]*=1-u-p,_[b]+=u;return _}function Wt(l){const p=l.r/255,_=l.g/255,b=l.b/255,w=Math.max(p,_,b),O=Math.min(p,_,b),D=(w+O)/2;let B,$,Y;return w!==O&&(Y=w-O,$=D>.5?Y/(2-w-O):Y/(w+O),B=function Ct(l,u,p,_,b){return l===b?(u-p)/_+(u<p?6:0):u===b?(p-l)/_+2:(l-u)/_+4}(p,_,b,Y,w),B=60*B+.5),[0|B,$||0,D]}function J(l,u,p,_){return(Array.isArray(u)?l(u[0],u[1],u[2]):l(u,p,_)).map(_t)}function ot(l,u,p){return J(ee,l,u,p)}function oe(l){return(l%360+360)%360}const _e={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"},Ae={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 Ne;const ke=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,qt=l=>l<=.0031308?12.92*l:1.055*Math.pow(l,1/2.4)-.055,xe=l=>l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4);function Se(l,u,p){if(l){let _=Wt(l);_[u]=Math.max(0,Math.min(_[u]+_[u]*p,0===u?360:1)),_=ot(_),l.r=_[0],l.g=_[1],l.b=_[2]}}function Ye(l,u){return l&&Object.assign(u||{},l)}function ri(l){var u={r:0,g:0,b:0,a:255};return Array.isArray(l)?l.length>=3&&(u={r:l[0],g:l[1],b:l[2],a:255},l.length>3&&(u.a=_t(l[3]))):(u=Ye(l,{r:0,g:0,b:0,a:1})).a=_t(u.a),u}function li(l){return"r"===l.charAt(0)?function He(l){const u=ke.exec(l);let _,b,w,p=255;if(u){if(u[7]!==_){const O=+u[7];p=u[8]?Z(O):A(255*O,0,255)}return _=+u[1],b=+u[3],w=+u[5],_=255&(u[2]?Z(_):A(_,0,255)),b=255&(u[4]?Z(b):A(b,0,255)),w=255&(u[6]?Z(w):A(w,0,255)),{r:_,g:b,b:w,a:p}}}(l):function ce(l){const u=jt.exec(l);let _,p=255;if(!u)return;u[5]!==_&&(p=u[6]?Z(+u[5]):_t(+u[5]));const b=oe(+u[2]),w=+u[3]/100,O=+u[4]/100;return _="hwb"===u[1]?function ct(l,u,p){return J(Yt,l,u,p)}(b,w,O):"hsv"===u[1]?function kt(l,u,p){return J(se,l,u,p)}(b,w,O):ot(b,w,O),{r:_[0],g:_[1],b:_[2],a:p}}(l)}class Oe{constructor(u){if(u instanceof Oe)return u;const p=typeof u;let _;"object"===p?_=ri(u):"string"===p&&(_=function Ot(l){var p,u=l.length;return"#"===l[0]&&(4===u||5===u?p={r:255&17*Mt[l[1]],g:255&17*Mt[l[2]],b:255&17*Mt[l[3]],a:5===u?17*Mt[l[4]]:255}:(7===u||9===u)&&(p={r:Mt[l[1]]<<4|Mt[l[2]],g:Mt[l[3]]<<4|Mt[l[4]],b:Mt[l[5]]<<4|Mt[l[6]],a:9===u?Mt[l[7]]<<4|Mt[l[8]]:255})),p}(u)||function ai(l){Ne||(Ne=function si(){const l={},u=Object.keys(Ae),p=Object.keys(_e);let _,b,w,O,D;for(_=0;_<u.length;_++){for(O=D=u[_],b=0;b<p.length;b++)w=p[b],D=D.replace(w,_e[w]);w=parseInt(Ae[O],16),l[D]=[w>>16&255,w>>8&255,255&w]}return l}(),Ne.transparent=[0,0,0,0]);const u=Ne[l.toLowerCase()];return u&&{r:u[0],g:u[1],b:u[2],a:4===u.length?u[3]:255}}(u)||li(u)),this._rgb=_,this._valid=!!_}get valid(){return this._valid}get rgb(){var u=Ye(this._rgb);return u&&(u.a=Pt(u.a)),u}set rgb(u){this._rgb=ri(u)}rgbString(){return this._valid?function yi(l){return l&&(l.a<255?`rgba(${l.r}, ${l.g}, ${l.b}, ${Pt(l.a)})`:`rgb(${l.r}, ${l.g}, ${l.b})`)}(this._rgb):void 0}hexString(){return this._valid?function Gt(l){var u=(l=>lt(l.r)&<(l.g)&<(l.b)&<(l.a))(l)?st:it;return l?"#"+u(l.r)+u(l.g)+u(l.b)+((l,u)=>l<255?u(l):"")(l.a,u):void 0}(this._rgb):void 0}hslString(){return this._valid?function we(l){if(!l)return;const u=Wt(l),p=u[0],_=xt(u[1]),b=xt(u[2]);return l.a<255?`hsla(${p}, ${_}%, ${b}%, ${Pt(l.a)})`:`hsl(${p}, ${_}%, ${b}%)`}(this._rgb):void 0}mix(u,p){if(u){const _=this.rgb,b=u.rgb;let w;const O=p===w?.5:p,D=2*O-1,B=_.a-b.a,$=((D*B==-1?D:(D+B)/(1+D*B))+1)/2;w=1-$,_.r=255&$*_.r+w*b.r+.5,_.g=255&$*_.g+w*b.g+.5,_.b=255&$*_.b+w*b.b+.5,_.a=O*_.a+(1-O)*b.a,this.rgb=_}return this}interpolate(u,p){return u&&(this._rgb=function oi(l,u,p){const _=xe(Pt(l.r)),b=xe(Pt(l.g)),w=xe(Pt(l.b));return{r:_t(qt(_+p*(xe(Pt(u.r))-_))),g:_t(qt(b+p*(xe(Pt(u.g))-b))),b:_t(qt(w+p*(xe(Pt(u.b))-w))),a:l.a+p*(u.a-l.a)}}(this._rgb,u._rgb,p)),this}clone(){return new Oe(this.rgb)}alpha(u){return this._rgb.a=_t(u),this}clearer(u){return this._rgb.a*=1-u,this}greyscale(){const u=this._rgb,p=d(.3*u.r+.59*u.g+.11*u.b);return u.r=u.g=u.b=p,this}opaquer(u){return this._rgb.a*=1+u,this}negate(){const u=this._rgb;return u.r=255-u.r,u.g=255-u.g,u.b=255-u.b,this}lighten(u){return Se(this._rgb,2,u),this}darken(u){return Se(this._rgb,2,-u),this}saturate(u){return Se(this._rgb,1,u),this}desaturate(u){return Se(this._rgb,1,-u),this}rotate(u){return function Zt(l,u){var p=Wt(l);p[0]=oe(p[0]+u),p=ot(p),l.r=p[0],l.g=p[1],l.b=p[2]}(this._rgb,u),this}}function Ue(){}const bi=(()=>{let l=0;return()=>l++})();function Ee(l){return null===l||typeof l>"u"}function he(l){if(Array.isArray&&Array.isArray(l))return!0;const u=Object.prototype.toString.call(l);return"[object"===u.slice(0,7)&&"Array]"===u.slice(-6)}function ie(l){return null!==l&&"[object Object]"===Object.prototype.toString.call(l)}function Xe(l){return("number"==typeof l||l instanceof Number)&&isFinite(+l)}function xi(l,u){return Xe(l)?l:u}function ne(l,u){return typeof l>"u"?u:l}const Ke=(l,u)=>"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/u,Qe=(l,u)=>"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100*u:+l;function vi(l,u,p){if(l&&"function"==typeof l.call)return l.apply(p,u)}function Be(l,u,p,_){let b,w,O;if(he(l))if(w=l.length,_)for(b=w-1;b>=0;b--)u.call(p,l[b],b);else for(b=0;b<w;b++)u.call(p,l[b],b);else if(ie(l))for(O=Object.keys(l),w=O.length,b=0;b<w;b++)u.call(p,l[O[b]],O[b])}function Pi(l,u){let p,_,b,w;if(!l||!u||l.length!==u.length)return!1;for(p=0,_=l.length;p<_;++p)if(b=l[p],w=u[p],b.datasetIndex!==w.datasetIndex||b.index!==w.index)return!1;return!0}function Te(l){if(he(l))return l.map(Te);if(ie(l)){const u=Object.create(null),p=Object.keys(l),_=p.length;let b=0;for(;b<_;++b)u[p[b]]=Te(l[p[b]]);return u}return l}function ve(l){return-1===["__proto__","prototype","constructor"].indexOf(l)}function Mi(l,u,p,_){if(!ve(l))return;const b=u[l],w=p[l];ie(b)&&ie(w)?Pe(b,w,_):u[l]=Te(w)}function Pe(l,u,p){const _=he(u)?u:[u],b=_.length;if(!ie(l))return l;const w=(p=p||{}).merger||Mi;let O;for(let D=0;D<b;++D){if(O=_[D],!ie(O))continue;const B=Object.keys(O);for(let $=0,Y=B.length;$<Y;++$)w(B[$],l,O,p)}return l}function C(l,u){return Pe(l,u,{merger:T})}function T(l,u,p){if(!ve(l))return;const _=u[l],b=p[l];ie(_)&&ie(b)?C(_,b):Object.prototype.hasOwnProperty.call(u,l)||(u[l]=Te(b))}const M={"":l=>l,x:l=>l.x,y:l=>l.y};function N(l,u){return(M[u]||(M[u]=function F(l){const u=function E(l){const u=l.split("."),p=[];let _="";for(const b of u)_+=b,_.endsWith("\\")?_=_.slice(0,-1)+".":(p.push(_),_="");return p}(l);return p=>{for(const _ of u){if(""===_)break;p=p&&p[_]}return p}}(u)))(l)}function K(l){return l.charAt(0).toUpperCase()+l.slice(1)}const ut=l=>typeof l<"u",ht=l=>"function"==typeof l,yt=(l,u)=>{if(l.size!==u.size)return!1;for(const p of l)if(!u.has(p))return!1;return!0};function Lt(l){return"mouseup"===l.type||"click"===l.type||"contextmenu"===l.type}const Ft=Math.PI,wt=2*Ft,$t=wt+Ft,Tt=Number.POSITIVE_INFINITY,Xt=Ft/180,Vt=Ft/2,vt=Ft/4,Rt=2*Ft/3,It=Math.log10,ae=Math.sign;function re(l,u,p){return Math.abs(l-u)<p}function Je(l){const u=Math.round(l);l=re(l,u,l/1e3)?u:l;const p=Math.pow(10,Math.floor(It(l))),_=l/p;return(_<=1?1:_<=2?2:_<=5?5:10)*p}function ge(l){const u=[],p=Math.sqrt(l);let _;for(_=1;_<p;_++)l%_==0&&(u.push(_),u.push(l/_));return p===(0|p)&&u.push(p),u.sort((b,w)=>b-w).pop(),u}function Li(l){return!isNaN(parseFloat(l))&&isFinite(l)}function tn(l,u){const p=Math.round(l);return p-u<=l&&p+u>=l}function en(l,u,p){let _,b,w;for(_=0,b=l.length;_<b;_++)w=l[_][p],isNaN(w)||(u.min=Math.min(u.min,w),u.max=Math.max(u.max,w))}function nn(l){return l*(Ft/180)}function ci(l){return l*(180/Ft)}function sn(l){if(!Xe(l))return;let u=1,p=0;for(;Math.round(l*u)/u!==l;)u*=10,p++;return p}function an(l,u){const p=u.x-l.x,_=u.y-l.y,b=Math.sqrt(p*p+_*_);let w=Math.atan2(_,p);return w<-.5*Ft&&(w+=wt),{angle:w,distance:b}}function je(l,u){return Math.sqrt(Math.pow(u.x-l.x,2)+Math.pow(u.y-l.y,2))}function Fi(l,u){return(l-u+$t)%wt-Ft}function Me(l){return(l%wt+wt)%wt}function Ii(l,u,p,_){const b=Me(l),w=Me(u),O=Me(p),D=Me(w-b),B=Me(O-b),$=Me(b-w),Y=Me(b-O);return b===w||b===O||_&&w===O||D>B&&$<Y}function hi(l,u,p){return Math.max(u,Math.min(p,l))}function on(l){return hi(l,-32768,32767)}function di(l,u,p,_=1e-6){return l>=Math.min(u,p)-_&&l<=Math.max(u,p)+_}function L(l,u,p){p=p||(O=>l[O]<u);let w,_=l.length-1,b=0;for(;_-b>1;)w=b+_>>1,p(w)?b=w:_=w;return{lo:b,hi:_}}const tt=(l,u,p,_)=>L(l,p,_?b=>{const w=l[b][u];return w<p||w===p&&l[b+1][u]===p}:b=>l[b][u]<p),g=(l,u,p)=>L(l,p,_=>l[_][u]>=p);function S(l,u,p){let _=0,b=l.length;for(;_<b&&l[_]<u;)_++;for(;b>_&&l[b-1]>p;)b--;return _>0||b<l.length?l.slice(_,b):l}const x=["push","pop","shift","splice","unshift"];function z(l,u){l._chartjs?l._chartjs.listeners.push(u):(Object.defineProperty(l,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[u]}}),x.forEach(p=>{const _="_onData"+K(p),b=l[p];Object.defineProperty(l,p,{configurable:!0,enumerable:!1,value(...w){const O=b.apply(this,w);return l._chartjs.listeners.forEach(D=>{"function"==typeof D[_]&&D[_](...w)}),O}})}))}function et(l,u){const p=l._chartjs;if(!p)return;const _=p.listeners,b=_.indexOf(u);-1!==b&&_.splice(b,1),!(_.length>0)&&(x.forEach(w=>{delete l[w]}),delete l._chartjs)}function Bt(l){const u=new Set(l);return u.size===l.length?l:Array.from(u)}const Qt=typeof window>"u"?function(l){return l()}:window.requestAnimationFrame;function ui(l,u){let p=[],_=!1;return function(...b){p=b,_||(_=!0,Qt.call(window,()=>{_=!1,l.apply(u,p)}))}}function Ze(l,u){let p;return function(..._){return u?(clearTimeout(p),p=setTimeout(l,u,_)):l.apply(this,_),u}}const qe=l=>"start"===l?"left":"end"===l?"right":"center",Ai=(l,u,p)=>"start"===l?u:"end"===l?p:(u+p)/2,Bi=(l,u,p,_)=>l===(_?"left":"right")?p:"center"===l?(u+p)/2:u;function Ci(l,u,p){const _=u.length;let b=0,w=_;if(l._sorted){const{iScale:O,_parsed:D}=l,B=O.axis,{min:$,max:Y,minDefined:pt,maxDefined:gt}=O.getUserBounds();pt&&(b=hi(Math.min(tt(D,B,$).lo,p?_:tt(u,B,O.getPixelForValue($)).lo),0,_-1)),w=gt?hi(Math.max(tt(D,O.axis,Y,!0).hi+1,p?0:tt(u,B,O.getPixelForValue(Y),!0).hi+1),b,_)-b:_-b}return{start:b,count:w}}function fi(l){const{xScale:u,yScale:p,_scaleRanges:_}=l,b={xmin:u.min,xmax:u.max,ymin:p.min,ymax:p.max};if(!_)return l._scaleRanges=b,!0;const w=_.xmin!==u.min||_.xmax!==u.max||_.ymin!==p.min||_.ymax!==p.max;return Object.assign(_,b),w}const fe=l=>0===l||1===l,le=(l,u,p)=>-Math.pow(2,10*(l-=1))*Math.sin((l-u)*wt/p),zt=(l,u,p)=>Math.pow(2,-10*l)*Math.sin((l-u)*wt/p)+1,De={linear:l=>l,easeInQuad:l=>l*l,easeOutQuad:l=>-l*(l-2),easeInOutQuad:l=>(l/=.5)<1?.5*l*l:-.5*(--l*(l-2)-1),easeInCubic:l=>l*l*l,easeOutCubic:l=>(l-=1)*l*l+1,easeInOutCubic:l=>(l/=.5)<1?.5*l*l*l:.5*((l-=2)*l*l+2),easeInQuart:l=>l*l*l*l,easeOutQuart:l=>-((l-=1)*l*l*l-1),easeInOutQuart:l=>(l/=.5)<1?.5*l*l*l*l:-.5*((l-=2)*l*l*l-2),easeInQuint:l=>l*l*l*l*l,easeOutQuint:l=>(l-=1)*l*l*l*l+1,easeInOutQuint:l=>(l/=.5)<1?.5*l*l*l*l*l:.5*((l-=2)*l*l*l*l+2),easeInSine:l=>1-Math.cos(l*Vt),easeOutSine:l=>Math.sin(l*Vt),easeInOutSine:l=>-.5*(Math.cos(Ft*l)-1),easeInExpo:l=>0===l?0:Math.pow(2,10*(l-1)),easeOutExpo:l=>1===l?1:1-Math.pow(2,-10*l),easeInOutExpo:l=>fe(l)?l:l<.5?.5*Math.pow(2,10*(2*l-1)):.5*(2-Math.pow(2,-10*(2*l-1))),easeInCirc:l=>l>=1?l:-(Math.sqrt(1-l*l)-1),easeOutCirc:l=>Math.sqrt(1-(l-=1)*l),easeInOutCirc:l=>(l/=.5)<1?-.5*(Math.sqrt(1-l*l)-1):.5*(Math.sqrt(1-(l-=2)*l)+1),easeInElastic:l=>fe(l)?l:le(l,.075,.3),easeOutElastic:l=>fe(l)?l:zt(l,.075,.3),easeInOutElastic:l=>fe(l)?l:l<.5?.5*le(2*l,.1125,.45):.5+.5*zt(2*l-1,.1125,.45),easeInBack:l=>l*l*(2.70158*l-1.70158),easeOutBack:l=>(l-=1)*l*(2.70158*l+1.70158)+1,easeInOutBack(l){let u=1.70158;return(l/=.5)<1?l*l*((1+(u*=1.525))*l-u)*.5:.5*((l-=2)*l*((1+(u*=1.525))*l+u)+2)},easeInBounce:l=>1-De.easeOutBounce(1-l),easeOutBounce:l=>l<1/2.75?7.5625*l*l:l<2/2.75?7.5625*(l-=1.5/2.75)*l+.75:l<2.5/2.75?7.5625*(l-=2.25/2.75)*l+.9375:7.5625*(l-=2.625/2.75)*l+.984375,easeInOutBounce:l=>l<.5?.5*De.easeInBounce(2*l):.5*De.easeOutBounce(2*l-1)+.5};function Le(l){if(l&&"object"==typeof l){const u=l.toString();return"[object CanvasPattern]"===u||"[object CanvasGradient]"===u}return!1}function ji(l){return Le(l)?l:new Oe(l)}function me(l){return Le(l)?l:new Oe(l).saturate(.5).darken(.1).hexString()}const ti=["x","y","borderWidth","radius","tension"],rn=["color","borderColor","backgroundColor"],wn=new Map;function kn(l,u,p){return function Fe(l,u){u=u||{};const p=l+JSON.stringify(u);let _=wn.get(p);return _||(_=new Intl.NumberFormat(l,u),wn.set(p,_)),_}(u,p).format(l)}const Sn={values:l=>he(l)?l:""+l,numeric(l,u,p){if(0===l)return"0";const _=this.chart.options.locale;let b,w=l;if(p.length>1){const $=Math.max(Math.abs(p[0].value),Math.abs(p[p.length-1].value));($<1e-4||$>1e15)&&(b="scientific"),w=function fs(l,u){let p=u.length>3?u[2].value-u[1].value:u[1].value-u[0].value;return Math.abs(p)>=1&&l!==Math.floor(l)&&(p=l-Math.floor(l)),p}(l,p)}const O=It(Math.abs(w)),D=isNaN(O)?1:Math.max(Math.min(-1*Math.floor(O),20),0),B={notation:b,minimumFractionDigits:D,maximumFractionDigits:D};return Object.assign(B,this.options.ticks.format),kn(l,_,B)},logarithmic(l,u,p){if(0===l)return"0";const _=p[u].significand||l/Math.pow(10,Math.floor(It(l)));return[1,2,3,5,10,15].includes(_)||u>.8*p.length?Sn.numeric.call(this,l,u,p):""}};var On={formatters:Sn};const Ni=Object.create(null),En=Object.create(null);function wi(l,u){if(!u)return l;const p=u.split(".");for(let _=0,b=p.length;_<b;++_){const w=p[_];l=l[w]||(l[w]=Object.create(null))}return l}function Wi(l,u,p){return"string"==typeof u?Pe(wi(l,u),p):Pe(wi(l,""),u)}class gs{constructor(u,p){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=_=>_.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=(_,b)=>me(b.backgroundColor),this.hoverBorderColor=(_,b)=>me(b.borderColor),this.hoverColor=(_,b)=>me(b.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(u),this.apply(p)}set(u,p){return Wi(this,u,p)}get(u){return wi(this,u)}describe(u,p){return Wi(En,u,p)}override(u,p){return Wi(Ni,u,p)}route(u,p,_,b){const w=wi(this,u),O=wi(this,_),D="_"+p;Object.defineProperties(w,{[D]:{value:w[p],writable:!0},[p]:{enumerable:!0,get(){const B=this[D],$=O[b];return ie(B)?Object.assign({},$,B):ne(B,$)},set(B){this[D]=B}}})}apply(u){u.forEach(p=>p(this))}}var $i=new gs({_scriptable:l=>!l.startsWith("on"),_indexable:l=>"events"!==l,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function zi(l){l.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),l.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:u=>"onProgress"!==u&&"onComplete"!==u&&"fn"!==u}),l.set("animations",{colors:{type:"color",properties:rn},numbers:{type:"number",properties:ti}}),l.describe("animations",{_fallback:"animation"}),l.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:u=>0|u}}}})},function us(l){l.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function ps(l){l.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:(u,p)=>p.lineWidth,tickColor:(u,p)=>p.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:On.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),l.route("scale.ticks","color","","color"),l.route("scale.grid","color","","borderColor"),l.route("scale.border","color","","borderColor"),l.route("scale.title","color","","color"),l.describe("scale",{_fallback:!1,_scriptable:u=>!u.startsWith("before")&&!u.startsWith("after")&&"callback"!==u&&"parser"!==u,_indexable:u=>"borderDash"!==u&&"tickBorderDash"!==u&&"dash"!==u}),l.describe("scales",{_fallback:"scale"}),l.describe("scale.ticks",{_scriptable:u=>"backdropPadding"!==u&&"callback"!==u,_indexable:u=>"backdropPadding"!==u})}]);function ln(l,u,p,_,b){let w=u[b];return w||(w=u[b]=l.measureText(b).width,p.push(b)),w>_&&(_=w),_}function ms(l,u,p,_){let b=(_=_||{}).data=_.data||{},w=_.garbageCollect=_.garbageCollect||[];_.font!==u&&(b=_.data={},w=_.garbageCollect=[],_.font=u),l.save(),l.font=u;let O=0;const D=p.length;let B,$,Y,pt,gt;for(B=0;B<D;B++)if(pt=p[B],null==pt||he(pt)){if(he(pt))for($=0,Y=pt.length;$<Y;$++)gt=pt[$],null!=gt&&!he(gt)&&(O=ln(l,b,w,O,gt))}else O=ln(l,b,w,O,pt);l.restore();const Nt=w.length/2;if(Nt>p.length){for(B=0;B<Nt;B++)delete b[w[B]];w.splice(0,Nt)}return O}function Rn(l,u,p){const _=l.currentDevicePixelRatio,b=0!==p?Math.max(p/2,.5):0;return Math.round((u-b)*_)/_+b}function Dn(l,u){!u&&!l||((u=u||l.getContext("2d")).save(),u.resetTransform(),u.clearRect(0,0,l.width,l.height),u.restore())}function _s(l,u,p,_){cn(l,u,p,_,null)}function cn(l,u,p,_,b){let w,O,D,B,$,Y,pt,gt;const Nt=u.pointStyle,Jt=u.rotation,bt=u.radius;let dt=(Jt||0)*Xt;if(Nt&&"object"==typeof Nt&&(w=Nt.toString(),"[object HTMLImageElement]"===w||"[object HTMLCanvasElement]"===w))return l.save(),l.translate(p,_),l.rotate(dt),l.drawImage(Nt,-Nt.width/2,-Nt.height/2,Nt.width,Nt.height),void l.restore();if(!(isNaN(bt)||bt<=0)){switch(l.beginPath(),Nt){default:b?l.ellipse(p,_,b/2,bt,0,0,wt):l.arc(p,_,bt,0,wt),l.closePath();break;case"triangle":Y=b?b/2:bt,l.moveTo(p+Math.sin(dt)*Y,_-Math.cos(dt)*bt),dt+=Rt,l.lineTo(p+Math.sin(dt)*Y,_-Math.cos(dt)*bt),dt+=Rt,l.lineTo(p+Math.sin(dt)*Y,_-Math.cos(dt)*bt),l.closePath();break;case"rectRounded":$=.516*bt,B=bt-$,O=Math.cos(dt+vt)*B,pt=Math.cos(dt+vt)*(b?b/2-$:B),D=Math.sin(dt+vt)*B,gt=Math.sin(dt+vt)*(b?b/2-$:B),l.arc(p-pt,_-D,$,dt-Ft,dt-Vt),l.arc(p+gt,_-O,$,dt-Vt,dt),l.arc(p+pt,_+D,$,dt,dt+Vt),l.arc(p-gt,_+O,$,dt+Vt,dt+Ft),l.closePath();break;case"rect":if(!Jt){B=Math.SQRT1_2*bt,Y=b?b/2:B,l.rect(p-Y,_-B,2*Y,2*B);break}dt+=vt;case"rectRot":pt=Math.cos(dt)*(b?b/2:bt),O=Math.cos(dt)*bt,D=Math.sin(dt)*bt,gt=Math.sin(dt)*(b?b/2:bt),l.moveTo(p-pt,_-D),l.lineTo(p+gt,_-O),l.lineTo(p+pt,_+D),l.lineTo(p-gt,_+O),l.closePath();break;case"crossRot":dt+=vt;case"cross":pt=Math.cos(dt)*(b?b/2:bt),O=Math.cos(dt)*bt,D=Math.sin(dt)*bt,gt=Math.sin(dt)*(b?b/2:bt),l.moveTo(p-pt,_-D),l.lineTo(p+pt,_+D),l.moveTo(p+gt,_-O),l.lineTo(p-gt,_+O);break;case"star":pt=Math.cos(dt)*(b?b/2:bt),O=Math.cos(dt)*bt,D=Math.sin(dt)*bt,gt=Math.sin(dt)*(b?b/2:bt),l.moveTo(p-pt,_-D),l.lineTo(p+pt,_+D),l.moveTo(p+gt,_-O),l.lineTo(p-gt,_+O),dt+=vt,pt=Math.cos(dt)*(b?b/2:bt),O=Math.cos(dt)*bt,D=Math.sin(dt)*bt,gt=Math.sin(dt)*(b?b/2:bt),l.moveTo(p-pt,_-D),l.lineTo(p+pt,_+D),l.moveTo(p+gt,_-O),l.lineTo(p-gt,_+O);break;case"line":O=b?b/2:Math.cos(dt)*bt,D=Math.sin(dt)*bt,l.moveTo(p-O,_-D),l.lineTo(p+O,_+D);break;case"dash":l.moveTo(p,_),l.lineTo(p+Math.cos(dt)*(b?b/2:bt),_+Math.sin(dt)*bt);break;case!1:l.closePath()}l.fill(),u.borderWidth>0&&l.stroke()}}function Vi(l,u,p){return p=p||.5,!u||l&&l.x>u.left-p&&l.x<u.right+p&&l.y>u.top-p&&l.y<u.bottom+p}function Gi(l,u){l.save(),l.beginPath(),l.rect(u.left,u.top,u.right-u.left,u.bottom-u.top),l.clip()}function ki(l){l.restore()}function ys(l,u,p,_,b){if(!u)return l.lineTo(p.x,p.y);if("middle"===b){const w=(u.x+p.x)/2;l.lineTo(w,u.y),l.lineTo(w,p.y)}else"after"===b!=!!_?l.lineTo(u.x,p.y):l.lineTo(p.x,u.y);l.lineTo(p.x,p.y)}function Ln(l,u,p,_){if(!u)return l.lineTo(p.x,p.y);l.bezierCurveTo(_?u.cp1x:u.cp2x,_?u.cp1y:u.cp2y,_?p.cp2x:p.cp1x,_?p.cp2y:p.cp1y,p.x,p.y)}function xs(l,u,p,_,b){if(b.strikethrough||b.underline){const w=l.measureText(_),O=u-w.actualBoundingBoxLeft,D=u+w.actualBoundingBoxRight,$=p+w.actualBoundingBoxDescent,Y=b.strikethrough?(p-w.actualBoundingBoxAscent+$)/2:$;l.strokeStyle=l.fillStyle,l.beginPath(),l.lineWidth=b.decorationWidth||2,l.moveTo(O,Y),l.lineTo(D,Y),l.stroke()}}function vs(l,u){const p=l.fillStyle;l.fillStyle=u.color,l.fillRect(u.left,u.top,u.width,u.height),l.fillStyle=p}function Ps(l,u,p,_,b,w={}){const O=he(u)?u:[u],D=w.strokeWidth>0&&""!==w.strokeColor;let B,$;for(l.save(),l.font=b.string,function bs(l,u){u.translation&&l.translate(u.translation[0],u.translation[1]),Ee(u.rotation)||l.rotate(u.rotation),u.color&&(l.fillStyle=u.color),u.textAlign&&(l.textAlign=u.textAlign),u.textBaseline&&(l.textBaseline=u.textBaseline)}(l,w),B=0;B<O.length;++B)$=O[B],w.backdrop&&vs(l,w.backdrop),D&&(w.strokeColor&&(l.strokeStyle=w.strokeColor),Ee(w.strokeWidth)||(l.lineWidth=w.strokeWidth),l.strokeText($,p,_,w.maxWidth)),l.fillText($,p,_,w.maxWidth),xs(l,p,_,$,w),_+=Number(b.lineHeight);l.restore()}function Fn(l,u){const{x:p,y:_,w:b,h:w,radius:O}=u;l.arc(p+O.topLeft,_+O.topLeft,O.topLeft,1.5*Ft,Ft,!0),l.lineTo(p,_+w-O.bottomLeft),l.arc(p+O.bottomLeft,_+w-O.bottomLeft,O.bottomLeft,Ft,Vt,!0),l.lineTo(p+b-O.bottomRight,_+w),l.arc(p+b-O.bottomRight,_+w-O.bottomRight,O.bottomRight,Vt,0,!0),l.lineTo(p+b,_+O.topRight),l.arc(p+b-O.topRight,_+O.topRight,O.topRight,0,-Vt,!0),l.lineTo(p+O.topLeft,_)}const In=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,An=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Ms(l,u){const p=(""+l).match(In);if(!p||"normal"===p[1])return 1.2*u;switch(l=+p[2],p[3]){case"px":return l;case"%":l/=100}return u*l}const Bn=l=>+l||0;function pi(l,u){const p={},_=ie(u),b=_?Object.keys(u):u,w=ie(l)?_?O=>ne(l[O],l[u[O]]):O=>l[O]:()=>l;for(const O of b)p[O]=Bn(w(O));return p}function hn(l){return pi(l,{top:"y",right:"x",bottom:"y",left:"x"})}function Cs(l){return pi(l,["topLeft","topRight","bottomLeft","bottomRight"])}function ws(l){const u=hn(l);return u.width=u.left+u.right,u.height=u.top+u.bottom,u}function Hi(l,u){let p=ne((l=l||{}).size,(u=u||$i.font).size);"string"==typeof p&&(p=parseInt(p,10));let _=ne(l.style,u.style);_&&!(""+_).match(An)&&(console.warn('Invalid font style specified: "'+_+'"'),_=void 0);const b={family:ne(l.family,u.family),lineHeight:Ms(ne(l.lineHeight,u.lineHeight),p),size:p,style:_,weight:ne(l.weight,u.weight),string:""};return b.string=function Tn(l){return!l||Ee(l.size)||Ee(l.family)?null:(l.style?l.style+" ":"")+(l.weight?l.weight+" ":"")+l.size+"px "+l.family}(b),b}function ks(l,u,p,_){let w,O,D,b=!0;for(w=0,O=l.length;w<O;++w)if(D=l[w],void 0!==D&&(void 0!==u&&"function"==typeof D&&(D=D(u),b=!1),void 0!==p&&he(D)&&(D=D[p%D.length],b=!1),void 0!==D))return _&&!b&&(_.cacheable=!1),D}function jn(l,u,p){const{min:_,max:b}=l,w=Qe(u,(b-_)/2),O=(D,B)=>p&&0===D?0:D+B;return{min:O(_,-Math.abs(w)),max:O(b,w)}}function dn(l,u){return Object.assign(Object.create(l),u)}function un(l,u=[""],p,_,b=(()=>l[0])){const w=p||l;typeof _>"u"&&(_=Yn("_fallback",l));const O={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:l,_rootScopes:w,_fallback:_,_getTarget:b,override:D=>un([D,...l],u,w,_)};return new Proxy(O,{deleteProperty:(D,B)=>(delete D[B],delete D._keys,delete l[0][B],!0),get:(D,B)=>Nn(D,B,()=>function Es(l,u,p,_){let b;for(const w of u)if(b=Yn(gi(w,l),p),typeof b<"u")return mi(l,b)?fn(p,_,l,b):b}(B,u,l,D)),getOwnPropertyDescriptor:(D,B)=>Reflect.getOwnPropertyDescriptor(D._scopes[0],B),getPrototypeOf:()=>Reflect.getPrototypeOf(l[0]),has:(D,B)=>Un(D).includes(B),ownKeys:D=>Un(D),set(D,B,$){const Y=D._storage||(D._storage=b());return D[B]=Y[B]=$,delete D._keys,!0}})}function Si(l,u,p,_){const b={_cacheable:!1,_proxy:l,_context:u,_subProxy:p,_stack:new Set,_descriptors:zn(l,_),setContext:w=>Si(l,w,p,_),override:w=>Si(l.override(w),u,p,_)};return new Proxy(b,{deleteProperty:(w,O)=>(delete w[O],delete l[O],!0),get:(w,O,D)=>Nn(w,O,()=>function Ss(l,u,p){const{_proxy:_,_context:b,_subProxy:w,_descriptors:O}=l;let D=_[u];return ht(D)&&O.isScriptable(u)&&(D=function Wn(l,u,p,_){const{_proxy:b,_context:w,_subProxy:O,_stack:D}=p;if(D.has(l))throw new Error("Recursion detected: "+Array.from(D).join("->")+"->"+l);D.add(l);let B=u(w,O||_);return D.delete(l),mi(l,B)&&(B=fn(b._scopes,b,l,B)),B}(u,D,l,p)),he(D)&&D.length&&(D=function $n(l,u,p,_){const{_proxy:b,_context:w,_subProxy:O,_descriptors:D}=p;if(typeof w.index<"u"&&_(l))return u[w.index%u.length];if(ie(u[0])){const B=u,$=b._scopes.filter(Y=>Y!==B);u=[];for(const Y of B){const pt=fn($,b,l,Y);u.push(Si(pt,w,O&&O[l],D))}}return u}(u,D,l,O.isIndexable)),mi(u,D)&&(D=Si(D,b,w&&w[u],O)),D}(w,O,D)),getOwnPropertyDescriptor:(w,O)=>w._descriptors.allKeys?Reflect.has(l,O)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(l,O),getPrototypeOf:()=>Reflect.getPrototypeOf(l),has:(w,O)=>Reflect.has(l,O),ownKeys:()=>Reflect.ownKeys(l),set:(w,O,D)=>(l[O]=D,delete w[O],!0)})}function zn(l,u={scriptable:!0,indexable:!0}){const{_scriptable:p=u.scriptable,_indexable:_=u.indexable,_allKeys:b=u.allKeys}=l;return{allKeys:b,scriptable:p,indexable:_,isScriptable:ht(p)?p:()=>p,isIndexable:ht(_)?_:()=>_}}const gi=(l,u)=>l?l+K(u):u,mi=(l,u)=>ie(u)&&"adapters"!==l&&(null===Object.getPrototypeOf(u)||u.constructor===Object);function Nn(l,u,p){if(Object.prototype.hasOwnProperty.call(l,u)||"constructor"===u)return l[u];const _=p();return l[u]=_,_}function Vn(l,u,p){return ht(l)?l(u,p):l}const Os=(l,u)=>!0===l?u:"string"==typeof l?N(u,l):void 0;function Gn(l,u,p,_,b){for(const w of u){const O=Os(p,w);if(O){l.add(O);const D=Vn(O._fallback,p,b);if(typeof D<"u"&&D!==p&&D!==_)return D}else if(!1===O&&typeof _<"u"&&p!==_)return null}return!1}function fn(l,u,p,_){const b=u._rootScopes,w=Vn(u._fallback,p,_),O=[...l,...b],D=new Set;D.add(_);let B=Hn(D,O,p,w||p,_);return!(null===B||typeof w<"u"&&w!==p&&(B=Hn(D,O,w,B,_),null===B))&&un(Array.from(D),[""],b,w,()=>function pn(l,u,p){const _=l._getTarget();u in _||(_[u]={});const b=_[u];return he(b)&&ie(p)?p:b||{}}(u,p,_))}function Hn(l,u,p,_,b){for(;p;)p=Gn(l,u,p,_,b);return p}function Yn(l,u){for(const p of u){if(!p)continue;const _=p[l];if(typeof _<"u")return _}}function Un(l){let u=l._keys;return u||(u=l._keys=function Ts(l){const u=new Set;for(const p of l)for(const _ of Object.keys(p).filter(b=>!b.startsWith("_")))u.add(_);return Array.from(u)}(l._scopes)),u}function Rs(l,u,p,_){const{iScale:b}=l,{key:w="r"}=this._parsing,O=new Array(_);let D,B,$,Y;for(D=0,B=_;D<B;++D)$=D+p,Y=u[$],O[D]={r:b.parse(N(Y,w),$)};return O}const Yi=Number.EPSILON||1e-14,ei=(l,u)=>u<l.length&&!l[u].skip&&l[u],gn=l=>"x"===l?"y":"x";function Xn(l,u,p,_){const b=l.skip?u:l,w=u,O=p.skip?u:p,D=je(w,b),B=je(O,w);let $=D/(D+B),Y=B/(D+B);$=isNaN($)?0:$,Y=isNaN(Y)?0:Y;const pt=_*$,gt=_*Y;return{previous:{x:w.x-pt*(O.x-b.x),y:w.y-pt*(O.y-b.y)},next:{x:w.x+gt*(O.x-b.x),y:w.y+gt*(O.y-b.y)}}}function Ui(l,u,p){return Math.max(Math.min(l,p),u)}function Fs(l,u,p,_,b){let w,O,D,B;if(u.spanGaps&&(l=l.filter($=>!$.skip)),"monotone"===u.cubicInterpolationMode)!function Ls(l,u="x"){const p=gn(u),_=l.length,b=Array(_).fill(0),w=Array(_);let O,D,B,$=ei(l,0);for(O=0;O<_;++O)if(D=B,B=$,$=ei(l,O+1),B){if($){const Y=$[u]-B[u];b[O]=0!==Y?($[p]-B[p])/Y:0}w[O]=D?$?ae(b[O-1])!==ae(b[O])?0:(b[O-1]+b[O])/2:b[O-1]:b[O]}(function We(l,u,p){const _=l.length;let b,w,O,D,B,$=ei(l,0);for(let Y=0;Y<_-1;++Y)if(B=$,$=ei(l,Y+1),B&&$){if(re(u[Y],0,Yi)){p[Y]=p[Y+1]=0;continue}b=p[Y]/u[Y],w=p[Y+1]/u[Y],D=Math.pow(b,2)+Math.pow(w,2),!(D<=9)&&(O=3/Math.sqrt(D),p[Y]=b*O*u[Y],p[Y+1]=w*O*u[Y])}})(l,b,w),function Ds(l,u,p="x"){const _=gn(p),b=l.length;let w,O,D,B=ei(l,0);for(let $=0;$<b;++$){if(O=D,D=B,B=ei(l,$+1),!D)continue;const Y=D[p],pt=D[_];O&&(w=(Y-O[p])/3,D[`cp1${p}`]=Y-w,D[`cp1${_}`]=pt-w*u[$]),B&&(w=(B[p]-Y)/3,D[`cp2${p}`]=Y+w,D[`cp2${_}`]=pt+w*u[$])}}(l,w,u)}(l,b);else{let $=_?l[l.length-1]:l[0];for(w=0,O=l.length;w<O;++w)D=l[w],B=Xn($,D,l[Math.min(w+1,O-(_?0:1))%O],u.tension),D.cp1x=B.previous.x,D.cp1y=B.previous.y,D.cp2x=B.next.x,D.cp2y=B.next.y,$=D}u.capBezierPoints&&function mn(l,u){let p,_,b,w,O,D=Vi(l[0],u);for(p=0,_=l.length;p<_;++p)O=w,w=D,D=p<_-1&&Vi(l[p+1],u),w&&(b=l[p],O&&(b.cp1x=Ui(b.cp1x,u.left,u.right),b.cp1y=Ui(b.cp1y,u.top,u.bottom)),D&&(b.cp2x=Ui(b.cp2x,u.left,u.right),b.cp2y=Ui(b.cp2y,u.top,u.bottom)))}(l,p)}function Kn(){return typeof window<"u"&&typeof document<"u"}function Xi(l){let u=l.parentNode;return u&&"[object ShadowRoot]"===u.toString()&&(u=u.host),u}function Oi(l,u,p){let _;return"string"==typeof l?(_=parseInt(l,10),-1!==l.indexOf("%")&&(_=_/100*u.parentNode[p])):_=l,_}const Ki=l=>l.ownerDocument.defaultView.getComputedStyle(l,null),Qn=["top","right","bottom","left"];function $e(l,u,p){const _={};p=p?"-"+p:"";for(let b=0;b<4;b++){const w=Qn[b];_[w]=parseFloat(l[u+"-"+w+p])||0}return _.width=_.left+_.right,_.height=_.top+_.bottom,_}const Jn=(l,u,p)=>(l>0||u>0)&&(!p||!p.shadowRoot);function As(l,u){if("native"in l)return l;const{canvas:p,currentDevicePixelRatio:_}=u,b=Ki(p),w="border-box"===b.boxSizing,O=$e(b,"padding"),D=$e(b,"border","width"),{x:B,y:$,box:Y}=function Is(l,u){const p=l.touches,_=p&&p.length?p[0]:l,{offsetX:b,offsetY:w}=_;let D,B,O=!1;if(Jn(b,w,l.target))D=b,B=w;else{const $=u.getBoundingClientRect();D=_.clientX-$.left,B=_.clientY-$.top,O=!0}return{x:D,y:B,box:O}}(l,p),pt=O.left+(Y&&D.left),gt=O.top+(Y&&D.top);let{width:Nt,height:Jt}=u;return w&&(Nt-=O.width+D.width,Jt-=O.height+D.height),{x:Math.round((B-pt)/Nt*p.width/_),y:Math.round(($-gt)/Jt*p.height/_)}}const Qi=l=>Math.round(10*l)/10;function Zn(l,u,p,_){const b=Ki(l),w=$e(b,"margin"),O=Oi(b.maxWidth,l,"clientWidth")||Tt,D=Oi(b.maxHeight,l,"clientHeight")||Tt,B=function Bs(l,u,p){let _,b;if(void 0===u||void 0===p){const w=l&&Xi(l);if(w){const O=w.getBoundingClientRect(),D=Ki(w),B=$e(D,"border","width"),$=$e(D,"padding");u=O.width-$.width-B.width,p=O.height-$.height-B.height,_=Oi(D.maxWidth,w,"clientWidth"),b=Oi(D.maxHeight,w,"clientHeight")}else u=l.clientWidth,p=l.clientHeight}return{width:u,height:p,maxWidth:_||Tt,maxHeight:b||Tt}}(l,u,p);let{width:$,height:Y}=B;if("content-box"===b.boxSizing){const gt=$e(b,"border","width"),Nt=$e(b,"padding");$-=Nt.width+gt.width,Y-=Nt.height+gt.height}return $=Math.max(0,$-w.width),Y=Math.max(0,_?$/_:Y-w.height),$=Qi(Math.min($,O,B.maxWidth)),Y=Qi(Math.min(Y,D,B.maxHeight)),$&&!Y&&(Y=Qi($/2)),(void 0!==u||void 0!==p)&&_&&B.height&&Y>B.height&&(Y=B.height,$=Qi(Math.floor(Y*_))),{width:$,height:Y}}function js(l,u,p){const _=u||1,b=Math.floor(l.height*_),w=Math.floor(l.width*_);l.height=Math.floor(l.height),l.width=Math.floor(l.width);const O=l.canvas;return O.style&&(p||!O.style.height&&!O.style.width)&&(O.style.height=`${l.height}px`,O.style.width=`${l.width}px`),(l.currentDevicePixelRatio!==_||O.height!==b||O.width!==w)&&(l.currentDevicePixelRatio=_,O.height=b,O.width=w,l.ctx.setTransform(_,0,0,_,0,0),!0)}const zs=function(){let l=!1;try{const u={get passive(){return l=!0,!1}};Kn()&&(window.addEventListener("test",null,u),window.removeEventListener("test",null,u))}catch{}return l}();function Ns(l,u){const p=function _n(l,u){return Ki(l).getPropertyValue(u)}(l,u),_=p&&p.match(/^(\d+)(\.\d+)?px$/);return _?+_[1]:void 0}function ii(l,u,p,_){return{x:l.x+p*(u.x-l.x),y:l.y+p*(u.y-l.y)}}function qn(l,u,p,_){return{x:l.x+p*(u.x-l.x),y:"middle"===_?p<.5?l.y:u.y:"after"===_?p<1?l.y:u.y:p>0?u.y:l.y}}function ts(l,u,p,_){const b={x:l.cp2x,y:l.cp2y},w={x:u.cp1x,y:u.cp1y},O=ii(l,b,p),D=ii(b,w,p),B=ii(w,u,p),$=ii(O,D,p),Y=ii(D,B,p);return ii($,Y,p)}const Ws=function(l,u){return{x:p=>l+l+u-p,setWidth(p){u=p},textAlign:p=>"center"===p?p:"right"===p?"left":"right",xPlus:(p,_)=>p-_,leftForLtr:(p,_)=>p-_}},$s=function(){return{x:l=>l,setWidth(l){},textAlign:l=>l,xPlus:(l,u)=>l+u,leftForLtr:(l,u)=>l}};function Vs(l,u,p){return l?Ws(u,p):$s()}function yn(l,u){let p,_;("ltr"===u||"rtl"===u)&&(p=l.canvas.style,_=[p.getPropertyValue("direction"),p.getPropertyPriority("direction")],p.setProperty("direction",u,"important"),l.prevTextDirection=_)}function Gs(l,u){void 0!==u&&(delete l.prevTextDirection,l.canvas.style.setProperty("direction",u[0],u[1]))}function Ji(l){return"angle"===l?{between:Ii,compare:Fi,normalize:Me}:{between:di,compare:(u,p)=>u-p,normalize:u=>u}}function bn({start:l,end:u,count:p,loop:_,style:b}){return{start:l%p,end:u%p,loop:_&&(u-l+1)%p==0,style:b}}function xn(l,u,p){if(!p)return[l];const{property:_,start:b,end:w}=p,O=u.length,{compare:D,between:B,normalize:$}=Ji(_),{start:Y,end:pt,loop:gt,style:Nt}=function es(l,u,p){const{property:_,start:b,end:w}=p,{between:O,normalize:D}=Ji(_),B=u.length;let gt,Nt,{start:$,end:Y,loop:pt}=l;if(pt){for($+=B,Y+=B,gt=0,Nt=B;gt<Nt&&O(D(u[$%B][_]),b,w);++gt)$--,Y--;$%=B,Y%=B}return Y<$&&(Y+=B),{start:$,end:Y,loop:pt,style:l.style}}(l,u,p),Jt=[];let de,_i,Ei,bt=!1,dt=null;for(let Ve=Y,as=Y;Ve<=pt;++Ve)_i=u[Ve%O],!_i.skip&&(de=$(_i[_]),de!==Ei&&(bt=B(de,b,w),null===dt&&(bt||B(b,Ei,de)&&0!==D(b,Ei))&&(dt=0===D(de,b)?Ve:as),null!==dt&&(!bt||0===D(w,de)||B(w,Ei,de))&&(Jt.push(bn({start:dt,end:Ve,loop:gt,count:O,style:Nt})),dt=null),as=Ve,Ei=de));return null!==dt&&Jt.push(bn({start:dt,end:pt,loop:gt,count:O,style:Nt})),Jt}function Hs(l,u){const p=[],_=l.segments;for(let b=0;b<_.length;b++){const w=xn(_[b],l.points,u);w.length&&p.push(...w)}return p}function Xs(l,u){const p=l.points,_=l.options.spanGaps,b=p.length;if(!b)return[];const w=!!l._loop,{start:O,end:D}=function Ys(l,u,p,_){let b=0,w=u-1;if(p&&!_)for(;b<u&&!l[b].skip;)b++;for(;b<u&&l[b].skip;)b++;for(b%=u,p&&(w+=b);w>b&&l[w%u].skip;)w--;return w%=u,{start:b,end:w}}(p,b,w,_);return is(l,!0===_?[{start:O,end:D,loop:w}]:function Us(l,u,p,_){const b=l.length,w=[];let B,O=u,D=l[u];for(B=u+1;B<=p;++B){const $=l[B%b];$.skip||$.stop?D.skip||(w.push({start:u%b,end:(B-1)%b,loop:_=!1}),u=O=$.stop?B:null):(O=B,D.skip&&(u=B)),D=$}return null!==O&&w.push({start:u%b,end:O%b,loop:_}),w}(p,O,D<O?D+b:D,!!l._fullLoop&&0===O&&D===b-1),p,u)}function is(l,u,p,_){return _&&_.setContext&&p?function Ks(l,u,p,_){const b=l._chart.getContext(),w=ns(l.options),{_datasetIndex:O,options:{spanGaps:D}}=l,B=p.length,$=[];let Y=w,pt=u[0].start,gt=pt;function Nt(Jt,bt,dt,de){const _i=D?-1:1;if(Jt!==bt){for(Jt+=B;p[Jt%B].skip;)Jt-=_i;for(;p[bt%B].skip;)bt+=_i;Jt%B!=bt%B&&($.push({start:Jt%B,end:bt%B,loop:dt,style:de}),Y=de,pt=bt%B)}}for(const Jt of u){pt=D?pt:Jt.start;let dt,bt=p[pt%B];for(gt=pt+1;gt<=Jt.end;gt++){const de=p[gt%B];dt=ns(_.setContext(dn(b,{type:"segment",p0:bt,p1:de,p0DataIndex:(gt-1)%B,p1DataIndex:gt%B,datasetIndex:O}))),Qs(dt,Y)&&Nt(pt,gt-1,Jt.loop,Y),bt=de,Y=dt}pt<gt-1&&Nt(pt,gt-1,Jt.loop,Y)}return $}(l,u,p,_):u}function ns(l){return{backgroundColor:l.backgroundColor,borderCapStyle:l.borderCapStyle,borderDash:l.borderDash,borderDashOffset:l.borderDashOffset,borderJoinStyle:l.borderJoinStyle,borderWidth:l.borderWidth,borderColor:l.borderColor}}function Qs(l,u){if(!u)return!1;const p=[],_=function(b,w){return Le(w)?(p.includes(w)||p.push(w),p.indexOf(w)):w};return JSON.stringify(l,_)!==JSON.stringify(u,_)}}}]);