t==="x"?"y":"x";function mP(t,e,n,i){const r=t.skip?e:t,a=e,s=n.skip?e:n,o=Rm(a,r),l=Rm(s,a);let c=o/(o+l),d=l/(o+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;const u=i*c,_=i*d;return{previous:{x:a.x-u*(s.x-r.x),y:a.y-u*(s.y-r.y)},next:{x:a.x+_*(s.x-r.x),y:a.y+_*(s.y-r.y)}}}function fP(t,e,n){const i=t.length;let r,a,s,o,l,c=ua(t,0);for(let d=0;d!c.skip)),e.cubicInterpolationMode==="monotone")hP(t,r);else{let c=i?t[t.length-1]:t[0];for(a=0,s=t.length;at.ownerDocument.defaultView.getComputedStyle(t,null);function bP(t,e){return _c(t).getPropertyValue(e)}const TP=["top","right","bottom","left"];function vr(t,e,n){const i={};n=n?"-"+n:"";for(let r=0;r<4;r++){const a=TP[r];i[a]=parseFloat(t[e+"-"+a+n])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}const vP=(t,e,n)=>(t>0||e>0)&&(!n||!n.shadowRoot);function yP(t,e){const n=t.touches,i=n&&n.length?n[0]:t,{offsetX:r,offsetY:a}=i;let s=!1,o,l;if(vP(r,a,t.target))o=r,l=a;else{const c=e.getBoundingClientRect();o=i.clientX-c.left,l=i.clientY-c.top,s=!0}return{x:o,y:l,box:s}}function ur(t,e){if("native"in t)return t;const{canvas:n,currentDevicePixelRatio:i}=e,r=_c(n),a=r.boxSizing==="border-box",s=vr(r,"padding"),o=vr(r,"border","width"),{x:l,y:c,box:d}=yP(t,n),u=s.left+(d&&o.left),_=s.top+(d&&o.top);let{width:p,height:f}=e;return a&&(p-=s.width+o.width,f-=s.height+o.height),{x:Math.round((l-u)/p*n.width/i),y:Math.round((c-_)/f*n.height/i)}}function CP(t,e,n){let i,r;if(e===void 0||n===void 0){const a=t&&Xf(t);if(!a)e=t.clientWidth,n=t.clientHeight;else{const s=a.getBoundingClientRect(),o=_c(a),l=vr(o,"border","width"),c=vr(o,"padding");e=s.width-c.width-l.width,n=s.height-c.height-l.height,i=Al(o.maxWidth,a,"clientWidth"),r=Al(o.maxHeight,a,"clientHeight")}}return{width:e,height:n,maxWidth:i||Rl,maxHeight:r||Rl}}const vo=t=>Math.round(t*10)/10;function RP(t,e,n,i){const r=_c(t),a=vr(r,"margin"),s=Al(r.maxWidth,t,"clientWidth")||Rl,o=Al(r.maxHeight,t,"clientHeight")||Rl,l=CP(t,e,n);let{width:c,height:d}=l;if(r.boxSizing==="content-box"){const _=vr(r,"border","width"),p=vr(r,"padding");c-=p.width+_.width,d-=p.height+_.height}return c=Math.max(0,c-a.width),d=Math.max(0,i?c/i:d-a.height),c=vo(Math.min(c,s,l.maxWidth)),d=vo(Math.min(d,o,l.maxHeight)),c&&!d&&(d=vo(c/2)),(e!==void 0||n!==void 0)&&i&&l.height&&d>l.height&&(d=l.height,c=vo(Math.floor(d*i))),{width:c,height:d}}function aE(t,e,n){const i=e||1,r=Math.floor(t.height*i),a=Math.floor(t.width*i);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const s=t.canvas;return s.style&&(n||!s.style.height&&!s.style.width)&&(s.style.height=`${t.height}px`,s.style.width=`${t.width}px`),t.currentDevicePixelRatio!==i||s.height!==r||s.width!==a?(t.currentDevicePixelRatio=i,s.height=r,s.width=a,t.ctx.setTransform(i,0,0,i,0,0),!0):!1}const OP=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};Qf()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return t}();function sE(t,e){const n=bP(t,e),i=n&&n.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function _r(t,e,n,i){return{x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}}function NP(t,e,n,i){return{x:t.x+n*(e.x-t.x),y:i==="middle"?n<.5?t.y:e.y:i==="after"?n<1?t.y:e.y:n>0?e.y:t.y}}function AP(t,e,n,i){const r={x:t.cp2x,y:t.cp2y},a={x:e.cp1x,y:e.cp1y},s=_r(t,r,n),o=_r(r,a,n),l=_r(a,e,n),c=_r(s,o,n),d=_r(o,l,n);return _r(c,d,n)}const IP=function(t,e){return{x(n){return t+t+e-n},setWidth(n){e=n},textAlign(n){return n==="center"?n:n==="right"?"left":"right"},xPlus(n,i){return n-i},leftForLtr(n,i){return n-i}}},xP=function(){return{x(t){return t},setWidth(t){},textAlign(t){return t},xPlus(t,e){return t+e},leftForLtr(t,e){return t}}};function na(t,e,n){return t?IP(e,n):xP()}function tO(t,e){let n,i;(e==="ltr"||e==="rtl")&&(n=t.canvas.style,i=[n.getPropertyValue("direction"),n.getPropertyPriority("direction")],n.setProperty("direction",e,"important"),t.prevTextDirection=i)}function nO(t,e){e!==void 0&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function iO(t){return t==="angle"?{between:xs,compare:w0,normalize:sn}:{between:ci,compare:(e,n)=>e-n,normalize:e=>e}}function oE({start:t,end:e,count:n,loop:i,style:r}){return{start:t%n,end:e%n,loop:i&&(e-t+1)%n===0,style:r}}function DP(t,e,n){const{property:i,start:r,end:a}=n,{between:s,normalize:o}=iO(i),l=e.length;let{start:c,end:d,loop:u}=t,_,p;if(u){for(c+=l,d+=l,_=0,p=l;_l(r,T,g)&&o(r,T)!==0,y=()=>o(a,g)===0||l(a,T,g),N=()=>m||b(),O=()=>!m||y();for(let A=d,x=d;A<=u;++A)E=e[A%s],!E.skip&&(g=c(E[i]),g!==T&&(m=l(g,r,a),h===null&&N()&&(h=o(g,r)===0?A:x),h!==null&&O()&&(f.push(oE({start:h,end:A,loop:_,count:s,style:p})),h=null),x=A,T=g));return h!==null&&f.push(oE({start:h,end:u,loop:_,count:s,style:p})),f}function aO(t,e){const n=[],i=t.segments;for(let r=0;rr&&t[a%e].skip;)a--;return a%=e,{start:r,end:a}}function MP(t,e,n,i){const r=t.length,a=[];let s=e,o=t[e],l;for(l=e+1;l<=n;++l){const c=t[l%r];c.skip||c.stop?o.skip||(i=!1,a.push({start:e%r,end:(l-1)%r,loop:i}),e=s=c.stop?l:null):(s=l,o.skip&&(e=l)),o=c}return s!==null&&a.push({start:e%r,end:s%r,loop:i}),a}function LP(t,e){const n=t.points,i=t.options.spanGaps,r=n.length;if(!r)return[];const a=!!t._loop,{start:s,end:o}=wP(n,r,a,i);if(i===!0)return lE(t,[{start:s,end:o,loop:a}],n,e);const l=oo({chart:e,initial:n.initial,numSteps:s,currentStep:Math.min(i-n.start,s)}))}_refresh(){this._request||(this._running=!0,this._request=zR.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((i,r)=>{if(!i.running||!i.items.length)return;const a=i.items;let s=a.length-1,o=!1,l;for(;s>=0;--s)l=a[s],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(e),o=!0):(a[s]=a[a.length-1],a.pop());o&&(r.draw(),this._notify(r,i,e,"progress")),a.length||(i.running=!1,this._notify(r,i,e,"complete"),i.initial=!1),n+=a.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let i=n.get(e);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,i)),i}listen(e,n,i){this._getAnims(e).listeners[n].push(i)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,r)=>Math.max(i,r._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const i=n.items;let r=i.length-1;for(;r>=0;--r)i[r].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var ti=new FP;const dE="transparent",UP={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const i=eE(t||dE),r=i.valid&&eE(e||dE);return r&&r.valid?r.mix(i,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class BP{constructor(e,n,i,r){const a=n[i];r=it([e.to,r,a,e.from]);const s=it([e.from,a,r]);this._active=!0,this._fn=e.fn||UP[e.type||typeof s],this._easing=rs[e.easing]||rs.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=i,this._from=s,this._to=r,this._promises=void 0}active(){return this._active}update(e,n,i){if(this._active){this._notify(!1);const r=this._target[this._prop],a=i-this._start,s=this._duration-a;this._start=i,this._duration=Math.floor(Math.max(s,e.duration)),this._total+=a,this._loop=!!e.loop,this._to=it([e.to,n,r,e.from]),this._from=it([e.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,i=this._duration,r=this._prop,a=this._from,s=this._loop,o=this._to;let l;if(this._active=a!==o&&(s||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[r]=this._fn(a,o,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,i)=>{e.push({res:n,rej:i})})}_notify(e){const n=e?"res":"rej",i=this._promises||[];for(let r=0;r{const a=e[r];if(!Ge(a))return;const s={};for(const o of n)s[o]=a[o];(rt(a.properties)&&a.properties||[r]).forEach(o=>{(o===r||!i.has(o))&&i.set(o,s)})})}_animateOptions(e,n){const i=n.options,r=YP(e,i);if(!r)return[];const a=this._createAnimations(r,i);return i.$shared&&GP(e.options.$animations,i).then(()=>{e.options=i},()=>{}),a}_createAnimations(e,n){const i=this._properties,r=[],a=e.$animations||(e.$animations={}),s=Object.keys(n),o=Date.now();let l;for(l=s.length-1;l>=0;--l){const c=s[l];if(c.charAt(0)==="$")continue;if(c==="options"){r.push(...this._animateOptions(e,n));continue}const d=n[c];let u=a[c];const _=i.get(c);if(u)if(_&&u.active()){u.update(_,d,o);continue}else u.cancel();if(!_||!_.duration){e[c]=d;continue}a[c]=u=new BP(_,e,c,d),r.push(u)}return r}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const i=this._createAnimations(e,n);if(i.length)return ti.add(this._chart,i),!0}}function GP(t,e){const n=[],i=Object.keys(e);for(let r=0;r0||!n&&a<0)return r.index}return null}function mE(t,e){const{chart:n,_cachedMeta:i}=t,r=n._stacks||(n._stacks={}),{iScale:a,vScale:s,index:o}=i,l=a.axis,c=s.axis,d=qP(a,s,i),u=e.length;let _;for(let p=0;pn[i].axis===e).shift()}function KP(t,e){return er(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function QP(t,e,n){return er(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function Oa(t,e){const n=t.controller.index,i=t.vScale&&t.vScale.axis;if(i){e=e||t._parsed;for(const r of e){const a=r._stacks;if(!a||a[i]===void 0||a[i][n]===void 0)return;delete a[i][n],a[i]._visualValues!==void 0&&a[i]._visualValues[n]!==void 0&&delete a[i]._visualValues[n]}}}const qc=t=>t==="reset"||t==="none",fE=(t,e)=>e?t:Object.assign({},t),XP=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:oO(n,!0),values:null};class Nn{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,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 e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=Hc(e.vScale,e),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(e){this.index!==e&&Oa(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,i=this.getDataset(),r=(u,_,p,f)=>u==="x"?_:u==="r"?f:p,a=n.xAxisID=Me(i.xAxisID,Vc(e,"x")),s=n.yAxisID=Me(i.yAxisID,Vc(e,"y")),o=n.rAxisID=Me(i.rAxisID,Vc(e,"r")),l=n.indexAxis,c=n.iAxisID=r(l,a,s,o),d=n.vAxisID=r(l,s,a,o);n.xScale=this.getScaleForId(a),n.yScale=this.getScaleForId(s),n.rScale=this.getScaleForId(o),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&Ol(this._data,this),e._stacked&&Oa(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),i=this._data;if(Ge(n)){const r=this._cachedMeta;this._data=VP(n,r)}else if(i!==n){if(i){Ol(i,this);const r=this._cachedMeta;Oa(r),r._parsed=[]}n&&Object.isExtensible(n)&&GR(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,i=this.getDataset();let r=!1;this._dataCheck();const a=n._stacked;n._stacked=Hc(n.vScale,n),n.stack!==i.stack&&(r=!0,Oa(n),n.stack=i.stack),this._resyncElements(e),(r||a!==n._stacked)&&(mE(this,n._parsed),n._stacked=Hc(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),i=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:i,_data:r}=this,{iScale:a,_stacked:s}=i,o=a.axis;let l=e===0&&n===r.length?!0:i._sorted,c=e>0&&i._parsed[e-1],d,u,_;if(this._parsing===!1)i._parsed=r,i._sorted=!0,_=r;else{rt(r[e])?_=this.parseArrayData(i,r,e,n):Ge(r[e])?_=this.parseObjectData(i,r,e,n):_=this.parsePrimitiveData(i,r,e,n);const p=()=>u[o]===null||c&&u[o]m||u=0;--_)if(!f()){this.updateRangeFromParsed(c,e,p,l);break}}return c}getAllParsedValues(e){const n=this._cachedMeta._parsed,i=[];let r,a,s;for(r=0,a=n.length;r=0&ðis.getContext(i,r,n),m=c.resolveNamedOptions(_,p,f,u);return m.$shared&&(m.$shared=l,a[s]=Object.freeze(fE(m,l))),m}_resolveAnimations(e,n,i){const r=this.chart,a=this._cachedDataOpts,s=`animation-${n}`,o=a[s];if(o)return o;let l;if(r.options.animation!==!1){const d=this.chart.config,u=d.datasetAnimationScopeKeys(this._type,n),_=d.getOptionScopes(this.getDataset(),u);l=d.createResolver(_,this.getContext(e,i,n))}const c=new sO(r,l&&l.animations);return l&&l._cacheable&&(a[s]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||qc(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const i=this.resolveDataElementOptions(e,n),r=this._sharedOptions,a=this.getSharedOptions(i),s=this.includeOptions(n,a)||a!==r;return this.updateSharedOptions(a,n,i),{sharedOptions:a,includeOptions:s}}updateElement(e,n,i,r){qc(r)?Object.assign(e,i):this._resolveAnimations(n,r).update(e,i)}updateSharedOptions(e,n,i){e&&!qc(n)&&this._resolveAnimations(void 0,n).update(e,i)}_setStyle(e,n,i,r){e.active=r;const a=this.getStyle(n,r);this._resolveAnimations(n,i,r).update(e,{options:!r&&this.getSharedOptions(a)||a})}removeHoverStyle(e,n,i){this._setStyle(e,i,"active",!1)}setHoverStyle(e,n,i){this._setStyle(e,i,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,i=this._cachedMeta.data;for(const[o,l,c]of this._syncList)this[o](l,c);this._syncList=[];const r=i.length,a=n.length,s=Math.min(a,r);s&&this.parse(0,s),a>r?this._insertElements(r,a-r,e):a{for(c.length+=n,o=c.length-1;o>=s;o--)c[o]=c[o-n]};for(l(a),o=e;or-a))}return t._cache.$bar}function jP(t){const e=t.iScale,n=ZP(e,t.type);let i=e._length,r,a,s,o;const l=()=>{s===32767||s===-32768||(Is(o)&&(i=Math.min(i,Math.abs(s-o)||i)),o=s)};for(r=0,a=n.length;r0?r[t-1]:null,o=tMath.abs(o)&&(l=o,c=s),e[n.axis]=c,e._custom={barStart:l,barEnd:c,start:r,end:a,min:s,max:o}}function lO(t,e,n,i){return rt(t)?tk(t,e,n,i):e[n.axis]=n.parse(t,i),e}function gE(t,e,n,i){const r=t.iScale,a=t.vScale,s=r.getLabels(),o=r===a,l=[];let c,d,u,_;for(c=n,d=n+i;c=n?1:-1)}function ik(t){let e,n,i,r,a;return t.horizontal?(e=t.base>t.x,n="left",i="right"):(e=t.based.controller.options.grouped),a=i.options.stacked,s=[],o=this._cachedMeta.controller.getParsed(n),l=o&&o[i.axis],c=d=>{const u=d._parsed.find(p=>p[i.axis]===l),_=u&&u[d.vScale.axis];if(Be(_)||isNaN(_))return!0};for(const d of r)if(!(n!==void 0&&c(d))&&((a===!1||s.indexOf(d.stack)===-1||a===void 0&&d.stack===void 0)&&s.push(d.stack),d.index===e))break;return s.length||s.push(void 0),s}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,n,i){const r=this._getStacks(e,i),a=n!==void 0?r.indexOf(n):-1;return a===-1?r.length-1:a}_getRuler(){const e=this.options,n=this._cachedMeta,i=n.iScale,r=[];let a,s;for(a=0,s=n.data.length;a=0;--i)n=Math.max(n,e[i].size(this.resolveDataElementOptions(i))/2);return n>0&&n}getLabelAndValue(e){const n=this._cachedMeta,i=this.chart.data.labels||[],{xScale:r,yScale:a}=n,s=this.getParsed(e),o=r.getLabelForValue(s.x),l=a.getLabelForValue(s.y),c=s._custom;return{label:i[e]||"",value:"("+o+", "+l+(c?", "+c:"")+")"}}update(e){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,e)}updateElements(e,n,i,r){const a=r==="reset",{iScale:s,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(n,r),d=s.axis,u=o.axis;for(let _=n;_xs(T,o,l,!0)?1:Math.max(b,b*n,y,y*n),f=(T,b,y)=>xs(T,o,l,!0)?-1:Math.min(b,b*n,y,y*n),m=p(0,c,u),h=p(Et,d,_),g=f(ot,c,u),E=f(ot+Et,d,_);i=(m-g)/2,r=(h-E)/2,a=-(m+g)/2,s=-(h+E)/2}return{ratioX:i,ratioY:r,offsetX:a,offsetY:s}}class gr extends Nn{constructor(e,n){super(e,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,n){const i=this.getDataset().data,r=this._cachedMeta;if(this._parsing===!1)r._parsed=i;else{let a=l=>+i[l];if(Ge(i[e])){const{key:l="value"}=this._parsing;a=c=>+Ki(i[c],l)}let s,o;for(s=e,o=e+n;s0&&!isNaN(e)?st*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,i=this.chart,r=i.data.labels||[],a=eo(n._parsed[e],i.options.locale);return{label:r[e]||"",value:a}}getMaxBorderWidth(e){let n=0;const i=this.chart;let r,a,s,o,l;if(!e){for(r=0,a=i.data.datasets.length;re!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),ue(gr,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:i,color:r}}=e.legend.options;return n.labels.map((a,s)=>{const l=e.getDatasetMeta(0).controller.getStyle(s);return{text:a,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:r,lineWidth:l.borderWidth,pointStyle:i,hidden:!e.getDataVisibility(s),index:s}})}return[]}},onClick(e,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}}});class Xo extends Nn{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const n=this._cachedMeta,{dataset:i,data:r=[],_dataset:a}=n,s=this.chart._animationsDisabled;let{start:o,count:l}=VR(n,r,s);this._drawStart=o,this._drawCount=l,qR(n)&&(o=0,l=r.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!a._decimated,i.points=r;const c=this.resolveDatasetElementOptions(e);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:c},e),this.updateElements(r,o,l,e)}updateElements(e,n,i,r){const a=r==="reset",{iScale:s,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:d,includeOptions:u}=this._getSharedOptions(n,r),_=s.axis,p=o.axis,{spanGaps:f,segment:m}=this.options,h=ca(f)?f:Number.POSITIVE_INFINITY,g=this.chart._animationsDisabled||a||r==="none",E=n+i,T=e.length;let b=n>0&&this.getParsed(n-1);for(let y=0;y=E){O.skip=!0;continue}const A=this.getParsed(y),x=Be(A[p]),F=O[_]=s.getPixelForValue(A[_],y),Y=O[p]=a||x?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,A,l):A[p],y);O.skip=isNaN(F)||isNaN(Y)||x,O.stop=y>0&&Math.abs(A[_]-b[_])>h,m&&(O.parsed=A,O.raw=c.data[y]),u&&(O.options=d||this.resolveDataElementOptions(y,N.active?"active":r)),g||this.updateElement(N,y,O,r),b=A}}getMaxOverflow(){const e=this._cachedMeta,n=e.dataset,i=n.options&&n.options.borderWidth||0,r=e.data||[];if(!r.length)return i;const a=r[0].size(this.resolveDataElementOptions(0)),s=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(i,a,s)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}ue(Xo,"id","line"),ue(Xo,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),ue(Xo,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class os extends Nn{constructor(e,n){super(e,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){const n=this._cachedMeta,i=this.chart,r=i.data.labels||[],a=eo(n._parsed[e].r,i.options.locale);return{label:r[e]||"",value:a}}parseObjectData(e,n,i,r){return JR.bind(this)(e,n,i,r)}update(e){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,e)}getMinMax(){const e=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((i,r)=>{const a=this.getParsed(r).r;!isNaN(a)&&this.chart.getDataVisibility(r)&&(an.max&&(n.max=a))}),n}_updateRadius(){const e=this.chart,n=e.chartArea,i=e.options,r=Math.min(n.right-n.left,n.bottom-n.top),a=Math.max(r/2,0),s=Math.max(i.cutoutPercentage?a/100*i.cutoutPercentage:1,0),o=(a-s)/e.getVisibleDatasetCount();this.outerRadius=a-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(e,n,i,r){const a=r==="reset",s=this.chart,l=s.options.animation,c=this._cachedMeta.rScale,d=c.xCenter,u=c.yCenter,_=c.getIndexAngle(0)-.5*ot;let p=_,f;const m=360/this.countVisibleElements();for(f=0;f{!isNaN(this.getParsed(r).r)&&this.chart.getDataVisibility(r)&&n++}),n}_computeAngle(e,n,i){return this.chart.getDataVisibility(e)?yn(this.resolveDataElementOptions(e,n).angle||i):0}}ue(os,"id","polarArea"),ue(os,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),ue(os,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:i,color:r}}=e.legend.options;return n.labels.map((a,s)=>{const l=e.getDatasetMeta(0).controller.getStyle(s);return{text:a,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:r,lineWidth:l.borderWidth,pointStyle:i,hidden:!e.getDataVisibility(s),index:s}})}return[]}},onClick(e,n,i){i.chart.toggleDataVisibility(n.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class Am extends gr{}ue(Am,"id","pie"),ue(Am,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class ls extends Nn{getLabelAndValue(e){const n=this._cachedMeta.vScale,i=this.getParsed(e);return{label:n.getLabels()[e],value:""+n.getLabelForValue(i[n.axis])}}parseObjectData(e,n,i,r){return JR.bind(this)(e,n,i,r)}update(e){const n=this._cachedMeta,i=n.dataset,r=n.data||[],a=n.iScale.getLabels();if(i.points=r,e!=="resize"){const s=this.resolveDatasetElementOptions(e);this.options.showLine||(s.borderWidth=0);const o={_loop:!0,_fullLoop:a.length===r.length,options:s};this.updateElement(i,void 0,o,e)}this.updateElements(r,0,r.length,e)}updateElements(e,n,i,r){const a=this._cachedMeta.rScale,s=r==="reset";for(let o=n;o0&&this.getParsed(n-1);for(let b=n;b0&&Math.abs(N[p]-T[p])>g,h&&(O.parsed=N,O.raw=c.data[b]),_&&(O.options=u||this.resolveDataElementOptions(b,y.active?"active":r)),E||this.updateElement(y,b,O,r),T=N}this.updateSharedOptions(u,r,d)}getMaxOverflow(){const e=this._cachedMeta,n=e.data||[];if(!this.options.showLine){let o=0;for(let l=n.length-1;l>=0;--l)o=Math.max(o,n[l].size(this.resolveDataElementOptions(l))/2);return o>0&&o}const i=e.dataset,r=i.options&&i.options.borderWidth||0;if(!n.length)return r;const a=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(r,a,s)/2}}ue(vn,"id","scatter"),ue(vn,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),ue(vn,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var lk=Object.freeze({__proto__:null,BarController:ss,BubbleController:Qo,DoughnutController:gr,LineController:Xo,PieController:Am,PolarAreaController:os,RadarController:ls,ScatterController:vn});function sr(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Zf{constructor(e){ue(this,"options");this.options=e||{}}static override(e){Object.assign(Zf.prototype,e)}init(){}formats(){return sr()}parse(){return sr()}format(){return sr()}add(){return sr()}diff(){return sr()}startOf(){return sr()}endOf(){return sr()}}var ck={_date:Zf};function dk(t,e,n,i){const{controller:r,data:a,_sorted:s}=t,o=r._cachedMeta.iScale;if(o&&e===o.axis&&e!=="r"&&s&&a.length){const l=o._reversePixels?L0:di;if(i){if(r._sharedOptions){const c=a[0],d=typeof c.getRange=="function"&&c.getRange(e);if(d){const u=l(a,e,n-d),_=l(a,e,n+d);return{lo:u.lo,hi:_.hi}}}}else return l(a,e,n)}return{lo:0,hi:a.length-1}}function io(t,e,n,i,r){const a=t.getSortedVisibleDatasetMetas(),s=n[e];for(let o=0,l=a.length;o{l[s]&&l[s](e[n],r)&&(a.push({element:l,datasetIndex:c,index:d}),o=o||l.inRange(e.x,e.y,r))}),i&&!o?[]:a}var mk={evaluateInteractionItems:io,modes:{index(t,e,n,i){const r=ur(e,t),a=n.axis||"x",s=n.includeInvisible||!1,o=n.intersect?Wc(t,r,a,i,s):Kc(t,r,a,!1,i,s),l=[];return o.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const d=o[0].index,u=c.data[d];u&&!u.skip&&l.push({element:u,datasetIndex:c.index,index:d})}),l):[]},dataset(t,e,n,i){const r=ur(e,t),a=n.axis||"xy",s=n.includeInvisible||!1;let o=n.intersect?Wc(t,r,a,i,s):Kc(t,r,a,!1,i,s);if(o.length>0){const l=o[0].datasetIndex,c=t.getDatasetMeta(l).data;o=[];for(let d=0;dn.pos===e)}function bE(t,e){return t.filter(n=>cO.indexOf(n.pos)===-1&&n.box.axis===e)}function Aa(t,e){return t.sort((n,i)=>{const r=e?i:n,a=e?n:i;return r.weight===a.weight?r.index-a.index:r.weight-a.weight})}function fk(t){const e=[];let n,i,r,a,s,o;for(n=0,i=(t||[]).length;nc.box.fullSize),!0),i=Aa(Na(e,"left"),!0),r=Aa(Na(e,"right")),a=Aa(Na(e,"top"),!0),s=Aa(Na(e,"bottom")),o=bE(e,"x"),l=bE(e,"y");return{fullSize:n,leftAndTop:i.concat(a),rightAndBottom:r.concat(l).concat(s).concat(o),chartArea:Na(e,"chartArea"),vertical:i.concat(r).concat(l),horizontal:a.concat(s).concat(o)}}function TE(t,e,n,i){return Math.max(t[n],e[n])+Math.max(t[i],e[i])}function dO(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Sk(t,e,n,i){const{pos:r,box:a}=n,s=t.maxPadding;if(!Ge(r)){n.size&&(t[r]-=n.size);const u=i[n.stack]||{size:0,count:1};u.size=Math.max(u.size,n.horizontal?a.height:a.width),n.size=u.size/u.count,t[r]+=n.size}a.getPadding&&dO(s,a.getPadding());const o=Math.max(0,e.outerWidth-TE(s,t,"left","right")),l=Math.max(0,e.outerHeight-TE(s,t,"top","bottom")),c=o!==t.w,d=l!==t.h;return t.w=o,t.h=l,n.horizontal?{same:c,other:d}:{same:d,other:c}}function bk(t){const e=t.maxPadding;function n(i){const r=Math.max(e[i]-t[i],0);return t[i]+=r,r}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function Tk(t,e){const n=e.maxPadding;function i(r){const a={left:0,top:0,right:0,bottom:0};return r.forEach(s=>{a[s]=Math.max(e[s],n[s])}),a}return i(t?["left","right"]:["top","bottom"])}function Fa(t,e,n,i){const r=[];let a,s,o,l,c,d;for(a=0,s=t.length,c=0;a{typeof m.beforeLayout=="function"&&m.beforeLayout()});const d=l.reduce((m,h)=>h.box.options&&h.box.options.display===!1?m:m+1,0)||1,u=Object.freeze({outerWidth:e,outerHeight:n,padding:r,availableWidth:a,availableHeight:s,vBoxMaxWidth:a/2/d,hBoxMaxHeight:s/2}),_=Object.assign({},r);dO(_,wt(i));const p=Object.assign({maxPadding:_,w:a,h:s,x:r.left,y:r.top},r),f=hk(l.concat(c),u);Fa(o.fullSize,p,u,f),Fa(l,p,u,f),Fa(c,p,u,f)&&Fa(l,p,u,f),bk(p),vE(o.leftAndTop,p,u,f),p.x+=p.w,p.y+=p.h,vE(o.rightAndBottom,p,u,f),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Ke(o.chartArea,m=>{const h=m.box;Object.assign(h,t.chartArea),h.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class uO{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,i){}removeEventListener(e,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,i,r){return n=Math.max(0,n||e.width),i=i||e.height,{width:n,height:Math.max(0,r?Math.floor(n/r):i)}}isAttached(e){return!0}updateConfig(e){}}class vk extends uO{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const Zo="$chartjs",yk={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},yE=t=>t===null||t==="";function Ck(t,e){const n=t.style,i=t.getAttribute("height"),r=t.getAttribute("width");if(t[Zo]={initial:{height:i,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",yE(r)){const a=sE(t,"width");a!==void 0&&(t.width=a)}if(yE(i))if(t.style.height==="")t.height=t.width/(e||2);else{const a=sE(t,"height");a!==void 0&&(t.height=a)}return t}const _O=OP?{passive:!0}:!1;function Rk(t,e,n){t&&t.addEventListener(e,n,_O)}function Ok(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,_O)}function Nk(t,e){const n=yk[t.type]||t.type,{x:i,y:r}=ur(t,e);return{type:n,chart:e,native:t,x:i!==void 0?i:null,y:r!==void 0?r:null}}function Il(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function Ak(t,e,n){const i=t.canvas,r=new MutationObserver(a=>{let s=!1;for(const o of a)s=s||Il(o.addedNodes,i),s=s&&!Il(o.removedNodes,i);s&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function Ik(t,e,n){const i=t.canvas,r=new MutationObserver(a=>{let s=!1;for(const o of a)s=s||Il(o.removedNodes,i),s=s&&!Il(o.addedNodes,i);s&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const ws=new Map;let CE=0;function pO(){const t=window.devicePixelRatio;t!==CE&&(CE=t,ws.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function xk(t,e){ws.size||window.addEventListener("resize",pO),ws.set(t,e)}function Dk(t){ws.delete(t),ws.size||window.removeEventListener("resize",pO)}function wk(t,e,n){const i=t.canvas,r=i&&Xf(i);if(!r)return;const a=HR((o,l)=>{const c=r.clientWidth;n(o,l),c{const l=o[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||a(c,d)});return s.observe(r),xk(t,a),s}function Qc(t,e,n){n&&n.disconnect(),e==="resize"&&Dk(t)}function Mk(t,e,n){const i=t.canvas,r=HR(a=>{t.ctx!==null&&n(Nk(a,t))},t);return Rk(i,e,r),r}class Lk extends uO{acquireContext(e,n){const i=e&&e.getContext&&e.getContext("2d");return i&&i.canvas===e?(Ck(e,n),i):null}releaseContext(e){const n=e.canvas;if(!n[Zo])return!1;const i=n[Zo].initial;["height","width"].forEach(a=>{const s=i[a];Be(s)?n.removeAttribute(a):n.setAttribute(a,s)});const r=i.style||{};return Object.keys(r).forEach(a=>{n.style[a]=r[a]}),n.width=n.width,delete n[Zo],!0}addEventListener(e,n,i){this.removeEventListener(e,n);const r=e.$proxies||(e.$proxies={}),s={attach:Ak,detach:Ik,resize:wk}[n]||Mk;r[n]=s(e,n,i)}removeEventListener(e,n){const i=e.$proxies||(e.$proxies={}),r=i[n];if(!r)return;({attach:Qc,detach:Qc,resize:Qc}[n]||Ok)(e,n,r),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,i,r){return RP(e,n,i,r)}isAttached(e){const n=e&&Xf(e);return!!(n&&n.isConnected)}}function Pk(t){return!Qf()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?vk:Lk}var Yo;let Ti=(Yo=class{constructor(){ue(this,"x");ue(this,"y");ue(this,"active",!1);ue(this,"options");ue(this,"$animations")}tooltipPosition(e){const{x:n,y:i}=this.getProps(["x","y"],e);return{x:n,y:i}}hasValue(){return ca(this.x)&&ca(this.y)}getProps(e,n){const i=this.$animations;if(!n||!i)return this;const r={};return e.forEach(a=>{r[a]=i[a]&&i[a].active()?i[a]._to:this[a]}),r}},ue(Yo,"defaults",{}),ue(Yo,"defaultRoutes"),Yo);function kk(t,e){const n=t.options.ticks,i=Fk(t),r=Math.min(n.maxTicksLimit||i,i),a=n.major.enabled?Bk(e):[],s=a.length,o=a[0],l=a[s-1],c=[];if(s>r)return Gk(e,c,a,s/r),c;const d=Uk(a,e,r);if(s>0){let u,_;const p=s>1?Math.round((l-o)/(s-1)):null;for(Co(e,c,d,Be(p)?0:o-p,o),u=0,_=s-1;u<_;u++)Co(e,c,d,a[u],a[u+1]);return Co(e,c,d,l,Be(p)?e.length:l+p),c}return Co(e,c,d),c}function Fk(t){const e=t.options.offset,n=t._tickSize(),i=t._length/n+(e?0:1),r=t._maxLength/n;return Math.floor(Math.min(i,r))}function Uk(t,e,n){const i=Yk(t),r=e.length/n;if(!i)return Math.max(r,1);const a=x0(i);for(let s=0,o=a.length-1;sr)return l}return Math.max(r,1)}function Bk(t){const e=[];let n,i;for(n=0,i=t.length;nt==="left"?"right":t==="right"?"left":t,RE=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,OE=(t,e)=>Math.min(e||t,t);function NE(t,e){const n=[],i=t.length/e,r=t.length;let a=0;for(;as+o)))return l}function Vk(t,e){Ke(t,n=>{const i=n.gc,r=i.length/2;let a;if(r>e){for(a=0;ai?i:n,i=r&&n>i?n:i,{min:an(n,an(i,n)),max:an(i,an(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Xe(this.options.beforeUpdate,[this])}update(e,n,i){const{beginAtZero:r,grace:a,ticks:s}=this.options,o=s.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=iP(this,a,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=o=a||i<=1||!this.isHorizontal()){this.labelRotation=r;return}const d=this._getLabelSizes(),u=d.widest.width,_=d.highest.height,p=Ot(this.chart.width-u,0,this.maxWidth);o=e.offset?this.maxWidth/i:p/(i-1),u+6>o&&(o=p/(i-(e.offset?.5:1)),l=this.maxHeight-Ia(e.grid)-n.padding-AE(e.title,this.chart.options.font),c=Math.sqrt(u*u+_*_),s=Yf(Math.min(Math.asin(Ot((d.highest.height+6)/o,-1,1)),Math.asin(Ot(l/c,-1,1))-Math.asin(Ot(_/c,-1,1)))),s=Math.max(r,Math.min(a,s))),this.labelRotation=s}afterCalculateLabelRotation(){Xe(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Xe(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:i,title:r,grid:a}}=this,s=this._isVisible(),o=this.isHorizontal();if(s){const l=AE(r,n.options.font);if(o?(e.width=this.maxWidth,e.height=Ia(a)+l):(e.height=this.maxHeight,e.width=Ia(a)+l),i.display&&this.ticks.length){const{first:c,last:d,widest:u,highest:_}=this._getLabelSizes(),p=i.padding*2,f=yn(this.labelRotation),m=Math.cos(f),h=Math.sin(f);if(o){const g=i.mirror?0:h*u.width+m*_.height;e.height=Math.min(this.maxHeight,e.height+g+p)}else{const g=i.mirror?0:m*u.width+h*_.height;e.width=Math.min(this.maxWidth,e.width+g+p)}this._calculatePadding(c,d,h,m)}}this._handleMargins(),o?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,i,r){const{ticks:{align:a,padding:s},position:o}=this.options,l=this.labelRotation!==0,c=o!=="top"&&this.axis==="x";if(this.isHorizontal()){const d=this.getPixelForTick(0)-this.left,u=this.right-this.getPixelForTick(this.ticks.length-1);let _=0,p=0;l?c?(_=r*e.width,p=i*n.height):(_=i*e.height,p=r*n.width):a==="start"?p=n.width:a==="end"?_=e.width:a!=="inner"&&(_=e.width/2,p=n.width/2),this.paddingLeft=Math.max((_-d+s)*this.width/(this.width-d),0),this.paddingRight=Math.max((p-u+s)*this.width/(this.width-u),0)}else{let d=n.height/2,u=e.height/2;a==="start"?(d=0,u=e.height):a==="end"&&(d=n.height,u=0),this.paddingTop=d+s,this.paddingBottom=u+s}}_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(){Xe(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,i;for(n=0,i=e.length;n({width:s[x]||0,height:o[x]||0});return{first:A(0),last:A(n-1),widest:A(N),highest:A(O),widths:s,heights:o}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return M0(this._alignToPixels?ar(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&eo*r?o/i:l/r:l*r0}_computeGridLineItems(e){const n=this.axis,i=this.chart,r=this.options,{grid:a,position:s,border:o}=r,l=a.offset,c=this.isHorizontal(),u=this.ticks.length+(l?1:0),_=Ia(a),p=[],f=o.setContext(this.getContext()),m=f.display?f.width:0,h=m/2,g=function(K){return ar(i,K,m)};let E,T,b,y,N,O,A,x,F,Y,I,B;if(s==="top")E=g(this.bottom),O=this.bottom-_,x=E-h,Y=g(e.top)+h,B=e.bottom;else if(s==="bottom")E=g(this.top),Y=e.top,B=g(e.bottom)-h,O=E+h,x=this.top+_;else if(s==="left")E=g(this.right),N=this.right-_,A=E-h,F=g(e.left)+h,I=e.right;else if(s==="right")E=g(this.left),F=e.left,I=g(e.right)-h,N=E+h,A=this.left+_;else if(n==="x"){if(s==="center")E=g((e.top+e.bottom)/2+.5);else if(Ge(s)){const K=Object.keys(s)[0],w=s[K];E=g(this.chart.scales[K].getPixelForValue(w))}Y=e.top,B=e.bottom,O=E+h,x=O+_}else if(n==="y"){if(s==="center")E=g((e.left+e.right)/2);else if(Ge(s)){const K=Object.keys(s)[0],w=s[K];E=g(this.chart.scales[K].getPixelForValue(w))}N=E-h,A=N-_,F=e.left,I=e.right}const v=Me(r.ticks.maxTicksLimit,u),U=Math.max(1,Math.ceil(u/v));for(T=0;T0&&(ye-=pe/2);break}V={left:ye,top:oe,width:pe+H.width,height:ge+H.height,color:U.backdropColor}}h.push({label:b,font:x,textOffset:I,options:{rotation:m,color:w,strokeColor:$,strokeWidth:W,textAlign:ce,textBaseline:B,translation:[y,N],backdrop:V}})}return h}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-yn(this.labelRotation))return e==="top"?"left":"right";let r="center";return n.align==="start"?r="left":n.align==="end"?r="right":n.align==="inner"&&(r="inner"),r}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:i,mirror:r,padding:a}}=this.options,s=this._getLabelSizes(),o=e+a,l=s.widest.width;let c,d;return n==="left"?r?(d=this.right+a,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-o,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d=this.left)):n==="right"?r?(d=this.left+a,i==="near"?c="right":i==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+o,i==="near"?c="left":i==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:i,top:r,width:a,height:s}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(i,r,a,s),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const r=this.ticks.findIndex(a=>a.value===e);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(e){const n=this.options.grid,i=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let a,s;const o=(l,c,d)=>{!d.width||!d.color||(i.save(),i.lineWidth=d.width,i.strokeStyle=d.color,i.setLineDash(d.borderDash||[]),i.lineDashOffset=d.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(a=0,s=r.length;a{this.draw(a)}}]:[{z:i,draw:a=>{this.drawBackground(),this.drawGrid(a),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:a=>{this.drawLabels(a)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",r=[];let a,s;for(a=0,s=n.length;a{const i=n.split("."),r=i.pop(),a=[t].concat(i).join("."),s=e[n].split("."),o=s.pop(),l=s.join(".");tt.route(a,r,l,o)})}function Zk(t){return"id"in t&&"defaults"in t}class jk{constructor(){this.controllers=new Ro(Nn,"datasets",!0),this.elements=new Ro(Ti,"elements"),this.plugins=new Ro(Object,"plugins"),this.scales=new Ro(Mr,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,i){[...n].forEach(r=>{const a=i||this._getRegistryForType(r);i||a.isForType(r)||a===this.plugins&&r.id?this._exec(e,a,r):Ke(r,s=>{const o=i||this._getRegistryForType(s);this._exec(e,o,s)})})}_exec(e,n,i){const r=Gf(e);Xe(i["before"+r],[],i),n[e](i),Xe(i["after"+r],[],i)}_getRegistryForType(e){for(let n=0;na.filter(o=>!s.some(l=>o.plugin.id===l.plugin.id));this._notify(r(n,i),e,"stop"),this._notify(r(i,n),e,"start")}}function e1(t){const e={},n=[],i=Object.keys(kt.plugins.items);for(let a=0;a1&&IE(t[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function xE(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function o1(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(i=>i.xAxisID===t||i.yAxisID===t);if(n.length)return xE(t,"x",n[0])||xE(t,"y",n[0])}return{}}function l1(t,e){const n=Nr[t.type]||{scales:{}},i=e.scales||{},r=Im(t.type,e),a=Object.create(null);return Object.keys(i).forEach(s=>{const o=i[s];if(!Ge(o))return console.error(`Invalid scale configuration for scale: ${s}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${s}`);const l=xm(s,o,o1(s,t),tt.scales[o.type]),c=a1(l,r),d=n.scales||{};a[s]=ns(Object.create(null),[{axis:l},o,d[l],d[c]])}),t.data.datasets.forEach(s=>{const o=s.type||t.type,l=s.indexAxis||Im(o,e),d=(Nr[o]||{}).scales||{};Object.keys(d).forEach(u=>{const _=r1(u,l),p=s[_+"AxisID"]||_;a[p]=a[p]||Object.create(null),ns(a[p],[{axis:_},i[p],d[u]])})}),Object.keys(a).forEach(s=>{const o=a[s];ns(o,[tt.scales[o.type],tt.scale])}),a}function mO(t){const e=t.options||(t.options={});e.plugins=Me(e.plugins,{}),e.scales=l1(t,e)}function fO(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function c1(t){return t=t||{},t.data=fO(t.data),mO(t),t}const DE=new Map,gO=new Set;function Oo(t,e){let n=DE.get(t);return n||(n=e(),DE.set(t,n),gO.add(n)),n}const xa=(t,e,n)=>{const i=Ki(e,n);i!==void 0&&t.add(i)};class d1{constructor(e){this._config=c1(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=fO(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),mO(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Oo(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return Oo(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return Oo(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,i=this.type;return Oo(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const i=this._scopeCache;let r=i.get(e);return(!r||n)&&(r=new Map,i.set(e,r)),r}getOptionScopes(e,n,i){const{options:r,type:a}=this,s=this._cachedScopes(e,i),o=s.get(n);if(o)return o;const l=new Set;n.forEach(d=>{e&&(l.add(e),d.forEach(u=>xa(l,e,u))),d.forEach(u=>xa(l,r,u)),d.forEach(u=>xa(l,Nr[a]||{},u)),d.forEach(u=>xa(l,tt,u)),d.forEach(u=>xa(l,Om,u))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),gO.has(n)&&s.set(n,c),c}chartOptionScopes(){const{options:e,type:n}=this;return[e,Nr[n]||{},tt.datasets[n]||{},{type:n},tt,Om]}resolveNamedOptions(e,n,i,r=[""]){const a={$shared:!0},{resolver:s,subPrefixes:o}=wE(this._resolverCache,e,r);let l=s;if(_1(s,n)){a.$shared=!1,i=Qi(i)?i():i;const c=this.createResolver(e,i,o);l=da(s,i,c)}for(const c of n)a[c]=l[c];return a}createResolver(e,n,i=[""],r){const{resolver:a}=wE(this._resolverCache,e,i);return Ge(n)?da(a,n,void 0,r):a}}function wE(t,e,n){let i=t.get(e);i||(i=new Map,t.set(e,i));const r=n.join();let a=i.get(r);return a||(a={resolver:$f(e,n),subPrefixes:n.filter(o=>!o.toLowerCase().includes("hover"))},i.set(r,a)),a}const u1=t=>Ge(t)&&Object.getOwnPropertyNames(t).some(e=>Qi(t[e]));function _1(t,e){const{isScriptable:n,isIndexable:i}=QR(t);for(const r of e){const a=n(r),s=i(r),o=(s||a)&&t[r];if(a&&(Qi(o)||u1(o))||s&&rt(o))return!0}return!1}var p1="4.4.6";const m1=["top","bottom","left","right","chartArea"];function ME(t,e){return t==="top"||t==="bottom"||m1.indexOf(t)===-1&&e==="x"}function LE(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}function PE(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),Xe(n&&n.onComplete,[t],e)}function f1(t){const e=t.chart,n=e.options.animation;Xe(n&&n.onProgress,[t],e)}function hO(t){return Qf()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const jo={},kE=t=>{const e=hO(t);return Object.values(jo).filter(n=>n.canvas===e).pop()};function g1(t,e,n){const i=Object.keys(t);for(const r of i){const a=+r;if(a>=e){const s=t[r];delete t[r],(n>0||a>e)&&(t[a+n]=s)}}}function h1(t,e,n,i){return!n||t.type==="mouseout"?null:i?e:t}function No(t,e,n){return t.options.clip?t[n]:e[n]}function E1(t,e){const{xScale:n,yScale:i}=t;return n&&i?{left:No(n,e,"left"),right:No(n,e,"right"),top:No(i,e,"top"),bottom:No(i,e,"bottom")}:e}var Oi;let xt=(Oi=class{static register(...e){kt.add(...e),FE()}static unregister(...e){kt.remove(...e),FE()}constructor(e,n){const i=this.config=new d1(n),r=hO(e),a=kE(r);if(a)throw new Error("Canvas is already in use. Chart with ID '"+a.id+"' must be destroyed before the canvas with ID '"+a.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||Pk(r)),this.platform.updateConfig(i);const o=this.platform.acquireContext(r,s.aspectRatio),l=o&&o.canvas,c=l&&l.height,d=l&&l.width;if(this.id=T0(),this.ctx=o,this.canvas=l,this.width=d,this.height=c,this._options=s,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 Jk,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=k0(u=>this.update(u),s.resizeDelay||0),this._dataChanges=[],jo[this.id]=this,!o||!l){console.error("Failed to create chart: can't acquire context from the given item");return}ti.listen(this,"complete",PE),ti.listen(this,"progress",f1),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:i,height:r,_aspectRatio:a}=this;return Be(e)?n&&a?a:r?i/r:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return kt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():aE(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return nE(this.canvas,this.ctx),this}stop(){return ti.stop(this),this}resize(e,n){ti.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const i=this.options,r=this.canvas,a=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(r,e,n,a),o=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,aE(this,o,!0)&&(this.notifyPlugins("resize",{size:s}),Xe(i.onResize,[this,s],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};Ke(n,(i,r)=>{i.id=r})}buildOrUpdateScales(){const e=this.options,n=e.scales,i=this.scales,r=Object.keys(i).reduce((s,o)=>(s[o]=!1,s),{});let a=[];n&&(a=a.concat(Object.keys(n).map(s=>{const o=n[s],l=xm(s,o),c=l==="r",d=l==="x";return{options:o,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),Ke(a,s=>{const o=s.options,l=o.id,c=xm(l,o),d=Me(o.type,s.dtype);(o.position===void 0||ME(o.position,c)!==ME(s.dposition))&&(o.position=s.dposition),r[l]=!0;let u=null;if(l in i&&i[l].type===d)u=i[l];else{const _=kt.getScale(d);u=new _({id:l,type:d,ctx:this.ctx,chart:this}),i[u.id]=u}u.init(o,e)}),Ke(r,(s,o)=>{s||delete i[o]}),Ke(i,s=>{Bt.configure(this,s,s.options),Bt.addBox(this,s)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,i=e.length;if(e.sort((r,a)=>r.index-a.index),i>n){for(let r=n;rn.length&&delete this._stacks,e.forEach((i,r)=>{n.filter(a=>a===i._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let i,r;for(this._removeUnreferencedMetasets(),i=0,r=n.length;i{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const a=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let c=0,d=this.data.datasets.length;c{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(LE("z","_idx"));const{_active:o,_lastEvent:l}=this;l?this._eventHandler(l,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Ke(this.scales,e=>{Bt.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(e.events);(!Kh(n,i)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:r,count:a}of n){const s=i==="_removeElements"?-a:a;g1(e,r,s)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=a=>new Set(e.filter(s=>s[0]===a).map((s,o)=>o+","+s.splice(1).join(","))),r=i(0);for(let a=1;aa.split(",")).map(a=>({method:a[1],start:+a[2],count:+a[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Bt.update(this,this.width,this.height,e);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],Ke(this.boxes,r=>{i&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,a)=>{r._idx=a}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,i=e._clip,r=!i.disabled,a=E1(e,this.chartArea),s={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(r&&to(n,{left:i.left===!1?0:a.left-i.left,right:i.right===!1?this.width:a.right+i.right,top:i.top===!1?0:a.top-i.top,bottom:i.bottom===!1?this.height:a.bottom+i.bottom}),e.controller.draw(),r&&no(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(e){return ui(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,i,r){const a=mk.modes[n];return typeof a=="function"?a(this,e,i,r):[]}getDatasetMeta(e){const n=this.data.datasets[e],i=this._metasets;let r=i.filter(a=>a&&a._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},i.push(r)),r}getContext(){return this.$context||(this.$context=er(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const i=this.getDatasetMeta(e);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(e,n){const i=this.getDatasetMeta(e);i.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,i){const r=i?"show":"hide",a=this.getDatasetMeta(e),s=a.controller._resolveAnimations(void 0,r);Is(n)?(a.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(e,i),s.update(a,{visible:i}),this.update(o=>o.datasetIndex===e?r:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),ti.remove(this),e=0,n=this.data.datasets.length;e{n.addEventListener(this,a,s),e[a]=s},r=(a,s,o)=>{a.offsetX=s,a.offsetY=o,this._eventHandler(a)};Ke(this.options.events,a=>i(a,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),e[l]=c},r=(l,c)=>{e[l]&&(n.removeEventListener(this,l,c),delete e[l])},a=(l,c)=>{this.canvas&&this.resize(l,c)};let s;const o=()=>{r("attach",o),this.attached=!0,this.resize(),i("resize",a),i("detach",s)};s=()=>{this.attached=!1,r("resize",a),this._stop(),this._resize(0,0),i("attach",o)},n.isAttached(this.canvas)?o():s()}unbindEvents(){Ke(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},Ke(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,i){const r=i?"set":"remove";let a,s,o,l;for(n==="dataset"&&(a=this.getDatasetMeta(e[0].datasetIndex),a.controller["_"+r+"DatasetHoverStyle"]()),o=0,l=e.length;o{const o=this.getDatasetMeta(a);if(!o)throw new Error("No dataset found at index "+a);return{datasetIndex:a,element:o.data[s],index:s}});!yl(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(e,n,i){return this._plugins.notify(this,e,n,i)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,i){const r=this.options.hover,a=(l,c)=>l.filter(d=>!c.some(u=>d.datasetIndex===u.datasetIndex&&d.index===u.index)),s=a(n,e),o=i?e:a(e,n);s.length&&this.updateHoverStyle(s,r.mode,!1),o.length&&r.mode&&this.updateHoverStyle(o,r.mode,!0)}_eventHandler(e,n){const i={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},r=s=>(s.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",i,r)===!1)return;const a=this._handleEvent(e,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,r),(a||i.changed)&&this.render(),this}_handleEvent(e,n,i){const{_active:r=[],options:a}=this,s=n,o=this._getActiveElements(e,r,i,s),l=N0(e),c=h1(e,this._lastEvent,i,l);i&&(this._lastEvent=null,Xe(a.onHover,[e,o,this],this),l&&Xe(a.onClick,[e,o,this],this));const d=!yl(o,r);return(d||n)&&(this._active=o,this._updateHoverStyles(o,r,n)),this._lastEvent=c,d}_getActiveElements(e,n,i,r){if(e.type==="mouseout")return[];if(!i)return n;const a=this.options.hover;return this.getElementsAtEventForMode(e,a.mode,a,r)}},ue(Oi,"defaults",tt),ue(Oi,"instances",jo),ue(Oi,"overrides",Nr),ue(Oi,"registry",kt),ue(Oi,"version",p1),ue(Oi,"getChart",kE),Oi);function FE(){return Ke(xt.instances,t=>t._plugins.invalidate())}function S1(t,e,n){const{startAngle:i,pixelMargin:r,x:a,y:s,outerRadius:o,innerRadius:l}=e;let c=r/o;t.beginPath(),t.arc(a,s,o,i-c,n+c),l>r?(c=r/l,t.arc(a,s,l,n+c,i-c,!0)):t.arc(a,s,r,n+Et,i-Et),t.closePath(),t.clip()}function b1(t){return qf(t,["outerStart","outerEnd","innerStart","innerEnd"])}function T1(t,e,n,i){const r=b1(t.options.borderRadius),a=(n-e)/2,s=Math.min(a,i*e/2),o=l=>{const c=(n-Math.min(a,l))*i/2;return Ot(l,0,Math.min(a,c))};return{outerStart:o(r.outerStart),outerEnd:o(r.outerEnd),innerStart:Ot(r.innerStart,0,s),innerEnd:Ot(r.innerEnd,0,s)}}function Br(t,e,n,i){return{x:n+t*Math.cos(e),y:i+t*Math.sin(e)}}function xl(t,e,n,i,r,a){const{x:s,y:o,startAngle:l,pixelMargin:c,innerRadius:d}=e,u=Math.max(e.outerRadius+i+n-c,0),_=d>0?d+i+n+c:0;let p=0;const f=r-l;if(i){const U=d>0?d-i:0,K=u>0?u-i:0,w=(U+K)/2,$=w!==0?f*w/(w+i):f;p=(f-$)/2}const m=Math.max(.001,f*u-n/ot)/u,h=(f-m)/2,g=l+h+p,E=r-h-p,{outerStart:T,outerEnd:b,innerStart:y,innerEnd:N}=T1(e,_,u,E-g),O=u-T,A=u-b,x=g+T/O,F=E-b/A,Y=_+y,I=_+N,B=g+y/Y,v=E-N/I;if(t.beginPath(),a){const U=(x+F)/2;if(t.arc(s,o,u,x,U),t.arc(s,o,u,U,F),b>0){const W=Br(A,F,s,o);t.arc(W.x,W.y,b,F,E+Et)}const K=Br(I,E,s,o);if(t.lineTo(K.x,K.y),N>0){const W=Br(I,v,s,o);t.arc(W.x,W.y,N,E+Et,v+Math.PI)}const w=(E-N/_+(g+y/_))/2;if(t.arc(s,o,_,E-N/_,w,!0),t.arc(s,o,_,w,g+y/_,!0),y>0){const W=Br(Y,B,s,o);t.arc(W.x,W.y,y,B+Math.PI,g-Et)}const $=Br(O,g,s,o);if(t.lineTo($.x,$.y),T>0){const W=Br(O,x,s,o);t.arc(W.x,W.y,T,g-Et,x)}}else{t.moveTo(s,o);const U=Math.cos(x)*u+s,K=Math.sin(x)*u+o;t.lineTo(U,K);const w=Math.cos(F)*u+s,$=Math.sin(F)*u+o;t.lineTo(w,$)}t.closePath()}function v1(t,e,n,i,r){const{fullCircles:a,startAngle:s,circumference:o}=e;let l=e.endAngle;if(a){xl(t,e,n,i,l,r);for(let c=0;c=st||m,g=ci(o,d+p,u+p);return h&&g}getCenterPoint(n){const{x:i,y:r,startAngle:a,endAngle:s,innerRadius:o,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:d}=this.options,u=(a+s)/2,_=(o+l+d+c)/2;return{x:i+Math.cos(u)*_,y:r+Math.sin(u)*_}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:i,circumference:r}=this,a=(i.offset||0)/4,s=(i.spacing||0)/2,o=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=r>st?Math.floor(r/st):0,r===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*a,Math.sin(l)*a);const c=1-Math.sin(Math.min(ot,r||0)),d=a*c;n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,v1(n,this,d,s,o),y1(n,this,d,s,o),n.restore()}}ue(Kr,"id","arc"),ue(Kr,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),ue(Kr,"defaultRoutes",{backgroundColor:"backgroundColor"}),ue(Kr,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function EO(t,e,n=e){t.lineCap=Me(n.borderCapStyle,e.borderCapStyle),t.setLineDash(Me(n.borderDash,e.borderDash)),t.lineDashOffset=Me(n.borderDashOffset,e.borderDashOffset),t.lineJoin=Me(n.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Me(n.borderWidth,e.borderWidth),t.strokeStyle=Me(n.borderColor,e.borderColor)}function C1(t,e,n){t.lineTo(n.x,n.y)}function R1(t){return t.stepped?K0:t.tension||t.cubicInterpolationMode==="monotone"?Q0:C1}function SO(t,e,n={}){const i=t.length,{start:r=0,end:a=i-1}=n,{start:s,end:o}=e,l=Math.max(r,s),c=Math.min(a,o),d=ro&&a>o;return{count:i,start:l,loop:e.loop,ilen:c(s+(c?o-b:b))%a,T=()=>{m!==h&&(t.lineTo(d,h),t.lineTo(d,m),t.lineTo(d,g))};for(l&&(p=r[E(0)],t.moveTo(p.x,p.y)),_=0;_<=o;++_){if(p=r[E(_)],p.skip)continue;const b=p.x,y=p.y,N=b|0;N===f?(yh&&(h=y),d=(u*d+b)/++u):(T(),t.lineTo(b,y),f=N,u=0,m=h=y),g=y}T()}function Dm(t){const e=t.options,n=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!n?N1:O1}function A1(t){return t.stepped?NP:t.tension||t.cubicInterpolationMode==="monotone"?AP:_r}function I1(t,e,n,i){let r=e._path;r||(r=e._path=new Path2D,e.path(r,n,i)&&r.closePath()),EO(t,e.options),t.stroke(r)}function x1(t,e,n,i){const{segments:r,options:a}=e,s=Dm(e);for(const o of r)EO(t,a,o.style),t.beginPath(),s(t,e,o,{start:n,end:n+i-1})&&t.closePath(),t.stroke()}const D1=typeof Path2D=="function";function w1(t,e,n,i){D1&&!e.options.segment?I1(t,e,n,i):x1(t,e,n,i)}class Cn extends Ti{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const r=i.spanGaps?this._loop:this._fullLoop;SP(this._points,i,e,r,n),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=LP(this,this.options.segment))}first(){const e=this.segments,n=this.points;return e.length&&n[e[0].start]}last(){const e=this.segments,n=this.points,i=e.length;return i&&n[e[i-1].end]}interpolate(e,n){const i=this.options,r=e[n],a=this.points,s=aO(this,{property:n,start:r,end:r});if(!s.length)return;const o=[],l=A1(i);let c,d;for(c=0,d=s.length;ce!=="borderDash"&&e!=="fill"});function UE(t,e,n,i){const r=t.options,{[n]:a}=t.getProps([n],i);return Math.abs(e-a)t.replace("rgb(","rgba(").replace(")",", 0.5)"));function TO(t){return wm[t%wm.length]}function vO(t){return BE[t%BE.length]}function B1(t,e){return t.borderColor=TO(e),t.backgroundColor=vO(e),++e}function G1(t,e){return t.backgroundColor=t.data.map(()=>TO(e++)),e}function Y1(t,e){return t.backgroundColor=t.data.map(()=>vO(e++)),e}function z1(t){let e=0;return(n,i)=>{const r=t.getDatasetMeta(i).controller;r instanceof gr?e=G1(n,e):r instanceof os?e=Y1(n,e):r&&(e=B1(n,e))}}function GE(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}function H1(t){return t&&(t.borderColor||t.backgroundColor)}function V1(){return tt.borderColor!=="rgba(0,0,0,0.1)"||tt.backgroundColor!=="rgba(0,0,0,0.1)"}var q1={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,n){if(!n.enabled)return;const{data:{datasets:i},options:r}=t.config,{elements:a}=r,s=GE(i)||H1(r)||a&&GE(a)||V1();if(!n.forceOverride&&s)return;const o=z1(t);i.forEach(o)}};function $1(t,e,n,i,r){const a=r.samples||i;if(a>=n)return t.slice(e,e+n);const s=[],o=(n-2)/(a-2);let l=0;const c=e+n-1;let d=e,u,_,p,f,m;for(s[l++]=t[d],u=0;up&&(p=f,_=t[E],m=E);s[l++]=_,d=m}return s[l++]=t[c],s}function W1(t,e,n,i){let r=0,a=0,s,o,l,c,d,u,_,p,f,m;const h=[],g=e+n-1,E=t[e].x,b=t[g].x-E;for(s=e;sm&&(m=c,_=s),r=(a*r+o.x)/++a;else{const N=s-1;if(!Be(u)&&!Be(_)){const O=Math.min(u,_),A=Math.max(u,_);O!==p&&O!==N&&h.push({...t[O],x:r}),A!==p&&A!==N&&h.push({...t[A],x:r})}s>0&&N!==p&&h.push(t[N]),h.push(o),d=y,a=0,f=m=c,u=_=p=s}}return h}function yO(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function YE(t){t.data.datasets.forEach(e=>{yO(e)})}function K1(t,e){const n=e.length;let i=0,r;const{iScale:a}=t,{min:s,max:o,minDefined:l,maxDefined:c}=a.getUserBounds();return l&&(i=Ot(di(e,a.axis,s).lo,0,n-1)),c?r=Ot(di(e,a.axis,o).hi+1,i,n)-i:r=n-i,{start:i,count:r}}var Q1={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,n)=>{if(!n.enabled){YE(t);return}const i=t.width;t.data.datasets.forEach((r,a)=>{const{_data:s,indexAxis:o}=r,l=t.getDatasetMeta(a),c=s||r.data;if(it([o,t.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const d=t.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||t.options.parsing)return;let{start:u,count:_}=K1(l,c);const p=n.threshold||4*i;if(_<=p){yO(r);return}Be(s)&&(r._data=c,delete r.data,Object.defineProperty(r,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(m){this._data=m}}));let f;switch(n.algorithm){case"lttb":f=$1(c,u,_,i,n);break;case"min-max":f=W1(c,u,_,i);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}r._decimated=f})},destroy(t){YE(t)}};function X1(t,e,n){const i=t.segments,r=t.points,a=e.points,s=[];for(const o of i){let{start:l,end:c}=o;c=jf(l,c,r);const d=Mm(n,r[l],r[c],o.loop);if(!e.segments){s.push({source:o,target:d,start:r[l],end:r[c]});continue}const u=aO(e,d);for(const _ of u){const p=Mm(n,a[_.start],a[_.end],_.loop),f=rO(o,r,p);for(const m of f)s.push({source:m,target:_,start:{[n]:zE(d,p,"start",Math.max)},end:{[n]:zE(d,p,"end",Math.min)}})}}return s}function Mm(t,e,n,i){if(i)return;let r=e[t],a=n[t];return t==="angle"&&(r=sn(r),a=sn(a)),{property:t,start:r,end:a}}function Z1(t,e){const{x:n=null,y:i=null}=t||{},r=e.points,a=[];return e.segments.forEach(({start:s,end:o})=>{o=jf(s,o,r);const l=r[s],c=r[o];i!==null?(a.push({x:l.x,y:i}),a.push({x:c.x,y:i})):n!==null&&(a.push({x:n,y:l.y}),a.push({x:n,y:c.y}))}),a}function jf(t,e,n){for(;e>t;e--){const i=n[e];if(!isNaN(i.x)&&!isNaN(i.y))break}return e}function zE(t,e,n,i){return t&&e?i(t[n],e[n]):t?t[n]:e?e[n]:0}function CO(t,e){let n=[],i=!1;return rt(t)?(i=!0,n=t):n=Z1(t,e),n.length?new Cn({points:n,options:{tension:0},_loop:i,_fullLoop:i}):null}function HE(t){return t&&t.fill!==!1}function j1(t,e,n){let r=t[e].fill;const a=[e];let s;if(!n)return r;for(;r!==!1&&a.indexOf(r)===-1;){if(!gt(r))return r;if(s=t[r],!s)return!1;if(s.visible)return r;a.push(r),r=s.fill}return!1}function J1(t,e,n){const i=iF(t);if(Ge(i))return isNaN(i.value)?!1:i;let r=parseFloat(i);return gt(r)&&Math.floor(r)===r?eF(i[0],e,r,n):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function eF(t,e,n,i){return(t==="-"||t==="+")&&(n=e+n),n===e||n<0||n>=i?!1:n}function tF(t,e){let n=null;return t==="start"?n=e.bottom:t==="end"?n=e.top:Ge(t)?n=e.getPixelForValue(t.value):e.getBasePixel&&(n=e.getBasePixel()),n}function nF(t,e,n){let i;return t==="start"?i=n:t==="end"?i=e.options.reverse?e.min:e.max:Ge(t)?i=t.value:i=e.getBaseValue(),i}function iF(t){const e=t.options,n=e.fill;let i=Me(n&&n.target,n);return i===void 0&&(i=!!e.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function rF(t){const{scale:e,index:n,line:i}=t,r=[],a=i.segments,s=i.points,o=aF(e,n);o.push(CO({x:null,y:e.bottom},i));for(let l=0;l=0;--s){const o=r[s].$filler;o&&(o.line.updateControlPoints(a,o.axis),i&&o.fill&&jc(t.ctx,o,a))}},beforeDatasetsDraw(t,e,n){if(n.drawTime!=="beforeDatasetsDraw")return;const i=t.getSortedVisibleDatasetMetas();for(let r=i.length-1;r>=0;--r){const a=i[r].$filler;HE(a)&&jc(t.ctx,a,t.chartArea)}},beforeDatasetDraw(t,e,n){const i=e.meta.$filler;!HE(i)||n.drawTime!=="beforeDatasetDraw"||jc(t.ctx,i,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const WE=(t,e)=>{let{boxHeight:n=e,boxWidth:i=e}=t;return t.usePointStyle&&(n=Math.min(n,e),i=t.pointStyleWidth||Math.min(i,e)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(e,n)}},gF=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class KE extends Ti{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,n,i){this.maxWidth=e,this.maxHeight=n,this._margins=i,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 e=this.options.labels||{};let n=Xe(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(i=>e.filter(i,this.chart.data))),e.sort&&(n=n.sort((i,r)=>e.sort(i,r,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const i=e.labels,r=Tt(i.font),a=r.size,s=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=WE(i,a);let c,d;n.font=r.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(s,a,o,l)+10):(d=this.maxHeight,c=this._fitCols(s,r,o,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,e.maxHeight||this.maxHeight)}_fitRows(e,n,i,r){const{ctx:a,maxWidth:s,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=r+o;let u=e;a.textAlign="left",a.textBaseline="middle";let _=-1,p=-d;return this.legendItems.forEach((f,m)=>{const h=i+n/2+a.measureText(f.text).width;(m===0||c[c.length-1]+h+2*o>s)&&(u+=d,c[c.length-(m>0?0:1)]=0,p+=d,_++),l[m]={left:0,top:p,row:_,width:h,height:r},c[c.length-1]+=h+o}),u}_fitCols(e,n,i,r){const{ctx:a,maxHeight:s,options:{labels:{padding:o}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=s-e;let u=o,_=0,p=0,f=0,m=0;return this.legendItems.forEach((h,g)=>{const{itemWidth:E,itemHeight:T}=hF(i,n,a,h,r);g>0&&p+T+2*o>d&&(u+=_+o,c.push({width:_,height:p}),f+=_+o,m++,_=p=0),l[g]={left:f,top:p,col:m,width:E,height:T},_=Math.max(_,E),p+=T+o}),u+=_,c.push({width:_,height:p}),u}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:r},rtl:a}}=this,s=na(a,this.left,this.width);if(this.isHorizontal()){let o=0,l=Pt(i,this.left+r,this.right-this.lineWidths[o]);for(const c of n)o!==c.row&&(o=c.row,l=Pt(i,this.left+r,this.right-this.lineWidths[o])),c.top+=this.top+e+r,c.left=s.leftForLtr(s.x(l),c.width),l+=c.width+r}else{let o=0,l=Pt(i,this.top+e+r,this.bottom-this.columnSizes[o].height);for(const c of n)c.col!==o&&(o=c.col,l=Pt(i,this.top+e+r,this.bottom-this.columnSizes[o].height)),c.top=l,c.left+=this.left+r,c.left=s.leftForLtr(s.x(c.left),c.width),l+=c.height+r}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;to(e,this),this._draw(),no(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:i,ctx:r}=this,{align:a,labels:s}=e,o=tt.color,l=na(e.rtl,this.left,this.width),c=Tt(s.font),{padding:d}=s,u=c.size,_=u/2;let p;this.drawTitle(),r.textAlign=l.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=c.string;const{boxWidth:f,boxHeight:m,itemHeight:h}=WE(s,u),g=function(N,O,A){if(isNaN(f)||f<=0||isNaN(m)||m<0)return;r.save();const x=Me(A.lineWidth,1);if(r.fillStyle=Me(A.fillStyle,o),r.lineCap=Me(A.lineCap,"butt"),r.lineDashOffset=Me(A.lineDashOffset,0),r.lineJoin=Me(A.lineJoin,"miter"),r.lineWidth=x,r.strokeStyle=Me(A.strokeStyle,o),r.setLineDash(Me(A.lineDash,[])),s.usePointStyle){const F={radius:m*Math.SQRT2/2,pointStyle:A.pointStyle,rotation:A.rotation,borderWidth:x},Y=l.xPlus(N,f/2),I=O+_;WR(r,F,Y,I,s.pointStyleWidth&&f)}else{const F=O+Math.max((u-m)/2,0),Y=l.leftForLtr(N,f),I=Tr(A.borderRadius);r.beginPath(),Object.values(I).some(B=>B!==0)?Ds(r,{x:Y,y:F,w:f,h:m,radius:I}):r.rect(Y,F,f,m),r.fill(),x!==0&&r.stroke()}r.restore()},E=function(N,O,A){Ar(r,A.text,N,O+h/2,c,{strikethrough:A.hidden,textAlign:l.textAlign(A.textAlign)})},T=this.isHorizontal(),b=this._computeTitleHeight();T?p={x:Pt(a,this.left+d,this.right-i[0]),y:this.top+d+b,line:0}:p={x:this.left+d,y:Pt(a,this.top+b+d,this.bottom-n[0].height),line:0},tO(this.ctx,e.textDirection);const y=h+d;this.legendItems.forEach((N,O)=>{r.strokeStyle=N.fontColor,r.fillStyle=N.fontColor;const A=r.measureText(N.text).width,x=l.textAlign(N.textAlign||(N.textAlign=s.textAlign)),F=f+_+A;let Y=p.x,I=p.y;l.setWidth(this.width),T?O>0&&Y+F+d>this.right&&(I=p.y+=y,p.line++,Y=p.x=Pt(a,this.left+d,this.right-i[p.line])):O>0&&I+y>this.bottom&&(Y=p.x=Y+n[p.line].width+d,p.line++,I=p.y=Pt(a,this.top+b+d,this.bottom-n[p.line].height));const B=l.x(Y);if(g(B,I,N),Y=F0(x,Y+f+_,T?Y+F:this.right,e.rtl),E(l.x(Y),I,N),T)p.x+=F+d;else if(typeof N.text!="string"){const v=c.lineHeight;p.y+=OO(N,v)+d}else p.y+=y}),nO(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,i=Tt(n.font),r=wt(n.padding);if(!n.display)return;const a=na(e.rtl,this.left,this.width),s=this.ctx,o=n.position,l=i.size/2,c=r.top+l;let d,u=this.left,_=this.width;if(this.isHorizontal())_=Math.max(...this.lineWidths),d=this.top+c,u=Pt(e.align,u,this.right-_);else{const f=this.columnSizes.reduce((m,h)=>Math.max(m,h.height),0);d=c+Pt(e.align,this.top,this.bottom-f-e.labels.padding-this._computeTitleHeight())}const p=Pt(o,u,u+_);s.textAlign=a.textAlign(Hf(o)),s.textBaseline="middle",s.strokeStyle=n.color,s.fillStyle=n.color,s.font=i.string,Ar(s,n.text,p,d,i)}_computeTitleHeight(){const e=this.options.title,n=Tt(e.font),i=wt(e.padding);return e.display?n.lineHeight+i.height:0}_getLegendItemAt(e,n){let i,r,a;if(ci(e,this.left,this.right)&&ci(n,this.top,this.bottom)){for(a=this.legendHitBoxes,i=0;ia.length>s.length?a:s)),e+n.size/2+i.measureText(r).width}function SF(t,e,n){let i=t;return typeof e.text!="string"&&(i=OO(e,n)),i}function OO(t,e){const n=t.text?t.text.length:0;return e*n}function bF(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var TF={id:"legend",_element:KE,start(t,e,n){const i=t.legend=new KE({ctx:t.ctx,options:n,chart:t});Bt.configure(t,i,n),Bt.addBox(t,i)},stop(t){Bt.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const i=t.legend;Bt.configure(t,i,n),i.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const i=e.datasetIndex,r=n.chart;r.isDatasetVisible(i)?(r.hide(i),e.hidden=!0):(r.show(i),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:r,color:a,useBorderRadius:s,borderRadius:o}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),d=wt(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:a,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:r||c.textAlign,borderRadius:s&&(o||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Jf extends Ti{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.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(e,n){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=n;const r=rt(i.text)?i.text.length:1;this._padding=wt(i.padding);const a=r*Tt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=a:this.width=a}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:n,left:i,bottom:r,right:a,options:s}=this,o=s.align;let l=0,c,d,u;return this.isHorizontal()?(d=Pt(o,i,a),u=n+e,c=a-i):(s.position==="left"?(d=i+e,u=Pt(o,r,n),l=ot*-.5):(d=a-e,u=Pt(o,n,r),l=ot*.5),c=r-n),{titleX:d,titleY:u,maxWidth:c,rotation:l}}draw(){const e=this.ctx,n=this.options;if(!n.display)return;const i=Tt(n.font),a=i.lineHeight/2+this._padding.top,{titleX:s,titleY:o,maxWidth:l,rotation:c}=this._drawArgs(a);Ar(e,n.text,0,0,i,{color:n.color,maxWidth:l,rotation:c,textAlign:Hf(n.align),textBaseline:"middle",translation:[s,o]})}}function vF(t,e){const n=new Jf({ctx:t.ctx,options:e,chart:t});Bt.configure(t,n,e),Bt.addBox(t,n),t.titleBlock=n}var yF={id:"title",_element:Jf,start(t,e,n){vF(t,n)},stop(t){const e=t.titleBlock;Bt.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,n){const i=t.titleBlock;Bt.configure(t,i,n),i.options=n},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 Ao=new WeakMap;var CF={id:"subtitle",start(t,e,n){const i=new Jf({ctx:t.ctx,options:n,chart:t});Bt.configure(t,i,n),Bt.addBox(t,i),Ao.set(t,i)},stop(t){Bt.removeBox(t,Ao.get(t)),Ao.delete(t)},beforeUpdate(t,e,n){const i=Ao.get(t);Bt.configure(t,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ua={average(t){if(!t.length)return!1;let e,n,i=new Set,r=0,a=0;for(e=0,n=t.length;eo+l)/i.size,y:r/a}},nearest(t,e){if(!t.length)return!1;let n=e.x,i=e.y,r=Number.POSITIVE_INFINITY,a,s,o;for(a=0,s=t.length;a-1?t.split(`
+`):t}function RF(t,e){const{element:n,datasetIndex:i,index:r}=e,a=t.getDatasetMeta(i).controller,{label:s,value:o}=a.getLabelAndValue(r);return{chart:t,label:s,parsed:a.getParsed(r),raw:t.data.datasets[i].data[r],formattedValue:o,dataset:a.getDataset(),dataIndex:r,datasetIndex:i,element:n}}function QE(t,e){const n=t.chart.ctx,{body:i,footer:r,title:a}=t,{boxWidth:s,boxHeight:o}=e,l=Tt(e.bodyFont),c=Tt(e.titleFont),d=Tt(e.footerFont),u=a.length,_=r.length,p=i.length,f=wt(e.padding);let m=f.height,h=0,g=i.reduce((b,y)=>b+y.before.length+y.lines.length+y.after.length,0);if(g+=t.beforeBody.length+t.afterBody.length,u&&(m+=u*c.lineHeight+(u-1)*e.titleSpacing+e.titleMarginBottom),g){const b=e.displayColors?Math.max(o,l.lineHeight):l.lineHeight;m+=p*b+(g-p)*l.lineHeight+(g-1)*e.bodySpacing}_&&(m+=e.footerMarginTop+_*d.lineHeight+(_-1)*e.footerSpacing);let E=0;const T=function(b){h=Math.max(h,n.measureText(b).width+E)};return n.save(),n.font=c.string,Ke(t.title,T),n.font=l.string,Ke(t.beforeBody.concat(t.afterBody),T),E=e.displayColors?s+2+e.boxPadding:0,Ke(i,b=>{Ke(b.before,T),Ke(b.lines,T),Ke(b.after,T)}),E=0,n.font=d.string,Ke(t.footer,T),n.restore(),h+=f.width,{width:h,height:m}}function OF(t,e){const{y:n,height:i}=e;return nt.height-i/2?"bottom":"center"}function NF(t,e,n,i){const{x:r,width:a}=i,s=n.caretSize+n.caretPadding;if(t==="left"&&r+a+s>e.width||t==="right"&&r-a-s<0)return!0}function AF(t,e,n,i){const{x:r,width:a}=n,{width:s,chartArea:{left:o,right:l}}=t;let c="center";return i==="center"?c=r<=(o+l)/2?"left":"right":r<=a/2?c="left":r>=s-a/2&&(c="right"),NF(c,t,e,n)&&(c="center"),c}function XE(t,e,n){const i=n.yAlign||e.yAlign||OF(t,n);return{xAlign:n.xAlign||e.xAlign||AF(t,e,n,i),yAlign:i}}function IF(t,e){let{x:n,width:i}=t;return e==="right"?n-=i:e==="center"&&(n-=i/2),n}function xF(t,e,n){let{y:i,height:r}=t;return e==="top"?i+=n:e==="bottom"?i-=r+n:i-=r/2,i}function ZE(t,e,n,i){const{caretSize:r,caretPadding:a,cornerRadius:s}=t,{xAlign:o,yAlign:l}=n,c=r+a,{topLeft:d,topRight:u,bottomLeft:_,bottomRight:p}=Tr(s);let f=IF(e,o);const m=xF(e,l,c);return l==="center"?o==="left"?f+=c:o==="right"&&(f-=c):o==="left"?f-=Math.max(d,_)+r:o==="right"&&(f+=Math.max(u,p)+r),{x:Ot(f,0,i.width-e.width),y:Ot(m,0,i.height-e.height)}}function Io(t,e,n){const i=wt(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-i.right:t.x+i.left}function jE(t){return Dn([],ni(t))}function DF(t,e,n){return er(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function JE(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const NO={beforeTitle:Jn,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex"u"?NO[e].call(n,i):r}class Lm extends Ti{constructor(e){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=e.chart,this.options=e.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(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,i=this.options.setContext(this.getContext()),r=i.enabled&&n.options.animation&&i.animations,a=new sO(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){return this.$context||(this.$context=DF(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:i}=n,r=Kt(i,"beforeTitle",this,e),a=Kt(i,"title",this,e),s=Kt(i,"afterTitle",this,e);let o=[];return o=Dn(o,ni(r)),o=Dn(o,ni(a)),o=Dn(o,ni(s)),o}getBeforeBody(e,n){return jE(Kt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:i}=n,r=[];return Ke(e,a=>{const s={before:[],lines:[],after:[]},o=JE(i,a);Dn(s.before,ni(Kt(o,"beforeLabel",this,a))),Dn(s.lines,Kt(o,"label",this,a)),Dn(s.after,ni(Kt(o,"afterLabel",this,a))),r.push(s)}),r}getAfterBody(e,n){return jE(Kt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:i}=n,r=Kt(i,"beforeFooter",this,e),a=Kt(i,"footer",this,e),s=Kt(i,"afterFooter",this,e);let o=[];return o=Dn(o,ni(r)),o=Dn(o,ni(a)),o=Dn(o,ni(s)),o}_createItems(e){const n=this._active,i=this.chart.data,r=[],a=[],s=[];let o=[],l,c;for(l=0,c=n.length;le.filter(d,u,_,i))),e.itemSort&&(o=o.sort((d,u)=>e.itemSort(d,u,i))),Ke(o,d=>{const u=JE(e.callbacks,d);r.push(Kt(u,"labelColor",this,d)),a.push(Kt(u,"labelPointStyle",this,d)),s.push(Kt(u,"labelTextColor",this,d))}),this.labelColors=r,this.labelPointStyles=a,this.labelTextColors=s,this.dataPoints=o,o}update(e,n){const i=this.options.setContext(this.getContext()),r=this._active;let a,s=[];if(!r.length)this.opacity!==0&&(a={opacity:0});else{const o=Ua[i.position].call(this,r,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const l=this._size=QE(this,i),c=Object.assign({},o,l),d=XE(this.chart,i,c),u=ZE(i,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,a={opacity:1,x:u.x,y:u.y,width:l.width,height:l.height,caretX:o.x,caretY:o.y}}this._tooltipItems=s,this.$context=void 0,a&&this._resolveAnimations().update(this,a),e&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,i,r){const a=this.getCaretPosition(e,i,r);n.lineTo(a.x1,a.y1),n.lineTo(a.x2,a.y2),n.lineTo(a.x3,a.y3)}getCaretPosition(e,n,i){const{xAlign:r,yAlign:a}=this,{caretSize:s,cornerRadius:o}=i,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:u}=Tr(o),{x:_,y:p}=e,{width:f,height:m}=n;let h,g,E,T,b,y;return a==="center"?(b=p+m/2,r==="left"?(h=_,g=h-s,T=b+s,y=b-s):(h=_+f,g=h+s,T=b-s,y=b+s),E=h):(r==="left"?g=_+Math.max(l,d)+s:r==="right"?g=_+f-Math.max(c,u)-s:g=this.caretX,a==="top"?(T=p,b=T-s,h=g-s,E=g+s):(T=p+m,b=T+s,h=g+s,E=g-s),y=T),{x1:h,x2:g,x3:E,y1:T,y2:b,y3:y}}drawTitle(e,n,i){const r=this.title,a=r.length;let s,o,l;if(a){const c=na(i.rtl,this.x,this.width);for(e.x=Io(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",s=Tt(i.titleFont),o=i.titleSpacing,n.fillStyle=i.titleColor,n.font=s.string,l=0;lE!==0)?(e.beginPath(),e.fillStyle=a.multiKeyBackground,Ds(e,{x:m,y:f,w:c,h:l,radius:g}),e.fill(),e.stroke(),e.fillStyle=s.backgroundColor,e.beginPath(),Ds(e,{x:h,y:f+1,w:c-2,h:l-2,radius:g}),e.fill()):(e.fillStyle=a.multiKeyBackground,e.fillRect(m,f,c,l),e.strokeRect(m,f,c,l),e.fillStyle=s.backgroundColor,e.fillRect(h,f+1,c-2,l-2))}e.fillStyle=this.labelTextColors[i]}drawBody(e,n,i){const{body:r}=this,{bodySpacing:a,bodyAlign:s,displayColors:o,boxHeight:l,boxWidth:c,boxPadding:d}=i,u=Tt(i.bodyFont);let _=u.lineHeight,p=0;const f=na(i.rtl,this.x,this.width),m=function(A){n.fillText(A,f.x(e.x+p),e.y+_/2),e.y+=_+a},h=f.textAlign(s);let g,E,T,b,y,N,O;for(n.textAlign=s,n.textBaseline="middle",n.font=u.string,e.x=Io(this,h,i),n.fillStyle=i.bodyColor,Ke(this.beforeBody,m),p=o&&h!=="right"?s==="center"?c/2+d:c+2+d:0,b=0,N=r.length;b0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,i=this.$animations,r=i&&i.x,a=i&&i.y;if(r||a){const s=Ua[e.position].call(this,this._active,this._eventPosition);if(!s)return;const o=this._size=QE(this,e),l=Object.assign({},s,this._size),c=XE(n,e,l),d=ZE(e,l,c,n);(r._to!==d.x||a._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=o.width,this.height=o.height,this.caretX=s.x,this.caretY=s.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},a={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=wt(n.padding),o=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&o&&(e.save(),e.globalAlpha=i,this.drawBackground(a,e,r,n),tO(e,n.textDirection),a.y+=s.top,this.drawTitle(a,e,n),this.drawBody(a,e,n),this.drawFooter(a,e,n),nO(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const i=this._active,r=e.map(({datasetIndex:o,index:l})=>{const c=this.chart.getDatasetMeta(o);if(!c)throw new Error("Cannot find a dataset at index "+o);return{datasetIndex:o,element:c.data[l],index:l}}),a=!yl(i,r),s=this._positionChanged(r,n);(a||s)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,a=this._active||[],s=this._getActiveElements(e,a,n,i),o=this._positionChanged(s,e),l=n||!yl(s,a)||o;return l&&(this._active=s,(r.enabled||r.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,i,r){const a=this.options;if(e.type==="mouseout")return[];if(!r)return n.filter(o=>this.chart.data.datasets[o.datasetIndex]&&this.chart.getDatasetMeta(o.datasetIndex).controller.getParsed(o.index)!==void 0);const s=this.chart.getElementsAtEventForMode(e,a.mode,a,i);return a.reverse&&s.reverse(),s}_positionChanged(e,n){const{caretX:i,caretY:r,options:a}=this,s=Ua[a.position].call(this,e,n);return s!==!1&&(i!==s.x||r!==s.y)}}ue(Lm,"positioners",Ua);var wF={id:"tooltip",_element:Lm,positioners:Ua,afterInit(t,e,n){n&&(t.tooltip=new Lm({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:NO},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},MF=Object.freeze({__proto__:null,Colors:q1,Decimation:Q1,Filler:fF,Legend:TF,SubTitle:CF,Title:yF,Tooltip:wF});const LF=(t,e,n,i)=>(typeof e=="string"?(n=t.push(e)-1,i.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function PF(t,e,n,i){const r=t.indexOf(e);if(r===-1)return LF(t,e,n,i);const a=t.lastIndexOf(e);return r!==a?n:r}const kF=(t,e)=>t===null?null:Ot(Math.round(t),0,e);function eS(t){const e=this.getLabels();return t>=0&&tn.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}ue(Pm,"id","category"),ue(Pm,"defaults",{ticks:{callback:eS}});function FF(t,e){const n=[],{bounds:r,step:a,min:s,max:o,precision:l,count:c,maxTicks:d,maxDigits:u,includeBounds:_}=t,p=a||1,f=d-1,{min:m,max:h}=e,g=!Be(s),E=!Be(o),T=!Be(c),b=(h-m)/(u+1);let y=Xh((h-m)/f/p)*p,N,O,A,x;if(y<1e-14&&!g&&!E)return[{value:m},{value:h}];x=Math.ceil(h/y)-Math.floor(m/y),x>f&&(y=Xh(x*y/f/p)*p),Be(l)||(N=Math.pow(10,l),y=Math.ceil(y*N)/N),r==="ticks"?(O=Math.floor(m/y)*y,A=Math.ceil(h/y)*y):(O=m,A=h),g&&E&&a&&D0((o-s)/a,y/1e3)?(x=Math.round(Math.min((o-s)/y,d)),y=(o-s)/x,O=s,A=o):T?(O=g?s:O,A=E?o:A,x=c-1,y=(A-O)/x):(x=(A-O)/y,is(x,Math.round(x),y/1e3)?x=Math.round(x):x=Math.ceil(x));const F=Math.max(Zh(y),Zh(O));N=Math.pow(10,Be(l)?F:l),O=Math.round(O*N)/N,A=Math.round(A*N)/N;let Y=0;for(g&&(_&&O!==s?(n.push({value:s}),Oo)break;n.push({value:I})}return E&&_&&A!==o?n.length&&is(n[n.length-1].value,o,tS(o,b,t))?n[n.length-1].value=o:n.push({value:o}):(!E||A===o)&&n.push({value:A}),n}function tS(t,e,{horizontal:n,minRotation:i}){const r=yn(i),a=(n?Math.sin(r):Math.cos(r))||.001,s=.75*e*(""+t).length;return Math.min(e/a,s)}class Dl extends Mr{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return Be(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:r,max:a}=this;const s=l=>r=n?r:l,o=l=>a=i?a:l;if(e){const l=Yn(r),c=Yn(a);l<0&&c<0?o(0):l>0&&c>0&&s(0)}if(r===a){let l=a===0?1:Math.abs(a*.05);o(a+l),e||s(r-l)}this.min=r,this.max=a}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=e,r;return i?(r=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let i=this.getTickLimit();i=Math.max(2,i);const r={maxTicks:i,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},a=this._range||this,s=FF(r,a);return e.bounds==="ticks"&&FR(s,this,"value"),e.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const e=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&e.length){const r=(i-n)/Math.max(e.length-1,1)/2;n-=r,i+=r}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(e){return eo(e,this.chart.options.locale,this.options.ticks.format)}}class Ir extends Dl{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=gt(e)?e:0,this.max=gt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,i=yn(this.options.ticks.minRotation),r=(e?Math.sin(i):Math.cos(i))||.001,a=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,a.lineHeight/r))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}ue(Ir,"id","linear"),ue(Ir,"defaults",{ticks:{callback:uc.formatters.numeric}});const Ms=t=>Math.floor(Pi(t)),or=(t,e)=>Math.pow(10,Ms(t)+e);function nS(t){return t/Math.pow(10,Ms(t))===1}function iS(t,e,n){const i=Math.pow(10,n),r=Math.floor(t/i);return Math.ceil(e/i)-r}function UF(t,e){const n=e-t;let i=Ms(n);for(;iS(t,e,i)>10;)i++;for(;iS(t,e,i)<10;)i--;return Math.min(i,Ms(t))}function BF(t,{min:e,max:n}){e=an(t.min,e);const i=[],r=Ms(e);let a=UF(e,n),s=a<0?Math.pow(10,Math.abs(a)):1;const o=Math.pow(10,a),l=r>a?Math.pow(10,r):0,c=Math.round((e-l)*s)/s,d=Math.floor((e-l)/o/10)*o*10;let u=Math.floor((c-d)/Math.pow(10,a)),_=an(t.min,Math.round((l+d+u*Math.pow(10,a))*s)/s);for(;_=10?u=u<15?15:20:u++,u>=20&&(a++,u=2,s=a>=0?1:s),_=Math.round((l+d+u*Math.pow(10,a))*s)/s;const p=an(t.max,_);return i.push({value:p,major:nS(p),significand:u}),i}class km extends Mr{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,n){const i=Dl.prototype.parse.apply(this,[e,n]);if(i===0){this._zero=!0;return}return gt(i)&&i>0?i:null}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=gt(e)?Math.max(0,e):null,this.max=gt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!gt(this._userMin)&&(this.min=e===or(this.min,0)?or(this.min,-1):or(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let i=this.min,r=this.max;const a=o=>i=e?i:o,s=o=>r=n?r:o;i===r&&(i<=0?(a(1),s(10)):(a(or(i,-1)),s(or(r,1)))),i<=0&&a(or(r,-1)),r<=0&&s(or(i,1)),this.min=i,this.max=r}buildTicks(){const e=this.options,n={min:this._userMin,max:this._userMax},i=BF(n,this);return e.bounds==="ticks"&&FR(i,this,"value"),e.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(e){return e===void 0?"0":eo(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=Pi(e),this._valueRange=Pi(this.max)-Pi(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Pi(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const n=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+n*this._valueRange)}}ue(km,"id","logarithmic"),ue(km,"defaults",{ticks:{callback:uc.formatters.logarithmic,major:{enabled:!0}}});function Fm(t){const e=t.ticks;if(e.display&&t.display){const n=wt(e.backdropPadding);return Me(e.font&&e.font.size,tt.font.size)+n.height}return 0}function GF(t,e,n){return n=rt(n)?n:[n],{w:W0(t,e.string,n),h:n.length*e.lineHeight}}function rS(t,e,n,i,r){return t===i||t===r?{start:e-n/2,end:e+n/2}:tr?{start:e-n,end:e}:{start:e,end:e+n}}function YF(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},n=Object.assign({},e),i=[],r=[],a=t._pointLabels.length,s=t.options.pointLabels,o=s.centerPointLabels?ot/a:0;for(let l=0;le.r&&(o=(i.end-e.r)/a,t.r=Math.max(t.r,e.r+o)),r.starte.b&&(l=(r.end-e.b)/s,t.b=Math.max(t.b,e.b+l))}function HF(t,e,n){const i=t.drawingArea,{extra:r,additionalAngle:a,padding:s,size:o}=n,l=t.getPointPosition(e,i+r+s,a),c=Math.round(Yf(sn(l.angle+Et))),d=KF(l.y,o.h,c),u=$F(c),_=WF(l.x,o.w,u);return{visible:!0,x:l.x,y:d,textAlign:u,left:_,top:d,right:_+o.w,bottom:d+o.h}}function VF(t,e){if(!e)return!0;const{left:n,top:i,right:r,bottom:a}=t;return!(ui({x:n,y:i},e)||ui({x:n,y:a},e)||ui({x:r,y:i},e)||ui({x:r,y:a},e))}function qF(t,e,n){const i=[],r=t._pointLabels.length,a=t.options,{centerPointLabels:s,display:o}=a.pointLabels,l={extra:Fm(a)/2,additionalAngle:s?ot/r:0};let c;for(let d=0;d270||n<90)&&(t-=e),t}function QF(t,e,n){const{left:i,top:r,right:a,bottom:s}=n,{backdropColor:o}=e;if(!Be(o)){const l=Tr(e.borderRadius),c=wt(e.backdropPadding);t.fillStyle=o;const d=i-c.left,u=r-c.top,_=a-i+c.width,p=s-r+c.height;Object.values(l).some(f=>f!==0)?(t.beginPath(),Ds(t,{x:d,y:u,w:_,h:p,radius:l}),t.fill()):t.fillRect(d,u,_,p)}}function XF(t,e){const{ctx:n,options:{pointLabels:i}}=t;for(let r=e-1;r>=0;r--){const a=t._pointLabelItems[r];if(!a.visible)continue;const s=i.setContext(t.getPointLabelContext(r));QF(n,s,a);const o=Tt(s.font),{x:l,y:c,textAlign:d}=a;Ar(n,t._pointLabels[r],l,c+o.lineHeight/2,o,{color:s.color,textAlign:d,textBaseline:"middle"})}}function AO(t,e,n,i){const{ctx:r}=t;if(n)r.arc(t.xCenter,t.yCenter,e,0,st);else{let a=t.getPointPosition(0,e);r.moveTo(a.x,a.y);for(let s=1;s{const r=Xe(this.options.pointLabels.callback,[n,i],this);return r||r===0?r:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const e=this.options;e.display&&e.pointLabels.display?YF(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,i,r){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((i-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,i,r))}getIndexAngle(e){const n=st/(this._pointLabels.length||1),i=this.options.startAngle||0;return sn(e*n+yn(i))}getDistanceFromCenterForValue(e){if(Be(e))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*n:(e-this.min)*n}getValueForDistanceFromCenter(e){if(Be(e))return NaN;const n=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(e){const n=this._pointLabels||[];if(e>=0&&e{if(u!==0||u===0&&this.min<0){l=this.getDistanceFromCenterForValue(d.value);const _=this.getContext(u),p=r.setContext(_),f=a.setContext(_);ZF(this,p,l,s,f)}}),i.display){for(e.save(),o=s-1;o>=0;o--){const d=i.setContext(this.getPointLabelContext(o)),{color:u,lineWidth:_}=d;!_||!u||(e.lineWidth=_,e.strokeStyle=u,e.setLineDash(d.borderDash),e.lineDashOffset=d.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(o,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const r=this.getIndexAngle(0);let a,s;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(r),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((o,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=i.setContext(this.getContext(l)),d=Tt(c.font);if(a=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){e.font=d.string,s=e.measureText(o.label).width,e.fillStyle=c.backdropColor;const u=wt(c.backdropPadding);e.fillRect(-s/2-u.left,-a-d.size/2-u.top,s+u.width,d.size+u.height)}Ar(e,o.label,0,-a,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),e.restore()}drawTitle(){}}ue(Ba,"id","radialLinear"),ue(Ba,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:uc.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),ue(Ba,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),ue(Ba,"descriptors",{angleLines:{_fallback:"grid"}});const pc={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}},jt=Object.keys(pc);function aS(t,e){return t-e}function sS(t,e){if(Be(e))return null;const n=t._adapter,{parser:i,round:r,isoWeekday:a}=t._parseOpts;let s=e;return typeof i=="function"&&(s=i(s)),gt(s)||(s=typeof i=="string"?n.parse(s,i):n.parse(s)),s===null?null:(r&&(s=r==="week"&&(ca(a)||a===!0)?n.startOf(s,"isoWeek",a):n.startOf(s,r)),+s)}function oS(t,e,n,i){const r=jt.length;for(let a=jt.indexOf(t);a=jt.indexOf(n);a--){const s=jt[a];if(pc[s].common&&t._adapter.diff(r,i,s)>=e-1)return s}return jt[n?jt.indexOf(n):0]}function eU(t){for(let e=jt.indexOf(t)+1,n=jt.length;e=e?n[i]:n[r];t[a]=!0}}function tU(t,e,n,i){const r=t._adapter,a=+r.startOf(e[0].value,i),s=e[e.length-1].value;let o,l;for(o=a;o<=s;o=+r.add(o,1,i))l=n[o],l>=0&&(e[l].major=!0);return e}function cS(t,e,n){const i=[],r={},a=e.length;let s,o;for(s=0;s+e.value))}initOffsets(e=[]){let n=0,i=0,r,a;this.options.offset&&e.length&&(r=this.getDecimalForValue(e[0]),e.length===1?n=1-r:n=(this.getDecimalForValue(e[1])-r)/2,a=this.getDecimalForValue(e[e.length-1]),e.length===1?i=a:i=(a-this.getDecimalForValue(e[e.length-2]))/2);const s=e.length<3?.5:.25;n=Ot(n,0,s),i=Ot(i,0,s),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const e=this._adapter,n=this.min,i=this.max,r=this.options,a=r.time,s=a.unit||oS(a.minUnit,n,i,this._getLabelCapacity(n)),o=Me(r.ticks.stepSize,1),l=s==="week"?a.isoWeekday:!1,c=ca(l)||l===!0,d={};let u=n,_,p;if(c&&(u=+e.startOf(u,"isoWeek",l)),u=+e.startOf(u,c?"day":s),e.diff(i,n,s)>1e5*o)throw new Error(n+" and "+i+" are too far apart with stepSize of "+o+" "+s);const f=r.ticks.source==="data"&&this.getDataTimestamps();for(_=u,p=0;_+m)}getLabelForValue(e){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(e,i.tooltipFormat):n.format(e,i.displayFormats.datetime)}format(e,n){const r=this.options.time.displayFormats,a=this._unit,s=n||r[a];return this._adapter.format(e,s)}_tickFormatFunction(e,n,i,r){const a=this.options,s=a.ticks.callback;if(s)return Xe(s,[e,n,i],this);const o=a.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&o[l],u=c&&o[c],_=i[n],p=c&&u&&_&&_.major;return this._adapter.format(e,r||(p?u:d))}generateTickLabels(e){let n,i,r;for(n=0,i=e.length;n0?o:1}getDataTimestamps(){let e=this._cache.data||[],n,i;if(e.length)return e;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,i=r.length;n=t[i].pos&&e<=t[r].pos&&({lo:i,hi:r}=di(t,"pos",e)),{pos:a,time:o}=t[i],{pos:s,time:l}=t[r]):(e>=t[i].time&&e<=t[r].time&&({lo:i,hi:r}=di(t,"time",e)),{time:a,pos:o}=t[i],{time:s,pos:l}=t[r]);const c=s-a;return c?o+(l-o)*(e-a)/c:o}class Um extends Ls{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=xo(n,this.min),this._tableRange=xo(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:i}=this,r=[],a=[];let s,o,l,c,d;for(s=0,o=e.length;s=n&&c<=i&&r.push(c);if(r.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(s=0,o=r.length;sr-a)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?e=this.normalize(n.concat(i)):e=n.length?n:i,e=this._cache.all=e,e}getDecimalForValue(e){return(xo(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,i=this.getDecimalForPixel(e)/n.factor-n.end;return xo(this._table,i*this._tableRange+this._minPos,!0)}}ue(Um,"id","timeseries"),ue(Um,"defaults",Ls.defaults);var nU=Object.freeze({__proto__:null,CategoryScale:Pm,LinearScale:Ir,LogarithmicScale:km,RadialLinearScale:Ba,TimeScale:Ls,TimeSeriesScale:Um});const eg=[lk,U1,MF,nU],IO={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},iU={ariaLabel:{type:String},ariaDescribedby:{type:String}},rU={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...IO,...iU},aU=OC[0]==="2"?(t,e)=>Object.assign(t,{attrs:e}):(t,e)=>Object.assign(t,e);function Gr(t){return Vs(t)?ze(t):t}function sU(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t;return Vs(e)?new Proxy(t,{}):t}function oU(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function xO(t,e){t.labels=e}function DO(t,e,n){const i=[];t.datasets=e.map(r=>{const a=t.datasets.find(s=>s[n]===r[n]);return!a||!r.data||i.includes(a)?{...r}:(i.push(a),Object.assign(a,r),a)})}function lU(t,e){const n={labels:[],datasets:[]};return xO(n,t.labels),DO(n,t.datasets,e),n}const cU=Pe({props:rU,setup(t,e){let{expose:n,slots:i}=e;const r=Ne(null),a=_f(null);n({chart:a});const s=()=>{if(!r.value)return;const{type:c,data:d,options:u,plugins:_,datasetIdKey:p}=t,f=lU(d,p),m=sU(f,d);a.value=new xt(r.value,{type:c,data:m,options:{...u},plugins:_})},o=()=>{const c=ze(a.value);c&&(t.destroyDelay>0?setTimeout(()=>{c.destroy(),a.value=null},t.destroyDelay):(c.destroy(),a.value=null))},l=c=>{c.update(t.updateMode)};return tc(s),ff(o),Un([()=>t.options,()=>t.data],(c,d)=>{let[u,_]=c,[p,f]=d;const m=ze(a.value);if(!m)return;let h=!1;if(u){const g=Gr(u),E=Gr(p);g&&g!==E&&(oU(m,g),h=!0)}if(_){const g=Gr(_.labels),E=Gr(f.labels),T=Gr(_.datasets),b=Gr(f.datasets);g!==E&&(xO(m.config.data,g),h=!0),T&&T!==b&&(DO(m.config.data,T,t.datasetIdKey),h=!0)}h&&ji(()=>{l(m)})},{deep:!0}),()=>fi("canvas",{role:"img",ariaLabel:t.ariaLabel,ariaDescribedby:t.ariaDescribedby,ref:r},[fi("p",{},[i.default?i.default():""])])}});function wO(t,e){return xt.register(e),Pe({props:IO,setup(n,i){let{expose:r}=i;const a=_f(null),s=o=>{a.value=o==null?void 0:o.chart};return r({chart:a}),()=>fi(cU,aU({ref:s},{type:t,...n}))}})}const dU=wO("bar",ss),uU=wO("radar",ls);/*!
+ * 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 dS=function(){if(typeof window<"u"){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),ds={toTextLines:function(t){var e=[],n;for(t=[].concat(t);t.length;)n=t.pop(),typeof n=="string"?e.unshift.apply(e,n.split(`
+`)):Array.isArray(n)?t.push.apply(t,n):Be(t)||e.unshift(""+n);return e},textSize:function(t,e,n){var i=[].concat(e),r=i.length,a=t.font,s=0,o;for(t.font=n.string,o=0;on.right&&(i|=LO),en.bottom&&(i|=PO),i}function mU(t,e){for(var n=t.x0,i=t.y0,r=t.x1,a=t.y1,s=Do(n,i,e),o=Do(r,a,e),l,c,d;!(!(s|o)||s&o);)l=s||o,l&kO?(c=n+(r-n)*(e.top-i)/(a-i),d=e.top):l&PO?(c=n+(r-n)*(e.bottom-i)/(a-i),d=e.bottom):l&LO?(d=i+(a-i)*(e.right-n)/(r-n),c=e.right):l&MO&&(d=i+(a-i)*(e.left-n)/(r-n),c=e.left),l===s?(n=c,i=d,s=Do(n,i,e)):(r=c,a=d,o=Do(r,a,e));return{x0:n,x1:r,y0:i,y1:a}}function wo(t,e){var n=e.anchor,i=t,r,a;return e.clamp&&(i=mU(i,e.area)),n==="start"?(r=i.x0,a=i.y0):n==="end"?(r=i.x1,a=i.y1):(r=(i.x0+i.x1)/2,a=(i.y0+i.y1)/2),_U(r,a,t.vx,t.vy,e.align)}var Mo={arc:function(t,e){var n=(t.startAngle+t.endAngle)/2,i=Math.cos(n),r=Math.sin(n),a=t.innerRadius,s=t.outerRadius;return wo({x0:t.x+i*a,y0:t.y+r*a,x1:t.x+i*s,y1:t.y+r*s,vx:i,vy:r},e)},point:function(t,e){var n=Jc(t,e.origin),i=n.x*t.options.radius,r=n.y*t.options.radius;return wo({x0:t.x-i,y0:t.y-r,x1:t.x+i,y1:t.y+r,vx:n.x,vy:n.y},e)},bar:function(t,e){var n=Jc(t,e.origin),i=t.x,r=t.y,a=0,s=0;return t.horizontal?(i=Math.min(t.x,t.base),a=Math.abs(t.base-t.x)):(r=Math.min(t.y,t.base),s=Math.abs(t.base-t.y)),wo({x0:i,y0:r+s,x1:i+a,y1:r,vx:n.x,vy:n.y},e)},fallback:function(t,e){var n=Jc(t,e.origin);return wo({x0:t.x,y0:t.y,x1:t.x+(t.width||0),y1:t.y+(t.height||0),vx:n.x,vy:n.y},e)}},_i=ds.rasterize;function fU(t){var e=t.borderWidth||0,n=t.padding,i=t.size.height,r=t.size.width,a=-r/2,s=-i/2;return{frame:{x:a-n.left-e,y:s-n.top-e,w:r+n.width+e*2,h:i+n.height+e*2},text:{x:a,y:s,w:r,h:i}}}function gU(t,e){var n=e.chart.getDatasetMeta(e.datasetIndex).vScale;if(!n)return null;if(n.xCenter!==void 0&&n.yCenter!==void 0)return{x:n.xCenter,y:n.yCenter};var i=n.getBasePixel();return t.horizontal?{x:i,y:null}:{x:null,y:i}}function hU(t){return t instanceof Kr?Mo.arc:t instanceof pi?Mo.point:t instanceof cs?Mo.bar:Mo.fallback}function EU(t,e,n,i,r,a){var s=Math.PI/2;if(a){var o=Math.min(a,r/2,i/2),l=e+o,c=n+o,d=e+i-o,u=n+r-o;t.moveTo(e,c),li.x+i.w+n*2||t.y>i.y+i.h+n*2)},intersects:function(t){var e=this._points(),n=t._points(),i=[Lo(e[0],e[1]),Lo(e[0],e[3])],r,a,s;for(this._rotation!==t._rotation&&i.push(Lo(n[0],n[1]),Lo(n[0],n[3])),r=0;r=0;--n)for(r=t[n].$layout,i=n-1;i>=0&&r._visible;--i)a=t[i].$layout,a._visible&&r._box.intersects(a._box)&&e(r,a);return t}function OU(t){var e,n,i,r,a,s,o;for(e=0,n=t.length;el.getProps([c],!0)[c]}),a=i.geometry(),s=BO(o,i.model(),a),r._box.update(s,a,i.rotation()));return RU(t,function(l,c){var d=l._hidable,u=c._hidable;d&&u||u?c._visible=!1:d&&(l._visible=!1)})}var us={prepare:function(t){var e=[],n,i,r,a,s;for(n=0,r=t.length;n=0;--n)if(i=t[n].$layout,i&&i._visible&&i._box.contains(e))return t[n];return null},draw:function(t,e){var n,i,r,a,s,o;for(n=0,i=e.length;n_e().uiState.useDarkMode?"#ffffff":"#000000"),gridLines:Te(()=>_e().uiState.useDarkMode?"rgba(256, 256, 256, 0.2)":"rgba(0, 0, 0, 0.2)"),contentFill:`rgba(${ei.red}, ${ei.green}, ${ei.blue}, 0.5)`,contentBorder:"rgb(127, 15, 24)",pointFill:`rgba(${ei.red}, ${ei.green}, ${ei.blue}, 1)`,additionalLine:Te(()=>_e().uiState.useDarkMode?"rgba(200, 200, 200, 0.3)":"rgba(0, 0, 0, 0.5)"),contentFillAlpha(t){return`rgba(${ei.red}, ${ei.green}, ${ei.blue}, ${t})`}},kU={class:"group pointer-events-none inline"},Po=4,FU=Pe({__name:"ToolTipComponent",props:{direction:{type:String,required:!1,default:"top"},toolTipContainerWillBeCentered:{type:Boolean,required:!1,default:!1},scrollOffsetX:{type:Number,required:!1,default:0},scrollOffsetY:{type:Number,required:!1,default:0}},setup(t){const e=t,n=Ne(null),i=Ne(null),r=Te(()=>{const a={},s=n.value,o=i.value;if(!s||!o)return a;let l=-s.offsetHeight-e.scrollOffsetY,c=(e.toolTipContainerWillBeCentered?-s.offsetWidth/2:0)-e.scrollOffsetX;return e.direction=="right"||e.direction=="left"?l+=(s.offsetHeight-o.offsetHeight)/2:c-=(o.offsetWidth-s.offsetWidth)/2,e.direction=="right"?c+=s.offsetWidth+Po:e.direction=="left"?c-=o.offsetWidth+Po:e.direction=="bottom"?l+=s.offsetHeight+Po:l-=o.offsetHeight+Po,a.top=l+"px",a.left=c+"px",a});return(a,s)=>(ae(),he("div",kU,[Q("div",{ref_key:"contentRef",ref:n,class:"pointer-events-auto"},[yt(a.$slots,"default",{},void 0,!0)],512),a.$slots.tooltip?(ae(),he("span",{key:0,class:"invisible absolute box-border delay-0 group-hover:visible group-hover:delay-200",ref_key:"tooltipRef",ref:i},[Q("span",{class:en(["arrowBase pointer-events-auto relative z-10 block rounded-md bg-tooltip px-1 text-center text-white after:absolute after:border-4 after:border-solid after:border-transparent",{"after:top-1/2 after:-mt-1":e.direction=="left"||e.direction=="right","after:!left-1/2 after:-ml-1":e.direction=="top"||e.direction=="bottom","after:top-full after:!border-t-tooltip":e.direction=="top","after:bottom-full after:!border-b-tooltip":e.direction=="bottom","after:left-full after:!border-l-tooltip":e.direction=="left","after:right-full after:!border-r-tooltip":e.direction=="right"}]),style:$t(r.value)},[yt(a.$slots,"tooltip",{},void 0,!0)],6)],512)):dt("",!0)]))}}),Jt=Ks(FU,[["__scopeId","data-v-8f80dbb0"]]),_s=Pe({__name:"OptionComponent",props:{label:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1}},emits:["click"],setup(t){return(e,n)=>(ae(),Ye(fa,{class:en(["print-exact mr-2 box-border flex h-6 w-fit items-center justify-center whitespace-nowrap !rounded-2xl px-[12px] text-center hover:!border-[2px] hover:px-[11px] print:border-2",{"!border-accent-dark !bg-accent !bg-opacity-40":t.selected}]),onClick:n[0]||(n[0]=i=>e.$emit("click"))},{default:re(()=>[be(le(t.label),1)]),_:1},8,["class"]))}}),UU={class:"flex h-fit flex-row items-center text-center text-xs"},BU={key:0,class:"mr-3 text-base"},GU={class:"whitespace-pre text-sm"},Ps=Pe({__name:"OptionsSelectorComponent",props:{title:{type:String,required:!1,default:""},labels:{type:Array,required:!0},defaultSelected:{type:Number,required:!1,default:0}},emits:["selectionChanged"],setup(t,{expose:e,emit:n}){const i=t,r=n,a=Ne(-1);function s(){return a.value==-1?i.defaultSelected:a.value}function o(l){r("selectionChanged",l),a.value=l}return e({select:o}),(l,c)=>(ae(),he("div",UU,[t.title!=""?(ae(),he("div",BU,le(t.title),1)):dt("",!0),(ae(!0),he(pt,null,Vn(t.labels.entries(),([d,u])=>(ae(),he("div",{key:d},[u.displayValue!==void 0?(ae(),Ye(Jt,{key:0,direction:"right","tool-tip-container-will-be-centered":!0},{default:re(()=>[te(_s,{label:u.displayValue,selected:d==s(),onClick:_=>o(d)},null,8,["label","selected","onClick"])]),tooltip:re(()=>[Q("p",GU,le(u.tooltip),1)]),_:2},1024)):(ae(),Ye(_s,{key:1,label:u,selected:d==s(),onClick:_=>o(d)},null,8,["label","selected","onClick"]))]))),128))]))}}),YU=Pe({__name:"MetricSelector",props:{metrics:{type:Array,required:!1,default:[Ze.AVERAGE,Ze.MAXIMUM]},title:{type:String,required:!1,default:""},defaultSelected:{type:String,required:!1,default:Ze.AVERAGE}},emits:["selectionChanged"],setup(t){const e=t,n=Te(()=>e.metrics.map(i=>({displayValue:bn[i].longName,tooltip:bn[i].tooltip})));return(i,r)=>(ae(),Ye(Ps,{title:t.title,labels:n.value,"default-selected":t.metrics.indexOf(t.defaultSelected),onSelectionChanged:r[0]||(r[0]=a=>i.$emit("selectionChanged",t.metrics[a]))},null,8,["title","labels","default-selected"]))}}),zU={class:"max-h-0 min-h-full print:max-h-none"},wl=Pe({__name:"ScrollableComponent",setup(t,{expose:e}){const n=Ne(null);function i(){if(!n.value)throw new Error("Root element is not available");return n.value}return e({getRoot:i}),(r,a)=>(ae(),he("div",{class:"overflow-y-auto print:overflow-y-visible",ref_key:"root",ref:n},[Q("div",zU,[yt(r.$slots,"default")])],512))}}),HU={class:"flex flex-col space-y-1"},VU=Pe({__name:"DistributionDiagramOptions",setup(t){const e=[10,20,25,50,100];return(n,i)=>(ae(),he("div",HU,[i[3]||(i[3]=Q("h3",{class:"text-lg underline"},"Options:",-1)),te(wl,{class:"h-fit flex-grow"},{default:re(()=>[te(YU,{class:"mt-2",title:"Metric:",defaultSelected:fe(_e)().uiState.distributionChartConfig.metric,onSelectionChanged:i[0]||(i[0]=r=>fe(_e)().uiState.distributionChartConfig.metric=r)},null,8,["defaultSelected"]),te(Ps,{class:"mt-2",title:"Scale x-Axis:",labels:["Linear","Logarithmic"],defaultSelected:fe(_e)().uiState.distributionChartConfig.xScale=="linear"?0:1,onSelectionChanged:i[1]||(i[1]=r=>fe(_e)().uiState.distributionChartConfig.xScale=r==0?"linear":"logarithmic")},null,8,["defaultSelected"]),te(Ps,{class:"mt-2",title:"Bucket Count:",labels:e.map(r=>r.toString()),defaultSelected:e.indexOf(fe(_e)().uiState.distributionChartConfig.bucketCount),onSelectionChanged:i[2]||(i[2]=r=>fe(_e)().uiState.distributionChartConfig.bucketCount=e[r])},null,8,["labels","defaultSelected"])]),_:1})]))}}),qU={class:"flex flex-col"},$U={class:"h-3/4 w-full print:h-fit print:w-fit"},WU=Pe({__name:"DistributionDiagram",props:{distributions:{type:Object,required:!0},xScale:{type:String,required:!1,default:"linear"}},setup(t){xt.register(...eg),xt.register(tg);const e=t,n=Te(()=>_e().uiState.distributionChartConfig),i=Te(()=>e.distributions[n.value.metric]),r=Te(()=>i.value.splitIntoBuckets(n.value.bucketCount)),a=Te(()=>Math.max(...r.value)),s=Te(()=>{let _=[];for(let p=0;p({label:"Comparisons in bucket",backgroundColor:_t.contentFill,borderWidth:1,borderColor:_t.contentBorder,tickColor:_t.ticksAndFont.value})),l=Te(()=>({labels:s.value,datasets:[{...o.value,data:r.value}]})),c=Te(()=>({responsive:!0,maintainAspectRatio:!1,indexAxis:"y",scales:{x:{suggestedMax:n.value.xScale==="linear"?a.value+5:10**Math.ceil(Math.log10(a.value+5)),type:n.value.xScale,ticks:{minRotation:n.value.xScale==="logarithmic"?30:0,autoSkipPadding:10,color:_t.ticksAndFont.value,callback:function(_){if(n.value.xScale==="logarithmic"&&(_+"").match(/1(0)*[^1-9.]/)||n.value.xScale!=="logarithmic")return _}},grid:{color:_t.gridLines.value}},y:{ticks:{color:_t.ticksAndFont.value,callback:function(_){const p=r.value.length-_-1;if(n.value.bucketCount<=10)return d(p);{let f=10;if(n.value.bucketCount<=25?f=5:f=Math.floor(n.value.bucketCount/10),p==n.value.bucketCount-1||p%f==0)return d(p)}}},grid:{color:_t.gridLines.value}}},animation:!1,plugins:{datalabels:{color:_t.ticksAndFont.value,font:{weight:"bold",size:u()},anchor:"end",align:"end",clamp:!0,text:"test"},legend:{display:!0,position:"bottom",align:"end",onClick:()=>{}}}}));function d(_){let p=100/n.value.bucketCount;return _*p+"-"+(_*p+p)+"%"}function u(){return n.value.bucketCount==100?7:n.value.bucketCount==50?10:12}return(_,p)=>(ae(),he("div",qU,[Q("div",$U,[te(fe(dU),{data:l.value,options:c.value},null,8,["data","options"])]),te(VU,{class:"flex-grow print:grow-0"})]))}});function KU(){var t=window.navigator.userAgent,e=t.indexOf("MSIE ");if(e>0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);var n=t.indexOf("Trident/");if(n>0){var i=t.indexOf("rv:");return parseInt(t.substring(i+3,t.indexOf(".",i)),10)}var r=t.indexOf("Edge/");return r>0?parseInt(t.substring(r+5,t.indexOf(".",r)),10):-1}let el;function Gm(){Gm.init||(Gm.init=!0,el=KU()!==-1)}var mc={name:"ResizeObserver",props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},emits:["notify"],mounted(){Gm(),ji(()=>{this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitOnMount&&this.emitSize()});const t=document.createElement("object");this._resizeObject=t,t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex",-1),t.onload=this.addResizeHandlers,t.type="text/html",el&&this.$el.appendChild(t),t.data="about:blank",el||this.$el.appendChild(t)},beforeUnmount(){this.removeResizeHandlers()},methods:{compareAndNotify(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize(){this.$emit("notify",{width:this._w,height:this._h})},addResizeHandlers(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers(){this._resizeObject&&this._resizeObject.onload&&(!el&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}};const QU=yI();TI("data-v-b329ee4c");const XU={class:"resize-observer",tabindex:"-1"};vI();const ZU=QU((t,e,n,i,r,a)=>(ae(),Ye("div",XU)));mc.render=ZU;mc.__scopeId="data-v-b329ee4c";mc.__file="src/components/ResizeObserver.vue";function tl(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?tl=function(e){return typeof e}:tl=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tl(t)}function jU(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function JU(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{},i,r,a,s=function(l){for(var c=arguments.length,d=new Array(c>1?c-1:0),u=1;u1){var c=o.find(function(u){return u.isIntersecting});c&&(l=c)}if(r.callback){var d=l.isIntersecting&&l.intersectionRatio>=r.threshold;if(d===r.oldResult)return;r.oldResult=d,r.callback(d,l)}},this.options.intersection),ji(function(){r.observer&&r.observer.observe(r.el)})}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&typeof this.options.intersection.threshold=="number"?this.options.intersection.threshold:0}}]),t}();function zO(t,e,n){var i=e.value;if(i)if(typeof IntersectionObserver>"u")console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var r=new oB(t,i,n);t._vue_visibilityState=r}}function lB(t,e,n){var i=e.value,r=e.oldValue;if(!YO(i,r)){var a=t._vue_visibilityState;if(!i){HO(t);return}a?a.createObserver(i,n):zO(t,{value:i},n)}}function HO(t){var e=t._vue_visibilityState;e&&(e.destroyObserver(),delete t._vue_visibilityState)}var cB={beforeMount:zO,updated:lB,unmounted:HO};function dB(t){return{all:t=t||new Map,on:function(e,n){var i=t.get(e);i&&i.push(n)||t.set(e,[n])},off:function(e,n){var i=t.get(e);i&&i.splice(i.indexOf(n)>>>0,1)},emit:function(e,n){(t.get(e)||[]).slice().map(function(i){i(n)}),(t.get("*")||[]).slice().map(function(i){i(e,n)})}}}var VO={itemsLimit:1e3},uB=/(auto|scroll)/;function qO(t,e){return t.parentNode===null?e:qO(t.parentNode,e.concat([t]))}var ed=function(e,n){return getComputedStyle(e,null).getPropertyValue(n)},_B=function(e){return ed(e,"overflow")+ed(e,"overflow-y")+ed(e,"overflow-x")},pB=function(e){return uB.test(_B(e))};function mS(t){if(t instanceof HTMLElement||t instanceof SVGElement){for(var e=qO(t.parentNode,[]),n=0;n{this.$_prerender=!1,this.updateVisibleItems(!0),this.ready=!0})},activated(){const t=this.$_lastUpdateScrollPosition;typeof t=="number"&&this.$nextTick(()=>{this.scrollToPosition(t)})},beforeUnmount(){this.removeListeners()},methods:{addView(t,e,n,i,r){const a=Xl({id:fB++,index:e,used:!0,key:i,type:r}),s=df({item:n,position:0,nr:a});return t.push(s),s},unuseView(t,e=!1){const n=this.$_unusedViews,i=t.nr.type;let r=n.get(i);r||(r=[],n.set(i,r)),r.push(t),e||(t.nr.used=!1,t.position=-9999)},handleResize(){this.$emit("resize"),this.ready&&this.updateVisibleItems(!1)},handleScroll(t){if(!this.$_scrollDirty){if(this.$_scrollDirty=!0,this.$_updateTimeout)return;const e=()=>requestAnimationFrame(()=>{this.$_scrollDirty=!1;const{continuous:n}=this.updateVisibleItems(!1,!0);n||(clearTimeout(this.$_refreshTimout),this.$_refreshTimout=setTimeout(this.handleScroll,this.updateInterval+100))});e(),this.updateInterval&&(this.$_updateTimeout=setTimeout(()=>{this.$_updateTimeout=0,this.$_scrollDirty&&e()},this.updateInterval))}},handleVisibilityChange(t,e){this.ready&&(t||e.boundingClientRect.width!==0||e.boundingClientRect.height!==0?(this.$emit("visible"),requestAnimationFrame(()=>{this.updateVisibleItems(!1)})):this.$emit("hidden"))},updateVisibleItems(t,e=!1){const n=this.itemSize,i=this.gridItems||1,r=this.itemSecondarySize||n,a=this.$_computedMinItemSize,s=this.typeField,o=this.simpleArray?null:this.keyField,l=this.items,c=l.length,d=this.sizes,u=this.$_views,_=this.$_unusedViews,p=this.pool,f=this.itemIndexByKey;let m,h,g,E,T;if(!c)m=h=E=T=g=0;else if(this.$_prerender)m=E=0,h=T=Math.min(this.prerender,l.length),g=null;else{const F=this.getScroll();if(e){let B=F.start-this.$_lastUpdateScrollPosition;if(B<0&&(B=-B),n===null&&BF.start&&(U=K),K=~~((v+U)/2);while(K!==w);for(K<0&&(K=0),m=K,g=d[c-1].accumulator,h=K;hc&&(h=c)),E=m;Ec&&(h=c),E<0&&(E=0),T>c&&(T=c),g=Math.ceil(c/i)*n}}h-m>VO.itemsLimit&&this.itemsLimitError(),this.totalSize=g;let b;const y=m<=this.$_endIndex&&h>=this.$_startIndex;if(y)for(let F=0,Y=p.length;F=h)&&this.unuseView(b));const N=y?null:new Map;let O,A,x;for(let F=m;F=I.length)&&(b=this.addView(p,F,O,Y,A),this.unuseView(b,!0),I=_.get(A)),b=I[x],N.set(A,x+1)),u.delete(b.nr.key),b.nr.used=!0,b.nr.index=F,b.nr.key=Y,b.nr.type=A,u.set(Y,b),B=!0;else if(!b.nr.used&&(b.nr.used=!0,B=!0,I)){const v=I.indexOf(b);v!==-1&&I.splice(v,1)}b.item=O,B&&(F===l.length-1&&this.$emit("scroll-end"),F===0&&this.$emit("scroll-start")),n===null?(b.position=d[F-1].accumulator,b.offset=0):(b.position=Math.floor(F/i)*n,b.offset=F%i*r)}return this.$_startIndex=m,this.$_endIndex=h,this.emitUpdate&&this.$emit("update",m,h,E,T),clearTimeout(this.$_sortTimer),this.$_sortTimer=setTimeout(this.sortViews,this.updateInterval+300),{continuous:y}},getListenerTarget(){let t=mS(this.$el);return window.document&&(t===window.document.documentElement||t===window.document.body)&&(t=window),t},getScroll(){const{$el:t,direction:e}=this,n=e==="vertical";let i;if(this.pageMode){const r=t.getBoundingClientRect(),a=n?r.height:r.width;let s=-(n?r.top:r.left),o=n?window.innerHeight:window.innerWidth;s<0&&(o+=s,s=0),s+o>a&&(o=a-s),i={start:s,end:s+o}}else n?i={start:t.scrollTop,end:t.scrollTop+t.clientHeight}:i={start:t.scrollLeft,end:t.scrollLeft+t.clientWidth};return i},applyPageMode(){this.pageMode?this.addListeners():this.removeListeners()},addListeners(){this.listenerTarget=this.getListenerTarget(),this.listenerTarget.addEventListener("scroll",this.handleScroll,Hm?{passive:!0}:!1),this.listenerTarget.addEventListener("resize",this.handleResize)},removeListeners(){this.listenerTarget&&(this.listenerTarget.removeEventListener("scroll",this.handleScroll),this.listenerTarget.removeEventListener("resize",this.handleResize),this.listenerTarget=null)},scrollToItem(t){let e;const n=this.gridItems||1;this.itemSize===null?e=t>0?this.sizes[t-1].accumulator:0:e=Math.floor(t/n)*this.itemSize,this.scrollToPosition(e)},scrollToPosition(t){const e=this.direction==="vertical"?{scroll:"scrollTop",start:"top"}:{scroll:"scrollLeft",start:"left"};let n,i,r;if(this.pageMode){const a=mS(this.$el),s=a.tagName==="HTML"?0:a[e.scroll],o=a.getBoundingClientRect(),c=this.$el.getBoundingClientRect()[e.start]-o[e.start];n=a,i=e.scroll,r=t+s+c}else n=this.$el,i=e.scroll,r=t;n[i]=r},itemsLimitError(){throw setTimeout(()=>{console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.","Scroller:",this.$el),console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.")}),new Error("Rendered items limit reached")},sortViews(){this.pool.sort((t,e)=>t.nr.index-e.nr.index)}}};const gB={key:0,ref:"before",class:"vue-recycle-scroller__slot"},hB={key:1,ref:"after",class:"vue-recycle-scroller__slot"};function EB(t,e,n,i,r,a){const s=$s("ResizeObserver"),o=FI("observe-visibility");return Jl((ae(),he("div",{class:en(["vue-recycle-scroller",{ready:r.ready,"page-mode":n.pageMode,[`direction-${t.direction}`]:!0}]),onScrollPassive:e[0]||(e[0]=(...l)=>a.handleScroll&&a.handleScroll(...l))},[t.$slots.before?(ae(),he("div",gB,[yt(t.$slots,"before")],512)):dt("v-if",!0),(ae(),Ye(Cg(n.listTag),{ref:"wrapper",style:$t({[t.direction==="vertical"?"minHeight":"minWidth"]:r.totalSize+"px"}),class:en(["vue-recycle-scroller__item-wrapper",n.listClass])},{default:re(()=>[(ae(!0),he(pt,null,Vn(r.pool,l=>(ae(),Ye(Cg(n.itemTag),vf({key:l.nr.id,style:r.ready?{transform:`translate${t.direction==="vertical"?"Y":"X"}(${l.position}px) translate${t.direction==="vertical"?"X":"Y"}(${l.offset}px)`,width:n.gridItems?`${t.direction==="vertical"&&n.itemSecondarySize||n.itemSize}px`:void 0,height:n.gridItems?`${t.direction==="horizontal"&&n.itemSecondarySize||n.itemSize}px`:void 0}:null,class:["vue-recycle-scroller__item-view",[n.itemClass,{hover:!n.skipHover&&r.hoverKey===l.nr.key}]]},UI(n.skipHover?{}:{mouseenter:()=>{r.hoverKey=l.nr.key},mouseleave:()=>{r.hoverKey=null}})),{default:re(()=>[yt(t.$slots,"default",{item:l.item,index:l.nr.index,active:l.nr.used})]),_:2},1040,["style","class"]))),128)),yt(t.$slots,"empty")]),_:3},8,["style","class"])),t.$slots.after?(ae(),he("div",hB,[yt(t.$slots,"after")],512)):dt("v-if",!0),te(s,{onNotify:a.handleResize},null,8,["onNotify"])],34)),[[o,a.handleVisibilityChange]])}ks.render=EB;ks.__file="src/components/RecycleScroller.vue";var Fs={name:"DynamicScroller",components:{RecycleScroller:ks},provide(){return typeof ResizeObserver<"u"&&(this.$_resizeObserver=new ResizeObserver(t=>{requestAnimationFrame(()=>{if(Array.isArray(t)){for(const e of t)if(e.target&&e.target.$_vs_onResize){let n,i;if(e.borderBoxSize){const r=e.borderBoxSize[0];n=r.inlineSize,i=r.blockSize}else n=e.contentRect.width,i=e.contentRect.height;e.target.$_vs_onResize(e.target.$_vs_id,n,i)}}})})),{vscrollData:this.vscrollData,vscrollParent:this,vscrollResizeObserver:this.$_resizeObserver}},inheritAttrs:!1,props:{...$O,minItemSize:{type:[Number,String],required:!0}},emits:["resize","visible"],data(){return{vscrollData:{active:!0,sizes:{},keyField:this.keyField,simpleArray:!1}}},computed:{simpleArray:WO,itemsWithSize(){const t=[],{items:e,keyField:n,simpleArray:i}=this,r=this.vscrollData.sizes,a=e.length;for(let s=0;s"u"&&!this.$_undefinedMap[l]&&(c=0),t.push({item:o,id:l,size:c})}return t}},watch:{items(){this.forceUpdate()},simpleArray:{handler(t){this.vscrollData.simpleArray=t},immediate:!0},direction(t){this.forceUpdate(!0)},itemsWithSize(t,e){const n=this.$el.scrollTop;let i=0,r=0;const a=Math.min(t.length,e.length);for(let o=0;o=n);o++)i+=e[o].size||this.minItemSize,r+=t[o].size||this.minItemSize;const s=r-i;s!==0&&(this.$el.scrollTop+=s)}},beforeCreate(){this.$_updates=[],this.$_undefinedSizes=0,this.$_undefinedMap={},this.$_events=dB()},activated(){this.vscrollData.active=!0},deactivated(){this.vscrollData.active=!1},unmounted(){this.$_events.all.clear()},methods:{onScrollerResize(){this.$refs.scroller&&this.forceUpdate(),this.$emit("resize")},onScrollerVisible(){this.$_events.emit("vscroll:update",{force:!1}),this.$emit("visible")},forceUpdate(t=!1){(t||this.simpleArray)&&(this.vscrollData.sizes={}),this.$_events.emit("vscroll:update",{force:!0})},scrollToItem(t){const e=this.$refs.scroller;e&&e.scrollToItem(t)},getItemSize(t,e=void 0){const n=this.simpleArray?e??this.items.indexOf(t):t[this.keyField];return this.vscrollData.sizes[n]||0},scrollToBottom(){if(this.$_scrollingToBottom)return;this.$_scrollingToBottom=!0;const t=this.$el;this.$nextTick(()=>{t.scrollTop=t.scrollHeight+5e3;const e=()=>{t.scrollTop=t.scrollHeight+5e3,requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight+5e3,this.$_undefinedSizes===0?this.$_scrollingToBottom=!1:requestAnimationFrame(e)})};requestAnimationFrame(e)})}}};function SB(t,e,n,i,r,a){const s=$s("RecycleScroller");return ae(),Ye(s,vf({ref:"scroller",items:a.itemsWithSize,"min-item-size":n.minItemSize,direction:t.direction,"key-field":"id","list-tag":t.listTag,"item-tag":t.itemTag},t.$attrs,{onResize:a.onScrollerResize,onVisible:a.onScrollerVisible}),{default:re(({item:o,index:l,active:c})=>[yt(t.$slots,"default",UA(yC({item:o.item,index:l,active:c,itemWithSize:o})))]),before:re(()=>[yt(t.$slots,"before")]),after:re(()=>[yt(t.$slots,"after")]),empty:re(()=>[yt(t.$slots,"empty")]),_:3},16,["items","min-item-size","direction","list-tag","item-tag","onResize","onVisible"])}Fs.render=SB;Fs.__file="src/components/DynamicScroller.vue";var Ml={name:"DynamicScrollerItem",inject:["vscrollData","vscrollParent","vscrollResizeObserver"],props:{item:{required:!0},watchData:{type:Boolean,default:!1},active:{type:Boolean,required:!0},index:{type:Number,default:void 0},sizeDependencies:{type:[Array,Object],default:null},emitResize:{type:Boolean,default:!1},tag:{type:String,default:"div"}},emits:["resize"],computed:{id(){if(this.vscrollData.simpleArray)return this.index;if(this.vscrollData.keyField in this.item)return this.item[this.vscrollData.keyField];throw new Error(`keyField '${this.vscrollData.keyField}' not found in your item. You should set a valid keyField prop on your Scroller`)},size(){return this.vscrollData.sizes[this.id]||0},finalActive(){return this.active&&this.vscrollData.active}},watch:{watchData:"updateWatchData",id(t,e){if(this.$el.$_vs_id=this.id,this.size||this.onDataUpdate(),this.$_sizeObserved){const n=this.vscrollData.sizes[e],i=this.vscrollData.sizes[t];n!=null&&n!==i&&this.applySize(n)}},finalActive(t){this.size||(t?this.vscrollParent.$_undefinedMap[this.id]||(this.vscrollParent.$_undefinedSizes++,this.vscrollParent.$_undefinedMap[this.id]=!0):this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=!1)),this.vscrollResizeObserver?t?this.observeSize():this.unobserveSize():t&&this.$_pendingVScrollUpdate===this.id&&this.updateSize()}},created(){if(!this.$isServer&&(this.$_forceNextVScrollUpdate=null,this.updateWatchData(),!this.vscrollResizeObserver)){for(const t in this.sizeDependencies)this.$watch(()=>this.sizeDependencies[t],this.onDataUpdate);this.vscrollParent.$_events.on("vscroll:update",this.onVscrollUpdate)}},mounted(){this.finalActive&&(this.updateSize(),this.observeSize())},beforeUnmount(){this.vscrollParent.$_events.off("vscroll:update",this.onVscrollUpdate),this.unobserveSize()},methods:{updateSize(){this.finalActive?this.$_pendingSizeUpdate!==this.id&&(this.$_pendingSizeUpdate=this.id,this.$_forceNextVScrollUpdate=null,this.$_pendingVScrollUpdate=null,this.computeSize(this.id)):this.$_forceNextVScrollUpdate=this.id},updateWatchData(){this.watchData&&!this.vscrollResizeObserver?this.$_watchData=this.$watch("item",()=>{this.onDataUpdate()},{deep:!0}):this.$_watchData&&(this.$_watchData(),this.$_watchData=null)},onVscrollUpdate({force:t}){!this.finalActive&&t&&(this.$_pendingVScrollUpdate=this.id),(this.$_forceNextVScrollUpdate===this.id||t||!this.size)&&this.updateSize()},onDataUpdate(){this.updateSize()},computeSize(t){this.$nextTick(()=>{if(this.id===t){const e=this.$el.offsetWidth,n=this.$el.offsetHeight;this.applyWidthHeight(e,n)}this.$_pendingSizeUpdate=null})},applyWidthHeight(t,e){const n=~~(this.vscrollParent.direction==="vertical"?e:t);n&&this.size!==n&&this.applySize(n)},applySize(t){this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=void 0),this.vscrollData.sizes[this.id]=t,this.emitResize&&this.$emit("resize",this.id)},observeSize(){this.vscrollResizeObserver&&(this.$_sizeObserved||(this.vscrollResizeObserver.observe(this.$el),this.$el.$_vs_id=this.id,this.$el.$_vs_onResize=this.onResize,this.$_sizeObserved=!0))},unobserveSize(){this.vscrollResizeObserver&&this.$_sizeObserved&&(this.vscrollResizeObserver.unobserve(this.$el),this.$el.$_vs_onResize=void 0,this.$_sizeObserved=!1)},onResize(t,e,n){this.id===t&&this.applyWidthHeight(e,n)}},render(){return fi(this.tag,this.$slots.default())}};Ml.__file="src/components/DynamicScrollerItem.vue";function bB(t,e){t.component("".concat(e,"recycle-scroller"),ks),t.component("".concat(e,"RecycleScroller"),ks),t.component("".concat(e,"dynamic-scroller"),Fs),t.component("".concat(e,"DynamicScroller"),Fs),t.component("".concat(e,"dynamic-scroller-item"),Ml),t.component("".concat(e,"DynamicScrollerItem"),Ml)}var TB={version:"2.0.0-beta.8",install:function(e,n){var i=Object.assign({},{installComponents:!0,componentsPrefix:""},n);for(var r in i)typeof i[r]<"u"&&(VO[r]=i[r]);i.installComponents&&bB(e,i.componentsPrefix)}};const vB={class:"group relative flex items-center justify-center"},yB={class:"break-anywhere"},fS=Pe({__name:"NameElement",props:{id:{type:String,required:!0}},setup(t){Wi.add(mL),Wi.add(_L);const e=t;function n(i){i.stopPropagation(),i.preventDefault(),_e().isAnonymous(e.id)?_e().removeAnonymous([e.id]):_e().addAnonymous([e.id])}return(i,r)=>(ae(),he("div",vB,[Q("div",yB,le(fe(_e)().getDisplayName(t.id)),1),Q("div",{class:"invisible absolute right-0 top-0 z-10 flex h-full cursor-pointer items-center p-2 delay-0 group-hover:visible group-hover:delay-100",onClick:r[0]||(r[0]=a=>n(a))},[te(fe(Ji),{class:"text-gray-500",icon:fe(_e)().isAnonymous(e.id)?["fas","eye"]:["fas","eye-slash"]},null,8,["icon"])])]))}}),CB=["placeholder"],RB=Pe({__name:"SearchBarComponent",props:{placeholder:{type:String,default:"Search...",required:!1},modelValue:{type:String,default:"",required:!1}},emits:["inputChanged","searchClicked","update:modelValue"],setup(t,{emit:e}){Wi.add(gL);const n=t,i=e,r=Te({get:()=>n.modelValue,set:a=>{i("update:modelValue",a),i("inputChanged",a)}});return(a,s)=>(ae(),Ye(fa,{class:"flex flex-row items-center space-x-2 px-2 py-2"},{default:re(()=>[te(fe(Ji),{icon:["fas","magnifying-glass"],class:"text-gray-500",onClick:s[0]||(s[0]=o=>i("searchClicked",r.value))}),Jl(Q("input",{type:"text",class:"flex-auto border-0 bg-transparent outline-none placeholder:text-gray-500",placeholder:t.placeholder,"onUpdate:modelValue":s[1]||(s[1]=o=>r.value=o)},null,8,CB),[[qx,r.value]])]),_:1}))}}),OB={class:"space-y-2"},NB={class:"flex flex-row flex-wrap items-center gap-x-8 gap-y-2"},AB=Pe({__name:"ComparisonTableFilter",props:{searchString:{type:String,default:""},enableClusterSorting:{type:Boolean,default:!0},header:{type:String,default:"Top Comparisons:"}},emits:["update:searchString"],setup(t,{emit:e}){const n=t,i=e,r=Te({get:()=>n.searchString,set:d=>{i("update:searchString",d);const u=d.trimEnd().toLowerCase().split(/ +/g).map(_=>_.trim().replace(/,/g,""));if(u.length!=0)for(const _ of _e().getSubmissionIds)_e().submissionDisplayName(_).toLowerCase().split(/ +/g).every(f=>u.includes(f))&&_e().state.anonymous.delete(_)}});function a(d){_e().uiState.comparisonTableSortingMetric=d{const d=o.map(u=>({displayValue:bn[u].longName,tooltip:bn[u].tooltip}));return n.enableClusterSorting&&d.push("Cluster"),d});function c(){_e().state.anonymous.size==_e().getSubmissionIds.length?_e().state.anonymous.clear():_e().state.anonymous=new Set(_e().getSubmissionIds)}return(d,u)=>(ae(),he("div",OB,[Q("div",NB,[Q("h2",null,le(t.header),1),te(Jt,{direction:"left",class:"min-w-[50%] flex-grow"},{default:re(()=>[te(RB,{placeholder:"Filter/Unhide Comparisons",modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=_=>r.value=_)},null,8,["modelValue"])]),tooltip:re(()=>u[3]||(u[3]=[Q("p",{class:"whitespace-pre text-sm"}," Type in the name of a submission to only show comparisons that contain this submission. ",-1),Q("p",{class:"whitespace-pre text-sm"},"Fully written out names get unhidden.",-1),Q("p",{class:"whitespace-pre text-sm"},[be(" You can also filter by index by entering a number or typing "),Q("i",null,"index:number")],-1),Q("p",{class:"whitespace-pre text-sm"},[be(" You can filter for specific similarity thresholds via >/<=/>= followed by the percentage. "),Q("br"),be(" You can filter for a specific metric by prefacing the percentage with the three-letter metric name (e.g. "),Q("i",null,"avg:>80"),be(") ")],-1)])),_:1}),te(ga,{class:"w-24",onClick:u[1]||(u[1]=_=>c())},{default:re(()=>[be(le(fe(_e)().state.anonymous.size==fe(_e)().getSubmissionIds.length?"Show All":"Hide All"),1)]),_:1})]),te(Ps,{title:"Sort By:",defaultSelected:s(),labels:l.value,onSelectionChanged:u[2]||(u[2]=_=>a(_))},null,8,["defaultSelected","labels"])]))}}),IB={class:"flex flex-col"},xB={class:"flex flex-col overflow-hidden"},DB={class:"font-bold"},wB={class:"tableRow"},MB={class:"tableCellSimilarity !flex-col"},LB={class:"flex w-full flex-row"},PB={class:"w-full text-center"},kB={class:"whitespace-pre text-sm"},FB={class:"w-full text-center"},UB={class:"whitespace-pre text-sm"},BB={key:0,class:"tableCellCluster items-center"},GB={class:"flex flex-grow flex-col overflow-hidden"},YB={class:"tableCellNumber"},zB={class:"w-full text-center"},HB={class:"tableCellName"},VB={class:"tableCellSimilarity"},qB={class:"w-1/2"},$B={class:"w-1/2"},WB={key:0,class:"tableCellCluster flex !flex-col items-center"},KB={class:"whitespace-nowrap text-sm"},QB=80,XB=50,ZB=.3,jB=90,JB=65,e2=.6,t2=Pe({__name:"ComparisonsTable",props:{topComparisons:{type:Array,required:!0},clusters:{type:Array,required:!1},header:{type:String,default:"Top Comparisons:"},highlightedRowIds:{type:Object,required:!1}},setup(t){Wi.add(pL);const e=t,n=Te(()=>{const _=r(a(Array.from(e.topComparisons)));let p=1;return _.forEach(f=>{f.id=p++}),_}),i=Ne("");function r(_){const p=i.value.trimEnd().toLowerCase().split(/ +/g).map(g=>g.trim().replace(/,/g,""));if(p.length==0)return _;const f=p.filter(g=>/index:[0-9]+/.test(g)).map(g=>g.substring(6)).map(g=>parseInt(g)),m=p.filter(g=>/((avg|max):)?([<>])=?[0-9]+%?/.test(g));return _.filter(g=>{const E=_e().submissionDisplayName(g.firstSubmissionId).toLowerCase(),T=_e().submissionDisplayName(g.secondSubmissionId).toLowerCase();if(p.some(y=>E.includes(y)||T.includes(y))||f.includes(g.sortingPlace+1)||p.some(y=>(g.sortingPlace+1).toString().includes(y)))return!0;const b={[Ze.AVERAGE]:[],[Ze.MAXIMUM]:[]};m.forEach(y=>{const N=/^(?:(avg|max):)([<>]=?[0-9]+%?$)/.exec(y);if(N){const O=N[1];let A=Ze.AVERAGE;for(const x of[Ze.AVERAGE,Ze.MAXIMUM])if(bn[x].shortName.toLowerCase()==O){A=x;break}b[A].push(N[2])}else b[Ze.AVERAGE].push(y),b[Ze.MAXIMUM].push(y)});for(const y of[Ze.AVERAGE,Ze.MAXIMUM])for(const N of b[y]){const O=/([<>]=?)([0-9]+)%?/.exec(N),A=O[1],x=parseInt(O[2]);if(h(g.similarities[y]*100,A,x))return!0}return!1});function h(g,E,T){switch(E){case">":return g>T;case"<":return g=":return g>=T;case"<=":return g<=T;default:return!1}}}function a(_){_.sort((f,m)=>m.similarities[_e().uiState.comparisonTableSortingMetric]-f.similarities[_e().uiState.comparisonTableSortingMetric]),_e().uiState.comparisonTableClusterSorting&&(_.sort((f,m)=>m.clusterIndex-f.clusterIndex),_.sort((f,m)=>s(m.clusterIndex).averageSimilarity-s(f.clusterIndex).averageSimilarity));let p=0;return _.forEach(f=>{f.sortingPlace=p++}),_}function s(_){return _<0||!e.clusters?{averageSimilarity:0}:e.clusters[_]}const o=e.clusters!=null;let l=[];e.clusters!=null&&(l=MU(e.clusters.length));const c=Te(()=>l.map(_=>`hsla(${_}, ${_e().uiState.useDarkMode?jB:QB}%, ${_e().uiState.useDarkMode?JB:XB}%, ${_e().uiState.useDarkMode?e2:ZB})`));function d(_){return e.highlightedRowIds!=null&&(_.firstSubmissionId==e.highlightedRowIds.firstId&&_.secondSubmissionId==e.highlightedRowIds.secondId||_.firstSubmissionId==e.highlightedRowIds.secondId&&_.secondSubmissionId==e.highlightedRowIds.firstId)}const u=Ne(null);return Un(Te(()=>e.highlightedRowIds),(_,p)=>{var f;_!=null&&((_==null?void 0:_.firstId)!=(p==null?void 0:p.firstId)||(_==null?void 0:_.secondId)!=(p==null?void 0:p.secondId))&&((f=u.value)==null||f.scrollToItem(e.topComparisons.findIndex(d)))}),(_,p)=>{const f=$s("RouterLink");return ae(),he("div",IB,[te(AB,{"search-string":i.value,"onUpdate:searchString":p[0]||(p[0]=m=>i.value=m),"enable-cluster-sorting":t.clusters!=null,header:t.header},null,8,["search-string","enable-cluster-sorting","header"]),Q("div",xB,[Q("div",DB,[Q("div",wB,[p[2]||(p[2]=Q("div",{class:"tableCellNumber"},null,-1)),p[3]||(p[3]=Q("div",{class:"tableCellName items-center"},"Submissions in Comparison",-1)),Q("div",MB,[p[1]||(p[1]=Q("div",null,"Similarity",-1)),Q("div",LB,[te(Jt,{class:"flex-1",direction:o?"top":"left"},{default:re(()=>[Q("p",PB,le(fe(bn)[fe(Ze).AVERAGE].shortName),1)]),tooltip:re(()=>[Q("p",kB,le(fe(bn)[fe(Ze).AVERAGE].tooltip),1)]),_:1},8,["direction"]),te(Jt,{class:"flex-1",direction:o?"top":"left"},{default:re(()=>[Q("p",FB,le(fe(bn)[fe(Ze).MAXIMUM].shortName),1)]),tooltip:re(()=>[Q("p",UB,le(fe(bn)[fe(Ze).MAXIMUM].tooltip),1)]),_:1},8,["direction"])])]),o?(ae(),he("div",BB,"Cluster")):dt("",!0)])]),Q("div",GB,[t.topComparisons.length>0?(ae(),Ye(fe(Fs),{key:0,items:n.value,"min-item-size":48,ref_key:"dynamicScroller",ref:u},{default:re(({item:m,index:h,active:g})=>[te(fe(Ml),{item:m,active:g,"size-dependencies":[m.firstSubmissionId,m.secondSubmissionId,fe(_e)().isAnonymous(m.firstSubmissionId),fe(_e)().isAnonymous(m.secondSubmissionId)],"data-index":h},{default:re(()=>[Q("div",{class:en(["tableRow",{"bg-container-secondary-light dark:bg-container-secondary-dark":m.id%2==1,"!bg-accent !bg-opacity-30":d(m)}])},[te(f,{to:{name:"ComparisonView",params:{comparisonFileName:fe(_e)().getComparisonFileName(m.firstSubmissionId,m.secondSubmissionId)}},class:"flex flex-grow cursor-pointer flex-row"},{default:re(()=>[Q("div",YB,[Q("div",zB,le(m.sortingPlace+1),1)]),Q("div",HB,[te(fS,{id:m.firstSubmissionId,class:"h-full w-1/2 px-2"},null,8,["id"]),te(fS,{id:m.secondSubmissionId,class:"h-full w-1/2 px-2"},null,8,["id"])]),Q("div",VB,[Q("div",qB,le((m.similarities[fe(Ze).AVERAGE]*100).toFixed(2))+"% ",1),Q("div",$B,le((m.similarities[fe(Ze).MAXIMUM]*100).toFixed(2))+"% ",1)])]),_:2},1032,["to"]),o?(ae(),he("div",WB,[m.clusterIndex>=0?(ae(),Ye(f,{key:0,to:{name:"ClusterView",params:{clusterIndex:m.clusterIndex}},class:"flex w-full justify-center text-center"},{default:re(()=>[te(Jt,{class:"w-fit",direction:"left","tool-tip-container-will-be-centered":!0},{default:re(()=>{var E,T,b;return[be(le((T=(E=t.clusters)==null?void 0:E[m.clusterIndex].members)==null?void 0:T.length)+" ",1),te(fe(Ji),{icon:["fas","user-group"],style:$t({color:c.value[m.clusterIndex]})},null,8,["style"]),be(" "+le((((b=t.clusters)==null?void 0:b[m.clusterIndex].averageSimilarity)*100).toFixed(2))+"% ",1)]}),tooltip:re(()=>{var E,T,b;return[Q("p",KB,le((T=(E=t.clusters)==null?void 0:E[m.clusterIndex].members)==null?void 0:T.length)+" submissions in cluster with average similarity of "+le((((b=t.clusters)==null?void 0:b[m.clusterIndex].averageSimilarity)*100).toFixed(2))+"% ",1)]}),_:2},1024)]),_:2},1032,["to"])):dt("",!0)])):dt("",!0)],2)]),_:2},1032,["item","active","size-dependencies","data-index"])]),after:re(()=>[yt(_.$slots,"footer",{},void 0,!0)]),_:3},8,["items"])):dt("",!0)])])])}}}),Vm=Ks(t2,[["__scopeId","data-v-620fecd5"]]),n2={class:"print:flex-none"},we=Pe({__name:"TextInformation",props:{label:{type:String,required:!0},tooltipSide:{type:String,required:!1,default:"bottom"}},setup(t){return(e,n)=>(ae(),he("div",n2,[te(Jt,{direction:t.tooltipSide},Ef({default:re(()=>[be(le(t.label)+": ",1),Q("i",null,[yt(e.$slots,"default")])]),_:2},[e.$slots.tooltip?{name:"tooltip",fn:re(()=>[yt(e.$slots,"tooltip")]),key:"0"}:void 0]),1032,["direction"])]))}}),i2={class:"absolute bottom-0 left-0 right-0 top-0 flex flex-col"},r2={class:"relative left-0 right-0 top-0 flex space-x-5 p-5 pb-0"},a2={class:"flex flex-row items-center space-x-5 print:flex-col print:items-start print:space-x-0"},s2={class:"whitespace-pre text-sm"},o2={key:0},l2={class:"relative bottom-0 left-0 right-0 flex flex-grow space-x-5 px-5 pb-7 pt-5 print:flex-col print:space-x-0 print:space-y-5"},c2=Pe({__name:"OverviewView",props:{overview:{type:Object,required:!0}},setup(t){const e=t;document.title=`${_e().state.uploadedFileName} - JPlag Report Viewer`;const n=Te(()=>e.overview.submissionFolderPath.length>1),i=Te(()=>n.value?"Click More to see all paths":e.overview.submissionFolderPath[0]);return wr(r=>(Wn(r,`Error displaying overview:
+`),!1)),(r,a)=>(ae(),he("div",i2,[Q("div",r2,[te(gn,{class:"flex-grow"},{default:re(()=>[a[5]||(a[5]=Q("h2",null,"JPlag Report",-1)),Q("div",a2,[te(we,{label:"Submission Directory",class:"flex-auto"},{default:re(()=>[be(le(i.value),1)]),_:1}),te(we,{label:"Result name",class:"flex-auto"},{default:re(()=>[be(le(fe(_e)().state.uploadedFileName),1)]),_:1}),te(we,{label:"Total Submissions",class:"flex-auto"},{default:re(()=>[be(le(fe(_e)().getSubmissionIds.length),1)]),_:1}),te(we,{label:"Shown/Total Comparisons",class:"flex-auto"},{default:re(()=>[be(le(t.overview.shownComparisons)+" / "+le(t.overview.totalComparisons),1)]),tooltip:re(()=>[Q("div",s2,[te(we,{label:"Shown Comparisons"},{default:re(()=>[be(le(t.overview.shownComparisons),1)]),_:1}),te(we,{label:"Total Comparisons"},{default:re(()=>[be(le(t.overview.totalComparisons),1)]),_:1}),t.overview.missingComparisons>0?(ae(),he("div",o2,[te(we,{label:"Missing Comparisons"},{default:re(()=>[be(le(t.overview.missingComparisons),1)]),_:1}),a[1]||(a[1]=Q("p",null," To include more comparisons in the report modify the number of shown comparisons in the CLI. ",-1))])):dt("",!0)])]),_:1}),te(we,{label:"Min Token Match",class:"flex-auto"},{default:re(()=>[be(le(t.overview.matchSensitivity),1)]),tooltip:re(()=>a[2]||(a[2]=[Q("div",{class:"whitespace-pre text-sm"},[Q("p",null," Tunes the comparison sensitivity by adjusting the minimum token required to be counted as a matching section. "),Q("p",null,"It can be adjusted in the CLI.")],-1)])),_:1}),te(Jt,{direction:"left",class:"flex-grow-0 print:hidden"},{default:re(()=>[te(ga,{onClick:a[0]||(a[0]=s=>fe(Sa).push({name:"InfoView"}))},{default:re(()=>a[3]||(a[3]=[be(" More ")])),_:1})]),tooltip:re(()=>a[4]||(a[4]=[Q("p",{class:"whitespace-pre text-sm"},"More information about the CLI run of JPlag",-1)])),_:1})])]),_:1})]),Q("div",l2,[te(gn,{class:"flex max-h-0 min-h-full flex-1 flex-col print:max-h-none print:min-h-fit print:flex-none"},{default:re(()=>[a[6]||(a[6]=Q("h2",null,"Distribution of Comparisons:",-1)),te(WU,{distributions:t.overview.distribution,class:"flex-grow"},null,8,["distributions"])]),_:1}),te(gn,{class:"flex max-h-0 min-h-full flex-1 flex-col print:hidden"},{default:re(()=>[te(Vm,{clusters:t.overview.clusters,"top-comparisons":t.overview.topComparisons,class:"min-h-0 flex-1 print:min-h-full print:flex-grow"},Ef({_:2},[t.overview.topComparisons.length[a[7]||(a[7]=Q("p",{class:"w-full pt-1 text-center font-bold"}," Not all comparisons are shown. To see more, re-run JPlag with a higher maximum number argument. ",-1))]),key:"0"}:void 0]),1032,["clusters","top-comparisons"])]),_:1})])]))}}),d2={key:1,class:"absolute bottom-0 left-0 right-0 top-0 flex flex-col items-center justify-center"},u2=Pe({__name:"OverviewViewWrapper",setup(t){const e=Ne(null);return Ea.getOverview().then(n=>{e.value=n}).catch(n=>{Wn(n,`Could not load overview:
+`)}),(n,i)=>(ae(),he("div",null,[e.value?(ae(),Ye(c2,{key:0,overview:e.value},null,8,["overview"])):(ae(),he("div",d2,[te(js,{class:"mx-auto"})])),te(Zs)]))}}),_2={class:"flex h-fit min-w-0 max-w-full flex-row space-x-1 overflow-x-hidden text-xs print:hidden"},p2={class:"whitespace-pre text-sm"},m2={key:0},f2={key:1},g2={key:0},h2={key:1},E2={class:"whitespace-pre text-sm"},S2={key:0},b2={class:"hidden print:block"},T2={"aria-describedby":"List of matches for printing"},v2={class:"px-2 text-left"},y2={class:"px-2 text-left"},C2={class:"px-2"},R2={class:"px-2"},O2={class:"px-2"},N2={class:"px-2"},A2={class:"px-2"},I2=Pe({__name:"MatchList",props:{matches:{type:Array,required:!0},id1:{type:String,required:!0},id2:{type:String,required:!0},basecodeInFirst:{type:Array,required:!1,default:()=>[]},basecodeInSecond:{type:Array,required:!1,default:()=>[]}},emits:["matchSelected"],setup(t){const e=t;function n(c){return c.split(/[/\\]/g).pop()||""}function i(c){var d;return c==0?"right":c>=2&&c+2>=(((d=e.matches)==null?void 0:d.length)??1/0)?"left":"bottom"}function r(c){return!isNaN(c.startInFirst.tokenListIndex)&&!isNaN(c.startInSecond.tokenListIndex)&&!isNaN(c.endInFirst.tokenListIndex)&&!isNaN(c.endInSecond.tokenListIndex)}const a=Ne(null),s=Ne(0);function o(){a.value&&(s.value=a.value.scrollLeft)}const l=Te(()=>e.basecodeInFirst.length>0||e.basecodeInSecond.length>0);return(c,d)=>{var u,_;return ae(),he(pt,null,[Q("div",_2,[l.value?(ae(),Ye(Jt,{key:0,direction:"right",class:"pr-3"},{default:re(()=>[te(_s,{label:"Base Code",style:$t({background:fe(Ga)(.3,"base")})},null,8,["style"])]),tooltip:re(()=>[Q("div",p2,[d[1]||(d[1]=be(" Sections that are likely base code (thus ignored in similarity calculation). ")),d[2]||(d[2]=Q("br",null,null,-1)),Q("p",null,[be(le(fe(_e)().getDisplayName(t.id1))+": ",1),t.basecodeInFirst.length>0?(ae(),he("span",m2,le(t.basecodeInFirst.map(p=>p.match.tokens).reduce((p,f)=>p+f,0))+" Tokens, Lines: "+le(fe(_e)().getDisplayName(t.id1??""))+": Lines "+le(t.basecodeInFirst.map(p=>`${p.start}-${p.end}`).join(",")),1)):(ae(),he("span",f2,"No Basecode in Submission"))]),Q("p",null,[be(le(fe(_e)().getDisplayName(t.id2))+": ",1),t.basecodeInSecond.length>0?(ae(),he("span",g2,le(t.basecodeInSecond.map(p=>p.match.tokens).reduce((p,f)=>p+f,0))+" Tokens, Lines: "+le(fe(_e)().getDisplayName(t.id2??""))+": Lines "+le(t.basecodeInSecond.map(p=>`${p.start}-${p.end}`).join(",")),1)):(ae(),he("span",h2,"No Basecode in Submission"))])])]),_:1})):dt("",!0),te(Jt,{direction:"right"},{default:re(()=>[te(_s,{label:"Match Files: TokenCount"})]),tooltip:re(()=>d[3]||(d[3]=[Q("p",{class:"whitespace-pre text-sm"},"Click on a match to show it in the code view.",-1)])),_:1}),Q("div",{class:"print-exact flex w-full flex-row space-x-1 overflow-x-auto print:flex-wrap print:space-y-1 print:overflow-x-hidden",ref_key:"scrollableList",ref:a,onScroll:d[0]||(d[0]=p=>o())},[(ae(!0),he(pt,null,Vn((u=t.matches)==null?void 0:u.entries(),([p,f])=>(ae(),Ye(Jt,{direction:i(p),key:p,scrollOffsetX:s.value},{default:re(()=>[te(_s,{style:$t({background:fe(Ga)(.3,f.colorIndex)}),onClick:m=>c.$emit("matchSelected",f),label:n(f.firstFile)+" - "+n(f.secondFile)+": "+f.tokens},null,8,["style","onClick","label"])]),tooltip:re(()=>[Q("p",E2,[be(" Match between "+le(n(f.firstFile))+" (Line "+le(f.startInFirst.line)+"-"+le(f.endInFirst.line)+") and "+le(n(f.secondFile))+" (Line "+le(f.startInSecond.line)+"-"+le(f.endInSecond.line)+") ",1),d[5]||(d[5]=Q("br",null,null,-1)),be(" Match is "+le(f.tokens)+" tokens long. ",1),d[6]||(d[6]=Q("br",null,null,-1)),r(f)?(ae(),he("span",S2,[be(" Token indices of match: "+le(f.startInFirst.tokenListIndex)+"-"+le(f.endInFirst.tokenListIndex)+" and "+le(f.startInSecond.tokenListIndex)+"-"+le(f.endInSecond.tokenListIndex)+". ",1),d[4]||(d[4]=Q("br",null,null,-1))])):dt("",!0),d[7]||(d[7]=be(" Click to show in code view. "))])]),_:2},1032,["direction","scrollOffsetX"]))),128))],544)]),Q("div",b2,[Q("table",T2,[Q("tr",null,[Q("th",v2,"File of "+le(t.id1),1),d[8]||(d[8]=Q("th",{class:"px-2 text-left"},"Starting Line - End Line",-1)),Q("th",y2,"File of "+le(t.id2),1),d[9]||(d[9]=Q("th",{class:"px-2 text-left"},"Starting Line - End Line",-1)),d[10]||(d[10]=Q("th",{class:"px-2 text-left"},"Token Count",-1))]),(ae(!0),he(pt,null,Vn((_=t.matches)==null?void 0:_.entries(),([p,f])=>(ae(),he("tr",{key:p,style:$t({background:fe(Ga)(.3,f.colorIndex)}),class:"print-exact"},[Q("td",C2,le(n(f.firstFile)),1),Q("td",R2,le(f.startInFirst)+" - "+le(f.endInFirst),1),Q("td",O2,le(n(f.secondFile)),1),Q("td",N2,le(f.startInSecond)+" - "+le(f.endInSecond),1),Q("td",A2,le(f.tokens),1)],4))),128)),l.value?(ae(),he("tr",{key:0,style:$t({background:fe(Ga)(.3,"base")}),class:"print-exact"},d[11]||(d[11]=[Q("td",{class:"px-2",colspan:"5"},"Basecode in submissions",-1)]),4)):dt("",!0)])])],64)}}});function KO(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],i=typeof n;(i==="object"||i==="function")&&!Object.isFrozen(n)&&KO(n)}),t}class gS{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function QO(t){return t.replace(/&/g,"&").replace(/