var Ho=Object.defineProperty;var Vo=(i,t,e)=>t in i?Ho(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var w=(i,t,e)=>Vo(i,typeof t!="symbol"?t+"":t,e);import{M as Dn,a$ as Rn,a4 as Ei,bq as $o,aM as qo,ax as Yo,aC as Uo,bs as Xo,b6 as Li,an as Ko,ac as In,c3 as Bt,aR as Z,aE as O,s as W,t as ft,u as it,I as S,aq as Go,bE as En,dc as Qo,bI as Ln,bR as Fn,dg as Fi,am as Bi,bG as Zo,dA as Jo,cK as gs,de as ta,q as Bn,bK as ea,df as ia,F as It,dj as sa,dB as na,bx as k,c8 as $,v as E,H as st,b3 as L,c7 as ht,ao as ct,aP as Gi,cj as oa,ce as ze}from"./index-pVvkWKzi.js";import{a as Mt,c as At}from"./triplestore-DD4Ytlqh.js";import{L as zn}from"./LoadingSpinner-BjU99GiU.js";import{c as Ce,d as bi}from"./VDataTable-CcxiU4H1.js";import{a as aa,V as ps}from"./VInput-C6ablejM.js";import{V as ae}from"./VContainer-DfGidfZL.js";import"./VChip-CuvHYCvE.js";import"./VSlideGroup-CBZvK47O.js";/*!
 * @kurkle/color v0.3.2
 * https://github.com/kurkle/color#readme
 * (c) 2023 Jukka Kurkela
 * Released under the MIT License
 */function Ee(i){return i+.5|0}const Dt=(i,t,e)=>Math.max(Math.min(i,e),t);function ye(i){return Dt(Ee(i*2.55),0,255)}function Et(i){return Dt(Ee(i*255),0,255)}function Pt(i){return Dt(Ee(i/2.55)/100,0,1)}function ms(i){return Dt(Ee(i*100),0,100)}const ut={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},zi=[..."0123456789ABCDEF"],ra=i=>zi[i&15],la=i=>zi[(i&240)>>4]+zi[i&15],Ne=i=>(i&240)>>4===(i&15),ca=i=>Ne(i.r)&&Ne(i.g)&&Ne(i.b)&&Ne(i.a);function ha(i){var t=i.length,e;return i[0]==="#"&&(t===4||t===5?e={r:255&ut[i[1]]*17,g:255&ut[i[2]]*17,b:255&ut[i[3]]*17,a:t===5?ut[i[4]]*17:255}:(t===7||t===9)&&(e={r:ut[i[1]]<<4|ut[i[2]],g:ut[i[3]]<<4|ut[i[4]],b:ut[i[5]]<<4|ut[i[6]],a:t===9?ut[i[7]]<<4|ut[i[8]]:255})),e}const da=(i,t)=>i<255?t(i):"";function ua(i){var t=ca(i)?ra:la;return i?"#"+t(i.r)+t(i.g)+t(i.b)+da(i.a,t):void 0}const fa=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Nn(i,t,e){const s=t*Math.min(e,1-e),n=(o,a=(o+i/30)%12)=>e-s*Math.max(Math.min(a-3,9-a,1),-1);return[n(0),n(8),n(4)]}function _a(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 ga(i,t,e){const s=Nn(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 pa(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 Qi(i){const e=i.r/255,s=i.g/255,n=i.b/255,o=Math.max(e,s,n),a=Math.min(e,s,n),r=(o+a)/2;let l,c,h;return o!==a&&(h=o-a,c=r>.5?h/(2-o-a):h/(o+a),l=pa(e,s,n,h,o),l=l*60+.5),[l|0,c||0,r]}function Zi(i,t,e,s){return(Array.isArray(t)?i(t[0],t[1],t[2]):i(t,e,s)).map(Et)}function Ji(i,t,e){return Zi(Nn,i,t,e)}function ma(i,t,e){return Zi(ga,i,t,e)}function ba(i,t,e){return Zi(_a,i,t,e)}function jn(i){return(i%360+360)%360}function ya(i){const t=fa.exec(i);let e=255,s;if(!t)return;t[5]!==s&&(e=t[6]?ye(+t[5]):Et(+t[5]));const n=jn(+t[2]),o=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?s=ma(n,o,a):t[1]==="hsv"?s=ba(n,o,a):s=Ji(n,o,a),{r:s[0],g:s[1],b:s[2],a:e}}function xa(i,t){var e=Qi(i);e[0]=jn(e[0]+t),e=Ji(e),i.r=e[0],i.g=e[1],i.b=e[2]}function va(i){if(!i)return;const t=Qi(i),e=t[0],s=ms(t[1]),n=ms(t[2]);return i.a<255?`hsla(${e}, ${s}%, ${n}%, ${Pt(i.a)})`:`hsl(${e}, ${s}%, ${n}%)`}const bs={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"},ys={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 ka(){const i={},t=Object.keys(ys),e=Object.keys(bs);let s,n,o,a,r;for(s=0;s<t.length;s++){for(a=r=t[s],n=0;n<e.length;n++)o=e[n],r=r.replace(o,bs[o]);o=parseInt(ys[a],16),i[r]=[o>>16&255,o>>8&255,o&255]}return i}let je;function wa(i){je||(je=ka(),je.transparent=[0,0,0,0]);const t=je[i.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}const Sa=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Ma(i){const t=Sa.exec(i);let e=255,s,n,o;if(t){if(t[7]!==s){const a=+t[7];e=t[8]?ye(a):Dt(a*255,0,255)}return s=+t[1],n=+t[3],o=+t[5],s=255&(t[2]?ye(s):Dt(s,0,255)),n=255&(t[4]?ye(n):Dt(n,0,255)),o=255&(t[6]?ye(o):Dt(o,0,255)),{r:s,g:n,b:o,a:e}}}function Pa(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${Pt(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}const vi=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,Qt=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function Ta(i,t,e){const s=Qt(Pt(i.r)),n=Qt(Pt(i.g)),o=Qt(Pt(i.b));return{r:Et(vi(s+e*(Qt(Pt(t.r))-s))),g:Et(vi(n+e*(Qt(Pt(t.g))-n))),b:Et(vi(o+e*(Qt(Pt(t.b))-o))),a:i.a+e*(t.a-i.a)}}function We(i,t,e){if(i){let s=Qi(i);s[t]=Math.max(0,Math.min(s[t]+s[t]*e,t===0?360:1)),s=Ji(s),i.r=s[0],i.g=s[1],i.b=s[2]}}function Wn(i,t){return i&&Object.assign(t||{},i)}function xs(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=Et(i[3]))):(t=Wn(i,{r:0,g:0,b:0,a:1}),t.a=Et(t.a)),t}function Oa(i){return i.charAt(0)==="r"?Ma(i):ya(i)}class Ae{constructor(t){if(t instanceof Ae)return t;const e=typeof t;let s;e==="object"?s=xs(t):e==="string"&&(s=ha(t)||wa(t)||Oa(t)),this._rgb=s,this._valid=!!s}get valid(){return this._valid}get rgb(){var t=Wn(this._rgb);return t&&(t.a=Pt(t.a)),t}set rgb(t){this._rgb=xs(t)}rgbString(){return this._valid?Pa(this._rgb):void 0}hexString(){return this._valid?ua(this._rgb):void 0}hslString(){return this._valid?va(this._rgb):void 0}mix(t,e){if(t){const s=this.rgb,n=t.rgb;let o;const a=e===o?.5:e,r=2*a-1,l=s.a-n.a,c=((r*l===-1?r:(r+l)/(1+r*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=a*s.a+(1-a)*n.a,this.rgb=s}return this}interpolate(t,e){return t&&(this._rgb=Ta(this._rgb,t._rgb,e)),this}clone(){return new Ae(this.rgb)}alpha(t){return this._rgb.a=Et(t),this}clearer(t){const e=this._rgb;return e.a*=1-t,this}greyscale(){const t=this._rgb,e=Ee(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 We(this._rgb,2,t),this}darken(t){return We(this._rgb,2,-t),this}saturate(t){return We(this._rgb,1,t),this}desaturate(t){return We(this._rgb,1,-t),this}rotate(t){return xa(this._rgb,t),this}}/*!
 * Chart.js v4.4.4
 * https://www.chartjs.org
 * (c) 2024 Chart.js Contributors
 * Released under the MIT License
 */function kt(){}const Ca=(()=>{let i=0;return()=>i++})();function z(i){return i===null||typeof i>"u"}function U(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 I(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function gt(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function mt(i,t){return gt(i)?i:t}function F(i,t){return typeof i>"u"?t:i}const Aa=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/t,Hn=(i,t)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*t:+i;function j(i,t,e){if(i&&typeof i.call=="function")return i.apply(e,t)}function B(i,t,e,s){let n,o,a;if(U(i))for(o=i.length,n=0;n<o;n++)t.call(e,i[n],n);else if(I(i))for(a=Object.keys(i),o=a.length,n=0;n<o;n++)t.call(e,i[a[n]],a[n])}function ai(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 ri(i){if(U(i))return i.map(ri);if(I(i)){const t=Object.create(null),e=Object.keys(i),s=e.length;let n=0;for(;n<s;++n)t[e[n]]=ri(i[e[n]]);return t}return i}function Vn(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function Da(i,t,e,s){if(!Vn(i))return;const n=t[i],o=e[i];I(n)&&I(o)?xt(n,o,s):t[i]=ri(o)}function xt(i,t,e){const s=U(t)?t:[t],n=s.length;if(!I(i))return i;e=e||{};const o=e.merger||Da;let a;for(let r=0;r<n;++r){if(a=s[r],!I(a))continue;const l=Object.keys(a);for(let c=0,h=l.length;c<h;++c)o(l[c],i,a,e)}return i}function we(i,t){return xt(i,t,{merger:Ra})}function Ra(i,t,e){if(!Vn(i))return;const s=t[i],n=e[i];I(s)&&I(n)?we(s,n):Object.prototype.hasOwnProperty.call(t,i)||(t[i]=ri(n))}const vs={"":i=>i,x:i=>i.x,y:i=>i.y};function Ia(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 Ea(i){const t=Ia(i);return e=>{for(const s of t){if(s==="")break;e=e&&e[s]}return e}}function Ut(i,t){return(vs[t]||(vs[t]=Ea(t)))(i)}function ts(i){return i.charAt(0).toUpperCase()+i.slice(1)}const De=i=>typeof i<"u",Ft=i=>typeof i=="function",ks=(i,t)=>{if(i.size!==t.size)return!1;for(const e of i)if(!t.has(e))return!1;return!0};function La(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}const K=Math.PI,X=2*K,li=Number.POSITIVE_INFINITY,Fa=K/180,G=K/2,jt=K/4,ws=K*2/3,Ni=Math.log10,Lt=Math.sign;function ei(i,t,e){return Math.abs(i-t)<e}function Ss(i){const t=Math.round(i);i=ei(i,t,i/1e3)?t:i;const e=Math.pow(10,Math.floor(Ni(i))),s=i/e;return(s<=1?1:s<=2?2:s<=5?5:10)*e}function Ba(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 ci(i){return!isNaN(parseFloat(i))&&isFinite(i)}function za(i,t){const e=Math.round(i);return e-t<=i&&e+t>=i}function Na(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 Tt(i){return i*(K/180)}function ja(i){return i*(180/K)}function Ms(i){if(!gt(i))return;let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}function $n(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*K&&(o+=X),{angle:o,distance:n}}function Wa(i,t){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2))}function Wt(i){return(i%X+X)%X}function hi(i,t,e,s){const n=Wt(i),o=Wt(t),a=Wt(e),r=Wt(o-n),l=Wt(a-n),c=Wt(n-o),h=Wt(n-a);return n===o||n===a||s&&o===a||r>l&&c<h}function rt(i,t,e){return Math.max(t,Math.min(e,i))}function Ha(i){return rt(i,-32768,32767)}function qt(i,t,e,s=1e-6){return i>=Math.min(t,e)-s&&i<=Math.max(t,e)+s}function es(i,t,e){e=e||(a=>i[a]<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 ji=(i,t,e,s)=>es(i,e,s?n=>{const o=i[n][t];return o<e||o===e&&i[n+1][t]===e}:n=>i[n][t]<e),Va=(i,t,e)=>es(i,e,s=>i[s][t]>=e);function $a(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 qn=["push","pop","shift","splice","unshift"];function qa(i,t){if(i._chartjs){i._chartjs.listeners.push(t);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),qn.forEach(e=>{const s="_onData"+ts(e),n=i[e];Object.defineProperty(i,e,{configurable:!0,enumerable:!1,value(...o){const a=n.apply(this,o);return i._chartjs.listeners.forEach(r=>{typeof r[s]=="function"&&r[s](...o)}),a}})})}function Ps(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)&&(qn.forEach(o=>{delete i[o]}),delete i._chartjs)}function Yn(i){const t=new Set(i);return t.size===i.length?i:Array.from(t)}const Un=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function Xn(i,t){let e=[],s=!1;return function(...n){e=n,s||(s=!0,Un.call(window,()=>{s=!1,i.apply(t,e)}))}}function Ya(i,t){let e;return function(...s){return t?(clearTimeout(e),e=setTimeout(i,t,s)):i.apply(this,s),t}}const is=i=>i==="start"?"left":i==="end"?"right":"center",et=(i,t,e)=>i==="start"?t:i==="end"?e:(t+e)/2,Ua=(i,t,e,s)=>i===(s?"left":"right")?e:i==="center"?(t+e)/2:t,He=i=>i===0||i===1,Ts=(i,t,e)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-t)*X/e)),Os=(i,t,e)=>Math.pow(2,-10*i)*Math.sin((i-t)*X/e)+1,Se={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*G)+1,easeOutSine:i=>Math.sin(i*G),easeInOutSine:i=>-.5*(Math.cos(K*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=>He(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=>He(i)?i:Ts(i,.075,.3),easeOutElastic:i=>He(i)?i:Os(i,.075,.3),easeInOutElastic(i){return He(i)?i:i<.5?.5*Ts(i*2,.1125,.45):.5+.5*Os(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-Se.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?Se.easeInBounce(i*2)*.5:Se.easeOutBounce(i*2-1)*.5+.5};function Kn(i){if(i&&typeof i=="object"){const t=i.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Cs(i){return Kn(i)?i:new Ae(i)}function ki(i){return Kn(i)?i:new Ae(i).saturate(.5).darken(.1).hexString()}const Xa=["x","y","borderWidth","radius","tension"],Ka=["color","borderColor","backgroundColor"];function Ga(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:Ka},numbers:{type:"number",properties:Xa}}),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 Qa(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}const As=new Map;function Za(i,t){t=t||{};const e=i+JSON.stringify(t);let s=As.get(e);return s||(s=new Intl.NumberFormat(i,t),As.set(e,s)),s}function ss(i,t,e){return Za(t,e).format(i)}const Gn={values(i){return U(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=Ja(i,e)}const a=Ni(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ss(i,s,l)},logarithmic(i,t,e){if(i===0)return"0";const s=e[t].significand||i/Math.pow(10,Math.floor(Ni(i)));return[1,2,3,5,10,15].includes(s)||t>.8*e.length?Gn.numeric.call(this,i,t,e):""}};function Ja(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 Qn={formatters:Gn};function tr(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:Qn.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 Xt=Object.create(null),Wi=Object.create(null);function Me(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 wi(i,t,e){return typeof t=="string"?xt(Me(i,t),e):xt(Me(i,""),t)}class er{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)=>ki(n.backgroundColor),this.hoverBorderColor=(s,n)=>ki(n.borderColor),this.hoverColor=(s,n)=>ki(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 wi(this,t,e)}get(t){return Me(this,t)}describe(t,e){return wi(Wi,t,e)}override(t,e){return wi(Xt,t,e)}route(t,e,s,n){const o=Me(this,t),a=Me(this,s),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const l=this[r],c=a[n];return I(l)?Object.assign({},c,l):F(l,c)},set(l){this[r]=l}}})}apply(t){t.forEach(e=>e(this))}}var q=new er({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Ga,Qa,tr]);function ir(i){return!i||z(i.size)||z(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ds(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 Ht(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 Rs(i,t){!t&&!i||(t=t||i.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,i.width,i.height),t.restore())}function Hi(i,t,e,s){Zn(i,t,e,s,null)}function Zn(i,t,e,s,n){let o,a,r,l,c,h,d,u;const f=t.pointStyle,g=t.rotation,_=t.radius;let p=(g||0)*Fa;if(f&&typeof f=="object"&&(o=f.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(e,s),i.rotate(p),i.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),i.restore();return}if(!(isNaN(_)||_<=0)){switch(i.beginPath(),f){default:n?i.ellipse(e,s,n/2,_,0,0,X):i.arc(e,s,_,0,X),i.closePath();break;case"triangle":h=n?n/2:_,i.moveTo(e+Math.sin(p)*h,s-Math.cos(p)*_),p+=ws,i.lineTo(e+Math.sin(p)*h,s-Math.cos(p)*_),p+=ws,i.lineTo(e+Math.sin(p)*h,s-Math.cos(p)*_),i.closePath();break;case"rectRounded":c=_*.516,l=_-c,a=Math.cos(p+jt)*l,d=Math.cos(p+jt)*(n?n/2-c:l),r=Math.sin(p+jt)*l,u=Math.sin(p+jt)*(n?n/2-c:l),i.arc(e-d,s-r,c,p-K,p-G),i.arc(e+u,s-a,c,p-G,p),i.arc(e+d,s+r,c,p,p+G),i.arc(e-u,s+a,c,p+G,p+K),i.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*_,h=n?n/2:l,i.rect(e-h,s-l,2*h,2*l);break}p+=jt;case"rectRot":d=Math.cos(p)*(n?n/2:_),a=Math.cos(p)*_,r=Math.sin(p)*_,u=Math.sin(p)*(n?n/2:_),i.moveTo(e-d,s-r),i.lineTo(e+u,s-a),i.lineTo(e+d,s+r),i.lineTo(e-u,s+a),i.closePath();break;case"crossRot":p+=jt;case"cross":d=Math.cos(p)*(n?n/2:_),a=Math.cos(p)*_,r=Math.sin(p)*_,u=Math.sin(p)*(n?n/2:_),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+u,s-a),i.lineTo(e-u,s+a);break;case"star":d=Math.cos(p)*(n?n/2:_),a=Math.cos(p)*_,r=Math.sin(p)*_,u=Math.sin(p)*(n?n/2:_),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+u,s-a),i.lineTo(e-u,s+a),p+=jt,d=Math.cos(p)*(n?n/2:_),a=Math.cos(p)*_,r=Math.sin(p)*_,u=Math.sin(p)*(n?n/2:_),i.moveTo(e-d,s-r),i.lineTo(e+d,s+r),i.moveTo(e+u,s-a),i.lineTo(e-u,s+a);break;case"line":a=n?n/2:Math.cos(p)*_,r=Math.sin(p)*_,i.moveTo(e-a,s-r),i.lineTo(e+a,s+r);break;case"dash":i.moveTo(e,s),i.lineTo(e+Math.cos(p)*(n?n/2:_),s+Math.sin(p)*_);break;case!1:i.closePath();break}i.fill(),t.borderWidth>0&&i.stroke()}}function ns(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 os(i,t){i.save(),i.beginPath(),i.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),i.clip()}function as(i){i.restore()}function sr(i,t){t.translation&&i.translate(t.translation[0],t.translation[1]),z(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 nr(i,t,e,s,n){if(n.strikethrough||n.underline){const o=i.measureText(s),a=t-o.actualBoundingBoxLeft,r=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(a,h),i.lineTo(r,h),i.stroke()}}function or(i,t){const e=i.fillStyle;i.fillStyle=t.color,i.fillRect(t.left,t.top,t.width,t.height),i.fillStyle=e}function Re(i,t,e,s,n,o={}){const a=U(t)?t:[t],r=o.strokeWidth>0&&o.strokeColor!=="";let l,c;for(i.save(),i.font=n.string,sr(i,o),l=0;l<a.length;++l)c=a[l],o.backdrop&&or(i,o.backdrop),r&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),z(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,e,s,o.maxWidth)),i.fillText(c,e,s,o.maxWidth),nr(i,e,s,c,o),s+=Number(n.lineHeight);i.restore()}function di(i,t){const{x:e,y:s,w:n,h:o,radius:a}=t;i.arc(e+a.topLeft,s+a.topLeft,a.topLeft,1.5*K,K,!0),i.lineTo(e,s+o-a.bottomLeft),i.arc(e+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,K,G,!0),i.lineTo(e+n-a.bottomRight,s+o),i.arc(e+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,G,0,!0),i.lineTo(e+n,s+a.topRight),i.arc(e+n-a.topRight,s+a.topRight,a.topRight,0,-G,!0),i.lineTo(e+a.topLeft,s)}const ar=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,rr=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function lr(i,t){const e=(""+i).match(ar);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 cr=i=>+i||0;function rs(i,t){const e={},s=I(t),n=s?Object.keys(t):t,o=I(i)?s?a=>F(i[a],i[t[a]]):a=>i[a]:()=>i;for(const a of n)e[a]=cr(o(a));return e}function Jn(i){return rs(i,{top:"y",right:"x",bottom:"y",left:"x"})}function se(i){return rs(i,["topLeft","topRight","bottomLeft","bottomRight"])}function dt(i){const t=Jn(i);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function J(i,t){i=i||{},t=t||q.font;let e=F(i.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let s=F(i.style,t.style);s&&!(""+s).match(rr)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:F(i.family,t.family),lineHeight:lr(F(i.lineHeight,t.lineHeight),e),size:e,style:s,weight:F(i.weight,t.weight),string:""};return n.string=ir(n),n}function V(i,t,e,s){let n,o,a;for(n=0,o=i.length;n<o;++n)if(a=i[n],a!==void 0&&(t!==void 0&&typeof a=="function"&&(a=a(t)),e!==void 0&&U(a)&&(a=a[e%a.length]),a!==void 0))return a}function hr(i,t,e){const{min:s,max:n}=i,o=Hn(t,(n-s)/2),a=(r,l)=>e&&r===0?0:r+l;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function ce(i,t){return Object.assign(Object.create(i),t)}function ls(i,t=[""],e,s,n=()=>i[0]){const o=e||i;typeof s>"u"&&(s=so("_fallback",i));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:s,_getTarget:n,override:r=>ls([r,...i],t,o,s)};return new Proxy(a,{deleteProperty(r,l){return delete r[l],delete r._keys,delete i[0][l],!0},get(r,l){return eo(r,l,()=>br(l,t,i,r))},getOwnPropertyDescriptor(r,l){return Reflect.getOwnPropertyDescriptor(r._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(r,l){return Es(r).includes(l)},ownKeys(r){return Es(r)},set(r,l,c){const h=r._storage||(r._storage=n());return r[l]=h[l]=c,delete r._keys,!0}})}function re(i,t,e,s){const n={_cacheable:!1,_proxy:i,_context:t,_subProxy:e,_stack:new Set,_descriptors:to(i,s),setContext:o=>re(i,o,e,s),override:o=>re(i.override(o),t,e,s)};return new Proxy(n,{deleteProperty(o,a){return delete o[a],delete i[a],!0},get(o,a,r){return eo(o,a,()=>ur(o,a,r))},getOwnPropertyDescriptor(o,a){return o._descriptors.allKeys?Reflect.has(i,a)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,a)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,a){return Reflect.has(i,a)},ownKeys(){return Reflect.ownKeys(i)},set(o,a,r){return i[a]=r,delete o[a],!0}})}function to(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:Ft(e)?e:()=>e,isIndexable:Ft(s)?s:()=>s}}const dr=(i,t)=>i?i+ts(t):t,cs=(i,t)=>I(t)&&i!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function eo(i,t,e){if(Object.prototype.hasOwnProperty.call(i,t)||t==="constructor")return i[t];const s=e();return i[t]=s,s}function ur(i,t,e){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=i;let r=s[t];return Ft(r)&&a.isScriptable(t)&&(r=fr(t,r,i,e)),U(r)&&r.length&&(r=_r(t,r,i,a.isIndexable)),cs(t,r)&&(r=re(r,n,o&&o[t],a)),r}function fr(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=e;if(r.has(i))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+i);r.add(i);let l=t(o,a||s);return r.delete(i),cs(i,l)&&(l=hs(n._scopes,n,i,l)),l}function _r(i,t,e,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=e;if(typeof o.index<"u"&&s(i))return t[o.index%t.length];if(I(t[0])){const l=t,c=n._scopes.filter(h=>h!==l);t=[];for(const h of l){const d=hs(c,n,i,h);t.push(re(d,o,a&&a[i],r))}}return t}function io(i,t,e){return Ft(i)?i(t,e):i}const gr=(i,t)=>i===!0?t:typeof i=="string"?Ut(t,i):void 0;function pr(i,t,e,s,n){for(const o of t){const a=gr(e,o);if(a){i.add(a);const r=io(a._fallback,e,n);if(typeof r<"u"&&r!==e&&r!==s)return r}else if(a===!1&&typeof s<"u"&&e!==s)return null}return!1}function hs(i,t,e,s){const n=t._rootScopes,o=io(t._fallback,e,s),a=[...i,...n],r=new Set;r.add(s);let l=Is(r,a,e,o||e,s);return l===null||typeof o<"u"&&o!==e&&(l=Is(r,a,o,l,s),l===null)?!1:ls(Array.from(r),[""],n,o,()=>mr(t,e,s))}function Is(i,t,e,s,n){for(;e;)e=pr(i,t,e,s,n);return e}function mr(i,t,e){const s=i._getTarget();t in s||(s[t]={});const n=s[t];return U(n)&&I(e)?e:n||{}}function br(i,t,e,s){let n;for(const o of t)if(n=so(dr(o,i),e),typeof n<"u")return cs(i,n)?hs(e,s,i,n):n}function so(i,t){for(const e of t){if(!e)continue;const s=e[i];if(typeof s<"u")return s}}function Es(i){let t=i._keys;return t||(t=i._keys=yr(i._scopes)),t}function yr(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)}function ds(){return typeof window<"u"&&typeof document<"u"}function us(i){let t=i.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function ui(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 yi=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function xr(i,t){return yi(i).getPropertyValue(t)}const vr=["top","right","bottom","left"];function Yt(i,t,e){const s={};e=e?"-"+e:"";for(let n=0;n<4;n++){const o=vr[n];s[o]=parseFloat(i[t+"-"+o+e])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const kr=(i,t,e)=>(i>0||t>0)&&(!e||!e.shadowRoot);function wr(i,t){const e=i.touches,s=e&&e.length?e[0]:i,{offsetX:n,offsetY:o}=s;let a=!1,r,l;if(kr(n,o,i.target))r=n,l=o;else{const c=t.getBoundingClientRect();r=s.clientX-c.left,l=s.clientY-c.top,a=!0}return{x:r,y:l,box:a}}function $t(i,t){if("native"in i)return i;const{canvas:e,currentDevicePixelRatio:s}=t,n=yi(e),o=n.boxSizing==="border-box",a=Yt(n,"padding"),r=Yt(n,"border","width"),{x:l,y:c,box:h}=wr(i,e),d=a.left+(h&&r.left),u=a.top+(h&&r.top);let{width:f,height:g}=t;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*e.width/s),y:Math.round((c-u)/g*e.height/s)}}function Sr(i,t,e){let s,n;if(t===void 0||e===void 0){const o=i&&us(i);if(!o)t=i.clientWidth,e=i.clientHeight;else{const a=o.getBoundingClientRect(),r=yi(o),l=Yt(r,"border","width"),c=Yt(r,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,s=ui(r.maxWidth,o,"clientWidth"),n=ui(r.maxHeight,o,"clientHeight")}}return{width:t,height:e,maxWidth:s||li,maxHeight:n||li}}const Ve=i=>Math.round(i*10)/10;function Mr(i,t,e,s){const n=yi(i),o=Yt(n,"margin"),a=ui(n.maxWidth,i,"clientWidth")||li,r=ui(n.maxHeight,i,"clientHeight")||li,l=Sr(i,t,e);let{width:c,height:h}=l;if(n.boxSizing==="content-box"){const u=Yt(n,"border","width"),f=Yt(n,"padding");c-=f.width+u.width,h-=f.height+u.height}return c=Math.max(0,c-o.width),h=Math.max(0,s?c/s:h-o.height),c=Ve(Math.min(c,a,l.maxWidth)),h=Ve(Math.min(h,r,l.maxHeight)),c&&!h&&(h=Ve(c/2)),(t!==void 0||e!==void 0)&&s&&l.height&&h>l.height&&(h=l.height,c=Ve(Math.floor(h*s))),{width:c,height:h}}function Ls(i,t,e){const s=t||1,n=Math.floor(i.height*s),o=Math.floor(i.width*s);i.height=Math.floor(i.height),i.width=Math.floor(i.width);const a=i.canvas;return a.style&&(e||!a.style.height&&!a.style.width)&&(a.style.height=`${i.height}px`,a.style.width=`${i.width}px`),i.currentDevicePixelRatio!==s||a.height!==n||a.width!==o?(i.currentDevicePixelRatio=s,a.height=n,a.width=o,i.ctx.setTransform(s,0,0,s,0,0),!0):!1}const Pr=function(){let i=!1;try{const t={get passive(){return i=!0,!1}};ds()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch{}return i}();function Fs(i,t){const e=xr(i,t),s=e&&e.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}const Tr=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 ne(i,t,e){return i?Tr(t,e):Or()}function no(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 oo(i,t){t!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",t[0],t[1]))}/*!
 * Chart.js v4.4.4
 * https://www.chartjs.org
 * (c) 2024 Chart.js Contributors
 * Released under the MIT License
 */class Cr{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],a=e.duration;o.forEach(r=>r({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(s-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Un.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 a=o.length-1,r=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>s.duration&&(s.duration=l._total),l.tick(t),r=!0):(o[a]=o[o.length-1],o.pop());r&&(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 wt=new Cr;const Bs="transparent",Ar={boolean(i,t,e){return e>.5?t:i},color(i,t,e){const s=Cs(i||Bs),n=s.valid&&Cs(t||Bs);return n&&n.valid?n.mix(s,e).hexString():t},number(i,t,e){return i+(t-i)*e}};class Dr{constructor(t,e,s,n){const o=e[s];n=V([t.to,n,o,t.from]);const a=V([t.from,o,n]);this._active=!0,this._fn=t.fn||Ar[t.type||typeof a],this._easing=Se[t.easing]||Se.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=a,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,a=this._duration-o;this._start=s,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=V([t.to,e,n,t.from]),this._from=V([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,a=this._loop,r=this._to;let l;if(this._active=o!==r&&(a||e<s),!this._active){this._target[n]=r,this._notify(!0);return}if(e<0){this._target[n]=o;return}l=e/s%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[n]=this._fn(o,r,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 ao{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!I(t))return;const e=Object.keys(q.animation),s=this._properties;Object.getOwnPropertyNames(t).forEach(n=>{const o=t[n];if(!I(o))return;const a={};for(const r of e)a[r]=o[r];(U(o.properties)&&o.properties||[n]).forEach(r=>{(r===n||!s.has(r))&&s.set(r,a)})})}_animateOptions(t,e){const s=e.options,n=Ir(t,s);if(!n)return[];const o=this._createAnimations(n,s);return s.$shared&&Rr(t.options.$animations,s).then(()=>{t.options=s},()=>{}),o}_createAnimations(t,e){const s=this._properties,n=[],o=t.$animations||(t.$animations={}),a=Object.keys(e),r=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){n.push(...this._animateOptions(t,e));continue}const h=e[c];let d=o[c];const u=s.get(c);if(d)if(u&&d.active()){d.update(u,h,r);continue}else d.cancel();if(!u||!u.duration){t[c]=h;continue}o[c]=d=new Dr(u,t,c,h),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}const s=this._createAnimations(t,e);if(s.length)return wt.add(this._chart,s),!0}}function Rr(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 Ir(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 zs(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 Er(i,t,e){if(e===!1)return!1;const s=zs(i,e),n=zs(t,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}function Lr(i){let t,e,s,n;return I(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 ro(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 Ns(i,t,e,s={}){const n=i.keys,o=s.mode==="single";let a,r,l,c;if(t!==null){for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===e){if(s.all)continue;break}c=i.values[l],gt(c)&&(o||t===0||Lt(t)===Lt(c))&&(t+=c)}return t}}function Fr(i,t){const{iScale:e,vScale:s}=t,n=e.axis==="x"?"x":"y",o=s.axis==="x"?"x":"y",a=Object.keys(i),r=new Array(a.length);let l,c,h;for(l=0,c=a.length;l<c;++l)h=a[l],r[l]={[n]:h,[o]:i[h]};return r}function js(i,t){const e=i&&i.options.stacked;return e||e===void 0&&t.stack!==void 0}function Br(i,t,e){return`${i.id}.${t.id}.${e.stack||e.type}`}function zr(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 Nr(i,t,e){const s=i[t]||(i[t]={});return s[e]||(s[e]={})}function Ws(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 Hs(i,t){const{chart:e,_cachedMeta:s}=i,n=e._stacks||(e._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,c=a.axis,h=Br(o,a,s),d=t.length;let u;for(let f=0;f<d;++f){const g=t[f],{[l]:_,[c]:p}=g,m=g._stacks||(g._stacks={});u=m[c]=Nr(n,h,_),u[r]=p,u._top=Ws(u,a,!0,s.type),u._bottom=Ws(u,a,!1,s.type);const b=u._visualValues||(u._visualValues={});b[r]=p}}function Si(i,t){const e=i.scales;return Object.keys(e).filter(s=>e[s].axis===t).shift()}function jr(i,t){return ce(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Wr(i,t,e){return ce(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function fe(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 Mi=i=>i==="reset"||i==="none",Vs=(i,t)=>t?i:Object.assign({},i),Hr=(i,t,e)=>i&&!t.hidden&&t._stacked&&{keys:ro(e,!0),values:null};class oe{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=js(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&&fe(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,s=this.getDataset(),n=(d,u,f,g)=>d==="x"?u:d==="r"?g:f,o=e.xAxisID=F(s.xAxisID,Si(t,"x")),a=e.yAxisID=F(s.yAxisID,Si(t,"y")),r=e.rAxisID=F(s.rAxisID,Si(t,"r")),l=e.indexAxis,c=e.iAxisID=n(l,o,a,r),h=e.vAxisID=n(l,a,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(a),e.rScale=this.getScaleForId(r),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&&Ps(this._data,this),t._stacked&&fe(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),s=this._data;if(I(e)){const n=this._cachedMeta;this._data=Fr(e,n)}else if(s!==e){if(s){Ps(s,this);const n=this._cachedMeta;fe(n),n._parsed=[]}e&&Object.isExtensible(e)&&qa(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=js(e.vScale,e),e.stack!==s.stack&&(n=!0,fe(e),e.stack=s.stack),this._resyncElements(t),(n||o!==e._stacked)&&Hs(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:s,_data:n}=this,{iScale:o,_stacked:a}=s,r=o.axis;let l=t===0&&e===n.length?!0:s._sorted,c=t>0&&s._parsed[t-1],h,d,u;if(this._parsing===!1)s._parsed=n,s._sorted=!0,u=n;else{U(n[t])?u=this.parseArrayData(s,n,t,e):I(n[t])?u=this.parseObjectData(s,n,t,e):u=this.parsePrimitiveData(s,n,t,e);const f=()=>d[r]===null||c&&d[r]<c[r];for(h=0;h<e;++h)s._parsed[h+t]=d=u[h],l&&(f()&&(l=!1),c=d);s._sorted=l}a&&Hs(this,u)}parsePrimitiveData(t,e,s,n){const{iScale:o,vScale:a}=t,r=o.axis,l=a.axis,c=o.getLabels(),h=o===a,d=new Array(n);let u,f,g;for(u=0,f=n;u<f;++u)g=u+s,d[u]={[r]:h||o.parse(c[g],g),[l]:a.parse(e[g],g)};return d}parseArrayData(t,e,s,n){const{xScale:o,yScale:a}=t,r=new Array(n);let l,c,h,d;for(l=0,c=n;l<c;++l)h=l+s,d=e[h],r[l]={x:o.parse(d[0],h),y:a.parse(d[1],h)};return r}parseObjectData(t,e,s,n){const{xScale:o,yScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=new Array(n);let h,d,u,f;for(h=0,d=n;h<d;++h)u=h+s,f=e[u],c[h]={x:o.parse(Ut(f,r),u),y:a.parse(Ut(f,l),u)};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,a=e[t.axis],r={keys:ro(n,!0),values:e._stacks[t.axis]._visualValues};return Ns(r,a,o.index,{mode:s})}updateRangeFromParsed(t,e,s,n){const o=s[e.axis];let a=o===null?NaN:o;const r=n&&s._stacks[e.axis];n&&r&&(n.values=r,a=Ns(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){const s=this._cachedMeta,n=s._parsed,o=s._sorted&&t===s.iScale,a=n.length,r=this._getOtherScale(t),l=Hr(e,s,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=zr(r);let u,f;function g(){f=n[u];const _=f[r.axis];return!gt(f[t.axis])||h>_||d<_}for(u=0;u<a&&!(!g()&&(this.updateRangeFromParsed(c,t,f,l),o));++u);if(o){for(u=a-1;u>=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,s=[];let n,o,a;for(n=0,o=e.length;n<o;++n)a=e[n][t.axis],gt(a)&&s.push(a);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=Lr(F(this.options.clip,Er(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,a=[],r=this._drawStart||0,l=this._drawCount||n.length-r,c=this.options.drawActiveElementsOnTop;let h;for(s.dataset&&s.dataset.draw(t,o,r,l),h=r;h<r+l;++h){const d=n[h];d.hidden||(d.active&&c?a.push(d):d.draw(t,o))}for(h=0;h<a.length;++h)a[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 a=this._cachedMeta.data[t];o=a.$context||(a.$context=Wr(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=jr(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,a=t+"-"+e,r=o[a],l=this.enableOptionSharing&&De(s);if(r)return Vs(r,l);const c=this.chart.config,h=c.datasetElementScopeKeys(this._type,t),d=n?[`${t}Hover`,"hover",t,""]:[t,""],u=c.getOptionScopes(this.getDataset(),h),f=Object.keys(q.elements[t]),g=()=>this.getContext(s,n,e),_=c.resolveNamedOptions(u,f,g,d);return _.$shared&&(_.$shared=l,o[a]=Object.freeze(Vs(_,l))),_}_resolveAnimations(t,e,s){const n=this.chart,o=this._cachedDataOpts,a=`animation-${e}`,r=o[a];if(r)return r;let l;if(n.options.animation!==!1){const h=this.chart.config,d=h.datasetAnimationScopeKeys(this._type,e),u=h.getOptionScopes(this.getDataset(),d);l=h.createResolver(u,this.getContext(t,s,e))}const c=new ao(n,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Mi(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const s=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(s),a=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,s),{sharedOptions:o,includeOptions:a}}updateElement(t,e,s,n){Mi(n)?Object.assign(t,s):this._resolveAnimations(e,n).update(t,s)}updateSharedOptions(t,e,s){t&&!Mi(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[r,l,c]of this._syncList)this[r](l,c);this._syncList=[];const n=s.length,o=e.length,a=Math.min(o,n);a&&this.parse(0,a),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,a=t+e;let r;const l=c=>{for(c.length+=e,r=c.length-1;r>=a;r--)c[r]=c[r-e]};for(l(o),r=t;r<a;++r)o[r]=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&&fe(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])}}w(oe,"defaults",{}),w(oe,"datasetElementType",null),w(oe,"dataElementType",null);function Vr(i,t){if(!i._cache.$bar){const e=i.getMatchingVisibleMetas(t);let s=[];for(let n=0,o=e.length;n<o;n++)s=s.concat(e[n].controller.getAllParsedValues(i));i._cache.$bar=Yn(s.sort((n,o)=>n-o))}return i._cache.$bar}function $r(i){const t=i.iScale,e=Vr(t,i.type);let s=t._length,n,o,a,r;const l=()=>{a===32767||a===-32768||(De(r)&&(s=Math.min(s,Math.abs(a-r)||s)),r=a)};for(n=0,o=e.length;n<o;++n)a=t.getPixelForValue(e[n]),l();for(r=void 0,n=0,o=t.ticks.length;n<o;++n)a=t.getPixelForTick(n),l();return s}function qr(i,t,e,s){const n=e.barThickness;let o,a;return z(n)?(o=t.min*e.categoryPercentage,a=e.barPercentage):(o=n*s,a=1),{chunk:o/s,ratio:a,start:t.pixels[i]-o/2}}function Yr(i,t,e,s){const n=t.pixels,o=n[i];let a=i>0?n[i-1]:null,r=i<n.length-1?n[i+1]:null;const l=e.categoryPercentage;a===null&&(a=o-(r===null?t.end-t.start:r-o)),r===null&&(r=o+o-a);const c=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/s,ratio:e.barPercentage,start:c}}function Ur(i,t,e,s){const n=e.parse(i[0],s),o=e.parse(i[1],s),a=Math.min(n,o),r=Math.max(n,o);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:n,end:o,min:a,max:r}}function lo(i,t,e,s){return U(i)?Ur(i,t,e,s):t[e.axis]=e.parse(i,s),t}function $s(i,t,e,s){const n=i.iScale,o=i.vScale,a=n.getLabels(),r=n===o,l=[];let c,h,d,u;for(c=e,h=e+s;c<h;++c)u=t[c],d={},d[n.axis]=r||n.parse(a[c],c),l.push(lo(u,d,o,c));return l}function Pi(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function Xr(i,t,e){return i!==0?Lt(i):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Kr(i){let t,e,s,n,o;return i.horizontal?(t=i.base>i.x,e="left",s="right"):(t=i.base<i.y,e="bottom",s="top"),t?(n="end",o="start"):(n="start",o="end"),{start:e,end:s,reverse:t,top:n,bottom:o}}function Gr(i,t,e,s){let n=t.borderSkipped;const o={};if(!n){i.borderSkipped=o;return}if(n===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:r,reverse:l,top:c,bottom:h}=Kr(i);n==="middle"&&e&&(i.enableBorderRadius=!0,(e._top||0)===s?n=c:(e._bottom||0)===s?n=h:(o[qs(h,a,r,l)]=!0,n=c)),o[qs(n,a,r,l)]=!0,i.borderSkipped=o}function qs(i,t,e,s){return s?(i=Qr(i,t,e),i=Ys(i,e,t)):i=Ys(i,t,e),i}function Qr(i,t,e){return i===t?e:i===e?t:i}function Ys(i,t,e){return i==="start"?t:i==="end"?e:i}function Zr(i,{inflateAmount:t},e){i.inflateAmount=t==="auto"?e===1?.33:0:t}class ii extends oe{parsePrimitiveData(t,e,s,n){return $s(t,e,s,n)}parseArrayData(t,e,s,n){return $s(t,e,s,n)}parseObjectData(t,e,s,n){const{iScale:o,vScale:a}=t,{xAxisKey:r="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?r:l,h=a.axis==="x"?r:l,d=[];let u,f,g,_;for(u=s,f=s+n;u<f;++u)_=e[u],g={},g[o.axis]=o.parse(Ut(_,c),u),d.push(lo(Ut(_,h),g,a,u));return d}updateRangeFromParsed(t,e,s,n){super.updateRangeFromParsed(t,e,s,n);const o=s._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:s,vScale:n}=e,o=this.getParsed(t),a=o._custom,r=Pi(a)?"["+a.start+", "+a.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+s.getLabelForValue(o[s.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,s,n){const o=n==="reset",{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),c=r.isHorizontal(),h=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+s;f++){const g=this.getParsed(f),_=o||z(g[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),p=this._calculateBarIndexPixels(f,h),m=(g._stacks||{})[r.axis],b={horizontal:c,base:_.base,enableBorderRadius:!m||Pi(g._custom)||a===m._top||a===m._bottom,x:c?_.head:p.center,y:c?p.center:_.head,height:c?p.size:Math.abs(_.size),width:c?Math.abs(_.size):p.size};u&&(b.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));const y=b.options||t[f].options;Gr(b,y,m,a),Zr(b,y,h.ratio),this.updateElement(t[f],f,b,n)}}_getStacks(t,e){const{iScale:s}=this._cachedMeta,n=s.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),o=s.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[s.axis],c=h=>{const d=h._parsed.find(f=>f[s.axis]===l),u=d&&d[h.vScale.axis];if(z(u)||isNaN(u))return!0};for(const h of n)if(!(e!==void 0&&c(h))&&((o===!1||a.indexOf(h.stack)===-1||o===void 0&&h.stack===void 0)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,s){const n=this._getStacks(t,s),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,s=e.iScale,n=[];let o,a;for(o=0,a=e.data.length;o<a;++o)n.push(s.getPixelForValue(this.getParsed(o)[s.axis],o));const r=t.barThickness;return{min:r||$r(e),pixels:n,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:s,index:n},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),c=l._custom,h=Pi(c);let d=l[e.axis],u=0,f=s?this.applyStack(e,l,s):d,g,_;f!==d&&(u=f-d,f=d),h&&(d=c.barStart,f=c.barEnd-c.barStart,d!==0&&Lt(d)!==Lt(c.barEnd)&&(u=0),u+=d);const p=!z(o)&&!h?o:u;let m=e.getPixelForValue(p);if(this.chart.getDataVisibility(t)?g=e.getPixelForValue(u+f):g=m,_=g-m,Math.abs(_)<a){_=Xr(_,e,r)*a,d===r&&(m-=_/2);const b=e.getPixelForDecimal(0),y=e.getPixelForDecimal(1),v=Math.min(b,y),x=Math.max(b,y);m=Math.max(Math.min(m,x),v),g=m+_,s&&!h&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(g)-e.getValueForPixel(m))}if(m===e.getPixelForValue(r)){const b=Lt(_)*e.getLineWidthForValue(r)/2;m+=b,_-=b}return{size:_,base:m,head:g,center:g+_/2}}_calculateBarIndexPixels(t,e){const s=e.scale,n=this.options,o=n.skipNull,a=F(n.maxBarThickness,1/0);let r,l;if(e.grouped){const c=o?this._getStackCount(t):e.stackCount,h=n.barThickness==="flex"?Yr(t,e,n,c):qr(t,e,n,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=h.start+h.chunk*d+h.chunk/2,l=Math.min(a,h.chunk*h.ratio)}else r=s.getPixelForValue(this.getParsed(t)[s.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){const t=this._cachedMeta,e=t.vScale,s=t.data,n=s.length;let o=0;for(;o<n;++o)this.getParsed(o)[e.axis]!==null&&!s[o].hidden&&s[o].draw(this._ctx)}}w(ii,"id","bar"),w(ii,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),w(ii,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});function Jr(i,t,e){let s=1,n=1,o=0,a=0;if(t<X){const r=i,l=r+t,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(y,v,x)=>hi(y,r,l,!0)?1:Math.max(v,v*e,x,x*e),g=(y,v,x)=>hi(y,r,l,!0)?-1:Math.min(v,v*e,x,x*e),_=f(0,c,d),p=f(G,h,u),m=g(K,c,d),b=g(K+G,h,u);s=(_-m)/2,n=(p-b)/2,o=-(_+m)/2,a=-(p+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}class xe extends oe{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const s=this.getDataset().data,n=this._cachedMeta;if(this._parsing===!1)n._parsed=s;else{let o=l=>+s[l];if(I(s[t])){const{key:l="value"}=this._parsing;o=c=>+Ut(s[c],l)}let a,r;for(a=t,r=t+e;a<r;++a)n._parsed[a]=o(a)}}_getRotation(){return Tt(this.options.rotation-90)}_getCircumference(){return Tt(this.options.circumference)}_getRotationExtents(){let t=X,e=-X;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){const n=this.chart.getDatasetMeta(s).controller,o=n._getRotation(),a=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+a)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:s}=e,n=this._cachedMeta,o=n.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(s.width,s.height)-a)/2,0),l=Math.min(Aa(this.options.cutout,r),1),c=this._getRingWeight(this.index),{circumference:h,rotation:d}=this._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:g,offsetY:_}=Jr(d,h,l),p=(s.width-a)/u,m=(s.height-a)/f,b=Math.max(Math.min(p,m)/2,0),y=Hn(this.options.radius,b),v=Math.max(y*l,0),x=(y-v)/this._getVisibleDatasetWeightTotal();this.offsetX=g*y,this.offsetY=_*y,n.total=this.calculateTotal(),this.outerRadius=y-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const s=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||n._parsed[t]===null||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/X)}updateElements(t,e,s,n){const o=n==="reset",a=this.chart,r=a.chartArea,c=a.options.animation,h=(r.left+r.right)/2,d=(r.top+r.bottom)/2,u=o&&c.animateScale,f=u?0:this.innerRadius,g=u?0:this.outerRadius,{sharedOptions:_,includeOptions:p}=this._getSharedOptions(e,n);let m=this._getRotation(),b;for(b=0;b<e;++b)m+=this._circumference(b,o);for(b=e;b<e+s;++b){const y=this._circumference(b,o),v=t[b],x={x:h+this.offsetX,y:d+this.offsetY,startAngle:m,endAngle:m+y,circumference:y,outerRadius:g,innerRadius:f};p&&(x.options=_||this.resolveDataElementOptions(b,v.active?"active":n)),m+=y,this.updateElement(v,b,x,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let s=0,n;for(n=0;n<e.length;n++){const o=t._parsed[n];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(n)&&!e[n].hidden&&(s+=Math.abs(o))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?X*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,s=this.chart,n=s.data.labels||[],o=ss(e._parsed[t],s.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const s=this.chart;let n,o,a,r,l;if(!t){for(n=0,o=s.data.datasets.length;n<o;++n)if(s.isDatasetVisible(n)){a=s.getDatasetMeta(n),t=a.data,r=a.controller;break}}if(!t)return 0;for(n=0,o=t.length;n<o;++n)l=r.resolveDataElementOptions(n),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let s=0,n=t.length;s<n;++s){const o=this.resolveDataElementOptions(s);e=Math.max(e,o.offset||0,o.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(e+=this._getRingWeight(s));return e}_getRingWeight(t){return Math.max(F(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}w(xe,"id","doughnut"),w(xe,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),w(xe,"descriptors",{_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),w(xe,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:s,color:n}}=t.legend.options;return e.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:n,lineWidth:l.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,e,s){s.chart.toggleDataVisibility(e.index),s.chart.update()}}}});class Vi extends xe{}w(Vi,"id","pie"),w(Vi,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});function Vt(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class fs{constructor(t){w(this,"options");this.options=t||{}}static override(t){Object.assign(fs.prototype,t)}init(){}formats(){return Vt()}parse(){return Vt()}format(){return Vt()}add(){return Vt()}diff(){return Vt()}startOf(){return Vt()}endOf(){return Vt()}}var tl={_date:fs};function el(i,t,e,s){const{controller:n,data:o,_sorted:a}=i,r=n._cachedMeta.iScale;if(r&&t===r.axis&&t!=="r"&&a&&o.length){const l=r._reversePixels?Va:ji;if(s){if(n._sharedOptions){const c=o[0],h=typeof c.getRange=="function"&&c.getRange(t);if(h){const d=l(o,t,e-h),u=l(o,t,e+h);return{lo:d.lo,hi:u.hi}}}}else return l(o,t,e)}return{lo:0,hi:o.length-1}}function Le(i,t,e,s,n){const o=i.getSortedVisibleDatasetMetas(),a=e[t];for(let r=0,l=o.length;r<l;++r){const{index:c,data:h}=o[r],{lo:d,hi:u}=el(o[r],t,a,n);for(let f=d;f<=u;++f){const g=h[f];g.skip||s(g,c,f)}}}function il(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,a=e?Math.abs(s.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Ti(i,t,e,s,n){const o=[];return!n&&!i.isPointInArea(t)||Le(i,e,t,function(r,l,c){!n&&!ns(r,i.chartArea,0)||r.inRange(t.x,t.y,s)&&o.push({element:r,datasetIndex:l,index:c})},!0),o}function sl(i,t,e,s){let n=[];function o(a,r,l){const{startAngle:c,endAngle:h}=a.getProps(["startAngle","endAngle"],s),{angle:d}=$n(a,{x:t.x,y:t.y});hi(d,c,h)&&n.push({element:a,datasetIndex:r,index:l})}return Le(i,e,t,o),n}function nl(i,t,e,s,n,o){let a=[];const r=il(e);let l=Number.POSITIVE_INFINITY;function c(h,d,u){const f=h.inRange(t.x,t.y,n);if(s&&!f)return;const g=h.getCenterPoint(n);if(!(!!o||i.isPointInArea(g))&&!f)return;const p=r(t,g);p<l?(a=[{element:h,datasetIndex:d,index:u}],l=p):p===l&&a.push({element:h,datasetIndex:d,index:u})}return Le(i,e,t,c),a}function Oi(i,t,e,s,n,o){return!o&&!i.isPointInArea(t)?[]:e==="r"&&!s?sl(i,t,e,n):nl(i,t,e,s,n,o)}function Us(i,t,e,s,n){const o=[],a=e==="x"?"inXRange":"inYRange";let r=!1;return Le(i,e,t,(l,c,h)=>{l[a]&&l[a](t[e],n)&&(o.push({element:l,datasetIndex:c,index:h}),r=r||l.inRange(t.x,t.y,n))}),s&&!r?[]:o}var ol={evaluateInteractionItems:Le,modes:{index(i,t,e,s){const n=$t(t,i),o=e.axis||"x",a=e.includeInvisible||!1,r=e.intersect?Ti(i,n,o,s,a):Oi(i,n,o,!1,s,a),l=[];return r.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{const h=r[0].index,d=c.data[h];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:h})}),l):[]},dataset(i,t,e,s){const n=$t(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;let r=e.intersect?Ti(i,n,o,s,a):Oi(i,n,o,!1,s,a);if(r.length>0){const l=r[0].datasetIndex,c=i.getDatasetMeta(l).data;r=[];for(let h=0;h<c.length;++h)r.push({element:c[h],datasetIndex:l,index:h})}return r},point(i,t,e,s){const n=$t(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return Ti(i,n,o,s,a)},nearest(i,t,e,s){const n=$t(t,i),o=e.axis||"xy",a=e.includeInvisible||!1;return Oi(i,n,o,e.intersect,s,a)},x(i,t,e,s){const n=$t(t,i);return Us(i,n,"x",e.intersect,s)},y(i,t,e,s){const n=$t(t,i);return Us(i,n,"y",e.intersect,s)}}};const co=["left","top","right","bottom"];function _e(i,t){return i.filter(e=>e.pos===t)}function Xs(i,t){return i.filter(e=>co.indexOf(e.pos)===-1&&e.box.axis===t)}function ge(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 al(i){const t=[];let e,s,n,o,a,r;for(e=0,s=(i||[]).length;e<s;++e)n=i[e],{position:o,options:{stack:a,stackWeight:r=1}}=n,t.push({index:e,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return t}function rl(i){const t={};for(const e of i){const{stack:s,pos:n,stackWeight:o}=e;if(!s||!co.includes(n))continue;const a=t[s]||(t[s]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function ll(i,t){const e=rl(i),{vBoxMaxWidth:s,hBoxMaxHeight:n}=t;let o,a,r;for(o=0,a=i.length;o<a;++o){r=i[o];const{fullSize:l}=r.box,c=e[r.stack],h=c&&r.stackWeight/c.weight;r.horizontal?(r.width=h?h*s:l&&t.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:l&&t.availableHeight)}return e}function cl(i){const t=al(i),e=ge(t.filter(c=>c.box.fullSize),!0),s=ge(_e(t,"left"),!0),n=ge(_e(t,"right")),o=ge(_e(t,"top"),!0),a=ge(_e(t,"bottom")),r=Xs(t,"x"),l=Xs(t,"y");return{fullSize:e,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:_e(t,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}function Ks(i,t,e,s){return Math.max(i[e],t[e])+Math.max(i[s],t[s])}function ho(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 hl(i,t,e,s){const{pos:n,box:o}=e,a=i.maxPadding;if(!I(n)){e.size&&(i[n]-=e.size);const d=s[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,i[n]+=e.size}o.getPadding&&ho(a,o.getPadding());const r=Math.max(0,t.outerWidth-Ks(a,i,"left","right")),l=Math.max(0,t.outerHeight-Ks(a,i,"top","bottom")),c=r!==i.w,h=l!==i.h;return i.w=r,i.h=l,e.horizontal?{same:c,other:h}:{same:h,other:c}}function dl(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 ul(i,t){const e=t.maxPadding;function s(n){const o={left:0,top:0,right:0,bottom:0};return n.forEach(a=>{o[a]=Math.max(t[a],e[a])}),o}return s(i?["left","right"]:["top","bottom"])}function ve(i,t,e,s){const n=[];let o,a,r,l,c,h;for(o=0,a=i.length,c=0;o<a;++o){r=i[o],l=r.box,l.update(r.width||t.w,r.height||t.h,ul(r.horizontal,t));const{same:d,other:u}=hl(t,e,r,s);c|=d&&n.length,h=h||u,l.fullSize||n.push(r)}return c&&ve(n,t,e,s)||h}function $e(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 Gs(i,t,e,s){const n=e.padding;let{x:o,y:a}=t;for(const r of i){const l=r.box,c=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/c.weight||1;if(r.horizontal){const d=t.w*h,u=c.size||l.height;De(c.start)&&(a=c.start),l.fullSize?$e(l,n.left,a,e.outerWidth-n.right-n.left,u):$e(l,t.left+c.placed,a,d,u),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*h,u=c.size||l.width;De(c.start)&&(o=c.start),l.fullSize?$e(l,o,n.top,u,e.outerHeight-n.bottom-n.top):$e(l,o,t.top+c.placed,u,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=a}var _t={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=dt(i.options.layout.padding),o=Math.max(t-n.width,0),a=Math.max(e-n.height,0),r=cl(i.boxes),l=r.vertical,c=r.horizontal;B(i.boxes,_=>{typeof _.beforeLayout=="function"&&_.beforeLayout()});const h=l.reduce((_,p)=>p.box.options&&p.box.options.display===!1?_:_+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},n);ho(u,dt(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=ll(l.concat(c),d);ve(r.fullSize,f,d,g),ve(l,f,d,g),ve(c,f,d,g)&&ve(l,f,d,g),dl(f),Gs(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,Gs(r.rightAndBottom,f,d,g),i.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},B(r.chartArea,_=>{const p=_.box;Object.assign(p,i.chartArea),p.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}};class uo{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 fl extends uo{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const si="$chartjs",_l={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Qs=i=>i===null||i==="";function gl(i,t){const e=i.style,s=i.getAttribute("height"),n=i.getAttribute("width");if(i[si]={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",Qs(n)){const o=Fs(i,"width");o!==void 0&&(i.width=o)}if(Qs(s))if(i.style.height==="")i.height=i.width/(t||2);else{const o=Fs(i,"height");o!==void 0&&(i.height=o)}return i}const fo=Pr?{passive:!0}:!1;function pl(i,t,e){i&&i.addEventListener(t,e,fo)}function ml(i,t,e){i&&i.canvas&&i.canvas.removeEventListener(t,e,fo)}function bl(i,t){const e=_l[i.type]||i.type,{x:s,y:n}=$t(i,t);return{type:e,chart:t,native:i,x:s!==void 0?s:null,y:n!==void 0?n:null}}function fi(i,t){for(const e of i)if(e===t||e.contains(t))return!0}function yl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||fi(r.addedNodes,s),a=a&&!fi(r.removedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function xl(i,t,e){const s=i.canvas,n=new MutationObserver(o=>{let a=!1;for(const r of o)a=a||fi(r.removedNodes,s),a=a&&!fi(r.addedNodes,s);a&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}const Ie=new Map;let Zs=0;function _o(){const i=window.devicePixelRatio;i!==Zs&&(Zs=i,Ie.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function vl(i,t){Ie.size||window.addEventListener("resize",_o),Ie.set(i,t)}function kl(i){Ie.delete(i),Ie.size||window.removeEventListener("resize",_o)}function wl(i,t,e){const s=i.canvas,n=s&&us(s);if(!n)return;const o=Xn((r,l)=>{const c=n.clientWidth;e(r,l),c<n.clientWidth&&e()},window),a=new ResizeObserver(r=>{const l=r[0],c=l.contentRect.width,h=l.contentRect.height;c===0&&h===0||o(c,h)});return a.observe(n),vl(i,o),a}function Ci(i,t,e){e&&e.disconnect(),t==="resize"&&kl(i)}function Sl(i,t,e){const s=i.canvas,n=Xn(o=>{i.ctx!==null&&e(bl(o,i))},i);return pl(s,t,n),n}class Ml extends uo{acquireContext(t,e){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(gl(t,e),s):null}releaseContext(t){const e=t.canvas;if(!e[si])return!1;const s=e[si].initial;["height","width"].forEach(o=>{const a=s[o];z(a)?e.removeAttribute(o):e.setAttribute(o,a)});const n=s.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[si],!0}addEventListener(t,e,s){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),a={attach:yl,detach:xl,resize:wl}[e]||Sl;n[e]=a(t,e,s)}removeEventListener(t,e){const s=t.$proxies||(t.$proxies={}),n=s[e];if(!n)return;({attach:Ci,detach:Ci,resize:Ci}[e]||ml)(t,e,n),s[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,s,n){return Mr(t,e,s,n)}isAttached(t){const e=t&&us(t);return!!(e&&e.isConnected)}}function Pl(i){return!ds()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?fl:Ml}class vt{constructor(){w(this,"x");w(this,"y");w(this,"active",!1);w(this,"options");w(this,"$animations")}tooltipPosition(t){const{x:e,y:s}=this.getProps(["x","y"],t);return{x:e,y:s}}hasValue(){return ci(this.x)&&ci(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}}w(vt,"defaults",{}),w(vt,"defaultRoutes");function Tl(i,t){const e=i.options.ticks,s=Ol(i),n=Math.min(e.maxTicksLimit||s,s),o=e.major.enabled?Al(t):[],a=o.length,r=o[0],l=o[a-1],c=[];if(a>n)return Dl(t,c,o,a/n),c;const h=Cl(o,t,n);if(a>0){let d,u;const f=a>1?Math.round((l-r)/(a-1)):null;for(qe(t,c,h,z(f)?0:r-f,r),d=0,u=a-1;d<u;d++)qe(t,c,h,o[d],o[d+1]);return qe(t,c,h,l,z(f)?t.length:l+f),c}return qe(t,c,h),c}function Ol(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 Cl(i,t,e){const s=Rl(i),n=t.length/e;if(!s)return Math.max(n,1);const o=Ba(s);for(let a=0,r=o.length-1;a<r;a++){const l=o[a];if(l>n)return l}return Math.max(n,1)}function Al(i){const t=[];let e,s;for(e=0,s=i.length;e<s;e++)i[e].major&&t.push(e);return t}function Dl(i,t,e,s){let n=0,o=e[0],a;for(s=Math.ceil(s),a=0;a<i.length;a++)a===o&&(t.push(i[a]),n++,o=e[n*s])}function qe(i,t,e,s,n){const o=F(s,0),a=Math.min(F(n,i.length),i.length);let r=0,l,c,h;for(e=Math.ceil(e),n&&(l=n-s,e=l/Math.floor(l/e)),h=o;h<0;)r++,h=Math.round(o+r*e);for(c=Math.max(o,0);c<a;c++)c===h&&(t.push(i[c]),r++,h=Math.round(o+r*e))}function Rl(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 Il=i=>i==="left"?"right":i==="right"?"left":i,Js=(i,t,e)=>t==="top"||t==="left"?i[t]+e:i[t]-e,tn=(i,t)=>Math.min(t||i,i);function en(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 El(i,t,e){const s=i.ticks.length,n=Math.min(t,s-1),o=i._startPixel,a=i._endPixel,r=1e-6;let l=i.getPixelForTick(n),c;if(!(e&&(s===1?c=Math.max(l-o,a-l):t===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(n-1))/2,l+=n<t?c:-c,l<o-r||l>a+r)))return l}function Ll(i,t){B(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 pe(i){return i.drawTicks?i.tickLength:0}function sn(i,t){if(!i.display)return 0;const e=J(i.font,t),s=dt(i.padding);return(U(i.text)?i.text.length:1)*e.lineHeight+s.height}function Fl(i,t){return ce(i,{scale:t,type:"scale"})}function Bl(i,t,e){return ce(i,{tick:e,index:t,type:"tick"})}function zl(i,t,e){let s=is(i);return(e&&t!=="right"||!e&&t==="right")&&(s=Il(s)),s}function Nl(i,t,e,s){const{top:n,left:o,bottom:a,right:r,chart:l}=i,{chartArea:c,scales:h}=l;let d=0,u,f,g;const _=a-n,p=r-o;if(i.isHorizontal()){if(f=et(s,o,r),I(e)){const m=Object.keys(e)[0],b=e[m];g=h[m].getPixelForValue(b)+_-t}else e==="center"?g=(c.bottom+c.top)/2+_-t:g=Js(i,e,t);u=r-o}else{if(I(e)){const m=Object.keys(e)[0],b=e[m];f=h[m].getPixelForValue(b)-p+t}else e==="center"?f=(c.left+c.right)/2-p+t:f=Js(i,e,t);g=et(s,a,n),d=e==="left"?-G:G}return{titleX:f,titleY:g,maxWidth:u,rotation:d}}class he extends vt{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=mt(t,Number.POSITIVE_INFINITY),e=mt(e,Number.NEGATIVE_INFINITY),s=mt(s,Number.POSITIVE_INFINITY),n=mt(n,Number.NEGATIVE_INFINITY),{min:mt(t,s),max:mt(e,n),minDefined:gt(t),maxDefined:gt(e)}}getMinMax(t){let{min:e,max:s,minDefined:n,maxDefined:o}=this.getUserBounds(),a;if(n&&o)return{min:e,max:s};const r=this.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)a=r[l].controller.getMinMax(this,t),n||(e=Math.min(e,a.min)),o||(s=Math.max(s,a.max));return e=o&&e>s?s:e,s=n&&e>s?e:s,{min:mt(e,mt(s,e)),max:mt(s,mt(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(){j(this.options.beforeUpdate,[this])}update(t,e,s){const{beginAtZero:n,grace:o,ticks:a}=this.options,r=a.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=hr(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=r<this.ticks.length;this._convertTicksToLabels(l?en(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Tl(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(){j(this.options.afterUpdate,[this])}beforeSetDimensions(){j(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(){j(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),j(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){j(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=j(e.callback,[o.value,s,t],this)}afterTickToLabelConversion(){j(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){j(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,s=tn(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let a=n,r,l,c;if(!this._isVisible()||!e.display||n>=o||s<=1||!this.isHorizontal()){this.labelRotation=n;return}const h=this._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=rt(this.chart.width-d,0,this.maxWidth);r=t.offset?this.maxWidth/s:f/(s-1),d+6>r&&(r=f/(s-(t.offset?.5:1)),l=this.maxHeight-pe(t.grid)-e.padding-sn(t.title,this.chart.options.font),c=Math.sqrt(d*d+u*u),a=ja(Math.min(Math.asin(rt((h.highest.height+6)/r,-1,1)),Math.asin(rt(l/c,-1,1))-Math.asin(rt(u/c,-1,1)))),a=Math.max(n,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){j(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){j(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:s,title:n,grid:o}}=this,a=this._isVisible(),r=this.isHorizontal();if(a){const l=sn(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=pe(o)+l):(t.height=this.maxHeight,t.width=pe(o)+l),s.display&&this.ticks.length){const{first:c,last:h,widest:d,highest:u}=this._getLabelSizes(),f=s.padding*2,g=Tt(this.labelRotation),_=Math.cos(g),p=Math.sin(g);if(r){const m=s.mirror?0:p*d.width+_*u.height;t.height=Math.min(this.maxHeight,t.height+m+f)}else{const m=s.mirror?0:_*d.width+p*u.height;t.width=Math.min(this.maxWidth,t.width+m+f)}this._calculatePadding(c,h,p,_)}}this._handleMargins(),r?(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:a},position:r}=this.options,l=this.labelRotation!==0,c=r!=="top"&&this.axis==="x";if(this.isHorizontal()){const h=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let u=0,f=0;l?c?(u=n*t.width,f=s*e.height):(u=s*t.height,f=n*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-h+a)*this.width/(this.width-h),0),this.paddingRight=Math.max((f-d+a)*this.width/(this.width-d),0)}else{let h=e.height/2,d=t.height/2;o==="start"?(h=0,d=t.height):o==="end"&&(h=e.height,d=0),this.paddingTop=h+a,this.paddingBottom=d+a}}_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(){j(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++)z(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=en(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,a=[],r=[],l=Math.floor(e/tn(e,s));let c=0,h=0,d,u,f,g,_,p,m,b,y,v,x;for(d=0;d<e;d+=l){if(g=t[d].label,_=this._resolveTickFontOptions(d),n.font=p=_.string,m=o[p]=o[p]||{data:{},gc:[]},b=_.lineHeight,y=v=0,!z(g)&&!U(g))y=Ds(n,m.data,m.gc,y,g),v=b;else if(U(g))for(u=0,f=g.length;u<f;++u)x=g[u],!z(x)&&!U(x)&&(y=Ds(n,m.data,m.gc,y,x),v+=b);a.push(y),r.push(v),c=Math.max(y,c),h=Math.max(v,h)}Ll(o,e);const M=a.indexOf(c),P=r.indexOf(h),T=C=>({width:a[C]||0,height:r[C]||0});return{first:T(0),last:T(e-1),widest:T(M),highest:T(P),widths:a,heights:r}}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 Ha(this._alignToPixels?Ht(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=Bl(this.getContext(),t,s))}return this.$context||(this.$context=Fl(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,e=Tt(this.labelRotation),s=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,r=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*s>r*n?r/s:l/n:l*n<r*s?l/s:r/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:a,border:r}=n,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),u=pe(o),f=[],g=r.setContext(this.getContext()),_=g.display?g.width:0,p=_/2,m=function(H){return Ht(s,H,_)};let b,y,v,x,M,P,T,C,D,A,R,Q;if(a==="top")b=m(this.bottom),P=this.bottom-u,C=b-p,A=m(t.top)+p,Q=t.bottom;else if(a==="bottom")b=m(this.top),A=t.top,Q=m(t.bottom)-p,P=b+p,C=this.top+u;else if(a==="left")b=m(this.right),M=this.right-u,T=b-p,D=m(t.left)+p,R=t.right;else if(a==="right")b=m(this.left),D=t.left,R=m(t.right)-p,M=b+p,T=this.left+u;else if(e==="x"){if(a==="center")b=m((t.top+t.bottom)/2+.5);else if(I(a)){const H=Object.keys(a)[0],Y=a[H];b=m(this.chart.scales[H].getPixelForValue(Y))}A=t.top,Q=t.bottom,P=b+p,C=P+u}else if(e==="y"){if(a==="center")b=m((t.left+t.right)/2);else if(I(a)){const H=Object.keys(a)[0],Y=a[H];b=m(this.chart.scales[H].getPixelForValue(Y))}M=b-p,T=M-u,D=t.left,R=t.right}const lt=F(n.ticks.maxTicksLimit,d),N=Math.max(1,Math.ceil(d/lt));for(y=0;y<d;y+=N){const H=this.getContext(y),Y=o.setContext(H),pt=r.setContext(H),tt=Y.lineWidth,Kt=Y.color,Be=pt.dash||[],Gt=pt.dashOffset,de=Y.tickWidth,zt=Y.tickColor,ue=Y.tickBorderDash||[],Nt=Y.tickBorderDashOffset;v=El(this,y,l),v!==void 0&&(x=Ht(s,v,tt),c?M=T=D=R=x:P=C=A=Q=x,f.push({tx1:M,ty1:P,tx2:T,ty2:C,x1:D,y1:A,x2:R,y2:Q,width:tt,color:Kt,borderDash:Be,borderDashOffset:Gt,tickWidth:de,tickColor:zt,tickBorderDash:ue,tickBorderDashOffset:Nt}))}return this._ticksLength=d,this._borderValue=b,f}_computeLabelItems(t){const e=this.axis,s=this.options,{position:n,ticks:o}=s,a=this.isHorizontal(),r=this.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=o,u=pe(s.grid),f=u+h,g=d?-h:f,_=-Tt(this.labelRotation),p=[];let m,b,y,v,x,M,P,T,C,D,A,R,Q="middle";if(n==="top")M=this.bottom-g,P=this._getXAxisLabelAlignment();else if(n==="bottom")M=this.top+g,P=this._getXAxisLabelAlignment();else if(n==="left"){const N=this._getYAxisLabelAlignment(u);P=N.textAlign,x=N.x}else if(n==="right"){const N=this._getYAxisLabelAlignment(u);P=N.textAlign,x=N.x}else if(e==="x"){if(n==="center")M=(t.top+t.bottom)/2+f;else if(I(n)){const N=Object.keys(n)[0],H=n[N];M=this.chart.scales[N].getPixelForValue(H)+f}P=this._getXAxisLabelAlignment()}else if(e==="y"){if(n==="center")x=(t.left+t.right)/2-f;else if(I(n)){const N=Object.keys(n)[0],H=n[N];x=this.chart.scales[N].getPixelForValue(H)}P=this._getYAxisLabelAlignment(u).textAlign}e==="y"&&(l==="start"?Q="top":l==="end"&&(Q="bottom"));const lt=this._getLabelSizes();for(m=0,b=r.length;m<b;++m){y=r[m],v=y.label;const N=o.setContext(this.getContext(m));T=this.getPixelForTick(m)+o.labelOffset,C=this._resolveTickFontOptions(m),D=C.lineHeight,A=U(v)?v.length:1;const H=A/2,Y=N.color,pt=N.textStrokeColor,tt=N.textStrokeWidth;let Kt=P;a?(x=T,P==="inner"&&(m===b-1?Kt=this.options.reverse?"left":"right":m===0?Kt=this.options.reverse?"right":"left":Kt="center"),n==="top"?c==="near"||_!==0?R=-A*D+D/2:c==="center"?R=-lt.highest.height/2-H*D+D:R=-lt.highest.height+D/2:c==="near"||_!==0?R=D/2:c==="center"?R=lt.highest.height/2-H*D:R=lt.highest.height-A*D,d&&(R*=-1),_!==0&&!N.showLabelBackdrop&&(x+=D/2*Math.sin(_))):(M=T,R=(1-A)*D/2);let Be;if(N.showLabelBackdrop){const Gt=dt(N.backdropPadding),de=lt.heights[m],zt=lt.widths[m];let ue=R-Gt.top,Nt=0-Gt.left;switch(Q){case"middle":ue-=de/2;break;case"bottom":ue-=de;break}switch(P){case"center":Nt-=zt/2;break;case"right":Nt-=zt;break;case"inner":m===b-1?Nt-=zt:m>0&&(Nt-=zt/2);break}Be={left:Nt,top:ue,width:zt+Gt.width,height:de+Gt.height,color:N.backdropColor}}p.push({label:v,font:C,textOffset:R,options:{rotation:_,color:Y,strokeColor:pt,strokeWidth:tt,textAlign:Kt,textBaseline:Q,translation:[x,M],backdrop:Be}})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Tt(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,a=this._getLabelSizes(),r=t+o,l=a.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-r,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+r,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:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(s,n,o,a),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,a;const r=(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,a=n.length;o<a;++o){const l=n[o];e.drawOnChartArea&&r({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&r({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()),a=s.display?o.width:0;if(!a)return;const r=n.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,h,d,u;this.isHorizontal()?(c=Ht(t,this.left,a)-a/2,h=Ht(t,this.right,r)+r/2,d=u=l):(d=Ht(t,this.top,a)-a/2,u=Ht(t,this.bottom,r)+r/2,c=h=l),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(c,d),e.lineTo(h,u),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const s=this.ctx,n=this._computeLabelArea();n&&os(s,n);const o=this.getLabelItems(t);for(const a of o){const r=a.options,l=a.font,c=a.label,h=a.textOffset;Re(s,c,0,h,l,r)}n&&as(s)}drawTitle(){const{ctx:t,options:{position:e,title:s,reverse:n}}=this;if(!s.display)return;const o=J(s.font),a=dt(s.padding),r=s.align;let l=o.lineHeight/2;e==="bottom"||e==="center"||I(e)?(l+=a.bottom,U(s.text)&&(l+=o.lineHeight*(s.text.length-1))):l+=a.top;const{titleX:c,titleY:h,maxWidth:d,rotation:u}=Nl(this,l,e,r);Re(t,s.text,0,0,o,{color:s.color,maxWidth:d,rotation:u,textAlign:zl(r,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=F(t.grid&&t.grid.z,-1),n=F(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==he.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,a;for(o=0,a=e.length;o<a;++o){const r=e[o];r[s]===this.id&&(!t||r.type===t)&&n.push(r)}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 Ye{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;Hl(e)&&(s=this.register(e));const n=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,jl(t,a,s),this.override&&q.override(t.id,t.overrides)),a}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 q[n]&&(delete q[n][s],this.override&&delete Xt[s])}}function jl(i,t,e){const s=xt(Object.create(null),[e?q.get(e):{},q.get(t),i.defaults]);q.set(t,s),i.defaultRoutes&&Wl(t,i.defaultRoutes),i.descriptors&&q.describe(t,i.descriptors)}function Wl(i,t){Object.keys(t).forEach(e=>{const s=e.split("."),n=s.pop(),o=[i].concat(s).join("."),a=t[e].split("."),r=a.pop(),l=a.join(".");q.route(o,n,l,r)})}function Hl(i){return"id"in i&&"defaults"in i}class Vl{constructor(){this.controllers=new Ye(oe,"datasets",!0),this.elements=new Ye(vt,"elements"),this.plugins=new Ye(Object,"plugins"),this.scales=new Ye(he,"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):B(n,a=>{const r=s||this._getRegistryForType(a);this._exec(t,r,a)})})}_exec(t,e,s){const n=ts(t);j(s["before"+n],[],s),e[t](s),j(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 yt=new Vl;class $l{constructor(){this._init=[]}notify(t,e,s,n){e==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),a=this._notify(o,t,e,s);return e==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,e,s,n){n=n||{};for(const o of t){const a=o.plugin,r=a[s],l=[e,n,o.options];if(j(r,l,a)===!1&&n.cancelable)return!1}return!0}invalidate(){z(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=F(s.options&&s.options.plugins,{}),o=ql(s);return n===!1&&!e?[]:Ul(t,o,n,e)}_notifyStateChanges(t){const e=this._oldCache||[],s=this._cache,n=(o,a)=>o.filter(r=>!a.some(l=>r.plugin.id===l.plugin.id));this._notify(n(e,s),t,"stop"),this._notify(n(s,e),t,"start")}}function ql(i){const t={},e=[],s=Object.keys(yt.plugins.items);for(let o=0;o<s.length;o++)e.push(yt.getPlugin(s[o]));const n=i.plugins||[];for(let o=0;o<n.length;o++){const a=n[o];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Yl(i,t){return!t&&i===!1?null:i===!0?{}:i}function Ul(i,{plugins:t,localIds:e},s,n){const o=[],a=i.getContext();for(const r of t){const l=r.id,c=Yl(s[l],n);c!==null&&o.push({plugin:r,options:Xl(i.config,{plugin:r,local:e[l]},c,a)})}return o}function Xl(i,{plugin:t,local:e},s,n){const o=i.pluginScopeKeys(t),a=i.getOptionScopes(s,o);return e&&t.defaults&&a.push(t.defaults),i.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function $i(i,t){const e=q.datasets[i]||{};return((t.datasets||{})[i]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Kl(i,t){let e=i;return i==="_index_"?e=t:i==="_value_"&&(e=t==="x"?"y":"x"),e}function Gl(i,t){return i===t?"_index_":"_value_"}function nn(i){if(i==="x"||i==="y"||i==="r")return i}function Ql(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function qi(i,...t){if(nn(i))return i;for(const e of t){const s=e.axis||Ql(e.position)||i.length>1&&nn(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function on(i,t,e){if(e[t+"AxisID"]===i)return{axis:t}}function Zl(i,t){if(t.data&&t.data.datasets){const e=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(e.length)return on(i,"x",e[0])||on(i,"y",e[0])}return{}}function Jl(i,t){const e=Xt[i.type]||{scales:{}},s=t.scales||{},n=$i(i.type,t),o=Object.create(null);return Object.keys(s).forEach(a=>{const r=s[a];if(!I(r))return console.error(`Invalid scale configuration for scale: ${a}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=qi(a,r,Zl(a,i),q.scales[r.type]),c=Gl(l,n),h=e.scales||{};o[a]=we(Object.create(null),[{axis:l},r,h[l],h[c]])}),i.data.datasets.forEach(a=>{const r=a.type||i.type,l=a.indexAxis||$i(r,t),h=(Xt[r]||{}).scales||{};Object.keys(h).forEach(d=>{const u=Kl(d,l),f=a[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),we(o[f],[{axis:u},s[f],h[d]])})}),Object.keys(o).forEach(a=>{const r=o[a];we(r,[q.scales[r.type],q.scale])}),o}function go(i){const t=i.options||(i.options={});t.plugins=F(t.plugins,{}),t.scales=Jl(i,t)}function po(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function tc(i){return i=i||{},i.data=po(i.data),go(i),i}const an=new Map,mo=new Set;function Ue(i,t){let e=an.get(i);return e||(e=t(),an.set(i,e),mo.add(e)),e}const me=(i,t,e)=>{const s=Ut(t,e);s!==void 0&&i.add(s)};class ec{constructor(t){this._config=tc(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=po(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(),go(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ue(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ue(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ue(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){const e=t.id,s=this.type;return Ue(`${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,a=this._cachedScopes(t,s),r=a.get(e);if(r)return r;const l=new Set;e.forEach(h=>{t&&(l.add(t),h.forEach(d=>me(l,t,d))),h.forEach(d=>me(l,n,d)),h.forEach(d=>me(l,Xt[o]||{},d)),h.forEach(d=>me(l,q,d)),h.forEach(d=>me(l,Wi,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),mo.has(e)&&a.set(e,c),c}chartOptionScopes(){const{options:t,type:e}=this;return[t,Xt[e]||{},q.datasets[e]||{},{type:e},q,Wi]}resolveNamedOptions(t,e,s,n=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=rn(this._resolverCache,t,n);let l=a;if(sc(a,e)){o.$shared=!1,s=Ft(s)?s():s;const c=this.createResolver(t,s,r);l=re(a,s,c)}for(const c of e)o[c]=l[c];return o}createResolver(t,e,s=[""],n){const{resolver:o}=rn(this._resolverCache,t,s);return I(e)?re(o,e,void 0,n):o}}function rn(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:ls(t,e),subPrefixes:e.filter(r=>!r.toLowerCase().includes("hover"))},s.set(n,o)),o}const ic=i=>I(i)&&Object.getOwnPropertyNames(i).some(t=>Ft(i[t]));function sc(i,t){const{isScriptable:e,isIndexable:s}=to(i);for(const n of t){const o=e(n),a=s(n),r=(a||o)&&i[n];if(o&&(Ft(r)||ic(r))||a&&U(r))return!0}return!1}var nc="4.4.4";const oc=["top","bottom","left","right","chartArea"];function ln(i,t){return i==="top"||i==="bottom"||oc.indexOf(i)===-1&&t==="x"}function cn(i,t){return function(e,s){return e[i]===s[i]?e[t]-s[t]:e[i]-s[i]}}function hn(i){const t=i.chart,e=t.options.animation;t.notifyPlugins("afterRender"),j(e&&e.onComplete,[i],t)}function ac(i){const t=i.chart,e=t.options.animation;j(e&&e.onProgress,[i],t)}function bo(i){return ds()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const ni={},dn=i=>{const t=bo(i);return Object.values(ni).filter(e=>e.canvas===t).pop()};function rc(i,t,e){const s=Object.keys(i);for(const n of s){const o=+n;if(o>=t){const a=i[n];delete i[n],(e>0||o>t)&&(i[o+e]=a)}}}function lc(i,t,e,s){return!e||i.type==="mouseout"?null:s?t:i}function Xe(i,t,e){return i.options.clip?i[e]:t[e]}function cc(i,t){const{xScale:e,yScale:s}=i;return e&&s?{left:Xe(e,t,"left"),right:Xe(e,t,"right"),top:Xe(s,t,"top"),bottom:Xe(s,t,"bottom")}:t}var Ct;let Fe=(Ct=class{static register(...t){yt.add(...t),un()}static unregister(...t){yt.remove(...t),un()}constructor(t,e){const s=this.config=new ec(e),n=bo(t),o=dn(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 a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Pl(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,c=l&&l.height,h=l&&l.width;if(this.id=Ca(),this.ctx=r,this.canvas=l,this.width=h,this.height=c,this._options=a,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 $l,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Ya(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],ni[this.id]=this,!r||!l){console.error("Failed to create chart: can't acquire context from the given item");return}wt.listen(this,"complete",hn),wt.listen(this,"progress",ac),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:s,height:n,_aspectRatio:o}=this;return z(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 yt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Ls(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Rs(this.canvas,this.ctx),this}stop(){return wt.stop(this),this}resize(t,e){wt.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,a=this.platform.getMaximumSize(n,t,e,o),r=s.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,Ls(this,r,!0)&&(this.notifyPlugins("resize",{size:a}),j(s.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const e=this.options.scales||{};B(e,(s,n)=>{s.id=n})}buildOrUpdateScales(){const t=this.options,e=t.scales,s=this.scales,n=Object.keys(s).reduce((a,r)=>(a[r]=!1,a),{});let o=[];e&&(o=o.concat(Object.keys(e).map(a=>{const r=e[a],l=qi(a,r),c=l==="r",h=l==="x";return{options:r,dposition:c?"chartArea":h?"bottom":"left",dtype:c?"radialLinear":h?"category":"linear"}}))),B(o,a=>{const r=a.options,l=r.id,c=qi(l,r),h=F(r.type,a.dtype);(r.position===void 0||ln(r.position,c)!==ln(a.dposition))&&(r.position=a.dposition),n[l]=!0;let d=null;if(l in s&&s[l].type===h)d=s[l];else{const u=yt.getScale(h);d=new u({id:l,type:h,ctx:this.ctx,chart:this}),s[d.id]=d}d.init(r,t)}),B(n,(a,r)=>{a||delete s[r]}),B(s,a=>{_t.configure(this,a,a.options),_t.addBox(this,a)})}_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(cn("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 a=this.getDatasetMeta(s);const r=o.type||this.config.type;if(a.type&&a.type!==r&&(this._destroyDatasetMeta(s),a=this.getDatasetMeta(s)),a.type=r,a.indexAxis=o.indexAxis||$i(r,this.options),a.order=o.order||0,a.index=s,a.label=""+o.label,a.visible=this.isDatasetVisible(s),a.controller)a.controller.updateIndex(s),a.controller.linkScales();else{const l=yt.getController(r),{datasetElementType:c,dataElementType:h}=q.datasets[r];Object.assign(l,{dataElementType:yt.getElement(h),datasetElementType:c&&yt.getElement(c)}),a.controller=new l(this,s),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){B(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 a=0;for(let c=0,h=this.data.datasets.length;c<h;c++){const{controller:d}=this.getDatasetMeta(c),u=!n&&o.indexOf(d)===-1;d.buildOrUpdateElements(u),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=s.layout.autoPadding?a:0,this._updateLayout(a),n||B(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(cn("z","_idx"));const{_active:r,_lastEvent:l}=this;l?this._eventHandler(l,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){B(this.scales,t=>{_t.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!ks(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 a=s==="_removeElements"?-o:o;rc(t,n,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,s=o=>new Set(t.filter(a=>a[0]===o).map((a,r)=>r+","+a.splice(1).join(","))),n=s(0);for(let o=1;o<e;o++)if(!ks(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;_t.update(this,this.width,this.height,t);const e=this.chartArea,s=e.width<=0||e.height<=0;this._layers=[],B(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,Ft(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&&(wt.has(this)?this.attached&&!wt.running(this)&&wt.start(this):(this.draw(),hn({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 a=e[n];(!t||a.visible)&&s.push(a)}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=t._clip,n=!s.disabled,o=cc(t,this.chartArea),a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(n&&os(e,{left:s.left===!1?0:o.left-s.left,right:s.right===!1?this.width:o.right+s.right,top:s.top===!1?0:o.top-s.top,bottom:s.bottom===!1?this.height:o.bottom+s.bottom}),t.controller.draw(),n&&as(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return ns(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,s,n){const o=ol.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=ce(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),a=o.controller._resolveAnimations(void 0,n);De(e)?(o.data[e].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(o,{visible:s}),this.update(r=>r.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(),wt.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(),Rs(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete ni[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,a)=>{e.addEventListener(this,o,a),t[o]=a},n=(o,a,r)=>{o.offsetX=a,o.offsetY=r,this._eventHandler(o)};B(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 a;const r=()=>{n("attach",r),this.attached=!0,this.resize(),s("resize",o),s("detach",a)};a=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),s("attach",r)},e.isAttached(this.canvas)?r():a()}unbindEvents(){B(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},B(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,a,r,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,l=t.length;r<l;++r){a=t[r];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[n+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],s=t.map(({datasetIndex:o,index:a})=>{const r=this.getDatasetMeta(o);if(!r)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:r.data[a],index:a}});!ai(s,e)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,e))}notifyPlugins(t,e,s){return this._plugins.notify(this,t,e,s)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,s){const n=this.options.hover,o=(l,c)=>l.filter(h=>!c.some(d=>h.datasetIndex===d.datasetIndex&&h.index===d.index)),a=o(e,t),r=s?t:o(t,e);a.length&&this.updateHoverStyle(a,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const s={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=a=>(a.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,a=e,r=this._getActiveElements(t,n,s,a),l=La(t),c=lc(t,this._lastEvent,s,l);s&&(this._lastEvent=null,j(o.onHover,[t,r,this],this),l&&j(o.onClick,[t,r,this],this));const h=!ai(r,n);return(h||e)&&(this._active=r,this._updateHoverStyles(r,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)}},w(Ct,"defaults",q),w(Ct,"instances",ni),w(Ct,"overrides",Xt),w(Ct,"registry",yt),w(Ct,"version",nc),w(Ct,"getChart",dn),Ct);function un(){return B(Fe.instances,i=>i._plugins.invalidate())}function hc(i,t,e){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=t;let c=n/r;i.beginPath(),i.arc(o,a,r,s-c,e+c),l>n?(c=n/l,i.arc(o,a,l,e+c,s-c,!0)):i.arc(o,a,n,e+G,s-G),i.closePath(),i.clip()}function dc(i){return rs(i,["outerStart","outerEnd","innerStart","innerEnd"])}function uc(i,t,e,s){const n=dc(i.options.borderRadius),o=(e-t)/2,a=Math.min(o,s*t/2),r=l=>{const c=(e-Math.min(o,l))*s/2;return rt(l,0,Math.min(o,c))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:rt(n.innerStart,0,a),innerEnd:rt(n.innerEnd,0,a)}}function Zt(i,t,e,s){return{x:e+i*Math.cos(t),y:s+i*Math.sin(t)}}function _i(i,t,e,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:c,innerRadius:h}=t,d=Math.max(t.outerRadius+s+e-c,0),u=h>0?h+s+e+c:0;let f=0;const g=n-l;if(s){const N=h>0?h-s:0,H=d>0?d-s:0,Y=(N+H)/2,pt=Y!==0?g*Y/(Y+s):g;f=(g-pt)/2}const _=Math.max(.001,g*d-e/K)/d,p=(g-_)/2,m=l+p+f,b=n-p-f,{outerStart:y,outerEnd:v,innerStart:x,innerEnd:M}=uc(t,u,d,b-m),P=d-y,T=d-v,C=m+y/P,D=b-v/T,A=u+x,R=u+M,Q=m+x/A,lt=b-M/R;if(i.beginPath(),o){const N=(C+D)/2;if(i.arc(a,r,d,C,N),i.arc(a,r,d,N,D),v>0){const tt=Zt(T,D,a,r);i.arc(tt.x,tt.y,v,D,b+G)}const H=Zt(R,b,a,r);if(i.lineTo(H.x,H.y),M>0){const tt=Zt(R,lt,a,r);i.arc(tt.x,tt.y,M,b+G,lt+Math.PI)}const Y=(b-M/u+(m+x/u))/2;if(i.arc(a,r,u,b-M/u,Y,!0),i.arc(a,r,u,Y,m+x/u,!0),x>0){const tt=Zt(A,Q,a,r);i.arc(tt.x,tt.y,x,Q+Math.PI,m-G)}const pt=Zt(P,m,a,r);if(i.lineTo(pt.x,pt.y),y>0){const tt=Zt(P,C,a,r);i.arc(tt.x,tt.y,y,m-G,C)}}else{i.moveTo(a,r);const N=Math.cos(C)*d+a,H=Math.sin(C)*d+r;i.lineTo(N,H);const Y=Math.cos(D)*d+a,pt=Math.sin(D)*d+r;i.lineTo(Y,pt)}i.closePath()}function fc(i,t,e,s,n){const{fullCircles:o,startAngle:a,circumference:r}=t;let l=t.endAngle;if(o){_i(i,t,e,s,l,n);for(let c=0;c<o;++c)i.fill();isNaN(r)||(l=a+(r%X||X))}return _i(i,t,e,s,l,n),i.fill(),l}function _c(i,t,e,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=t,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,f=l.borderAlign==="inner";if(!c)return;i.setLineDash(d||[]),i.lineDashOffset=u,f?(i.lineWidth=c*2,i.lineJoin=h||"round"):(i.lineWidth=c,i.lineJoin=h||"bevel");let g=t.endAngle;if(o){_i(i,t,e,s,g,n);for(let _=0;_<o;++_)i.stroke();isNaN(r)||(g=a+(r%X||X))}f&&hc(i,t,g),o||(_i(i,t,e,s,g,n),i.stroke())}class ie extends vt{constructor(e){super();w(this,"circumference");w(this,"endAngle");w(this,"fullCircles");w(this,"innerRadius");w(this,"outerRadius");w(this,"pixelMargin");w(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,s,n){const o=this.getProps(["x","y"],n),{angle:a,distance:r}=$n(o,{x:e,y:s}),{startAngle:l,endAngle:c,innerRadius:h,outerRadius:d,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),f=(this.options.spacing+this.options.borderWidth)/2,g=F(u,c-l),_=hi(a,l,c)&&l!==c,p=g>=X||_,m=qt(r,h+f,d+f);return p&&m}getCenterPoint(e){const{x:s,y:n,startAngle:o,endAngle:a,innerRadius:r,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:h}=this.options,d=(o+a)/2,u=(r+l+h+c)/2;return{x:s+Math.cos(d)*u,y:n+Math.sin(d)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){const{options:s,circumference:n}=this,o=(s.offset||0)/4,a=(s.spacing||0)/2,r=s.circular;if(this.pixelMargin=s.borderAlign==="inner"?.33:0,this.fullCircles=n>X?Math.floor(n/X):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();const l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);const c=1-Math.sin(Math.min(K,n||0)),h=o*c;e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,fc(e,this,h,a,r),_c(e,this,h,a,r),e.restore()}}w(ie,"id","arc"),w(ie,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),w(ie,"defaultRoutes",{backgroundColor:"backgroundColor"}),w(ie,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});function fn(i,t,e,s){const n=i.options,{[e]:o}=i.getProps([e],s);return Math.abs(t-o)<n.radius+n.hitRadius}class oi extends vt{constructor(e){super();w(this,"parsed");w(this,"skip");w(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:a,y:r}=this.getProps(["x","y"],n);return Math.pow(e-a,2)+Math.pow(s-r,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(e,s){return fn(this,e,"x",s)}inYRange(e,s){return fn(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||!ns(this,s,this.size(n)/2)||(e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.fillStyle=n.backgroundColor,Hi(e,n,this.x,this.y))}getRange(){const e=this.options||{};return e.radius+e.hitRadius}}w(oi,"id","point"),w(oi,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),w(oi,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function yo(i,t){const{x:e,y:s,base:n,width:o,height:a}=i.getProps(["x","y","base","width","height"],t);let r,l,c,h,d;return i.horizontal?(d=a/2,r=Math.min(e,n),l=Math.max(e,n),c=s-d,h=s+d):(d=o/2,r=e-d,l=e+d,c=Math.min(s,n),h=Math.max(s,n)),{left:r,top:c,right:l,bottom:h}}function Rt(i,t,e,s){return i?0:rt(t,e,s)}function gc(i,t,e){const s=i.options.borderWidth,n=i.borderSkipped,o=Jn(s);return{t:Rt(n.top,o.top,0,e),r:Rt(n.right,o.right,0,t),b:Rt(n.bottom,o.bottom,0,e),l:Rt(n.left,o.left,0,t)}}function pc(i,t,e){const{enableBorderRadius:s}=i.getProps(["enableBorderRadius"]),n=i.options.borderRadius,o=se(n),a=Math.min(t,e),r=i.borderSkipped,l=s||I(n);return{topLeft:Rt(!l||r.top||r.left,o.topLeft,0,a),topRight:Rt(!l||r.top||r.right,o.topRight,0,a),bottomLeft:Rt(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:Rt(!l||r.bottom||r.right,o.bottomRight,0,a)}}function mc(i){const t=yo(i),e=t.right-t.left,s=t.bottom-t.top,n=gc(i,e/2,s/2),o=pc(i,e/2,s/2);return{outer:{x:t.left,y:t.top,w:e,h:s,radius:o},inner:{x:t.left+n.l,y:t.top+n.t,w:e-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function Ai(i,t,e,s){const n=t===null,o=e===null,r=i&&!(n&&o)&&yo(i,s);return r&&(n||qt(t,r.left,r.right))&&(o||qt(e,r.top,r.bottom))}function bc(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function yc(i,t){i.rect(t.x,t.y,t.w,t.h)}function Di(i,t,e={}){const s=i.x!==e.x?-t:0,n=i.y!==e.y?-t:0,o=(i.x+i.w!==e.x+e.w?t:0)-s,a=(i.y+i.h!==e.y+e.h?t:0)-n;return{x:i.x+s,y:i.y+n,w:i.w+o,h:i.h+a,radius:i.radius}}class Pe extends vt{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:s,backgroundColor:n}}=this,{inner:o,outer:a}=mc(this),r=bc(a.radius)?di:yc;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),r(t,Di(a,e,o)),t.clip(),r(t,Di(o,-e,a)),t.fillStyle=s,t.fill("evenodd")),t.beginPath(),r(t,Di(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,s){return Ai(this,t,e,s)}inXRange(t,e){return Ai(this,t,null,e)}inYRange(t,e){return Ai(this,null,t,e)}getCenterPoint(t){const{x:e,y:s,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?s:(s+n)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}w(Pe,"id","bar"),w(Pe,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),w(Pe,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});const _n=(i,t)=>{let{boxHeight:e=t,boxWidth:s=t}=i;return i.usePointStyle&&(e=Math.min(e,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(t,e)}},xc=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class gn extends vt{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,s){this.maxWidth=t,this.maxHeight=e,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=j(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(s=>t.filter(s,this.chart.data))),t.sort&&(e=e.sort((s,n)=>t.sort(s,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}const s=t.labels,n=J(s.font),o=n.size,a=this._computeTitleHeight(),{boxWidth:r,itemHeight:l}=_n(s,o);let c,h;e.font=n.string,this.isHorizontal()?(c=this.maxWidth,h=this._fitRows(a,o,r,l)+10):(h=this.maxHeight,c=this._fitCols(a,n,r,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,s,n){const{ctx:o,maxWidth:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],h=n+r;let d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-h;return this.legendItems.forEach((g,_)=>{const p=s+e/2+o.measureText(g.text).width;(_===0||c[c.length-1]+p+2*r>a)&&(d+=h,c[c.length-(_>0?0:1)]=0,f+=h,u++),l[_]={left:0,top:f,row:u,width:p,height:n},c[c.length-1]+=p+r}),d}_fitCols(t,e,s,n){const{ctx:o,maxHeight:a,options:{labels:{padding:r}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],h=a-t;let d=r,u=0,f=0,g=0,_=0;return this.legendItems.forEach((p,m)=>{const{itemWidth:b,itemHeight:y}=vc(s,e,o,p,n);m>0&&f+y+2*r>h&&(d+=u+r,c.push({width:u,height:f}),g+=u+r,_++,u=f=0),l[m]={left:g,top:f,col:_,width:b,height:y},u=Math.max(u,b),f+=y+r}),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:s,labels:{padding:n},rtl:o}}=this,a=ne(o,this.left,this.width);if(this.isHorizontal()){let r=0,l=et(s,this.left+n,this.right-this.lineWidths[r]);for(const c of e)r!==c.row&&(r=c.row,l=et(s,this.left+n,this.right-this.lineWidths[r])),c.top+=this.top+t+n,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+n}else{let r=0,l=et(s,this.top+t+n,this.bottom-this.columnSizes[r].height);for(const c of e)c.col!==r&&(r=c.col,l=et(s,this.top+t+n,this.bottom-this.columnSizes[r].height)),c.top=l,c.left+=this.left+n,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;os(t,this),this._draw(),as(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:s,ctx:n}=this,{align:o,labels:a}=t,r=q.color,l=ne(t.rtl,this.left,this.width),c=J(a.font),{padding:h}=a,d=c.size,u=d/2;let f;this.drawTitle(),n.textAlign=l.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=c.string;const{boxWidth:g,boxHeight:_,itemHeight:p}=_n(a,d),m=function(M,P,T){if(isNaN(g)||g<=0||isNaN(_)||_<0)return;n.save();const C=F(T.lineWidth,1);if(n.fillStyle=F(T.fillStyle,r),n.lineCap=F(T.lineCap,"butt"),n.lineDashOffset=F(T.lineDashOffset,0),n.lineJoin=F(T.lineJoin,"miter"),n.lineWidth=C,n.strokeStyle=F(T.strokeStyle,r),n.setLineDash(F(T.lineDash,[])),a.usePointStyle){const D={radius:_*Math.SQRT2/2,pointStyle:T.pointStyle,rotation:T.rotation,borderWidth:C},A=l.xPlus(M,g/2),R=P+u;Zn(n,D,A,R,a.pointStyleWidth&&g)}else{const D=P+Math.max((d-_)/2,0),A=l.leftForLtr(M,g),R=se(T.borderRadius);n.beginPath(),Object.values(R).some(Q=>Q!==0)?di(n,{x:A,y:D,w:g,h:_,radius:R}):n.rect(A,D,g,_),n.fill(),C!==0&&n.stroke()}n.restore()},b=function(M,P,T){Re(n,T.text,M,P+p/2,c,{strikethrough:T.hidden,textAlign:l.textAlign(T.textAlign)})},y=this.isHorizontal(),v=this._computeTitleHeight();y?f={x:et(o,this.left+h,this.right-s[0]),y:this.top+h+v,line:0}:f={x:this.left+h,y:et(o,this.top+v+h,this.bottom-e[0].height),line:0},no(this.ctx,t.textDirection);const x=p+h;this.legendItems.forEach((M,P)=>{n.strokeStyle=M.fontColor,n.fillStyle=M.fontColor;const T=n.measureText(M.text).width,C=l.textAlign(M.textAlign||(M.textAlign=a.textAlign)),D=g+u+T;let A=f.x,R=f.y;l.setWidth(this.width),y?P>0&&A+D+h>this.right&&(R=f.y+=x,f.line++,A=f.x=et(o,this.left+h,this.right-s[f.line])):P>0&&R+x>this.bottom&&(A=f.x=A+e[f.line].width+h,f.line++,R=f.y=et(o,this.top+v+h,this.bottom-e[f.line].height));const Q=l.x(A);if(m(Q,R,M),A=Ua(C,A+g+u,y?A+D:this.right,t.rtl),b(l.x(A),R,M),y)f.x+=D+h;else if(typeof M.text!="string"){const lt=c.lineHeight;f.y+=xo(M,lt)+h}else f.y+=x}),oo(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,s=J(e.font),n=dt(e.padding);if(!e.display)return;const o=ne(t.rtl,this.left,this.width),a=this.ctx,r=e.position,l=s.size/2,c=n.top+l;let h,d=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),h=this.top+c,d=et(t.align,d,this.right-u);else{const g=this.columnSizes.reduce((_,p)=>Math.max(_,p.height),0);h=c+et(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}const f=et(r,d,d+u);a.textAlign=o.textAlign(is(r)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=s.string,Re(a,e.text,f,h,s)}_computeTitleHeight(){const t=this.options.title,e=J(t.font),s=dt(t.padding);return t.display?e.lineHeight+s.height:0}_getLegendItemAt(t,e){let s,n,o;if(qt(t,this.left,this.right)&&qt(e,this.top,this.bottom)){for(o=this.legendHitBoxes,s=0;s<o.length;++s)if(n=o[s],qt(t,n.left,n.left+n.width)&&qt(e,n.top,n.top+n.height))return this.legendItems[s]}return null}handleEvent(t){const e=this.options;if(!Sc(t.type,e))return;const s=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const n=this._hoveredItem,o=xc(n,s);n&&!o&&j(e.onLeave,[t,n,this],this),this._hoveredItem=s,s&&!o&&j(e.onHover,[t,s,this],this)}else s&&j(e.onClick,[t,s,this],this)}}function vc(i,t,e,s,n){const o=kc(s,i,t,e),a=wc(n,s,t.lineHeight);return{itemWidth:o,itemHeight:a}}function kc(i,t,e,s){let n=i.text;return n&&typeof n!="string"&&(n=n.reduce((o,a)=>o.length>a.length?o:a)),t+e.size/2+s.measureText(n).width}function wc(i,t,e){let s=i;return typeof t.text!="string"&&(s=xo(t,e)),s}function xo(i,t){const e=i.text?i.text.length:0;return t*e}function Sc(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var vo={id:"legend",_element:gn,start(i,t,e){const s=i.legend=new gn({ctx:i.ctx,options:e,chart:i});_t.configure(i,s,e),_t.addBox(i,s)},stop(i){_t.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,e){const s=i.legend;_t.configure(i,s,e),s.options=e},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,e){const s=t.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),t.hidden=!0):(n.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(e?0:void 0),h=dt(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:c.borderColor,pointStyle:s||c.pointStyle,rotation:c.rotation,textAlign:n||c.textAlign,borderRadius:a&&(r||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class ko extends vt{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;const n=U(s.text)?s.text.length:1;this._padding=dt(s.padding);const o=n*J(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:e,left:s,bottom:n,right:o,options:a}=this,r=a.align;let l=0,c,h,d;return this.isHorizontal()?(h=et(r,s,o),d=e+t,c=o-s):(a.position==="left"?(h=s+t,d=et(r,n,e),l=K*-.5):(h=o-t,d=et(r,e,n),l=K*.5),c=n-e),{titleX:h,titleY:d,maxWidth:c,rotation:l}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const s=J(e.font),o=s.lineHeight/2+this._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=this._drawArgs(o);Re(t,e.text,0,0,s,{color:e.color,maxWidth:l,rotation:c,textAlign:is(e.align),textBaseline:"middle",translation:[a,r]})}}function Mc(i,t){const e=new ko({ctx:i.ctx,options:t,chart:i});_t.configure(i,e,t),_t.addBox(i,e),i.titleBlock=e}var wo={id:"title",_element:ko,start(i,t,e){Mc(i,e)},stop(i){const t=i.titleBlock;_t.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,e){const s=i.titleBlock;_t.configure(i,s,e),s.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const ke={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 r=i[t].element;if(r&&r.hasValue()){const l=r.tooltipPosition();s.add(l.x),n+=l.y,++o}}return o===0||s.size===0?!1:{x:[...s].reduce((r,l)=>r+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,a,r;for(o=0,a=i.length;o<a;++o){const l=i[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),h=Wa(t,c);h<n&&(n=h,r=l)}}if(r){const l=r.tooltipPosition();e=l.x,s=l.y}return{x:e,y:s}}};function bt(i,t){return t&&(U(t)?Array.prototype.push.apply(i,t):i.push(t)),i}function St(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
`)>-1?i.split(`
`):i}function Pc(i,t){const{element:e,datasetIndex:s,index:n}=t,o=i.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:i,label:a,parsed:o.getParsed(n),raw:i.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function pn(i,t){const e=i.chart.ctx,{body:s,footer:n,title:o}=i,{boxWidth:a,boxHeight:r}=t,l=J(t.bodyFont),c=J(t.titleFont),h=J(t.footerFont),d=o.length,u=n.length,f=s.length,g=dt(t.padding);let _=g.height,p=0,m=s.reduce((v,x)=>v+x.before.length+x.lines.length+x.after.length,0);if(m+=i.beforeBody.length+i.afterBody.length,d&&(_+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),m){const v=t.displayColors?Math.max(r,l.lineHeight):l.lineHeight;_+=f*v+(m-f)*l.lineHeight+(m-1)*t.bodySpacing}u&&(_+=t.footerMarginTop+u*h.lineHeight+(u-1)*t.footerSpacing);let b=0;const y=function(v){p=Math.max(p,e.measureText(v).width+b)};return e.save(),e.font=c.string,B(i.title,y),e.font=l.string,B(i.beforeBody.concat(i.afterBody),y),b=t.displayColors?a+2+t.boxPadding:0,B(s,v=>{B(v.before,y),B(v.lines,y),B(v.after,y)}),b=0,e.font=h.string,B(i.footer,y),e.restore(),p+=g.width,{width:p,height:_}}function Tc(i,t){const{y:e,height:s}=t;return e<s/2?"top":e>i.height-s/2?"bottom":"center"}function Oc(i,t,e,s){const{x:n,width:o}=s,a=e.caretSize+e.caretPadding;if(i==="left"&&n+o+a>t.width||i==="right"&&n-o-a<0)return!0}function Cc(i,t,e,s){const{x:n,width:o}=e,{width:a,chartArea:{left:r,right:l}}=i;let c="center";return s==="center"?c=n<=(r+l)/2?"left":"right":n<=o/2?c="left":n>=a-o/2&&(c="right"),Oc(c,i,t,e)&&(c="center"),c}function mn(i,t,e){const s=e.yAlign||t.yAlign||Tc(i,e);return{xAlign:e.xAlign||t.xAlign||Cc(i,t,e,s),yAlign:s}}function Ac(i,t){let{x:e,width:s}=i;return t==="right"?e-=s:t==="center"&&(e-=s/2),e}function Dc(i,t,e){let{y:s,height:n}=i;return t==="top"?s+=e:t==="bottom"?s-=n+e:s-=n/2,s}function bn(i,t,e,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=i,{xAlign:r,yAlign:l}=e,c=n+o,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:f}=se(a);let g=Ac(t,r);const _=Dc(t,l,c);return l==="center"?r==="left"?g+=c:r==="right"&&(g-=c):r==="left"?g-=Math.max(h,u)+n:r==="right"&&(g+=Math.max(d,f)+n),{x:rt(g,0,s.width-t.width),y:rt(_,0,s.height-t.height)}}function Ke(i,t,e){const s=dt(e.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function yn(i){return bt([],St(i))}function Rc(i,t,e){return ce(i,{tooltip:t,tooltipItems:e,type:"tooltip"})}function xn(i,t){const e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?i.override(e):i}const So={beforeTitle:kt,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:kt,beforeBody:kt,beforeLabel:kt,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 z(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:kt,afterBody:kt,beforeFooter:kt,footer:kt,afterFooter:kt};function nt(i,t,e,s){const n=i[t].call(e,s);return typeof n>"u"?So[t].call(e,s):n}class Yi extends vt{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 ao(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Rc(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){const{callbacks:s}=e,n=nt(s,"beforeTitle",this,t),o=nt(s,"title",this,t),a=nt(s,"afterTitle",this,t);let r=[];return r=bt(r,St(n)),r=bt(r,St(o)),r=bt(r,St(a)),r}getBeforeBody(t,e){return yn(nt(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:s}=e,n=[];return B(t,o=>{const a={before:[],lines:[],after:[]},r=xn(s,o);bt(a.before,St(nt(r,"beforeLabel",this,o))),bt(a.lines,nt(r,"label",this,o)),bt(a.after,St(nt(r,"afterLabel",this,o))),n.push(a)}),n}getAfterBody(t,e){return yn(nt(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:s}=e,n=nt(s,"beforeFooter",this,t),o=nt(s,"footer",this,t),a=nt(s,"afterFooter",this,t);let r=[];return r=bt(r,St(n)),r=bt(r,St(o)),r=bt(r,St(a)),r}_createItems(t){const e=this._active,s=this.chart.data,n=[],o=[],a=[];let r=[],l,c;for(l=0,c=e.length;l<c;++l)r.push(Pc(this.chart,e[l]));return t.filter&&(r=r.filter((h,d,u)=>t.filter(h,d,u,s))),t.itemSort&&(r=r.sort((h,d)=>t.itemSort(h,d,s))),B(r,h=>{const d=xn(t.callbacks,h);n.push(nt(d,"labelColor",this,h)),o.push(nt(d,"labelPointStyle",this,h)),a.push(nt(d,"labelTextColor",this,h))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=r,r}update(t,e){const s=this.options.setContext(this.getContext()),n=this._active;let o,a=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{const r=ke[s.position].call(this,n,this._eventPosition);a=this._createItems(s),this.title=this.getTitle(a,s),this.beforeBody=this.getBeforeBody(a,s),this.body=this.getBody(a,s),this.afterBody=this.getAfterBody(a,s),this.footer=this.getFooter(a,s);const l=this._size=pn(this,s),c=Object.assign({},r,l),h=mn(this.chart,s,c),d=bn(s,c,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:r.x,caretY:r.y}}this._tooltipItems=a,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:a,cornerRadius:r}=s,{topLeft:l,topRight:c,bottomLeft:h,bottomRight:d}=se(r),{x:u,y:f}=t,{width:g,height:_}=e;let p,m,b,y,v,x;return o==="center"?(v=f+_/2,n==="left"?(p=u,m=p-a,y=v+a,x=v-a):(p=u+g,m=p+a,y=v-a,x=v+a),b=p):(n==="left"?m=u+Math.max(l,h)+a:n==="right"?m=u+g-Math.max(c,d)-a:m=this.caretX,o==="top"?(y=f,v=y-a,p=m-a,b=m+a):(y=f+_,v=y+a,p=m+a,b=m-a),x=y),{x1:p,x2:m,x3:b,y1:y,y2:v,y3:x}}drawTitle(t,e,s){const n=this.title,o=n.length;let a,r,l;if(o){const c=ne(s.rtl,this.x,this.width);for(t.x=Ke(this,s.titleAlign,s),e.textAlign=c.textAlign(s.titleAlign),e.textBaseline="middle",a=J(s.titleFont),r=s.titleSpacing,e.fillStyle=s.titleColor,e.font=a.string,l=0;l<o;++l)e.fillText(n[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===o&&(t.y+=s.titleMarginBottom-r)}}_drawColorBox(t,e,s,n,o){const a=this.labelColors[s],r=this.labelPointStyles[s],{boxHeight:l,boxWidth:c}=o,h=J(o.bodyFont),d=Ke(this,"left",o),u=n.x(d),f=l<h.lineHeight?(h.lineHeight-l)/2:0,g=e.y+f;if(o.usePointStyle){const _={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},p=n.leftForLtr(u,c)+c/2,m=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,Hi(t,_,p,m),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Hi(t,_,p,m)}else{t.lineWidth=I(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const _=n.leftForLtr(u,c),p=n.leftForLtr(n.xPlus(u,1),c-2),m=se(a.borderRadius);Object.values(m).some(b=>b!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,di(t,{x:_,y:g,w:c,h:l,radius:m}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),di(t,{x:p,y:g+1,w:c-2,h:l-2,radius:m}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(_,g,c,l),t.strokeRect(_,g,c,l),t.fillStyle=a.backgroundColor,t.fillRect(p,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,e,s){const{body:n}=this,{bodySpacing:o,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c,boxPadding:h}=s,d=J(s.bodyFont);let u=d.lineHeight,f=0;const g=ne(s.rtl,this.x,this.width),_=function(T){e.fillText(T,g.x(t.x+f),t.y+u/2),t.y+=u+o},p=g.textAlign(a);let m,b,y,v,x,M,P;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=Ke(this,p,s),e.fillStyle=s.bodyColor,B(this.beforeBody,_),f=r&&p!=="right"?a==="center"?c/2+h:c+2+h:0,v=0,M=n.length;v<M;++v){for(m=n[v],b=this.labelTextColors[v],e.fillStyle=b,B(m.before,_),y=m.lines,r&&y.length&&(this._drawColorBox(e,t,v,g,s),u=Math.max(d.lineHeight,l)),x=0,P=y.length;x<P;++x)_(y[x]),u=d.lineHeight;B(m.after,_)}f=0,u=d.lineHeight,B(this.afterBody,_),t.y-=o}drawFooter(t,e,s){const n=this.footer,o=n.length;let a,r;if(o){const l=ne(s.rtl,this.x,this.width);for(t.x=Ke(this,s.footerAlign,s),t.y+=s.footerMarginTop,e.textAlign=l.textAlign(s.footerAlign),e.textBaseline="middle",a=J(s.footerFont),e.fillStyle=s.footerColor,e.font=a.string,r=0;r<o;++r)e.fillText(n[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+s.footerSpacing}}drawBackground(t,e,s,n){const{xAlign:o,yAlign:a}=this,{x:r,y:l}=t,{width:c,height:h}=s,{topLeft:d,topRight:u,bottomLeft:f,bottomRight:g}=se(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+d,l),a==="top"&&this.drawCaret(t,e,s,n),e.lineTo(r+c-u,l),e.quadraticCurveTo(r+c,l,r+c,l+u),a==="center"&&o==="right"&&this.drawCaret(t,e,s,n),e.lineTo(r+c,l+h-g),e.quadraticCurveTo(r+c,l+h,r+c-g,l+h),a==="bottom"&&this.drawCaret(t,e,s,n),e.lineTo(r+f,l+h),e.quadraticCurveTo(r,l+h,r,l+h-f),a==="center"&&o==="left"&&this.drawCaret(t,e,s,n),e.lineTo(r,l+d),e.quadraticCurveTo(r,l,r+d,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 a=ke[t.position].call(this,this._active,this._eventPosition);if(!a)return;const r=this._size=pn(this,t),l=Object.assign({},a,this._size),c=mn(e,t,l),h=bn(t,l,c,e);(n._to!==h.x||o._to!==h.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=r.width,this.height=r.height,this.caretX=a.x,this.caretY=a.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 a=dt(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=s,this.drawBackground(o,t,n,e),no(t,e.textDirection),o.y+=a.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),oo(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const s=this._active,n=t.map(({datasetIndex:r,index:l})=>{const c=this.chart.getDatasetMeta(r);if(!c)throw new Error("Cannot find a dataset at index "+r);return{datasetIndex:r,element:c.data[l],index:l}}),o=!ai(s,n),a=this._positionChanged(n,e);(o||a)&&(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||[],a=this._getActiveElements(t,o,e,s),r=this._positionChanged(a,t),l=e||!ai(a,o)||r;return l&&(this._active=a,(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(r=>this.chart.data.datasets[r.datasetIndex]&&this.chart.getDatasetMeta(r.datasetIndex).controller.getParsed(r.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,s);return o.reverse&&a.reverse(),a}_positionChanged(t,e){const{caretX:s,caretY:n,options:o}=this,a=ke[o.position].call(this,t,e);return a!==!1&&(s!==a.x||n!==a.y)}}w(Yi,"positioners",ke);var Mo={id:"tooltip",_element:Yi,positioners:ke,afterInit(i,t,e){e&&(i.tooltip=new Yi({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:So},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 Ic=(i,t,e,s)=>(typeof t=="string"?(e=i.push(t)-1,s.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function Ec(i,t,e,s){const n=i.indexOf(t);if(n===-1)return Ic(i,t,e,s);const o=i.lastIndexOf(t);return n!==o?e:n}const Lc=(i,t)=>i===null?null:rt(Math.round(i),0,t);function vn(i){const t=this.getLabels();return i>=0&&i<t.length?t[i]:i}class gi extends he{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(z(t))return null;const s=this.getLabels();return e=isFinite(e)&&s[e]===t?e:Ec(s,t,F(e,t),this._addedLabels),Lc(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 a=t;a<=e;a++)n.push({value:a});return n}getLabelForValue(t){return vn.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}}w(gi,"id","category"),w(gi,"defaults",{ticks:{callback:vn}});function Fc(i,t){const e=[],{bounds:n,step:o,min:a,max:r,precision:l,count:c,maxTicks:h,maxDigits:d,includeBounds:u}=i,f=o||1,g=h-1,{min:_,max:p}=t,m=!z(a),b=!z(r),y=!z(c),v=(p-_)/(d+1);let x=Ss((p-_)/g/f)*f,M,P,T,C;if(x<1e-14&&!m&&!b)return[{value:_},{value:p}];C=Math.ceil(p/x)-Math.floor(_/x),C>g&&(x=Ss(C*x/g/f)*f),z(l)||(M=Math.pow(10,l),x=Math.ceil(x*M)/M),n==="ticks"?(P=Math.floor(_/x)*x,T=Math.ceil(p/x)*x):(P=_,T=p),m&&b&&o&&za((r-a)/o,x/1e3)?(C=Math.round(Math.min((r-a)/x,h)),x=(r-a)/C,P=a,T=r):y?(P=m?a:P,T=b?r:T,C=c-1,x=(T-P)/C):(C=(T-P)/x,ei(C,Math.round(C),x/1e3)?C=Math.round(C):C=Math.ceil(C));const D=Math.max(Ms(x),Ms(P));M=Math.pow(10,z(l)?D:l),P=Math.round(P*M)/M,T=Math.round(T*M)/M;let A=0;for(m&&(u&&P!==a?(e.push({value:a}),P<a&&A++,ei(Math.round((P+A*x)*M)/M,a,kn(a,v,i))&&A++):P<a&&A++);A<C;++A){const R=Math.round((P+A*x)*M)/M;if(b&&R>r)break;e.push({value:R})}return b&&u&&T!==r?e.length&&ei(e[e.length-1].value,r,kn(r,v,i))?e[e.length-1].value=r:e.push({value:r}):(!b||T===r)&&e.push({value:T}),e}function kn(i,t,{horizontal:e,minRotation:s}){const n=Tt(s),o=(e?Math.sin(n):Math.cos(n))||.001,a=.75*t*(""+i).length;return Math.min(t/o,a)}class Bc extends he{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 z(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 a=l=>n=e?n:l,r=l=>o=s?o:l;if(t){const l=Lt(n),c=Lt(o);l<0&&c<0?r(0):l>0&&c>0&&a(0)}if(n===o){let l=o===0?1:Math.abs(o*.05);r(o+l),t||a(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,a=Fc(n,o);return t.bounds==="ticks"&&Na(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let 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 ss(t,this.chart.options.locale,this.options.ticks.format)}}class pi extends Bc{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=gt(t)?t:0,this.max=gt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,s=Tt(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}}w(pi,"id","linear"),w(pi,"defaults",{ticks:{callback:Qn.formatters.numeric}});const xi={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}},at=Object.keys(xi);function wn(i,t){return i-t}function Sn(i,t){if(z(t))return null;const e=i._adapter,{parser:s,round:n,isoWeekday:o}=i._parseOpts;let a=t;return typeof s=="function"&&(a=s(a)),gt(a)||(a=typeof s=="string"?e.parse(a,s):e.parse(a)),a===null?null:(n&&(a=n==="week"&&(ci(o)||o===!0)?e.startOf(a,"isoWeek",o):e.startOf(a,n)),+a)}function Mn(i,t,e,s){const n=at.length;for(let o=at.indexOf(i);o<n-1;++o){const a=xi[at[o]],r=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(r*a.size))<=s)return at[o]}return at[n-1]}function zc(i,t,e,s,n){for(let o=at.length-1;o>=at.indexOf(e);o--){const a=at[o];if(xi[a].common&&i._adapter.diff(n,s,a)>=t-1)return a}return at[e?at.indexOf(e):0]}function Nc(i){for(let t=at.indexOf(i)+1,e=at.length;t<e;++t)if(xi[at[t]].common)return at[t]}function Pn(i,t,e){if(!e)i[t]=!0;else if(e.length){const{lo:s,hi:n}=es(e,t),o=e[s]>=t?e[s]:e[n];i[o]=!0}}function jc(i,t,e,s){const n=i._adapter,o=+n.startOf(t[0].value,s),a=t[t.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=e[r],l>=0&&(t[l].major=!0);return t}function Tn(i,t,e){const s=[],n={},o=t.length;let a,r;for(a=0;a<o;++a)r=t[a],n[r]=a,s.push({value:r,major:!1});return o===0||!e?s:jc(i,s,n,e)}class mi extends he{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 tl._date(t.adapters.date);n.init(e),we(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:Sn(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:a,maxDefined:r}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(n=Math.min(n,c.min)),!r&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!r)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),n=gt(n)&&!isNaN(n)?n:+e.startOf(Date.now(),s),o=gt(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,a=this.max,r=$a(n,o,a);return this._unit=e.unit||(s.autoSkip?Mn(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):zc(this,r.length,e.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:Nc(this._unit),this.initOffsets(n),t.reverse&&r.reverse(),Tn(this,r,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 a=t.length<3?.5:.25;e=rt(e,0,a),s=rt(s,0,a),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,a=o.unit||Mn(o.minUnit,e,s,this._getLabelCapacity(e)),r=F(n.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=ci(l)||l===!0,h={};let d=e,u,f;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(s,e,a)>1e5*r)throw new Error(e+" and "+s+" are too far apart with stepSize of "+r+" "+a);const g=n.ticks.source==="data"&&this.getDataTimestamps();for(u=d,f=0;u<s;u=+t.add(u,r,a),f++)Pn(h,u,g);return(u===s||n.bounds==="ticks"||f===1)&&Pn(h,u,g),Object.keys(h).sort(wn).map(_=>+_)}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,a=e||n[o];return this._adapter.format(t,a)}_tickFormatFunction(t,e,s,n){const o=this.options,a=o.ticks.callback;if(a)return j(a,[t,e,s],this);const r=o.time.displayFormats,l=this._unit,c=this._majorUnit,h=l&&r[l],d=c&&r[c],u=s[e],f=c&&d&&u&&u.major;return this._adapter.format(t,n||(f?d:h))}generateTickLabels(t){let e,s,n;for(e=0,s=t.length;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=Tt(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),a=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:s*o+r*a,h:s*a+r*o}}_getLabelCapacity(t){const e=this.options.time,s=e.displayFormats,n=s[e.unit]||s.millisecond,o=this._tickFormatFunction(t,0,Tn(this,[t],this._majorUnit),n),a=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return r>0?r: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(Sn(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Yn(t.sort(wn))}}w(mi,"id","time"),w(mi,"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 Ge(i,t,e){let s=0,n=i.length-1,o,a,r,l;e?(t>=i[s].pos&&t<=i[n].pos&&({lo:s,hi:n}=ji(i,"pos",t)),{pos:o,time:r}=i[s],{pos:a,time:l}=i[n]):(t>=i[s].time&&t<=i[n].time&&({lo:s,hi:n}=ji(i,"time",t)),{time:o,pos:r}=i[s],{time:a,pos:l}=i[n]);const c=a-o;return c?r+(l-r)*(t-o)/c:r}class On extends mi{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=Ge(e,this.min),this._tableRange=Ge(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:s}=this,n=[],o=[];let a,r,l,c,h;for(a=0,r=t.length;a<r;++a)c=t[a],c>=e&&c<=s&&n.push(c);if(n.length<2)return[{time:e,pos:0},{time:s,pos:1}];for(a=0,r=n.length;a<r;++a)h=n[a+1],l=n[a-1],c=n[a],Math.round((h+l)/2)!==c&&o.push({time:c,pos:a/(r-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(Ge(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,s=this.getDecimalForPixel(t)/e.factor-e.end;return Ge(this._table,s*this._tableRange+this._minPos,!0)}}w(On,"id","timeseries"),w(On,"defaults",mi.defaults);const Po={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},Wc={ariaLabel:{type:String},ariaDescribedby:{type:String}},Hc={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...Po,...Wc},Vc=$o[0]==="2"?(i,t)=>Object.assign(i,{attrs:t}):(i,t)=>Object.assign(i,t);function Jt(i){return In(i)?Li(i):i}function $c(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i;return In(t)?new Proxy(i,{}):i}function qc(i,t){const e=i.options;e&&t&&Object.assign(e,t)}function To(i,t){i.labels=t}function Oo(i,t,e){const s=[];i.datasets=t.map(n=>{const o=i.datasets.find(a=>a[e]===n[e]);return!o||!n.data||s.includes(o)?{...n}:(s.push(o),Object.assign(o,n),o)})}function Yc(i,t){const e={labels:[],datasets:[]};return To(e,i.labels),Oo(e,i.datasets,t),e}const Uc=Dn({props:Hc,setup(i,t){let{expose:e,slots:s}=t;const n=qo(null),o=Rn(null);e({chart:o});const a=()=>{if(!n.value)return;const{type:c,data:h,options:d,plugins:u,datasetIdKey:f}=i,g=Yc(h,f),_=$c(g,h);o.value=new Fe(n.value,{type:c,data:_,options:{...d},plugins:u})},r=()=>{const c=Li(o.value);c&&(i.destroyDelay>0?setTimeout(()=>{c.destroy(),o.value=null},i.destroyDelay):(c.destroy(),o.value=null))},l=c=>{c.update(i.updateMode)};return Yo(a),Uo(r),Xo([()=>i.options,()=>i.data],(c,h)=>{let[d,u]=c,[f,g]=h;const _=Li(o.value);if(!_)return;let p=!1;if(d){const m=Jt(d),b=Jt(f);m&&m!==b&&(qc(_,m),p=!0)}if(u){const m=Jt(u.labels),b=Jt(g.labels),y=Jt(u.datasets),v=Jt(g.datasets);m!==b&&(To(_.config.data,m),p=!0),y&&y!==v&&(Oo(_.config.data,y,i.datasetIdKey),p=!0)}p&&Ko(()=>{l(_)})},{deep:!0}),()=>Ei("canvas",{role:"img",ariaLabel:i.ariaLabel,ariaDescribedby:i.ariaDescribedby,ref:n},[Ei("p",{},[s.default?s.default():""])])}});function Co(i,t){return Fe.register(t),Dn({props:Po,setup(e,s){let{expose:n}=s;const o=Rn(null),a=r=>{o.value=r==null?void 0:r.chart};return n({chart:o}),()=>Ei(Uc,Vc({ref:a},{type:i,...e}))}})}const Xc=Co("bar",ii),Kc=Co("pie",Vi);Fe.register(ie,wo,Mo,vo,gi,pi);const Gc={name:"PieChart",components:{Pie:Kc},props:{chartData:{type:Object,default:null},styling:{type:Object,default:()=>({width:400,height:400})},maxNumLabels:{type:Number,default:9}},emits:["filterBy"],data(){return{pie_chart_options:{responsive:!1,maintainAspectRatio:!1,plugins:{legend:{labels:{filter:i=>i.index<=this.maxNumLabels}}}}}}};function Qc(i,t,e,s,n,o){const a=Z("Pie");return e.chartData?(O(),W(a,{key:0,data:e.chartData,chart_id:"artefact_classes",options:n.pie_chart_options,width:e.styling.width,height:e.styling.height},null,8,["data","options","width","height"])):ft("",!0)}const Zc=Bt(Gc,[["render",Qc]]);/*!
 * chartjs-plugin-datalabels v2.2.0
 * https://chartjs-plugin-datalabels.netlify.app
 * (c) 2017-2022 chartjs-plugin-datalabels contributors
 * Released under the MIT license
 */var Cn=function(){if(typeof window<"u"){if(window.devicePixelRatio)return window.devicePixelRatio;var i=window.screen;if(i)return(i.deviceXDPI||1)/(i.logicalXDPI||1)}return 1}(),Te={toTextLines:function(i){var t=[],e;for(i=[].concat(i);i.length;)e=i.pop(),typeof e=="string"?t.unshift.apply(t,e.split(`
`)):Array.isArray(e)?i.push.apply(i,e):z(i)||t.unshift(""+e);return t},textSize:function(i,t,e){var s=[].concat(t),n=s.length,o=i.font,a=0,r;for(i.font=e.string,r=0;r<n;++r)a=Math.max(i.measureText(s[r]).width,a);return i.font=o,{height:n*e.lineHeight,width:a}},bound:function(i,t,e){return Math.max(i,Math.min(t,e))},arrayDiff:function(i,t){var e=i.slice(),s=[],n,o,a,r;for(n=0,a=t.length;n<a;++n)r=t[n],o=e.indexOf(r),o===-1?s.push([r,1]):e.splice(o,1);for(n=0,a=e.length;n<a;++n)s.push([e[n],-1]);return s},rasterize:function(i){return Math.round(i*Cn)/Cn}};function Ri(i,t){var e=t.x,s=t.y;if(e===null)return{x:0,y:-1};if(s===null)return{x:1,y:0};var n=i.x-e,o=i.y-s,a=Math.sqrt(n*n+o*o);return{x:a?n/a:0,y:a?o/a:-1}}function Jc(i,t,e,s,n){switch(n){case"center":e=s=0;break;case"bottom":e=0,s=1;break;case"right":e=1,s=0;break;case"left":e=-1,s=0;break;case"top":e=0,s=-1;break;case"start":e=-e,s=-s;break;case"end":break;default:n*=Math.PI/180,e=Math.cos(n),s=Math.sin(n);break}return{x:i,y:t,vx:e,vy:s}}var th=0,Ao=1,Do=2,Ro=4,Io=8;function Qe(i,t,e){var s=th;return i<e.left?s|=Ao:i>e.right&&(s|=Do),t<e.top?s|=Io:t>e.bottom&&(s|=Ro),s}function eh(i,t){for(var e=i.x0,s=i.y0,n=i.x1,o=i.y1,a=Qe(e,s,t),r=Qe(n,o,t),l,c,h;!(!(a|r)||a&r);)l=a||r,l&Io?(c=e+(n-e)*(t.top-s)/(o-s),h=t.top):l&Ro?(c=e+(n-e)*(t.bottom-s)/(o-s),h=t.bottom):l&Do?(h=s+(o-s)*(t.right-e)/(n-e),c=t.right):l&Ao&&(h=s+(o-s)*(t.left-e)/(n-e),c=t.left),l===a?(e=c,s=h,a=Qe(e,s,t)):(n=c,o=h,r=Qe(n,o,t));return{x0:e,x1:n,y0:s,y1:o}}function Ze(i,t){var e=t.anchor,s=i,n,o;return t.clamp&&(s=eh(s,t.area)),e==="start"?(n=s.x0,o=s.y0):e==="end"?(n=s.x1,o=s.y1):(n=(s.x0+s.x1)/2,o=(s.y0+s.y1)/2),Jc(n,o,i.vx,i.vy,t.align)}var Je={arc:function(i,t){var e=(i.startAngle+i.endAngle)/2,s=Math.cos(e),n=Math.sin(e),o=i.innerRadius,a=i.outerRadius;return Ze({x0:i.x+s*o,y0:i.y+n*o,x1:i.x+s*a,y1:i.y+n*a,vx:s,vy:n},t)},point:function(i,t){var e=Ri(i,t.origin),s=e.x*i.options.radius,n=e.y*i.options.radius;return Ze({x0:i.x-s,y0:i.y-n,x1:i.x+s,y1:i.y+n,vx:e.x,vy:e.y},t)},bar:function(i,t){var e=Ri(i,t.origin),s=i.x,n=i.y,o=0,a=0;return i.horizontal?(s=Math.min(i.x,i.base),o=Math.abs(i.base-i.x)):(n=Math.min(i.y,i.base),a=Math.abs(i.base-i.y)),Ze({x0:s,y0:n+a,x1:s+o,y1:n,vx:e.x,vy:e.y},t)},fallback:function(i,t){var e=Ri(i,t.origin);return Ze({x0:i.x,y0:i.y,x1:i.x+(i.width||0),y1:i.y+(i.height||0),vx:e.x,vy:e.y},t)}},Ot=Te.rasterize;function ih(i){var t=i.borderWidth||0,e=i.padding,s=i.size.height,n=i.size.width,o=-n/2,a=-s/2;return{frame:{x:o-e.left-t,y:a-e.top-t,w:n+e.width+t*2,h:s+e.height+t*2},text:{x:o,y:a,w:n,h:s}}}function sh(i,t){var e=t.chart.getDatasetMeta(t.datasetIndex).vScale;if(!e)return null;if(e.xCenter!==void 0&&e.yCenter!==void 0)return{x:e.xCenter,y:e.yCenter};var s=e.getBasePixel();return i.horizontal?{x:s,y:null}:{x:null,y:s}}function nh(i){return i instanceof ie?Je.arc:i instanceof oi?Je.point:i instanceof Pe?Je.bar:Je.fallback}function oh(i,t,e,s,n,o){var a=Math.PI/2;if(o){var r=Math.min(o,n/2,s/2),l=t+r,c=e+r,h=t+s-r,d=e+n-r;i.moveTo(t,c),l<h&&c<d?(i.arc(l,c,r,-Math.PI,-a),i.arc(h,c,r,-a,0),i.arc(h,d,r,0,a),i.arc(l,d,r,a,Math.PI)):l<h?(i.moveTo(l,e),i.arc(h,c,r,-a,a),i.arc(l,c,r,a,Math.PI+a)):c<d?(i.arc(l,c,r,-Math.PI,0),i.arc(l,d,r,0,Math.PI)):i.arc(l,c,r,-Math.PI,Math.PI),i.closePath(),i.moveTo(t,e)}else i.rect(t,e,s,n)}function ah(i,t,e){var s=e.backgroundColor,n=e.borderColor,o=e.borderWidth;!s&&(!n||!o)||(i.beginPath(),oh(i,Ot(t.x)+o/2,Ot(t.y)+o/2,Ot(t.w)-o,Ot(t.h)-o,e.borderRadius),i.closePath(),s&&(i.fillStyle=s,i.fill()),n&&o&&(i.strokeStyle=n,i.lineWidth=o,i.lineJoin="miter",i.stroke()))}function rh(i,t,e){var s=e.lineHeight,n=i.w,o=i.x,a=i.y+s/2;return t==="center"?o+=n/2:(t==="end"||t==="right")&&(o+=n),{h:s,w:n,x:o,y:a}}function lh(i,t,e){var s=i.shadowBlur,n=e.stroked,o=Ot(e.x),a=Ot(e.y),r=Ot(e.w);n&&i.strokeText(t,o,a,r),e.filled&&(s&&n&&(i.shadowBlur=0),i.fillText(t,o,a,r),s&&n&&(i.shadowBlur=s))}function ch(i,t,e,s){var n=s.textAlign,o=s.color,a=!!o,r=s.font,l=t.length,c=s.textStrokeColor,h=s.textStrokeWidth,d=c&&h,u;if(!(!l||!a&&!d))for(e=rh(e,n,r),i.font=r.string,i.textAlign=n,i.textBaseline="middle",i.shadowBlur=s.textShadowBlur,i.shadowColor=s.textShadowColor,a&&(i.fillStyle=o),d&&(i.lineJoin="round",i.lineWidth=h,i.strokeStyle=c),u=0,l=t.length;u<l;++u)lh(i,t[u],{stroked:d,filled:a,w:e.w,x:e.x,y:e.y+e.h*u})}var Eo=function(i,t,e,s){var n=this;n._config=i,n._index=s,n._model=null,n._rects=null,n._ctx=t,n._el=e};xt(Eo.prototype,{_modelize:function(i,t,e,s){var n=this,o=n._index,a=J(V([e.font,{}],s,o)),r=V([e.color,q.color],s,o);return{align:V([e.align,"center"],s,o),anchor:V([e.anchor,"center"],s,o),area:s.chart.chartArea,backgroundColor:V([e.backgroundColor,null],s,o),borderColor:V([e.borderColor,null],s,o),borderRadius:V([e.borderRadius,0],s,o),borderWidth:V([e.borderWidth,0],s,o),clamp:V([e.clamp,!1],s,o),clip:V([e.clip,!1],s,o),color:r,display:i,font:a,lines:t,offset:V([e.offset,4],s,o),opacity:V([e.opacity,1],s,o),origin:sh(n._el,s),padding:dt(V([e.padding,4],s,o)),positioner:nh(n._el),rotation:V([e.rotation,0],s,o)*(Math.PI/180),size:Te.textSize(n._ctx,t,a),textAlign:V([e.textAlign,"start"],s,o),textShadowBlur:V([e.textShadowBlur,0],s,o),textShadowColor:V([e.textShadowColor,r],s,o),textStrokeColor:V([e.textStrokeColor,r],s,o),textStrokeWidth:V([e.textStrokeWidth,0],s,o)}},update:function(i){var t=this,e=null,s=null,n=t._index,o=t._config,a,r,l,c=V([o.display,!0],i,n);c&&(a=i.dataset.data[n],r=F(j(o.formatter,[a,i]),a),l=z(r)?[]:Te.toTextLines(r),l.length&&(e=t._modelize(c,l,o,i),s=ih(e))),t._model=e,t._rects=s},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(i,t){var e=this,s=i.ctx,n=e._model,o=e._rects,a;this.visible()&&(s.save(),n.clip&&(a=n.area,s.beginPath(),s.rect(a.left,a.top,a.right-a.left,a.bottom-a.top),s.clip()),s.globalAlpha=Te.bound(0,n.opacity,1),s.translate(Ot(t.x),Ot(t.y)),s.rotate(n.rotation),ah(s,o.frame,n),ch(s,n.lines,o.text,n),s.restore())}});var hh=Number.MIN_SAFE_INTEGER||-9007199254740991,dh=Number.MAX_SAFE_INTEGER||9007199254740991;function be(i,t,e){var s=Math.cos(e),n=Math.sin(e),o=t.x,a=t.y;return{x:o+s*(i.x-o)-n*(i.y-a),y:a+n*(i.x-o)+s*(i.y-a)}}function An(i,t){var e=dh,s=hh,n=t.origin,o,a,r,l,c;for(o=0;o<i.length;++o)a=i[o],r=a.x-n.x,l=a.y-n.y,c=t.vx*r+t.vy*l,e=Math.min(e,c),s=Math.max(s,c);return{min:e,max:s}}function ti(i,t){var e=t.x-i.x,s=t.y-i.y,n=Math.sqrt(e*e+s*s);return{vx:(t.x-i.x)/n,vy:(t.y-i.y)/n,origin:i,ln:n}}var Lo=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};xt(Lo.prototype,{center:function(){var i=this._rect;return{x:i.x+i.w/2,y:i.y+i.h/2}},update:function(i,t,e){this._rotation=e,this._rect={x:t.x+i.x,y:t.y+i.y,w:t.w,h:t.h}},contains:function(i){var t=this,e=1,s=t._rect;return i=be(i,t.center(),-t._rotation),!(i.x<s.x-e||i.y<s.y-e||i.x>s.x+s.w+e*2||i.y>s.y+s.h+e*2)},intersects:function(i){var t=this._points(),e=i._points(),s=[ti(t[0],t[1]),ti(t[0],t[3])],n,o,a;for(this._rotation!==i._rotation&&s.push(ti(e[0],e[1]),ti(e[0],e[3])),n=0;n<s.length;++n)if(o=An(t,s[n]),a=An(e,s[n]),o.max<a.min||a.max<o.min)return!1;return!0},_points:function(){var i=this,t=i._rect,e=i._rotation,s=i.center();return[be({x:t.x,y:t.y},s,e),be({x:t.x+t.w,y:t.y},s,e),be({x:t.x+t.w,y:t.y+t.h},s,e),be({x:t.x,y:t.y+t.h},s,e)]}});function Fo(i,t,e){var s=t.positioner(i,t),n=s.vx,o=s.vy;if(!n&&!o)return{x:s.x,y:s.y};var a=e.w,r=e.h,l=t.rotation,c=Math.abs(a/2*Math.cos(l))+Math.abs(r/2*Math.sin(l)),h=Math.abs(a/2*Math.sin(l))+Math.abs(r/2*Math.cos(l)),d=1/Math.max(Math.abs(n),Math.abs(o));return c*=n*d,h*=o*d,c+=t.offset*n,h+=t.offset*o,{x:s.x+c,y:s.y+h}}function uh(i,t){var e,s,n,o;for(e=i.length-1;e>=0;--e)for(n=i[e].$layout,s=e-1;s>=0&&n._visible;--s)o=i[s].$layout,o._visible&&n._box.intersects(o._box)&&t(n,o);return i}function fh(i){var t,e,s,n,o,a,r;for(t=0,e=i.length;t<e;++t)s=i[t],n=s.$layout,n._visible&&(r=new Proxy(s._el,{get:(l,c)=>l.getProps([c],!0)[c]}),o=s.geometry(),a=Fo(r,s.model(),o),n._box.update(a,o,s.rotation()));return uh(i,function(l,c){var h=l._hidable,d=c._hidable;h&&d||d?c._visible=!1:h&&(l._visible=!1)})}var Oe={prepare:function(i){var t=[],e,s,n,o,a;for(e=0,n=i.length;e<n;++e)for(s=0,o=i[e].length;s<o;++s)a=i[e][s],t.push(a),a.$layout={_box:new Lo,_hidable:!1,_visible:!0,_set:e,_idx:a._index};return t.sort(function(r,l){var c=r.$layout,h=l.$layout;return c._idx===h._idx?h._set-c._set:h._idx-c._idx}),this.update(t),t},update:function(i){var t=!1,e,s,n,o,a;for(e=0,s=i.length;e<s;++e)n=i[e],o=n.model(),a=n.$layout,a._hidable=o&&o.display==="auto",a._visible=n.visible(),t|=a._hidable;t&&fh(i)},lookup:function(i,t){var e,s;for(e=i.length-1;e>=0;--e)if(s=i[e].$layout,s&&s._visible&&s._box.contains(t))return i[e];return null},draw:function(i,t){var e,s,n,o,a,r;for(e=0,s=t.length;e<s;++e)n=t[e],o=n.$layout,o._visible&&(a=n.geometry(),r=Fo(n._el,n.model(),a),o._box.update(r,a,n.rotation()),n.draw(i,r))}},_h=function(i){if(z(i))return null;var t=i,e,s,n;if(I(i))if(!z(i.label))t=i.label;else if(!z(i.r))t=i.r;else for(t="",e=Object.keys(i),n=0,s=e.length;n<s;++n)t+=(n!==0?", ":"")+e[n]+": "+i[e[n]];return""+t},gh={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:_h,labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},ot="$datalabels",Bo="$default";function ph(i,t){var e=i.datalabels,s={},n=[],o,a;return e===!1?null:(e===!0&&(e={}),t=xt({},[t,e]),o=t.labels||{},a=Object.keys(o),delete t.labels,a.length?a.forEach(function(r){o[r]&&n.push(xt({},[t,o[r],{_key:r}]))}):n.push(t),s=n.reduce(function(r,l){return B(l.listeners||{},function(c,h){r[h]=r[h]||{},r[h][l._key||Bo]=c}),delete l.listeners,r},{}),{labels:n,listeners:s})}function Ui(i,t,e,s){if(t){var n=e.$context,o=e.$groups,a;t[o._set]&&(a=t[o._set][o._key],a&&j(a,[n,s])===!0&&(i[ot]._dirty=!0,e.update(n)))}}function mh(i,t,e,s,n){var o,a;!e&&!s||(e?s?e!==s&&(a=o=!0):a=!0:o=!0,a&&Ui(i,t.leave,e,n),o&&Ui(i,t.enter,s,n))}function bh(i,t){var e=i[ot],s=e._listeners,n,o;if(!(!s.enter&&!s.leave)){if(t.type==="mousemove")o=Oe.lookup(e._labels,t);else if(t.type!=="mouseout")return;n=e._hovered,e._hovered=o,mh(i,s,n,o,t)}}function yh(i,t){var e=i[ot],s=e._listeners.click,n=s&&Oe.lookup(e._labels,t);n&&Ui(i,s,n,t)}var xh={id:"datalabels",defaults:gh,beforeInit:function(i){i[ot]={_actives:[]}},beforeUpdate:function(i){var t=i[ot];t._listened=!1,t._listeners={},t._datasets=[],t._labels=[]},afterDatasetUpdate:function(i,t,e){var s=t.index,n=i[ot],o=n._datasets[s]=[],a=i.isDatasetVisible(s),r=i.data.datasets[s],l=ph(r,e),c=t.meta.data||[],h=i.ctx,d,u,f,g,_,p,m,b;for(h.save(),d=0,f=c.length;d<f;++d)if(m=c[d],m[ot]=[],a&&m&&i.getDataVisibility(d)&&!m.skip)for(u=0,g=l.labels.length;u<g;++u)_=l.labels[u],p=_._key,b=new Eo(_,h,m,d),b.$groups={_set:s,_key:p||Bo},b.$context={active:!1,chart:i,dataIndex:d,dataset:r,datasetIndex:s},b.update(b.$context),m[ot].push(b),o.push(b);h.restore(),xt(n._listeners,l.listeners,{merger:function(y,v,x){v[y]=v[y]||{},v[y][t.index]=x[y],n._listened=!0}})},afterUpdate:function(i){i[ot]._labels=Oe.prepare(i[ot]._datasets)},afterDatasetsDraw:function(i){Oe.draw(i,i[ot]._labels)},beforeEvent:function(i,t){if(i[ot]._listened){var e=t.event;switch(e.type){case"mousemove":case"mouseout":bh(i,e);break;case"click":yh(i,e);break}}},afterEvent:function(i){var t=i[ot],e=t._actives,s=t._actives=i.getActiveElements(),n=Te.arrayDiff(e,s),o,a,r,l,c,h,d;for(o=0,a=n.length;o<a;++o)if(c=n[o],c[1])for(d=c[0].element[ot]||[],r=0,l=d.length;r<l;++r)h=d[r],h.$context.active=c[1]===1,h.update(h.$context);(t._dirty||n.length)&&(Oe.update(t._labels),i.render()),delete t._dirty}};Fe.register(wo,Mo,vo,gi,pi,Pe,xh);const vh={components:{Bar:Xc},props:{hoverLabel:{type:String,default:"Anzahl:"},chartData:{type:Object,default:null},styling:{type:Object,default:()=>({width:600,height:300})}},data(){return{chart:null,silence_hover:!1,bar_chart_options:{responsive:!0,maintainAspectRatio:!1,indexAxis:"y",layout:{padding:{right:30}},plugins:{datalabels:{color:"#650013",anchor:"end",align:"end",offset:2,clip:!1,listeners:{click:this.click_label,enter:(i,t)=>{this.silence_hover=!0,t.native.target.style.cursor=this.determine_pointer_style(i)},leave:(i,t)=>{this.silence_hover=!1,t.native.target.style.cursor="default"}}},tooltip:{callbacks:{label:i=>` ${this.hoverLabel} ${i.parsed.y}`}}},interaction:{mode:"index",axis:"y"},onClick:this.click_bar,onHover:(i,t)=>{!this.silence_hover&&t.length&&(i.native.target.style.cursor=this.determine_pointer_style(t[0]))}}}},computed:{component_height(){return this.chartData.datasets[0].data.length*30},styles(){return{height:`${this.component_height+60}px`,position:"relative"}}},updated(){this.has_data()&&(this.chart=this.$refs.bar.chart)},mounted(){this.has_data()&&(this.chart=this.$refs.bar.chart)},methods:{has_data(){return this.chartData!=null&&"datasets"in this.chartData&&this.chartData.datasets.length&&this.chartData.datasets[0].data.length},determine_pointer_style(i){let t=null;return i.index>=0?t=i.index:i.dataIndex>=0&&(t=i.dataIndex),this.has_query(i.datasetIndex,t)?"pointer":"default"},has_query(i,t){return this.chartData.datasets[i]&&this.chartData.datasets[i].queries[t]},navigate_to(i,t){this.has_query(i,t)&&this.$router.push({name:"Search",query:{q:this.chartData.datasets[i].queries[t]}})},click_bar(i){const t=this.chart.getElementsAtEventForMode(i,"nearest",{intersect:!0},!0);t.length!=0&&this.navigate_to(t[0].datasetIndex,t[0].index)},click_label(i){this.navigate_to(i.datasetIndex,i.dataIndex)}}},kh={key:0};function wh(i,t,e,s,n,o){const a=Z("Bar");return o.has_data()?(O(),it("div",kh,[S(a,{ref:"bar",data:e.chartData,options:n.bar_chart_options,"chart-id":"quoted_works",style:Go(o.styles)},null,8,["data","options","style"])])):ft("",!0)}const zo=Bt(vh,[["render",wh]]),te=`
    BASE <https://db.antiquitatum-thesaurus.eu>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
    PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> 
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>  `,ee={is_copy_after:`?s crm:P108i_was_produced_by / crm:P01i_is_domain_of ?relation .
                  ?relation crm:P16.1_mode_of_use <type/original> .
                  ?relation crm:P02_has_range ?original_object . `,has_copy:`?relation crm:P02_has_range ?s .
             ?relation crm:P16.1_mode_of_use <type/original> .
             ?original_object crm:P108i_was_produced_by / crm:P01i_is_domain_of ?relation .
                  `,is_precursor_for:`?relation crm:P16.1_mode_of_use <type/precursor> .
                     ?relation crm:P02_has_range ?s .
                     ?original_object crm:P108i_was_produced_by / crm:P01i_is_domain_of ?relation . 
                  `,is_based_on:`?relation crm:P16.1_mode_of_use <type/precursor> .
                ?s crm:P108i_was_produced_by / crm:P01i_is_domain_of ?relation . 
                ?relation crm:P02_has_range ?original_object .`,is_duplicate:`?s crm:P01i_is_domain_of ?relation .
                  ?relation crm:P130.1_kind_of_similarity <type/1641767> .
                  ?relation crm:P02_has_range ?original_object .`,related_to:`?s crm:P01i_is_domain_of ?relation .
               ?relation crm:P130.1_kind_of_similarity <type/1022295> .
               ?relation crm:P02_has_range ?original_object .`,has_version:`?s crm:P01i_is_domain_of ?relation . 
                  ?relation crm:P130.1_kind_of_similarity <type/object_version> .
                  ?relation crm:P02_has_range ?original_object .`,is_version_of:`?s crm:P02i_is_range_of ?relation . 
                ?relation crm:P130.1_kind_of_similarity <type/object_version> .
                ?relation crm:P01_has_domain ?original_object .`},le={async get_artefact_depections(i=0,t=null){let e="";i>0&&(e=`?o crm:P46i_forms_part_of <module/${i}> .`);let s=`
      ${te}
      SELECT DISTINCT ?id ?title (COUNT(DISTINCT ?o) as ?art_cnt)
      WHERE {
      
        
        ?depicts a crm:PC62_depicts .
        ?depicts crm:P02_has_range  ?artefact .
        ?o crm:P01i_is_domain_of ?depicts .
        ${e}

        ?artefact crm:P1_is_identified_by ?title_obj .
        VALUES ?pref_title { <type/preferred_title> }
        ?title_obj crm:P2_has_type  ?pref_title.
        ?title_obj crm:P190_has_symbolic_content ?title .

        BIND(STRAFTER( STR(?artefact), "object/" ) as ?id) .
      } 
      GROUP BY ?id ?title
      ORDER BY DESC(?art_cnt)
    `,n=await Mt(s,{signal:t});return At(n,{stats:[{id:"id",label:"title",artefacts:"art_cnt"}]})},async get_plates_per_work(i=0,t=null){let e="";i>0?e=`FILTER NOT EXISTS { ?x crm:P46_is_composed_of ?father . ?x crm:P46i_forms_part_of <module/${i}> . }`:e="FILTER NOT EXISTS { ?x crm:P46_is_composed_of ?father . }";let s="",n="";i>0&&(s=`?leafs crm:P46i_forms_part_of <module/${i}> .`,n=`?father crm:P46i_forms_part_of <module/${i}> .`);let o=`
      ${te}
      SELECT DISTINCT ?id (CONCAT(?gr_title, " ", ?title) AS ?title) (COUNT(DISTINCT ?leafs) as ?plate_cnt)  (COUNT(DISTINCT ?artefact) as ?art_cnt)
      WHERE {
      hint:Query hint:optimizer "None" .
        # father is either 'Druckwerk' or 'Handschrift' or 'Grafik'
       VALUES ?father_type {<type/gnd_4013134-8> <type/gnd_4023287-6> <type/gnd_4021845-4>}
  		  ?father crm:P2_has_type ?father_type .

        ${n}

          ?father crm:P46_is_composed_of* ?leafs .
          
          ${s}

           # leafs have no more parts 
          FILTER NOT EXISTS { ?leafs crm:P46_is_composed_of ?y }
        
          OPTIONAL{
            ?leafs crm:P01i_is_domain_of ?depicts .
            ?depicts a crm:PC62_depicts .
            ?depicts crm:P02_has_range ?artefact .
          }

        # father is not a part of something else
        ${e}

        # father has a title
        ?father crm:P1_is_identified_by ?title_obj .

        VALUES ?pref_title { <type/preferred_title> }
        ?title_obj crm:P2_has_type  ?pref_title.
        ?title_obj crm:P190_has_symbolic_content ?title .

        # get grandfather title if exists
        # this is important for module queries where 
        # father is not always the last item in the hierarchy
        OPTIONAL {
          ?father crm:P46i_forms_part_of+ ?grand_father
          FILTER NOT EXISTS { ?x crm:P46_is_composed_of ?grand_father }
          
          ?grand_father crm:P1_is_identified_by ?gr_title_obj .
          ?gr_title_obj crm:P2_has_type ?pref_title .
          ?gr_title_obj crm:P190_has_symbolic_content ?gr_title .
        }


        BIND(STRAFTER( STR(?father), "object/" ) as ?id) .
      } 
      GROUP BY ?id ?father ?gr_title ?title
      ORDER BY DESC(?plate_cnt) DESC(?art_cnt) DESC(?title) 
    `,a=await Mt(o,{signal:t});return At(a,{stats:[{id:"id",label:"title",count:"plate_cnt",artefacts:"art_cnt"}]})},async get_progress_statistics(i=null){let t=new Date(Date.now());t.setDate(t.getDate()-7);let e=`
    ${te}
    SELECT ?label ?cnt WHERE {
      {
        SELECT ?label (count(DISTINCT ?s) as ?cnt) WHERE {
          BIND('creation_last_week' as ?label)
          ?s a crm:E24_Physical_Human-Made_Thing .
          ?s crm:P67i_is_referred_to_by / crm:P94i_was_created_by / crm:P4_has_time-span /crm:P82b_end_of_the_end ?end .
          FILTER(?end >= "${t.toISOString()}"^^xsd:date)
        }
        GROUP BY ?label
        
      } UNION {
        SELECT ?label (count(DISTINCT ?s) as ?cnt) WHERE {
          BIND('all' as ?label)
          ?s a crm:E24_Physical_Human-Made_Thing .
        }
        GROUP BY ?label
      }
    } ORDER BY ?cnt
    `,s=await Mt(e,{signal:i});return At(s,{progress_stats:[{label:"label",count:"cnt"}]})},async get_artefacts_for_work_by_type_stats(i,t=0,e="classification",s=null){let n="",o="",a="";i>-1&&(n="?work_title",o=`
        VALUES ?root { <object/${i}> }
        ?root crm:P1_is_identified_by ?title . 
        VALUES ?pref_title { <type/preferred_title> }
        ?title crm:P2_has_type  ?pref_title.
        ?title crm:P190_has_symbolic_content ?work_title .
        ?root crm:P46_is_composed_of* ?part .`),t>0&&(a=`?part crm:P46i_forms_part_of <module/${t}> .`);let r=`
          ${te}

          SELECT ${n} ?type ?class_name (count(DISTINCT ?artefact) as ?count) 
          WHERE {
            ${o}
            ${a}    
            ?part crm:P01i_is_domain_of ?depicts .
            ?depicts a crm:PC62_depicts .
            ?depicts crm:P02_has_range ?artefact . 
            ?artefact crm:P2_has_type ?type .

            VALUES ?t_type {<type/${e}> }
            ?type crm:P2_has_type ?t_type .
            ?type rdfs:label ?class_name . 
          } 
          GROUP BY ?type ?class_name ${n}
          ORDER BY DESC(?count)`,l=await Mt(r,{signal:s});return At(l,{class_stats:{work_title:"work_title",stats:[{iri:"type",label:"class_name",count:"count"}]}})},async get_total_works_relations(i=0,t=null){let e="";i>0&&(e=`?s crm:P46i_forms_part_of <module/${i}> .`);let s=`
      ${te}
      SELECT ?type (COUNT(?original_object) as ?count) WHERE {
        ${e}
        {
          BIND("is_copy_after/has_copy" as ?type)
          ${ee.is_copy_after}

        } UNION {
          BIND("is_precursor_for/is_based_on" as ?type)
          ${ee.is_precursor_for}

        } UNION {
          BIND("is_duplicate" as ?type)
          ${ee.is_duplicate}

        } UNION {
          BIND("related_to" as ?type)
          ${ee.related_to}

        } UNION {
          BIND("is_version_of/has_version" as ?type)
          ${ee.is_version_of}
        }
      } GROUP BY ?type ORDER BY DESC(?count)
    `,n=await Mt(s,{signal:t});return At(n,{rel_stats:[{type:"type",count:"count"}]})},async get_cited_works_stats(i,t="is_copy_after",e=null){let s=`
      ${te}
      SELECT ?father ?title ?part_of_source_work (COUNT(?original_object) as ?count) WHERE {
        # selected object is composed of sides
       VALUES ?root { <object/${i}> }
        ?root crm:P46_is_composed_of* ?s .

        ${ee[t]}
        
        
        # related objects have a father 
        ?father crm:P46_is_composed_of* ?original_object .
       	FILTER NOT EXISTS { ?x crm:P46_is_composed_of ?father . }
    		BIND(IF (exists { ?father crm:P46_is_composed_of ?x. }, 1, 0) AS ?part_of_source_work )

        # father has a title
        ?father crm:P1_is_identified_by ?title_obj .
        ?title_obj crm:P2_has_type <type/preferred_title> .
        ?title_obj crm:P190_has_symbolic_content ?title .

     } 
      GROUP BY ?father ?title ?part_of_source_work
      ORDER BY DESC(?count) DESC(?title)
    `,n=await Mt(s,{signal:e});return At(n,{work_stats:[{iri:"father",label:"title",count:"count",part_of_source_work:"part_of_source_work"}]})}},No={methods:{create_hexadecimal_value(i,t=198,e=2){return Math.floor(i*t).toString(16).padStart(e,"0")},get_random_color(i,t,e="r"){let s=this.create_hexadecimal_value((t-i)/t);return e==="r"?`#${s}0C30`:e==="b"?`#0C30${s}`:"#000000"}}},Xi=1,Ki=2,Ii=`
    BASE <https://db.antiquitatum-thesaurus.eu>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
    PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> 
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX at: <https://db.antiquitatum-thesaurus.eu/ontology/>
  `,_s={async get_work_titles_n_id(i=0,t=0){let e="";i>0?e=`FILTER NOT EXISTS { ?x crm:P46_is_composed_of ?father . ?x crm:P46i_forms_part_of <module/${i}> . }`:e="FILTER NOT EXISTS { ?x crm:P46_is_composed_of ?father . }";const s=a=>`FILTER EXISTS {
    				{
    					?${a} crm:P108i_was_produced_by / crm:P01i_is_domain_of / crm:P16.1_mode_of_use <type/original> .
					  } UNION {
              ?${a} crm:P02i_is_range_of / crm:P16.1_mode_of_use <type/original>
					  } UNION {
    					?${a} crm:P108i_was_produced_by / crm:P01i_is_domain_of / crm:P16.1_mode_of_use <type/precursor> .
					  } UNION { 
    					?${a} crm:P01i_is_domain_of / crm:P130.1_kind_of_similarity <type/1641767> .
					  } UNION {
    					?${a} crm:P01i_is_domain_of / crm:P130.1_kind_of_similarity <type/1022295> .
					  } UNION {
              ?${a} crm:P01i_is_domain_of / crm:P130.1_kind_of_similarity <type/object_version> .
					  } UNION {
              ?${a} crm:P02i_is_range_of / crm:P130.1_kind_of_similarity <type/object_version>
            }
				  }`;let n=`
            ${Ii}
            SELECT DISTINCT ?id (CONCAT(?gr_title, " ", ?title_label) AS ?title_label) WHERE {
                VALUES ?father_type {<type/gnd_4013134-8> <type/gnd_4023287-6> <type/gnd_4021845-4>}
                hint:Query hint:optimizer "None" .
                ?father crm:P2_has_type ?father_type . 

                
                
                { 
                  ?father crm:P46_is_composed_of+ ?pages .

                  # in cases where the depicted artifacts are in focus find only results with a depicts link
                  ${t==Xi?"?pages crm:P01i_is_domain_of ?depicts . ?depicts a crm:PC62_depicts .":""}
                  ${t==Ki?s("pages"):""}

                  # if a module filter is active find only fathers that are part of the module
                  ${i>0?`?father crm:P46i_forms_part_of <module/${i}> .`:""}

                  # filter the fathers down to the required toplevel entry
                  ${e}

        		    } UNION {
                  # no other object has ?father as father
                  FILTER NOT EXISTS { ?pages crm:P46_is_composed_of|^crm:P46_is_composed_of ?father. }
                  ${t==Xi?"?father crm:P01i_is_domain_of ?depicts . ?depicts a crm:PC62_depicts .":""}
                  ${t==Ki?s("father"):""}
                  ${i>0?`?father crm:P46i_forms_part_of <module/${i}> .`:""}

       		     } 

                

                ?father crm:P1_is_identified_by ?title .
                ?title crm:P2_has_type <type/preferred_title> . 
                ?title crm:P190_has_symbolic_content ?title_label .

                OPTIONAL {
                  # in cases where father is not the last entry of the hierarchy 
                  # e.g. with active module filter, find the last one for the proper title
                  ?father crm:P46i_forms_part_of+ ?grand_father .
                  ?grand_father a crm:E24_Physical_Human-Made_Thing .
                  FILTER NOT EXISTS { ?x crm:P46_is_composed_of ?grand_father. ?grand_father a crm:E24_Physical_Human-Made_Thing . }
                  ?grand_father crm:P1_is_identified_by ?gr_title_obj .
                  ?gr_title_obj crm:P2_has_type <type/preferred_title> .
                  ?gr_title_obj crm:P190_has_symbolic_content ?gr_title .
  				      }

                BIND(STRAFTER( STR(?father), "object/" ) as ?id)   
               } GROUP BY ?id ?gr_title ?title_label
               ORDER BY ?title_label`,o=await Mt(n);return At(o,{works:[{value:"id",title:"title_label"}]})},async get_work_titles_based_on_relationship(i){let e=`
            ${Ii}
            SELECT DISTINCT ?id ?title_label WHERE {
                ?father crm:P46_is_composed_of* ?s .

                ${{is_copy_after:"FILTER EXISTS { ?s crm:P108i_was_produced_by / crm:P01i_is_domain_of / crm:P16.1_mode_of_use <type/original> }",has_precursor:"FILTER EXISTS { ?s crm:P108i_was_produced_by / crm:P01i_is_domain_of / crm:P16.1_mode_of_use <type/precursor> }",has_duplicate:"FILTER EXISTS { ?s crm:P01i_is_domain_of / crm:P130.1_kind_of_similarity <type/1641767> }",is_related_by:"FILTER EXISTS { ?s crm:P01i_is_domain_of / crm:P130.1_kind_of_similarity <type/1022295> }"}[i]}

                FILTER NOT EXISTS {?father ^crm:P46_is_composed_of ?g . }
               
                ?father crm:P1_is_identified_by ?title .
                ?title crm:P2_has_type <type/preferred_title> . 
                ?title crm:P190_has_symbolic_content ?title_label .
                
                BIND(STRAFTER( STR(?father), "object/" ) as ?id)
                
               } ORDER BY ?title_label`,s=await Mt(e);return At(s,{works:[{value:"id",text:"title_label"}]})},async get_relationships_based_on_selected_work(i,t){let e=`
        ${Ii}
        SELECT 
          (MAX(?ica) as ?is_copy_after)
          (MAX(?hc) as ?has_copy)
          (MAX(?pf) as ?is_precursor_for)
          (MAX(?bo) as ?is_based_on)
          (MAX(?hd) as ?is_duplicate)
          (MAX(?rt) as ?related_to)
          (MAX(?hv) as ?has_version)
          (MAX(?iv) as ?is_version_of)
        WHERE {
          ?object crm:P46i_forms_part_of* <object/${i}> . 
          BIND ( IF (exists { ?object crm:P108i_was_produced_by ?x . ?x crm:P01i_is_domain_of  ?y . ?y crm:P16.1_mode_of_use <type/original> . }, 1, 0) AS ?ica ) 
          BIND ( IF (exists { ?object crm:P02i_is_range_of ?x . ?x crm:P16.1_mode_of_use <type/original> . }, 1, 0) AS ?hc )
          BIND ( IF (exists { ?object crm:P108i_was_produced_by ?x . ?x crm:P01i_is_domain_of ?y . ?y crm:P16.1_mode_of_use <type/precursor> . }, 1, 0) AS ?bo ) 
          BIND ( IF (exists { ?x crm:P108i_was_produced_by ?y . ?y crm:P01i_is_domain_of ?z . ?z crm:P16.1_mode_of_use <type/precursor> . ?z crm:P02_has_range ?object }, 1, 0) AS ?pf ) 
          BIND ( IF (exists { ?object crm:P01i_is_domain_of ?x . ?x crm:P130.1_kind_of_similarity <type/1641767> . }, 1, 0) AS ?hd ) 
          BIND ( IF (exists { ?object crm:P01i_is_domain_of ?x . ?x crm:P130.1_kind_of_similarity <type/1022295> . ?x crm:P02_has_range ?oro . ?father crm:P46_is_composed_of ?oro . }, 1, 0) AS ?rt )
          BIND ( IF (exists { ?object crm:P01i_is_domain_of ?x . ?x crm:P130.1_kind_of_similarity <type/object_version> . }, 1, 0) AS ?hv )
          BIND ( IF (exists { ?object crm:P02i_is_range_of ?x . ?x crm:P130.1_kind_of_similarity <type/object_version> . }, 1, 0) AS ?iv )
        }
      `,s=await Mt(e,{signal:t}),n=[];for(const[o,a]of Object.entries(s.results.bindings[0]))a.value==1&&n.push(o);return n}},Sh=En({...Qo({falseIcon:"$radioOff",trueIcon:"$radioOn"})},"VRadio"),jo=Ln()({name:"VRadio",props:Sh(),setup(i,t){let{slots:e}=t;return Fn(()=>{const s=Fi.filterProps(i);return S(Fi,Bi(s,{class:["v-radio",i.class],style:i.style,type:"radio"}),e)}),{}}}),Mh=En({height:{type:[Number,String],default:"auto"},...aa(),...Zo(Jo(),["multiple"]),trueIcon:{type:gs,default:"$radioOn"},falseIcon:{type:gs,default:"$radioOff"},type:{type:String,default:"radio"}},"VRadioGroup"),Wo=Ln()({name:"VRadioGroup",inheritAttrs:!1,props:Mh(),emits:{"update:modelValue":i=>!0},setup(i,t){let{attrs:e,slots:s}=t;const n=ta(),o=Bn(()=>i.id||`radio-group-${n}`),a=ea(i,"modelValue");return Fn(()=>{const[r,l]=ia(e),c=ps.filterProps(i),h=Fi.filterProps(i),d=s.label?s.label({label:i.label,props:{for:o.value}}):i.label;return S(ps,Bi({class:["v-radio-group",i.class],style:i.style},r,c,{modelValue:a.value,"onUpdate:modelValue":u=>a.value=u,id:o.value}),{...s,default:u=>{let{id:f,messagesId:g,isDisabled:_,isReadonly:p}=u;return S(It,null,[d&&S(sa,{id:f.value},{default:()=>[d]}),S(na,Bi(h,{id:f.value,"aria-describedby":g.value,defaultsTarget:"VRadio",trueIcon:i.trueIcon,falseIcon:i.falseIcon,type:i.type,disabled:_.value,readonly:p.value,"aria-labelledby":d?f.value:void 0,multiple:!1},l,{modelValue:a.value,"onUpdate:modelValue":m=>a.value=m}),s)])}})}),{}}}),Ph={name:"ContentPerDocument",components:{PieChart:Zc,BarChart:zo,LoadingSpinner:zn},mixins:[No],inject:["parent_ac"],props:{moduleQueries:{type:Object,required:!0},selectedModul:{type:String,required:!0},unsupportedSourceWork:{type:Array,default:()=>[]}},data(){return{selected_chart_type:"Bar",chart_types:["Bar","Table"],list_not_loaded:!0,found_data:!1,class_data:null,class_data_raw:[],data_table_headers:[{text:"Klasse",align:"start",sortable:!1,value:"label"},{text:"Anzahl",value:"count"}],footerProps:{"items-per-page-text":this.$t("statistics.rows_per_page"),"items-per-page-all-text":this.$t("statistics.all_rows"),"items-per-page-options":[5,10,20,-1]},selected_objectclass:"classification",selected_work:0,selectable_works_list:[],types:[{value:"classification",text:this.$t("statistics.classification")},{value:"object_type",text:this.$t("statistics.object_type")}],data_loading:!1,no_data_text:this.$t("statistics.no_data_found"),loading_text:this.$t("statistics.data_loading")}},computed:{has_selection(){return this.selected_objectclass&&this.selected_work},selected_work_title(){return this.selected_work?this.selectable_works_list.find(t=>t.value===this.selected_work).title:""}},watch:{selectedModul(){this.reset_loaded_data(),this.reset_formular_data(),this.init_select(),this.load_from_ts()},selected_objectclass(){let i=this.types.find(t=>t.value==this.selected_objectclass);this.data_table_headers[0].text=i.text,this.load_from_ts()},selected_work(i){i!=0&&this.load_from_ts()}},mounted(){this.init_select()},methods:{initiate_search(i){this.$router.push({name:"Search",query:{qfilter:[`${this.selected_objectclass}-IS_OR-${i}`,`is_depicted_in-IS_OR-${this.selected_work_title}`],sorting:"title"}})},reset_loaded_data(){this.class_data=null,this.class_data_raw=[]},reset_formular_data(){},add_module_query(i){this.selectedModul!="all"&&i.push(this.moduleQueries[this.selectedModul])},create_query(i,t){if(!this.unsupportedSourceWork.includes(this.selected_work)){let e=[{field:this.selected_objectclass,iri:[{value:i,label:t}]}];return this.selected_work>-1&&e.push({field:"is_depicted_in",iri:[{value:`object/${this.selected_work}`,label:this.selected_work_title}]}),this.add_module_query(e),JSON.stringify(e)}return null},init_class_data(){return{labels:[],datasets:[{label:`Anzahl Artefakte in ${this.selected_work_title}`,data:[],backgroundColor:[],queries:[],barThickness:5}]}},init_select(){const i=this.selectedModul!="all"?Number(this.selectedModul):0;this.list_not_loaded=!0,_s.get_work_titles_n_id(i,Xi).then(t=>{if(t.works){const e=t.works.sort((s,n)=>s.title.localeCompare(n.title));this.selectable_works_list=[{value:-1,title:"Alle Quellenwerke"},...e],this.selected_work=-1,this.list_not_loaded=!1}})},load_from_ts(){if(this.has_selection){this.class_data=this.init_class_data(),this.data_loading=!0;const i=this.selectedModul!="all"?Number(this.selectedModul):0;le.get_artefacts_for_work_by_type_stats(this.selected_work,i,this.selected_objectclass,this.parent_ac.signal).then(t=>{this.class_data=this.init_class_data(),this.class_data_raw=[],t.class_stats?(this.found_data=!0,this.class_data_raw=t.class_stats.stats,t.class_stats.stats.forEach((e,s)=>{this.class_data.labels.push(e.label),this.class_data.datasets[0].data.push(e.count),this.class_data.datasets[0].backgroundColor.push(this.get_random_color(s,this.class_data.datasets[0].data.length)),this.class_data.datasets[0].queries.push(this.create_query(e.iri,e.label))})):this.found_data=!1,this.data_loading=!1})}}}},Th={key:0,class:"pie_container"},Oh={class:"text-start"},Ch={class:"text-end",style:{"min-width":"160px"}},Ah={key:1};function Dh(i,t,e,s,n,o){const a=Z("PieChart"),r=Z("BarChart"),l=Z("router-link"),c=Z("LoadingSpinner");return O(),W(ae,null,{default:k(()=>[S(ht,null,{default:k(()=>[S($,null,{default:k(()=>[E("h4",null,[st(L(i.$t("statistics.headline_classifications_per_document")),1),E("span",null," ("+L(i.$t(`statistics.${e.selectedModul}`))+")",1)])]),_:1})]),_:1}),S(ht,{align:"center",justify:"center"},{default:k(()=>[S($,{lg:"5",md:"6",sm:"6",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(Ce,{modelValue:n.selected_work,"onUpdate:modelValue":t[0]||(t[0]=h=>n.selected_work=h),items:n.selectable_works_list,"item-title":"title","item-value":"value",label:i.$t("statistics.work"),disabled:n.list_not_loaded},null,8,["modelValue","items","label","disabled"])]),_:1},8,["class"]),S($,{lg:"3",md:"6",sm:"6",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(Ce,{modelValue:n.selected_objectclass,"onUpdate:modelValue":t[1]||(t[1]=h=>n.selected_objectclass=h),"item-title":"text","item-value":"value",items:n.types,label:i.$t("label.classification_systematic"),disabled:n.list_not_loaded},null,8,["modelValue","items","label","disabled"])]),_:1},8,["class"]),S($,{lg:"4",md:"6",sm:"6",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(Wo,{modelValue:n.selected_chart_type,"onUpdate:modelValue":t[2]||(t[2]=h=>n.selected_chart_type=h),inline:""},{default:k(()=>[(O(!0),it(It,null,Gi(n.chart_types,h=>(O(),W(jo,{key:h,label:i.$t(`label.${h}`),value:h},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["class"])]),_:1}),S(ht,null,{default:k(()=>[n.data_loading?(O(),W($,{key:1},{default:k(()=>[S(c)]),_:1})):(O(),W($,{key:0},{default:k(()=>[n.found_data?(O(),W(ae,{key:0,style:{"max-width":"800px"}},{default:k(()=>[n.selected_chart_type=="Pie"?(O(),it("span",Th,[n.class_data?(O(),W(a,{key:0,"chart-data":n.class_data,onFilterBy:o.initiate_search},null,8,["chart-data","onFilterBy"])):ft("",!0)])):ft("",!0),n.selected_chart_type=="Bar"?(O(),it(It,{key:1},[n.class_data?(O(),W(r,{key:0,"chart-data":n.class_data},null,8,["chart-data"])):ft("",!0)],64)):ft("",!0),n.selected_chart_type=="Table"?(O(),W(bi,{key:2,items:n.class_data_raw,headers:n.data_table_headers,loading:n.data_loading,"loading-text":n.loading_text,"no-data-text":n.no_data_text,"footer-props":n.footerProps},{item:k(({item:h})=>[E("tr",null,[E("td",Oh,L(h.label),1),E("td",Ch,[h.count>0?(O(),W(l,{key:0,class:"link",to:{name:"Search",query:{q:o.create_query(h.iri,h.label)}}},{default:k(()=>[st(L(h.count),1)]),_:2},1032,["to"])):(O(),it("div",Ah,L(h.count),1))])])]),_:1},8,["items","headers","loading","loading-text","no-data-text","footer-props"])):ft("",!0)]),_:1})):(O(),it(It,{key:1},[st(L(n.no_data_text),1)],64))]),_:1}))]),_:1})]),_:1})}const Rh=Bt(Ph,[["render",Dh],["__scopeId","data-v-44d58dbc"]]),Ih={name:"CollectionProgress",inject:["parent_ac"],data(){return{stats:[]}},created(){le.get_progress_statistics(this.parent_ac.signal).then(i=>{i.progress_stats&&(this.stats=i.progress_stats)})}},Eh={class:"mx-4 mb-1"};function Lh(i,t,e,s,n,o){return O(),it("div",Eh,[S(ht,null,{default:k(()=>[S($,null,{default:k(()=>[E("h4",null,L(i.$t("statistics.headline_progress")),1)]),_:1})]),_:1}),(O(!0),it(It,null,Gi(n.stats,(a,r)=>(O(),W(ht,{key:"stats_"+r,class:"text-body-2",dense:""},{default:k(()=>[S($,null,{default:k(()=>[st(L(i.$t("statistics."+a.label)),1)]),_:2},1024),S($,null,{default:k(()=>[st(L(a.count),1)]),_:2},1024)]),_:2},1024))),128))])}const Fh=Bt(Ih,[["render",Lh]]),Bh={name:"PlatesPerDocument",inject:["parent_ac"],props:{moduleQueries:{type:Object,default:()=>({})},selectedModul:{type:String,default:"all"},unsupportedSourceWork:{type:Array,default:()=>[]}},data(){return{selected_chart_type:"Table",stats_raw:[],data_table_headers:[{title:this.$t("statistics.work"),align:"start",key:"label"},{title:"Anzahl Abbildungen",align:"end",key:"count"},{title:"Anzahl Artefakte",align:"end",key:"artefacts"}],footerProps:{"items-per-page-options":[{value:5,title:"5"},{value:10,title:"10"},{value:20,title:"20"},{value:-1,title:this.$t("statistics.all_rows")}]},data_loading:!1,no_data_text:this.$t("statistics.no_data_found"),loading_text:this.$t("statistics.data_loading")}},computed:{total_count(){return this.stats_raw.length?this.sum_fields("count"):0},total_artefacts(){return this.stats_raw.length?this.sum_fields("artefacts"):0}},watch:{selectedModul(){this.load_from_ts()}},created(){this.load_from_ts()},methods:{sum_fields(i){return this.stats_raw.reduce((t,e)=>Number(t)+(Number(e[i])||0),0)},add_module_query(i){this.selectedModul!="all"&&i.push(this.moduleQueries[this.selectedModul])},buildDepictionsQuery(i,t){if(!this.unsupportedSourceWork.includes(i)){let e=[{field:"is_part_of_source_work",iri:[{value:`object/${i}`,label:t}]},{field:"object_type",iri:[{value:"type/gnd_4021845-4",label:"Grafik"}]}];return this.add_module_query(e),JSON.stringify(e)}return null},buildArtefactsQuery(i,t){if(!this.unsupportedSourceWork.includes(i)){let e=[{field:"is_depicted_in",iri:[{value:`object/${i}`,label:t}]}];return this.add_module_query(e),JSON.stringify(e)}return null},load_from_ts(){this.data_loading=!0;const i=this.selectedModul!="all"?Number(this.selectedModul):0;le.get_plates_per_work(i,this.parent_ac.signal).then(t=>{t&&t.stats&&(this.data_loading=!1,this.stats_raw=t.stats)})}}},zh={class:"text-start"},Nh={class:"text-end",style:{width:"90px"}},jh={key:1},Wh={class:"text-end",style:{width:"90px"}},Hh={key:1},Vh={class:"text-start"},$h={class:"text-end"},qh={class:"text-end"};function Yh(i,t,e,s,n,o){const a=Z("router-link");return O(),W(ae,null,{default:k(()=>[E("h4",null,[st(L(i.$t("statistics.headline_plates_per_document")),1),E("span",null," ("+L(i.$t(`statistics.${e.selectedModul}`))+")",1)]),n.selected_chart_type=="Table"?(O(),W(bi,{key:0,items:n.stats_raw,headers:n.data_table_headers,loading:n.data_loading,"loading-text":n.loading_text,"no-data-text":n.no_data_text,"items-per-page-options":n.footerProps["items-per-page-options"]},{item:k(({item:r})=>[E("tr",null,[E("td",zh,[S(a,{class:"link",to:`/object/${r.id}`},{default:k(()=>[st(L(r.label),1)]),_:2},1032,["to"])]),E("td",Nh,[r.count>0&&!e.unsupportedSourceWork.includes(r.id)?(O(),W(a,{key:0,class:"link",to:{name:"Search",query:{q:o.buildDepictionsQuery(r.id,r.label)}}},{default:k(()=>[st(L(r.count),1)]),_:2},1032,["to"])):(O(),it("div",jh,L(r.count),1))]),E("td",Wh,[r.artefacts>0&&!e.unsupportedSourceWork.includes(r.id)?(O(),W(a,{key:0,class:"link",to:{name:"Search",query:{q:o.buildArtefactsQuery(r.id,r.label)}}},{default:k(()=>[st(L(r.artefacts),1)]),_:2},1032,["to"])):(O(),it("div",Hh,L(r.artefacts),1))])])]),"body.append":k(()=>[E("tr",null,[E("th",Vh,L(i.$t("statistics.all")),1),E("th",$h,L(o.total_count),1),E("th",qh,L(o.total_artefacts),1)])]),_:2},1032,["items","headers","loading","loading-text","no-data-text","items-per-page-options"])):ft("",!0)]),_:1})}const Uh=Bt(Bh,[["render",Yh]]),Xh={name:"RelationPerDocument",components:{BarChart:zo,LoadingSpinner:zn},mixins:[No],inject:["parent_ac"],props:{selectableWorks:{type:Array,required:!0},moduleQueries:{type:Object,required:!0},selectedModul:{type:String,required:!0},supportedRelations:{type:Array,required:!0},unsupportedSourceWork:{type:Array,default:()=>[]}},data(){return{selected_rel_type:"",selected_work:0,selectable_works_list:[],relationship_types:[],selected_chart_type:"Bar",chart_types:["Bar","Table"],data_table_headers:[{text:"Quellenwerk",align:"start",sortable:!1,value:"work_title"},{text:"Anzahl",value:"count"}],footerProps:{"items-per-page-text":this.$t("statistics.rows_per_page"),"items-per-page-all-text":this.$t("statistics.all_rows"),"items-per-page-options":[5,10,20,-1]},cited_works:null,cited_works_raw:[],data_loading:!1,no_data_text:this.$t("statistics.no_data_found"),loading_text:this.$t("statistics.data_loading"),list_not_loaded:!0,found_data:!1}},computed:{selected_work_title(){return this.selectable_works_list.length>1?this.selectable_works_list.find(t=>t.value==this.selected_work).title:""}},watch:{selectableWorks(i){this.list_not_loaded=!0,this.selectable_works_list=[{value:-1,title:"Alle Quellenwerke"},...i],this.selected_work=-1,this.list_not_loaded=!1,this.reset_loaded_data(),this.reset_formular_data(),this.load_relation_types_totals()},selected_rel_type(){this.selected_work>0&&(this.reset_loaded_data(),this.load_from_ts())},selected_work(i,t){this.reset_loaded_data(),this.relationship_types=[],this.selected_rel_type&&(this.selected_rel_type=""),t!=0&&(i==-1?this.load_relation_types_totals():this.load_relation_types_for_selected_work(i))}},methods:{reset_default_table_headers(){this.data_table_headers=[{text:"Quellenwerk",align:"start",sortable:!1,value:"label"},{text:"Anzahl",value:"count"}]},add_module_query(i){this.selectedModul!="all"&&i.push(this.moduleQueries[this.selectedModul])},create_query(i,t,e="1"){if(this.supportedRelations.includes(this.selected_rel_type)&&!this.unsupportedSourceWork.includes(this.selected_work)){let s=[];return e=="1"&&s.push({field:"is_part_of_source_work",iri:[{value:`object/${this.selected_work}`,label:this.selected_work_title}]}),s.push({field:this.selected_rel_type,iri:[{value:i,label:t}]}),this.add_module_query(s),JSON.stringify(s)}return null},init_cited_works(){return{labels:[],datasets:[{label:`Anzahl Zitate in ${this.selected_work_title}`,data:[],backgroundColor:[],queries:[],barThickness:5}]}},init_relation_total(){return{labels:[],datasets:[{label:"Anzahl Beziehung der Quellenwerke untereinander",data:[],backgroundColor:[],queries:[],barThickness:5}]}},reset_loaded_data(){this.cited_works=null,this.cited_works_raw=[]},reset_formular_data(){this.selected_rel_type="",this.selected_work=this.selectable_works_list.length?this.selectable_works_list[0].value:0},load_from_ts(){this.selected_rel_type&&this.selected_work&&(this.reset_default_table_headers(),this.cited_works=this.init_cited_works(),this.data_loading=!0,this.found_data=!1,le.get_cited_works_stats(this.selected_work,this.selected_rel_type,this.parent_ac.signal).then(i=>{i.work_stats&&(this.cited_works_raw=i.work_stats,i.work_stats.forEach((t,e)=>{this.cited_works.labels.push(t.label),this.cited_works.datasets[0].data.push(t.count),this.cited_works.datasets[0].backgroundColor.push(this.get_random_color(e,i.work_stats.length,"r")),this.cited_works.datasets[0].queries.push(this.create_query(t.iri,t.label,t.part_of_source_work))}),this.found_data=!0),this.data_loading=!1}))},load_relation_types_for_selected_work(i){_s.get_relationships_based_on_selected_work(i,this.parent_ac.signal).then(t=>{var e;this.relationship_types=t.map(s=>({value:s,text:this.$t(`label.${s}`)})),this.selected_rel_type=(e=this.relationship_types[0])==null?void 0:e.value})},load_relation_types_totals(){const i=this.selectedModul!="all"?Number(this.selectedModul):0;le.get_total_works_relations(i,this.parent_ac.signal).then(t=>{this.cited_works=this.init_relation_total(),t.rel_stats&&(this.data_loading=!1,this.cited_works_raw=t.rel_stats,this.data_table_headers=[{text:"Beziehungstyp",align:"start",sortable:!1,value:"label"},{text:"Anzahl",value:"count"}],t.rel_stats.forEach((e,s)=>{let n=e.type.split("/").reduce((o,a)=>o?o+" / "+this.$t(`label.${a}`):this.$t(`label.${a}`),"");e.label=n,this.cited_works.labels.push(n),this.cited_works.datasets[0].data.push(e.count),this.cited_works.datasets[0].backgroundColor.push(this.get_random_color(s,t.rel_stats.length,"r")),this.found_data=!0}))})}}},Kh={class:"text-start"},Gh={class:"text-end",style:{"min-width":"160px"}},Qh={key:1};function Zh(i,t,e,s,n,o){const a=Z("BarChart"),r=Z("router-link"),l=Z("loading-spinner");return O(),W(ae,null,{default:k(()=>[S(ht,null,{default:k(()=>[S($,null,{default:k(()=>[E("h4",null,[st(L(i.$t("statistics.headline_relations_to_document")),1),E("span",null," ("+L(i.$t(`statistics.${e.selectedModul}`))+")",1)])]),_:1})]),_:1}),S(ht,{align:"center",justify:"center"},{default:k(()=>[S($,{lg:"5",md:"6",sm:"6",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(Ce,{modelValue:n.selected_work,"onUpdate:modelValue":t[0]||(t[0]=c=>n.selected_work=c),items:n.selectable_works_list,"item-title":"title","item-value":"value",label:i.$t("statistics.work"),disabled:n.list_not_loaded},null,8,["modelValue","items","label","disabled"])]),_:1},8,["class"]),S($,{lg:"3",md:"6",sm:"6",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(Ce,{modelValue:n.selected_rel_type,"onUpdate:modelValue":t[1]||(t[1]=c=>n.selected_rel_type=c),items:n.relationship_types,"item-title":"text","item-value":"value",label:i.$t("label.relation_type"),disabled:n.relationship_types.length==0},null,8,["modelValue","items","label","disabled"])]),_:1},8,["class"]),S($,{lg:"4",md:"6",sm:"6",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(Wo,{modelValue:n.selected_chart_type,"onUpdate:modelValue":t[2]||(t[2]=c=>n.selected_chart_type=c),inline:""},{default:k(()=>[(O(!0),it(It,null,Gi(n.chart_types,c=>(O(),W(jo,{key:c,label:i.$t(`label.${c}`),value:c},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["class"])]),_:1}),S(ht,null,{default:k(()=>[n.data_loading?(O(),W($,{key:1},{default:k(()=>[S(l)]),_:1})):(O(),W($,{key:0},{default:k(()=>[n.found_data&&(n.relationship_types.length||n.selected_work==-1)?(O(),W(ae,{key:0,style:{"max-width":"800px"}},{default:k(()=>[n.selected_chart_type=="Bar"?(O(),it(It,{key:0},[n.cited_works&&!n.data_loading?(O(),W(a,{key:0,"chart-data":n.cited_works},null,8,["chart-data"])):ft("",!0)],64)):ft("",!0),n.selected_chart_type=="Table"?(O(),W(bi,{key:1,items:n.cited_works_raw,headers:n.data_table_headers,loading:n.data_loading,"loading-text":n.loading_text,"no-data-text":n.no_data_text,"footer-props":n.footerProps},{item:k(({item:c})=>[E("tr",null,[E("td",Kh,L(c.label),1),E("td",Gh,[c.count>0&&n.selected_work!=-1?(O(),W(r,{key:0,class:"link",to:{name:"Search",query:{q:o.create_query(c.iri,c.label,c.part_of_source_work)}}},{default:k(()=>[st(L(c.count),1)]),_:2},1032,["to"])):(O(),it("div",Qh,L(c.count),1))])])]),_:1},8,["items","headers","loading","loading-text","no-data-text","footer-props"])):ft("",!0)]),_:1})):(O(),it(It,{key:1},[st(L(n.no_data_text),1)],64))]),_:1}))]),_:1})]),_:1})}const Jh=Bt(Xh,[["render",Zh]]),td={name:"ArtefactDepictions",inject:["parent_ac"],props:{moduleQueries:{type:Object,default:()=>({})},selectedModul:{type:String,default:""}},data(){return{footerProps:{"items-per-page-options":[{value:5,title:"5"},{value:10,title:"10"},{value:20,title:"20"},{value:-1,title:this.$t("statistics.all_rows")}]},selected_chart_type:"Table",stats_raw:[],data_table_headers:[{title:this.$t("statistics.artefact"),key:"label"},{title:"Anzahl Abbildungen",align:"end",key:"artefacts"}],data_loading:!1,no_data_text:this.$t("statistics.no_data_found"),loading_text:this.$t("statistics.data_loading")}},computed:{total_artefacts(){return this.stats_raw.length?this.sum_fields("artefacts"):0}},watch:{selectedModul(){this.load_from_ts()}},created(){this.load_from_ts()},methods:{sum_fields(i){return this.stats_raw.reduce((t,e)=>Number(t)+(Number(e[i])||0),0)},add_module_query(i){this.selectedModul!="all"&&i.push(this.moduleQueries[this.selectedModul])},buildQueryBuilderQuery(i,t){let e=[{field:"depicts",iri:[{value:`object/${i}`,label:t}]}];return this.add_module_query(e),JSON.stringify(e)},load_from_ts(){this.data_loading=!0,this.stats_raw=[];const i=this.selectedModul!="all"?Number(this.selectedModul):0;le.get_artefact_depections(i,this.parent_ac.signal).then(t=>{t&&t.stats&&(this.data_loading=!1,this.stats_raw=t.stats)})}}},ed={class:"text-start"},id={class:"text-end",style:{"min-width":"160px"}},sd={key:1},nd={class:"text-start"},od={class:"text-end"};function ad(i,t,e,s,n,o){const a=Z("router-link");return O(),W(ae,null,{default:k(()=>[E("h4",null,[st(L(i.$t("statistics.headline_artefact_depictions")),1),E("span",null," ("+L(i.$t(`statistics.${e.selectedModul}`))+")",1)]),n.selected_chart_type=="Table"?(O(),W(bi,{key:0,items:n.stats_raw,headers:n.data_table_headers,loading:n.data_loading,"loading-text":n.loading_text,"no-data-text":n.no_data_text,"items-per-page-options":n.footerProps["items-per-page-options"]},{item:k(({item:r})=>[E("tr",null,[E("td",ed,[S(a,{class:"link",to:`/object/${r.id}`},{default:k(()=>[st(L(r.label),1)]),_:2},1032,["to"])]),E("td",id,[r.artefacts>0?(O(),W(a,{key:0,class:"link",to:{name:"Search",query:{q:o.buildQueryBuilderQuery(r.id,r.label)}}},{default:k(()=>[st(L(r.artefacts),1)]),_:2},1032,["to"])):(O(),it("div",sd,L(r.artefacts),1))])])]),"body.append":k(()=>[E("tr",null,[E("th",nd,L(i.$t("statistics.all")),1),E("th",od,L(o.total_artefacts),1)])]),_:2},1032,["items","headers","loading","loading-text","no-data-text","items-per-page-options"])):ft("",!0)]),_:1})}const rd=Bt(td,[["render",ad]]),ld={name:"Statistics",components:{ClassificationsPerDocument:Rh,RelationPerDocument:Jh,CollectionProgress:Fh,MainContainer:oa,PlatesPerDocument:Uh,ArtefactDepictions:rd},provide(){return{parent_ac:Bn(()=>this.ac)}},data(){return{ac:null,open_panel:0,selected_modul:"all",selectable_works:[],supported_relations:["is_copy_after","has_copy"],unsupported_source_work:["1313703","1364897","1314500","23880998","1324472"],module_queries:{1:{field:"part_of_module",iri:[{value:"module/1",label:"Module 1: Ägypten"}]},2:{field:"part_of_module",iri:[{value:"module/2",label:"Module 2: Peripherien"}]}},modules:[{value:"all",text:this.$t("statistics.selection_all")},{value:"1",text:this.$t("statistics.selection_in_mod1")},{value:"2",text:this.$t("statistics.selection_in_mod2")}]}},watch:{selected_modul(i){i!=this.$route.query.stat_mod&&this.$router.push({path:"/statistics",query:{stat_mod:this.selected_modul}}),this.load_works()}},created(){this.ac=new AbortController,this.$route.query.stat_mod&&(this.selected_modul=this.$route.query.stat_mod),this.load_works()},methods:{load_works(){const i=this.selected_modul!="all"?Number(this.selected_modul):0;_s.get_work_titles_n_id(i,Ki).then(t=>{t.works&&(this.selectable_works=t.works.sort((e,s)=>e.title.localeCompare(s.title)))})}}};function cd(i,t,e,s,n,o){const a=Z("CollectionProgress"),r=Z("plates-per-document"),l=Z("artefact-depictions"),c=Z("ClassificationsPerDocument"),h=Z("RelationPerDocument"),d=Z("MainContainer");return O(),W(d,null,{default:k(()=>[E("div",{class:ct(["mt-2",{"mx-6 px-2":!(i.$vuetify.display.sm||i.$vuetify.display.xs)}])},[S(ht,{class:"ma-0 pa-0"},{default:k(()=>[S($,null,{default:k(()=>[E("h3",null,L(i.$t("statistics.main_headline")),1)]),_:1})]),_:1}),S(ht,{class:"ma-0 pa-0"},{default:k(()=>[S($,{lg:"6",sm:"12",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(ht,{class:"mx-1 pa-1"},{default:k(()=>[S(Ce,{modelValue:n.selected_modul,"onUpdate:modelValue":t[0]||(t[0]=u=>n.selected_modul=u),class:"medium-v-select",items:n.modules,"item-title":"text","item-value":"value",density:"compact",style:{"max-width":"250px"}},null,8,["modelValue","items"])]),_:1})]),_:1},8,["class"]),S($,{md:"6",sm:"12",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(a)]),_:1},8,["class"])]),_:1}),S(ze),S(ht,{class:"ma-0 pa-0"},{default:k(()=>[S($,{md:"6",sm:"12",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(r,{"module-queries":n.module_queries,"selected-modul":n.selected_modul,"unsupported-source-work":n.unsupported_source_work},null,8,["module-queries","selected-modul","unsupported-source-work"])]),_:1},8,["class"]),E("div",null,[S(ze,{thickness:1,vertical:"",style:{height:"100%"}})]),S($,{md:"6",sm:"12",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(l,{"module-queries":n.module_queries,"selected-modul":n.selected_modul},null,8,["module-queries","selected-modul"])]),_:1},8,["class"])]),_:1}),S(ze),S(ht,{class:"ma-0 pa-0"},{default:k(()=>[S($,{md:"6",sm:"12",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(c,{"module-queries":n.module_queries,"selected-modul":n.selected_modul,"unsupported-source-work":n.unsupported_source_work},null,8,["module-queries","selected-modul","unsupported-source-work"])]),_:1},8,["class"]),E("div",null,[S(ze,{thickness:1,vertical:"",style:{height:"100%"}})]),S($,{md:"6",sm:"12",class:ct({custom1col:i.$vuetify.display.xs})},{default:k(()=>[S(h,{"module-queries":n.module_queries,"selected-modul":n.selected_modul,"selectable-works":n.selectable_works,"supported-relations":n.supported_relations,"unsupported-source-work":n.unsupported_source_work},null,8,["module-queries","selected-modul","selectable-works","supported-relations","unsupported-source-work"])]),_:1},8,["class"])]),_:1})],2)]),_:1})}const xd=Bt(ld,[["render",cd]]);export{xd as default};