const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/peerShareLinkModal-QPXBoQ7C.js","assets/index-CGY_8-KO.js","assets/index-D2ns9qRW.css","assets/dayjs.min-BZb_e7nw.js","assets/vue-datepicker-BIlY3Ss2.js","assets/localeText-FmUupiXC.js","assets/peerJobs-DVgoNfVt.js","assets/schedulePeerJob-C5YbygAh.js","assets/schedulePeerJob--V7cpve7.css","assets/peerJobs-voXURBEt.css","assets/peerQRCode-DDkOBj-3.js","assets/browser-CjSdxGTc.js","assets/peerConfigurationFile-lWLWU3l5.js","assets/peerConfigurationFile-Dma_bQR7.css","assets/peerSettings-jMO8Y4z7.js","assets/peerSettings-DCod994Y.css","assets/peerSearchBar-CBbXC57S.js","assets/peerSearchBar-5knTmb8D.css","assets/peerJobsAllModal-BO5GLO3N.js","assets/peerJobsLogsModal-CBhltKU6.js","assets/editConfiguration-CfiGsPt6.js","assets/editConfiguration-C_hKRy6y.css"])))=>i.map(i=>d[i]); import{J as hn,K as dn,L as bi,M as fo,r as q,o as un,N as go,H as _e,O as _i,P as po,Q as fn,D as ti,s as gn,p as It,a as O,c as E,b as m,d as D,A as Z,t as B,e as W,g as Gt,_ as ei,W as pn,G as ft,z as fe,F as Xt,h as xi,j as Jt,R as mo,U as bo,n as St,w as Et,T as Di,f as $t,i as N,k as yi,V as _t,X as xt,Y as _o,m as xo,v as yo,Z as vo}from"./index-CGY_8-KO.js";import{_ as wo}from"./protocolBadge-CIAFrzfx.js";import{L as j}from"./localeText-FmUupiXC.js";import{d as So}from"./dayjs.min-BZb_e7nw.js";/*! * @kurkle/color v0.3.2 * https://github.com/kurkle/color#readme * (c) 2023 Jukka Kurkela * Released under the MIT License */function Pe(i){return i+.5|0}const vt=(i,t,e)=>Math.max(Math.min(i,e),t);function ce(i){return vt(Pe(i*2.55),0,255)}function kt(i){return vt(Pe(i*255),0,255)}function bt(i){return vt(Pe(i/2.55)/100,0,1)}function Yi(i){return vt(Pe(i*100),0,100)}const it={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},vi=[..."0123456789ABCDEF"],ko=i=>vi[i&15],Mo=i=>vi[(i&240)>>4]+vi[i&15],Ae=i=>(i&240)>>4===(i&15),Po=i=>Ae(i.r)&&Ae(i.g)&&Ae(i.b)&&Ae(i.a);function Co(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&it[i[1]]*17,g:255&it[i[2]]*17,b:255&it[i[3]]*17,a:t===5?it[i[4]]*17:255}:(t===7||t===9)&&(e={r:it[i[1]]<<4|it[i[2]],g:it[i[3]]<<4|it[i[4]],b:it[i[5]]<<4|it[i[6]],a:t===9?it[i[7]]<<4|it[i[8]]:255})),e}const Oo=(i,t)=>i<255?t(i):"";function Do(i){var t=Po(i)?ko:Mo;return i?"#"+t(i.r)+t(i.g)+t(i.b)+Oo(i.a,t):void 0}const To=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function mn(i,t,e){const s=t*Math.min(e,1-e),n=(o,r=(o+i/30)%12)=>e-s*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function Ao(i,t,e){const s=(n,o=(n+i/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[s(5),s(3),s(1)]}function Lo(i,t,e){const s=mn(i,1,.5);let n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)s[n]*=1-t-e,s[n]+=t;return s}function Ro(i,t,e,s,n){return i===n?(t-e)/s+(t.5?h/(2-o-r):h/(o+r),l=Ro(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function Ai(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(kt)}function Li(i,t,e){return Ai(mn,i,t,e)}function Io(i,t,e){return Ai(Lo,i,t,e)}function Eo(i,t,e){return Ai(Ao,i,t,e)}function bn(i){return(i%360+360)%360}function Fo(i){const t=To.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?ce(+t[5]):kt(+t[5]));const n=bn(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=Io(n,o,r):t[1]==="hsv"?s=Eo(n,o,r):s=Li(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function zo(i,t){var e=Ti(i);e[0]=bn(e[0]+t),e=Li(e),i.r=e[0],i.g=e[1],i.b=e[2]}function Bo(i){if(!i)return;const t=Ti(i),e=t[0],s=Yi(t[1]),n=Yi(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${bt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const Xi={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"},Ki={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"};function $o(){const i={},t=Object.keys(Ki),e=Object.keys(Xi);let s,n,o,r,a;for(s=0;s>16&255,o>>8&255,o&255]}return i}let Le;function Ho(i){Le||(Le=$o(),Le.transparent=[0,0,0,0]);const t=Le[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Wo=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function No(i){const t=Wo.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const r=+t[7];e=t[8]?ce(r):vt(r*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?ce(s):vt(s,0,255)),n=255&(t[4]?ce(n):vt(n,0,255)),o=255&(t[6]?ce(o):vt(o,0,255)),{r:s,g:n,b:o,a:e}}}function Vo(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${bt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const oi=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Ut=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function jo(i,t,e){const s=Ut(bt(i.r)),n=Ut(bt(i.g)),o=Ut(bt(i.b));return{r:kt(oi(s+e*(Ut(bt(t.r))-s))),g:kt(oi(n+e*(Ut(bt(t.g))-n))),b:kt(oi(o+e*(Ut(bt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function Re(i,t,e){if(i){let s=Ti(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Li(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function _n(i,t){return i&&Object.assign(t||{},i)}function qi(i){var t={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(t={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(t.a=kt(i[3]))):(t=_n(i,{r:0,g:0,b:0,a:1}),t.a=kt(t.a)),t}function Uo(i){return i.charAt(0)==="r"?No(i):Fo(i)}class xe{constructor(t){if(t instanceof xe)return t;const e=typeof t;let s;e==="object"?s=qi(t):e==="string"&&(s=Co(t)||Ho(t)||Uo(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=_n(this._rgb);return t&&(t.a=bt(t.a)),t}set rgb(t){this._rgb=qi(t)}rgbString(){return this._valid?Vo(this._rgb):void 0}hexString(){return this._valid?Do(this._rgb):void 0}hslString(){return this._valid?Bo(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const r=e===o?.5:e,a=2*r-1,l=s.a-n.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,s.r=255&c*s.r+o*n.r+.5,s.g=255&c*s.g+o*n.g+.5,s.b=255&c*s.b+o*n.b+.5,s.a=r*s.a+(1-r)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=jo(this._rgb,t._rgb,e)),this}clone(){return new xe(this.rgb)}alpha(t){return this._rgb.a=kt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Pe(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){const e=this._rgb;return e.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Re(this._rgb,2,t),this}darken(t){return Re(this._rgb,2,-t),this}saturate(t){return Re(this._rgb,1,t),this}desaturate(t){return Re(this._rgb,1,-t),this}rotate(t){return zo(this._rgb,t),this}}/*! * Chart.js v4.4.4 * https://www.chartjs.org * (c) 2024 Chart.js Contributors * Released under the MIT License */function gt(){}const Yo=(()=>{let i=0;return()=>i++})();function F(i){return i===null||typeof i>"u"}function V(i){if(Array.isArray&&Array.isArray(i))return!0;const t=Object.prototype.toString.call(i);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function L(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function nt(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function lt(i,t){return nt(i)?i:t}function A(i,t){return typeof i>"u"?t:i}const Xo=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function z(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function I(i,t,e,s){let n,o,r;if(V(i))for(o=i.length,n=0;ni,x:i=>i.x,y:i=>i.y};function Go(i){const t=i.split("."),e=[];let s="";for(const n of t)s+=n,s.endsWith("\\")?s=s.slice(0,-1)+".":(e.push(s),s="");return e}function Jo(i){const t=Go(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Qt(i,t){return(Gi[t]||(Gi[t]=Jo(t)))(i)}function Ri(i){return i.charAt(0).toUpperCase()+i.slice(1)}const ve=i=>typeof i<"u",Mt=i=>typeof i=="function",Ji=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Qo(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const U=Math.PI,dt=2*U,Zo=dt+U,Ge=Number.POSITIVE_INFINITY,tr=U/180,rt=U/2,Dt=U/4,Qi=U*2/3,wi=Math.log10,ut=Math.sign;function pe(i,t,e){return Math.abs(i-t)n-o).pop(),t}function we(i){return!isNaN(parseFloat(i))&&isFinite(i)}function ir(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function sr(i,t,e){let s,n,o;for(s=0,n=i.length;sl&&c=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Ii(i,t,e){e=e||(r=>i[r]1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const Bt=(i,t,e,s)=>Ii(i,e,s?n=>{const o=i[n][t];return oi[n][t]Ii(i,e,s=>i[s][t]>=e);function cr(i,t,e){let s=0,n=i.length;for(;ss&&i[n-1]>e;)n--;return s>0||n{const s="_onData"+Ri(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const r=n.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[s]=="function"&&a[s](...o)}),r}})})}function es(i,t){const e=i._chartjs;if(!e)return;const s=e.listeners,n=s.indexOf(t);n!==-1&&s.splice(n,1),!(s.length>0)&&(vn.forEach(o=>{delete i[o]}),delete i._chartjs)}function wn(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Sn=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function kn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Sn.call(window,()=>{s=!1,i.apply(t,e)}))}}function dr(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const Ei=i=>i==="start"?"left":i==="end"?"right":"center",X=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,ur=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t;function fr(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:r,_parsed:a}=i,l=r.axis,{min:c,max:h,minDefined:d,maxDefined:u}=r.getUserBounds();d&&(n=tt(Math.min(Bt(a,l,c).lo,e?s:Bt(t,l,r.getPixelForValue(c)).lo),0,s-1)),u?o=tt(Math.max(Bt(a,r.axis,h,!0).hi+1,e?0:Bt(t,l,r.getPixelForValue(h),!0).hi+1),n,s)-n:o=s-n}return{start:n,count:o}}function gr(i){const{xScale:t,yScale:e,_scaleRanges:s}=i,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!s)return i._scaleRanges=n,!0;const o=s.xmin!==t.min||s.xmax!==t.max||s.ymin!==e.min||s.ymax!==e.max;return Object.assign(s,n),o}const Ie=i=>i===0||i===1,is=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*dt/e)),ss=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*dt/e)+1,me={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*rt)+1,easeOutSine:i=>Math.sin(i*rt),easeInOutSine:i=>-.5*(Math.cos(U*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>Ie(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>Ie(i)?i:is(i,.075,.3),easeOutElastic:i=>Ie(i)?i:ss(i,.075,.3),easeInOutElastic(i){return Ie(i)?i:i<.5?.5*is(i*2,.1125,.45):.5+.5*ss(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let t=1.70158;return(i/=.5)<1?.5*(i*i*(((t*=1.525)+1)*i-t)):.5*((i-=2)*i*(((t*=1.525)+1)*i+t)+2)},easeInBounce:i=>1-me.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?me.easeInBounce(i*2)*.5:me.easeOutBounce(i*2-1)*.5+.5};function Fi(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function ns(i){return Fi(i)?i:new xe(i)}function ri(i){return Fi(i)?i:new xe(i).saturate(.5).darken(.1).hexString()}const pr=["x","y","borderWidth","radius","tension"],mr=["color","borderColor","backgroundColor"];function br(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),i.set("animations",{colors:{type:"color",properties:mr},numbers:{type:"number",properties:pr}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function _r(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const os=new Map;function xr(i,t){t=t||{};const e=i+JSON.stringify(t);let s=os.get(e);return s||(s=new Intl.NumberFormat(i,t),os.set(e,s)),s}function Mn(i,t,e){return xr(t,e).format(i)}const Pn={values(i){return V(i)?i:""+i},numeric(i,t,e){if(i===0)return"0";const s=this.chart.options.locale;let n,o=i;if(e.length>1){const c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(n="scientific"),o=yr(i,e)}const r=wi(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),Mn(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(wi(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?Pn.numeric.call(this,i,t,e):""}};function yr(i,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&i!==Math.floor(i)&&(e=i-Math.floor(i)),e}var Cn={formatters:Pn};function vr(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.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:Cn.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}const Wt=Object.create(null),ki=Object.create(null);function be(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;ss.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=(s,n)=>ri(n.backgroundColor),this.hoverBorderColor=(s,n)=>ri(n.borderColor),this.hoverColor=(s,n)=>ri(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ai(this,t,e)}get(t){return be(this,t)}describe(t,e){return ai(ki,t,e)}override(t,e){return ai(Wt,t,e)}route(t,e,s,n){const o=be(this,t),r=be(this,s),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[a],c=r[n];return L(l)?Object.assign({},c,l):A(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var H=new wr({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[br,_r,vr]);function Sr(i){return!i||F(i.size)||F(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function rs(i,t,e,s,n){let o=t[n];return o||(o=t[n]=i.measureText(n).width,e.push(n)),o>s&&(s=o),s}function Tt(i,t,e){const s=i.currentDevicePixelRatio,n=e!==0?Math.max(e/2,.5):0;return Math.round((t-n)*s)/s+n}function as(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function Mi(i,t,e,s){On(i,t,e,s,null)}function On(i,t,e,s,n){let o,r,a,l,c,h,d,u;const f=t.pointStyle,g=t.rotation,p=t.radius;let b=(g||0)*tr;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(b),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(p)||p<=0)){switch(i.beginPath(),f){default:n?i.ellipse(e,s,n/2,p,0,0,dt):i.arc(e,s,p,0,dt),i.closePath();break;case"triangle":h=n?n/2:p,i.moveTo(e+Math.sin(b)*h,s-Math.cos(b)*p),b+=Qi,i.lineTo(e+Math.sin(b)*h,s-Math.cos(b)*p),b+=Qi,i.lineTo(e+Math.sin(b)*h,s-Math.cos(b)*p),i.closePath();break;case"rectRounded":c=p*.516,l=p-c,r=Math.cos(b+Dt)*l,d=Math.cos(b+Dt)*(n?n/2-c:l),a=Math.sin(b+Dt)*l,u=Math.sin(b+Dt)*(n?n/2-c:l),i.arc(e-d,s-a,c,b-U,b-rt),i.arc(e+u,s-r,c,b-rt,b),i.arc(e+d,s+a,c,b,b+rt),i.arc(e-u,s+r,c,b+rt,b+U),i.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,h=n?n/2:l,i.rect(e-h,s-l,2*h,2*l);break}b+=Dt;case"rectRot":d=Math.cos(b)*(n?n/2:p),r=Math.cos(b)*p,a=Math.sin(b)*p,u=Math.sin(b)*(n?n/2:p),i.moveTo(e-d,s-a),i.lineTo(e+u,s-r),i.lineTo(e+d,s+a),i.lineTo(e-u,s+r),i.closePath();break;case"crossRot":b+=Dt;case"cross":d=Math.cos(b)*(n?n/2:p),r=Math.cos(b)*p,a=Math.sin(b)*p,u=Math.sin(b)*(n?n/2:p),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r);break;case"star":d=Math.cos(b)*(n?n/2:p),r=Math.cos(b)*p,a=Math.sin(b)*p,u=Math.sin(b)*(n?n/2:p),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r),b+=Dt,d=Math.cos(b)*(n?n/2:p),r=Math.cos(b)*p,a=Math.sin(b)*p,u=Math.sin(b)*(n?n/2:p),i.moveTo(e-d,s-a),i.lineTo(e+d,s+a),i.moveTo(e+u,s-r),i.lineTo(e-u,s+r);break;case"line":r=n?n/2:Math.cos(b)*p,a=Math.sin(b)*p,i.moveTo(e-r,s-a),i.lineTo(e+r,s+a);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(b)*(n?n/2:p),s+Math.sin(b)*p);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function Se(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.xt.top-e&&i.y0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,Pr(i,o),l=0;l+i||0;function Dn(i,t){const e={},s=L(t),n=s?Object.keys(t):t,o=L(i)?s?r=>A(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of n)e[r]=Lr(o(r));return e}function Tn(i){return Dn(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Kt(i){return Dn(i,["topLeft","topRight","bottomLeft","bottomRight"])}function ot(i){const t=Tn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function K(i,t){i=i||{},t=t||H.font;let e=A(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=A(i.style,t.style);s&&!(""+s).match(Tr)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:A(i.family,t.family),lineHeight:Ar(A(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:A(i.weight,t.weight),string:""};return n.string=Sr(n),n}function Ee(i,t,e,s){let n,o,r;for(n=0,o=i.length;ne&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function Nt(i,t){return Object.assign(Object.create(i),t)}function $i(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=In("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>$i([a,...i],t,o,s)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return Ln(a,l,()=>Wr(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return cs(a).includes(l)},ownKeys(a){return cs(a)},set(a,l,c){const h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function Zt(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:An(i,s),setContext:o=>Zt(i,o,e,s),override:o=>Zt(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return Ln(o,r,()=>Er(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function An(i,t={scriptable:!0,indexable:!0}){const{_scriptable:e=t.scriptable,_indexable:s=t.indexable,_allKeys:n=t.allKeys}=i;return{allKeys:n,scriptable:e,indexable:s,isScriptable:Mt(e)?e:()=>e,isIndexable:Mt(s)?s:()=>s}}const Ir=(i,t)=>i?i+Ri(t):t,Hi=(i,t)=>L(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Ln(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function Er(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=i;let a=s[t];return Mt(a)&&r.isScriptable(t)&&(a=Fr(t,a,i,e)),V(a)&&a.length&&(a=zr(t,a,i,r.isIndexable)),Hi(t,a)&&(a=Zt(a,n,o&&o[t],r)),a}function Fr(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_stack:a}=e;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=t(o,r||s);return a.delete(i),Hi(i,l)&&(l=Wi(n._scopes,n,i,l)),l}function zr(i,t,e,s){const{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(L(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=Wi(c,n,i,h);t.push(Zt(d,o,r&&r[i],a))}}return t}function Rn(i,t,e){return Mt(i)?i(t,e):i}const Br=(i,t)=>i===!0?t:typeof i=="string"?Qt(t,i):void 0;function $r(i,t,e,s,n){for(const o of t){const r=Br(e,o);if(r){i.add(r);const a=Rn(r._fallback,e,n);if(typeof a<"u"&&a!==e&&a!==s)return a}else if(r===!1&&typeof s<"u"&&e!==s)return null}return!1}function Wi(i,t,e,s){const n=t._rootScopes,o=Rn(t._fallback,e,s),r=[...i,...n],a=new Set;a.add(s);let l=ls(a,r,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=ls(a,r,o,l,s),l===null)?!1:$i(Array.from(a),[""],n,o,()=>Hr(t,e,s))}function ls(i,t,e,s,n){for(;e;)e=$r(i,t,e,s,n);return e}function Hr(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return V(n)&&L(e)?e:n||{}}function Wr(i,t,e,s){let n;for(const o of t)if(n=In(Ir(o,i),e),typeof n<"u")return Hi(i,n)?Wi(e,s,i,n):n}function In(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function cs(i){let t=i._keys;return t||(t=i._keys=Nr(i._scopes)),t}function Nr(i){const t=new Set;for(const e of i)for(const s of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(s);return Array.from(t)}const Vr=Number.EPSILON||1e-14,te=(i,t)=>ti==="x"?"y":"x";function jr(i,t,e,s){const n=i.skip?t:i,o=t,r=e.skip?t:e,a=Si(o,n),l=Si(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=s*c,u=s*h;return{previous:{x:o.x-d*(r.x-n.x),y:o.y-d*(r.y-n.y)},next:{x:o.x+u*(r.x-n.x),y:o.y+u*(r.y-n.y)}}}function Ur(i,t,e){const s=i.length;let n,o,r,a,l,c=te(i,0);for(let h=0;h!c.skip)),t.cubicInterpolationMode==="monotone")Xr(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,r=i.length;oi.ownerDocument.defaultView.getComputedStyle(i,null);function Gr(i,t){return ii(i).getPropertyValue(t)}const Jr=["top","right","bottom","left"];function Ht(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Jr[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Qr=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Zr(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let r=!1,a,l;if(Qr(n,o,i.target))a=n,l=o;else{const c=t.getBoundingClientRect();a=s.clientX-c.left,l=s.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function Lt(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=ii(e),o=n.boxSizing==="border-box",r=Ht(n,"padding"),a=Ht(n,"border","width"),{x:l,y:c,box:h}=Zr(i,e),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:f,height:g}=t;return o&&(f-=r.width+a.width,g-=r.height+a.height),{x:Math.round((l-d)/f*e.width/s),y:Math.round((c-u)/g*e.height/s)}}function ta(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&Vi(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=ii(o),l=Ht(a,"border","width"),c=Ht(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,s=Qe(a.maxWidth,o,"clientWidth"),n=Qe(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||Ge,maxHeight:n||Ge}}const ze=i=>Math.round(i*10)/10;function ea(i,t,e,s){const n=ii(i),o=Ht(n,"margin"),r=Qe(n.maxWidth,i,"clientWidth")||Ge,a=Qe(n.maxHeight,i,"clientHeight")||Ge,l=ta(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const u=Ht(n,"border","width"),f=Ht(n,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=ze(Math.min(c,r,l.maxWidth)),h=ze(Math.min(h,a,l.maxHeight)),c&&!h&&(h=ze(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=ze(Math.floor(h*s))),{width:c,height:h}}function hs(i,t,e){const s=t||1,n=Math.floor(i.height*s),o=Math.floor(i.width*s);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const r=i.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||r.height!==n||r.width!==o?(i.currentDevicePixelRatio=s,r.height=n,r.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const ia=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};Ni()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function ds(i,t){const e=Gr(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function Rt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function sa(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:s==="middle"?e<.5?i.y:t.y:s==="after"?e<1?i.y:t.y:e>0?t.y:i.y}}function na(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=Rt(i,n,e),a=Rt(n,o,e),l=Rt(o,t,e),c=Rt(r,a,e),h=Rt(a,l,e);return Rt(c,h,e)}const oa=function(i,t){return{x(e){return i+i+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,s){return e-s},leftForLtr(e,s){return e-s}}},ra=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function qt(i,t,e){return i?oa(t,e):ra()}function Fn(i,t){let e,s;(t==="ltr"||t==="rtl")&&(e=i.canvas.style,s=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),i.prevTextDirection=s)}function zn(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function Bn(i){return i==="angle"?{between:yn,compare:rr,normalize:yt}:{between:zt,compare:(t,e)=>t-e,normalize:t=>t}}function us({start:i,end:t,count:e,loop:s,style:n}){return{start:i%e,end:t%e,loop:s&&(t-i+1)%e===0,style:n}}function aa(i,t,e){const{property:s,start:n,end:o}=e,{between:r,normalize:a}=Bn(s),l=t.length;let{start:c,end:h,loop:d}=i,u,f;if(d){for(c+=l,h+=l,u=0,f=l;ul(n,S,x)&&a(n,S)!==0,w=()=>a(o,x)===0||l(o,S,x),P=()=>p||k(),y=()=>!p||w();for(let _=h,C=h;_<=d;++_)v=t[_%r],!v.skip&&(x=c(v[s]),x!==S&&(p=l(x,n,o),b===null&&P()&&(b=a(x,n)===0?_:C),b!==null&&y()&&(g.push(us({start:b,end:_,loop:u,count:r,style:f})),b=null),C=_,S=x));return b!==null&&g.push(us({start:b,end:d,loop:u,count:r,style:f})),g}function ca(i,t){const e=[],s=i.segments;for(let n=0;nn&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function da(i,t,e,s){const n=i.length,o=[];let r=t,a=i[t],l;for(l=t+1;l<=e;++l){const c=i[l%n];c.skip||c.stop?a.skip||(s=!1,o.push({start:t%n,end:(l-1)%n,loop:s}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%n,end:r%n,loop:s}),o}function ua(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:r,end:a}=ha(e,n,o,s);if(s===!0)return fs(i,[{start:r,end:a,loop:o}],e,t);const l=aa({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Sn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((s,n)=>{if(!s.running||!s.items.length)return;const o=s.items;let r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,s,t,"progress")),o.length||(s.running=!1,this._notify(n,s,t,"complete"),s.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){const e=this._charts;let s=e.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,s)),s}listen(t,e,s){this._getAnims(t).listeners[e].push(s)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((s,n)=>Math.max(s,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const s=e.items;let n=s.length-1;for(;n>=0;--n)s[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var pt=new pa;const ps="transparent",ma={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=ns(i||ps),n=s.valid&&ns(t||ps);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class ba{constructor(t,e,s,n){const o=e[s];n=Ee([t.to,n,o,t.from]);const r=Ee([t.from,o,n]);this._active=!0,this._fn=t.fn||ma[t.type||typeof r],this._easing=me[t.easing]||me.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=s,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,s){if(this._active){this._notify(!1);const n=this._target[this._prop],o=s-this._start,r=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ee([t.to,e,n,t.from]),this._from=Ee([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,s=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to;let l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((e,s)=>{t.push({res:e,rej:s})})}_notify(t){const e=t?"res":"rej",s=this._promises||[];for(let n=0;n{const o=t[n];if(!L(o))return;const r={};for(const a of e)r[a]=o[a];(V(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=xa(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&_a(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now();let l;for(l=r.length-1;l>=0;--l){const c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const u=s.get(c);if(d)if(u&&d.active()){d.update(u,h,a);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new ba(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return pt.add(this._chart,s),!0}}function _a(i,t){const e=[],s=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function ys(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=s,l=o.axis,c=r.axis,h=Sa(o,r,s),d=t.length;let u;for(let f=0;fe[s].axis===t).shift()}function Pa(i,t){return Nt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Ca(i,t,e){return Nt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function ne(i,t){const e=i.controller.index,s=i.vScale&&i.vScale.axis;if(s){t=t||i._parsed;for(const n of t){const o=n._stacks;if(!o||o[s]===void 0||o[s][e]===void 0)return;delete o[s][e],o[s]._visualValues!==void 0&&o[s]._visualValues[e]!==void 0&&delete o[s]._visualValues[e]}}}const ci=i=>i==="reset"||i==="none",vs=(i,t)=>t?i:Object.assign({},i),Oa=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:Hn(e,!0),values:null};class ji{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=_s(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&&ne(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,u,f,g)=>d==="x"?u:d==="r"?g:f,o=e.xAxisID=A(s.xAxisID,li(t,"x")),r=e.yAxisID=A(s.yAxisID,li(t,"y")),a=e.rAxisID=A(s.rAxisID,li(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,r,a),h=e.vAxisID=n(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(h)}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&&es(this._data,this),t._stacked&&ne(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(L(e)){const n=this._cachedMeta;this._data=wa(e,n)}else if(s!==e){if(s){es(s,this);const n=this._cachedMeta;ne(n),n._parsed=[]}e&&Object.isExtensible(e)&&hr(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,s=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=_s(e.vScale,e),e.stack!==s.stack&&(n=!0,ne(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&ys(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:r}=s,a=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,u;if(this._parsing===!1)s._parsed=n,s._sorted=!0,u=n;else{V(n[t])?u=this.parseArrayData(s,n,t,e):L(n[t])?u=this.parseObjectData(s,n,t,e):u=this.parsePrimitiveData(s,n,t,e);const f=()=>d[a]===null||c&&d[a]p||d=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,r;for(n=0,o=e.length;n=0&&tthis.getContext(s,n,e),p=c.resolveNamedOptions(u,f,g,d);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(vs(p,l))),p}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,s,e))}const c=new $n(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ci(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:r}}updateElement(t,e,s,n){ci(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!ci(e)&&this._resolveAnimations(void 0,e).update(t,s)}_setStyle(t,e,s,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,s,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,e,s){this._setStyle(t,s,"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,s=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const n=s.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;an-o))}return i._cache.$bar}function Ta(i){const t=i.iScale,e=Da(t,i.type);let s=t._length,n,o,r,a;const l=()=>{r===32767||r===-32768||(ve(a)&&(s=Math.min(s,Math.abs(r-a)||s)),a=r)};for(n=0,o=e.length;n0?n[i-1]:null,a=iMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:r,max:a}}function Wn(i,t,e,s){return V(i)?Ra(i,t,e,s):t[e.axis]=e.parse(i,s),t}function ws(i,t,e,s){const n=i.iScale,o=i.vScale,r=n.getLabels(),a=n===o,l=[];let c,h,d,u;for(c=e,h=e+s;c=e?1:-1)}function Ea(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.baseh.controller.options.grouped),o=s.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[s.axis],c=h=>{const d=h._parsed.find(f=>f[s.axis]===l),u=d&&d[h.vScale.axis];if(F(u)||isNaN(u))return!0};for(const h of n)if(!(e!==void 0&&c(h))&&((o===!1||r.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&r.push(h.stack),h.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,r;for(o=0,r=e.data.length;o0&&this.getParsed(e-1);for(let w=0;w=v){y.skip=!0;continue}const _=this.getParsed(w),C=F(_[f]),M=y[u]=r.getPixelForValue(_[u],w),T=y[f]=o||C?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,_,l):_[f],w);y.skip=isNaN(M)||isNaN(T)||C,y.stop=w>0&&Math.abs(_[u]-k[u])>b,p&&(y.parsed=_,y.raw=c.data[w]),d&&(y.options=h||this.resolveDataElementOptions(w,P.active?"active":n)),x||this.updateElement(P,w,y,n),k=_}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,s=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return s;const o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(s,o,r)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}function At(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Ui{static override(t){Object.assign(Ui.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return At()}parse(){return At()}format(){return At()}add(){return At()}diff(){return At()}startOf(){return At()}endOf(){return At()}}var $a={_date:Ui};function Ha(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const l=a._reversePixels?lr:Bt;if(s){if(n._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(o,t,e-h),u=l(o,t,e+h);return{lo:d.lo,hi:u.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function Ce(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r]&&l[r](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),a=a||l.inRange(t.x,t.y,n))}),s&&!a?[]:o}var ja={evaluateInteractionItems:Ce,modes:{index(i,t,e,s){const n=Lt(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?di(i,n,o,s,r):ui(i,n,o,!1,s,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=Lt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?di(i,n,o,s,r):ui(i,n,o,!1,s,r);if(a.length>0){const l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let h=0;he.pos===t)}function Ps(i,t){return i.filter(e=>jn.indexOf(e.pos)===-1&&e.box.axis===t)}function re(i,t){return i.sort((e,s)=>{const n=t?s:e,o=t?e:s;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function Ua(i){const t=[];let e,s,n,o,r,a;for(e=0,s=(i||[]).length;ec.box.fullSize),!0),s=re(oe(t,"left"),!0),n=re(oe(t,"right")),o=re(oe(t,"top"),!0),r=re(oe(t,"bottom")),a=Ps(t,"x"),l=Ps(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:oe(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function Cs(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function Un(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function qa(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!L(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&Un(r,o.getPadding());const a=Math.max(0,t.outerWidth-Cs(r,i,"left","right")),l=Math.max(0,t.outerHeight-Cs(r,i,"top","bottom")),c=a!==i.w,h=l!==i.h;return i.w=a,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function Ga(i){const t=i.maxPadding;function e(s){const n=Math.max(t[s]-i[s],0);return i[s]+=n,n}i.y+=e("top"),i.x+=e("left"),e("right"),e("bottom")}function Ja(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return s(i?["left","right"]:["top","bottom"])}function he(i,t,e,s){const n=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o{typeof p.beforeLayout=="function"&&p.beforeLayout()});const h=l.reduce((p,b)=>b.box.options&&b.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},n);Un(u,ot(s));const f=Object.assign({maxPadding:u,w:o,h:r,x:n.left,y:n.top},n),g=Xa(l.concat(c),d);he(a.fullSize,f,d,g),he(l,f,d,g),he(c,f,d,g)&&he(l,f,d,g),Ga(f),Os(a.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,Os(a.rightAndBottom,f,d,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},I(a.chartArea,p=>{const b=p.box;Object.assign(b,i.chartArea),b.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class Yn{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,s){}removeEventListener(t,e,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,s,n){return e=Math.max(0,e||t.width),s=s||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):s)}}isAttached(t){return!0}updateConfig(t){}}class Qa extends Yn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Ue="$chartjs",Za={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ds=i=>i===null||i==="";function tl(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[Ue]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ds(n)){const o=ds(i,"width");o!==void 0&&(i.width=o)}if(Ds(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=ds(i,"height");o!==void 0&&(i.height=o)}return i}const Xn=ia?{passive:!0}:!1;function el(i,t,e){i&&i.addEventListener(t,e,Xn)}function il(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Xn)}function sl(i,t){const e=Za[i.type]||i.type,{x:s,y:n}=Lt(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function Ze(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function nl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ze(a.addedNodes,s),r=r&&!Ze(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function ol(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||Ze(a.removedNodes,s),r=r&&!Ze(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const Me=new Map;let Ts=0;function Kn(){const i=window.devicePixelRatio;i!==Ts&&(Ts=i,Me.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function rl(i,t){Me.size||window.addEventListener("resize",Kn),Me.set(i,t)}function al(i){Me.delete(i),Me.size||window.removeEventListener("resize",Kn)}function ll(i,t,e){const s=i.canvas,n=s&&Vi(s);if(!n)return;const o=kn((a,l)=>{const c=n.clientWidth;e(a,l),c{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),rl(i,o),r}function fi(i,t,e){e&&e.disconnect(),t==="resize"&&al(i)}function cl(i,t,e){const s=i.canvas,n=kn(o=>{i.ctx!==null&&e(sl(o,i))},i);return el(s,t,n),n}class hl extends Yn{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(tl(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[Ue])return!1;const s=e[Ue].initial;["height","width"].forEach(o=>{const r=s[o];F(r)?e.removeAttribute(o):e.setAttribute(o,r)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Ue],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:nl,detach:ol,resize:ll}[e]||cl;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:fi,detach:fi,resize:fi}[e]||il)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return ea(t,e,s,n)}isAttached(t){const e=t&&Vi(t);return!!(e&&e.isConnected)}}function dl(i){return!Ni()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Qa:hl}class Pt{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return we(this.x)&&we(this.y)}getProps(t,e){const s=this.$animations;if(!e||!s)return this;const n={};return t.forEach(o=>{n[o]=s[o]&&s[o].active()?s[o]._to:this[o]}),n}}function ul(i,t){const e=i.options.ticks,s=fl(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?pl(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return ml(t,c,o,r/n),c;const h=gl(o,t,n);if(r>0){let d,u;const f=r>1?Math.round((l-a)/(r-1)):null;for($e(t,c,h,F(f)?0:a-f,a),d=0,u=r-1;dn)return l}return Math.max(n,1)}function pl(i){const t=[];let e,s;for(e=0,s=i.length;ei==="left"?"right":i==="right"?"left":i,As=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Ls=(i,t)=>Math.min(t||i,i);function Rs(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;or+a)))return l}function yl(i,t){I(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;os?s:e,s=n&&e>s?e:s,{min:lt(e,lt(s,e)),max:lt(s,lt(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){z(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Rr(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=tt(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/s:f/(s-1),d+6>a&&(a=f/(s-(t.offset?.5:1)),l=this.maxHeight-ae(t.grid)-e.padding-Is(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),r=nr(Math.min(Math.asin(tt((h.highest.height+6)/a,-1,1)),Math.asin(tt(l/c,-1,1))-Math.asin(tt(u/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){z(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){z(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){const l=Is(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=ae(o)+l):(t.height=this.maxHeight,t.width=ae(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,g=Ft(this.labelRotation),p=Math.cos(g),b=Math.sin(g);if(a){const x=s.mirror?0:b*d.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+x+f)}else{const x=s.mirror?0:p*d.width+b*u.height;t.width=Math.min(this.maxWidth,t.width+x+f)}this._calculatePadding(c,h,b,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,s,n){const{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=n*t.width,f=s*e.height):(u=s*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+r)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+r,this.paddingBottom=d+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(){z(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,s;for(e=0,s=t.length;e({width:r[C]||0,height:a[C]||0});return{first:_(0),last:_(e-1),widest:_(P),highest:_(y),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return ar(this._alignToPixels?Tt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*n?a/s:l/n:l*n0}_computeGridLineItems(t){const e=this.axis,s=this.chart,n=this.options,{grid:o,position:r,border:a}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=ae(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,b=p/2,x=function(Y){return Tt(s,Y,p)};let v,S,k,w,P,y,_,C,M,T,R,G;if(r==="top")v=x(this.bottom),y=this.bottom-u,C=v-b,T=x(t.top)+b,G=t.bottom;else if(r==="bottom")v=x(this.top),T=t.top,G=x(t.bottom)-b,y=v+b,C=this.top+u;else if(r==="left")v=x(this.right),P=this.right-u,_=v-b,M=x(t.left)+b,R=t.right;else if(r==="right")v=x(this.left),M=t.left,R=x(t.right)-b,P=v+b,_=this.left+u;else if(e==="x"){if(r==="center")v=x((t.top+t.bottom)/2+.5);else if(L(r)){const Y=Object.keys(r)[0],et=r[Y];v=x(this.chart.scales[Y].getPixelForValue(et))}T=t.top,G=t.bottom,y=v+b,C=y+u}else if(e==="y"){if(r==="center")v=x((t.left+t.right)/2);else if(L(r)){const Y=Object.keys(r)[0],et=r[Y];v=x(this.chart.scales[Y].getPixelForValue(et))}P=v-b,_=P-u,M=t.left,R=t.right}const at=A(n.ticks.maxTicksLimit,d),$=Math.max(1,Math.ceil(d/at));for(S=0;S0&&(Ot-=Ct/2);break}Te={left:Ot,top:se,width:Ct+jt.width,height:ie+jt.height,color:$.backdropColor}}b.push({label:k,font:C,textOffset:R,options:{rotation:p,color:et,strokeColor:Oe,strokeWidth:De,textAlign:Vt,textBaseline:G,translation:[w,P],backdrop:Te}})}return b}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Ft(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:s,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width;let c,h;return e==="left"?n?(h=this.right+o,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h+=l)):(h=this.right-a,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h=this.left)):e==="right"?n?(h=this.left+o,s==="near"?c="right":s==="center"?(c="center",h-=l/2):(c="left",h-=l)):(h=this.left+a,s==="near"?c="left":s==="center"?(c="center",h+=l/2):(c="right",h=this.right)):c="right",{textAlign:c,x:h}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:s,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,r),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){const e=this.options.grid,s=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,r;const a=(l,c,h)=>{!h.width||!h.color||(s.save(),s.lineWidth=h.width,s.strokeStyle=h.color,s.setLineDash(h.borderDash||[]),s.lineDashOffset=h.borderDashOffset,s.beginPath(),s.moveTo(l.x,l.y),s.lineTo(c.x,c.y),s.stroke(),s.restore())};if(e.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:s,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",n=[];let o,r;for(o=0,r=e.length;o{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");H.route(o,n,l,a)})}function Cl(i){return"id"in i&&"defaults"in i}class Ol{constructor(){this.controllers=new He(ji,"datasets",!0),this.elements=new He(Pt,"elements"),this.plugins=new He(Object,"plugins"),this.scales=new He(ee,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,s){[...e].forEach(n=>{const o=s||this._getRegistryForType(n);s||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):I(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=Ri(t);z(s["before"+n],[],s),e[t](s),z(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function Tl(i){const t={},e=[],s=Object.keys(ht.plugins.items);for(let o=0;o1&&Es(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function Fs(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function zl(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return Fs(i,"x",e[0])||Fs(i,"y",e[0])}return{}}function Bl(i,t){const e=Wt[i.type]||{scales:{}},s=t.scales||{},n=Pi(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!L(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);const l=Ci(r,a,zl(r,i),H.scales[a.type]),c=El(l,n),h=e.scales||{};o[r]=ge(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||Pi(a,t),h=(Wt[a]||{}).scales||{};Object.keys(h).forEach(d=>{const u=Il(d,l),f=r[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),ge(o[f],[{axis:u},s[f],h[d]])})}),Object.keys(o).forEach(r=>{const a=o[r];ge(a,[H.scales[a.type],H.scale])}),o}function qn(i){const t=i.options||(i.options={});t.plugins=A(t.plugins,{}),t.scales=Bl(i,t)}function Gn(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function $l(i){return i=i||{},i.data=Gn(i.data),qn(i),i}const zs=new Map,Jn=new Set;function We(i,t){let e=zs.get(i);return e||(e=t(),zs.set(i,e),Jn.add(e)),e}const le=(i,t,e)=>{const s=Qt(t,e);s!==void 0&&i.add(s)};class Hl{constructor(t){this._config=$l(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Gn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),qn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return We(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return We(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return We(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return We(`${s}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const s=this._scopeCache;let n=s.get(t);return(!n||e)&&(n=new Map,s.set(t,n)),n}getOptionScopes(t,e,s){const{options:n,type:o}=this,r=this._cachedScopes(t,s),a=r.get(e);if(a)return a;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>le(l,t,d))),h.forEach(d=>le(l,n,d)),h.forEach(d=>le(l,Wt[o]||{},d)),h.forEach(d=>le(l,H,d)),h.forEach(d=>le(l,ki,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Jn.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Wt[e]||{},H.datasets[e]||{},{type:e},H,ki]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Bs(this._resolverCache,t,n);let l=r;if(Nl(r,e)){o.$shared=!1,s=Mt(s)?s():s;const c=this.createResolver(t,s,a);l=Zt(r,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=Bs(this._resolverCache,t,s);return L(e)?Zt(o,e,void 0,n):o}}function Bs(i,t,e){let s=i.get(t);s||(s=new Map,i.set(t,s));const n=e.join();let o=s.get(n);return o||(o={resolver:$i(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const Wl=i=>L(i)&&Object.getOwnPropertyNames(i).some(t=>Mt(i[t]));function Nl(i,t){const{isScriptable:e,isIndexable:s}=An(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(Mt(a)||Wl(a))||r&&V(a))return!0}return!1}var Vl="4.4.4";const jl=["top","bottom","left","right","chartArea"];function $s(i,t){return i==="top"||i==="bottom"||jl.indexOf(i)===-1&&t==="x"}function Hs(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Ws(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),z(e&&e.onComplete,[i],t)}function Ul(i){const t=i.chart,e=t.options.animation;z(e&&e.onProgress,[i],t)}function Qn(i){return Ni()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const Ye={},Ns=i=>{const t=Qn(i);return Object.values(Ye).filter(e=>e.canvas===t).pop()};function Yl(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const r=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=r)}}}function Xl(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function Ne(i,t,e){return i.options.clip?i[e]:t[e]}function Kl(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Ne(e,t,"left"),right:Ne(e,t,"right"),top:Ne(s,t,"top"),bottom:Ne(s,t,"bottom")}:t}let si=class{static defaults=H;static instances=Ye;static overrides=Wt;static registry=ht;static version=Vl;static getChart=Ns;static register(...t){ht.add(...t),Vs()}static unregister(...t){ht.remove(...t),Vs()}constructor(t,e){const s=this.config=new Hl(e),n=Qn(t),o=Ns(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||dl(n)),this.platform.updateConfig(s);const a=this.platform.acquireContext(n,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Yo(),this.ctx=a,this.canvas=l,this.width=h,this.height=c,this._options=r,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 Dl,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=dr(d=>this.update(d),r.resizeDelay||0),this._dataChanges=[],Ye[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}pt.listen(this,"complete",Ws),pt.listen(this,"progress",Ul),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return F(t)?e&&o?o:n?s/n: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 ht}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():hs(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return as(this.canvas,this.ctx),this}stop(){return pt.stop(this),this}resize(t,e){pt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const s=this.options,n=this.canvas,o=s.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,hs(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),z(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};I(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((r,a)=>(r[a]=!1,r),{});let o=[];e&&(o=o.concat(Object.keys(e).map(r=>{const a=e[r],l=Ci(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),I(o,r=>{const a=r.options,l=a.id,c=Ci(l,a),h=A(a.type,r.dtype);(a.position===void 0||$s(a.position,c)!==$s(r.dposition))&&(a.position=r.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const u=ht.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(a,t)}),I(n,(r,a)=>{r||delete s[a]}),I(s,r=>{st.configure(this,r,r.options),st.addBox(this,r)})}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,s=t.length;if(t.sort((n,o)=>n.index-o.index),s>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((s,n)=>{e.filter(o=>o===s._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let s,n;for(this._removeUnreferencedMetasets(),s=0,n=e.length;s{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const s=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,h=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Hs("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){I(this.scales,t=>{st.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Ji(e,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:s,start:n,count:o}of e){const r=s==="_removeElements"?-o:o;Yl(t,n,r)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=s(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;st.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],I(this.boxes,n=>{s&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,s=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s=t._clip,n=!s.disabled,o=Kl(t,this.chartArea),r={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(n&&zi(e,{left:s.left===!1?0:o.left-s.left,right:s.right===!1?this.width:o.right+s.right,top:s.top===!1?0:o.top-s.top,bottom:s.bottom===!1?this.height:o.bottom+s.bottom}),t.controller.draw(),n&&Bi(e),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return Se(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=ja.modes[e];return typeof o=="function"?o(this,t,s,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],s=this._metasets;let n=s.filter(o=>o&&o._dataset===e).pop();return n||(n={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},s.push(n)),n}getContext(){return this.$context||(this.$context=Nt(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!e.hidden}setDatasetVisibility(t,e){const s=this.getDatasetMeta(t);s.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,s){const n=s?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);ve(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),r.update(o,{visible:s}),this.update(a=>a.datasetIndex===t?n: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(),pt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};I(this.options.events,o=>s(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,s=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},n=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let r;const a=()=>{n("attach",a),this.attached=!0,this.resize(),s("resize",o),s("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){I(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},I(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,s){const n=s?"set":"remove";let o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Ke(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),r=o(e,t),a=s?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,n)===!1)return;const o=this._handleEvent(t,e,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,n),(o||s.changed)&&this.render(),this}_handleEvent(t,e,s){const{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,s,r),l=Qo(t),c=Xl(t,this._lastEvent,s,l);s&&(this._lastEvent=null,z(o.onHover,[t,a,this],this),l&&z(o.onClick,[t,a,this],this));const h=!Ke(a,n);return(h||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=c,h}_getActiveElements(t,e,s,n){if(t.type==="mouseout")return[];if(!s)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};function Vs(){return I(si.instances,i=>i._plugins.invalidate())}function Zn(i,t,e=t){i.lineCap=A(e.borderCapStyle,t.borderCapStyle),i.setLineDash(A(e.borderDash,t.borderDash)),i.lineDashOffset=A(e.borderDashOffset,t.borderDashOffset),i.lineJoin=A(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=A(e.borderWidth,t.borderWidth),i.strokeStyle=A(e.borderColor,t.borderColor)}function ql(i,t,e){i.lineTo(e.x,e.y)}function Gl(i){return i.stepped?kr:i.tension||i.cubicInterpolationMode==="monotone"?Mr:ql}function to(i,t,e={}){const s=i.length,{start:n=0,end:o=s-1}=e,{start:r,end:a}=t,l=Math.max(n,r),c=Math.min(o,a),h=na&&o>a;return{count:s,start:l,loop:t.loop,ilen:c(r+(c?a-k:k))%o,S=()=>{p!==b&&(i.lineTo(h,b),i.lineTo(h,p),i.lineTo(h,x))};for(l&&(f=n[v(0)],i.moveTo(f.x,f.y)),u=0;u<=a;++u){if(f=n[v(u)],f.skip)continue;const k=f.x,w=f.y,P=k|0;P===g?(wb&&(b=w),h=(d*h+k)/++d):(S(),i.lineTo(k,w),g=P,d=0,p=b=w),x=w}S()}function Oi(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Ql:Jl}function Zl(i){return i.stepped?sa:i.tension||i.cubicInterpolationMode==="monotone"?na:Rt}function tc(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Zn(i,t.options),i.stroke(n)}function ec(i,t,e,s){const{segments:n,options:o}=t,r=Oi(t);for(const a of n)Zn(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const ic=typeof Path2D=="function";function sc(i,t,e,s){ic&&!t.options.segment?tc(i,t,e,s):ec(i,t,e,s)}class nc extends Pt{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=>t!=="borderDash"&&t!=="fill"};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 s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){const n=s.spanGaps?this._loop:this._fullLoop;qr(this._points,s,t,n,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=ua(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,s=t.length;return s&&e[t[s-1].end]}interpolate(t,e){const s=this.options,n=t[e],o=this.points,r=ca(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],l=Zl(s);let c,h;for(c=0,h=r.length;c{let{boxHeight:e=t,boxWidth:s=t}=i;return i.usePointStyle&&(e=Math.min(e,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(t,e)}},uc=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class Ys extends Pt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=z(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=K(s.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=Us(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(r,o,a,l)+10):(h=this.maxHeight,c=this._fitCols(r,n,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+a;let d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((g,p)=>{const b=s+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+b+2*a>r)&&(d+=h,c[c.length-(p>0?0:1)]=0,f+=h,u++),l[p]={left:0,top:f,row:u,width:b,height:n},c[c.length-1]+=b+a}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=r-t;let d=a,u=0,f=0,g=0,p=0;return this.legendItems.forEach((b,x)=>{const{itemWidth:v,itemHeight:S}=fc(s,e,o,b,n);x>0&&f+S+2*a>h&&(d+=u+a,c.push({width:u,height:f}),g+=u+a,p++,u=f=0),l[x]={left:g,top:f,col:p,width:v,height:S},u=Math.max(u,v),f+=S+a}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,r=qt(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=X(s,this.left+n,this.right-this.lineWidths[a]);for(const c of e)a!==c.row&&(a=c.row,l=X(s,this.left+n,this.right-this.lineWidths[a])),c.top+=this.top+t+n,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+n}else{let a=0,l=X(s,this.top+t+n,this.bottom-this.columnSizes[a].height);for(const c of e)c.col!==a&&(a=c.col,l=X(s,this.top+t+n,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+n,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;zi(t,this),this._draw(),Bi(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:r}=t,a=H.color,l=qt(t.rtl,this.left,this.width),c=K(r.font),{padding:h}=r,d=c.size,u=d/2;let f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:g,boxHeight:p,itemHeight:b}=Us(r,d),x=function(P,y,_){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;n.save();const C=A(_.lineWidth,1);if(n.fillStyle=A(_.fillStyle,a),n.lineCap=A(_.lineCap,"butt"),n.lineDashOffset=A(_.lineDashOffset,0),n.lineJoin=A(_.lineJoin,"miter"),n.lineWidth=C,n.strokeStyle=A(_.strokeStyle,a),n.setLineDash(A(_.lineDash,[])),r.usePointStyle){const M={radius:p*Math.SQRT2/2,pointStyle:_.pointStyle,rotation:_.rotation,borderWidth:C},T=l.xPlus(P,g/2),R=y+u;On(n,M,T,R,r.pointStyleWidth&&g)}else{const M=y+Math.max((d-p)/2,0),T=l.leftForLtr(P,g),R=Kt(_.borderRadius);n.beginPath(),Object.values(R).some(G=>G!==0)?Je(n,{x:T,y:M,w:g,h:p,radius:R}):n.rect(T,M,g,p),n.fill(),C!==0&&n.stroke()}n.restore()},v=function(P,y,_){ke(n,_.text,P,y+b/2,c,{strikethrough:_.hidden,textAlign:l.textAlign(_.textAlign)})},S=this.isHorizontal(),k=this._computeTitleHeight();S?f={x:X(o,this.left+h,this.right-s[0]),y:this.top+h+k,line:0}:f={x:this.left+h,y:X(o,this.top+k+h,this.bottom-e[0].height),line:0},Fn(this.ctx,t.textDirection);const w=b+h;this.legendItems.forEach((P,y)=>{n.strokeStyle=P.fontColor,n.fillStyle=P.fontColor;const _=n.measureText(P.text).width,C=l.textAlign(P.textAlign||(P.textAlign=r.textAlign)),M=g+u+_;let T=f.x,R=f.y;l.setWidth(this.width),S?y>0&&T+M+h>this.right&&(R=f.y+=w,f.line++,T=f.x=X(o,this.left+h,this.right-s[f.line])):y>0&&R+w>this.bottom&&(T=f.x=T+e[f.line].width+h,f.line++,R=f.y=X(o,this.top+k+h,this.bottom-e[f.line].height));const G=l.x(T);if(x(G,R,P),T=ur(C,T+g+u,S?T+M:this.right,t.rtl),v(l.x(T),R,P),S)f.x+=M+h;else if(typeof P.text!="string"){const at=c.lineHeight;f.y+=io(P,at)+h}else f.y+=w}),zn(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=K(e.font),n=ot(e.padding);if(!e.display)return;const o=qt(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=X(t.align,d,this.right-u);else{const g=this.columnSizes.reduce((p,b)=>Math.max(p,b.height),0);h=c+X(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=X(a,d,d+u);r.textAlign=o.textAlign(Ei(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=s.string,ke(r,e.text,f,h,s)}_computeTitleHeight(){const t=this.options.title,e=K(t.font),s=ot(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(zt(t,this.left,this.right)&&zt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;so.length>r.length?o:r)),t+e.size/2+s.measureText(n).width}function pc(i,t,e){let s=i;return typeof t.text!="string"&&(s=io(t,e)),s}function io(i,t){const e=i.text?i.text.length:0;return t*e}function mc(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var bc={id:"legend",_element:Ys,start(i,t,e){const s=i.legend=new Ys({ctx:i.ctx,options:e,chart:i});st.configure(i,s,e),st.addBox(i,s)},stop(i){st.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;st.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=ot(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class so extends Pt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=V(s.text)?s.text.length:1;this._padding=ot(s.padding);const o=n*K(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:r}=this,a=r.align;let l=0,c,h,d;return this.isHorizontal()?(h=X(a,s,o),d=e+t,c=o-s):(r.position==="left"?(h=s+t,d=X(a,n,e),l=U*-.5):(h=o-t,d=X(a,e,n),l=U*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=K(e.font),o=s.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);ke(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:Ei(e.align),textBaseline:"middle",translation:[r,a]})}}function _c(i,t){const e=new so({ctx:i.ctx,options:t,chart:i});st.configure(i,e,t),st.addBox(i,e),i.titleBlock=e}var xc={id:"title",_element:so,start(i,t,e){_c(i,e)},stop(i){const t=i.titleBlock;st.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;st.configure(i,s,e),s.options=e},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 de={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;ta+l)/s.size,y:n/o}},nearest(i,t){if(!i.length)return!1;let e=t.x,s=t.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o-1?i.split(` `):i}function yc(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:i,label:r,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function Xs(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=K(t.bodyFont),c=K(t.titleFont),h=K(t.footerFont),d=o.length,u=n.length,f=s.length,g=ot(t.padding);let p=g.height,b=0,x=s.reduce((k,w)=>k+w.before.length+w.lines.length+w.after.length,0);if(x+=i.beforeBody.length+i.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),x){const k=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*k+(x-f)*l.lineHeight+(x-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let v=0;const S=function(k){b=Math.max(b,e.measureText(k).width+v)};return e.save(),e.font=c.string,I(i.title,S),e.font=l.string,I(i.beforeBody.concat(i.afterBody),S),v=t.displayColors?r+2+t.boxPadding:0,I(s,k=>{I(k.before,S),I(k.lines,S),I(k.after,S)}),v=0,e.font=h.string,I(i.footer,S),e.restore(),b+=g.width,{width:b,height:p}}function vc(i,t){const{y:e,height:s}=t;return ei.height-s/2?"bottom":"center"}function wc(i,t,e,s){const{x:n,width:o}=s,r=e.caretSize+e.caretPadding;if(i==="left"&&n+o+r>t.width||i==="right"&&n-o-r<0)return!0}function Sc(i,t,e,s){const{x:n,width:o}=e,{width:r,chartArea:{left:a,right:l}}=i;let c="center";return s==="center"?c=n<=(a+l)/2?"left":"right":n<=o/2?c="left":n>=r-o/2&&(c="right"),wc(c,i,t,e)&&(c="center"),c}function Ks(i,t,e){const s=e.yAlign||t.yAlign||vc(i,e);return{xAlign:e.xAlign||t.xAlign||Sc(i,t,e,s),yAlign:s}}function kc(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function Mc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function qs(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=Kt(r);let g=kc(t,a);const p=Mc(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(h,u)+n:a==="right"&&(g+=Math.max(d,f)+n),{x:tt(g,0,s.width-t.width),y:tt(p,0,s.height-t.height)}}function Ve(i,t,e){const s=ot(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function Gs(i){return ct([],mt(i))}function Pc(i,t,e){return Nt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function Js(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const no={beforeTitle:gt,title(i){if(i.length>0){const t=i[0],e=t.chart.data.labels,s=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?no[t].call(e,s):n}class Qs extends Pt{static positioners=de;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,s=this.options.setContext(this.getContext()),n=s.enabled&&e.options.animation&&s.animations,o=new $n(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Pc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=J(s,"beforeTitle",this,t),o=J(s,"title",this,t),r=J(s,"afterTitle",this,t);let a=[];return a=ct(a,mt(n)),a=ct(a,mt(o)),a=ct(a,mt(r)),a}getBeforeBody(t,e){return Gs(J(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return I(t,o=>{const r={before:[],lines:[],after:[]},a=Js(s,o);ct(r.before,mt(J(a,"beforeLabel",this,o))),ct(r.lines,J(a,"label",this,o)),ct(r.after,mt(J(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return Gs(J(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=J(s,"beforeFooter",this,t),o=J(s,"footer",this,t),r=J(s,"afterFooter",this,t);let a=[];return a=ct(a,mt(n)),a=ct(a,mt(o)),a=ct(a,mt(r)),a}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],r=[];let a=[],l,c;for(l=0,c=e.length;lt.filter(h,d,u,s))),t.itemSort&&(a=a.sort((h,d)=>t.itemSort(h,d,s))),I(a,h=>{const d=Js(t.callbacks,h);n.push(J(d,"labelColor",this,h)),o.push(J(d,"labelPointStyle",this,h)),r.push(J(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const a=de[s.position].call(this,n,this._eventPosition);r=this._createItems(s),this.title=this.getTitle(r,s),this.beforeBody=this.getBeforeBody(r,s),this.body=this.getBody(r,s),this.afterBody=this.getAfterBody(r,s),this.footer=this.getFooter(r,s);const l=this._size=Xs(this,s),c=Object.assign({},a,l),h=Ks(this.chart,s,c),d=qs(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,s,n){const o=this.getCaretPosition(t,s,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,s){const{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=Kt(a),{x:u,y:f}=t,{width:g,height:p}=e;let b,x,v,S,k,w;return o==="center"?(k=f+p/2,n==="left"?(b=u,x=b-r,S=k+r,w=k-r):(b=u+g,x=b+r,S=k-r,w=k+r),v=b):(n==="left"?x=u+Math.max(l,h)+r:n==="right"?x=u+g-Math.max(c,d)-r:x=this.caretX,o==="top"?(S=f,k=S-r,b=x-r,v=x+r):(S=f+p,k=S+r,b=x+r,v=x-r),w=S),{x1:b,x2:x,x3:v,y1:S,y2:k,y3:w}}drawTitle(t,e,s){const n=this.title,o=n.length;let r,a,l;if(o){const c=qt(s.rtl,this.x,this.width);for(t.x=Ve(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",r=K(s.titleFont),a=s.titleSpacing,e.fillStyle=s.titleColor,e.font=r.string,l=0;lv!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Je(t,{x:p,y:g,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Je(t,{x:b,y:g+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(b,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=K(s.bodyFont);let u=d.lineHeight,f=0;const g=qt(s.rtl,this.x,this.width),p=function(_){e.fillText(_,g.x(t.x+f),t.y+u/2),t.y+=u+o},b=g.textAlign(r);let x,v,S,k,w,P,y;for(e.textAlign=r,e.textBaseline="middle",e.font=d.string,t.x=Ve(this,b,s),e.fillStyle=s.bodyColor,I(this.beforeBody,p),f=a&&b!=="right"?r==="center"?c/2+h:c+2+h:0,k=0,P=n.length;k0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const r=de[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=Xs(this,t),l=Object.assign({},r,this._size),c=Ks(e,t,l),h=qs(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const r=ot(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),Fn(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),zn(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Ke(s,n),r=this._positionChanged(n,e);(o||r)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,s=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,s),a=this._positionChanged(r,t),l=e||!Ke(r,o)||a;return l&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,s,n){const o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const r=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&r.reverse(),r}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,r=de[o.position].call(this,t,e);return r!==!1&&(s!==r.x||n!==r.y)}}var Cc={id:"tooltip",_element:Qs,positioners:de,afterInit(i,t,e){e&&(i.tooltip=new Qs({chart:i,options:e}))},beforeUpdate(i,t,e){i.tooltip&&i.tooltip.initialize(e)},reset(i,t,e){i.tooltip&&i.tooltip.initialize(e)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const e={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",e)}},afterEvent(i,t){if(i.tooltip){const e=t.replay;i.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:no},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Oc=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Dc(i,t,e,s){const n=i.indexOf(t);if(n===-1)return Oc(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const Tc=(i,t)=>i===null?null:tt(Math.round(i),0,t);function Zs(i){const t=this.getLabels();return i>=0&&ie.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 Lc(i,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=i,f=o||1,g=h-1,{min:p,max:b}=t,x=!F(r),v=!F(a),S=!F(c),k=(b-p)/(d+1);let w=Zi((b-p)/g/f)*f,P,y,_,C;if(w<1e-14&&!x&&!v)return[{value:p},{value:b}];C=Math.ceil(b/w)-Math.floor(p/w),C>g&&(w=Zi(C*w/g/f)*f),F(l)||(P=Math.pow(10,l),w=Math.ceil(w*P)/P),n==="ticks"?(y=Math.floor(p/w)*w,_=Math.ceil(b/w)*w):(y=p,_=b),x&&v&&o&&ir((a-r)/o,w/1e3)?(C=Math.round(Math.min((a-r)/w,h)),w=(a-r)/C,y=r,_=a):S?(y=x?r:y,_=v?a:_,C=c-1,w=(_-y)/C):(C=(_-y)/w,pe(C,Math.round(C),w/1e3)?C=Math.round(C):C=Math.ceil(C));const M=Math.max(ts(w),ts(y));P=Math.pow(10,F(l)?M:l),y=Math.round(y*P)/P,_=Math.round(_*P)/P;let T=0;for(x&&(u&&y!==r?(e.push({value:r}),ya)break;e.push({value:R})}return v&&u&&_!==a?e.length&&pe(e[e.length-1].value,a,tn(a,k,i))?e[e.length-1].value=a:e.push({value:a}):(!v||_===a)&&e.push({value:_}),e}function tn(i,t,{horizontal:e,minRotation:s}){const n=Ft(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class Rc extends ee{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return F(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:s}=this.getUserBounds();let{min:n,max:o}=this;const r=l=>n=e?n:l,a=l=>o=s?o:l;if(t){const l=ut(n),c=ut(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(n-l)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:e,stepSize:s}=t,n;return s?(n=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const n={maxTicks:s,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=Lc(n,o);return t.bounds==="ticks"&&sr(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){const t=this.ticks;let e=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const n=(s-e)/Math.max(t.length-1,1)/2;e-=n,s+=n}this._startValue=e,this._endValue=s,this._valueRange=s-e}getLabelForValue(t){return Mn(t,this.chart.options.locale,this.options.ticks.format)}}class Ic extends Rc{static id="linear";static defaults={ticks:{callback:Cn.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=nt(t)?t:0,this.max=nt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=Ft(this.options.ticks.minRotation),n=(t?Math.sin(s):Math.cos(s))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const ni={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}},Q=Object.keys(ni);function en(i,t){return i-t}function sn(i,t){if(F(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let r=t;return typeof s=="function"&&(r=s(r)),nt(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(we(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function nn(i,t,e,s){const n=Q.length;for(let o=Q.indexOf(i);o=Q.indexOf(e);o--){const r=Q[o];if(ni[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return Q[e?Q.indexOf(e):0]}function Fc(i){for(let t=Q.indexOf(i)+1,e=Q.length;t=t?e[s]:e[n];i[o]=!0}}function zc(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),r=t[t.length-1].value;let a,l;for(a=o;a<=r;a=+n.add(a,1,s))l=e[a],l>=0&&(t[l].major=!0);return t}function rn(i,t,e){const s=[],n={},o=t.length;let r,a;for(r=0;r+t.value))}initOffsets(t=[]){let e=0,s=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?s=o:s=(o-this.getDecimalForValue(t[t.length-2]))/2);const r=t.length<3?.5:.25;e=tt(e,0,r),s=tt(s,0,r),this._offsets={start:e,end:s,factor:1/(e+1+s)}}_generate(){const t=this._adapter,e=this.min,s=this.max,n=this.options,o=n.time,r=o.unit||nn(o.minUnit,e,s,this._getLabelCapacity(e)),a=A(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=we(l)||l===!0,h={};let d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":r),t.diff(s,e,r)>1e5*a)throw new Error(e+" and "+s+" are too far apart with stepSize of "+a+" "+r);const g=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u+p)}getLabelForValue(t){const e=this._adapter,s=this.options.time;return s.tooltipFormat?e.format(t,s.tooltipFormat):e.format(t,s.displayFormats.datetime)}format(t,e){const n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,s,n){const o=this.options,r=o.ticks.callback;if(r)return z(r,[t,e,s],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],d=c&&a[c],u=s[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,s;if(t.length)return t;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,s=n.length;e=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=Bt(i,"pos",t)),{pos:o,time:a}=i[s],{pos:r,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=Bt(i,"time",t)),{time:o,pos:a}=i[s],{time:r,pos:l}=i[n]);const c=r-o;return c?a+(l-a)*(t-o)/c:a}class Su extends an{static id="timeseries";static defaults=an.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=je(e,this.min),this._tableRange=je(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let r,a,l,c,h;for(r=0,a=t.length;r=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),s=this.getLabelTimestamps();return e.length&&s.length?t=this.normalize(e.concat(s)):t=e.length?e:s,t=this._cache.all=t,t}getDecimalForValue(t){return(je(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return je(this._table,s*this._tableRange+this._minPos,!0)}}const oo={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},Bc={ariaLabel:{type:String},ariaDescribedby:{type:String}},$c={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...oo,...Bc},Hc=fo[0]==="2"?(i,t)=>Object.assign(i,{attrs:t}):(i,t)=>Object.assign(i,t);function Yt(i){return fn(i)?_i(i):i}function Wc(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i;return fn(t)?new Proxy(i,{}):i}function Nc(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function ro(i,t){i.labels=t}function ao(i,t,e){const s=[];i.datasets=t.map(n=>{const o=i.datasets.find(r=>r[e]===n[e]);return!o||!n.data||s.includes(o)?{...n}:(s.push(o),Object.assign(o,n),o)})}function Vc(i,t){const e={labels:[],datasets:[]};return ro(e,i.labels),ao(e,i.datasets,t),e}const jc=hn({props:$c,setup(i,t){let{expose:e,slots:s}=t;const n=q(null),o=dn(null);e({chart:o});const r=()=>{if(!n.value)return;const{type:c,data:h,options:d,plugins:u,datasetIdKey:f}=i,g=Vc(h,f),p=Wc(g,h);o.value=new si(n.value,{type:c,data:p,options:{...d},plugins:u})},a=()=>{const c=_i(o.value);c&&(i.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},i.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(i.updateMode)};return un(r),go(a),_e([()=>i.options,()=>i.data],(c,h)=>{let[d,u]=c,[f,g]=h;const p=_i(o.value);if(!p)return;let b=!1;if(d){const x=Yt(d),v=Yt(f);x&&x!==v&&(Nc(p,x),b=!0)}if(u){const x=Yt(u.labels),v=Yt(g.labels),S=Yt(u.datasets),k=Yt(g.datasets);x!==v&&(ro(p.config.data,x),b=!0),S&&S!==k&&(ao(p.config.data,S,i.datasetIdKey),b=!0)}b&&po(()=>{l(p)})},{deep:!0}),()=>bi("canvas",{role:"img",ariaLabel:i.ariaLabel,ariaDescribedby:i.ariaDescribedby,ref:n},[bi("p",{},[s.default?s.default():""])])}});function lo(i,t){return si.register(t),hn({props:oo,setup(e,s){let{expose:n}=s;const o=dn(null),r=a=>{o.value=a?.chart};return n({chart:o}),()=>bi(jc,Hc({ref:r},{type:i,...e}))}})}const Uc=lo("bar",Nn),ln=lo("line",Vn),Yc={class:"row gx-2 gy-2 mb-3"},Xc={class:"col-12"},Kc={class:"card rounded-3 bg-transparent",style:{height:"270px"}},qc={class:"card-header bg-transparent border-0"},Gc={class:"text-muted"},Jc={class:"card-body pt-1"},Qc={class:"col-sm col-lg-6"},Zc={class:"card rounded-3 bg-transparent",style:{height:"270px"}},th={class:"card-header bg-transparent border-0 d-flex align-items-center"},eh={class:"text-muted"},ih={key:0,class:"text-primary fw-bold ms-auto"},sh={class:"card-body pt-1"},nh={class:"col-sm col-lg-6"},oh={class:"card rounded-3 bg-transparent",style:{height:"270px"}},rh={class:"card-header bg-transparent border-0 d-flex align-items-center"},ah={class:"text-muted"},lh={key:0,class:"text-success fw-bold ms-auto"},ch={class:"card-body pt-1"},hh={__name:"peerDataUsageCharts",props:{configurationPeers:Array,configurationInfo:Object},setup(i){si.register(nc,dc,Nn,Vn,Ic,bc,xc,Cc,Ac,oc);const t=i,e=q({timestamp:[],data:[]}),s=q({timestamp:[],data:[]}),n=ti(),o=q(void 0),r=async()=>{await Gt("/api/getWireguardConfigurationRealtimeTraffic",{configurationName:"wg1"},f=>{let g=So().format("hh:mm:ss A");(f.data.sent!==0&&f.data.recv!==0||e.value.data.length>0&&s.value.data.length>0)&&(e.value.timestamp.push(g),e.value.data.push(f.data.sent),s.value.timestamp.push(g),s.value.data.push(f.data.recv))})},a=()=>{clearInterval(o.value),o.value=void 0,t.configurationInfo.Status&&(o.value=setInterval(()=>{r()},parseInt(n.Configuration.Server.dashboard_refresh_interval)))};un(()=>{a()}),_e(()=>t.configurationInfo.Status,()=>{a()}),_e(()=>n.Configuration.Server.dashboard_refresh_interval,()=>{a()}),gn(()=>{clearInterval(o.value),o.value=void 0});const l=It(()=>{let f=t.configurationPeers.filter(g=>g.cumu_data+g.total_data>0);return{labels:f.map(g=>g.name?g.name:`Untitled Peer - ${g.id}`),datasets:[{label:"Total Data Usage",data:f.map(g=>g.cumu_data+g.total_data),backgroundColor:f.map(g=>"#ffc107"),tooltip:{callbacks:{label:g=>`${g.formattedValue} GB`}}}]}}),c=It(()=>({labels:[...e.value.timestamp],datasets:[{label:"Data Sent",data:[...e.value.data],fill:!1,borderColor:"#198754",backgroundColor:"#198754",tension:0}]})),h=It(()=>({labels:[...s.value.timestamp],datasets:[{label:"Data Received",data:[...s.value.data],fill:!1,borderColor:"#0d6efd",backgroundColor:"#0d6efd",tension:0}]})),d=It(()=>({responsive:!0,plugins:{legend:{display:!1}},scales:{x:{ticks:{display:!1},grid:{display:!1}},y:{ticks:{callback:(f,g)=>`${Math.round((f+Number.EPSILON)*1e3)/1e3} GB`},grid:{display:!1}}}})),u=It(()=>({responsive:!0,plugins:{legend:{display:!1},tooltip:{callbacks:{label:f=>`${f.formattedValue} MB/s`}}},scales:{x:{ticks:{display:!1},grid:{display:!0}},y:{ticks:{callback:(f,g)=>`${Math.round((f+Number.EPSILON)*1e3)/1e3} MB/s`},grid:{display:!0}}}}));return(f,g)=>(O(),E("div",Yc,[m("div",Xc,[m("div",Kc,[m("div",qc,[m("small",Gc,[D(j,{t:"Peers Data Usage"})])]),m("div",Jc,[D(Z(Uc),{data:l.value,options:d.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["data","options"])])])]),m("div",Qc,[m("div",Zc,[m("div",th,[m("small",eh,[D(j,{t:"Real Time Received Data Usage"})]),s.value.data.length>0?(O(),E("small",ih,B(s.value.data[s.value.data.length-1])+" MB/s ",1)):W("",!0)]),m("div",sh,[D(Z(ln),{options:u.value,data:h.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])]),m("div",nh,[m("div",oh,[m("div",rh,[m("small",ah,[D(j,{t:"Real Time Sent Data Usage"})]),e.value.data.length>0?(O(),E("small",lh,B(e.value.data[e.value.data.length-1])+" MB/s ",1)):W("",!0)]),m("div",ch,[D(Z(ln),{options:u.value,data:c.value,style:{width:"100%",height:"200px","max-height":"200px"}},null,8,["options","data"])])])])]))}},dh={name:"peerSearch",components:{LocaleText:j},setup(){const i=ti(),t=pn();return{store:i,wireguardConfigurationStore:t}},props:{configuration:Object},data(){return{sort:{status:ft("Status"),name:ft("Name"),allowed_ip:ft("Allowed IPs"),restricted:ft("Restricted")},interval:{5e3:ft("5 Seconds"),1e4:ft("10 Seconds"),3e4:ft("30 Seconds"),6e4:ft("1 Minutes")},searchString:"",searchStringTimeout:void 0,showDisplaySettings:!1,showMoreSettings:!1}},methods:{debounce(){this.searchStringTimeout?(clearTimeout(this.searchStringTimeout),this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)):this.searchStringTimeout=setTimeout(()=>{this.wireguardConfigurationStore.searchString=this.searchString},300)},updateSort(i){fe("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_sort",value:i},t=>{t.status&&this.store.getConfiguration()})},updateRefreshInterval(i){fe("/api/updateDashboardConfigurationItem",{section:"Server",key:"dashboard_refresh_interval",value:i},t=>{t.status&&this.store.getConfiguration()})},downloadAllPeer(){Gt(`/api/downloadAllPeers/${this.configuration.Name}`,{},i=>{console.log(i),window.wireguard.generateZipFiles(i,this.configuration.Name)})}},computed:{searchBarPlaceholder(){return ft("Search Peers...")}}},uh={class:"d-flex flex-column gap-2 my-4"},fh={class:"d-flex gap-2 peerSearchContainer"},gh={class:"dropdown"},ph={"data-bs-toggle":"dropdown",class:"btn w-100 btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},mh={class:"badge text-bg-primary ms-2"},bh={class:"dropdown-menu rounded-3"},_h=["onClick"],xh={class:"ms-auto"},yh={key:0,class:"bi bi-check-circle-fill"},vh={class:"dropdown"},wh={"data-bs-toggle":"dropdown",class:"btn btn-sm w-100 text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle position-relative"},Sh={class:"badge text-bg-primary ms-2"},kh={class:"dropdown-menu rounded-3"},Mh=["onClick"],Ph={class:"ms-auto"},Ch={key:0,class:"bi bi-check-circle-fill"};function Oh(i,t,e,s,n,o){const r=Jt("LocaleText");return O(),E("div",uh,[m("div",fh,[m("div",gh,[m("button",ph,[t[4]||(t[4]=m("i",{class:"bi bi-sort-up me-2"},null,-1)),D(r,{t:"Sort By"}),m("span",mh,B(this.sort[s.store.Configuration.Server.dashboard_sort]),1)]),m("ul",bh,[(O(!0),E(Xt,null,xi(this.sort,(a,l)=>(O(),E("li",null,[m("button",{class:"dropdown-item d-flex align-items-center",onClick:c=>this.updateSort(l)},[m("small",null,B(a),1),m("small",xh,[s.store.Configuration.Server.dashboard_sort===l?(O(),E("i",yh)):W("",!0)])],8,_h)]))),256))])]),m("div",vh,[m("button",wh,[t[5]||(t[5]=m("i",{class:"bi bi-arrow-repeat me-2"},null,-1)),D(r,{t:"Refresh Interval"}),m("span",Sh,B(this.interval[s.store.Configuration.Server.dashboard_refresh_interval]),1)]),m("ul",kh,[(O(!0),E(Xt,null,xi(this.interval,(a,l)=>(O(),E("li",null,[m("button",{class:"dropdown-item d-flex align-items-center",onClick:c=>this.updateRefreshInterval(l)},[m("small",null,B(a),1),m("small",Ph,[s.store.Configuration.Server.dashboard_refresh_interval===l?(O(),E("i",Ch)):W("",!0)])],8,Mh)]))),256))])]),m("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle ms-lg-auto",onClick:t[0]||(t[0]=a=>this.$emit("search"))},[t[6]||(t[6]=m("i",{class:"bi bi-search me-2"},null,-1)),D(r,{t:"Search"})]),m("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[1]||(t[1]=a=>this.downloadAllPeer())},[t[7]||(t[7]=m("i",{class:"bi bi-download me-2 me-lg-0 me-xl-2"},null,-1)),D(r,{t:"Download All",class:"d-sm-block d-lg-none d-xl-block"})]),m("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[2]||(t[2]=a=>this.$emit("selectPeers"))},[t[8]||(t[8]=m("i",{class:"bi bi-check2-all me-2 me-lg-0 me-xl-2"},null,-1)),D(r,{t:"Select Peers",class:"d-sm-block d-lg-none d-xl-block"})]),m("button",{class:"btn btn-sm text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:t[3]||(t[3]=a=>this.$emit("jobsAll")),type:"button","aria-expanded":"false"},[t[9]||(t[9]=m("i",{class:"bi bi-person-walking me-2 me-lg-0 me-xl-2"},null,-1)),D(r,{t:"Active Jobs",class:"d-sm-block d-lg-none d-xl-block"})])])])}const Dh=ei(dh,[["render",Oh],["__scopeId","data-v-2c7d446a"]]);function Th(i){return mo()?(bo(i),!0):!1}function co(i){return typeof i=="function"?i():Z(i)}const ho=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ah=Object.prototype.toString,Lh=i=>Ah.call(i)==="[object Object]",Xe=()=>{},Rh=Ih();function Ih(){var i,t;return ho&&((i=window?.navigator)==null?void 0:i.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function ue(i){var t;const e=co(i);return(t=e?.$el)!=null?t:e}const uo=ho?window:void 0;function mi(...i){let t,e,s,n;if(typeof i[0]=="string"||Array.isArray(i[0])?([e,s,n]=i,t=uo):[t,e,s,n]=i,!t)return Xe;Array.isArray(e)||(e=[e]),Array.isArray(s)||(s=[s]);const o=[],r=()=>{o.forEach(h=>h()),o.length=0},a=(h,d,u,f)=>(h.addEventListener(d,u,f),()=>h.removeEventListener(d,u,f)),l=_e(()=>[ue(t),co(n)],([h,d])=>{if(r(),!h)return;const u=Lh(d)?{...d}:d;o.push(...e.flatMap(f=>s.map(g=>a(h,f,g,u))))},{immediate:!0,flush:"post"}),c=()=>{l(),r()};return Th(c),c}let cn=!1;function Eh(i,t,e={}){const{window:s=uo,ignore:n=[],capture:o=!0,detectIframe:r=!1}=e;if(!s)return Xe;Rh&&!cn&&(cn=!0,Array.from(s.document.body.children).forEach(u=>u.addEventListener("click",Xe)),s.document.documentElement.addEventListener("click",Xe));let a=!0;const l=u=>n.some(f=>{if(typeof f=="string")return Array.from(s.document.querySelectorAll(f)).some(g=>g===u.target||u.composedPath().includes(g));{const g=ue(f);return g&&(u.target===g||u.composedPath().includes(g))}}),h=[mi(s,"click",u=>{const f=ue(i);if(!(!f||f===u.target||u.composedPath().includes(f))){if(u.detail===0&&(a=!l(u)),!a){a=!0;return}t(u)}},{passive:!0,capture:o}),mi(s,"pointerdown",u=>{const f=ue(i);a=!l(u)&&!!(f&&!u.composedPath().includes(f))},{passive:!0}),r&&mi(s,"blur",u=>{setTimeout(()=>{var f;const g=ue(i);((f=s.document.activeElement)==null?void 0:f.tagName)==="IFRAME"&&!g?.contains(s.document.activeElement)&&t(u)},0)})].filter(Boolean);return()=>h.forEach(u=>u())}const Fh={key:0,class:"position-absolute d-block p-1 px-2 bg-body text-body rounded-3 border shadow"},zh={__name:"peerSettingsDropdownTool",props:{icon:String,title:String},emits:["click"],setup(i,{emit:t}){const e=t,s=q(!1);return(n,o)=>(O(),E("a",{class:"dropdown-item text-center px-0 rounded-3 position-relative",role:"button",onMouseenter:o[0]||(o[0]=r=>s.value=!0),onMouseleave:o[1]||(o[1]=r=>s.value=!1),onClick:o[2]||(o[2]=r=>e("click"))},[m("i",{class:St(["me-auto bi",i.icon])},null,2),D(Di,{name:"zoomReversed"},{default:Et(()=>[s.value?(O(),E("span",Fh,[m("small",null,B(i.title),1)])):W("",!0)]),_:1})],32))}},Bh=ei(zh,[["__scopeId","data-v-2d66aeb6"]]),$h={name:"peerSettingsDropdown",components:{PeerSettingsDropdownTool:Bh,LocaleText:j},setup(){return{dashboardStore:ti()}},props:{Peer:Object},data(){return{deleteBtnDisabled:!1,restrictBtnDisabled:!1,allowAccessBtnDisabled:!1,confirmDelete:!1}},methods:{downloadPeer(){Gt("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},i=>{if(i.status){const t=new Blob([i.data.file],{type:"text/plain"}),e=URL.createObjectURL(t),s=`${i.data.fileName}.conf`,n=document.createElement("a");n.href=e,n.download=s,n.click(),this.dashboardStore.newMessage("WGDashboard","Peer download started","success")}else this.dashboardStore.newMessage("Server",i.message,"danger")})},downloadQRCode(i){Gt("/api/downloadPeer/"+this.$route.params.id,{id:this.Peer.id},t=>{t.status?this.$emit(i,t.data.file):this.dashboardStore.newMessage("Server",t.message,"danger")})},deletePeer(){this.deleteBtnDisabled=!0,fe(`/api/deletePeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.deleteBtnDisabled=!1})},restrictPeer(){this.restrictBtnDisabled=!0,fe(`/api/restrictPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.restrictBtnDisabled=!1})},allowAccessPeer(){this.allowAccessBtnDisabled=!0,fe(`/api/allowAccessPeers/${this.$route.params.id}`,{peers:[this.Peer.id]},i=>{this.dashboardStore.newMessage("Server",i.message,i.status?"success":"danger"),this.$emit("refresh"),this.allowAccessBtnDisabled=!1})}}},Hh={class:"dropdown-menu mt-2 shadow-lg d-block rounded-3",style:{"max-width":"200px"}},Wh={style:{"font-size":"0.8rem","padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},Nh={class:"text-body d-flex"},Vh={class:"ms-auto"},jh={key:1},Uh={class:"w-100 dropdown-item text-muted",style:{"white-space":"break-spaces","font-size":"0.7rem"}},Yh={key:2},Xh={class:"d-flex",style:{"padding-left":"var(--bs-dropdown-item-padding-x)","padding-right":"var(--bs-dropdown-item-padding-x)"}},Kh={key:1,class:"confirmDelete"},qh={style:{"white-space":"break-spaces"},class:"mb-2 d-block fw-bold"},Gh={class:"d-flex w-100 gap-2"},Jh=["disabled"],Qh=["disabled"],Zh={key:1};function td(i,t,e,s,n,o){const r=Jt("LocaleText"),a=Jt("PeerSettingsDropdownTool");return O(),E("ul",Hh,[this.Peer.restricted?(O(),E("li",Zh,[m("a",{class:St(["dropdown-item d-flex text-warning",{disabled:this.allowAccessBtnDisabled}]),onClick:t[10]||(t[10]=l=>this.allowAccessPeer()),role:"button"},[t[22]||(t[22]=m("i",{class:"me-auto bi bi-unlock"},null,-1)),this.allowAccessBtnDisabled?(O(),N(r,{key:1,t:"Allowing Access..."})):(O(),N(r,{key:0,t:"Allow Access"}))],2)])):(O(),E(Xt,{key:0},[this.confirmDelete?(O(),E("li",Kh,[m("p",qh,[D(r,{t:"Are you sure to delete this peer?"})]),m("div",Gh,[m("button",{onClick:t[8]||(t[8]=l=>this.deletePeer()),disabled:this.deleteBtnDisabled,class:"flex-grow-1 ms-auto btn btn-sm bg-danger"},[D(r,{t:"Yes"})],8,Jh),m("button",{disabled:this.deleteBtnDisabled,onClick:t[9]||(t[9]=l=>this.confirmDelete=!1),class:"flex-grow-1 btn btn-sm bg-secondary-subtle text-secondary-emphasis border border-secondary-subtle"},[D(r,{t:"No"})],8,Qh)])])):(O(),E(Xt,{key:0},[this.Peer.status==="running"?(O(),E(Xt,{key:0},[m("li",Wh,[m("span",Nh,[t[11]||(t[11]=m("i",{class:"bi bi-box-arrow-in-right"},null,-1)),m("span",Vh,B(this.Peer.endpoint),1)])]),t[12]||(t[12]=m("li",null,[m("hr",{class:"dropdown-divider"})],-1))],64)):W("",!0),this.Peer.private_key?(O(),E("li",Yh,[t[13]||(t[13]=m("div",{class:"text-center text-muted"},null,-1)),m("div",Xh,[D(a,{icon:"bi-download",title:"Download",onClick:t[0]||(t[0]=l=>this.downloadPeer())}),D(a,{icon:"bi-qr-code",title:"QR Code",onClick:t[1]||(t[1]=l=>this.$emit("qrcode"))}),D(a,{icon:"bi-body-text",title:"Configuration File",onClick:t[2]||(t[2]=l=>this.$emit("configurationFile"))}),D(a,{icon:"bi-share",title:"Share",onClick:t[3]||(t[3]=l=>this.$emit("share"))})])])):(O(),E("li",jh,[m("small",Uh,[D(r,{t:"Download & QR Code is not available due to no private key set for this peer"})])])),t[20]||(t[20]=m("li",null,[m("hr",{class:"dropdown-divider"})],-1)),m("li",null,[m("a",{class:"dropdown-item d-flex",role:"button",onClick:t[4]||(t[4]=l=>this.$emit("setting"))},[t[14]||(t[14]=m("i",{class:"me-auto bi bi-pen"},null,-1)),t[15]||(t[15]=$t()),D(r,{t:"Peer Settings"})])]),m("li",null,[m("a",{class:"dropdown-item d-flex",role:"button",onClick:t[5]||(t[5]=l=>this.$emit("jobs"))},[t[16]||(t[16]=m("i",{class:"me-auto bi bi-app-indicator"},null,-1)),t[17]||(t[17]=$t()),D(r,{t:"Schedule Jobs"})])]),t[21]||(t[21]=m("li",null,[m("hr",{class:"dropdown-divider"})],-1)),m("li",null,[m("a",{class:St(["dropdown-item d-flex text-warning",{disabled:this.restrictBtnDisabled}]),onClick:t[6]||(t[6]=l=>this.restrictPeer()),role:"button"},[t[18]||(t[18]=m("i",{class:"me-auto bi bi-lock"},null,-1)),this.restrictBtnDisabled?(O(),N(r,{key:1,t:"Restricting..."})):(O(),N(r,{key:0,t:"Restrict Access"}))],2)]),m("li",null,[m("a",{class:St(["dropdown-item d-flex fw-bold text-danger",{disabled:this.deleteBtnDisabled}]),onClick:t[7]||(t[7]=l=>this.confirmDelete=!0),role:"button"},[t[19]||(t[19]=m("i",{class:"me-auto bi bi-trash"},null,-1)),this.deleteBtnDisabled?(O(),N(r,{key:1,t:"Deleting..."})):(O(),N(r,{key:0,t:"Delete"}))],2)])],64))],64))])}const ed=ei($h,[["render",td],["__scopeId","data-v-dc8f29f3"]]),id={name:"peer",components:{LocaleText:j,PeerSettingsDropdown:ed},props:{Peer:Object},data(){return{}},setup(){const i=q(null),t=q(!1);return Eh(i,e=>{t.value=!1}),{target:i,subMenuOpened:t}},computed:{getLatestHandshake(){return this.Peer.latest_handshake.includes(",")?this.Peer.latest_handshake.split(",")[0]:this.Peer.latest_handshake}}},sd={key:0,class:"card-header bg-transparent d-flex align-items-center gap-2 border-0"},nd={style:{"font-size":"0.8rem"},class:"ms-auto d-flex gap-2"},od={class:"text-primary"},rd={class:"text-success"},ad={key:0,class:"text-secondary"},ld={key:1,class:"border-0 card-header bg-transparent text-warning fw-bold",style:{"font-size":"0.8rem"}},cd={class:"card-body pt-1",style:{"font-size":"0.9rem"}},hd={class:"mb-1"},dd={class:"text-muted"},ud={class:"d-block"},fd={class:"text-muted"},gd={class:"d-block"},pd={key:0},md={class:"text-muted"},bd={class:"d-block"},_d={class:"d-flex align-items-end"};function xd(i,t,e,s,n,o){const r=Jt("LocaleText"),a=Jt("PeerSettingsDropdown");return O(),E("div",{class:St(["card shadow-sm rounded-3 peerCard",{"border-warning":e.Peer.restricted}])},[m("div",null,[e.Peer.restricted?(O(),E("div",ld,[t[12]||(t[12]=m("i",{class:"bi-lock-fill me-2"},null,-1)),D(r,{t:"Access Restricted"})])):(O(),E("div",sd,[m("div",{class:St(["dot ms-0",{active:e.Peer.status==="running"}])},null,2),m("div",nd,[m("span",od,[t[7]||(t[7]=m("i",{class:"bi bi-arrow-down"},null,-1)),m("strong",null,B((e.Peer.cumu_receive+e.Peer.total_receive).toFixed(4)),1),t[8]||(t[8]=$t(" GB "))]),m("span",rd,[t[9]||(t[9]=m("i",{class:"bi bi-arrow-up"},null,-1)),m("strong",null,B((e.Peer.cumu_sent+e.Peer.total_sent).toFixed(4)),1),t[10]||(t[10]=$t(" GB "))]),e.Peer.latest_handshake!=="No Handshake"?(O(),E("span",ad,[t[11]||(t[11]=m("i",{class:"bi bi-arrows-angle-contract"},null,-1)),$t(" "+B(o.getLatestHandshake)+" ago ",1)])):W("",!0)])]))]),m("div",cd,[m("h6",null,B(e.Peer.name?e.Peer.name:"Untitled Peer"),1),m("div",hd,[m("small",dd,[D(r,{t:"Public Key"})]),m("small",ud,[m("samp",null,B(e.Peer.id),1)])]),m("div",null,[m("small",fd,[D(r,{t:"Allowed IPs"})]),m("small",gd,[m("samp",null,B(e.Peer.allowed_ip),1)])]),e.Peer.advanced_security?(O(),E("div",pd,[m("small",md,[D(r,{t:"Advanced Security"})]),m("small",bd,[m("samp",null,B(e.Peer.advanced_security),1)])])):W("",!0),m("div",_d,[m("div",{class:St(["ms-auto px-2 rounded-3 subMenuBtn",{active:this.subMenuOpened}])},[m("a",{role:"button",class:"text-body",onClick:t[0]||(t[0]=l=>this.subMenuOpened=!0)},t[13]||(t[13]=[m("h5",{class:"mb-0"},[m("i",{class:"bi bi-three-dots"})],-1)])),D(Di,{name:"slide-fade"},{default:Et(()=>[this.subMenuOpened?(O(),N(a,{key:0,onQrcode:t[1]||(t[1]=l=>this.$emit("qrcode")),onConfigurationFile:t[2]||(t[2]=l=>this.$emit("configurationFile")),onSetting:t[3]||(t[3]=l=>this.$emit("setting")),onJobs:t[4]||(t[4]=l=>this.$emit("jobs")),onRefresh:t[5]||(t[5]=l=>this.$emit("refresh")),onShare:t[6]||(t[6]=l=>this.$emit("share")),Peer:e.Peer,ref:"target"},null,8,["Peer"])):W("",!0)]),_:1})],2)])])],2)}const yd=ei(id,[["render",xd],["__scopeId","data-v-b471ab00"]]),vd={__name:"peerListModals",props:{configurationModals:Object,configurationModalSelectedPeer:Object},emits:["refresh"],setup(i,{emit:t}){const e=t,s=_t(()=>xt(()=>import("./peerShareLinkModal-QPXBoQ7C.js"),__vite__mapDeps([0,1,2,3,4,5]))),n=_t(()=>xt(()=>import("./peerJobs-DVgoNfVt.js"),__vite__mapDeps([6,7,1,2,4,3,5,8,9]))),o=_t(()=>xt(()=>import("./peerQRCode-DDkOBj-3.js"),__vite__mapDeps([10,11,5,1,2]))),r=_t(()=>xt(()=>import("./peerConfigurationFile-lWLWU3l5.js"),__vite__mapDeps([12,1,2,5,11,13]))),a=_t(()=>xt(()=>import("./peerSettings-jMO8Y4z7.js"),__vite__mapDeps([14,1,2,5,15])));return(l,c)=>(O(),N(yi,{name:"zoom"},{default:Et(()=>[i.configurationModals.peerSetting.modalOpen?(O(),N(Z(a),{key:"PeerSettingsModal",selectedPeer:i.configurationModalSelectedPeer,onRefresh:c[0]||(c[0]=h=>e("refresh")),onClose:c[1]||(c[1]=h=>i.configurationModals.peerSetting.modalOpen=!1)},null,8,["selectedPeer"])):W("",!0),i.configurationModals.peerQRCode.modalOpen?(O(),N(Z(o),{key:"PeerQRCodeModal",selectedPeer:i.configurationModalSelectedPeer,onClose:c[2]||(c[2]=h=>i.configurationModals.peerQRCode.modalOpen=!1)},null,8,["selectedPeer"])):W("",!0),i.configurationModals.peerScheduleJobs.modalOpen?(O(),N(Z(n),{key:"PeerJobsModal",onRefresh:c[3]||(c[3]=h=>e("refresh")),selectedPeer:i.configurationModalSelectedPeer,onClose:c[4]||(c[4]=h=>i.configurationModals.peerScheduleJobs.modalOpen=!1)},null,8,["selectedPeer"])):W("",!0),i.configurationModals.peerShare.modalOpen?(O(),N(Z(s),{key:"PeerShareLinkModal",onClose:c[5]||(c[5]=h=>{i.configurationModals.peerShare.modalOpen=!1}),selectedPeer:i.configurationModalSelectedPeer},null,8,["selectedPeer"])):W("",!0),i.configurationModals.peerConfigurationFile.modalOpen?(O(),N(Z(r),{key:4,onClose:c[6]||(c[6]=h=>i.configurationModals.peerConfigurationFile.modalOpen=!1),selectedPeer:i.configurationModalSelectedPeer},null,8,["selectedPeer"])):W("",!0)]),_:1}))}},wd={class:"container-fluid"},Sd={class:"d-flex align-items-sm-center flex-column flex-sm-row gap-3"},kd={class:"text-muted d-flex align-items-center gap-2"},Md={class:"mb-0"},Pd={class:"d-flex align-items-center gap-3"},Cd={class:"mb-0 display-4"},Od={class:"ms-sm-auto d-flex gap-2 flex-column"},Dd={class:"card rounded-3 bg-transparent"},Td={class:"card-body py-2 d-flex align-items-center"},Ad={class:"text-muted"},Ld={class:"form-check form-switch mb-0 ms-auto pe-0 me-0"},Rd=["for"],Id={key:2,class:"spinner-border spinner-border-sm ms-2","aria-hidden":"true"},Ed=["disabled","id"],Fd={class:"d-flex gap-2"},zd={class:"row mt-3 gy-2 gx-2 mb-2"},Bd={class:"col-12 col-lg-3"},$d={class:"card rounded-3 bg-transparent h-100"},Hd={class:"card-body py-2 d-flex flex-column justify-content-center"},Wd={class:"mb-0 text-muted"},Nd={class:"col-12 col-lg-3"},Vd={class:"card rounded-3 bg-transparent h-100"},jd={class:"card-body py-2 d-flex flex-column justify-content-center"},Ud={class:"mb-0 text-muted"},Yd={style:{"word-break":"break-all"},class:"col-12 col-lg-6"},Xd={class:"card rounded-3 bg-transparent h-100"},Kd={class:"card-body py-2 d-flex flex-column justify-content-center"},qd={class:"mb-0 text-muted"},Gd={class:"row gx-2 gy-2 mb-2"},Jd={class:"col-12 col-lg-3"},Qd={class:"card rounded-3 bg-transparent h-100"},Zd={class:"card-body d-flex"},tu={class:"mb-0 text-muted"},eu={class:"h4"},iu={class:"col-12 col-lg-3"},su={class:"card rounded-3 bg-transparent h-100"},nu={class:"card-body d-flex"},ou={class:"mb-0 text-muted"},ru={class:"h4"},au={class:"col-12 col-lg-3"},lu={class:"card rounded-3 bg-transparent h-100"},cu={class:"card-body d-flex"},hu={class:"mb-0 text-muted"},du={class:"h4 text-primary"},uu={class:"col-12 col-lg-3"},fu={class:"card rounded-3 bg-transparent h-100"},gu={class:"card-body d-flex"},pu={class:"mb-0 text-muted"},mu={class:"h4 text-success"},bu={style:{"margin-bottom":"80px"}},ku={__name:"peerListNew",async setup(i){let t,e;const s=_t(()=>xt(()=>import("./peerSearchBar-CBbXC57S.js"),__vite__mapDeps([16,1,2,5,17]))),n=_t(()=>xt(()=>import("./peerJobsAllModal-BO5GLO3N.js"),__vite__mapDeps([18,7,1,2,4,3,5,8]))),o=_t(()=>xt(()=>import("./peerJobsLogsModal-CBhltKU6.js"),__vite__mapDeps([19,3,1,2,5]))),r=_t(()=>xt(()=>import("./editConfiguration-CfiGsPt6.js"),__vite__mapDeps([20,1,2,5,3,21]))),a=ti(),l=pn(),c=vo(),h=q({}),d=q([]),u=q(!1),f=q({}),g=q({peerSetting:{modalOpen:!1},peerScheduleJobs:{modalOpen:!1},peerQRCode:{modalOpen:!1},peerConfigurationFile:{modalOpen:!1},peerCreate:{modalOpen:!1},peerScheduleJobsAll:{modalOpen:!1},peerScheduleJobsLogs:{modalOpen:!1},peerShare:{modalOpen:!1},editConfiguration:{modalOpen:!1},selectPeers:{modalOpen:!1},backupRestore:{modalOpen:!1},deleteConfiguration:{modalOpen:!1},editRawConfigurationFile:{modalOpen:!1}}),p=q(!1),b=async()=>{await Gt("/api/getWireguardConfigurationInfo",{configurationName:c.params.id},y=>{y.status&&(h.value=y.data.configurationInfo,d.value=y.data.configurationPeers,d.value.forEach(_=>{_.restricted=!1}),y.data.configurationRestrictedPeers.forEach(_=>{_.restricted=!0,d.value.push(_)}))})};[t,e]=_o(()=>b()),await t,e();const x=q(void 0),v=()=>{clearInterval(x.value),x.value=setInterval(async()=>{await b()},parseInt(a.Configuration.Server.dashboard_refresh_interval))};v(),gn(()=>{clearInterval(x.value),x.value=void 0}),_e(()=>a.Configuration.Server.dashboard_refresh_interval,()=>{v()});const S=async()=>{u.value=!0,await Gt("/api/toggleWireguardConfiguration/",{configurationName:h.value.Name},y=>{y.status?a.newMessage("Server",`${h.value.Name} ${y.data?"is on":"is off"}`,"success"):a.newMessage("Server",y.message,"danger"),l.Configurations.find(_=>_.Name===h.value.Name).Status=y.data,h.value.Status=y.data,u.value=!1})},k=It(()=>({connectedPeers:d.value.filter(y=>y.status==="running").length,totalUsage:d.value.length>0?d.value.filter(y=>!y.restricted).map(y=>y.total_data+y.cumu_data).reduce((y,_)=>y+_,0).toFixed(4):0,totalReceive:d.value.length>0?d.value.filter(y=>!y.restricted).map(y=>y.total_receive+y.cumu_receive).reduce((y,_)=>y+_,0).toFixed(4):0,totalSent:d.value.length>0?d.value.filter(y=>!y.restricted).map(y=>y.total_sent+y.cumu_sent).reduce((y,_)=>y+_,0).toFixed(4):0})),w=q(10),P=It(()=>{const y=l.searchString?d.value.filter(_=>_.name.includes(l.searchString)||_.id.includes(l.searchString)||_.allowed_ip.includes(l.searchString)):d.value;return a.Configuration.Server.dashboard_sort==="restricted"?y.sort((_,C)=>_[a.Configuration.Server.dashboard_sort]C[a.Configuration.Server.dashboard_sort]?-1:0).slice(0,w.value):y.sort((_,C)=>_[a.Configuration.Server.dashboard_sort]C[a.Configuration.Server.dashboard_sort]?1:0).slice(0,w.value)});return(y,_)=>{const C=Jt("RouterLink");return O(),E("div",wd,[m("div",Sd,[m("div",null,[m("div",kd,[m("h5",Md,[D(wo,{protocol:h.value.Protocol},null,8,["protocol"])])]),m("div",Pd,[m("h1",Cd,[m("samp",null,B(h.value.Name),1)])])]),m("div",Od,[m("div",Dd,[m("div",Td,[m("small",Ad,[D(j,{t:"Status"})]),m("div",{class:St(["dot ms-2",{active:h.value.Status}])},null,2),m("div",Ld,[m("label",{class:"form-check-label",style:{cursor:"pointer"},for:"switch"+h.value.id},[h.value.Status&&!u.value?(O(),N(j,{key:0,t:"On"})):!h.value.Status&&!u.value?(O(),N(j,{key:1,t:"Off"})):W("",!0),u.value?(O(),E("span",Id)):W("",!0)],8,Rd),xo(m("input",{class:"form-check-input",style:{cursor:"pointer"},disabled:u.value,type:"checkbox",role:"switch",id:"switch"+h.value.id,onChange:_[0]||(_[0]=M=>S()),"onUpdate:modelValue":_[1]||(_[1]=M=>h.value.Status=M)},null,40,Ed),[[yo,h.value.Status]])])])]),m("div",Fd,[D(C,{to:"create",class:"titleBtn py-2 text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle"},{default:Et(()=>[_[23]||(_[23]=m("i",{class:"bi bi-plus-lg me-2"},null,-1)),D(j,{t:"Peer"})]),_:1}),m("button",{class:"titleBtn py-2 text-decoration-none btn text-primary-emphasis bg-primary-subtle rounded-3 border-1 border-primary-subtle",onClick:_[2]||(_[2]=M=>g.value.editConfiguration.modalOpen=!0),type:"button","aria-expanded":"false"},[_[24]||(_[24]=m("i",{class:"bi bi-gear-fill me-2"},null,-1)),D(j,{t:"Configuration Settings"})])])])]),_[29]||(_[29]=m("hr",null,null,-1)),m("div",zd,[m("div",Bd,[m("div",$d,[m("div",Hd,[m("p",Wd,[m("small",null,[D(j,{t:"Address"})])]),$t(" "+B(h.value.Address),1)])])]),m("div",Nd,[m("div",Vd,[m("div",jd,[m("p",Ud,[m("small",null,[D(j,{t:"Listen Port"})])]),$t(" "+B(h.value.ListenPort),1)])])]),m("div",Yd,[m("div",Xd,[m("div",Kd,[m("p",qd,[m("small",null,[D(j,{t:"Public Key"})])]),m("samp",null,B(h.value.PublicKey),1)])])])]),m("div",Gd,[m("div",Jd,[m("div",Qd,[m("div",Zd,[m("div",null,[m("p",tu,[m("small",null,[D(j,{t:"Connected Peers"})])]),m("strong",eu,B(k.value.connectedPeers)+" / "+B(d.value.length),1)]),_[25]||(_[25]=m("i",{class:"bi bi-ethernet ms-auto h2 text-muted"},null,-1))])])]),m("div",iu,[m("div",su,[m("div",nu,[m("div",null,[m("p",ou,[m("small",null,[D(j,{t:"Total Usage"})])]),m("strong",ru,B(k.value.totalUsage)+" GB",1)]),_[26]||(_[26]=m("i",{class:"bi bi-arrow-down-up ms-auto h2 text-muted"},null,-1))])])]),m("div",au,[m("div",lu,[m("div",cu,[m("div",null,[m("p",hu,[m("small",null,[D(j,{t:"Total Received"})])]),m("strong",du,B(k.value.totalReceive)+" GB",1)]),_[27]||(_[27]=m("i",{class:"bi bi-arrow-down ms-auto h2 text-muted"},null,-1))])])]),m("div",uu,[m("div",fu,[m("div",gu,[m("div",null,[m("p",pu,[m("small",null,[D(j,{t:"Total Sent"})])]),m("strong",mu,B(k.value.totalSent)+" GB",1)]),_[28]||(_[28]=m("i",{class:"bi bi-arrow-up ms-auto h2 text-muted"},null,-1))])])])]),D(hh,{configurationPeers:d.value,configurationInfo:h.value},null,8,["configurationPeers","configurationInfo"]),_[30]||(_[30]=m("hr",null,null,-1)),m("div",bu,[D(Dh,{onSearch:_[3]||(_[3]=M=>p.value=!0),onJobsAll:_[4]||(_[4]=M=>g.value.peerScheduleJobsAll.modalOpen=!0),onJobLogs:_[5]||(_[5]=M=>g.value.peerScheduleJobsLogs.modalOpen=!0),onEditConfiguration:_[6]||(_[6]=M=>g.value.editConfiguration.modalOpen=!0),onSelectPeers:_[7]||(_[7]=M=>g.value.selectPeers.modalOpen=!0),onBackupRestore:_[8]||(_[8]=M=>g.value.backupRestore.modalOpen=!0),onDeleteConfiguration:_[9]||(_[9]=M=>g.value.deleteConfiguration.modalOpen=!0),configuration:h.value},null,8,["configuration"]),D(yi,{name:"peerList",tag:"div",class:"row gx-2 gy-2 z-0 position-relative"},{default:Et(()=>[(O(!0),E(Xt,null,xi(P.value,M=>(O(),E("div",{class:"col-12 col-lg-6 col-xl-4",key:M.id},[D(yd,{Peer:M,onShare:T=>{g.value.peerShare.modalOpen=!0,f.value=M},onRefresh:_[10]||(_[10]=T=>b()),onJobs:T=>{g.value.peerScheduleJobs.modalOpen=!0,f.value=M},onSetting:T=>{g.value.peerSetting.modalOpen=!0,f.value=M},onQrcode:T=>{f.value=M,g.value.peerQRCode.modalOpen=!0},onConfigurationFile:T=>{f.value=M,g.value.peerConfigurationFile.modalOpen=!0}},null,8,["Peer","onShare","onJobs","onSetting","onQrcode","onConfigurationFile"])]))),128))]),_:1})]),D(Di,{name:"slideUp"},{default:Et(()=>[p.value?(O(),N(Z(s),{key:0,onClose:_[11]||(_[11]=M=>p.value=!1)})):W("",!0)]),_:1}),D(vd,{configurationModals:g.value,configurationModalSelectedPeer:f.value,onRefresh:_[12]||(_[12]=M=>b())},null,8,["configurationModals","configurationModalSelectedPeer"]),D(yi,{name:"zoom"},{default:Et(()=>[g.value.peerScheduleJobsAll.modalOpen?(O(),N(Z(n),{key:"PeerJobsAllModal",onRefresh:_[13]||(_[13]=M=>b()),onAllLogs:_[14]||(_[14]=M=>g.value.peerScheduleJobsLogs.modalOpen=!0),onClose:_[15]||(_[15]=M=>g.value.peerScheduleJobsAll.modalOpen=!1),configurationPeers:d.value},null,8,["configurationPeers"])):W("",!0),g.value.peerScheduleJobsLogs.modalOpen?(O(),N(Z(o),{key:"PeerJobsLogsModal",onClose:_[16]||(_[16]=M=>g.value.peerScheduleJobsLogs.modalOpen=!1),configurationInfo:h.value},null,8,["configurationInfo"])):W("",!0),g.value.editConfiguration.modalOpen?(O(),N(Z(r),{key:"EditConfigurationModal",onEditRaw:_[17]||(_[17]=M=>g.value.editRawConfigurationFile.modalOpen=!0),onClose:_[18]||(_[18]=M=>g.value.editConfiguration.modalOpen=!1),onDataChanged:_[19]||(_[19]=M=>h.value=M),onRefresh:_[20]||(_[20]=M=>b()),onBackupRestore:_[21]||(_[21]=M=>g.value.backupRestore.modalOpen=!0),onDeleteConfiguration:_[22]||(_[22]=M=>g.value.deleteConfiguration.modalOpen=!0),configurationInfo:h.value},null,8,["configurationInfo"])):W("",!0)]),_:1})])}}};export{ku as default};