Refactoring complet du plugin analytics : remplacement de la section avec template Vue inline par un custom field compilé avec kirbyup. Dashboard avec KPIs, line chart Chart.js et filtres par date. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
18 lines
154 KiB
JavaScript
18 lines
154 KiB
JavaScript
var Rl=Object.defineProperty;var El=(X,N,q)=>N in X?Rl(X,N,{enumerable:!0,configurable:!0,writable:!0,value:q}):X[N]=q;var S=(X,N,q)=>El(X,typeof N!="symbol"?N+"":N,q);(function(){"use strict";/*!
|
|
* @kurkle/color v0.3.4
|
|
* https://github.com/kurkle/color#readme
|
|
* (c) 2024 Jukka Kurkela
|
|
* Released under the MIT License
|
|
*/function X(i){return i+.5|0}const N=(i,t,e)=>Math.max(Math.min(i,e),t);function q(i){return N(X(i*2.55),0,255)}function lt(i){return N(X(i*255),0,255)}function st(i){return N(X(i/2.55)/100,0,1)}function mi(i){return N(X(i*100),0,100)}const $={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},Le=[..."0123456789ABCDEF"],bn=i=>Le[i&15],_n=i=>Le[(i&240)>>4]+Le[i&15],Jt=i=>(i&240)>>4===(i&15),yn=i=>Jt(i.r)&&Jt(i.g)&&Jt(i.b)&&Jt(i.a);function xn(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&$[i[1]]*17,g:255&$[i[2]]*17,b:255&$[i[3]]*17,a:t===5?$[i[4]]*17:255}:(t===7||t===9)&&(e={r:$[i[1]]<<4|$[i[2]],g:$[i[3]]<<4|$[i[4]],b:$[i[5]]<<4|$[i[6]],a:t===9?$[i[7]]<<4|$[i[8]]:255})),e}const vn=(i,t)=>i<255?t(i):"";function kn(i){var t=yn(i)?bn:_n;return i?"#"+t(i.r)+t(i.g)+t(i.b)+vn(i.a,t):void 0}const wn=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function bi(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 Mn(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 Sn(i,t,e){const s=bi(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 Dn(i,t,e,s,n){return i===n?(t-e)/s+(t<e?6:0):t===n?(e-i)/s+2:(i-t)/s+4}function Fe(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),r=Math.min(e,s,n),a=(o+r)/2;let l,c,h;return o!==r&&(h=o-r,c=a>.5?h/(2-o-r):h/(o+r),l=Dn(e,s,n,h,o),l=l*60+.5),[l|0,c||0,a]}function Re(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(lt)}function Ee(i,t,e){return Re(bi,i,t,e)}function Pn(i,t,e){return Re(Sn,i,t,e)}function On(i,t,e){return Re(Mn,i,t,e)}function _i(i){return(i%360+360)%360}function Cn(i){const t=wn.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?q(+t[5]):lt(+t[5]));const n=_i(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?s=Pn(n,o,r):t[1]==="hsv"?s=On(n,o,r):s=Ee(n,o,r),{r:s[0],g:s[1],b:s[2],a:e}}function Tn(i,t){var e=Fe(i);e[0]=_i(e[0]+t),e=Ee(e),i.r=e[0],i.g=e[1],i.b=e[2]}function An(i){if(!i)return;const t=Fe(i),e=t[0],s=mi(t[1]),n=mi(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${st(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const yi={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"},xi={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 In(){const i={},t=Object.keys(xi),e=Object.keys(yi);let s,n,o,r,a;for(s=0;s<t.length;s++){for(r=a=t[s],n=0;n<e.length;n++)o=e[n],a=a.replace(o,yi[o]);o=parseInt(xi[r],16),i[a]=[o>>16&255,o>>8&255,o&255]}return i}let te;function Ln(i){te||(te=In(),te.transparent=[0,0,0,0]);const t=te[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Fn=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Rn(i){const t=Fn.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const r=+t[7];e=t[8]?q(r):N(r*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?q(s):N(s,0,255)),n=255&(t[4]?q(n):N(n,0,255)),o=255&(t[6]?q(o):N(o,0,255)),{r:s,g:n,b:o,a:e}}}function En(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${st(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const ze=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Pt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function zn(i,t,e){const s=Pt(st(i.r)),n=Pt(st(i.g)),o=Pt(st(i.b));return{r:lt(ze(s+e*(Pt(st(t.r))-s))),g:lt(ze(n+e*(Pt(st(t.g))-n))),b:lt(ze(o+e*(Pt(st(t.b))-o))),a:i.a+e*(t.a-i.a)}}function ee(i,t,e){if(i){let s=Fe(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ee(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function vi(i,t){return i&&Object.assign(t||{},i)}function ki(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=lt(i[3]))):(t=vi(i,{r:0,g:0,b:0,a:1}),t.a=lt(t.a)),t}function Bn(i){return i.charAt(0)==="r"?Rn(i):Cn(i)}class Ft{constructor(t){if(t instanceof Ft)return t;const e=typeof t;let s;e==="object"?s=ki(t):e==="string"&&(s=xn(t)||Ln(t)||Bn(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=vi(this._rgb);return t&&(t.a=st(t.a)),t}set rgb(t){this._rgb=ki(t)}rgbString(){return this._valid?En(this._rgb):void 0}hexString(){return this._valid?kn(this._rgb):void 0}hslString(){return this._valid?An(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=zn(this._rgb,t._rgb,e)),this}clone(){return new Ft(this.rgb)}alpha(t){return this._rgb.a=lt(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=X(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 ee(this._rgb,2,t),this}darken(t){return ee(this._rgb,2,-t),this}saturate(t){return ee(this._rgb,1,t),this}desaturate(t){return ee(this._rgb,1,-t),this}rotate(t){return Tn(this._rgb,t),this}}/*!
|
|
* Chart.js v4.5.1
|
|
* https://www.chartjs.org
|
|
* (c) 2025 Chart.js Contributors
|
|
* Released under the MIT License
|
|
*/function nt(){}const Nn=(()=>{let i=0;return()=>i++})();function T(i){return i==null}function z(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 D(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function V(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function G(i,t){return V(i)?i:t}function C(i,t){return typeof i>"u"?t:i}const Vn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function A(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function O(i,t,e,s){let n,o,r;if(z(i))for(o=i.length,n=0;n<o;n++)t.call(e,i[n],n);else if(D(i))for(r=Object.keys(i),o=r.length,n=0;n<o;n++)t.call(e,i[r[n]],r[n])}function ie(i,t){let e,s,n,o;if(!i||!t||i.length!==t.length)return!1;for(e=0,s=i.length;e<s;++e)if(n=i[e],o=t[e],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function se(i){if(z(i))return i.map(se);if(D(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=se(i[e[n]]);return t}return i}function wi(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function jn(i,t,e,s){if(!wi(i))return;const n=t[i],o=e[i];D(n)&&D(o)?Rt(n,o,s):t[i]=se(o)}function Rt(i,t,e){const s=z(t)?t:[t],n=s.length;if(!D(i))return i;e=e||{};const o=e.merger||jn;let r;for(let a=0;a<n;++a){if(r=s[a],!D(r))continue;const l=Object.keys(r);for(let c=0,h=l.length;c<h;++c)o(l[c],i,r,e)}return i}function Et(i,t){return Rt(i,t,{merger:Hn})}function Hn(i,t,e){if(!wi(i))return;const s=t[i],n=e[i];D(s)&&D(n)?Et(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=se(n))}const Mi={"":i=>i,x:i=>i.x,y:i=>i.y};function Wn(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 $n(i){const t=Wn(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function ne(i,t){return(Mi[t]||(Mi[t]=$n(t)))(i)}function Be(i){return i.charAt(0).toUpperCase()+i.slice(1)}const oe=i=>typeof i<"u",ct=i=>typeof i=="function",Si=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function Yn(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const j=Math.PI,Z=2*j,Un=Z+j,re=Number.POSITIVE_INFINITY,Xn=j/180,K=j/2,gt=j/4,Di=j*2/3,Pi=Math.log10,Ot=Math.sign;function zt(i,t,e){return Math.abs(i-t)<e}function Oi(i){const t=Math.round(i);i=zt(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(Pi(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function Kn(i){const t=[],e=Math.sqrt(i);let s;for(s=1;s<e;s++)i%s===0&&(t.push(s),t.push(i/s));return e===(e|0)&&t.push(e),t.sort((n,o)=>n-o).pop(),t}function qn(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function Bt(i){return!qn(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function Gn(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function Zn(i,t,e){let s,n,o;for(s=0,n=i.length;s<n;s++)o=i[s][e],isNaN(o)||(t.min=Math.min(t.min,o),t.max=Math.max(t.max,o))}function pt(i){return i*(j/180)}function Qn(i){return i*(180/j)}function Ci(i){if(!V(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function Jn(i,t){const e=t.x-i.x,s=t.y-i.y,n=Math.sqrt(e*e+s*s);let o=Math.atan2(s,e);return o<-.5*j&&(o+=Z),{angle:o,distance:n}}function Ne(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function to(i,t){return(i-t+Un)%Z-j}function Q(i){return(i%Z+Z)%Z}function Ti(i,t,e,s){const n=Q(i),o=Q(t),r=Q(e),a=Q(o-n),l=Q(r-n),c=Q(n-o),h=Q(n-r);return n===o||n===r||s&&o===r||a>l&&c<h}function Y(i,t,e){return Math.max(t,Math.min(e,i))}function eo(i){return Y(i,-32768,32767)}function Ai(i,t,e,s=1e-6){return i>=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function Ve(i,t,e){e=e||(r=>i[r]<t);let s=i.length-1,n=0,o;for(;s-n>1;)o=n+s>>1,e(o)?n=o:s=o;return{lo:n,hi:s}}const mt=(i,t,e,s)=>Ve(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),io=(i,t,e)=>Ve(i,e,s=>i[s][t]>=e);function so(i,t,e){let s=0,n=i.length;for(;s<n&&i[s]<t;)s++;for(;n>s&&i[n-1]>e;)n--;return s>0||n<i.length?i.slice(s,n):i}const Ii=["push","pop","shift","splice","unshift"];function no(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),Ii.forEach(e=>{const s="_onData"+Be(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 Li(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)&&(Ii.forEach(o=>{delete i[o]}),delete i._chartjs)}function oo(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Fi=(function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame})();function Ri(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Fi.call(window,()=>{s=!1,i.apply(t,e)}))}}function ro(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const ao=i=>i==="start"?"left":i==="end"?"right":"center",Ei=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2;function lo(i,t,e){const s=t.length;let n=0,o=s;if(i._sorted){const{iScale:r,vScale:a,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,h=r.axis,{min:f,max:d,minDefined:u,maxDefined:m}=r.getUserBounds();if(u){if(n=Math.min(mt(l,h,f).lo,e?s:mt(t,h,r.getPixelForValue(f)).lo),c){const g=l.slice(0,n+1).reverse().findIndex(p=>!T(p[a.axis]));n-=Math.max(0,g)}n=Y(n,0,s-1)}if(m){let g=Math.max(mt(l,r.axis,d,!0).hi+1,e?0:mt(t,h,r.getPixelForValue(d),!0).hi+1);if(c){const p=l.slice(g-1).findIndex(b=>!T(b[a.axis]));g+=Math.max(0,p)}o=Y(g,n,s)-n}else o=s-n}return{start:n,count:o}}function co(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 ae=i=>i===0||i===1,zi=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*Z/e)),Bi=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*Z/e)+1,Nt={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*K)+1,easeOutSine:i=>Math.sin(i*K),easeInOutSine:i=>-.5*(Math.cos(j*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=>ae(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=>ae(i)?i:zi(i,.075,.3),easeOutElastic:i=>ae(i)?i:Bi(i,.075,.3),easeInOutElastic(i){return ae(i)?i:i<.5?.5*zi(i*2,.1125,.45):.5+.5*Bi(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-Nt.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?Nt.easeInBounce(i*2)*.5:Nt.easeOutBounce(i*2-1)*.5+.5};function je(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Ni(i){return je(i)?i:new Ft(i)}function He(i){return je(i)?i:new Ft(i).saturate(.5).darken(.1).hexString()}const ho=["x","y","borderWidth","radius","tension"],fo=["color","borderColor","backgroundColor"];function uo(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:fo},numbers:{type:"number",properties:ho}}),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 go(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const Vi=new Map;function po(i,t){t=t||{};const e=i+JSON.stringify(t);let s=Vi.get(e);return s||(s=new Intl.NumberFormat(i,t),Vi.set(e,s)),s}function ji(i,t,e){return po(t,e).format(i)}const mo={values(i){return z(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=bo(i,e)}const r=Pi(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),ji(i,s,l)}};function bo(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 Hi={formatters:mo};function _o(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:Hi.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 bt=Object.create(null),We=Object.create(null);function Vt(i,t){if(!t)return i;const e=t.split(".");for(let s=0,n=e.length;s<n;++s){const o=e[s];i=i[o]||(i[o]=Object.create(null))}return i}function $e(i,t,e){return typeof t=="string"?Rt(Vt(i,t),e):Rt(Vt(i,""),t)}class yo{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=s=>s.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)=>He(n.backgroundColor),this.hoverBorderColor=(s,n)=>He(n.borderColor),this.hoverColor=(s,n)=>He(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 $e(this,t,e)}get(t){return Vt(this,t)}describe(t,e){return $e(We,t,e)}override(t,e){return $e(bt,t,e)}route(t,e,s,n){const o=Vt(this,t),r=Vt(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 D(l)?Object.assign({},c,l):C(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}}var R=new yo({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[uo,go,_o]);function xo(i){return!i||T(i.size)||T(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Wi(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 _t(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 $i(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function Ye(i,t,e,s){vo(i,t,e,s)}function vo(i,t,e,s,n){let o,r,a,l,c,h,f,d;const u=t.pointStyle,m=t.rotation,g=t.radius;let p=(m||0)*Xn;if(u&&typeof u=="object"&&(o=u.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(p),i.drawImage(u,-u.width/2,-u.height/2,u.width,u.height),i.restore();return}if(!(isNaN(g)||g<=0)){switch(i.beginPath(),u){default:i.arc(e,s,g,0,Z),i.closePath();break;case"triangle":h=g,i.moveTo(e+Math.sin(p)*h,s-Math.cos(p)*g),p+=Di,i.lineTo(e+Math.sin(p)*h,s-Math.cos(p)*g),p+=Di,i.lineTo(e+Math.sin(p)*h,s-Math.cos(p)*g),i.closePath();break;case"rectRounded":c=g*.516,l=g-c,r=Math.cos(p+gt)*l,f=Math.cos(p+gt)*l,a=Math.sin(p+gt)*l,d=Math.sin(p+gt)*l,i.arc(e-f,s-a,c,p-j,p-K),i.arc(e+d,s-r,c,p-K,p),i.arc(e+f,s+a,c,p,p+K),i.arc(e-d,s+r,c,p+K,p+j),i.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*g,h=l,i.rect(e-h,s-l,2*h,2*l);break}p+=gt;case"rectRot":f=Math.cos(p)*g,r=Math.cos(p)*g,a=Math.sin(p)*g,d=Math.sin(p)*g,i.moveTo(e-f,s-a),i.lineTo(e+d,s-r),i.lineTo(e+f,s+a),i.lineTo(e-d,s+r),i.closePath();break;case"crossRot":p+=gt;case"cross":f=Math.cos(p)*g,r=Math.cos(p)*g,a=Math.sin(p)*g,d=Math.sin(p)*g,i.moveTo(e-f,s-a),i.lineTo(e+f,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r);break;case"star":f=Math.cos(p)*g,r=Math.cos(p)*g,a=Math.sin(p)*g,d=Math.sin(p)*g,i.moveTo(e-f,s-a),i.lineTo(e+f,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r),p+=gt,f=Math.cos(p)*g,r=Math.cos(p)*g,a=Math.sin(p)*g,d=Math.sin(p)*g,i.moveTo(e-f,s-a),i.lineTo(e+f,s+a),i.moveTo(e+d,s-r),i.lineTo(e-d,s+r);break;case"line":r=Math.cos(p)*g,a=Math.sin(p)*g,i.moveTo(e-r,s-a),i.lineTo(e+r,s+a);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(p)*g,s+Math.sin(p)*g);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function jt(i,t,e){return e=e||.5,!t||i&&i.x>t.left-e&&i.x<t.right+e&&i.y>t.top-e&&i.y<t.bottom+e}function Ue(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function Xe(i){i.restore()}function ko(i,t,e,s,n){if(!t)return i.lineTo(e.x,e.y);if(n==="middle"){const o=(t.x+e.x)/2;i.lineTo(o,t.y),i.lineTo(o,e.y)}else n==="after"!=!!s?i.lineTo(t.x,e.y):i.lineTo(e.x,t.y);i.lineTo(e.x,e.y)}function wo(i,t,e,s){if(!t)return i.lineTo(e.x,e.y);i.bezierCurveTo(s?t.cp1x:t.cp2x,s?t.cp1y:t.cp2y,s?e.cp2x:e.cp1x,s?e.cp2y:e.cp1y,e.x,e.y)}function Mo(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),T(t.rotation)||i.rotate(t.rotation),t.color&&(i.fillStyle=t.color),t.textAlign&&(i.textAlign=t.textAlign),t.textBaseline&&(i.textBaseline=t.textBaseline)}function So(i,t,e,s,n){if(n.strikethrough||n.underline){const o=i.measureText(s),r=t-o.actualBoundingBoxLeft,a=t+o.actualBoundingBoxRight,l=e-o.actualBoundingBoxAscent,c=e+o.actualBoundingBoxDescent,h=n.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=n.decorationWidth||2,i.moveTo(r,h),i.lineTo(a,h),i.stroke()}}function Do(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function Yi(i,t,e,s,n,o={}){const r=z(t)?t:[t],a=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,Mo(i,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Do(i,o.backdrop),a&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),T(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,s,o.maxWidth)),i.fillText(c,e,s,o.maxWidth),So(i,e,s,c,o),s+=Number(n.lineHeight);i.restore()}function Ui(i,t){const{x:e,y:s,w:n,h:o,radius:r}=t;i.arc(e+r.topLeft,s+r.topLeft,r.topLeft,1.5*j,j,!0),i.lineTo(e,s+o-r.bottomLeft),i.arc(e+r.bottomLeft,s+o-r.bottomLeft,r.bottomLeft,j,K,!0),i.lineTo(e+n-r.bottomRight,s+o),i.arc(e+n-r.bottomRight,s+o-r.bottomRight,r.bottomRight,K,0,!0),i.lineTo(e+n,s+r.topRight),i.arc(e+n-r.topRight,s+r.topRight,r.topRight,0,-K,!0),i.lineTo(e+r.topLeft,s)}const Po=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Oo=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Co(i,t){const e=(""+i).match(Po);if(!e||e[1]==="normal")return t*1.2;switch(i=+e[2],e[3]){case"px":return i;case"%":i/=100;break}return t*i}const To=i=>+i||0;function Xi(i,t){const e={},s=D(t),n=s?Object.keys(t):t,o=D(i)?s?r=>C(i[r],i[t[r]]):r=>i[r]:()=>i;for(const r of n)e[r]=To(o(r));return e}function Ao(i){return Xi(i,{top:"y",right:"x",bottom:"y",left:"x"})}function le(i){return Xi(i,["topLeft","topRight","bottomLeft","bottomRight"])}function ht(i){const t=Ao(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function J(i,t){i=i||{},t=t||R.font;let e=C(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=C(i.style,t.style);s&&!(""+s).match(Oo)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:C(i.family,t.family),lineHeight:Co(C(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:C(i.weight,t.weight),string:""};return n.string=xo(n),n}function ce(i,t,e,s){let n,o,r;for(n=0,o=i.length;n<o;++n)if(r=i[n],r!==void 0&&r!==void 0)return r}function Io(i,t,e){const{min:s,max:n}=i,o=Vn(t,(n-s)/2),r=(a,l)=>e&&a===0?0:a+l;return{min:r(s,-Math.abs(o)),max:r(n,o)}}function yt(i,t){return Object.assign(Object.create(i),t)}function Ke(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=Qi("_fallback",i));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:a=>Ke([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 qi(a,l,()=>Vo(l,t,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return Ji(a).includes(l)},ownKeys(a){return Ji(a)},set(a,l,c){const h=a._storage||(a._storage=n());return a[l]=h[l]=c,delete a._keys,!0}})}function Ct(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:Ki(i,s),setContext:o=>Ct(i,o,e,s),override:o=>Ct(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 qi(o,r,()=>Fo(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 Ki(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:ct(e)?e:()=>e,isIndexable:ct(s)?s:()=>s}}const Lo=(i,t)=>i?i+Be(t):t,qe=(i,t)=>D(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function qi(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function Fo(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:r}=i;let a=s[t];return ct(a)&&r.isScriptable(t)&&(a=Ro(t,a,i,e)),z(a)&&a.length&&(a=Eo(t,a,i,r.isIndexable)),qe(t,a)&&(a=Ct(a,n,o&&o[t],r)),a}function Ro(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),qe(i,l)&&(l=Ge(n._scopes,n,i,l)),l}function Eo(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(D(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const f=Ge(c,n,i,h);t.push(Ct(f,o,r&&r[i],a))}}return t}function Gi(i,t,e){return ct(i)?i(t,e):i}const zo=(i,t)=>i===!0?t:typeof i=="string"?ne(t,i):void 0;function Bo(i,t,e,s,n){for(const o of t){const r=zo(e,o);if(r){i.add(r);const a=Gi(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 Ge(i,t,e,s){const n=t._rootScopes,o=Gi(t._fallback,e,s),r=[...i,...n],a=new Set;a.add(s);let l=Zi(a,r,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=Zi(a,r,o,l,s),l===null)?!1:Ke(Array.from(a),[""],n,o,()=>No(t,e,s))}function Zi(i,t,e,s,n){for(;e;)e=Bo(i,t,e,s,n);return e}function No(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return z(n)&&D(e)?e:n||{}}function Vo(i,t,e,s){let n;for(const o of t)if(n=Qi(Lo(o,i),e),typeof n<"u")return qe(i,n)?Ge(e,s,i,n):n}function Qi(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function Ji(i){let t=i._keys;return t||(t=i._keys=jo(i._scopes)),t}function jo(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 Ho=Number.EPSILON||1e-14,Tt=(i,t)=>t<i.length&&!i[t].skip&&i[t],ts=i=>i==="x"?"y":"x";function Wo(i,t,e,s){const n=i.skip?t:i,o=t,r=e.skip?t:e,a=Ne(o,n),l=Ne(r,o);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const f=s*c,d=s*h;return{previous:{x:o.x-f*(r.x-n.x),y:o.y-f*(r.y-n.y)},next:{x:o.x+d*(r.x-n.x),y:o.y+d*(r.y-n.y)}}}function $o(i,t,e){const s=i.length;let n,o,r,a,l,c=Tt(i,0);for(let h=0;h<s-1;++h)if(l=c,c=Tt(i,h+1),!(!l||!c)){if(zt(t[h],0,Ho)){e[h]=e[h+1]=0;continue}n=e[h]/t[h],o=e[h+1]/t[h],a=Math.pow(n,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),e[h]=n*r*t[h],e[h+1]=o*r*t[h])}}function Yo(i,t,e="x"){const s=ts(e),n=i.length;let o,r,a,l=Tt(i,0);for(let c=0;c<n;++c){if(r=a,a=l,l=Tt(i,c+1),!a)continue;const h=a[e],f=a[s];r&&(o=(h-r[e])/3,a[`cp1${e}`]=h-o,a[`cp1${s}`]=f-o*t[c]),l&&(o=(l[e]-h)/3,a[`cp2${e}`]=h+o,a[`cp2${s}`]=f+o*t[c])}}function Uo(i,t="x"){const e=ts(t),s=i.length,n=Array(s).fill(0),o=Array(s);let r,a,l,c=Tt(i,0);for(r=0;r<s;++r)if(a=l,l=c,c=Tt(i,r+1),!!l){if(c){const h=c[t]-l[t];n[r]=h!==0?(c[e]-l[e])/h:0}o[r]=a?c?Ot(n[r-1])!==Ot(n[r])?0:(n[r-1]+n[r])/2:n[r-1]:n[r]}$o(i,n,o),Yo(i,o,t)}function he(i,t,e){return Math.max(Math.min(i,e),t)}function Xo(i,t){let e,s,n,o,r,a=jt(i[0],t);for(e=0,s=i.length;e<s;++e)r=o,o=a,a=e<s-1&&jt(i[e+1],t),o&&(n=i[e],r&&(n.cp1x=he(n.cp1x,t.left,t.right),n.cp1y=he(n.cp1y,t.top,t.bottom)),a&&(n.cp2x=he(n.cp2x,t.left,t.right),n.cp2y=he(n.cp2y,t.top,t.bottom)))}function Ko(i,t,e,s,n){let o,r,a,l;if(t.spanGaps&&(i=i.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Uo(i,n);else{let c=s?i[i.length-1]:i[0];for(o=0,r=i.length;o<r;++o)a=i[o],l=Wo(c,a,i[Math.min(o+1,r-(s?0:1))%r],t.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}t.capBezierPoints&&Xo(i,e)}function Ze(){return typeof window<"u"&&typeof document<"u"}function Qe(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function fe(i,t,e){let s;return typeof i=="string"?(s=parseInt(i,10),i.indexOf("%")!==-1&&(s=s/100*t.parentNode[e])):s=i,s}const de=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function qo(i,t){return de(i).getPropertyValue(t)}const Go=["top","right","bottom","left"];function xt(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=Go[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const Zo=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function Qo(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let r=!1,a,l;if(Zo(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 vt(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=de(e),o=n.boxSizing==="border-box",r=xt(n,"padding"),a=xt(n,"border","width"),{x:l,y:c,box:h}=Qo(i,e),f=r.left+(h&&a.left),d=r.top+(h&&a.top);let{width:u,height:m}=t;return o&&(u-=r.width+a.width,m-=r.height+a.height),{x:Math.round((l-f)/u*e.width/s),y:Math.round((c-d)/m*e.height/s)}}function Jo(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&Qe(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const r=o.getBoundingClientRect(),a=de(o),l=xt(a,"border","width"),c=xt(a,"padding");t=r.width-c.width-l.width,e=r.height-c.height-l.height,s=fe(a.maxWidth,o,"clientWidth"),n=fe(a.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||re,maxHeight:n||re}}const ft=i=>Math.round(i*10)/10;function tr(i,t,e,s){const n=de(i),o=xt(n,"margin"),r=fe(n.maxWidth,i,"clientWidth")||re,a=fe(n.maxHeight,i,"clientHeight")||re,l=Jo(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const d=xt(n,"border","width"),u=xt(n,"padding");c-=u.width+d.width,h-=u.height+d.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=ft(Math.min(c,r,l.maxWidth)),h=ft(Math.min(h,a,l.maxHeight)),c&&!h&&(h=ft(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=ft(Math.floor(h*s))),{width:c,height:h}}function es(i,t,e){const s=t||1,n=ft(i.height*s),o=ft(i.width*s);i.height=ft(i.height),i.width=ft(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 er=(function(){let i=!1;try{const t={get passive(){return i=!0,!1}};Ze()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i})();function is(i,t){const e=qo(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function kt(i,t,e,s){return{x:i.x+e*(t.x-i.x),y:i.y+e*(t.y-i.y)}}function ir(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 sr(i,t,e,s){const n={x:i.cp2x,y:i.cp2y},o={x:t.cp1x,y:t.cp1y},r=kt(i,n,e),a=kt(n,o,e),l=kt(o,t,e),c=kt(r,a,e),h=kt(a,l,e);return kt(c,h,e)}const nr=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}}},or=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,t){return i+t},leftForLtr(i,t){return i}}};function Je(i,t,e){return i?nr(t,e):or()}function rr(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 ar(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}function ss(i){return i==="angle"?{between:Ti,compare:to,normalize:Q}:{between:Ai,compare:(t,e)=>t-e,normalize:t=>t}}function ns({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 lr(i,t,e){const{property:s,start:n,end:o}=e,{between:r,normalize:a}=ss(s),l=t.length;let{start:c,end:h,loop:f}=i,d,u;if(f){for(c+=l,h+=l,d=0,u=l;d<u&&r(a(t[c%l][s]),n,o);++d)c--,h--;c%=l,h%=l}return h<c&&(h+=l),{start:c,end:h,loop:f,style:i.style}}function os(i,t,e){if(!e)return[i];const{property:s,start:n,end:o}=e,r=t.length,{compare:a,between:l,normalize:c}=ss(s),{start:h,end:f,loop:d,style:u}=lr(i,t,e),m=[];let g=!1,p=null,b,y,v;const x=()=>l(n,v,b)&&a(n,v)!==0,_=()=>a(o,b)===0||l(o,v,b),M=()=>g||x(),k=()=>!g||_();for(let w=h,P=h;w<=f;++w)y=t[w%r],!y.skip&&(b=c(y[s]),b!==v&&(g=l(b,n,o),p===null&&M()&&(p=a(b,n)===0?w:P),p!==null&&k()&&(m.push(ns({start:p,end:w,loop:d,count:r,style:u})),p=null),P=w,v=b));return p!==null&&m.push(ns({start:p,end:f,loop:d,count:r,style:u})),m}function rs(i,t){const e=[],s=i.segments;for(let n=0;n<s.length;n++){const o=os(s[n],i.points,t);o.length&&e.push(...o)}return e}function cr(i,t,e,s){let n=0,o=t-1;if(e&&!s)for(;n<t&&!i[n].skip;)n++;for(;n<t&&i[n].skip;)n++;for(n%=t,e&&(o+=n);o>n&&i[o%t].skip;)o--;return o%=t,{start:n,end:o}}function hr(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 fr(i,t){const e=i.points,s=i.options.spanGaps,n=e.length;if(!n)return[];const o=!!i._loop,{start:r,end:a}=cr(e,n,o,s);if(s===!0)return as(i,[{start:r,end:a,loop:o}],e,t);const l=a<r?a+n:a,c=!!i._fullLoop&&r===0&&a===n-1;return as(i,hr(e,r,l,c),e,t)}function as(i,t,e,s){return!s||!s.setContext||!e?t:dr(i,t,e,s)}function dr(i,t,e,s){const n=i._chart.getContext(),o=ls(i.options),{_datasetIndex:r,options:{spanGaps:a}}=i,l=e.length,c=[];let h=o,f=t[0].start,d=f;function u(m,g,p,b){const y=a?-1:1;if(m!==g){for(m+=l;e[m%l].skip;)m-=y;for(;e[g%l].skip;)g+=y;m%l!==g%l&&(c.push({start:m%l,end:g%l,loop:p,style:b}),h=b,f=g%l)}}for(const m of t){f=a?f:m.start;let g=e[f%l],p;for(d=f+1;d<=m.end;d++){const b=e[d%l];p=ls(s.setContext(yt(n,{type:"segment",p0:g,p1:b,p0DataIndex:(d-1)%l,p1DataIndex:d%l,datasetIndex:r}))),ur(p,h)&&u(f,d-1,m.loop,h),g=b,h=p}f<d-1&&u(f,d-1,m.loop,h)}return c}function ls(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function ur(i,t){if(!t)return!1;const e=[],s=function(n,o){return je(o)?(e.includes(o)||e.push(o),e.indexOf(o)):o};return JSON.stringify(i,s)!==JSON.stringify(t,s)}function ue(i,t,e){return i.options.clip?i[e]:t[e]}function gr(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:ue(e,t,"left"),right:ue(e,t,"right"),top:ue(s,t,"top"),bottom:ue(s,t,"bottom")}:t}function cs(i,t){const e=t._clip;if(e.disabled)return!1;const s=gr(t,i.chartArea);return{left:e.left===!1?0:s.left-(e.left===!0?0:e.left),right:e.right===!1?i.width:s.right+(e.right===!0?0:e.right),top:e.top===!1?0:s.top-(e.top===!0?0:e.top),bottom:e.bottom===!1?i.height:s.bottom+(e.bottom===!0?0:e.bottom)}}/*!
|
|
* Chart.js v4.5.1
|
|
* https://www.chartjs.org
|
|
* (c) 2025 Chart.js Contributors
|
|
* Released under the MIT License
|
|
*/class pr{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,s,n){const o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(s-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Fi.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 ot=new pr;const hs="transparent",mr={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=Ni(i||hs),n=s.valid&&Ni(t||hs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class br{constructor(t,e,s,n){const o=e[s];n=ce([t.to,n,o,t.from]);const r=ce([t.from,o,n]);this._active=!0,this._fn=t.fn||mr[t.type||typeof r],this._easing=Nt[t.easing]||Nt.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=ce([t.to,e,n,t.from]),this._from=ce([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||e<s),!this._active){this._target[n]=a,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/s%2,l=r&&l>1?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<s.length;n++)s[n][e]()}}class fs{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!D(t))return;const e=Object.keys(R.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!D(o))return;const r={};for(const a of e)r[a]=o[a];(z(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!s.has(a))&&s.set(a,r)})})}_animateOptions(t,e){const s=e.options,n=yr(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&_r(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 f=o[c];const d=s.get(c);if(f)if(d&&f.active()){f.update(d,h,a);continue}else f.cancel();if(!d||!d.duration){t[c]=h;continue}o[c]=f=new br(d,t,c,h),n.push(f)}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 ot.add(this._chart,s),!0}}function _r(i,t){const e=[],s=Object.keys(t);for(let n=0;n<s.length;n++){const o=i[s[n]];o&&o.active()&&e.push(o.wait())}return Promise.all(e)}function yr(i,t){if(!t)return;let e=i.options;if(!e){i.options=t;return}return e.$shared&&(i.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function ds(i,t){const e=i&&i.options||{},s=e.reverse,n=e.min===void 0?t:0,o=e.max===void 0?t:0;return{start:s?o:n,end:s?n:o}}function xr(i,t,e){if(e===!1)return!1;const s=ds(i,e),n=ds(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function vr(i){let t,e,s,n;return D(i)?(t=i.top,e=i.right,s=i.bottom,n=i.left):t=e=s=n=i,{top:t,right:e,bottom:s,left:n,disabled:i===!1}}function us(i,t){const e=[],s=i._getSortedDatasetMetas(t);let n,o;for(n=0,o=s.length;n<o;++n)e.push(s[n].index);return e}function gs(i,t,e,s={}){const n=i.keys,o=s.mode==="single";let r,a,l,c;if(t===null)return;let h=!1;for(r=0,a=n.length;r<a;++r){if(l=+n[r],l===e){if(h=!0,s.all)continue;break}c=i.values[l],V(c)&&(o||t===0||Ot(t)===Ot(c))&&(t+=c)}return!h&&!s.all?0:t}function kr(i,t){const{iScale:e,vScale:s}=t,n=e.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",r=Object.keys(i),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[n]:h,[o]:i[h]};return a}function ti(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function wr(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function Mr(i){const{min:t,max:e,minDefined:s,maxDefined:n}=i.getUserBounds();return{min:s?t:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}function Sr(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function ps(i,t,e,s){for(const n of t.getMatchingVisibleMetas(s).reverse()){const o=i[n.index];if(e&&o>0||!e&&o<0)return n.index}return null}function ms(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=wr(o,r,s),f=t.length;let d;for(let u=0;u<f;++u){const m=t[u],{[l]:g,[c]:p}=m,b=m._stacks||(m._stacks={});d=b[c]=Sr(n,h,g),d[a]=p,d._top=ps(d,r,!0,s.type),d._bottom=ps(d,r,!1,s.type);const y=d._visualValues||(d._visualValues={});y[a]=p}}function ei(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function Dr(i,t){return yt(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Pr(i,t,e){return yt(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Ht(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 ii=i=>i==="reset"||i==="none",bs=(i,t)=>t?i:Object.assign({},i),Or=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:us(e,!0),values:null};class Wt{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=ti(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&&Ht(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(f,d,u,m)=>f==="x"?d:f==="r"?m:u,o=e.xAxisID=C(s.xAxisID,ei(t,"x")),r=e.yAxisID=C(s.yAxisID,ei(t,"y")),a=e.rAxisID=C(s.rAxisID,ei(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&&Li(this._data,this),t._stacked&&Ht(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(D(e)){const n=this._cachedMeta;this._data=kr(e,n)}else if(s!==e){if(s){Li(s,this);const n=this._cachedMeta;Ht(n),n._parsed=[]}e&&Object.isExtensible(e)&&no(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=ti(e.vScale,e),e.stack!==s.stack&&(n=!0,Ht(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&(ms(this,e._parsed),e._stacked=ti(e.vScale,e))}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,f,d;if(this._parsing===!1)s._parsed=n,s._sorted=!0,d=n;else{z(n[t])?d=this.parseArrayData(s,n,t,e):D(n[t])?d=this.parseObjectData(s,n,t,e):d=this.parsePrimitiveData(s,n,t,e);const u=()=>f[a]===null||c&&f[a]<c[a];for(h=0;h<e;++h)s._parsed[h+t]=f=d[h],l&&(u()&&(l=!1),c=f);s._sorted=l}r&&ms(this,d)}parsePrimitiveData(t,e,s,n){const{iScale:o,vScale:r}=t,a=o.axis,l=r.axis,c=o.getLabels(),h=o===r,f=new Array(n);let d,u,m;for(d=0,u=n;d<u;++d)m=d+s,f[d]={[a]:h||o.parse(c[m],m),[l]:r.parse(e[m],m)};return f}parseArrayData(t,e,s,n){const{xScale:o,yScale:r}=t,a=new Array(n);let l,c,h,f;for(l=0,c=n;l<c;++l)h=l+s,f=e[h],a[l]={x:o.parse(f[0],h),y:r.parse(f[1],h)};return a}parseObjectData(t,e,s,n){const{xScale:o,yScale:r}=t,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(n);let h,f,d,u;for(h=0,f=n;h<f;++h)d=h+s,u=e[d],c[h]={x:o.parse(ne(u,a),d),y:r.parse(ne(u,l),d)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,s){const n=this.chart,o=this._cachedMeta,r=e[t.axis],a={keys:us(n,!0),values:e._stacks[t.axis]._visualValues};return gs(a,r,o.index,{mode:s})}updateRangeFromParsed(t,e,s,n){const o=s[e.axis];let r=o===null?NaN:o;const a=n&&s._stacks[e.axis];n&&a&&(n.values=a,r=gs(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,e){const s=this._cachedMeta,n=s._parsed,o=s._sorted&&t===s.iScale,r=n.length,a=this._getOtherScale(t),l=Or(e,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:f}=Mr(a);let d,u;function m(){u=n[d];const g=u[a.axis];return!V(u[t.axis])||h>g||f<g}for(d=0;d<r&&!(!m()&&(this.updateRangeFromParsed(c,t,u,l),o));++d);if(o){for(d=r-1;d>=0;--d)if(!m()){this.updateRangeFromParsed(c,t,u,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,r;for(n=0,o=e.length;n<o;++n)r=e[n][t.axis],V(r)&&s.push(r);return s}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,s=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:s?""+s.getLabelForValue(o[s.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=vr(C(this.options.clip,xr(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,s=this._cachedMeta,n=s.data||[],o=e.chartArea,r=[],a=this._drawStart||0,l=this._drawCount||n.length-a,c=this.options.drawActiveElementsOnTop;let h;for(s.dataset&&s.dataset.draw(t,o,a,l),h=a;h<a+l;++h){const f=n[h];f.hidden||(f.active&&c?r.push(f):f.draw(t,o))}for(h=0;h<r.length;++h)r[h].draw(t,o)}getStyle(t,e){const s=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,e,s){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const r=this._cachedMeta.data[t];o=r.$context||(r.$context=Pr(this.getContext(),t,r)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Dr(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=s,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",s){const n=e==="active",o=this._cachedDataOpts,r=t+"-"+e,a=o[r],l=this.enableOptionSharing&&oe(s);if(a)return bs(a,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),f=n?[`${t}Hover`,"hover",t,""]:[t,""],d=c.getOptionScopes(this.getDataset(),h),u=Object.keys(R.elements[t]),m=()=>this.getContext(s,n,e),g=c.resolveNamedOptions(d,u,m,f);return g.$shared&&(g.$shared=l,o[r]=Object.freeze(bs(g,l))),g}_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,f=h.datasetAnimationScopeKeys(this._type,e),d=h.getOptionScopes(this.getDataset(),f);l=h.createResolver(d,this.getContext(t,s,e))}const c=new fs(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||ii(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){ii(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!ii(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<n&&this._removeElements(o,n-o)}_insertElements(t,e,s=!0){const n=this._cachedMeta,o=n.data,r=t+e;let a;const l=c=>{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;a<r;++a)o[a]=new this.dataElementType;this._parsing&&l(n._parsed),this.parse(t,e),s&&this.updateElements(o,t,e,"reset")}updateElements(t,e,s,n){}_removeElements(t,e){const s=this._cachedMeta;if(this._parsing){const n=s._parsed.splice(t,e);s._stacked&&Ht(s,n)}s.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,s,n]=t;this[e](s,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}S(Wt,"defaults",{}),S(Wt,"datasetElementType",null),S(Wt,"dataElementType",null);class ge extends Wt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:s,data:n=[],_dataset:o}=e,r=this.chart._animationsDisabled;let{start:a,count:l}=lo(e,n,r);this._drawStart=a,this._drawCount=l,co(e)&&(a=0,l=n.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!o._decimated,s.points=n;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(s,void 0,{animated:!r,options:c},t),this.updateElements(n,a,l,t)}updateElements(t,e,s,n){const o=n==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:h,includeOptions:f}=this._getSharedOptions(e,n),d=r.axis,u=a.axis,{spanGaps:m,segment:g}=this.options,p=Bt(m)?m:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||n==="none",y=e+s,v=t.length;let x=e>0&&this.getParsed(e-1);for(let _=0;_<v;++_){const M=t[_],k=b?M:{};if(_<e||_>=y){k.skip=!0;continue}const w=this.getParsed(_),P=T(w[u]),I=k[d]=r.getPixelForValue(w[d],_),L=k[u]=o||P?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,w,l):w[u],_);k.skip=isNaN(I)||isNaN(L)||P,k.stop=_>0&&Math.abs(w[d]-x[d])>p,g&&(k.parsed=w,k.raw=c.data[_]),f&&(k.options=h||this.resolveDataElementOptions(_,M.active?"active":n)),b||this.updateElement(M,_,k,n),x=w}}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()}}S(ge,"id","line"),S(ge,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),S(ge,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function wt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class si{constructor(t){S(this,"options");this.options=t||{}}static override(t){Object.assign(si.prototype,t)}init(){}formats(){return wt()}parse(){return wt()}format(){return wt()}add(){return wt()}diff(){return wt()}startOf(){return wt()}endOf(){return wt()}}var Cr={_date:si};function Tr(i,t,e,s){const{controller:n,data:o,_sorted:r}=i,a=n._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){const c=a._reversePixels?io:mt;if(s){if(n._sharedOptions){const h=o[0],f=typeof h.getRange=="function"&&h.getRange(t);if(f){const d=c(o,t,e-f),u=c(o,t,e+f);return{lo:d.lo,hi:u.hi}}}}else{const h=c(o,t,e);if(l){const{vScale:f}=n._cachedMeta,{_parsed:d}=i,u=d.slice(0,h.lo+1).reverse().findIndex(g=>!T(g[f.axis]));h.lo-=Math.max(0,u);const m=d.slice(h.hi).findIndex(g=>!T(g[f.axis]));h.hi+=Math.max(0,m)}return h}}return{lo:0,hi:o.length-1}}function pe(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a<l;++a){const{index:c,data:h}=o[a],{lo:f,hi:d}=Tr(o[a],t,r,n);for(let u=f;u<=d;++u){const m=h[u];m.skip||s(m,c,u)}}}function Ar(i){const t=i.indexOf("x")!==-1,e=i.indexOf("y")!==-1;return function(s,n){const o=t?Math.abs(s.x-n.x):0,r=e?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function ni(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||pe(i,e,t,function(a,l,c){!n&&!jt(a,i.chartArea,0)||a.inRange(t.x,t.y,s)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Ir(i,t,e,s){let n=[];function o(r,a,l){const{startAngle:c,endAngle:h}=r.getProps(["startAngle","endAngle"],s),{angle:f}=Jn(r,{x:t.x,y:t.y});Ti(f,c,h)&&n.push({element:r,datasetIndex:a,index:l})}return pe(i,e,t,o),n}function Lr(i,t,e,s,n,o){let r=[];const a=Ar(e);let l=Number.POSITIVE_INFINITY;function c(h,f,d){const u=h.inRange(t.x,t.y,n);if(s&&!u)return;const m=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(m))&&!u)return;const p=a(t,m);p<l?(r=[{element:h,datasetIndex:f,index:d}],l=p):p===l&&r.push({element:h,datasetIndex:f,index:d})}return pe(i,e,t,c),r}function oi(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?Ir(i,t,e,n):Lr(i,t,e,s,n,o)}function _s(i,t,e,s,n){const o=[],r=e==="x"?"inXRange":"inYRange";let a=!1;return pe(i,e,t,(l,c,h)=>{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 Fr={modes:{index(i,t,e,s){const n=vt(t,i),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?ni(i,n,o,s,r):oi(i,n,o,!1,s,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=a[0].index,f=c.data[h];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=vt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;let a=e.intersect?ni(i,n,o,s,r):oi(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;h<c.length;++h)a.push({element:c[h],datasetIndex:l,index:h})}return a},point(i,t,e,s){const n=vt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return ni(i,n,o,s,r)},nearest(i,t,e,s){const n=vt(t,i),o=e.axis||"xy",r=e.includeInvisible||!1;return oi(i,n,o,e.intersect,s,r)},x(i,t,e,s){const n=vt(t,i);return _s(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=vt(t,i);return _s(i,n,"y",e.intersect,s)}}};const ys=["left","top","right","bottom"];function $t(i,t){return i.filter(e=>e.pos===t)}function xs(i,t){return i.filter(e=>ys.indexOf(e.pos)===-1&&e.box.axis===t)}function Yt(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 Rr(i){const t=[];let e,s,n,o,r,a;for(e=0,s=(i||[]).length;e<s;++e)n=i[e],{position:o,options:{stack:r,stackWeight:a=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:r&&o+r,stackWeight:a});return t}function Er(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!ys.includes(n))continue;const r=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return t}function zr(i,t){const e=Er(i),{vBoxMaxWidth:s,hBoxMaxHeight:n}=t;let o,r,a;for(o=0,r=i.length;o<r;++o){a=i[o];const{fullSize:l}=a.box,c=e[a.stack],h=c&&a.stackWeight/c.weight;a.horizontal?(a.width=h?h*s:l&&t.availableWidth,a.height=n):(a.width=s,a.height=h?h*n:l&&t.availableHeight)}return e}function Br(i){const t=Rr(i),e=Yt(t.filter(c=>c.box.fullSize),!0),s=Yt($t(t,"left"),!0),n=Yt($t(t,"right")),o=Yt($t(t,"top"),!0),r=Yt($t(t,"bottom")),a=xs(t,"x"),l=xs(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(r).concat(a),chartArea:$t(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(r).concat(a)}}function vs(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function ks(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 Nr(i,t,e,s){const{pos:n,box:o}=e,r=i.maxPadding;if(!D(n)){e.size&&(i[n]-=e.size);const f=s[e.stack]||{size:0,count:1};f.size=Math.max(f.size,e.horizontal?o.height:o.width),e.size=f.size/f.count,i[n]+=e.size}o.getPadding&&ks(r,o.getPadding());const a=Math.max(0,t.outerWidth-vs(r,i,"left","right")),l=Math.max(0,t.outerHeight-vs(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 Vr(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 jr(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 Ut(i,t,e,s){const n=[];let o,r,a,l,c,h;for(o=0,r=i.length,c=0;o<r;++o){a=i[o],l=a.box,l.update(a.width||t.w,a.height||t.h,jr(a.horizontal,t));const{same:f,other:d}=Nr(t,e,a,s);c|=f&&n.length,h=h||d,l.fullSize||n.push(a)}return c&&Ut(n,t,e,s)||h}function me(i,t,e,s,n){i.top=e,i.left=t,i.right=t+s,i.bottom=e+n,i.width=s,i.height=n}function ws(i,t,e,s){const n=e.padding;let{x:o,y:r}=t;for(const a of i){const l=a.box,c=s[a.stack]||{placed:0,weight:1},h=a.stackWeight/c.weight||1;if(a.horizontal){const f=t.w*h,d=c.size||l.height;oe(c.start)&&(r=c.start),l.fullSize?me(l,n.left,r,e.outerWidth-n.right-n.left,d):me(l,t.left+c.placed,r,f,d),c.start=r,c.placed+=f,r=l.bottom}else{const f=t.h*h,d=c.size||l.width;oe(c.start)&&(o=c.start),l.fullSize?me(l,o,n.top,d,e.outerHeight-n.bottom-n.top):me(l,o,t.top+c.placed,d,f),c.start=o,c.placed+=f,o=l.right}}t.x=o,t.y=r}var be={addBox(i,t){i.boxes||(i.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},i.boxes.push(t)},removeBox(i,t){const e=i.boxes?i.boxes.indexOf(t):-1;e!==-1&&i.boxes.splice(e,1)},configure(i,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(i,t,e,s){if(!i)return;const n=ht(i.options.layout.padding),o=Math.max(t-n.width,0),r=Math.max(e-n.height,0),a=Br(i.boxes),l=a.vertical,c=a.horizontal;O(i.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const h=l.reduce((g,p)=>p.box.options&&p.box.options.display===!1?g:g+1,0)||1,f=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/h,hBoxMaxHeight:r/2}),d=Object.assign({},n);ks(d,ht(s));const u=Object.assign({maxPadding:d,w:o,h:r,x:n.left,y:n.top},n),m=zr(l.concat(c),f);Ut(a.fullSize,u,f,m),Ut(l,u,f,m),Ut(c,u,f,m)&&Ut(l,u,f,m),Vr(u),ws(a.leftAndTop,u,f,m),u.x+=u.w,u.y+=u.h,ws(a.rightAndBottom,u,f,m),i.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},O(a.chartArea,g=>{const p=g.box;Object.assign(p,i.chartArea),p.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}};class Ms{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 Hr extends Ms{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const _e="$chartjs",Wr={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ss=i=>i===null||i==="";function $r(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[_e]={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",Ss(n)){const o=is(i,"width");o!==void 0&&(i.width=o)}if(Ss(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=is(i,"height");o!==void 0&&(i.height=o)}return i}const Ds=er?{passive:!0}:!1;function Yr(i,t,e){i&&i.addEventListener(t,e,Ds)}function Ur(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,Ds)}function Xr(i,t){const e=Wr[i.type]||i.type,{x:s,y:n}=vt(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function ye(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function Kr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ye(a.addedNodes,s),r=r&&!ye(a.removedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function qr(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let r=!1;for(const a of o)r=r||ye(a.removedNodes,s),r=r&&!ye(a.addedNodes,s);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const Xt=new Map;let Ps=0;function Os(){const i=window.devicePixelRatio;i!==Ps&&(Ps=i,Xt.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function Gr(i,t){Xt.size||window.addEventListener("resize",Os),Xt.set(i,t)}function Zr(i){Xt.delete(i),Xt.size||window.removeEventListener("resize",Os)}function Qr(i,t,e){const s=i.canvas,n=s&&Qe(s);if(!n)return;const o=Ri((a,l)=>{const c=n.clientWidth;e(a,l),c<n.clientWidth&&e()},window),r=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return r.observe(n),Gr(i,o),r}function ri(i,t,e){e&&e.disconnect(),t==="resize"&&Zr(i)}function Jr(i,t,e){const s=i.canvas,n=Ri(o=>{i.ctx!==null&&e(Xr(o,i))},i);return Yr(s,t,n),n}class ta extends Ms{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?($r(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[_e])return!1;const s=e[_e].initial;["height","width"].forEach(o=>{const r=s[o];T(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[_e],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),r={attach:Kr,detach:qr,resize:Qr}[e]||Jr;n[e]=r(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:ri,detach:ri,resize:ri}[e]||Ur)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return tr(t,e,s,n)}isAttached(t){const e=t&&Qe(t);return!!(e&&e.isConnected)}}function ea(i){return!Ze()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?Hr:ta}class Mt{constructor(){S(this,"x");S(this,"y");S(this,"active",!1);S(this,"options");S(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return Bt(this.x)&&Bt(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}}S(Mt,"defaults",{}),S(Mt,"defaultRoutes");function ia(i,t){const e=i.options.ticks,s=sa(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?oa(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>n)return ra(t,c,o,r/n),c;const h=na(o,t,n);if(r>0){let f,d;const u=r>1?Math.round((l-a)/(r-1)):null;for(xe(t,c,h,T(u)?0:a-u,a),f=0,d=r-1;f<d;f++)xe(t,c,h,o[f],o[f+1]);return xe(t,c,h,l,T(u)?t.length:l+u),c}return xe(t,c,h),c}function sa(i){const t=i.options.offset,e=i._tickSize(),s=i._length/e+(t?0:1),n=i._maxLength/e;return Math.floor(Math.min(s,n))}function na(i,t,e){const s=aa(i),n=t.length/e;if(!s)return Math.max(n,1);const o=Kn(s);for(let r=0,a=o.length-1;r<a;r++){const l=o[r];if(l>n)return l}return Math.max(n,1)}function oa(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function ra(i,t,e,s){let n=0,o=e[0],r;for(s=Math.ceil(s),r=0;r<i.length;r++)r===o&&(t.push(i[r]),n++,o=e[n*s])}function xe(i,t,e,s,n){const o=C(s,0),r=Math.min(C(n,i.length),i.length);let a=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-s,e=l/Math.floor(l/e)),h=o;h<0;)a++,h=Math.round(o+a*e);for(c=Math.max(o,0);c<r;c++)c===h&&(t.push(i[c]),a++,h=Math.round(o+a*e))}function aa(i){const t=i.length;let e,s;if(t<2)return!1;for(s=i[0],e=1;e<t;++e)if(i[e]-i[e-1]!==s)return!1;return s}const la=i=>i==="left"?"right":i==="right"?"left":i,Cs=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,Ts=(i,t)=>Math.min(t||i,i);function As(i,t){const e=[],s=i.length/t,n=i.length;let o=0;for(;o<n;o+=s)e.push(i[Math.floor(o)]);return e}function ca(i,t,e){const s=i.ticks.length,n=Math.min(t,s-1),o=i._startPixel,r=i._endPixel,a=1e-6;let l=i.getPixelForTick(n),c;if(!(e&&(s===1?c=Math.max(l-o,r-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<o-a||l>r+a)))return l}function ha(i,t){O(i,e=>{const s=e.gc,n=s.length/2;let o;if(n>t){for(o=0;o<n;++o)delete e.data[s[o]];s.splice(0,n)}})}function Kt(i){return i.drawTicks?i.tickLength:0}function Is(i,t){if(!i.display)return 0;const e=J(i.font,t),s=ht(i.padding);return(z(i.text)?i.text.length:1)*e.lineHeight+s.height}function fa(i,t){return yt(i,{scale:t,type:"scale"})}function da(i,t,e){return yt(i,{tick:e,index:t,type:"tick"})}function ua(i,t,e){let s=ao(i);return(e&&t!=="right"||!e&&t==="right")&&(s=la(s)),s}function ga(i,t,e,s){const{top:n,left:o,bottom:r,right:a,chart:l}=i,{chartArea:c,scales:h}=l;let f=0,d,u,m;const g=r-n,p=a-o;if(i.isHorizontal()){if(u=Ei(s,o,a),D(e)){const b=Object.keys(e)[0],y=e[b];m=h[b].getPixelForValue(y)+g-t}else e==="center"?m=(c.bottom+c.top)/2+g-t:m=Cs(i,e,t);d=a-o}else{if(D(e)){const b=Object.keys(e)[0],y=e[b];u=h[b].getPixelForValue(y)-p+t}else e==="center"?u=(c.left+c.right)/2-p+t:u=Cs(i,e,t);m=Ei(s,r,n),f=e==="left"?-K:K}return{titleX:u,titleY:m,maxWidth:d,rotation:f}}class At extends Mt{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:s,_suggestedMax:n}=this;return t=G(t,Number.POSITIVE_INFINITY),e=G(e,Number.NEGATIVE_INFINITY),s=G(s,Number.POSITIVE_INFINITY),n=G(n,Number.NEGATIVE_INFINITY),{min:G(t,s),max:G(e,n),minDefined:V(t),maxDefined:V(e)}}getMinMax(t){let{min:e,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),r;if(n&&o)return{min:e,max:s};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,t),n||(e=Math.min(e,r.min)),o||(s=Math.max(s,r.max));return e=o&&e>s?s:e,s=n&&e>s?e:s,{min:G(e,G(s,e)),max:G(s,G(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(){A(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=Io(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?As(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=ia(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,s;this.isHorizontal()?(e=this.left,s=this.right):(e=this.top,s=this.bottom,t=!t),this._startPixel=e,this._endPixel=s,this._reversePixels=t,this._length=s-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){A(this.options.afterUpdate,[this])}beforeSetDimensions(){A(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){A(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),A(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){A(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s],o.label=A(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){A(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){A(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=Ts(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let r=n,a,l,c;if(!this._isVisible()||!e.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),f=h.widest.width,d=h.highest.height,u=Y(this.chart.width-f,0,this.maxWidth);a=t.offset?this.maxWidth/s:u/(s-1),f+6>a&&(a=u/(s-(t.offset?.5:1)),l=this.maxHeight-Kt(t.grid)-e.padding-Is(t.title,this.chart.options.font),c=Math.sqrt(f*f+d*d),r=Qn(Math.min(Math.asin(Y((h.highest.height+6)/a,-1,1)),Math.asin(Y(l/c,-1,1))-Math.asin(Y(d/c,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){A(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){A(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=Kt(o)+l):(t.height=this.maxHeight,t.width=Kt(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:f,highest:d}=this._getLabelSizes(),u=s.padding*2,m=pt(this.labelRotation),g=Math.cos(m),p=Math.sin(m);if(a){const b=s.mirror?0:p*f.width+g*d.height;t.height=Math.min(this.maxHeight,t.height+b+u)}else{const b=s.mirror?0:g*f.width+p*d.height;t.width=Math.min(this.maxWidth,t.width+b+u)}this._calculatePadding(c,h,p,g)}}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,f=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,u=0;l?c?(d=n*t.width,u=s*e.height):(d=s*t.height,u=n*e.width):o==="start"?u=e.width:o==="end"?d=t.width:o!=="inner"&&(d=t.width/2,u=e.width/2),this.paddingLeft=Math.max((d-h+r)*this.width/(this.width-h),0),this.paddingRight=Math.max((u-f+r)*this.width/(this.width-f),0)}else{let h=e.height/2,f=t.height/2;o==="start"?(h=0,f=t.height):o==="end"&&(h=e.height,f=0),this.paddingTop=h+r,this.paddingBottom=f+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(){A(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<s;e++)T(t[e].label)&&(t.splice(e,1),s--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let s=this.ticks;e<s.length&&(s=As(s,e)),this._labelSizes=t=this._computeLabelSizes(s,s.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,s){const{ctx:n,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(e/Ts(e,s));let c=0,h=0,f,d,u,m,g,p,b,y,v,x,_;for(f=0;f<e;f+=l){if(m=t[f].label,g=this._resolveTickFontOptions(f),n.font=p=g.string,b=o[p]=o[p]||{data:{},gc:[]},y=g.lineHeight,v=x=0,!T(m)&&!z(m))v=Wi(n,b.data,b.gc,v,m),x=y;else if(z(m))for(d=0,u=m.length;d<u;++d)_=m[d],!T(_)&&!z(_)&&(v=Wi(n,b.data,b.gc,v,_),x+=y);r.push(v),a.push(x),c=Math.max(v,c),h=Math.max(x,h)}ha(o,e);const M=r.indexOf(c),k=a.indexOf(h),w=P=>({width:r[P]||0,height:a[P]||0});return{first:w(0),last:w(e-1),widest:w(M),highest:w(k),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 eo(this._alignToPixels?_t(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&&t<e.length){const s=e[t];return s.$context||(s.$context=da(this.getContext(),t,s))}return this.$context||(this.$context=fa(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=pt(this.labelRotation),s=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),r=t.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*s>a*n?a/s:l/n:l*n<a*s?l/s:a/n}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_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(),f=this.ticks.length+(l?1:0),d=Kt(o),u=[],m=a.setContext(this.getContext()),g=m.display?m.width:0,p=g/2,b=function(B){return _t(s,B,g)};let y,v,x,_,M,k,w,P,I,L,E,it;if(r==="top")y=b(this.bottom),k=this.bottom-d,P=y-p,L=b(t.top)+p,it=t.bottom;else if(r==="bottom")y=b(this.top),L=t.top,it=b(t.bottom)-p,k=y+p,P=this.top+d;else if(r==="left")y=b(this.right),M=this.right-d,w=y-p,I=b(t.left)+p,E=t.right;else if(r==="right")y=b(this.left),I=t.left,E=b(t.right)-p,M=y+p,w=this.left+d;else if(e==="x"){if(r==="center")y=b((t.top+t.bottom)/2+.5);else if(D(r)){const B=Object.keys(r)[0],U=r[B];y=b(this.chart.scales[B].getPixelForValue(U))}L=t.top,it=t.bottom,k=y+p,P=k+d}else if(e==="y"){if(r==="center")y=b((t.left+t.right)/2);else if(D(r)){const B=Object.keys(r)[0],U=r[B];y=b(this.chart.scales[B].getPixelForValue(U))}M=y-p,w=M-d,I=t.left,E=t.right}const ut=C(n.ticks.maxTicksLimit,f),F=Math.max(1,Math.ceil(f/ut));for(v=0;v<f;v+=F){const B=this.getContext(v),U=o.setContext(B),Te=a.setContext(B),Ae=U.lineWidth,It=U.color,Ie=Te.dash||[],Lt=Te.dashOffset,Zt=U.tickWidth,St=U.tickColor,Qt=U.tickBorderDash||[],Dt=U.tickBorderDashOffset;x=ca(this,v,l),x!==void 0&&(_=_t(s,x,Ae),c?M=w=I=E=_:k=P=L=it=_,u.push({tx1:M,ty1:k,tx2:w,ty2:P,x1:I,y1:L,x2:E,y2:it,width:Ae,color:It,borderDash:Ie,borderDashOffset:Lt,tickWidth:Zt,tickColor:St,tickBorderDash:Qt,tickBorderDashOffset:Dt}))}return this._ticksLength=f,this._borderValue=y,u}_computeLabelItems(t){const e=this.axis,s=this.options,{position:n,ticks:o}=s,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:h,mirror:f}=o,d=Kt(s.grid),u=d+h,m=f?-h:u,g=-pt(this.labelRotation),p=[];let b,y,v,x,_,M,k,w,P,I,L,E,it="middle";if(n==="top")M=this.bottom-m,k=this._getXAxisLabelAlignment();else if(n==="bottom")M=this.top+m,k=this._getXAxisLabelAlignment();else if(n==="left"){const F=this._getYAxisLabelAlignment(d);k=F.textAlign,_=F.x}else if(n==="right"){const F=this._getYAxisLabelAlignment(d);k=F.textAlign,_=F.x}else if(e==="x"){if(n==="center")M=(t.top+t.bottom)/2+u;else if(D(n)){const F=Object.keys(n)[0],B=n[F];M=this.chart.scales[F].getPixelForValue(B)+u}k=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")_=(t.left+t.right)/2-u;else if(D(n)){const F=Object.keys(n)[0],B=n[F];_=this.chart.scales[F].getPixelForValue(B)}k=this._getYAxisLabelAlignment(d).textAlign}e==="y"&&(l==="start"?it="top":l==="end"&&(it="bottom"));const ut=this._getLabelSizes();for(b=0,y=a.length;b<y;++b){v=a[b],x=v.label;const F=o.setContext(this.getContext(b));w=this.getPixelForTick(b)+o.labelOffset,P=this._resolveTickFontOptions(b),I=P.lineHeight,L=z(x)?x.length:1;const B=L/2,U=F.color,Te=F.textStrokeColor,Ae=F.textStrokeWidth;let It=k;r?(_=w,k==="inner"&&(b===y-1?It=this.options.reverse?"left":"right":b===0?It=this.options.reverse?"right":"left":It="center"),n==="top"?c==="near"||g!==0?E=-L*I+I/2:c==="center"?E=-ut.highest.height/2-B*I+I:E=-ut.highest.height+I/2:c==="near"||g!==0?E=I/2:c==="center"?E=ut.highest.height/2-B*I:E=ut.highest.height-L*I,f&&(E*=-1),g!==0&&!F.showLabelBackdrop&&(_+=I/2*Math.sin(g))):(M=w,E=(1-L)*I/2);let Ie;if(F.showLabelBackdrop){const Lt=ht(F.backdropPadding),Zt=ut.heights[b],St=ut.widths[b];let Qt=E-Lt.top,Dt=0-Lt.left;switch(it){case"middle":Qt-=Zt/2;break;case"bottom":Qt-=Zt;break}switch(k){case"center":Dt-=St/2;break;case"right":Dt-=St;break;case"inner":b===y-1?Dt-=St:b>0&&(Dt-=St/2);break}Ie={left:Dt,top:Qt,width:St+Lt.width,height:Zt+Lt.height,color:F.backdropColor}}p.push({label:x,font:P,textOffset:E,options:{rotation:g,color:U,strokeColor:Te,strokeWidth:Ae,textAlign:It,textBaseline:it,translation:[_,M],backdrop:Ie}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-pt(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<r;++o){const l=n[o];e.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:s,grid:n}}=this,o=s.setContext(this.getContext()),r=s.display?o.width:0;if(!r)return;const a=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,f,d;this.isHorizontal()?(c=_t(t,this.left,r)-r/2,h=_t(t,this.right,a)+a/2,f=d=l):(f=_t(t,this.top,r)-r/2,d=_t(t,this.bottom,a)+a/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,f),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&Ue(s,n);const o=this.getLabelItems(t);for(const r of o){const a=r.options,l=r.font,c=r.label,h=r.textOffset;Yi(s,c,0,h,l,a)}n&&Xe(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=J(s.font),r=ht(s.padding),a=s.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||D(e)?(l+=r.bottom,z(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=r.top;const{titleX:c,titleY:h,maxWidth:f,rotation:d}=ga(this,l,e,a);Yi(t,s.text,0,0,o,{color:s.color,maxWidth:f,rotation:d,textAlign:ua(a,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,s=C(t.grid&&t.grid.z,-1),n=C(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==At.prototype.draw?[{z:e,draw: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<r;++o){const a=e[o];a[s]===this.id&&(!t||a.type===t)&&n.push(a)}return n}_resolveTickFontOptions(t){const e=this.options.ticks.setContext(this.getContext(t));return J(e.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class ve{constructor(t,e,s){this.type=t,this.scope=e,this.override=s,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let s;ba(e)&&(s=this.register(e));const n=this.items,o=t.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,pa(t,r,s),this.override&&R.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const e=this.items,s=t.id,n=this.scope;s in e&&delete e[s],n&&s in R[n]&&(delete R[n][s],this.override&&delete bt[s])}}function pa(i,t,e){const s=Rt(Object.create(null),[e?R.get(e):{},R.get(t),i.defaults]);R.set(t,s),i.defaultRoutes&&ma(t,i.defaultRoutes),i.descriptors&&R.describe(t,i.descriptors)}function ma(i,t){Object.keys(t).forEach(e=>{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");R.route(o,n,l,a)})}function ba(i){return"id"in i&&"defaults"in i}class _a{constructor(){this.controllers=new ve(Wt,"datasets",!0),this.elements=new ve(Mt,"elements"),this.plugins=new ve(Object,"plugins"),this.scales=new ve(At,"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):O(n,r=>{const a=s||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,s){const n=Be(t);A(s["before"+n],[],s),e[t](s),A(s["after"+n],[],s)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const s=this._typedRegistries[e];if(s.isForType(t))return s}return this.plugins}_get(t,e,s){const n=e.get(t);if(n===void 0)throw new Error('"'+t+'" is not a registered '+s+".");return n}}var tt=new _a;class ya{constructor(){this._init=void 0}notify(t,e,s,n){if(e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),this._init===void 0)return;const o=n?this._descriptors(t).filter(n):this._descriptors(t),r=this._notify(o,t,e,s);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,e,s,n){n=n||{};for(const o of t){const r=o.plugin,a=r[s],l=[e,n,o.options];if(A(a,l,r)===!1&&n.cancelable)return!1}return!0}invalidate(){T(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const s=t&&t.config,n=C(s.options&&s.options.plugins,{}),o=xa(s);return n===!1&&!e?[]:ka(t,o,n,e)}_notifyStateChanges(t){const e=this._oldCache||[],s=this._cache,n=(o,r)=>o.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 xa(i){const t={},e=[],s=Object.keys(tt.plugins.items);for(let o=0;o<s.length;o++)e.push(tt.getPlugin(s[o]));const n=i.plugins||[];for(let o=0;o<n.length;o++){const r=n[o];e.indexOf(r)===-1&&(e.push(r),t[r.id]=!0)}return{plugins:e,localIds:t}}function va(i,t){return!t&&i===!1?null:i===!0?{}:i}function ka(i,{plugins:t,localIds:e},s,n){const o=[],r=i.getContext();for(const a of t){const l=a.id,c=va(s[l],n);c!==null&&o.push({plugin:a,options:wa(i.config,{plugin:a,local:e[l]},c,r)})}return o}function wa(i,{plugin:t,local:e},s,n){const o=i.pluginScopeKeys(t),r=i.getOptionScopes(s,o);return e&&t.defaults&&r.push(t.defaults),i.createResolver(r,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ai(i,t){const e=R.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Ma(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function Sa(i,t){return i===t?"_index_":"_value_"}function Ls(i){if(i==="x"||i==="y"||i==="r")return i}function Da(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function li(i,...t){if(Ls(i))return i;for(const e of t){const s=e.axis||Da(e.position)||i.length>1&&Ls(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 Pa(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 Oa(i,t){const e=bt[i.type]||{scales:{}},s=t.scales||{},n=ai(i.type,t),o=Object.create(null);return Object.keys(s).forEach(r=>{const a=s[r];if(!D(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=li(r,a,Pa(r,i),R.scales[a.type]),c=Sa(l,n),h=e.scales||{};o[r]=Et(Object.create(null),[{axis:l},a,h[l],h[c]])}),i.data.datasets.forEach(r=>{const a=r.type||i.type,l=r.indexAxis||ai(a,t),h=(bt[a]||{}).scales||{};Object.keys(h).forEach(f=>{const d=Ma(f,l),u=r[d+"AxisID"]||d;o[u]=o[u]||Object.create(null),Et(o[u],[{axis:d},s[u],h[f]])})}),Object.keys(o).forEach(r=>{const a=o[r];Et(a,[R.scales[a.type],R.scale])}),o}function Rs(i){const t=i.options||(i.options={});t.plugins=C(t.plugins,{}),t.scales=Oa(i,t)}function Es(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function Ca(i){return i=i||{},i.data=Es(i.data),Rs(i),i}const zs=new Map,Bs=new Set;function ke(i,t){let e=zs.get(i);return e||(e=t(),zs.set(i,e),Bs.add(e)),e}const qt=(i,t,e)=>{const s=ne(t,e);s!==void 0&&i.add(s)};class Ta{constructor(t){this._config=Ca(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=Es(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(),Rs(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return ke(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return ke(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return ke(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return ke(`${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(f=>qt(l,t,f))),h.forEach(f=>qt(l,n,f)),h.forEach(f=>qt(l,bt[o]||{},f)),h.forEach(f=>qt(l,R,f)),h.forEach(f=>qt(l,We,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Bs.has(e)&&r.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,bt[e]||{},R.datasets[e]||{},{type:e},R,We]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:r,subPrefixes:a}=Ns(this._resolverCache,t,n);let l=r;if(Ia(r,e)){o.$shared=!1,s=ct(s)?s():s;const c=this.createResolver(t,s,a);l=Ct(r,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=Ns(this._resolverCache,t,s);return D(e)?Ct(o,e,void 0,n):o}}function Ns(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:Ke(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},s.set(n,o)),o}const Aa=i=>D(i)&&Object.getOwnPropertyNames(i).some(t=>ct(i[t]));function Ia(i,t){const{isScriptable:e,isIndexable:s}=Ki(i);for(const n of t){const o=e(n),r=s(n),a=(r||o)&&i[n];if(o&&(ct(a)||Aa(a))||r&&z(a))return!0}return!1}var La="4.5.1";const Fa=["top","bottom","left","right","chartArea"];function Vs(i,t){return i==="top"||i==="bottom"||Fa.indexOf(i)===-1&&t==="x"}function js(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function Hs(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),A(e&&e.onComplete,[i],t)}function Ra(i){const t=i.chart,e=t.options.animation;A(e&&e.onProgress,[i],t)}function Ws(i){return Ze()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const we={},$s=i=>{const t=Ws(i);return Object.values(we).filter(e=>e.canvas===t).pop()};function Ea(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 za(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}class rt{static register(...t){tt.add(...t),Ys()}static unregister(...t){tt.remove(...t),Ys()}constructor(t,e){const s=this.config=new Ta(e),n=Ws(t),o=$s(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||ea(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=Nn(),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 ya,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ro(f=>this.update(f),r.resizeDelay||0),this._dataChanges=[],we[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}ot.listen(this,"complete",Hs),ot.listen(this,"progress",Ra),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return T(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 tt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():es(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return $i(this.canvas,this.ctx),this}stop(){return ot.stop(this),this}resize(t,e){ot.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,es(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),A(s.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};O(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=li(r,a),c=l==="r",h=l==="x";return{options:a,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),O(o,r=>{const a=r.options,l=a.id,c=li(l,a),h=C(a.type,r.dtype);(a.position===void 0||Vs(a.position,c)!==Vs(r.dposition))&&(a.position=r.dposition),n[l]=!0;let f=null;if(l in s&&s[l].type===h)f=s[l];else{const d=tt.getScale(h);f=new d({id:l,type:h,ctx:this.ctx,chart:this}),s[f.id]=f}f.init(a,t)}),O(n,(r,a)=>{r||delete s[a]}),O(s,r=>{be.configure(this,r,r.options),be.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;n<s;++n)this._destroyDatasetMeta(n);t.splice(e,s-e)}this._sortedMetasets=t.slice(0).sort(js("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.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<n;s++){const o=e[s];let r=this.getDatasetMeta(s);const a=o.type||this.config.type;if(r.type&&r.type!==a&&(this._destroyDatasetMeta(s),r=this.getDatasetMeta(s)),r.type=a,r.indexAxis=o.indexAxis||ai(a,this.options),r.order=o.order||0,r.index=s,r.label=""+o.label,r.visible=this.isDatasetVisible(s),r.controller)r.controller.updateIndex(s),r.controller.linkScales();else{const l=tt.getController(a),{datasetElementType:c,dataElementType:h}=R.datasets[a];Object.assign(l,{dataElementType:tt.getElement(h),datasetElementType:c&&tt.getElement(c)}),r.controller=new l(this,s),t.push(r.controller)}}return this._updateMetasets(),t}_resetElements(){O(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const 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<h;c++){const{controller:f}=this.getDatasetMeta(c),d=!n&&o.indexOf(f)===-1;f.buildOrUpdateElements(d),r=Math.max(+f.getMaxOverflow(),r)}r=this._minPadding=s.layout.autoPadding?r:0,this._updateLayout(r),n||O(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(js("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){O(this.scales,t=>{be.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!Si(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;Ea(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;o<e;o++)if(!Si(n,s(o)))return;return Array.from(n).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;be.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],O(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<s;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,s=this.data.datasets.length;e<s;++e)this._updateDataset(e,ct(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const s=this.getDatasetMeta(t),n={meta:s,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",n)!==!1&&(s.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(ot.has(this)?this.attached&&!ot.running(this)&&ot.start(this):(this.draw(),Hs({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:s,height:n}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,n)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,s=[];let n,o;for(n=0,o=e.length;n<o;++n){const r=e[n];(!t||r.visible)&&s.push(r)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,s={meta:t,index:t.index,cancelable:!0},n=cs(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(n&&Ue(e,n),t.controller.draw(),n&&Xe(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return jt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=Fr.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=yt(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);oe(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(),ot.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),$i(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete we[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,s=(o,r)=>{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};O(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(){O(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},O(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<l;++a){r=t[a];const c=r&&this.getDatasetMeta(r.datasetIndex).controller;c&&c[n+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],s=t.map(({datasetIndex:o,index:r})=>{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}});!ie(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(f=>h.datasetIndex===f.datasetIndex&&h.index===f.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=Yn(t),c=za(t,this._lastEvent,s,l);s&&(this._lastEvent=null,A(o.onHover,[t,a,this],this),l&&A(o.onClick,[t,a,this],this));const h=!ie(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)}}S(rt,"defaults",R),S(rt,"instances",we),S(rt,"overrides",bt),S(rt,"registry",tt),S(rt,"version",La),S(rt,"getChart",$s);function Ys(){return O(rt.instances,i=>i._plugins.invalidate())}function Us(i,t,e=t){i.lineCap=C(e.borderCapStyle,t.borderCapStyle),i.setLineDash(C(e.borderDash,t.borderDash)),i.lineDashOffset=C(e.borderDashOffset,t.borderDashOffset),i.lineJoin=C(e.borderJoinStyle,t.borderJoinStyle),i.lineWidth=C(e.borderWidth,t.borderWidth),i.strokeStyle=C(e.borderColor,t.borderColor)}function Ba(i,t,e){i.lineTo(e.x,e.y)}function Na(i){return i.stepped?ko:i.tension||i.cubicInterpolationMode==="monotone"?wo:Ba}function Xs(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=n<r&&o<r||n>a&&o>a;return{count:s,start:l,loop:t.loop,ilen:c<l&&!h?s+c-l:c-l}}function Va(i,t,e,s){const{points:n,options:o}=t,{count:r,start:a,loop:l,ilen:c}=Xs(n,e,s),h=Na(o);let{move:f=!0,reverse:d}=s||{},u,m,g;for(u=0;u<=c;++u)m=n[(a+(d?c-u:u))%r],!m.skip&&(f?(i.moveTo(m.x,m.y),f=!1):h(i,g,m,d,o.stepped),g=m);return l&&(m=n[(a+(d?c:0))%r],h(i,g,m,d,o.stepped)),!!l}function ja(i,t,e,s){const n=t.points,{count:o,start:r,ilen:a}=Xs(n,e,s),{move:l=!0,reverse:c}=s||{};let h=0,f=0,d,u,m,g,p,b;const y=x=>(r+(c?a-x:x))%o,v=()=>{g!==p&&(i.lineTo(h,p),i.lineTo(h,g),i.lineTo(h,b))};for(l&&(u=n[y(0)],i.moveTo(u.x,u.y)),d=0;d<=a;++d){if(u=n[y(d)],u.skip)continue;const x=u.x,_=u.y,M=x|0;M===m?(_<g?g=_:_>p&&(p=_),h=(f*h+x)/++f):(v(),i.lineTo(x,_),m=M,f=0,g=p=_),b=_}v()}function ci(i){const t=i.options,e=t.borderDash&&t.borderDash.length;return!i._decimated&&!i._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?ja:Va}function Ha(i){return i.stepped?ir:i.tension||i.cubicInterpolationMode==="monotone"?sr:kt}function Wa(i,t,e,s){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,s)&&n.closePath()),Us(i,t.options),i.stroke(n)}function $a(i,t,e,s){const{segments:n,options:o}=t,r=ci(t);for(const a of n)Us(i,o,a.style),i.beginPath(),r(i,t,a,{start:e,end:e+s-1})&&i.closePath(),i.stroke()}const Ya=typeof Path2D=="function";function Ua(i,t,e,s){Ya&&!t.options.segment?Wa(i,t,e,s):$a(i,t,e,s)}class dt extends Mt{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;Ko(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=fr(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=rs(this,{property:e,start:n,end:n});if(!r.length)return;const a=[],l=Ha(s);let c,h;for(c=0,h=r.length;c<h;++c){const{start:f,end:d}=r[c],u=o[f],m=o[d];if(u===m){a.push(u);continue}const g=Math.abs((n-u[e])/(m[e]-u[e])),p=l(u,m,g,s.stepped);p[e]=t[e],a.push(p)}return a.length===1?a[0]:a}pathSegment(t,e,s){return ci(this)(t,this,e,s)}path(t,e,s){const n=this.segments,o=ci(this);let r=this._loop;e=e||0,s=s||this.points.length-e;for(const a of n)r&=o(t,this,a,{start:e,end:e+s-1});return!!r}draw(t,e,s,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),Ua(t,this,s,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}S(dt,"id","line"),S(dt,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),S(dt,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),S(dt,"descriptors",{_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"});function Ks(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class Me extends Mt{constructor(e){super();S(this,"parsed");S(this,"skip");S(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,s,n){const o=this.options,{x:r,y:a}=this.getProps(["x","y"],n);return Math.pow(e-r,2)+Math.pow(s-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,s){return Ks(this,e,"x",s)}inYRange(e,s){return Ks(this,e,"y",s)}getCenterPoint(e){const{x:s,y:n}=this.getProps(["x","y"],e);return{x:s,y:n}}size(e){e=e||this.options||{};let s=e.radius||0;s=Math.max(s,s&&e.hoverRadius||0);const n=s&&e.borderWidth||0;return(s+n)*2}draw(e,s){const n=this.options;this.skip||n.radius<.1||!jt(this,s,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,Ye(e,n,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}S(Me,"id","point"),S(Me,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),S(Me,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function Xa(i,t,e){const s=i.segments,n=i.points,o=t.points,r=[];for(const a of s){let{start:l,end:c}=a;c=Se(l,c,n);const h=hi(e,n[l],n[c],a.loop);if(!t.segments){r.push({source:a,target:h,start:n[l],end:n[c]});continue}const f=rs(t,h);for(const d of f){const u=hi(e,o[d.start],o[d.end],d.loop),m=os(a,n,u);for(const g of m)r.push({source:g,target:d,start:{[e]:qs(h,u,"start",Math.max)},end:{[e]:qs(h,u,"end",Math.min)}})}}return r}function hi(i,t,e,s){if(s)return;let n=t[i],o=e[i];return i==="angle"&&(n=Q(n),o=Q(o)),{property:i,start:n,end:o}}function Ka(i,t){const{x:e=null,y:s=null}=i||{},n=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=Se(r,a,n);const l=n[r],c=n[a];s!==null?(o.push({x:l.x,y:s}),o.push({x:c.x,y:s})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function Se(i,t,e){for(;t>i;t--){const s=e[t];if(!isNaN(s.x)&&!isNaN(s.y))break}return t}function qs(i,t,e,s){return i&&t?s(i[e],t[e]):i?i[e]:t?t[e]:0}function Gs(i,t){let e=[],s=!1;return z(i)?(s=!0,e=i):e=Ka(i,t),e.length?new dt({points:e,options:{tension:0},_loop:s,_fullLoop:s}):null}function Zs(i){return i&&i.fill!==!1}function qa(i,t,e){let n=i[t].fill;const o=[t];let r;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!V(n))return n;if(r=i[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function Ga(i,t,e){const s=tl(i);if(D(s))return isNaN(s.value)?!1:s;let n=parseFloat(s);return V(n)&&Math.floor(n)===n?Za(s[0],t,n,e):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function Za(i,t,e,s){return(i==="-"||i==="+")&&(e=t+e),e===t||e<0||e>=s?!1:e}function Qa(i,t){let e=null;return i==="start"?e=t.bottom:i==="end"?e=t.top:D(i)?e=t.getPixelForValue(i.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Ja(i,t,e){let s;return i==="start"?s=e:i==="end"?s=t.options.reverse?t.min:t.max:D(i)?s=i.value:s=t.getBaseValue(),s}function tl(i){const t=i.options,e=t.fill;let s=C(e&&e.target,e);return s===void 0&&(s=!!t.backgroundColor),s===!1||s===null?!1:s===!0?"origin":s}function el(i){const{scale:t,index:e,line:s}=i,n=[],o=s.segments,r=s.points,a=il(t,e);a.push(Gs({x:null,y:t.bottom},s));for(let l=0;l<o.length;l++){const c=o[l];for(let h=c.start;h<=c.end;h++)sl(n,r[h],a)}return new dt({points:n,options:{}})}function il(i,t){const e=[],s=i.getMatchingVisibleMetas("line");for(let n=0;n<s.length;n++){const o=s[n];if(o.index===t)break;o.hidden||e.unshift(o.dataset)}return e}function sl(i,t,e){const s=[];for(let n=0;n<e.length;n++){const o=e[n],{first:r,last:a,point:l}=nl(o,t,"x");if(!(!l||r&&a)){if(r)s.unshift(l);else if(i.push(l),!a)break}}i.push(...s)}function nl(i,t,e){const s=i.interpolate(t,e);if(!s)return{};const n=s[e],o=i.segments,r=i.points;let a=!1,l=!1;for(let c=0;c<o.length;c++){const h=o[c],f=r[h.start][e],d=r[h.end][e];if(Ai(n,f,d)){a=n===f,l=n===d;break}}return{first:a,last:l,point:s}}class Qs{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,s){const{x:n,y:o,radius:r}=this;return e=e||{start:0,end:Z},t.arc(n,o,r,e.end,e.start,!0),!s.bounds}interpolate(t){const{x:e,y:s,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:s+Math.sin(o)*n,angle:o}}}function ol(i){const{chart:t,fill:e,line:s}=i;if(V(e))return rl(t,e);if(e==="stack")return el(i);if(e==="shape")return!0;const n=al(i);return n instanceof Qs?n:Gs(n,s)}function rl(i,t){const e=i.getDatasetMeta(t);return e&&i.isDatasetVisible(t)?e.dataset:null}function al(i){return(i.scale||{}).getPointPositionForValue?cl(i):ll(i)}function ll(i){const{scale:t={},fill:e}=i,s=Qa(e,t);if(V(s)){const n=t.isHorizontal();return{x:n?s:null,y:n?null:s}}return null}function cl(i){const{scale:t,fill:e}=i,s=t.options,n=t.getLabels().length,o=s.reverse?t.max:t.min,r=Ja(e,t,o),a=[];if(s.grid.circular){const l=t.getPointPositionForValue(0,o);return new Qs({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(r)})}for(let l=0;l<n;++l)a.push(t.getPointPositionForValue(l,r));return a}function fi(i,t,e){const s=ol(t),{chart:n,index:o,line:r,scale:a,axis:l}=t,c=r.options,h=c.fill,f=c.backgroundColor,{above:d=f,below:u=f}=h||{},m=n.getDatasetMeta(o),g=cs(n,m);s&&r.points.length&&(Ue(i,e),hl(i,{line:r,target:s,above:d,below:u,area:e,scale:a,axis:l,clip:g}),Xe(i))}function hl(i,t){const{line:e,target:s,above:n,below:o,area:r,scale:a,clip:l}=t,c=e._loop?"angle":t.axis;i.save();let h=o;o!==n&&(c==="x"?(Js(i,s,r.top),di(i,{line:e,target:s,color:n,scale:a,property:c,clip:l}),i.restore(),i.save(),Js(i,s,r.bottom)):c==="y"&&(tn(i,s,r.left),di(i,{line:e,target:s,color:o,scale:a,property:c,clip:l}),i.restore(),i.save(),tn(i,s,r.right),h=n)),di(i,{line:e,target:s,color:h,scale:a,property:c,clip:l}),i.restore()}function Js(i,t,e){const{segments:s,points:n}=t;let o=!0,r=!1;i.beginPath();for(const a of s){const{start:l,end:c}=a,h=n[l],f=n[Se(l,c,n)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(h.x,e),i.lineTo(h.x,h.y)),r=!!t.pathSegment(i,a,{move:r}),r?i.closePath():i.lineTo(f.x,e)}i.lineTo(t.first().x,e),i.closePath(),i.clip()}function tn(i,t,e){const{segments:s,points:n}=t;let o=!0,r=!1;i.beginPath();for(const a of s){const{start:l,end:c}=a,h=n[l],f=n[Se(l,c,n)];o?(i.moveTo(h.x,h.y),o=!1):(i.lineTo(e,h.y),i.lineTo(h.x,h.y)),r=!!t.pathSegment(i,a,{move:r}),r?i.closePath():i.lineTo(e,f.y)}i.lineTo(e,t.first().y),i.closePath(),i.clip()}function di(i,t){const{line:e,target:s,property:n,color:o,scale:r,clip:a}=t,l=Xa(e,s,n);for(const{source:c,target:h,start:f,end:d}of l){const{style:{backgroundColor:u=o}={}}=c,m=s!==!0;i.save(),i.fillStyle=u,fl(i,r,a,m&&hi(n,f,d)),i.beginPath();const g=!!e.pathSegment(i,c);let p;if(m){g?i.closePath():en(i,s,d,n);const b=!!s.pathSegment(i,h,{move:g,reverse:!0});p=g&&b,p||en(i,s,f,n)}i.closePath(),i.fill(p?"evenodd":"nonzero"),i.restore()}}function fl(i,t,e,s){const n=t.chart.chartArea,{property:o,start:r,end:a}=s||{};if(o==="x"||o==="y"){let l,c,h,f;o==="x"?(l=r,c=n.top,h=a,f=n.bottom):(l=n.left,c=r,h=n.right,f=a),i.beginPath(),e&&(l=Math.max(l,e.left),h=Math.min(h,e.right),c=Math.max(c,e.top),f=Math.min(f,e.bottom)),i.rect(l,c,h-l,f-c),i.clip()}}function en(i,t,e,s){const n=t.interpolate(e,s);n&&i.lineTo(n.x,n.y)}var dl={id:"filler",afterDatasetsUpdate(i,t,e){const s=(i.data.datasets||[]).length,n=[];let o,r,a,l;for(r=0;r<s;++r)o=i.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof dt&&(l={visible:i.isDatasetVisible(r),index:r,fill:Ga(a,r,s),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,n.push(l);for(r=0;r<s;++r)l=n[r],!(!l||l.fill===!1)&&(l.fill=qa(n,r,e.propagate))},beforeDraw(i,t,e){const s=e.drawTime==="beforeDraw",n=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let r=n.length-1;r>=0;--r){const a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),s&&a.fill&&fi(i.ctx,a,o))}},beforeDatasetsDraw(i,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;const s=i.getSortedVisibleDatasetMetas();for(let n=s.length-1;n>=0;--n){const o=s[n].$filler;Zs(o)&&fi(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,t,e){const s=t.meta.$filler;!Zs(s)||e.drawTime!=="beforeDatasetDraw"||fi(i.ctx,s,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Gt={average(i){if(!i.length)return!1;let t,e,s=new Set,n=0,o=0;for(t=0,e=i.length;t<e;++t){const a=i[t].element;if(a&&a.hasValue()){const l=a.tooltipPosition();s.add(l.x),n+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((a,l)=>a+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<r;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=Ne(t,c);h<n&&(n=h,a=l)}}if(a){const l=a.tooltipPosition();e=l.x,s=l.y}return{x:e,y:s}}};function et(i,t){return t&&(z(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function at(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
|
|
`)>-1?i.split(`
|
|
`):i}function ul(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 sn(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:r,boxHeight:a}=t,l=J(t.bodyFont),c=J(t.titleFont),h=J(t.footerFont),f=o.length,d=n.length,u=s.length,m=ht(t.padding);let g=m.height,p=0,b=s.reduce((x,_)=>x+_.before.length+_.lines.length+_.after.length,0);if(b+=i.beforeBody.length+i.afterBody.length,f&&(g+=f*c.lineHeight+(f-1)*t.titleSpacing+t.titleMarginBottom),b){const x=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=u*x+(b-u)*l.lineHeight+(b-1)*t.bodySpacing}d&&(g+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let y=0;const v=function(x){p=Math.max(p,e.measureText(x).width+y)};return e.save(),e.font=c.string,O(i.title,v),e.font=l.string,O(i.beforeBody.concat(i.afterBody),v),y=t.displayColors?r+2+t.boxPadding:0,O(s,x=>{O(x.before,v),O(x.lines,v),O(x.after,v)}),y=0,e.font=h.string,O(i.footer,v),e.restore(),p+=m.width,{width:p,height:g}}function gl(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function pl(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 ml(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"),pl(c,i,t,e)&&(c="center"),c}function nn(i,t,e){const s=e.yAlign||t.yAlign||gl(i,e);return{xAlign:e.xAlign||t.xAlign||ml(i,t,e,s),yAlign:s}}function bl(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function _l(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function on(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=e,c=n+o,{topLeft:h,topRight:f,bottomLeft:d,bottomRight:u}=le(r);let m=bl(t,a);const g=_l(t,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(h,d)+n:a==="right"&&(m+=Math.max(f,u)+n),{x:Y(m,0,s.width-t.width),y:Y(g,0,s.height-t.height)}}function De(i,t,e){const s=ht(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function rn(i){return et([],at(i))}function yl(i,t,e){return yt(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function an(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const ln={beforeTitle:nt,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<s)return e[t.dataIndex]}return""},afterTitle:nt,beforeBody:nt,beforeLabel:nt,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let t=i.dataset.label||"";t&&(t+=": ");const e=i.formattedValue;return T(e)||(t+=e),t},labelColor(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){const e=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:nt,afterBody:nt,beforeFooter:nt,footer:nt,afterFooter:nt};function H(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?ln[t].call(e,s):n}class ui extends Mt{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 fs(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=yl(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=H(s,"beforeTitle",this,t),o=H(s,"title",this,t),r=H(s,"afterTitle",this,t);let a=[];return a=et(a,at(n)),a=et(a,at(o)),a=et(a,at(r)),a}getBeforeBody(t,e){return rn(H(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return O(t,o=>{const r={before:[],lines:[],after:[]},a=an(s,o);et(r.before,at(H(a,"beforeLabel",this,o))),et(r.lines,H(a,"label",this,o)),et(r.after,at(H(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return rn(H(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=H(s,"beforeFooter",this,t),o=H(s,"footer",this,t),r=H(s,"afterFooter",this,t);let a=[];return a=et(a,at(n)),a=et(a,at(o)),a=et(a,at(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;l<c;++l)a.push(ul(this.chart,e[l]));return t.filter&&(a=a.filter((h,f,d)=>t.filter(h,f,d,s))),t.itemSort&&(a=a.sort((h,f)=>t.itemSort(h,f,s))),O(a,h=>{const f=an(t.callbacks,h);n.push(H(f,"labelColor",this,h)),o.push(H(f,"labelPointStyle",this,h)),r.push(H(f,"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=Gt[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=sn(this,s),c=Object.assign({},a,l),h=nn(this.chart,s,c),f=on(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:f.x,y:f.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:f}=le(a),{x:d,y:u}=t,{width:m,height:g}=e;let p,b,y,v,x,_;return o==="center"?(x=u+g/2,n==="left"?(p=d,b=p-r,v=x+r,_=x-r):(p=d+m,b=p+r,v=x-r,_=x+r),y=p):(n==="left"?b=d+Math.max(l,h)+r:n==="right"?b=d+m-Math.max(c,f)-r:b=this.caretX,o==="top"?(v=u,x=v-r,p=b-r,y=b+r):(v=u+g,x=v+r,p=b+r,y=b-r),_=v),{x1:p,x2:b,x3:y,y1:v,y2:x,y3:_}}drawTitle(t,e,s){const n=this.title,o=n.length;let r,a,l;if(o){const c=Je(s.rtl,this.x,this.width);for(t.x=De(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",r=J(s.titleFont),a=s.titleSpacing,e.fillStyle=s.titleColor,e.font=r.string,l=0;l<o;++l)e.fillText(n[l],c.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+a,l+1===o&&(t.y+=s.titleMarginBottom-a)}}_drawColorBox(t,e,s,n,o){const r=this.labelColors[s],a=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=o,h=J(o.bodyFont),f=De(this,"left",o),d=n.x(f),u=l<h.lineHeight?(h.lineHeight-l)/2:0,m=e.y+u;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},p=n.leftForLtr(d,c)+c/2,b=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Ye(t,g,p,b),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Ye(t,g,p,b)}else{t.lineWidth=D(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const g=n.leftForLtr(d,c),p=n.leftForLtr(n.xPlus(d,1),c-2),b=le(r.borderRadius);Object.values(b).some(y=>y!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Ui(t,{x:g,y:m,w:c,h:l,radius:b}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Ui(t,{x:p,y:m+1,w:c-2,h:l-2,radius:b}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,m,c,l),t.strokeRect(g,m,c,l),t.fillStyle=r.backgroundColor,t.fillRect(p,m+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,f=J(s.bodyFont);let d=f.lineHeight,u=0;const m=Je(s.rtl,this.x,this.width),g=function(w){e.fillText(w,m.x(t.x+u),t.y+d/2),t.y+=d+o},p=m.textAlign(r);let b,y,v,x,_,M,k;for(e.textAlign=r,e.textBaseline="middle",e.font=f.string,t.x=De(this,p,s),e.fillStyle=s.bodyColor,O(this.beforeBody,g),u=a&&p!=="right"?r==="center"?c/2+h:c+2+h:0,x=0,M=n.length;x<M;++x){for(b=n[x],y=this.labelTextColors[x],e.fillStyle=y,O(b.before,g),v=b.lines,a&&v.length&&(this._drawColorBox(e,t,x,m,s),d=Math.max(f.lineHeight,l)),_=0,k=v.length;_<k;++_)g(v[_]),d=f.lineHeight;O(b.after,g)}u=0,d=f.lineHeight,O(this.afterBody,g),t.y-=o}drawFooter(t,e,s){const n=this.footer,o=n.length;let r,a;if(o){const l=Je(s.rtl,this.x,this.width);for(t.x=De(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=l.textAlign(s.footerAlign),e.textBaseline="middle",r=J(s.footerFont),e.fillStyle=s.footerColor,e.font=r.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+s.footerSpacing}}drawBackground(t,e,s,n){const{xAlign:o,yAlign:r}=this,{x:a,y:l}=t,{width:c,height:h}=s,{topLeft:f,topRight:d,bottomLeft:u,bottomRight:m}=le(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(a+f,l),r==="top"&&this.drawCaret(t,e,s,n),e.lineTo(a+c-d,l),e.quadraticCurveTo(a+c,l,a+c,l+d),r==="center"&&o==="right"&&this.drawCaret(t,e,s,n),e.lineTo(a+c,l+h-m),e.quadraticCurveTo(a+c,l+h,a+c-m,l+h),r==="bottom"&&this.drawCaret(t,e,s,n),e.lineTo(a+u,l+h),e.quadraticCurveTo(a,l+h,a,l+h-u),r==="center"&&o==="left"&&this.drawCaret(t,e,s,n),e.lineTo(a,l+f),e.quadraticCurveTo(a,l,a+f,l),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,s=this.$animations,n=s&&s.x,o=s&&s.y;if(n||o){const r=Gt[t.position].call(this,this._active,this._eventPosition);if(!r)return;const a=this._size=sn(this,t),l=Object.assign({},r,this._size),c=nn(e,t,l),h=on(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=ht(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),rr(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),ar(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=!ie(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||!ie(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=Gt[o.position].call(this,t,e);return r!==!1&&(s!==r.x||n!==r.y)}}S(ui,"positioners",Gt);var xl={id:"tooltip",_element:ui,positioners:Gt,afterInit(i,t,e){e&&(i.tooltip=new ui({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:ln},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 vl=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function kl(i,t,e,s){const n=i.indexOf(t);if(n===-1)return vl(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const wl=(i,t)=>i===null?null:Y(Math.round(i),0,t);function cn(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class gi extends At{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const s=this.getLabels();for(const{index:n,label:o}of e)s[n]===o&&s.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(T(t))return null;const s=this.getLabels();return e=isFinite(e)&&s[e]===t?e:kl(s,t,C(e,t),this._addedLabels),wl(e,s.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:s,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),e||(n=this.getLabels().length-1)),this.min=s,this.max=n}buildTicks(){const t=this.min,e=this.max,s=this.options.offset,n=[];let o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let r=t;r<=e;r++)n.push({value:r});return n}getLabelForValue(t){return cn.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}S(gi,"id","category"),S(gi,"defaults",{ticks:{callback:cn}});function Ml(i,t){const e=[],{bounds:n,step:o,min:r,max:a,precision:l,count:c,maxTicks:h,maxDigits:f,includeBounds:d}=i,u=o||1,m=h-1,{min:g,max:p}=t,b=!T(r),y=!T(a),v=!T(c),x=(p-g)/(f+1);let _=Oi((p-g)/m/u)*u,M,k,w,P;if(_<1e-14&&!b&&!y)return[{value:g},{value:p}];P=Math.ceil(p/_)-Math.floor(g/_),P>m&&(_=Oi(P*_/m/u)*u),T(l)||(M=Math.pow(10,l),_=Math.ceil(_*M)/M),n==="ticks"?(k=Math.floor(g/_)*_,w=Math.ceil(p/_)*_):(k=g,w=p),b&&y&&o&&Gn((a-r)/o,_/1e3)?(P=Math.round(Math.min((a-r)/_,h)),_=(a-r)/P,k=r,w=a):v?(k=b?r:k,w=y?a:w,P=c-1,_=(w-k)/P):(P=(w-k)/_,zt(P,Math.round(P),_/1e3)?P=Math.round(P):P=Math.ceil(P));const I=Math.max(Ci(_),Ci(k));M=Math.pow(10,T(l)?I:l),k=Math.round(k*M)/M,w=Math.round(w*M)/M;let L=0;for(b&&(d&&k!==r?(e.push({value:r}),k<r&&L++,zt(Math.round((k+L*_)*M)/M,r,hn(r,x,i))&&L++):k<r&&L++);L<P;++L){const E=Math.round((k+L*_)*M)/M;if(y&&E>a)break;e.push({value:E})}return y&&d&&w!==a?e.length&&zt(e[e.length-1].value,a,hn(a,x,i))?e[e.length-1].value=a:e.push({value:a}):(!y||w===a)&&e.push({value:w}),e}function hn(i,t,{horizontal:e,minRotation:s}){const n=pt(s),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+i).length;return Math.min(t/o,r)}class Sl extends At{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 T(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=Ot(n),c=Ot(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=Ml(n,o);return t.bounds==="ticks"&&Zn(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 ji(t,this.chart.options.locale,this.options.ticks.format)}}class pi extends Sl{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=V(t)?t:0,this.max=V(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=pt(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}}S(pi,"id","linear"),S(pi,"defaults",{ticks:{callback:Hi.formatters.numeric}});const Pe={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}},W=Object.keys(Pe);function fn(i,t){return i-t}function dn(i,t){if(T(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)),V(r)||(r=typeof s=="string"?e.parse(r,s):e.parse(r)),r===null?null:(n&&(r=n==="week"&&(Bt(o)||o===!0)?e.startOf(r,"isoWeek",o):e.startOf(r,n)),+r)}function un(i,t,e,s){const n=W.length;for(let o=W.indexOf(i);o<n-1;++o){const r=Pe[W[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((e-t)/(a*r.size))<=s)return W[o]}return W[n-1]}function Dl(i,t,e,s,n){for(let o=W.length-1;o>=W.indexOf(e);o--){const r=W[o];if(Pe[r].common&&i._adapter.diff(n,s,r)>=t-1)return r}return W[e?W.indexOf(e):0]}function Pl(i){for(let t=W.indexOf(i)+1,e=W.length;t<e;++t)if(Pe[W[t]].common)return W[t]}function gn(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:s,hi:n}=Ve(e,t),o=e[s]>=t?e[s]:e[n];i[o]=!0}}function Ol(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 pn(i,t,e){const s=[],n={},o=t.length;let r,a;for(r=0;r<o;++r)a=t[r],n[a]=r,s.push({value:a,major:!1});return o===0||!e?s:Ol(i,s,n,e)}class Oe extends At{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const s=t.time||(t.time={}),n=this._adapter=new Cr._date(t.adapters.date);n.init(e),Et(s.displayFormats,n.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:dn(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,s=t.time.unit||"day";let{min:n,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=V(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=V(o)&&!isNaN(o)?o:+e.endOf(Date.now(),s)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],s=t[t.length-1]),{min:e,max:s}}buildTicks(){const t=this.options,e=t.time,s=t.ticks,n=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,r=this.max,a=so(n,o,r);return this._unit=e.unit||(s.autoSkip?un(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):Dl(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:Pl(this._unit),this.initOffsets(n),t.reverse&&a.reverse(),pn(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+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=Y(e,0,r),s=Y(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||un(o.minUnit,e,s,this._getLabelCapacity(e)),a=C(n.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=Bt(l)||l===!0,h={};let f=e,d,u;if(c&&(f=+t.startOf(f,"isoWeek",l)),f=+t.startOf(f,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 m=n.ticks.source==="data"&&this.getDataTimestamps();for(d=f,u=0;d<s;d=+t.add(d,a,r),u++)gn(h,d,m);return(d===s||n.bounds==="ticks"||u===1)&&gn(h,d,m),Object.keys(h).sort(fn).map(g=>+g)}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 A(r,[t,e,s],this);const a=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&a[l],f=c&&a[c],d=s[e],u=c&&f&&d&&d.major;return this._adapter.format(t,n||(u?f:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;e<s;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+s)*e.factor)}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,s=this.ctx.measureText(t).width,n=pt(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),r=Math.sin(n),a=this._resolveTickFontOptions(0).size;return{w:s*o+a*r,h:s*r+a*o}}_getLabelCapacity(t){const e=this.options.time,s=e.displayFormats,n=s[e.unit]||s.millisecond,o=this._tickFormatFunction(t,0,pn(this,[t],this._majorUnit),n),r=this._getLabelSize(o),a=Math.floor(this.isHorizontal()?this.width/r.w:this.height/r.h)-1;return a>0?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<s;++e)t=t.concat(n[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let e,s;if(t.length)return t;const n=this.getLabels();for(e=0,s=n.length;e<s;++e)t.push(dn(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return oo(t.sort(fn))}}S(Oe,"id","time"),S(Oe,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ce(i,t,e){let s=0,n=i.length-1,o,r,a,l;e?(t>=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=mt(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}=mt(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 mn extends Oe{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=Ce(e,this.min),this._tableRange=Ce(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<a;++r)c=t[r],c>=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;r<a;++r)h=n[r+1],l=n[r-1],c=n[r],Math.round((h+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){const t=this.min,e=this.max;let s=super.getDataTimestamps();return(!s.includes(t)||!s.length)&&s.splice(0,0,t),(!s.includes(e)||s.length===1)&&s.push(e),s.sort((n,o)=>n-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(Ce(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Ce(this._table,s*this._tableRange+this._minPos,!0)}}S(mn,"id","timeseries"),S(mn,"defaults",Oe.defaults);function Cl(i,t,e,s,n,o,r,a){var l=typeof i=="function"?i.options:i;return t&&(l.render=t,l.staticRenderFns=e,l._compiled=!0),{exports:i,options:l}}rt.register(ge,dt,Me,pi,gi,dl,xl);const Tl={props:{analyticsData:{type:Object,default:()=>({})}},data(){return{startDate:"",endDate:"",data:this.analyticsData||{},chart:null}},computed:{hasData(){return this.data&&this.data.totalVisits>0},pagesPerSession(){var i;return(i=this.data)!=null&&i.uniqueSessions?(this.data.totalVisits/this.data.uniqueSessions).toFixed(1):"0"}},watch:{analyticsData(i){this.data=i||{},this.renderChart()}},mounted(){this.setDefaultDates(),this.fetchData()},beforeUnmount(){this.destroyChart()},methods:{setDefaultDates(){const i=new Date,t=new Date(i);t.setDate(t.getDate()-30),this.endDate=i.toISOString().split("T")[0],this.startDate=t.toISOString().split("T")[0]},async fetchData(){const i=new URLSearchParams;this.startDate&&i.set("startDate",this.startDate),this.endDate&&i.set("endDate",this.endDate);try{const e=await(await fetch(`/analytics-data.json?${i}`)).json();e.status==="success"&&(this.data=e.data),this.renderChart()}catch(t){console.error("Analytics fetch error:",t),this.renderChart()}},destroyChart(){this.chart&&(this.chart.destroy(),this.chart=null)},formatDateFR(i){const[t,e,s]=i.split("-");return`${s}/${e}/${t}`},renderChart(){var n;this.destroyChart();const i=this.$refs.chartCanvas;if(!i||!((n=this.data)!=null&&n.visitsByDay))return;const t=Object.keys(this.data.visitsByDay).map(o=>this.formatDateFR(o)),e=Object.values(this.data.visitsByDay);if(!t.length)return;const s=Math.max(...e);this.chart=new rt(i,{type:"line",data:{labels:t,datasets:[{label:"Visites",data:e,borderColor:"#4271ae",backgroundColor:"rgba(66, 113, 174, 0.1)",fill:!0,tension:.3,pointRadius:3,pointHoverRadius:5}]},options:{responsive:!0,maintainAspectRatio:!1,plugins:{tooltip:{mode:"index",intersect:!1}},scales:{y:{beginAtZero:!0,max:s+3,ticks:{precision:0}}}}})}}};var Al=function(){var t=this,e=t._self._c;return e("div",{staticClass:"k-analytics-dashboard"},[e("div",{staticClass:"k-analytics-filters"},[e("label",[t._v(" Du "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.startDate,expression:"startDate"}],attrs:{type:"date"},domProps:{value:t.startDate},on:{change:t.fetchData,input:function(s){s.target.composing||(t.startDate=s.target.value)}}})]),e("label",[t._v(" Au "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.endDate,expression:"endDate"}],attrs:{type:"date"},domProps:{value:t.endDate},on:{change:t.fetchData,input:function(s){s.target.composing||(t.endDate=s.target.value)}}})])]),t.hasData?[e("div",{staticClass:"k-analytics-grid"},[e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Sessions uniques")]),e("div",{staticClass:"k-analytics-metric"},[t._v(t._s(t.data.uniqueSessions))])]),e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Pages vues")]),e("div",{staticClass:"k-analytics-metric"},[t._v(t._s(t.data.totalVisits))])]),e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Pages / session")]),e("div",{staticClass:"k-analytics-metric"},[t._v(t._s(t.pagesPerSession))])])]),e("div",{staticClass:"k-analytics-chart-container"},[e("h3",[t._v("Visites par jour")]),e("canvas",{ref:"chartCanvas"})]),e("div",{staticClass:"k-analytics-grid k-analytics-grid--2col"},[t.data.visitsByPage&&Object.keys(t.data.visitsByPage).length?e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Pages les plus visitées")]),e("ul",{staticClass:"k-analytics-list"},t._l(t.data.visitsByPage,function(s,n){return e("li",{key:n},[e("span",{staticClass:"k-analytics-list-label"},[t._v(t._s(n))]),e("span",{staticClass:"k-analytics-list-value"},[t._v(t._s(s))])])}),0)]):t._e(),t.data.visitsByUser&&Object.keys(t.data.visitsByUser).length?e("div",{staticClass:"k-analytics-card"},[e("h3",[t._v("Utilisateurs les plus actifs")]),e("ul",{staticClass:"k-analytics-list"},t._l(t.data.visitsByUser,function(s,n){return e("li",{key:n},[e("span",{staticClass:"k-analytics-list-label"},[t._v(t._s(n))]),e("span",{staticClass:"k-analytics-list-value"},[t._v(t._s(s))])])}),0)]):t._e()])]:e("div",{staticClass:"k-analytics-empty"},[e("p",[t._v("Aucune donnée à afficher")])])],2)},Il=[],Ll=Cl(Tl,Al,Il);const Fl=Ll.exports;window.panel.plugin("adrienpayet/analytics",{fields:{"analytics-dashboard":Fl}})})();
|