scope360-core 0.0.228 → 0.0.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,7 @@
36
36
  * Released under the MIT License
37
37
  */class Fx{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,r,s){const i=n.listeners[s],a=n.duration;i.forEach(l=>l({chart:e,initial:n.initial,numSteps:a,currentStep:Math.min(r-n.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=zm.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((r,s)=>{if(!r.running||!r.items.length)return;const i=r.items;let a=i.length-1,l=!1,c;for(;a>=0;--a)c=i[a],c._active?(c._total>r.duration&&(r.duration=c._total),c.tick(e),l=!0):(i[a]=i[i.length-1],i.pop());l&&(s.draw(),this._notify(s,r,e,"progress")),i.length||(r.running=!1,this._notify(s,r,e,"complete"),r.initial=!1),n+=i.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let r=n.get(e);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,r)),r}listen(e,n,r){this._getAnims(e).listeners[n].push(r)}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((r,s)=>Math.max(r,s._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 r=n.items;let s=r.length-1;for(;s>=0;--s)r[s].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var yr=new Fx;const fp="transparent",Rx={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const r=Um(t||fp),s=r.valid&&Um(e||fp);return s&&s.valid?s.mix(r,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class Ix{constructor(e,n,r,s){const i=n[r];s=ul([e.to,s,i,e.from]);const a=ul([e.from,i,s]);this._active=!0,this._fn=e.fn||Rx[e.type||typeof a],this._easing=Eo[e.easing]||Eo.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=r,this._from=a,this._to=s,this._promises=void 0}active(){return this._active}update(e,n,r){if(this._active){this._notify(!1);const s=this._target[this._prop],i=r-this._start,a=this._duration-i;this._start=r,this._duration=Math.floor(Math.max(a,e.duration)),this._total+=i,this._loop=!!e.loop,this._to=ul([e.to,n,s,e.from]),this._from=ul([e.from,s,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,r=this._duration,s=this._prop,i=this._from,a=this._loop,l=this._to;let c;if(this._active=i!==l&&(a||n<r),!this._active){this._target[s]=l,this._notify(!0);return}if(n<0){this._target[s]=i;return}c=n/r%2,c=a&&c>1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[s]=this._fn(i,l,c)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,r)=>{e.push({res:n,rej:r})})}_notify(e){const n=e?"res":"rej",r=this._promises||[];for(let s=0;s<r.length;s++)r[s][n]()}}class mp{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!Te(e))return;const n=Object.keys(gt.animation),r=this._properties;Object.getOwnPropertyNames(e).forEach(s=>{const i=e[s];if(!Te(i))return;const a={};for(const l of n)a[l]=i[l];(st(i.properties)&&i.properties||[s]).forEach(l=>{(l===s||!r.has(l))&&r.set(l,a)})})}_animateOptions(e,n){const r=n.options,s=zx(e,r);if(!s)return[];const i=this._createAnimations(s,r);return r.$shared&&Hx(e.options.$animations,r).then(()=>{e.options=r},()=>{}),i}_createAnimations(e,n){const r=this._properties,s=[],i=e.$animations||(e.$animations={}),a=Object.keys(n),l=Date.now();let c;for(c=a.length-1;c>=0;--c){const d=a[c];if(d.charAt(0)==="$")continue;if(d==="options"){s.push(...this._animateOptions(e,n));continue}const u=n[d];let h=i[d];const f=r.get(d);if(h)if(f&&h.active()){h.update(f,u,l);continue}else h.cancel();if(!f||!f.duration){e[d]=u;continue}i[d]=h=new Ix(f,e,d,u),s.push(h)}return s}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const r=this._createAnimations(e,n);if(r.length)return yr.add(this._chart,r),!0}}function Hx(t,e){const n=[],r=Object.keys(e);for(let s=0;s<r.length;s++){const i=t[r[s]];i&&i.active()&&n.push(i.wait())}return Promise.all(n)}function zx(t,e){if(!e)return;let n=t.options;if(!n){t.options=e;return}return n.$shared&&(t.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function pp(t,e){const n=t&&t.options||{},r=n.reverse,s=n.min===void 0?e:0,i=n.max===void 0?e:0;return{start:r?i:s,end:r?s:i}}function Yx(t,e,n){if(n===!1)return!1;const r=pp(t,n),s=pp(e,n);return{top:s.end,right:r.end,bottom:s.start,left:r.start}}function Wx(t){let e,n,r,s;return Te(t)?(e=t.top,n=t.right,r=t.bottom,s=t.left):e=n=r=s=t,{top:e,right:n,bottom:r,left:s,disabled:t===!1}}function gp(t,e){const n=[],r=t._getSortedDatasetMetas(e);let s,i;for(s=0,i=r.length;s<i;++s)n.push(r[s].index);return n}function _p(t,e,n,r={}){const s=t.keys,i=r.mode==="single";let a,l,c,d;if(e!==null){for(a=0,l=s.length;a<l;++a){if(c=+s[a],c===n){if(r.all)continue;break}d=t.values[c],lt(d)&&(i||e===0||xi(e)===xi(d))&&(e+=d)}return e}}function jx(t){const e=Object.keys(t),n=new Array(e.length);let r,s,i;for(r=0,s=e.length;r<s;++r)i=e[r],n[r]={x:i,y:t[i]};return n}function yp(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function Zx(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function Ux(t){const{min:e,max:n,minDefined:r,maxDefined:s}=t.getUserBounds();return{min:r?e:Number.NEGATIVE_INFINITY,max:s?n:Number.POSITIVE_INFINITY}}function qx(t,e,n){const r=t[e]||(t[e]={});return r[n]||(r[n]={})}function wp(t,e,n,r){for(const s of e.getMatchingVisibleMetas(r).reverse()){const i=t[s.index];if(n&&i>0||!n&&i<0)return s.index}return null}function bp(t,e){const{chart:n,_cachedMeta:r}=t,s=n._stacks||(n._stacks={}),{iScale:i,vScale:a,index:l}=r,c=i.axis,d=a.axis,u=Zx(i,a,r),h=e.length;let f;for(let m=0;m<h;++m){const g=e[m],{[c]:p,[d]:_}=g,y=g._stacks||(g._stacks={});f=y[d]=qx(s,u,p),f[l]=_,f._top=wp(f,a,!0,r.type),f._bottom=wp(f,a,!1,r.type);const C=f._visualValues||(f._visualValues={});C[l]=_}}function Hu(t,e){const n=t.scales;return Object.keys(n).filter(r=>n[r].axis===e).shift()}function Gx(t,e){return ts(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Kx(t,e,n){return ts(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function Lo(t,e){const n=t.controller.index,r=t.vScale&&t.vScale.axis;if(r){e=e||t._parsed;for(const s of e){const i=s._stacks;if(!i||i[r]===void 0||i[r][n]===void 0)return;delete i[r][n],i[r]._visualValues!==void 0&&i[r]._visualValues[n]!==void 0&&delete i[r]._visualValues[n]}}}const zu=t=>t==="reset"||t==="none",kp=(t,e)=>e?t:Object.assign({},t),Xx=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:gp(n,!0),values:null};class Vo{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=yp(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&&Lo(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,r=this.getDataset(),s=(h,f,m,g)=>h==="x"?f:h==="r"?g:m,i=n.xAxisID=Fe(r.xAxisID,Hu(e,"x")),a=n.yAxisID=Fe(r.yAxisID,Hu(e,"y")),l=n.rAxisID=Fe(r.rAxisID,Hu(e,"r")),c=n.indexAxis,d=n.iAxisID=s(c,i,a,l),u=n.vAxisID=s(c,a,i,l);n.xScale=this.getScaleForId(i),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(l),n.iScale=this.getScaleForId(d),n.vScale=this.getScaleForId(u)}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&&Hm(this._data,this),e._stacked&&Lo(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),r=this._data;if(Te(n))this._data=jx(n);else if(r!==n){if(r){Hm(r,this);const s=this._cachedMeta;Lo(s),s._parsed=[]}n&&Object.isExtensible(n)&&OC(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,r=this.getDataset();let s=!1;this._dataCheck();const i=n._stacked;n._stacked=yp(n.vScale,n),n.stack!==r.stack&&(s=!0,Lo(n),n.stack=r.stack),this._resyncElements(e),(s||i!==n._stacked)&&bp(this,n._parsed)}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),r=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:r,_data:s}=this,{iScale:i,_stacked:a}=r,l=i.axis;let c=e===0&&n===s.length?!0:r._sorted,d=e>0&&r._parsed[e-1],u,h,f;if(this._parsing===!1)r._parsed=s,r._sorted=!0,f=s;else{st(s[e])?f=this.parseArrayData(r,s,e,n):Te(s[e])?f=this.parseObjectData(r,s,e,n):f=this.parsePrimitiveData(r,s,e,n);const m=()=>h[l]===null||d&&h[l]<d[l];for(u=0;u<n;++u)r._parsed[u+e]=h=f[u],c&&(m()&&(c=!1),d=h);r._sorted=c}a&&bp(this,f)}parsePrimitiveData(e,n,r,s){const{iScale:i,vScale:a}=e,l=i.axis,c=a.axis,d=i.getLabels(),u=i===a,h=new Array(s);let f,m,g;for(f=0,m=s;f<m;++f)g=f+r,h[f]={[l]:u||i.parse(d[g],g),[c]:a.parse(n[g],g)};return h}parseArrayData(e,n,r,s){const{xScale:i,yScale:a}=e,l=new Array(s);let c,d,u,h;for(c=0,d=s;c<d;++c)u=c+r,h=n[u],l[c]={x:i.parse(h[0],u),y:a.parse(h[1],u)};return l}parseObjectData(e,n,r,s){const{xScale:i,yScale:a}=e,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=new Array(s);let u,h,f,m;for(u=0,h=s;u<h;++u)f=u+r,m=n[f],d[u]={x:i.parse(sl(m,l),f),y:a.parse(sl(m,c),f)};return d}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,n,r){const s=this.chart,i=this._cachedMeta,a=n[e.axis],l={keys:gp(s,!0),values:n._stacks[e.axis]._visualValues};return _p(l,a,i.index,{mode:r})}updateRangeFromParsed(e,n,r,s){const i=r[n.axis];let a=i===null?NaN:i;const l=s&&r._stacks[n.axis];s&&l&&(s.values=l,a=_p(s,i,this._cachedMeta.index)),e.min=Math.min(e.min,a),e.max=Math.max(e.max,a)}getMinMax(e,n){const r=this._cachedMeta,s=r._parsed,i=r._sorted&&e===r.iScale,a=s.length,l=this._getOtherScale(e),c=Xx(n,r,this.chart),d={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:h}=Ux(l);let f,m;function g(){m=s[f];const p=m[l.axis];return!lt(m[e.axis])||u>p||h<p}for(f=0;f<a&&!(!g()&&(this.updateRangeFromParsed(d,e,m,c),i));++f);if(i){for(f=a-1;f>=0;--f)if(!g()){this.updateRangeFromParsed(d,e,m,c);break}}return d}getAllParsedValues(e){const n=this._cachedMeta._parsed,r=[];let s,i,a;for(s=0,i=n.length;s<i;++s)a=n[s][e.axis],lt(a)&&r.push(a);return r}getMaxOverflow(){return!1}getLabelAndValue(e){const n=this._cachedMeta,r=n.iScale,s=n.vScale,i=this.getParsed(e);return{label:r?""+r.getLabelForValue(i[r.axis]):"",value:s?""+s.getLabelForValue(i[s.axis]):""}}_update(e){const n=this._cachedMeta;this.update(e||"default"),n._clip=Wx(Fe(this.options.clip,Yx(n.xScale,n.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,n=this.chart,r=this._cachedMeta,s=r.data||[],i=n.chartArea,a=[],l=this._drawStart||0,c=this._drawCount||s.length-l,d=this.options.drawActiveElementsOnTop;let u;for(r.dataset&&r.dataset.draw(e,i,l,c),u=l;u<l+c;++u){const h=s[u];h.hidden||(h.active&&d?a.push(h):h.draw(e,i))}for(u=0;u<a.length;++u)a[u].draw(e,i)}getStyle(e,n){const r=n?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(e||0,r)}getContext(e,n,r){const s=this.getDataset();let i;if(e>=0&&e<this._cachedMeta.data.length){const a=this._cachedMeta.data[e];i=a.$context||(a.$context=Kx(this.getContext(),e,a)),i.parsed=this.getParsed(e),i.raw=s.data[e],i.index=i.dataIndex=e}else i=this.$context||(this.$context=Gx(this.chart.getContext(),this.index)),i.dataset=s,i.index=i.datasetIndex=this.index;return i.active=!!n,i.mode=r,i}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,n){return this._resolveElementOptions(this.dataElementType.id,n,e)}_resolveElementOptions(e,n="default",r){const s=n==="active",i=this._cachedDataOpts,a=e+"-"+n,l=i[a],c=this.enableOptionSharing&&il(r);if(l)return kp(l,c);const d=this.chart.config,u=d.datasetElementScopeKeys(this._type,e),h=s?[`${e}Hover`,"hover",e,""]:[e,""],f=d.getOptionScopes(this.getDataset(),u),m=Object.keys(gt.elements[e]),g=()=>this.getContext(r,s,n),p=d.resolveNamedOptions(f,m,g,h);return p.$shared&&(p.$shared=c,i[a]=Object.freeze(kp(p,c))),p}_resolveAnimations(e,n,r){const s=this.chart,i=this._cachedDataOpts,a=`animation-${n}`,l=i[a];if(l)return l;let c;if(s.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,n),f=u.getOptionScopes(this.getDataset(),h);c=u.createResolver(f,this.getContext(e,r,n))}const d=new mp(s,c&&c.animations);return c&&c._cacheable&&(i[a]=Object.freeze(d)),d}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||zu(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const r=this.resolveDataElementOptions(e,n),s=this._sharedOptions,i=this.getSharedOptions(r),a=this.includeOptions(n,i)||i!==s;return this.updateSharedOptions(i,n,r),{sharedOptions:i,includeOptions:a}}updateElement(e,n,r,s){zu(s)?Object.assign(e,r):this._resolveAnimations(n,s).update(e,r)}updateSharedOptions(e,n,r){e&&!zu(n)&&this._resolveAnimations(void 0,n).update(e,r)}_setStyle(e,n,r,s){e.active=s;const i=this.getStyle(n,s);this._resolveAnimations(n,r,s).update(e,{options:!s&&this.getSharedOptions(i)||i})}removeHoverStyle(e,n,r){this._setStyle(e,r,"active",!1)}setHoverStyle(e,n,r){this._setStyle(e,r,"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,r=this._cachedMeta.data;for(const[l,c,d]of this._syncList)this[l](c,d);this._syncList=[];const s=r.length,i=n.length,a=Math.min(i,s);a&&this.parse(0,a),i>s?this._insertElements(s,i-s,e):i<s&&this._removeElements(i,s-i)}_insertElements(e,n,r=!0){const s=this._cachedMeta,i=s.data,a=e+n;let l;const c=d=>{for(d.length+=n,l=d.length-1;l>=a;l--)d[l]=d[l-n]};for(c(i),l=e;l<a;++l)i[l]=new this.dataElementType;this._parsing&&c(s._parsed),this.parse(e,n),r&&this.updateElements(i,e,n,"reset")}updateElements(e,n,r,s){}_removeElements(e,n){const r=this._cachedMeta;if(this._parsing){const s=r._parsed.splice(e,n);r._stacked&&Lo(r,s)}r.data.splice(e,n)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[n,r,s]=e;this[n](r,s)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,n){n&&this._sync(["_removeElements",e,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",e,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}W(Vo,"defaults",{}),W(Vo,"datasetElementType",null),W(Vo,"dataElementType",null);class gl extends Vo{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const n=this._cachedMeta,{dataset:r,data:s=[],_dataset:i}=n,a=this.chart._animationsDisabled;let{start:l,count:c}=LC(n,s,a);this._drawStart=l,this._drawCount=c,VC(n)&&(l=0,c=s.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!i._decimated,r.points=s;const d=this.resolveDatasetElementOptions(e);this.options.showLine||(d.borderWidth=0),d.segment=this.options.segment,this.updateElement(r,void 0,{animated:!a,options:d},e),this.updateElements(s,l,c,e)}updateElements(e,n,r,s){const i=s==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,{sharedOptions:u,includeOptions:h}=this._getSharedOptions(n,s),f=a.axis,m=l.axis,{spanGaps:g,segment:p}=this.options,_=Oo(g)?g:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||i||s==="none",C=n+r,k=e.length;let v=n>0&&this.getParsed(n-1);for(let M=0;M<k;++M){const T=e[M],S=y?T:{};if(M<n||M>=C){S.skip=!0;continue}const O=this.getParsed(M),E=Ue(O[m]),I=S[f]=a.getPixelForValue(O[f],M),j=S[m]=i||E?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,O,c):O[m],M);S.skip=isNaN(I)||isNaN(j)||E,S.stop=M>0&&Math.abs(O[f]-v[f])>_,p&&(S.parsed=O,S.raw=d.data[M]),h&&(S.options=u||this.resolveDataElementOptions(M,T.active?"active":s)),y||this.updateElement(T,M,S,s),v=O}}getMaxOverflow(){const e=this._cachedMeta,n=e.dataset,r=n.options&&n.options.borderWidth||0,s=e.data||[];if(!s.length)return r;const i=s[0].size(this.resolveDataElementOptions(0)),a=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(r,i,a)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}W(gl,"id","line"),W(gl,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),W(gl,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function Bs(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Yu{constructor(e){W(this,"options");this.options=e||{}}static override(e){Object.assign(Yu.prototype,e)}init(){}formats(){return Bs()}parse(){return Bs()}format(){return Bs()}add(){return Bs()}diff(){return Bs()}startOf(){return Bs()}endOf(){return Bs()}}var Jx={_date:Yu};function Qx(t,e,n,r){const{controller:s,data:i,_sorted:a}=t,l=s._cachedMeta.iScale;if(l&&e===l.axis&&e!=="r"&&a&&i.length){const c=l._reversePixels?TC:Es;if(r){if(s._sharedOptions){const d=i[0],u=typeof d.getRange=="function"&&d.getRange(e);if(u){const h=c(i,e,n-u),f=c(i,e,n+u);return{lo:h.lo,hi:f.hi}}}}else return c(i,e,n)}return{lo:0,hi:i.length-1}}function No(t,e,n,r,s){const i=t.getSortedVisibleDatasetMetas(),a=n[e];for(let l=0,c=i.length;l<c;++l){const{index:d,data:u}=i[l],{lo:h,hi:f}=Qx(i[l],e,a,s);for(let m=h;m<=f;++m){const g=u[m];g.skip||r(g,d,m)}}}function eM(t){const e=t.indexOf("x")!==-1,n=t.indexOf("y")!==-1;return function(r,s){const i=e?Math.abs(r.x-s.x):0,a=n?Math.abs(r.y-s.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(a,2))}}function Wu(t,e,n,r,s){const i=[];return!s&&!t.isPointInArea(e)||No(t,n,e,function(l,c,d){!s&&!_r(l,t.chartArea,0)||l.inRange(e.x,e.y,r)&&i.push({element:l,datasetIndex:c,index:d})},!0),i}function tM(t,e,n,r){let s=[];function i(a,l,c){const{startAngle:d,endAngle:u}=a.getProps(["startAngle","endAngle"],r),{angle:h}=MC(a,{x:e.x,y:e.y});Fm(h,d,u)&&s.push({element:a,datasetIndex:l,index:c})}return No(t,n,e,i),s}function nM(t,e,n,r,s,i){let a=[];const l=eM(n);let c=Number.POSITIVE_INFINITY;function d(u,h,f){const m=u.inRange(e.x,e.y,s);if(r&&!m)return;const g=u.getCenterPoint(s);if(!(!!i||t.isPointInArea(g))&&!m)return;const _=l(e,g);_<c?(a=[{element:u,datasetIndex:h,index:f}],c=_):_===c&&a.push({element:u,datasetIndex:h,index:f})}return No(t,n,e,d),a}function ju(t,e,n,r,s,i){return!i&&!t.isPointInArea(e)?[]:n==="r"&&!r?tM(t,e,n,s):nM(t,e,n,r,s,i)}function Cp(t,e,n,r,s){const i=[],a=n==="x"?"inXRange":"inYRange";let l=!1;return No(t,n,e,(c,d,u)=>{c[a](e[n],s)&&(i.push({element:c,datasetIndex:d,index:u}),l=l||c.inRange(e.x,e.y,s))}),r&&!l?[]:i}var rM={evaluateInteractionItems:No,modes:{index(t,e,n,r){const s=Vs(e,t),i=n.axis||"x",a=n.includeInvisible||!1,l=n.intersect?Wu(t,s,i,r,a):ju(t,s,i,!1,r,a),c=[];return l.length?(t.getSortedVisibleDatasetMetas().forEach(d=>{const u=l[0].index,h=d.data[u];h&&!h.skip&&c.push({element:h,datasetIndex:d.index,index:u})}),c):[]},dataset(t,e,n,r){const s=Vs(e,t),i=n.axis||"xy",a=n.includeInvisible||!1;let l=n.intersect?Wu(t,s,i,r,a):ju(t,s,i,!1,r,a);if(l.length>0){const c=l[0].datasetIndex,d=t.getDatasetMeta(c).data;l=[];for(let u=0;u<d.length;++u)l.push({element:d[u],datasetIndex:c,index:u})}return l},point(t,e,n,r){const s=Vs(e,t),i=n.axis||"xy",a=n.includeInvisible||!1;return Wu(t,s,i,r,a)},nearest(t,e,n,r){const s=Vs(e,t),i=n.axis||"xy",a=n.includeInvisible||!1;return ju(t,s,i,n.intersect,r,a)},x(t,e,n,r){const s=Vs(e,t);return Cp(t,s,"x",n.intersect,r)},y(t,e,n,r){const s=Vs(e,t);return Cp(t,s,"y",n.intersect,r)}}};const xp=["left","top","right","bottom"];function Bo(t,e){return t.filter(n=>n.pos===e)}function Mp(t,e){return t.filter(n=>xp.indexOf(n.pos)===-1&&n.box.axis===e)}function Ao(t,e){return t.sort((n,r)=>{const s=e?r:n,i=e?n:r;return s.weight===i.weight?s.index-i.index:s.weight-i.weight})}function sM(t){const e=[];let n,r,s,i,a,l;for(n=0,r=(t||[]).length;n<r;++n)s=t[n],{position:i,options:{stack:a,stackWeight:l=1}}=s,e.push({index:n,box:s,pos:i,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&i+a,stackWeight:l});return e}function iM(t){const e={};for(const n of t){const{stack:r,pos:s,stackWeight:i}=n;if(!r||!xp.includes(s))continue;const a=e[r]||(e[r]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=i}return e}function oM(t,e){const n=iM(t),{vBoxMaxWidth:r,hBoxMaxHeight:s}=e;let i,a,l;for(i=0,a=t.length;i<a;++i){l=t[i];const{fullSize:c}=l.box,d=n[l.stack],u=d&&l.stackWeight/d.weight;l.horizontal?(l.width=u?u*r:c&&e.availableWidth,l.height=s):(l.width=r,l.height=u?u*s:c&&e.availableHeight)}return n}function aM(t){const e=sM(t),n=Ao(e.filter(d=>d.box.fullSize),!0),r=Ao(Bo(e,"left"),!0),s=Ao(Bo(e,"right")),i=Ao(Bo(e,"top"),!0),a=Ao(Bo(e,"bottom")),l=Mp(e,"x"),c=Mp(e,"y");return{fullSize:n,leftAndTop:r.concat(i),rightAndBottom:s.concat(c).concat(a).concat(l),chartArea:Bo(e,"chartArea"),vertical:r.concat(s).concat(c),horizontal:i.concat(a).concat(l)}}function Sp(t,e,n,r){return Math.max(t[n],e[n])+Math.max(t[r],e[r])}function vp(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 lM(t,e,n,r){const{pos:s,box:i}=n,a=t.maxPadding;if(!Te(s)){n.size&&(t[s]-=n.size);const h=r[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?i.height:i.width),n.size=h.size/h.count,t[s]+=n.size}i.getPadding&&vp(a,i.getPadding());const l=Math.max(0,e.outerWidth-Sp(a,t,"left","right")),c=Math.max(0,e.outerHeight-Sp(a,t,"top","bottom")),d=l!==t.w,u=c!==t.h;return t.w=l,t.h=c,n.horizontal?{same:d,other:u}:{same:u,other:d}}function cM(t){const e=t.maxPadding;function n(r){const s=Math.max(e[r]-t[r],0);return t[r]+=s,s}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function dM(t,e){const n=e.maxPadding;function r(s){const i={left:0,top:0,right:0,bottom:0};return s.forEach(a=>{i[a]=Math.max(e[a],n[a])}),i}return r(t?["left","right"]:["top","bottom"])}function Fo(t,e,n,r){const s=[];let i,a,l,c,d,u;for(i=0,a=t.length,d=0;i<a;++i){l=t[i],c=l.box,c.update(l.width||e.w,l.height||e.h,dM(l.horizontal,e));const{same:h,other:f}=lM(e,n,l,r);d|=h&&s.length,u=u||f,c.fullSize||s.push(l)}return d&&Fo(s,e,n,r)||u}function _l(t,e,n,r,s){t.top=n,t.left=e,t.right=e+r,t.bottom=n+s,t.width=r,t.height=s}function Tp(t,e,n,r){const s=n.padding;let{x:i,y:a}=e;for(const l of t){const c=l.box,d=r[l.stack]||{count:1,placed:0,weight:1},u=l.stackWeight/d.weight||1;if(l.horizontal){const h=e.w*u,f=d.size||c.height;il(d.start)&&(a=d.start),c.fullSize?_l(c,s.left,a,n.outerWidth-s.right-s.left,f):_l(c,e.left+d.placed,a,h,f),d.start=a,d.placed+=h,a=c.bottom}else{const h=e.h*u,f=d.size||c.width;il(d.start)&&(i=d.start),c.fullSize?_l(c,i,s.top,f,n.outerHeight-s.bottom-s.top):_l(c,i,e.top+d.placed,f,h),d.start=i,d.placed+=h,i=c.right}}e.x=i,e.y=a}var yl={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(n){e.draw(n)}}]},t.boxes.push(e)},removeBox(t,e){const n=t.boxes?t.boxes.indexOf(e):-1;n!==-1&&t.boxes.splice(n,1)},configure(t,e,n){e.fullSize=n.fullSize,e.position=n.position,e.weight=n.weight},update(t,e,n,r){if(!t)return;const s=yn(t.options.layout.padding),i=Math.max(e-s.width,0),a=Math.max(n-s.height,0),l=aM(t.boxes),c=l.vertical,d=l.horizontal;Re(t.boxes,p=>{typeof p.beforeLayout=="function"&&p.beforeLayout()});const u=c.reduce((p,_)=>_.box.options&&_.box.options.display===!1?p:p+1,0)||1,h=Object.freeze({outerWidth:e,outerHeight:n,padding:s,availableWidth:i,availableHeight:a,vBoxMaxWidth:i/2/u,hBoxMaxHeight:a/2}),f=Object.assign({},s);vp(f,yn(r));const m=Object.assign({maxPadding:f,w:i,h:a,x:s.left,y:s.top},s),g=oM(c.concat(d),h);Fo(l.fullSize,m,h,g),Fo(c,m,h,g),Fo(d,m,h,g)&&Fo(c,m,h,g),cM(m),Tp(l.leftAndTop,m,h,g),m.x+=m.w,m.y+=m.h,Tp(l.rightAndBottom,m,h,g),t.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},Re(l.chartArea,p=>{const _=p.box;Object.assign(_,t.chartArea),_.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class Dp{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,r){}removeEventListener(e,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,r,s){return n=Math.max(0,n||e.width),r=r||e.height,{width:n,height:Math.max(0,s?Math.floor(n/s):r)}}isAttached(e){return!0}updateConfig(e){}}class uM extends Dp{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const wl="$chartjs",hM={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Op=t=>t===null||t==="";function fM(t,e){const n=t.style,r=t.getAttribute("height"),s=t.getAttribute("width");if(t[wl]={initial:{height:r,width:s,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",Op(s)){const i=op(t,"width");i!==void 0&&(t.width=i)}if(Op(r))if(t.style.height==="")t.height=t.width/(e||2);else{const i=op(t,"height");i!==void 0&&(t.height=i)}return t}const Ep=Sx?{passive:!0}:!1;function mM(t,e,n){t&&t.addEventListener(e,n,Ep)}function pM(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,Ep)}function gM(t,e){const n=hM[t.type]||t.type,{x:r,y:s}=Vs(t,e);return{type:n,chart:e,native:t,x:r!==void 0?r:null,y:s!==void 0?s:null}}function bl(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function _M(t,e,n){const r=t.canvas,s=new MutationObserver(i=>{let a=!1;for(const l of i)a=a||bl(l.addedNodes,r),a=a&&!bl(l.removedNodes,r);a&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}function yM(t,e,n){const r=t.canvas,s=new MutationObserver(i=>{let a=!1;for(const l of i)a=a||bl(l.removedNodes,r),a=a&&!bl(l.addedNodes,r);a&&n()});return s.observe(document,{childList:!0,subtree:!0}),s}const Ro=new Map;let $p=0;function Pp(){const t=window.devicePixelRatio;t!==$p&&($p=t,Ro.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function wM(t,e){Ro.size||window.addEventListener("resize",Pp),Ro.set(t,e)}function bM(t){Ro.delete(t),Ro.size||window.removeEventListener("resize",Pp)}function kM(t,e,n){const r=t.canvas,s=r&&Ru(r);if(!s)return;const i=Ym((l,c)=>{const d=s.clientWidth;n(l,c),d<s.clientWidth&&n()},window),a=new ResizeObserver(l=>{const c=l[0],d=c.contentRect.width,u=c.contentRect.height;d===0&&u===0||i(d,u)});return a.observe(s),wM(t,i),a}function Zu(t,e,n){n&&n.disconnect(),e==="resize"&&bM(t)}function CM(t,e,n){const r=t.canvas,s=Ym(i=>{t.ctx!==null&&n(gM(i,t))},t);return mM(r,e,s),s}class xM extends Dp{acquireContext(e,n){const r=e&&e.getContext&&e.getContext("2d");return r&&r.canvas===e?(fM(e,n),r):null}releaseContext(e){const n=e.canvas;if(!n[wl])return!1;const r=n[wl].initial;["height","width"].forEach(i=>{const a=r[i];Ue(a)?n.removeAttribute(i):n.setAttribute(i,a)});const s=r.style||{};return Object.keys(s).forEach(i=>{n.style[i]=s[i]}),n.width=n.width,delete n[wl],!0}addEventListener(e,n,r){this.removeEventListener(e,n);const s=e.$proxies||(e.$proxies={}),a={attach:_M,detach:yM,resize:kM}[n]||CM;s[n]=a(e,n,r)}removeEventListener(e,n){const r=e.$proxies||(e.$proxies={}),s=r[n];if(!s)return;({attach:Zu,detach:Zu,resize:Zu}[n]||pM)(e,n,s),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,r,s){return Mx(e,n,r,s)}isAttached(e){const n=Ru(e);return!!(n&&n.isConnected)}}function MM(t){return!Fu()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?uM:xM}class As{constructor(){W(this,"x");W(this,"y");W(this,"active",!1);W(this,"options");W(this,"$animations")}tooltipPosition(e){const{x:n,y:r}=this.getProps(["x","y"],e);return{x:n,y:r}}hasValue(){return Oo(this.x)&&Oo(this.y)}getProps(e,n){const r=this.$animations;if(!n||!r)return this;const s={};return e.forEach(i=>{s[i]=r[i]&&r[i].active()?r[i]._to:this[i]}),s}}W(As,"defaults",{}),W(As,"defaultRoutes");function SM(t,e){const n=t.options.ticks,r=vM(t),s=Math.min(n.maxTicksLimit||r,r),i=n.major.enabled?DM(e):[],a=i.length,l=i[0],c=i[a-1],d=[];if(a>s)return OM(e,d,i,a/s),d;const u=TM(i,e,s);if(a>0){let h,f;const m=a>1?Math.round((c-l)/(a-1)):null;for(kl(e,d,u,Ue(m)?0:l-m,l),h=0,f=a-1;h<f;h++)kl(e,d,u,i[h],i[h+1]);return kl(e,d,u,c,Ue(m)?e.length:c+m),d}return kl(e,d,u),d}function vM(t){const e=t.options.offset,n=t._tickSize(),r=t._length/n+(e?0:1),s=t._maxLength/n;return Math.floor(Math.min(r,s))}function TM(t,e,n){const r=EM(t),s=e.length/n;if(!r)return Math.max(s,1);const i=CC(r);for(let a=0,l=i.length-1;a<l;a++){const c=i[a];if(c>s)return c}return Math.max(s,1)}function DM(t){const e=[];let n,r;for(n=0,r=t.length;n<r;n++)t[n].major&&e.push(n);return e}function OM(t,e,n,r){let s=0,i=n[0],a;for(r=Math.ceil(r),a=0;a<t.length;a++)a===i&&(e.push(t[a]),s++,i=n[s*r])}function kl(t,e,n,r,s){const i=Fe(r,0),a=Math.min(Fe(s,t.length),t.length);let l=0,c,d,u;for(n=Math.ceil(n),s&&(c=s-r,n=c/Math.floor(c/n)),u=i;u<0;)l++,u=Math.round(i+l*n);for(d=Math.max(i,0);d<a;d++)d===u&&(e.push(t[d]),l++,u=Math.round(i+l*n))}function EM(t){const e=t.length;let n,r;if(e<2)return!1;for(r=t[0],n=1;n<e;++n)if(t[n]-t[n-1]!==r)return!1;return r}const $M=t=>t==="left"?"right":t==="right"?"left":t,Lp=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,Vp=(t,e)=>Math.min(e||t,t);function Np(t,e){const n=[],r=t.length/e,s=t.length;let i=0;for(;i<s;i+=r)n.push(t[Math.floor(i)]);return n}function PM(t,e,n){const r=t.ticks.length,s=Math.min(e,r-1),i=t._startPixel,a=t._endPixel,l=1e-6;let c=t.getPixelForTick(s),d;if(!(n&&(r===1?d=Math.max(c-i,a-c):e===0?d=(t.getPixelForTick(1)-c)/2:d=(c-t.getPixelForTick(s-1))/2,c+=s<e?d:-d,c<i-l||c>a+l)))return c}function LM(t,e){Re(t,n=>{const r=n.gc,s=r.length/2;let i;if(s>e){for(i=0;i<s;++i)delete n.data[r[i]];r.splice(0,s)}})}function Io(t){return t.drawTicks?t.tickLength:0}function Bp(t,e){if(!t.display)return 0;const n=an(t.font,e),r=yn(t.padding);return(st(t.text)?t.text.length:1)*n.lineHeight+r.height}function VM(t,e){return ts(t,{scale:e,type:"scale"})}function NM(t,e,n){return ts(t,{tick:n,index:e,type:"tick"})}function BM(t,e,n){let r=PC(t);return(n&&e!=="right"||!n&&e==="right")&&(r=$M(r)),r}function AM(t,e,n,r){const{top:s,left:i,bottom:a,right:l,chart:c}=t,{chartArea:d,scales:u}=c;let h=0,f,m,g;const p=a-s,_=l-i;if(t.isHorizontal()){if(m=Wm(r,i,l),Te(n)){const y=Object.keys(n)[0],C=n[y];g=u[y].getPixelForValue(C)+p-e}else n==="center"?g=(d.bottom+d.top)/2+p-e:g=Lp(t,n,e);f=l-i}else{if(Te(n)){const y=Object.keys(n)[0],C=n[y];m=u[y].getPixelForValue(C)-_+e}else n==="center"?m=(d.left+d.right)/2-_+e:m=Lp(t,n,e);g=Wm(r,a,s),h=n==="left"?-sn:sn}return{titleX:m,titleY:g,maxWidth:f,rotation:h}}class Fs extends As{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,n){return e}getUserBounds(){let{_userMin:e,_userMax:n,_suggestedMin:r,_suggestedMax:s}=this;return e=nn(e,Number.POSITIVE_INFINITY),n=nn(n,Number.NEGATIVE_INFINITY),r=nn(r,Number.POSITIVE_INFINITY),s=nn(s,Number.NEGATIVE_INFINITY),{min:nn(e,r),max:nn(n,s),minDefined:lt(e),maxDefined:lt(n)}}getMinMax(e){let{min:n,max:r,minDefined:s,maxDefined:i}=this.getUserBounds(),a;if(s&&i)return{min:n,max:r};const l=this.getMatchingVisibleMetas();for(let c=0,d=l.length;c<d;++c)a=l[c].controller.getMinMax(this,e),s||(n=Math.min(n,a.min)),i||(r=Math.max(r,a.max));return n=i&&n>r?r:n,r=s&&n>r?n:r,{min:nn(n,nn(r,n)),max:nn(r,nn(n,r))}}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(){ct(this.options.beforeUpdate,[this])}update(e,n,r){const{beginAtZero:s,grace:i,ticks:a}=this.options,l=a.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=nx(this,i,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=l<this.ticks.length;this._convertTicksToLabels(c?Np(this.ticks,l):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=SM(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),c&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,e=!e),this._startPixel=n,this._endPixel=r,this._reversePixels=e,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ct(this.options.afterUpdate,[this])}beforeSetDimensions(){ct(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){ct(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),ct(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ct(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const n=this.options.ticks;let r,s,i;for(r=0,s=e.length;r<s;r++)i=e[r],i.label=ct(n.callback,[i.value,r,e],this)}afterTickToLabelConversion(){ct(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ct(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,r=Vp(this.ticks.length,e.ticks.maxTicksLimit),s=n.minRotation||0,i=n.maxRotation;let a=s,l,c,d;if(!this._isVisible()||!n.display||s>=i||r<=1||!this.isHorizontal()){this.labelRotation=s;return}const u=this._getLabelSizes(),h=u.widest.width,f=u.highest.height,m=_n(this.chart.width-h,0,this.maxWidth);l=e.offset?this.maxWidth/r:m/(r-1),h+6>l&&(l=m/(r-(e.offset?.5:1)),c=this.maxHeight-Io(e.grid)-n.padding-Bp(e.title,this.chart.options.font),d=Math.sqrt(h*h+f*f),a=xu(Math.min(Math.asin(_n((u.highest.height+6)/l,-1,1)),Math.asin(_n(c/d,-1,1))-Math.asin(_n(f/d,-1,1)))),a=Math.max(s,Math.min(i,a))),this.labelRotation=a}afterCalculateLabelRotation(){ct(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ct(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:r,title:s,grid:i}}=this,a=this._isVisible(),l=this.isHorizontal();if(a){const c=Bp(s,n.options.font);if(l?(e.width=this.maxWidth,e.height=Io(i)+c):(e.height=this.maxHeight,e.width=Io(i)+c),r.display&&this.ticks.length){const{first:d,last:u,widest:h,highest:f}=this._getLabelSizes(),m=r.padding*2,g=es(this.labelRotation),p=Math.cos(g),_=Math.sin(g);if(l){const y=r.mirror?0:_*h.width+p*f.height;e.height=Math.min(this.maxHeight,e.height+y+m)}else{const y=r.mirror?0:p*h.width+_*f.height;e.width=Math.min(this.maxWidth,e.width+y+m)}this._calculatePadding(d,u,_,p)}}this._handleMargins(),l?(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,r,s){const{ticks:{align:i,padding:a},position:l}=this.options,c=this.labelRotation!==0,d=l!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,m=0;c?d?(f=s*e.width,m=r*n.height):(f=r*e.height,m=s*n.width):i==="start"?m=n.width:i==="end"?f=e.width:i!=="inner"&&(f=e.width/2,m=n.width/2),this.paddingLeft=Math.max((f-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((m-h+a)*this.width/(this.width-h),0)}else{let u=n.height/2,h=e.height/2;i==="start"?(u=0,h=e.height):i==="end"&&(u=n.height,h=0),this.paddingTop=u+a,this.paddingBottom=h+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ct(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,r;for(n=0,r=e.length;n<r;n++)Ue(e[n].label)&&(e.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=Np(r,n)),this._labelSizes=e=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,n,r){const{ctx:s,_longestTextCache:i}=this,a=[],l=[],c=Math.floor(n/Vp(n,r));let d=0,u=0,h,f,m,g,p,_,y,C,k,v,M;for(h=0;h<n;h+=c){if(g=e[h].label,p=this._resolveTickFontOptions(h),s.font=_=p.string,y=i[_]=i[_]||{data:{},gc:[]},C=p.lineHeight,k=v=0,!Ue(g)&&!st(g))k=cl(s,y.data,y.gc,k,g),v=C;else if(st(g))for(f=0,m=g.length;f<m;++f)M=g[f],!Ue(M)&&!st(M)&&(k=cl(s,y.data,y.gc,k,M),v+=C);a.push(k),l.push(v),d=Math.max(k,d),u=Math.max(v,u)}LM(i,n);const T=a.indexOf(d),S=l.indexOf(u),O=E=>({width:a[E]||0,height:l[E]||0});return{first:O(0),last:O(n-1),widest:O(T),highest:O(S),widths:a,heights:l}}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 vC(this._alignToPixels?Ps(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&&e<n.length){const r=n[e];return r.$context||(r.$context=NM(this.getContext(),e,r))}return this.$context||(this.$context=VM(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=es(this.labelRotation),r=Math.abs(Math.cos(n)),s=Math.abs(Math.sin(n)),i=this._getLabelSizes(),a=e.autoSkipPadding||0,l=i?i.widest.width+a:0,c=i?i.highest.height+a:0;return this.isHorizontal()?c*r>l*s?l/r:c/s:c*s<l*r?c/r:l/s}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const n=this.axis,r=this.chart,s=this.options,{grid:i,position:a,border:l}=s,c=i.offset,d=this.isHorizontal(),h=this.ticks.length+(c?1:0),f=Io(i),m=[],g=l.setContext(this.getContext()),p=g.display?g.width:0,_=p/2,y=function(x){return Ps(r,x,p)};let C,k,v,M,T,S,O,E,I,j,$,R;if(a==="top")C=y(this.bottom),S=this.bottom-f,E=C-_,j=y(e.top)+_,R=e.bottom;else if(a==="bottom")C=y(this.top),j=e.top,R=y(e.bottom)-_,S=C+_,E=this.top+f;else if(a==="left")C=y(this.right),T=this.right-f,O=C-_,I=y(e.left)+_,$=e.right;else if(a==="right")C=y(this.left),I=e.left,$=y(e.right)-_,T=C+_,O=this.left+f;else if(n==="x"){if(a==="center")C=y((e.top+e.bottom)/2+.5);else if(Te(a)){const x=Object.keys(a)[0],V=a[x];C=y(this.chart.scales[x].getPixelForValue(V))}j=e.top,R=e.bottom,S=C+_,E=S+f}else if(n==="y"){if(a==="center")C=y((e.left+e.right)/2);else if(Te(a)){const x=Object.keys(a)[0],V=a[x];C=y(this.chart.scales[x].getPixelForValue(V))}T=C-_,O=T-f,I=e.left,$=e.right}const G=Fe(s.ticks.maxTicksLimit,h),D=Math.max(1,Math.ceil(h/G));for(k=0;k<h;k+=D){const x=this.getContext(k),V=i.setContext(x),Z=l.setContext(x),ee=V.lineWidth,U=V.color,P=Z.dash||[],N=Z.dashOffset,b=V.tickWidth,w=V.tickColor,B=V.tickBorderDash||[],H=V.tickBorderDashOffset;v=PM(this,k,c),v!==void 0&&(M=Ps(r,v,ee),d?T=O=I=$=M:S=E=j=R=M,m.push({tx1:T,ty1:S,tx2:O,ty2:E,x1:I,y1:j,x2:$,y2:R,width:ee,color:U,borderDash:P,borderDashOffset:N,tickWidth:b,tickColor:w,tickBorderDash:B,tickBorderDashOffset:H}))}return this._ticksLength=h,this._borderValue=C,m}_computeLabelItems(e){const n=this.axis,r=this.options,{position:s,ticks:i}=r,a=this.isHorizontal(),l=this.ticks,{align:c,crossAlign:d,padding:u,mirror:h}=i,f=Io(r.grid),m=f+u,g=h?-u:m,p=-es(this.labelRotation),_=[];let y,C,k,v,M,T,S,O,E,I,j,$,R="middle";if(s==="top")T=this.bottom-g,S=this._getXAxisLabelAlignment();else if(s==="bottom")T=this.top+g,S=this._getXAxisLabelAlignment();else if(s==="left"){const D=this._getYAxisLabelAlignment(f);S=D.textAlign,M=D.x}else if(s==="right"){const D=this._getYAxisLabelAlignment(f);S=D.textAlign,M=D.x}else if(n==="x"){if(s==="center")T=(e.top+e.bottom)/2+m;else if(Te(s)){const D=Object.keys(s)[0],x=s[D];T=this.chart.scales[D].getPixelForValue(x)+m}S=this._getXAxisLabelAlignment()}else if(n==="y"){if(s==="center")M=(e.left+e.right)/2-m;else if(Te(s)){const D=Object.keys(s)[0],x=s[D];M=this.chart.scales[D].getPixelForValue(x)}S=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(c==="start"?R="top":c==="end"&&(R="bottom"));const G=this._getLabelSizes();for(y=0,C=l.length;y<C;++y){k=l[y],v=k.label;const D=i.setContext(this.getContext(y));O=this.getPixelForTick(y)+i.labelOffset,E=this._resolveTickFontOptions(y),I=E.lineHeight,j=st(v)?v.length:1;const x=j/2,V=D.color,Z=D.textStrokeColor,ee=D.textStrokeWidth;let U=S;a?(M=O,S==="inner"&&(y===C-1?U=this.options.reverse?"left":"right":y===0?U=this.options.reverse?"right":"left":U="center"),s==="top"?d==="near"||p!==0?$=-j*I+I/2:d==="center"?$=-G.highest.height/2-x*I+I:$=-G.highest.height+I/2:d==="near"||p!==0?$=I/2:d==="center"?$=G.highest.height/2-x*I:$=G.highest.height-j*I,h&&($*=-1),p!==0&&!D.showLabelBackdrop&&(M+=I/2*Math.sin(p))):(T=O,$=(1-j)*I/2);let P;if(D.showLabelBackdrop){const N=yn(D.backdropPadding),b=G.heights[y],w=G.widths[y];let B=$-N.top,H=0-N.left;switch(R){case"middle":B-=b/2;break;case"bottom":B-=b;break}switch(S){case"center":H-=w/2;break;case"right":H-=w;break;case"inner":y===C-1?H-=w:y>0&&(H-=w/2);break}P={left:H,top:B,width:w+N.width,height:b+N.height,color:D.backdropColor}}_.push({label:v,font:E,textOffset:$,options:{rotation:p,color:V,strokeColor:Z,strokeWidth:ee,textAlign:U,textBaseline:R,translation:[M,T],backdrop:P}})}return _}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-es(this.labelRotation))return e==="top"?"left":"right";let s="center";return n.align==="start"?s="left":n.align==="end"?s="right":n.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:r,mirror:s,padding:i}}=this.options,a=this._getLabelSizes(),l=e+i,c=a.widest.width;let d,u;return n==="left"?s?(u=this.right+i,r==="near"?d="left":r==="center"?(d="center",u+=c/2):(d="right",u+=c)):(u=this.right-l,r==="near"?d="right":r==="center"?(d="center",u-=c/2):(d="left",u=this.left)):n==="right"?s?(u=this.left+i,r==="near"?d="right":r==="center"?(d="center",u-=c/2):(d="left",u-=c)):(u=this.left+l,r==="near"?d="left":r==="center"?(d="center",u+=c/2):(d="right",u=this.right)):d="right",{textAlign:d,x:u}}_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:r,top:s,width:i,height:a}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(r,s,i,a),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const s=this.ticks.findIndex(i=>i.value===e);return s>=0?n.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){const n=this.options.grid,r=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let i,a;const l=(c,d,u)=>{!u.width||!u.color||(r.save(),r.lineWidth=u.width,r.strokeStyle=u.color,r.setLineDash(u.borderDash||[]),r.lineDashOffset=u.borderDashOffset,r.beginPath(),r.moveTo(c.x,c.y),r.lineTo(d.x,d.y),r.stroke(),r.restore())};if(n.display)for(i=0,a=s.length;i<a;++i){const c=s[i];n.drawOnChartArea&&l({x:c.x1,y:c.y1},{x:c.x2,y:c.y2},c),n.drawTicks&&l({x:c.tx1,y:c.ty1},{x:c.tx2,y:c.ty2},{color:c.tickColor,width:c.tickWidth,borderDash:c.tickBorderDash,borderDashOffset:c.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:n,options:{border:r,grid:s}}=this,i=r.setContext(this.getContext()),a=r.display?i.width:0;if(!a)return;const l=s.setContext(this.getContext(0)).lineWidth,c=this._borderValue;let d,u,h,f;this.isHorizontal()?(d=Ps(e,this.left,a)-a/2,u=Ps(e,this.right,l)+l/2,h=f=c):(h=Ps(e,this.top,a)-a/2,f=Ps(e,this.bottom,l)+l/2,d=u=c),n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.beginPath(),n.moveTo(d,h),n.lineTo(u,f),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const r=this.ctx,s=this._computeLabelArea();s&&Pu(r,s);const i=this.getLabelItems(e);for(const a of i){const l=a.options,c=a.font,d=a.label,u=a.textOffset;dl(r,d,0,u,c,l)}s&&Lu(r)}drawTitle(){const{ctx:e,options:{position:n,title:r,reverse:s}}=this;if(!r.display)return;const i=an(r.font),a=yn(r.padding),l=r.align;let c=i.lineHeight/2;n==="bottom"||n==="center"||Te(n)?(c+=a.bottom,st(r.text)&&(c+=i.lineHeight*(r.text.length-1))):c+=a.top;const{titleX:d,titleY:u,maxWidth:h,rotation:f}=AM(this,c,n,l);dl(e,r.text,0,0,i,{color:r.color,maxWidth:h,rotation:f,textAlign:BM(l,n,s),textBaseline:"middle",translation:[d,u]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,n=e.ticks&&e.ticks.z||0,r=Fe(e.grid&&e.grid.z,-1),s=Fe(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==Fs.prototype.draw?[{z:n,draw:i=>{this.draw(i)}}]:[{z:r,draw:i=>{this.drawBackground(),this.drawGrid(i),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:n,draw:i=>{this.drawLabels(i)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",s=[];let i,a;for(i=0,a=n.length;i<a;++i){const l=n[i];l[r]===this.id&&(!e||l.type===e)&&s.push(l)}return s}_resolveTickFontOptions(e){const n=this.options.ticks.setContext(this.getContext(e));return an(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Cl{constructor(e,n,r){this.type=e,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const n=Object.getPrototypeOf(e);let r;IM(n)&&(r=this.register(n));const s=this.items,i=e.id,a=this.scope+"."+i;if(!i)throw new Error("class does not have id: "+e);return i in s||(s[i]=e,FM(e,a,r),this.override&&gt.override(e.id,e.overrides)),a}get(e){return this.items[e]}unregister(e){const n=this.items,r=e.id,s=this.scope;r in n&&delete n[r],s&&r in gt[s]&&(delete gt[s][r],this.override&&delete $s[r])}}function FM(t,e,n){const r=vo(Object.create(null),[n?gt.get(n):{},gt.get(e),t.defaults]);gt.set(e,r),t.defaultRoutes&&RM(e,t.defaultRoutes),t.descriptors&&gt.describe(e,t.descriptors)}function RM(t,e){Object.keys(e).forEach(n=>{const r=n.split("."),s=r.pop(),i=[t].concat(r).join("."),a=e[n].split("."),l=a.pop(),c=a.join(".");gt.route(i,s,c,l)})}function IM(t){return"id"in t&&"defaults"in t}class HM{constructor(){this.controllers=new Cl(Vo,"datasets",!0),this.elements=new Cl(As,"elements"),this.plugins=new Cl(Object,"plugins"),this.scales=new Cl(Fs,"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,r){[...n].forEach(s=>{const i=r||this._getRegistryForType(s);r||i.isForType(s)||i===this.plugins&&s.id?this._exec(e,i,s):Re(s,a=>{const l=r||this._getRegistryForType(a);this._exec(e,l,a)})})}_exec(e,n,r){const s=Cu(e);ct(r["before"+s],[],r),n[e](r),ct(r["after"+s],[],r)}_getRegistryForType(e){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(e))return r}return this.plugins}_get(e,n,r){const s=n.get(e);if(s===void 0)throw new Error('"'+e+'" is not a registered '+r+".");return s}}var er=new HM;class zM{constructor(){this._init=[]}notify(e,n,r,s){n==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const i=s?this._descriptors(e).filter(s):this._descriptors(e),a=this._notify(i,e,n,r);return n==="afterDestroy"&&(this._notify(i,e,"stop"),this._notify(this._init,e,"uninstall")),a}_notify(e,n,r,s){s=s||{};for(const i of e){const a=i.plugin,l=a[r],c=[n,s,i.options];if(ct(l,c,a)===!1&&s.cancelable)return!1}return!0}invalidate(){Ue(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),n}_createDescriptors(e,n){const r=e&&e.config,s=Fe(r.options&&r.options.plugins,{}),i=YM(r);return s===!1&&!n?[]:jM(e,i,s,n)}_notifyStateChanges(e){const n=this._oldCache||[],r=this._cache,s=(i,a)=>i.filter(l=>!a.some(c=>l.plugin.id===c.plugin.id));this._notify(s(n,r),e,"stop"),this._notify(s(r,n),e,"start")}}function YM(t){const e={},n=[],r=Object.keys(er.plugins.items);for(let i=0;i<r.length;i++)n.push(er.getPlugin(r[i]));const s=t.plugins||[];for(let i=0;i<s.length;i++){const a=s[i];n.indexOf(a)===-1&&(n.push(a),e[a.id]=!0)}return{plugins:n,localIds:e}}function WM(t,e){return!e&&t===!1?null:t===!0?{}:t}function jM(t,{plugins:e,localIds:n},r,s){const i=[],a=t.getContext();for(const l of e){const c=l.id,d=WM(r[c],s);d!==null&&i.push({plugin:l,options:ZM(t.config,{plugin:l,local:n[c]},d,a)})}return i}function ZM(t,{plugin:e,local:n},r,s){const i=t.pluginScopeKeys(e),a=t.getOptionScopes(r,i);return n&&e.defaults&&a.push(e.defaults),t.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Uu(t,e){const n=gt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function UM(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function qM(t,e){return t===e?"_index_":"_value_"}function Ap(t){if(t==="x"||t==="y"||t==="r")return t}function GM(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function qu(t,...e){if(Ap(t))return t;for(const n of e){const r=n.axis||GM(n.position)||t.length>1&&Ap(t[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function Fp(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function KM(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(r=>r.xAxisID===t||r.yAxisID===t);if(n.length)return Fp(t,"x",n[0])||Fp(t,"y",n[0])}return{}}function XM(t,e){const n=$s[t.type]||{scales:{}},r=e.scales||{},s=Uu(t.type,e),i=Object.create(null);return Object.keys(r).forEach(a=>{const l=r[a];if(!Te(l))return console.error(`Invalid scale configuration for scale: ${a}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const c=qu(a,l,KM(a,t),gt.scales[l.type]),d=qM(c,s),u=n.scales||{};i[a]=To(Object.create(null),[{axis:c},l,u[c],u[d]])}),t.data.datasets.forEach(a=>{const l=a.type||t.type,c=a.indexAxis||Uu(l,e),u=($s[l]||{}).scales||{};Object.keys(u).forEach(h=>{const f=UM(h,c),m=a[f+"AxisID"]||f;i[m]=i[m]||Object.create(null),To(i[m],[{axis:f},r[m],u[h]])})}),Object.keys(i).forEach(a=>{const l=i[a];To(l,[gt.scales[l.type],gt.scale])}),i}function Rp(t){const e=t.options||(t.options={});e.plugins=Fe(e.plugins,{}),e.scales=XM(t,e)}function Ip(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function JM(t){return t=t||{},t.data=Ip(t.data),Rp(t),t}const Hp=new Map,zp=new Set;function xl(t,e){let n=Hp.get(t);return n||(n=e(),Hp.set(t,n),zp.add(n)),n}const Ho=(t,e,n)=>{const r=sl(e,n);r!==void 0&&t.add(r)};class QM{constructor(e){this._config=JM(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=Ip(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(),Rp(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return xl(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return xl(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return xl(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,r=this.type;return xl(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const r=this._scopeCache;let s=r.get(e);return(!s||n)&&(s=new Map,r.set(e,s)),s}getOptionScopes(e,n,r){const{options:s,type:i}=this,a=this._cachedScopes(e,r),l=a.get(n);if(l)return l;const c=new Set;n.forEach(u=>{e&&(c.add(e),u.forEach(h=>Ho(c,e,h))),u.forEach(h=>Ho(c,s,h)),u.forEach(h=>Ho(c,$s[i]||{},h)),u.forEach(h=>Ho(c,gt,h)),u.forEach(h=>Ho(c,Ou,h))});const d=Array.from(c);return d.length===0&&d.push(Object.create(null)),zp.has(n)&&a.set(n,d),d}chartOptionScopes(){const{options:e,type:n}=this;return[e,$s[n]||{},gt.datasets[n]||{},{type:n},gt,Ou]}resolveNamedOptions(e,n,r,s=[""]){const i={$shared:!0},{resolver:a,subPrefixes:l}=Yp(this._resolverCache,e,s);let c=a;if(tS(a,n)){i.$shared=!1,r=Jr(r)?r():r;const d=this.createResolver(e,r,l);c=Mi(a,r,d)}for(const d of n)i[d]=c[d];return i}createResolver(e,n,r=[""],s){const{resolver:i}=Yp(this._resolverCache,e,r);return Te(n)?Mi(i,n,void 0,s):i}}function Yp(t,e,n){let r=t.get(e);r||(r=new Map,t.set(e,r));const s=n.join();let i=r.get(s);return i||(i={resolver:Nu(e,n),subPrefixes:n.filter(l=>!l.toLowerCase().includes("hover"))},r.set(s,i)),i}const eS=t=>Te(t)&&Object.getOwnPropertyNames(t).some(e=>Jr(t[e]));function tS(t,e){const{isScriptable:n,isIndexable:r}=Jm(t);for(const s of e){const i=n(s),a=r(s),l=(a||i)&&t[s];if(i&&(Jr(l)||eS(l))||a&&st(l))return!0}return!1}var nS="4.4.2";const rS=["top","bottom","left","right","chartArea"];function Wp(t,e){return t==="top"||t==="bottom"||rS.indexOf(t)===-1&&e==="x"}function jp(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}function Zp(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),ct(n&&n.onComplete,[t],e)}function sS(t){const e=t.chart,n=e.options.animation;ct(n&&n.onProgress,[t],e)}function Up(t){return Fu()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Ml={},qp=t=>{const e=Up(t);return Object.values(Ml).filter(n=>n.canvas===e).pop()};function iS(t,e,n){const r=Object.keys(t);for(const s of r){const i=+s;if(i>=e){const a=t[s];delete t[s],(n>0||i>e)&&(t[i+n]=a)}}}function oS(t,e,n,r){return!n||t.type==="mouseout"?null:r?e:t}function Sl(t,e,n){return t.options.clip?t[n]:e[n]}function aS(t,e){const{xScale:n,yScale:r}=t;return n&&r?{left:Sl(n,e,"left"),right:Sl(n,e,"right"),top:Sl(r,e,"top"),bottom:Sl(r,e,"bottom")}:e}let zo=(cs=class{static register(...e){er.add(...e),Gp()}static unregister(...e){er.remove(...e),Gp()}constructor(e,n){const r=this.config=new QM(n),s=Up(e),i=qp(s);if(i)throw new Error("Canvas is already in use. Chart with ID '"+i.id+"' must be destroyed before the canvas with ID '"+i.canvas.id+"' can be reused.");const a=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||MM(s)),this.platform.updateConfig(r);const l=this.platform.acquireContext(s,a.aspectRatio),c=l&&l.canvas,d=c&&c.height,u=c&&c.width;if(this.id=fC(),this.ctx=l,this.canvas=c,this.width=u,this.height=d,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new zM,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=$C(h=>this.update(h),a.resizeDelay||0),this._dataChanges=[],Ml[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}yr.listen(this,"complete",Zp),yr.listen(this,"progress",sS),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:r,height:s,_aspectRatio:i}=this;return Ue(e)?n&&i?i:s?r/s: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 er}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ip(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Km(this.canvas,this.ctx),this}stop(){return yr.stop(this),this}resize(e,n){yr.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const r=this.options,s=this.canvas,i=r.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(s,e,n,i),l=r.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,ip(this,l,!0)&&(this.notifyPlugins("resize",{size:a}),ct(r.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};Re(n,(r,s)=>{r.id=s})}buildOrUpdateScales(){const e=this.options,n=e.scales,r=this.scales,s=Object.keys(r).reduce((a,l)=>(a[l]=!1,a),{});let i=[];n&&(i=i.concat(Object.keys(n).map(a=>{const l=n[a],c=qu(a,l),d=c==="r",u=c==="x";return{options:l,dposition:d?"chartArea":u?"bottom":"left",dtype:d?"radialLinear":u?"category":"linear"}}))),Re(i,a=>{const l=a.options,c=l.id,d=qu(c,l),u=Fe(l.type,a.dtype);(l.position===void 0||Wp(l.position,d)!==Wp(a.dposition))&&(l.position=a.dposition),s[c]=!0;let h=null;if(c in r&&r[c].type===u)h=r[c];else{const f=er.getScale(u);h=new f({id:c,type:u,ctx:this.ctx,chart:this}),r[h.id]=h}h.init(l,e)}),Re(s,(a,l)=>{a||delete r[l]}),Re(r,a=>{yl.configure(this,a,a.options),yl.addBox(this,a)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,r=e.length;if(e.sort((s,i)=>s.index-i.index),r>n){for(let s=n;s<r;++s)this._destroyDatasetMeta(s);e.splice(n,r-n)}this._sortedMetasets=e.slice(0).sort(jp("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:n}}=this;e.length>n.length&&delete this._stacks,e.forEach((r,s)=>{n.filter(i=>i===r._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let r,s;for(this._removeUnreferencedMetasets(),r=0,s=n.length;r<s;r++){const i=n[r];let a=this.getDatasetMeta(r);const l=i.type||this.config.type;if(a.type&&a.type!==l&&(this._destroyDatasetMeta(r),a=this.getDatasetMeta(r)),a.type=l,a.indexAxis=i.indexAxis||Uu(l,this.options),a.order=i.order||0,a.index=r,a.label=""+i.label,a.visible=this.isDatasetVisible(r),a.controller)a.controller.updateIndex(r),a.controller.linkScales();else{const c=er.getController(l),{datasetElementType:d,dataElementType:u}=gt.datasets[l];Object.assign(c,{dataElementType:er.getElement(u),datasetElementType:d&&er.getElement(d)}),a.controller=new c(this,r),e.push(a.controller)}}return this._updateMetasets(),e}_resetElements(){Re(this.data.datasets,(e,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const i=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let d=0,u=this.data.datasets.length;d<u;d++){const{controller:h}=this.getDatasetMeta(d),f=!s&&i.indexOf(h)===-1;h.buildOrUpdateElements(f),a=Math.max(+h.getMaxOverflow(),a)}a=this._minPadding=r.layout.autoPadding?a:0,this._updateLayout(a),s||Re(i,d=>{d.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(jp("z","_idx"));const{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){Re(this.scales,e=>{yl.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(e.events);(!Lm(n,r)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:s,count:i}of n){const a=r==="_removeElements"?-i:i;iS(e,s,a)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=i=>new Set(e.filter(a=>a[0]===i).map((a,l)=>l+","+a.splice(1).join(","))),s=r(0);for(let i=1;i<n;i++)if(!Lm(s,r(i)))return;return Array.from(s).map(i=>i.split(",")).map(i=>({method:i[1],start:+i[2],count:+i[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;yl.update(this,this.width,this.height,e);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],Re(this.boxes,s=>{r&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,i)=>{s._idx=i}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,Jr(e)?e({datasetIndex:n}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,n){const r=this.getDatasetMeta(e),s={meta:r,index:e,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(r.controller._update(n),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(yr.has(this)?this.attached&&!yr.running(this)&&yr.start(this):(this.draw(),Zp({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:r,height:s}=this._resizeBeforeDraw;this._resize(r,s),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(e=0;e<n.length&&n[e].z<=0;++e)n[e].draw(this.chartArea);for(this._drawDatasets();e<n.length;++e)n[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const n=this._sortedMetasets,r=[];let s,i;for(s=0,i=n.length;s<i;++s){const a=n[s];(!e||a.visible)&&r.push(a)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,r=e._clip,s=!r.disabled,i=aS(e,this.chartArea),a={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(s&&Pu(n,{left:r.left===!1?0:i.left-r.left,right:r.right===!1?this.width:i.right+r.right,top:r.top===!1?0:i.top-r.top,bottom:r.bottom===!1?this.height:i.bottom+r.bottom}),e.controller.draw(),s&&Lu(n),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(e){return _r(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,r,s){const i=rM.modes[n];return typeof i=="function"?i(this,e,r,s):[]}getDatasetMeta(e){const n=this.data.datasets[e],r=this._metasets;let s=r.filter(i=>i&&i._dataset===n).pop();return s||(s={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},r.push(s)),s}getContext(){return this.$context||(this.$context=ts(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const r=this.getDatasetMeta(e);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(e,n){const r=this.getDatasetMeta(e);r.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,r){const s=r?"show":"hide",i=this.getDatasetMeta(e),a=i.controller._resolveAnimations(void 0,s);il(n)?(i.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(e,r),a.update(i,{visible:r}),this.update(l=>l.datasetIndex===e?s: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(),yr.remove(this),e=0,n=this.data.datasets.length;e<n;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:n}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),Km(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete Ml[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,n=this.platform,r=(i,a)=>{n.addEventListener(this,i,a),e[i]=a},s=(i,a,l)=>{i.offsetX=a,i.offsetY=l,this._eventHandler(i)};Re(this.options.events,i=>r(i,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,r=(c,d)=>{n.addEventListener(this,c,d),e[c]=d},s=(c,d)=>{e[c]&&(n.removeEventListener(this,c,d),delete e[c])},i=(c,d)=>{this.canvas&&this.resize(c,d)};let a;const l=()=>{s("attach",l),this.attached=!0,this.resize(),r("resize",i),r("detach",a)};a=()=>{this.attached=!1,s("resize",i),this._stop(),this._resize(0,0),r("attach",l)},n.isAttached(this.canvas)?l():a()}unbindEvents(){Re(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},Re(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,r){const s=r?"set":"remove";let i,a,l,c;for(n==="dataset"&&(i=this.getDatasetMeta(e[0].datasetIndex),i.controller["_"+s+"DatasetHoverStyle"]()),l=0,c=e.length;l<c;++l){a=e[l];const d=a&&this.getDatasetMeta(a.datasetIndex).controller;d&&d[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const n=this._active||[],r=e.map(({datasetIndex:i,index:a})=>{const l=this.getDatasetMeta(i);if(!l)throw new Error("No dataset found at index "+i);return{datasetIndex:i,element:l.data[a],index:a}});!nl(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(e,n,r){return this._plugins.notify(this,e,n,r)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,r){const s=this.options.hover,i=(c,d)=>c.filter(u=>!d.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),a=i(n,e),l=r?e:i(e,n);a.length&&this.updateHoverStyle(a,s.mode,!1),l.length&&s.mode&&this.updateHoverStyle(l,s.mode,!0)}_eventHandler(e,n){const r={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},s=a=>(a.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",r,s)===!1)return;const i=this._handleEvent(e,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,s),(i||r.changed)&&this.render(),this}_handleEvent(e,n,r){const{_active:s=[],options:i}=this,a=n,l=this._getActiveElements(e,s,r,a),c=wC(e),d=oS(e,this._lastEvent,r,c);r&&(this._lastEvent=null,ct(i.onHover,[e,l,this],this),c&&ct(i.onClick,[e,l,this],this));const u=!nl(l,s);return(u||n)&&(this._active=l,this._updateHoverStyles(l,s,n)),this._lastEvent=d,u}_getActiveElements(e,n,r,s){if(e.type==="mouseout")return[];if(!r)return n;const i=this.options.hover;return this.getElementsAtEventForMode(e,i.mode,i,s)}},W(cs,"defaults",gt),W(cs,"instances",Ml),W(cs,"overrides",$s),W(cs,"registry",er),W(cs,"version",nS),W(cs,"getChart",qp),cs);function Gp(){return Re(zo.instances,t=>t._plugins.invalidate())}function Kp(t,e,n=e){t.lineCap=Fe(n.borderCapStyle,e.borderCapStyle),t.setLineDash(Fe(n.borderDash,e.borderDash)),t.lineDashOffset=Fe(n.borderDashOffset,e.borderDashOffset),t.lineJoin=Fe(n.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Fe(n.borderWidth,e.borderWidth),t.strokeStyle=Fe(n.borderColor,e.borderColor)}function lS(t,e,n){t.lineTo(n.x,n.y)}function cS(t){return t.stepped?ZC:t.tension||t.cubicInterpolationMode==="monotone"?UC:lS}function Xp(t,e,n={}){const r=t.length,{start:s=0,end:i=r-1}=n,{start:a,end:l}=e,c=Math.max(s,a),d=Math.min(i,l),u=s<a&&i<a||s>l&&i>l;return{count:r,start:c,loop:e.loop,ilen:d<c&&!u?r+d-c:d-c}}function dS(t,e,n,r){const{points:s,options:i}=e,{count:a,start:l,loop:c,ilen:d}=Xp(s,n,r),u=cS(i);let{move:h=!0,reverse:f}=r||{},m,g,p;for(m=0;m<=d;++m)g=s[(l+(f?d-m:m))%a],!g.skip&&(h?(t.moveTo(g.x,g.y),h=!1):u(t,p,g,f,i.stepped),p=g);return c&&(g=s[(l+(f?d:0))%a],u(t,p,g,f,i.stepped)),!!c}function uS(t,e,n,r){const s=e.points,{count:i,start:a,ilen:l}=Xp(s,n,r),{move:c=!0,reverse:d}=r||{};let u=0,h=0,f,m,g,p,_,y;const C=v=>(a+(d?l-v:v))%i,k=()=>{p!==_&&(t.lineTo(u,_),t.lineTo(u,p),t.lineTo(u,y))};for(c&&(m=s[C(0)],t.moveTo(m.x,m.y)),f=0;f<=l;++f){if(m=s[C(f)],m.skip)continue;const v=m.x,M=m.y,T=v|0;T===g?(M<p?p=M:M>_&&(_=M),u=(h*u+v)/++h):(k(),t.lineTo(v,M),g=T,h=0,p=_=M),y=M}k()}function Gu(t){const e=t.options,n=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!n?uS:dS}function hS(t){return t.stepped?vx:t.tension||t.cubicInterpolationMode==="monotone"?Tx:Ns}function fS(t,e,n,r){let s=e._path;s||(s=e._path=new Path2D,e.path(s,n,r)&&s.closePath()),Kp(t,e.options),t.stroke(s)}function mS(t,e,n,r){const{segments:s,options:i}=e,a=Gu(e);for(const l of s)Kp(t,i,l.style),t.beginPath(),a(t,e,l,{start:n,end:n+r-1})&&t.closePath(),t.stroke()}const pS=typeof Path2D=="function";function gS(t,e,n,r){pS&&!e.options.segment?fS(t,e,n,r):mS(t,e,n,r)}class wr extends As{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 r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const s=r.spanGaps?this._loop:this._fullLoop;yx(this._points,r,e,s,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=Nx(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,r=e.length;return r&&n[e[r-1].end]}interpolate(e,n){const r=this.options,s=e[n],i=this.points,a=dp(this,{property:n,start:s,end:s});if(!a.length)return;const l=[],c=hS(r);let d,u;for(d=0,u=a.length;d<u;++d){const{start:h,end:f}=a[d],m=i[h],g=i[f];if(m===g){l.push(m);continue}const p=Math.abs((s-m[n])/(g[n]-m[n])),_=c(m,g,p,r.stepped);_[n]=e[n],l.push(_)}return l.length===1?l[0]:l}pathSegment(e,n,r){return Gu(this)(e,this,n,r)}path(e,n,r){const s=this.segments,i=Gu(this);let a=this._loop;n=n||0,r=r||this.points.length-n;for(const l of s)a&=i(e,this,l,{start:n,end:n+r-1});return!!a}draw(e,n,r,s){const i=this.options||{};(this.points||[]).length&&i.borderWidth&&(e.save(),gS(e,this,r,s),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}W(wr,"id","line"),W(wr,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),W(wr,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),W(wr,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"});function Jp(t,e,n,r){const s=t.options,{[n]:i}=t.getProps([n],r);return Math.abs(e-i)<s.radius+s.hitRadius}class Yo extends As{constructor(n){super();W(this,"parsed");W(this,"skip");W(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,r,s){const i=this.options,{x:a,y:l}=this.getProps(["x","y"],s);return Math.pow(n-a,2)+Math.pow(r-l,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(n,r){return Jp(this,n,"x",r)}inYRange(n,r){return Jp(this,n,"y",r)}getCenterPoint(n){const{x:r,y:s}=this.getProps(["x","y"],n);return{x:r,y:s}}size(n){n=n||this.options||{};let r=n.radius||0;r=Math.max(r,r&&n.hoverRadius||0);const s=r&&n.borderWidth||0;return(r+s)*2}draw(n,r){const s=this.options;this.skip||s.radius<.1||!_r(this,r,this.size(s)/2)||(n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.fillStyle=s.backgroundColor,$u(n,s,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}W(Yo,"id","point"),W(Yo,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),W(Yo,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function _S(t,e,n){const r=t.segments,s=t.points,i=e.points,a=[];for(const l of r){let{start:c,end:d}=l;d=Xu(c,d,s);const u=Ku(n,s[c],s[d],l.loop);if(!e.segments){a.push({source:l,target:u,start:s[c],end:s[d]});continue}const h=dp(e,u);for(const f of h){const m=Ku(n,i[f.start],i[f.end],f.loop),g=cp(l,s,m);for(const p of g)a.push({source:p,target:f,start:{[n]:Qp(u,m,"start",Math.max)},end:{[n]:Qp(u,m,"end",Math.min)}})}}return a}function Ku(t,e,n,r){if(r)return;let s=e[t],i=n[t];return t==="angle"&&(s=on(s),i=on(i)),{property:t,start:s,end:i}}function yS(t,e){const{x:n=null,y:r=null}=t||{},s=e.points,i=[];return e.segments.forEach(({start:a,end:l})=>{l=Xu(a,l,s);const c=s[a],d=s[l];r!==null?(i.push({x:c.x,y:r}),i.push({x:d.x,y:r})):n!==null&&(i.push({x:n,y:c.y}),i.push({x:n,y:d.y}))}),i}function Xu(t,e,n){for(;e>t;e--){const r=n[e];if(!isNaN(r.x)&&!isNaN(r.y))break}return e}function Qp(t,e,n,r){return t&&e?r(t[n],e[n]):t?t[n]:e?e[n]:0}function e2(t,e){let n=[],r=!1;return st(t)?(r=!0,n=t):n=yS(t,e),n.length?new wr({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function t2(t){return t&&t.fill!==!1}function wS(t,e,n){let s=t[e].fill;const i=[e];let a;if(!n)return s;for(;s!==!1&&i.indexOf(s)===-1;){if(!lt(s))return s;if(a=t[s],!a)return!1;if(a.visible)return s;i.push(s),s=a.fill}return!1}function bS(t,e,n){const r=MS(t);if(Te(r))return isNaN(r.value)?!1:r;let s=parseFloat(r);return lt(s)&&Math.floor(s)===s?kS(r[0],e,s,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function kS(t,e,n,r){return(t==="-"||t==="+")&&(n=e+n),n===e||n<0||n>=r?!1:n}function CS(t,e){let n=null;return t==="start"?n=e.bottom:t==="end"?n=e.top:Te(t)?n=e.getPixelForValue(t.value):e.getBasePixel&&(n=e.getBasePixel()),n}function xS(t,e,n){let r;return t==="start"?r=n:t==="end"?r=e.options.reverse?e.min:e.max:Te(t)?r=t.value:r=e.getBaseValue(),r}function MS(t){const e=t.options,n=e.fill;let r=Fe(n&&n.target,n);return r===void 0&&(r=!!e.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function SS(t){const{scale:e,index:n,line:r}=t,s=[],i=r.segments,a=r.points,l=vS(e,n);l.push(e2({x:null,y:e.bottom},r));for(let c=0;c<i.length;c++){const d=i[c];for(let u=d.start;u<=d.end;u++)TS(s,a[u],l)}return new wr({points:s,options:{}})}function vS(t,e){const n=[],r=t.getMatchingVisibleMetas("line");for(let s=0;s<r.length;s++){const i=r[s];if(i.index===e)break;i.hidden||n.unshift(i.dataset)}return n}function TS(t,e,n){const r=[];for(let s=0;s<n.length;s++){const i=n[s],{first:a,last:l,point:c}=DS(i,e,"x");if(!(!c||a&&l)){if(a)r.unshift(c);else if(t.push(c),!l)break}}t.push(...r)}function DS(t,e,n){const r=t.interpolate(e,n);if(!r)return{};const s=r[n],i=t.segments,a=t.points;let l=!1,c=!1;for(let d=0;d<i.length;d++){const u=i[d],h=a[u.start][n],f=a[u.end][n];if(Rm(s,h,f)){l=s===h,c=s===f;break}}return{first:l,last:c,point:r}}class n2{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,n,r){const{x:s,y:i,radius:a}=this;return n=n||{start:0,end:rn},e.arc(s,i,a,n.end,n.start,!0),!r.bounds}interpolate(e){const{x:n,y:r,radius:s}=this,i=e.angle;return{x:n+Math.cos(i)*s,y:r+Math.sin(i)*s,angle:i}}}function OS(t){const{chart:e,fill:n,line:r}=t;if(lt(n))return ES(e,n);if(n==="stack")return SS(t);if(n==="shape")return!0;const s=$S(t);return s instanceof n2?s:e2(s,r)}function ES(t,e){const n=t.getDatasetMeta(e);return n&&t.isDatasetVisible(e)?n.dataset:null}function $S(t){return(t.scale||{}).getPointPositionForValue?LS(t):PS(t)}function PS(t){const{scale:e={},fill:n}=t,r=CS(n,e);if(lt(r)){const s=e.isHorizontal();return{x:s?r:null,y:s?null:r}}return null}function LS(t){const{scale:e,fill:n}=t,r=e.options,s=e.getLabels().length,i=r.reverse?e.max:e.min,a=xS(n,e,i),l=[];if(r.grid.circular){const c=e.getPointPositionForValue(0,i);return new n2({x:c.x,y:c.y,radius:e.getDistanceFromCenterForValue(a)})}for(let c=0;c<s;++c)l.push(e.getPointPositionForValue(c,a));return l}function Ju(t,e,n){const r=OS(e),{line:s,scale:i,axis:a}=e,l=s.options,c=l.fill,d=l.backgroundColor,{above:u=d,below:h=d}=c||{};r&&s.points.length&&(Pu(t,n),VS(t,{line:s,target:r,above:u,below:h,area:n,scale:i,axis:a}),Lu(t))}function VS(t,e){const{line:n,target:r,above:s,below:i,area:a,scale:l}=e,c=n._loop?"angle":e.axis;t.save(),c==="x"&&i!==s&&(r2(t,r,a.top),s2(t,{line:n,target:r,color:s,scale:l,property:c}),t.restore(),t.save(),r2(t,r,a.bottom)),s2(t,{line:n,target:r,color:i,scale:l,property:c}),t.restore()}function r2(t,e,n){const{segments:r,points:s}=e;let i=!0,a=!1;t.beginPath();for(const l of r){const{start:c,end:d}=l,u=s[c],h=s[Xu(c,d,s)];i?(t.moveTo(u.x,u.y),i=!1):(t.lineTo(u.x,n),t.lineTo(u.x,u.y)),a=!!e.pathSegment(t,l,{move:a}),a?t.closePath():t.lineTo(h.x,n)}t.lineTo(e.first().x,n),t.closePath(),t.clip()}function s2(t,e){const{line:n,target:r,property:s,color:i,scale:a}=e,l=_S(n,r,s);for(const{source:c,target:d,start:u,end:h}of l){const{style:{backgroundColor:f=i}={}}=c,m=r!==!0;t.save(),t.fillStyle=f,NS(t,a,m&&Ku(s,u,h)),t.beginPath();const g=!!n.pathSegment(t,c);let p;if(m){g?t.closePath():i2(t,r,h,s);const _=!!r.pathSegment(t,d,{move:g,reverse:!0});p=g&&_,p||i2(t,r,u,s)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function NS(t,e,n){const{top:r,bottom:s}=e.chart.chartArea,{property:i,start:a,end:l}=n||{};i==="x"&&(t.beginPath(),t.rect(a,r,l-a,s-r),t.clip())}function i2(t,e,n,r){const s=e.interpolate(n,r);s&&t.lineTo(s.x,s.y)}var o2={id:"filler",afterDatasetsUpdate(t,e,n){const r=(t.data.datasets||[]).length,s=[];let i,a,l,c;for(a=0;a<r;++a)i=t.getDatasetMeta(a),l=i.dataset,c=null,l&&l.options&&l instanceof wr&&(c={visible:t.isDatasetVisible(a),index:a,fill:bS(l,a,r),chart:t,axis:i.controller.options.indexAxis,scale:i.vScale,line:l}),i.$filler=c,s.push(c);for(a=0;a<r;++a)c=s[a],!(!c||c.fill===!1)&&(c.fill=wS(s,a,n.propagate))},beforeDraw(t,e,n){const r=n.drawTime==="beforeDraw",s=t.getSortedVisibleDatasetMetas(),i=t.chartArea;for(let a=s.length-1;a>=0;--a){const l=s[a].$filler;l&&(l.line.updateControlPoints(i,l.axis),r&&l.fill&&Ju(t.ctx,l,i))}},beforeDatasetsDraw(t,e,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=t.getSortedVisibleDatasetMetas();for(let s=r.length-1;s>=0;--s){const i=r[s].$filler;t2(i)&&Ju(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,n){const r=e.meta.$filler;!t2(r)||n.drawTime!=="beforeDatasetDraw"||Ju(t.ctx,r,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Wo={average(t){if(!t.length)return!1;let e,n,r=new Set,s=0,i=0;for(e=0,n=t.length;e<n;++e){const l=t[e].element;if(l&&l.hasValue()){const c=l.tooltipPosition();r.add(c.x),s+=c.y,++i}}return{x:[...r].reduce((l,c)=>l+c)/r.size,y:s/i}},nearest(t,e){if(!t.length)return!1;let n=e.x,r=e.y,s=Number.POSITIVE_INFINITY,i,a,l;for(i=0,a=t.length;i<a;++i){const c=t[i].element;if(c&&c.hasValue()){const d=c.getCenterPoint(),u=Mu(e,d);u<s&&(s=u,l=c)}}if(l){const c=l.tooltipPosition();n=c.x,r=c.y}return{x:n,y:r}}};function tr(t,e){return e&&(st(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function br(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
38
38
  `)>-1?t.split(`
39
- `):t}function BS(t,e){const{element:n,datasetIndex:r,index:s}=e,i=t.getDatasetMeta(r).controller,{label:a,value:l}=i.getLabelAndValue(s);return{chart:t,label:a,parsed:i.getParsed(s),raw:t.data.datasets[r].data[s],formattedValue:l,dataset:i.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function a2(t,e){const n=t.chart.ctx,{body:r,footer:s,title:i}=t,{boxWidth:a,boxHeight:l}=e,c=an(e.bodyFont),d=an(e.titleFont),u=an(e.footerFont),h=i.length,f=s.length,m=r.length,g=yn(e.padding);let p=g.height,_=0,y=r.reduce((v,M)=>v+M.before.length+M.lines.length+M.after.length,0);if(y+=t.beforeBody.length+t.afterBody.length,h&&(p+=h*d.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),y){const v=e.displayColors?Math.max(l,c.lineHeight):c.lineHeight;p+=m*v+(y-m)*c.lineHeight+(y-1)*e.bodySpacing}f&&(p+=e.footerMarginTop+f*u.lineHeight+(f-1)*e.footerSpacing);let C=0;const k=function(v){_=Math.max(_,n.measureText(v).width+C)};return n.save(),n.font=d.string,Re(t.title,k),n.font=c.string,Re(t.beforeBody.concat(t.afterBody),k),C=e.displayColors?a+2+e.boxPadding:0,Re(r,v=>{Re(v.before,k),Re(v.lines,k),Re(v.after,k)}),C=0,n.font=u.string,Re(t.footer,k),n.restore(),_+=g.width,{width:_,height:p}}function AS(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function FS(t,e,n,r){const{x:s,width:i}=r,a=n.caretSize+n.caretPadding;if(t==="left"&&s+i+a>e.width||t==="right"&&s-i-a<0)return!0}function RS(t,e,n,r){const{x:s,width:i}=n,{width:a,chartArea:{left:l,right:c}}=t;let d="center";return r==="center"?d=s<=(l+c)/2?"left":"right":s<=i/2?d="left":s>=a-i/2&&(d="right"),FS(d,t,e,n)&&(d="center"),d}function l2(t,e,n){const r=n.yAlign||e.yAlign||AS(t,n);return{xAlign:n.xAlign||e.xAlign||RS(t,e,n,r),yAlign:r}}function IS(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function HS(t,e,n){let{y:r,height:s}=t;return e==="top"?r+=n:e==="bottom"?r-=s+n:r-=s/2,r}function c2(t,e,n,r){const{caretSize:s,caretPadding:i,cornerRadius:a}=t,{xAlign:l,yAlign:c}=n,d=s+i,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:m}=Po(a);let g=IS(e,l);const p=HS(e,c,d);return c==="center"?l==="left"?g+=d:l==="right"&&(g-=d):l==="left"?g-=Math.max(u,f)+s:l==="right"&&(g+=Math.max(h,m)+s),{x:_n(g,0,r.width-e.width),y:_n(p,0,r.height-e.height)}}function vl(t,e,n){const r=yn(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function d2(t){return tr([],br(t))}function zS(t,e,n){return ts(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function u2(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const h2={beforeTitle:gr,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:gr,beforeBody:gr,beforeLabel:gr,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return Ue(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:gr,afterBody:gr,beforeFooter:gr,footer:gr,afterFooter:gr};function jt(t,e,n,r){const s=t[e].call(n,r);return typeof s>"u"?h2[e].call(n,r):s}class Qu extends As{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,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,i=new mp(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=zS(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,s=jt(r,"beforeTitle",this,e),i=jt(r,"title",this,e),a=jt(r,"afterTitle",this,e);let l=[];return l=tr(l,br(s)),l=tr(l,br(i)),l=tr(l,br(a)),l}getBeforeBody(e,n){return d2(jt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,s=[];return Re(e,i=>{const a={before:[],lines:[],after:[]},l=u2(r,i);tr(a.before,br(jt(l,"beforeLabel",this,i))),tr(a.lines,jt(l,"label",this,i)),tr(a.after,br(jt(l,"afterLabel",this,i))),s.push(a)}),s}getAfterBody(e,n){return d2(jt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,s=jt(r,"beforeFooter",this,e),i=jt(r,"footer",this,e),a=jt(r,"afterFooter",this,e);let l=[];return l=tr(l,br(s)),l=tr(l,br(i)),l=tr(l,br(a)),l}_createItems(e){const n=this._active,r=this.chart.data,s=[],i=[],a=[];let l=[],c,d;for(c=0,d=n.length;c<d;++c)l.push(BS(this.chart,n[c]));return e.filter&&(l=l.filter((u,h,f)=>e.filter(u,h,f,r))),e.itemSort&&(l=l.sort((u,h)=>e.itemSort(u,h,r))),Re(l,u=>{const h=u2(e.callbacks,u);s.push(jt(h,"labelColor",this,u)),i.push(jt(h,"labelPointStyle",this,u)),a.push(jt(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=l,l}update(e,n){const r=this.options.setContext(this.getContext()),s=this._active;let i,a=[];if(!s.length)this.opacity!==0&&(i={opacity:0});else{const l=Wo[r.position].call(this,s,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const c=this._size=a2(this,r),d=Object.assign({},l,c),u=l2(this.chart,r,d),h=c2(r,d,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,s){const i=this.getCaretPosition(e,r,s);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(e,n,r){const{xAlign:s,yAlign:i}=this,{caretSize:a,cornerRadius:l}=r,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:h}=Po(l),{x:f,y:m}=e,{width:g,height:p}=n;let _,y,C,k,v,M;return i==="center"?(v=m+p/2,s==="left"?(_=f,y=_-a,k=v+a,M=v-a):(_=f+g,y=_+a,k=v-a,M=v+a),C=_):(s==="left"?y=f+Math.max(c,u)+a:s==="right"?y=f+g-Math.max(d,h)-a:y=this.caretX,i==="top"?(k=m,v=k-a,_=y-a,C=y+a):(k=m+p,v=k+a,_=y+a,C=y-a),M=k),{x1:_,x2:y,x3:C,y1:k,y2:v,y3:M}}drawTitle(e,n,r){const s=this.title,i=s.length;let a,l,c;if(i){const d=Iu(r.rtl,this.x,this.width);for(e.x=vl(this,r.titleAlign,r),n.textAlign=d.textAlign(r.titleAlign),n.textBaseline="middle",a=an(r.titleFont),l=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,c=0;c<i;++c)n.fillText(s[c],d.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+l,c+1===i&&(e.y+=r.titleMarginBottom-l)}}_drawColorBox(e,n,r,s,i){const a=this.labelColors[r],l=this.labelPointStyles[r],{boxHeight:c,boxWidth:d}=i,u=an(i.bodyFont),h=vl(this,"left",i),f=s.x(h),m=c<u.lineHeight?(u.lineHeight-c)/2:0,g=n.y+m;if(i.usePointStyle){const p={radius:Math.min(d,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},_=s.leftForLtr(f,d)+d/2,y=g+c/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,$u(e,p,_,y),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,$u(e,p,_,y)}else{e.lineWidth=Te(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;const p=s.leftForLtr(f,d),_=s.leftForLtr(s.xPlus(f,1),d-2),y=Po(a.borderRadius);Object.values(y).some(C=>C!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,Vu(e,{x:p,y:g,w:d,h:c,radius:y}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),Vu(e,{x:_,y:g+1,w:d-2,h:c-2,radius:y}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(p,g,d,c),e.strokeRect(p,g,d,c),e.fillStyle=a.backgroundColor,e.fillRect(_,g+1,d-2,c-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:s}=this,{bodySpacing:i,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:d,boxPadding:u}=r,h=an(r.bodyFont);let f=h.lineHeight,m=0;const g=Iu(r.rtl,this.x,this.width),p=function(O){n.fillText(O,g.x(e.x+m),e.y+f/2),e.y+=f+i},_=g.textAlign(a);let y,C,k,v,M,T,S;for(n.textAlign=a,n.textBaseline="middle",n.font=h.string,e.x=vl(this,_,r),n.fillStyle=r.bodyColor,Re(this.beforeBody,p),m=l&&_!=="right"?a==="center"?d/2+u:d+2+u:0,v=0,T=s.length;v<T;++v){for(y=s[v],C=this.labelTextColors[v],n.fillStyle=C,Re(y.before,p),k=y.lines,l&&k.length&&(this._drawColorBox(n,e,v,g,r),f=Math.max(h.lineHeight,c)),M=0,S=k.length;M<S;++M)p(k[M]),f=h.lineHeight;Re(y.after,p)}m=0,f=h.lineHeight,Re(this.afterBody,p),e.y-=i}drawFooter(e,n,r){const s=this.footer,i=s.length;let a,l;if(i){const c=Iu(r.rtl,this.x,this.width);for(e.x=vl(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=c.textAlign(r.footerAlign),n.textBaseline="middle",a=an(r.footerFont),n.fillStyle=r.footerColor,n.font=a.string,l=0;l<i;++l)n.fillText(s[l],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+r.footerSpacing}}drawBackground(e,n,r,s){const{xAlign:i,yAlign:a}=this,{x:l,y:c}=e,{width:d,height:u}=r,{topLeft:h,topRight:f,bottomLeft:m,bottomRight:g}=Po(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(l+h,c),a==="top"&&this.drawCaret(e,n,r,s),n.lineTo(l+d-f,c),n.quadraticCurveTo(l+d,c,l+d,c+f),a==="center"&&i==="right"&&this.drawCaret(e,n,r,s),n.lineTo(l+d,c+u-g),n.quadraticCurveTo(l+d,c+u,l+d-g,c+u),a==="bottom"&&this.drawCaret(e,n,r,s),n.lineTo(l+m,c+u),n.quadraticCurveTo(l,c+u,l,c+u-m),a==="center"&&i==="left"&&this.drawCaret(e,n,r,s),n.lineTo(l,c+h),n.quadraticCurveTo(l,c,l+h,c),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,s=r&&r.x,i=r&&r.y;if(s||i){const a=Wo[e.position].call(this,this._active,this._eventPosition);if(!a)return;const l=this._size=a2(this,e),c=Object.assign({},a,this._size),d=l2(n,e,c),u=c2(e,c,d,n);(s._to!==u.x||i._to!==u.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},i={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=yn(n.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&l&&(e.save(),e.globalAlpha=r,this.drawBackground(i,e,s,n),Ex(e,n.textDirection),i.y+=a.top,this.drawTitle(i,e,n),this.drawBody(i,e,n),this.drawFooter(i,e,n),$x(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,s=e.map(({datasetIndex:l,index:c})=>{const d=this.chart.getDatasetMeta(l);if(!d)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:d.data[c],index:c}}),i=!nl(r,s),a=this._positionChanged(s,n);(i||a)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,i=this._active||[],a=this._getActiveElements(e,i,n,r),l=this._positionChanged(a,e),c=n||!nl(a,i)||l;return c&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),c}_getActiveElements(e,n,r,s){const i=this.options;if(e.type==="mouseout")return[];if(!s)return n.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);const a=this.chart.getElementsAtEventForMode(e,i.mode,i,r);return i.reverse&&a.reverse(),a}_positionChanged(e,n){const{caretX:r,caretY:s,options:i}=this,a=Wo[i.position].call(this,e,n);return a!==!1&&(r!==a.x||s!==a.y)}}W(Qu,"positioners",Wo);var YS={id:"tooltip",_element:Qu,positioners:Wo,afterInit(t,e,n){n&&(t.tooltip=new Qu({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:h2},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"]};const WS=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function jS(t,e,n,r){const s=t.indexOf(e);if(s===-1)return WS(t,e,n,r);const i=t.lastIndexOf(e);return s!==i?n:s}const ZS=(t,e)=>t===null?null:_n(Math.round(t),0,e);function f2(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class Tl extends Fs{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:s,label:i}of n)r[s]===i&&r.splice(s,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(Ue(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:jS(r,e,Fe(n,e),this._addedLabels),ZS(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(s=this.getLabels().length-1)),this.min=r,this.max=s}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,s=[];let i=this.getLabels();i=e===0&&n===i.length-1?i:i.slice(e,n+1),this._valueRange=Math.max(i.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let a=e;a<=n;a++)s.push({value:a});return s}getLabelForValue(e){return f2.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}W(Tl,"id","category"),W(Tl,"defaults",{ticks:{callback:f2}});function US(t,e){const n=[],{bounds:s,step:i,min:a,max:l,precision:c,count:d,maxTicks:u,maxDigits:h,includeBounds:f}=t,m=i||1,g=u-1,{min:p,max:_}=e,y=!Ue(a),C=!Ue(l),k=!Ue(d),v=(_-p)/(h+1);let M=Nm((_-p)/g/m)*m,T,S,O,E;if(M<1e-14&&!y&&!C)return[{value:p},{value:_}];E=Math.ceil(_/M)-Math.floor(p/M),E>g&&(M=Nm(E*M/g/m)*m),Ue(c)||(T=Math.pow(10,c),M=Math.ceil(M*T)/T),s==="ticks"?(S=Math.floor(p/M)*M,O=Math.ceil(_/M)*M):(S=p,O=_),y&&C&&i&&xC((l-a)/i,M/1e3)?(E=Math.round(Math.min((l-a)/M,u)),M=(l-a)/E,S=a,O=l):k?(S=y?a:S,O=C?l:O,E=d-1,M=(O-S)/E):(E=(O-S)/M,Do(E,Math.round(E),M/1e3)?E=Math.round(E):E=Math.ceil(E));const I=Math.max(Am(M),Am(S));T=Math.pow(10,Ue(c)?I:c),S=Math.round(S*T)/T,O=Math.round(O*T)/T;let j=0;for(y&&(f&&S!==a?(n.push({value:a}),S<a&&j++,Do(Math.round((S+j*M)*T)/T,a,m2(a,v,t))&&j++):S<a&&j++);j<E;++j){const $=Math.round((S+j*M)*T)/T;if(C&&$>l)break;n.push({value:$})}return C&&f&&O!==l?n.length&&Do(n[n.length-1].value,l,m2(l,v,t))?n[n.length-1].value=l:n.push({value:l}):(!C||O===l)&&n.push({value:O}),n}function m2(t,e,{horizontal:n,minRotation:r}){const s=es(r),i=(n?Math.sin(s):Math.cos(s))||.001,a=.75*e*(""+t).length;return Math.min(e/i,a)}class Dl extends Fs{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 Ue(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:i}=this;const a=c=>s=n?s:c,l=c=>i=r?i:c;if(e){const c=xi(s),d=xi(i);c<0&&d<0?l(0):c>0&&d>0&&a(0)}if(s===i){let c=i===0?1:Math.abs(i*.05);l(i+c),e||a(s-c)}this.min=s,this.max=i}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,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},i=this._range||this,a=US(s,i);return e.bounds==="ticks"&&Bm(a,this,"value"),e.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const s=(r-n)/Math.max(e.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return Du(e,this.chart.options.locale,this.options.ticks.format)}}class Ol extends Dl{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=lt(e)?e:0,this.max=lt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=es(this.options.ticks.minRotation),s=(e?Math.sin(r):Math.cos(r))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}W(Ol,"id","linear"),W(Ol,"defaults",{ticks:{callback:ll.formatters.numeric}});const jo=t=>Math.floor(Qr(t)),Rs=(t,e)=>Math.pow(10,jo(t)+e);function p2(t){return t/Math.pow(10,jo(t))===1}function g2(t,e,n){const r=Math.pow(10,n),s=Math.floor(t/r);return Math.ceil(e/r)-s}function qS(t,e){const n=e-t;let r=jo(n);for(;g2(t,e,r)>10;)r++;for(;g2(t,e,r)<10;)r--;return Math.min(r,jo(t))}function GS(t,{min:e,max:n}){e=nn(t.min,e);const r=[],s=jo(e);let i=qS(e,n),a=i<0?Math.pow(10,Math.abs(i)):1;const l=Math.pow(10,i),c=s>i?Math.pow(10,s):0,d=Math.round((e-c)*a)/a,u=Math.floor((e-c)/l/10)*l*10;let h=Math.floor((d-u)/Math.pow(10,i)),f=nn(t.min,Math.round((c+u+h*Math.pow(10,i))*a)/a);for(;f<n;)r.push({value:f,major:p2(f),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(i++,h=2,a=i>=0?1:a),f=Math.round((c+u+h*Math.pow(10,i))*a)/a;const m=nn(t.max,f);return r.push({value:m,major:p2(m),significand:h}),r}class _2 extends Fs{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,n){const r=Dl.prototype.parse.apply(this,[e,n]);if(r===0){this._zero=!0;return}return lt(r)&&r>0?r:null}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=lt(e)?Math.max(0,e):null,this.max=lt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!lt(this._userMin)&&(this.min=e===Rs(this.min,0)?Rs(this.min,-1):Rs(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let r=this.min,s=this.max;const i=l=>r=e?r:l,a=l=>s=n?s:l;r===s&&(r<=0?(i(1),a(10)):(i(Rs(r,-1)),a(Rs(s,1)))),r<=0&&i(Rs(s,-1)),s<=0&&a(Rs(r,1)),this.min=r,this.max=s}buildTicks(){const e=this.options,n={min:this._userMin,max:this._userMax},r=GS(n,this);return e.bounds==="ticks"&&Bm(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}getLabelForValue(e){return e===void 0?"0":Du(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=Qr(e),this._valueRange=Qr(this.max)-Qr(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Qr(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const n=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+n*this._valueRange)}}W(_2,"id","logarithmic"),W(_2,"defaults",{ticks:{callback:ll.formatters.logarithmic,major:{enabled:!0}}});function e1(t){const e=t.ticks;if(e.display&&t.display){const n=yn(e.backdropPadding);return Fe(e.font&&e.font.size,gt.font.size)+n.height}return 0}function KS(t,e,n){return n=st(n)?n:[n],{w:WC(t,e.string,n),h:n.length*e.lineHeight}}function y2(t,e,n,r,s){return t===r||t===s?{start:e-n/2,end:e+n/2}:t<r||t>s?{start:e-n,end:e}:{start:e,end:e+n}}function XS(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),r=[],s=[],i=t._pointLabels.length,a=t.options.pointLabels,l=a.centerPointLabels?Dt/i:0;for(let c=0;c<i;c++){const d=a.setContext(t.getPointLabelContext(c));s[c]=d.padding;const u=t.getPointPosition(c,t.drawingArea+s[c],l),h=an(d.font),f=KS(t.ctx,h,t._pointLabels[c]);r[c]=f;const m=on(t.getIndexAngle(c)+l),g=Math.round(xu(m)),p=y2(g,u.x,f.w,0,180),_=y2(g,u.y,f.h,90,270);JS(n,e,m,p,_)}t.setCenterPoint(e.l-n.l,n.r-e.r,e.t-n.t,n.b-e.b),t._pointLabelItems=tv(t,r,s)}function JS(t,e,n,r,s){const i=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));let l=0,c=0;r.start<e.l?(l=(e.l-r.start)/i,t.l=Math.min(t.l,e.l-l)):r.end>e.r&&(l=(r.end-e.r)/i,t.r=Math.max(t.r,e.r+l)),s.start<e.t?(c=(e.t-s.start)/a,t.t=Math.min(t.t,e.t-c)):s.end>e.b&&(c=(s.end-e.b)/a,t.b=Math.max(t.b,e.b+c))}function QS(t,e,n){const r=t.drawingArea,{extra:s,additionalAngle:i,padding:a,size:l}=n,c=t.getPointPosition(e,r+s+a,i),d=Math.round(xu(on(c.angle+sn))),u=sv(c.y,l.h,d),h=nv(d),f=rv(c.x,l.w,h);return{visible:!0,x:c.x,y:u,textAlign:h,left:f,top:u,right:f+l.w,bottom:u+l.h}}function ev(t,e){if(!e)return!0;const{left:n,top:r,right:s,bottom:i}=t;return!(_r({x:n,y:r},e)||_r({x:n,y:i},e)||_r({x:s,y:r},e)||_r({x:s,y:i},e))}function tv(t,e,n){const r=[],s=t._pointLabels.length,i=t.options,{centerPointLabels:a,display:l}=i.pointLabels,c={extra:e1(i)/2,additionalAngle:a?Dt/s:0};let d;for(let u=0;u<s;u++){c.padding=n[u],c.size=e[u];const h=QS(t,u,c);r.push(h),l==="auto"&&(h.visible=ev(h,d),h.visible&&(d=h))}return r}function nv(t){return t===0||t===180?"center":t<180?"left":"right"}function rv(t,e,n){return n==="right"?t-=e:n==="center"&&(t-=e/2),t}function sv(t,e,n){return n===90||n===270?t-=e/2:(n>270||n<90)&&(t-=e),t}function iv(t,e,n){const{left:r,top:s,right:i,bottom:a}=n,{backdropColor:l}=e;if(!Ue(l)){const c=Po(e.borderRadius),d=yn(e.backdropPadding);t.fillStyle=l;const u=r-d.left,h=s-d.top,f=i-r+d.width,m=a-s+d.height;Object.values(c).some(g=>g!==0)?(t.beginPath(),Vu(t,{x:u,y:h,w:f,h:m,radius:c}),t.fill()):t.fillRect(u,h,f,m)}}function ov(t,e){const{ctx:n,options:{pointLabels:r}}=t;for(let s=e-1;s>=0;s--){const i=t._pointLabelItems[s];if(!i.visible)continue;const a=r.setContext(t.getPointLabelContext(s));iv(n,a,i);const l=an(a.font),{x:c,y:d,textAlign:u}=i;dl(n,t._pointLabels[s],c,d+l.lineHeight/2,l,{color:a.color,textAlign:u,textBaseline:"middle"})}}function w2(t,e,n,r){const{ctx:s}=t;if(n)s.arc(t.xCenter,t.yCenter,e,0,rn);else{let i=t.getPointPosition(0,e);s.moveTo(i.x,i.y);for(let a=1;a<r;a++)i=t.getPointPosition(a,e),s.lineTo(i.x,i.y)}}function av(t,e,n,r,s){const i=t.ctx,a=e.circular,{color:l,lineWidth:c}=e;!a&&!r||!l||!c||n<0||(i.save(),i.strokeStyle=l,i.lineWidth=c,i.setLineDash(s.dash),i.lineDashOffset=s.dashOffset,i.beginPath(),w2(t,n,a,r),i.closePath(),i.stroke(),i.restore())}function lv(t,e,n){return ts(t,{label:n,index:e,type:"pointLabel"})}class El extends Dl{constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const e=this._padding=yn(e1(this.options)/2),n=this.width=this.maxWidth-e.width,r=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+n/2+e.left),this.yCenter=Math.floor(this.top+r/2+e.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!1);this.min=lt(e)&&!isNaN(e)?e:0,this.max=lt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/e1(this.options))}generateTickLabels(e){Dl.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((n,r)=>{const s=ct(this.options.pointLabels.callback,[n,r],this);return s||s===0?s:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const e=this.options;e.display&&e.pointLabels.display?XS(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,r,s){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((r-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,r,s))}getIndexAngle(e){const n=rn/(this._pointLabels.length||1),r=this.options.startAngle||0;return on(e*n+es(r))}getDistanceFromCenterForValue(e){if(Ue(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(Ue(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<n.length){const r=n[e];return lv(this.getContext(),e,r)}}getPointPosition(e,n,r=0){const s=this.getIndexAngle(e)-sn+r;return{x:Math.cos(s)*n+this.xCenter,y:Math.sin(s)*n+this.yCenter,angle:s}}getPointPositionForValue(e,n){return this.getPointPosition(e,this.getDistanceFromCenterForValue(n))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){const{left:n,top:r,right:s,bottom:i}=this._pointLabelItems[e];return{left:n,top:r,right:s,bottom:i}}drawBackground(){const{backgroundColor:e,grid:{circular:n}}=this.options;if(e){const r=this.ctx;r.save(),r.beginPath(),w2(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=e,r.fill(),r.restore()}}drawGrid(){const e=this.ctx,n=this.options,{angleLines:r,grid:s,border:i}=n,a=this._pointLabels.length;let l,c,d;if(n.pointLabels.display&&ov(this,a),s.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const f=this.getContext(h),m=s.setContext(f),g=i.setContext(f);av(this,m,c,a,g)}}),r.display){for(e.save(),l=a-1;l>=0;l--){const u=r.setContext(this.getPointLabelContext(l)),{color:h,lineWidth:f}=u;!f||!h||(e.lineWidth=f,e.strokeStyle=h,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(n.ticks.reverse?this.min:this.max),d=this.getPointPosition(l,c),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(d.x,d.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const s=this.getIndexAngle(0);let i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(s),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((l,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;const d=r.setContext(this.getContext(c)),u=an(d.font);if(i=this.getDistanceFromCenterForValue(this.ticks[c].value),d.showLabelBackdrop){e.font=u.string,a=e.measureText(l.label).width,e.fillStyle=d.backdropColor;const h=yn(d.backdropPadding);e.fillRect(-a/2-h.left,-i-u.size/2-h.top,a+h.width,u.size+h.height)}dl(e,l.label,0,-i,u,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),e.restore()}drawTitle(){}}W(El,"id","radialLinear"),W(El,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ll.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),W(El,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),W(El,"descriptors",{angleLines:{_fallback:"grid"}});const $l={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}},Zt=Object.keys($l);function b2(t,e){return t-e}function k2(t,e){if(Ue(e))return null;const n=t._adapter,{parser:r,round:s,isoWeekday:i}=t._parseOpts;let a=e;return typeof r=="function"&&(a=r(a)),lt(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(s&&(a=s==="week"&&(Oo(i)||i===!0)?n.startOf(a,"isoWeek",i):n.startOf(a,s)),+a)}function C2(t,e,n,r){const s=Zt.length;for(let i=Zt.indexOf(t);i<s-1;++i){const a=$l[Zt[i]],l=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-e)/(l*a.size))<=r)return Zt[i]}return Zt[s-1]}function cv(t,e,n,r,s){for(let i=Zt.length-1;i>=Zt.indexOf(n);i--){const a=Zt[i];if($l[a].common&&t._adapter.diff(s,r,a)>=e-1)return a}return Zt[n?Zt.indexOf(n):0]}function dv(t){for(let e=Zt.indexOf(t)+1,n=Zt.length;e<n;++e)if($l[Zt[e]].common)return Zt[e]}function x2(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:s}=Su(n,e),i=n[r]>=e?n[r]:n[s];t[i]=!0}}function uv(t,e,n,r){const s=t._adapter,i=+s.startOf(e[0].value,r),a=e[e.length-1].value;let l,c;for(l=i;l<=a;l=+s.add(l,1,r))c=n[l],c>=0&&(e[c].major=!0);return e}function M2(t,e,n){const r=[],s={},i=e.length;let a,l;for(a=0;a<i;++a)l=e[a],s[l]=a,r.push({value:l,major:!1});return i===0||!n?r:uv(t,r,s,n)}class Pl extends Fs{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),s=this._adapter=new Jx._date(e.adapters.date);s.init(n),To(r.displayFormats,s.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:k2(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:s,max:i,minDefined:a,maxDefined:l}=this.getUserBounds();function c(d){!a&&!isNaN(d.min)&&(s=Math.min(s,d.min)),!l&&!isNaN(d.max)&&(i=Math.max(i,d.max))}(!a||!l)&&(c(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&c(this.getMinMax(!1))),s=lt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),r),i=lt(i)&&!isNaN(i)?i:+n.endOf(Date.now(),r)+1,this.min=Math.min(s,i-1),this.max=Math.max(s+1,i)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,s=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const i=this.min,a=this.max,l=DC(s,i,a);return this._unit=n.unit||(r.autoSkip?C2(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):cv(this,l.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:dv(this._unit),this.initOffsets(s),e.reverse&&l.reverse(),M2(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,s,i;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?n=1-s:n=(this.getDecimalForValue(e[1])-s)/2,i=this.getDecimalForValue(e[e.length-1]),e.length===1?r=i:r=(i-this.getDecimalForValue(e[e.length-2]))/2);const a=e.length<3?.5:.25;n=_n(n,0,a),r=_n(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,s=this.options,i=s.time,a=i.unit||C2(i.minUnit,n,r,this._getLabelCapacity(n)),l=Fe(s.ticks.stepSize,1),c=a==="week"?i.isoWeekday:!1,d=Oo(c)||c===!0,u={};let h=n,f,m;if(d&&(h=+e.startOf(h,"isoWeek",c)),h=+e.startOf(h,d?"day":a),e.diff(r,n,a)>1e5*l)throw new Error(n+" and "+r+" are too far apart with stepSize of "+l+" "+a);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=h,m=0;f<r;f=+e.add(f,l,a),m++)x2(u,f,g);return(f===r||s.bounds==="ticks"||m===1)&&x2(u,f,g),Object.keys(u).sort(b2).map(p=>+p)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const s=this.options.time.displayFormats,i=this._unit,a=n||s[i];return this._adapter.format(e,a)}_tickFormatFunction(e,n,r,s){const i=this.options,a=i.ticks.callback;if(a)return ct(a,[e,n,r],this);const l=i.time.displayFormats,c=this._unit,d=this._majorUnit,u=c&&l[c],h=d&&l[d],f=r[n],m=d&&h&&f&&f.major;return this._adapter.format(e,s||(m?h:u))}generateTickLabels(e){let n,r,s;for(n=0,r=e.length;n<r;++n)s=e[n],s.label=this._tickFormatFunction(s.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,s=es(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(s),a=Math.sin(s),l=this._resolveTickFontOptions(0).size;return{w:r*i+l*a,h:r*a+l*i}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,s=r[n.unit]||r.millisecond,i=this._tickFormatFunction(e,0,M2(this,[e],this._majorUnit),s),a=this._getLabelSize(i),l=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return l>0?l:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n<r;++n)e=e.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const s=this.getLabels();for(n=0,r=s.length;n<r;++n)e.push(k2(this,s[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return EC(e.sort(b2))}}W(Pl,"id","time"),W(Pl,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ll(t,e,n){let r=0,s=t.length-1,i,a,l,c;n?(e>=t[r].pos&&e<=t[s].pos&&({lo:r,hi:s}=Es(t,"pos",e)),{pos:i,time:l}=t[r],{pos:a,time:c}=t[s]):(e>=t[r].time&&e<=t[s].time&&({lo:r,hi:s}=Es(t,"time",e)),{time:i,pos:l}=t[r],{time:a,pos:c}=t[s]);const d=a-i;return d?l+(c-l)*(e-i)/d:l}class S2 extends Pl{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=Ll(n,this.min),this._tableRange=Ll(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,s=[],i=[];let a,l,c,d,u;for(a=0,l=e.length;a<l;++a)d=e[a],d>=n&&d<=r&&s.push(d);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,l=s.length;a<l;++a)u=s[a+1],c=s[a-1],d=s[a],Math.round((u+c)/2)!==d&&i.push({time:d,pos:a/(l-1)});return i}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((s,i)=>s-i)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Ll(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Ll(this._table,r*this._tableRange+this._minPos,!0)}}W(S2,"id","timeseries"),W(S2,"defaults",Pl.defaults);const v2={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},hv={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...v2,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},fv=o.version[0]==="2"?(t,e)=>Object.assign(t,{attrs:e}):(t,e)=>Object.assign(t,e);function vi(t){return o.isProxy(t)?o.toRaw(t):t}function mv(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t;return o.isProxy(e)?new Proxy(t,{}):t}function pv(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function T2(t,e){t.labels=e}function D2(t,e,n){const r=[];t.datasets=e.map(s=>{const i=t.datasets.find(a=>a[n]===s[n]);return!i||!s.data||r.includes(i)?{...s}:(r.push(i),Object.assign(i,s),i)})}function gv(t,e){const n={labels:[],datasets:[]};return T2(n,t.labels),D2(n,t.datasets,e),n}const _v=o.defineComponent({props:hv,setup(t,e){let{expose:n,slots:r}=e;const s=o.ref(null),i=o.shallowRef(null);n({chart:i});const a=()=>{if(!s.value)return;const{type:d,data:u,options:h,plugins:f,datasetIdKey:m}=t,g=gv(u,m),p=mv(g,u);i.value=new zo(s.value,{type:d,data:p,options:{...h},plugins:f})},l=()=>{const d=o.toRaw(i.value);d&&(t.destroyDelay>0?setTimeout(()=>{d.destroy(),i.value=null},t.destroyDelay):(d.destroy(),i.value=null))},c=d=>{d.update(t.updateMode)};return o.onMounted(a),o.onUnmounted(l),o.watch([()=>t.options,()=>t.data],(d,u)=>{let[h,f]=d,[m,g]=u;const p=o.toRaw(i.value);if(!p)return;let _=!1;if(h){const y=vi(h),C=vi(m);y&&y!==C&&(pv(p,y),_=!0)}if(f){const y=vi(f.labels),C=vi(g.labels),k=vi(f.datasets),v=vi(g.datasets);y!==C&&(T2(p.config.data,y),_=!0),k&&k!==v&&(D2(p.config.data,k,t.datasetIdKey),_=!0)}_&&o.nextTick(()=>{c(p)})},{deep:!0}),()=>o.h("canvas",{role:"img",ariaLabel:t.ariaLabel,ariaDescribedby:t.ariaDescribedby,ref:s},[o.h("p",{},[r.default?r.default():""])])}});function yv(t,e){return zo.register(e),o.defineComponent({props:v2,setup(n,r){let{expose:s}=r;const i=o.shallowRef(null),a=l=>{i.value=l==null?void 0:l.chart};return s({chart:i}),()=>o.h(_v,fv({ref:a},{type:t,...n}))}})}const O2=yv("line",gl),wv={class:"chart-container"},t1={__name:"LineChart",props:{data:{type:Array,required:!0},dataType:{type:String,required:!0},isMask:{type:Boolean,default:!1},ticksCallback:{type:Function,default:t=>t},borderColor:{type:String,default:"#007AFF"},gradient:{type:Object,default:{height:450,startColor:"rgba(0, 122, 255, 0.1)",endColor:"rgba(0, 122, 255, 0)"}}},setup(t){zo.register(Tl,Ol,Yo,wr,YS,o2);const e=t,n=o.ref(0);let r=o.reactive({isEmpty:!0});const s=h=>{const f=new Set,m=[];let g=[];switch(e.dataType){case"balanceChartData":g=h.length!==0?h.map(_=>(f.add(_.date),Et(_.balance*Mc(),2))):[0,0];break;case"performanceChartData":g=h.length!==0?h.map((_,y)=>(f.add(_.date),Et(y?_.pnl_to_deposit+_[y-1].pnl_to_deposit:_.pnl_to_deposit,2))):[0,0];break}m.push({data:g});const p=Array.from(f);return p.length===1?(p.push(...p),m.forEach(_=>{_.data.push(..._.data)}),r.isEmpty=!1):p.length===0?(r.isEmpty=!0,p.push(0,0)):r.isEmpty=!1,{labels:p,datasets:m}},i=o.computed(()=>s(e.data)),a=h=>{const m=h.chart.ctx.createLinearGradient(0,0,0,e.gradient.height);return m.addColorStop(0,e.gradient.startColor),m.addColorStop(1,e.gradient.endColor),m},l=(h,f)=>{let m=document.querySelector(`#${h}-${e.dataType}`);return m||(m=document.createElement("div"),m.classList.add(h),m.setAttribute("id",`${h}-${e.dataType}`),f.canvas.parentNode.appendChild(m)),m},c=h=>{if(!r.isEmpty){const{chart:f,tooltip:m}=h,g=l("chart-tooltip",f);if(m.opacity===0){g.style.opacity="0";return}if(m.body){const M=m.title||[],T=m.body.map(O=>O.lines),S=document.createElement("div");for(S.classList.add("chart-tooltip-middle"),S.innerHTML=`<div class="chart-tooltip-content">
39
+ `):t}function BS(t,e){const{element:n,datasetIndex:r,index:s}=e,i=t.getDatasetMeta(r).controller,{label:a,value:l}=i.getLabelAndValue(s);return{chart:t,label:a,parsed:i.getParsed(s),raw:t.data.datasets[r].data[s],formattedValue:l,dataset:i.getDataset(),dataIndex:s,datasetIndex:r,element:n}}function a2(t,e){const n=t.chart.ctx,{body:r,footer:s,title:i}=t,{boxWidth:a,boxHeight:l}=e,c=an(e.bodyFont),d=an(e.titleFont),u=an(e.footerFont),h=i.length,f=s.length,m=r.length,g=yn(e.padding);let p=g.height,_=0,y=r.reduce((v,M)=>v+M.before.length+M.lines.length+M.after.length,0);if(y+=t.beforeBody.length+t.afterBody.length,h&&(p+=h*d.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),y){const v=e.displayColors?Math.max(l,c.lineHeight):c.lineHeight;p+=m*v+(y-m)*c.lineHeight+(y-1)*e.bodySpacing}f&&(p+=e.footerMarginTop+f*u.lineHeight+(f-1)*e.footerSpacing);let C=0;const k=function(v){_=Math.max(_,n.measureText(v).width+C)};return n.save(),n.font=d.string,Re(t.title,k),n.font=c.string,Re(t.beforeBody.concat(t.afterBody),k),C=e.displayColors?a+2+e.boxPadding:0,Re(r,v=>{Re(v.before,k),Re(v.lines,k),Re(v.after,k)}),C=0,n.font=u.string,Re(t.footer,k),n.restore(),_+=g.width,{width:_,height:p}}function AS(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function FS(t,e,n,r){const{x:s,width:i}=r,a=n.caretSize+n.caretPadding;if(t==="left"&&s+i+a>e.width||t==="right"&&s-i-a<0)return!0}function RS(t,e,n,r){const{x:s,width:i}=n,{width:a,chartArea:{left:l,right:c}}=t;let d="center";return r==="center"?d=s<=(l+c)/2?"left":"right":s<=i/2?d="left":s>=a-i/2&&(d="right"),FS(d,t,e,n)&&(d="center"),d}function l2(t,e,n){const r=n.yAlign||e.yAlign||AS(t,n);return{xAlign:n.xAlign||e.xAlign||RS(t,e,n,r),yAlign:r}}function IS(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function HS(t,e,n){let{y:r,height:s}=t;return e==="top"?r+=n:e==="bottom"?r-=s+n:r-=s/2,r}function c2(t,e,n,r){const{caretSize:s,caretPadding:i,cornerRadius:a}=t,{xAlign:l,yAlign:c}=n,d=s+i,{topLeft:u,topRight:h,bottomLeft:f,bottomRight:m}=Po(a);let g=IS(e,l);const p=HS(e,c,d);return c==="center"?l==="left"?g+=d:l==="right"&&(g-=d):l==="left"?g-=Math.max(u,f)+s:l==="right"&&(g+=Math.max(h,m)+s),{x:_n(g,0,r.width-e.width),y:_n(p,0,r.height-e.height)}}function vl(t,e,n){const r=yn(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function d2(t){return tr([],br(t))}function zS(t,e,n){return ts(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function u2(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const h2={beforeTitle:gr,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:gr,beforeBody:gr,beforeLabel:gr,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return Ue(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:gr,afterBody:gr,beforeFooter:gr,footer:gr,afterFooter:gr};function jt(t,e,n,r){const s=t[e].call(n,r);return typeof s>"u"?h2[e].call(n,r):s}class Qu extends As{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,r=this.options.setContext(this.getContext()),s=r.enabled&&n.options.animation&&r.animations,i=new mp(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(i)),i}getContext(){return this.$context||(this.$context=zS(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,s=jt(r,"beforeTitle",this,e),i=jt(r,"title",this,e),a=jt(r,"afterTitle",this,e);let l=[];return l=tr(l,br(s)),l=tr(l,br(i)),l=tr(l,br(a)),l}getBeforeBody(e,n){return d2(jt(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,s=[];return Re(e,i=>{const a={before:[],lines:[],after:[]},l=u2(r,i);tr(a.before,br(jt(l,"beforeLabel",this,i))),tr(a.lines,jt(l,"label",this,i)),tr(a.after,br(jt(l,"afterLabel",this,i))),s.push(a)}),s}getAfterBody(e,n){return d2(jt(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,s=jt(r,"beforeFooter",this,e),i=jt(r,"footer",this,e),a=jt(r,"afterFooter",this,e);let l=[];return l=tr(l,br(s)),l=tr(l,br(i)),l=tr(l,br(a)),l}_createItems(e){const n=this._active,r=this.chart.data,s=[],i=[],a=[];let l=[],c,d;for(c=0,d=n.length;c<d;++c)l.push(BS(this.chart,n[c]));return e.filter&&(l=l.filter((u,h,f)=>e.filter(u,h,f,r))),e.itemSort&&(l=l.sort((u,h)=>e.itemSort(u,h,r))),Re(l,u=>{const h=u2(e.callbacks,u);s.push(jt(h,"labelColor",this,u)),i.push(jt(h,"labelPointStyle",this,u)),a.push(jt(h,"labelTextColor",this,u))}),this.labelColors=s,this.labelPointStyles=i,this.labelTextColors=a,this.dataPoints=l,l}update(e,n){const r=this.options.setContext(this.getContext()),s=this._active;let i,a=[];if(!s.length)this.opacity!==0&&(i={opacity:0});else{const l=Wo[r.position].call(this,s,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const c=this._size=a2(this,r),d=Object.assign({},l,c),u=l2(this.chart,r,d),h=c2(r,d,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,i={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,i&&this._resolveAnimations().update(this,i),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,s){const i=this.getCaretPosition(e,r,s);n.lineTo(i.x1,i.y1),n.lineTo(i.x2,i.y2),n.lineTo(i.x3,i.y3)}getCaretPosition(e,n,r){const{xAlign:s,yAlign:i}=this,{caretSize:a,cornerRadius:l}=r,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:h}=Po(l),{x:f,y:m}=e,{width:g,height:p}=n;let _,y,C,k,v,M;return i==="center"?(v=m+p/2,s==="left"?(_=f,y=_-a,k=v+a,M=v-a):(_=f+g,y=_+a,k=v-a,M=v+a),C=_):(s==="left"?y=f+Math.max(c,u)+a:s==="right"?y=f+g-Math.max(d,h)-a:y=this.caretX,i==="top"?(k=m,v=k-a,_=y-a,C=y+a):(k=m+p,v=k+a,_=y+a,C=y-a),M=k),{x1:_,x2:y,x3:C,y1:k,y2:v,y3:M}}drawTitle(e,n,r){const s=this.title,i=s.length;let a,l,c;if(i){const d=Iu(r.rtl,this.x,this.width);for(e.x=vl(this,r.titleAlign,r),n.textAlign=d.textAlign(r.titleAlign),n.textBaseline="middle",a=an(r.titleFont),l=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,c=0;c<i;++c)n.fillText(s[c],d.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+l,c+1===i&&(e.y+=r.titleMarginBottom-l)}}_drawColorBox(e,n,r,s,i){const a=this.labelColors[r],l=this.labelPointStyles[r],{boxHeight:c,boxWidth:d}=i,u=an(i.bodyFont),h=vl(this,"left",i),f=s.x(h),m=c<u.lineHeight?(u.lineHeight-c)/2:0,g=n.y+m;if(i.usePointStyle){const p={radius:Math.min(d,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},_=s.leftForLtr(f,d)+d/2,y=g+c/2;e.strokeStyle=i.multiKeyBackground,e.fillStyle=i.multiKeyBackground,$u(e,p,_,y),e.strokeStyle=a.borderColor,e.fillStyle=a.backgroundColor,$u(e,p,_,y)}else{e.lineWidth=Te(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,e.strokeStyle=a.borderColor,e.setLineDash(a.borderDash||[]),e.lineDashOffset=a.borderDashOffset||0;const p=s.leftForLtr(f,d),_=s.leftForLtr(s.xPlus(f,1),d-2),y=Po(a.borderRadius);Object.values(y).some(C=>C!==0)?(e.beginPath(),e.fillStyle=i.multiKeyBackground,Vu(e,{x:p,y:g,w:d,h:c,radius:y}),e.fill(),e.stroke(),e.fillStyle=a.backgroundColor,e.beginPath(),Vu(e,{x:_,y:g+1,w:d-2,h:c-2,radius:y}),e.fill()):(e.fillStyle=i.multiKeyBackground,e.fillRect(p,g,d,c),e.strokeRect(p,g,d,c),e.fillStyle=a.backgroundColor,e.fillRect(_,g+1,d-2,c-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:s}=this,{bodySpacing:i,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:d,boxPadding:u}=r,h=an(r.bodyFont);let f=h.lineHeight,m=0;const g=Iu(r.rtl,this.x,this.width),p=function(O){n.fillText(O,g.x(e.x+m),e.y+f/2),e.y+=f+i},_=g.textAlign(a);let y,C,k,v,M,T,S;for(n.textAlign=a,n.textBaseline="middle",n.font=h.string,e.x=vl(this,_,r),n.fillStyle=r.bodyColor,Re(this.beforeBody,p),m=l&&_!=="right"?a==="center"?d/2+u:d+2+u:0,v=0,T=s.length;v<T;++v){for(y=s[v],C=this.labelTextColors[v],n.fillStyle=C,Re(y.before,p),k=y.lines,l&&k.length&&(this._drawColorBox(n,e,v,g,r),f=Math.max(h.lineHeight,c)),M=0,S=k.length;M<S;++M)p(k[M]),f=h.lineHeight;Re(y.after,p)}m=0,f=h.lineHeight,Re(this.afterBody,p),e.y-=i}drawFooter(e,n,r){const s=this.footer,i=s.length;let a,l;if(i){const c=Iu(r.rtl,this.x,this.width);for(e.x=vl(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=c.textAlign(r.footerAlign),n.textBaseline="middle",a=an(r.footerFont),n.fillStyle=r.footerColor,n.font=a.string,l=0;l<i;++l)n.fillText(s[l],c.x(e.x),e.y+a.lineHeight/2),e.y+=a.lineHeight+r.footerSpacing}}drawBackground(e,n,r,s){const{xAlign:i,yAlign:a}=this,{x:l,y:c}=e,{width:d,height:u}=r,{topLeft:h,topRight:f,bottomLeft:m,bottomRight:g}=Po(s.cornerRadius);n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,n.lineWidth=s.borderWidth,n.beginPath(),n.moveTo(l+h,c),a==="top"&&this.drawCaret(e,n,r,s),n.lineTo(l+d-f,c),n.quadraticCurveTo(l+d,c,l+d,c+f),a==="center"&&i==="right"&&this.drawCaret(e,n,r,s),n.lineTo(l+d,c+u-g),n.quadraticCurveTo(l+d,c+u,l+d-g,c+u),a==="bottom"&&this.drawCaret(e,n,r,s),n.lineTo(l+m,c+u),n.quadraticCurveTo(l,c+u,l,c+u-m),a==="center"&&i==="left"&&this.drawCaret(e,n,r,s),n.lineTo(l,c+h),n.quadraticCurveTo(l,c,l+h,c),n.closePath(),n.fill(),s.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,s=r&&r.x,i=r&&r.y;if(s||i){const a=Wo[e.position].call(this,this._active,this._eventPosition);if(!a)return;const l=this._size=a2(this,e),c=Object.assign({},a,this._size),d=l2(n,e,c),u=c2(e,c,d,n);(s._to!==u.x||i._to!==u.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const s={width:this.width,height:this.height},i={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=yn(n.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&l&&(e.save(),e.globalAlpha=r,this.drawBackground(i,e,s,n),Ex(e,n.textDirection),i.y+=a.top,this.drawTitle(i,e,n),this.drawBody(i,e,n),this.drawFooter(i,e,n),$x(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,s=e.map(({datasetIndex:l,index:c})=>{const d=this.chart.getDatasetMeta(l);if(!d)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:d.data[c],index:c}}),i=!nl(r,s),a=this._positionChanged(s,n);(i||a)&&(this._active=s,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,i=this._active||[],a=this._getActiveElements(e,i,n,r),l=this._positionChanged(a,e),c=n||!nl(a,i)||l;return c&&(this._active=a,(s.enabled||s.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),c}_getActiveElements(e,n,r,s){const i=this.options;if(e.type==="mouseout")return[];if(!s)return n.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);const a=this.chart.getElementsAtEventForMode(e,i.mode,i,r);return i.reverse&&a.reverse(),a}_positionChanged(e,n){const{caretX:r,caretY:s,options:i}=this,a=Wo[i.position].call(this,e,n);return a!==!1&&(r!==a.x||s!==a.y)}}W(Qu,"positioners",Wo);var YS={id:"tooltip",_element:Qu,positioners:Wo,afterInit(t,e,n){n&&(t.tooltip=new Qu({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:h2},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"]};const WS=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function jS(t,e,n,r){const s=t.indexOf(e);if(s===-1)return WS(t,e,n,r);const i=t.lastIndexOf(e);return s!==i?n:s}const ZS=(t,e)=>t===null?null:_n(Math.round(t),0,e);function f2(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class Tl extends Fs{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:s,label:i}of n)r[s]===i&&r.splice(s,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(Ue(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:jS(r,e,Fe(n,e),this._addedLabels),ZS(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(s=this.getLabels().length-1)),this.min=r,this.max=s}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,s=[];let i=this.getLabels();i=e===0&&n===i.length-1?i:i.slice(e,n+1),this._valueRange=Math.max(i.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let a=e;a<=n;a++)s.push({value:a});return s}getLabelForValue(e){return f2.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}W(Tl,"id","category"),W(Tl,"defaults",{ticks:{callback:f2}});function US(t,e){const n=[],{bounds:s,step:i,min:a,max:l,precision:c,count:d,maxTicks:u,maxDigits:h,includeBounds:f}=t,m=i||1,g=u-1,{min:p,max:_}=e,y=!Ue(a),C=!Ue(l),k=!Ue(d),v=(_-p)/(h+1);let M=Nm((_-p)/g/m)*m,T,S,O,E;if(M<1e-14&&!y&&!C)return[{value:p},{value:_}];E=Math.ceil(_/M)-Math.floor(p/M),E>g&&(M=Nm(E*M/g/m)*m),Ue(c)||(T=Math.pow(10,c),M=Math.ceil(M*T)/T),s==="ticks"?(S=Math.floor(p/M)*M,O=Math.ceil(_/M)*M):(S=p,O=_),y&&C&&i&&xC((l-a)/i,M/1e3)?(E=Math.round(Math.min((l-a)/M,u)),M=(l-a)/E,S=a,O=l):k?(S=y?a:S,O=C?l:O,E=d-1,M=(O-S)/E):(E=(O-S)/M,Do(E,Math.round(E),M/1e3)?E=Math.round(E):E=Math.ceil(E));const I=Math.max(Am(M),Am(S));T=Math.pow(10,Ue(c)?I:c),S=Math.round(S*T)/T,O=Math.round(O*T)/T;let j=0;for(y&&(f&&S!==a?(n.push({value:a}),S<a&&j++,Do(Math.round((S+j*M)*T)/T,a,m2(a,v,t))&&j++):S<a&&j++);j<E;++j){const $=Math.round((S+j*M)*T)/T;if(C&&$>l)break;n.push({value:$})}return C&&f&&O!==l?n.length&&Do(n[n.length-1].value,l,m2(l,v,t))?n[n.length-1].value=l:n.push({value:l}):(!C||O===l)&&n.push({value:O}),n}function m2(t,e,{horizontal:n,minRotation:r}){const s=es(r),i=(n?Math.sin(s):Math.cos(s))||.001,a=.75*e*(""+t).length;return Math.min(e/i,a)}class Dl extends Fs{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 Ue(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:s,max:i}=this;const a=c=>s=n?s:c,l=c=>i=r?i:c;if(e){const c=xi(s),d=xi(i);c<0&&d<0?l(0):c>0&&d>0&&a(0)}if(s===i){let c=i===0?1:Math.abs(i*.05);l(i+c),e||a(s-c)}this.min=s,this.max=i}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,s;return r?(s=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),n=n||11),n&&(s=Math.min(n,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const s={maxTicks:r,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},i=this._range||this,a=US(s,i);return e.bounds==="ticks"&&Bm(a,this,"value"),e.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const s=(r-n)/Math.max(e.length-1,1)/2;n-=s,r+=s}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return Du(e,this.chart.options.locale,this.options.ticks.format)}}class Ol extends Dl{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=lt(e)?e:0,this.max=lt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=es(this.options.ticks.minRotation),s=(e?Math.sin(r):Math.cos(r))||.001,i=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,i.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}W(Ol,"id","linear"),W(Ol,"defaults",{ticks:{callback:ll.formatters.numeric}});const jo=t=>Math.floor(Qr(t)),Rs=(t,e)=>Math.pow(10,jo(t)+e);function p2(t){return t/Math.pow(10,jo(t))===1}function g2(t,e,n){const r=Math.pow(10,n),s=Math.floor(t/r);return Math.ceil(e/r)-s}function qS(t,e){const n=e-t;let r=jo(n);for(;g2(t,e,r)>10;)r++;for(;g2(t,e,r)<10;)r--;return Math.min(r,jo(t))}function GS(t,{min:e,max:n}){e=nn(t.min,e);const r=[],s=jo(e);let i=qS(e,n),a=i<0?Math.pow(10,Math.abs(i)):1;const l=Math.pow(10,i),c=s>i?Math.pow(10,s):0,d=Math.round((e-c)*a)/a,u=Math.floor((e-c)/l/10)*l*10;let h=Math.floor((d-u)/Math.pow(10,i)),f=nn(t.min,Math.round((c+u+h*Math.pow(10,i))*a)/a);for(;f<n;)r.push({value:f,major:p2(f),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(i++,h=2,a=i>=0?1:a),f=Math.round((c+u+h*Math.pow(10,i))*a)/a;const m=nn(t.max,f);return r.push({value:m,major:p2(m),significand:h}),r}class _2 extends Fs{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,n){const r=Dl.prototype.parse.apply(this,[e,n]);if(r===0){this._zero=!0;return}return lt(r)&&r>0?r:null}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=lt(e)?Math.max(0,e):null,this.max=lt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!lt(this._userMin)&&(this.min=e===Rs(this.min,0)?Rs(this.min,-1):Rs(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let r=this.min,s=this.max;const i=l=>r=e?r:l,a=l=>s=n?s:l;r===s&&(r<=0?(i(1),a(10)):(i(Rs(r,-1)),a(Rs(s,1)))),r<=0&&i(Rs(s,-1)),s<=0&&a(Rs(r,1)),this.min=r,this.max=s}buildTicks(){const e=this.options,n={min:this._userMin,max:this._userMax},r=GS(n,this);return e.bounds==="ticks"&&Bm(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}getLabelForValue(e){return e===void 0?"0":Du(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=Qr(e),this._valueRange=Qr(this.max)-Qr(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Qr(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const n=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+n*this._valueRange)}}W(_2,"id","logarithmic"),W(_2,"defaults",{ticks:{callback:ll.formatters.logarithmic,major:{enabled:!0}}});function e1(t){const e=t.ticks;if(e.display&&t.display){const n=yn(e.backdropPadding);return Fe(e.font&&e.font.size,gt.font.size)+n.height}return 0}function KS(t,e,n){return n=st(n)?n:[n],{w:WC(t,e.string,n),h:n.length*e.lineHeight}}function y2(t,e,n,r,s){return t===r||t===s?{start:e-n/2,end:e+n/2}:t<r||t>s?{start:e-n,end:e}:{start:e,end:e+n}}function XS(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),r=[],s=[],i=t._pointLabels.length,a=t.options.pointLabels,l=a.centerPointLabels?Dt/i:0;for(let c=0;c<i;c++){const d=a.setContext(t.getPointLabelContext(c));s[c]=d.padding;const u=t.getPointPosition(c,t.drawingArea+s[c],l),h=an(d.font),f=KS(t.ctx,h,t._pointLabels[c]);r[c]=f;const m=on(t.getIndexAngle(c)+l),g=Math.round(xu(m)),p=y2(g,u.x,f.w,0,180),_=y2(g,u.y,f.h,90,270);JS(n,e,m,p,_)}t.setCenterPoint(e.l-n.l,n.r-e.r,e.t-n.t,n.b-e.b),t._pointLabelItems=tv(t,r,s)}function JS(t,e,n,r,s){const i=Math.abs(Math.sin(n)),a=Math.abs(Math.cos(n));let l=0,c=0;r.start<e.l?(l=(e.l-r.start)/i,t.l=Math.min(t.l,e.l-l)):r.end>e.r&&(l=(r.end-e.r)/i,t.r=Math.max(t.r,e.r+l)),s.start<e.t?(c=(e.t-s.start)/a,t.t=Math.min(t.t,e.t-c)):s.end>e.b&&(c=(s.end-e.b)/a,t.b=Math.max(t.b,e.b+c))}function QS(t,e,n){const r=t.drawingArea,{extra:s,additionalAngle:i,padding:a,size:l}=n,c=t.getPointPosition(e,r+s+a,i),d=Math.round(xu(on(c.angle+sn))),u=sv(c.y,l.h,d),h=nv(d),f=rv(c.x,l.w,h);return{visible:!0,x:c.x,y:u,textAlign:h,left:f,top:u,right:f+l.w,bottom:u+l.h}}function ev(t,e){if(!e)return!0;const{left:n,top:r,right:s,bottom:i}=t;return!(_r({x:n,y:r},e)||_r({x:n,y:i},e)||_r({x:s,y:r},e)||_r({x:s,y:i},e))}function tv(t,e,n){const r=[],s=t._pointLabels.length,i=t.options,{centerPointLabels:a,display:l}=i.pointLabels,c={extra:e1(i)/2,additionalAngle:a?Dt/s:0};let d;for(let u=0;u<s;u++){c.padding=n[u],c.size=e[u];const h=QS(t,u,c);r.push(h),l==="auto"&&(h.visible=ev(h,d),h.visible&&(d=h))}return r}function nv(t){return t===0||t===180?"center":t<180?"left":"right"}function rv(t,e,n){return n==="right"?t-=e:n==="center"&&(t-=e/2),t}function sv(t,e,n){return n===90||n===270?t-=e/2:(n>270||n<90)&&(t-=e),t}function iv(t,e,n){const{left:r,top:s,right:i,bottom:a}=n,{backdropColor:l}=e;if(!Ue(l)){const c=Po(e.borderRadius),d=yn(e.backdropPadding);t.fillStyle=l;const u=r-d.left,h=s-d.top,f=i-r+d.width,m=a-s+d.height;Object.values(c).some(g=>g!==0)?(t.beginPath(),Vu(t,{x:u,y:h,w:f,h:m,radius:c}),t.fill()):t.fillRect(u,h,f,m)}}function ov(t,e){const{ctx:n,options:{pointLabels:r}}=t;for(let s=e-1;s>=0;s--){const i=t._pointLabelItems[s];if(!i.visible)continue;const a=r.setContext(t.getPointLabelContext(s));iv(n,a,i);const l=an(a.font),{x:c,y:d,textAlign:u}=i;dl(n,t._pointLabels[s],c,d+l.lineHeight/2,l,{color:a.color,textAlign:u,textBaseline:"middle"})}}function w2(t,e,n,r){const{ctx:s}=t;if(n)s.arc(t.xCenter,t.yCenter,e,0,rn);else{let i=t.getPointPosition(0,e);s.moveTo(i.x,i.y);for(let a=1;a<r;a++)i=t.getPointPosition(a,e),s.lineTo(i.x,i.y)}}function av(t,e,n,r,s){const i=t.ctx,a=e.circular,{color:l,lineWidth:c}=e;!a&&!r||!l||!c||n<0||(i.save(),i.strokeStyle=l,i.lineWidth=c,i.setLineDash(s.dash),i.lineDashOffset=s.dashOffset,i.beginPath(),w2(t,n,a,r),i.closePath(),i.stroke(),i.restore())}function lv(t,e,n){return ts(t,{label:n,index:e,type:"pointLabel"})}class El extends Dl{constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const e=this._padding=yn(e1(this.options)/2),n=this.width=this.maxWidth-e.width,r=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+n/2+e.left),this.yCenter=Math.floor(this.top+r/2+e.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!1);this.min=lt(e)&&!isNaN(e)?e:0,this.max=lt(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/e1(this.options))}generateTickLabels(e){Dl.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((n,r)=>{const s=ct(this.options.pointLabels.callback,[n,r],this);return s||s===0?s:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const e=this.options;e.display&&e.pointLabels.display?XS(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,r,s){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((r-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,r,s))}getIndexAngle(e){const n=rn/(this._pointLabels.length||1),r=this.options.startAngle||0;return on(e*n+es(r))}getDistanceFromCenterForValue(e){if(Ue(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(Ue(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<n.length){const r=n[e];return lv(this.getContext(),e,r)}}getPointPosition(e,n,r=0){const s=this.getIndexAngle(e)-sn+r;return{x:Math.cos(s)*n+this.xCenter,y:Math.sin(s)*n+this.yCenter,angle:s}}getPointPositionForValue(e,n){return this.getPointPosition(e,this.getDistanceFromCenterForValue(n))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){const{left:n,top:r,right:s,bottom:i}=this._pointLabelItems[e];return{left:n,top:r,right:s,bottom:i}}drawBackground(){const{backgroundColor:e,grid:{circular:n}}=this.options;if(e){const r=this.ctx;r.save(),r.beginPath(),w2(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=e,r.fill(),r.restore()}}drawGrid(){const e=this.ctx,n=this.options,{angleLines:r,grid:s,border:i}=n,a=this._pointLabels.length;let l,c,d;if(n.pointLabels.display&&ov(this,a),s.display&&this.ticks.forEach((u,h)=>{if(h!==0||h===0&&this.min<0){c=this.getDistanceFromCenterForValue(u.value);const f=this.getContext(h),m=s.setContext(f),g=i.setContext(f);av(this,m,c,a,g)}}),r.display){for(e.save(),l=a-1;l>=0;l--){const u=r.setContext(this.getPointLabelContext(l)),{color:h,lineWidth:f}=u;!f||!h||(e.lineWidth=f,e.strokeStyle=h,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,c=this.getDistanceFromCenterForValue(n.ticks.reverse?this.min:this.max),d=this.getPointPosition(l,c),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(d.x,d.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const s=this.getIndexAngle(0);let i,a;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(s),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((l,c)=>{if(c===0&&this.min>=0&&!n.reverse)return;const d=r.setContext(this.getContext(c)),u=an(d.font);if(i=this.getDistanceFromCenterForValue(this.ticks[c].value),d.showLabelBackdrop){e.font=u.string,a=e.measureText(l.label).width,e.fillStyle=d.backdropColor;const h=yn(d.backdropPadding);e.fillRect(-a/2-h.left,-i-u.size/2-h.top,a+h.width,u.size+h.height)}dl(e,l.label,0,-i,u,{color:d.color,strokeColor:d.textStrokeColor,strokeWidth:d.textStrokeWidth})}),e.restore()}drawTitle(){}}W(El,"id","radialLinear"),W(El,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ll.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),W(El,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),W(El,"descriptors",{angleLines:{_fallback:"grid"}});const $l={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}},Zt=Object.keys($l);function b2(t,e){return t-e}function k2(t,e){if(Ue(e))return null;const n=t._adapter,{parser:r,round:s,isoWeekday:i}=t._parseOpts;let a=e;return typeof r=="function"&&(a=r(a)),lt(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(s&&(a=s==="week"&&(Oo(i)||i===!0)?n.startOf(a,"isoWeek",i):n.startOf(a,s)),+a)}function C2(t,e,n,r){const s=Zt.length;for(let i=Zt.indexOf(t);i<s-1;++i){const a=$l[Zt[i]],l=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-e)/(l*a.size))<=r)return Zt[i]}return Zt[s-1]}function cv(t,e,n,r,s){for(let i=Zt.length-1;i>=Zt.indexOf(n);i--){const a=Zt[i];if($l[a].common&&t._adapter.diff(s,r,a)>=e-1)return a}return Zt[n?Zt.indexOf(n):0]}function dv(t){for(let e=Zt.indexOf(t)+1,n=Zt.length;e<n;++e)if($l[Zt[e]].common)return Zt[e]}function x2(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:s}=Su(n,e),i=n[r]>=e?n[r]:n[s];t[i]=!0}}function uv(t,e,n,r){const s=t._adapter,i=+s.startOf(e[0].value,r),a=e[e.length-1].value;let l,c;for(l=i;l<=a;l=+s.add(l,1,r))c=n[l],c>=0&&(e[c].major=!0);return e}function M2(t,e,n){const r=[],s={},i=e.length;let a,l;for(a=0;a<i;++a)l=e[a],s[l]=a,r.push({value:l,major:!1});return i===0||!n?r:uv(t,r,s,n)}class Pl extends Fs{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),s=this._adapter=new Jx._date(e.adapters.date);s.init(n),To(r.displayFormats,s.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:k2(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:s,max:i,minDefined:a,maxDefined:l}=this.getUserBounds();function c(d){!a&&!isNaN(d.min)&&(s=Math.min(s,d.min)),!l&&!isNaN(d.max)&&(i=Math.max(i,d.max))}(!a||!l)&&(c(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&c(this.getMinMax(!1))),s=lt(s)&&!isNaN(s)?s:+n.startOf(Date.now(),r),i=lt(i)&&!isNaN(i)?i:+n.endOf(Date.now(),r)+1,this.min=Math.min(s,i-1),this.max=Math.max(s+1,i)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,s=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const i=this.min,a=this.max,l=DC(s,i,a);return this._unit=n.unit||(r.autoSkip?C2(n.minUnit,this.min,this.max,this._getLabelCapacity(i)):cv(this,l.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:dv(this._unit),this.initOffsets(s),e.reverse&&l.reverse(),M2(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,s,i;this.options.offset&&e.length&&(s=this.getDecimalForValue(e[0]),e.length===1?n=1-s:n=(this.getDecimalForValue(e[1])-s)/2,i=this.getDecimalForValue(e[e.length-1]),e.length===1?r=i:r=(i-this.getDecimalForValue(e[e.length-2]))/2);const a=e.length<3?.5:.25;n=_n(n,0,a),r=_n(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,s=this.options,i=s.time,a=i.unit||C2(i.minUnit,n,r,this._getLabelCapacity(n)),l=Fe(s.ticks.stepSize,1),c=a==="week"?i.isoWeekday:!1,d=Oo(c)||c===!0,u={};let h=n,f,m;if(d&&(h=+e.startOf(h,"isoWeek",c)),h=+e.startOf(h,d?"day":a),e.diff(r,n,a)>1e5*l)throw new Error(n+" and "+r+" are too far apart with stepSize of "+l+" "+a);const g=s.ticks.source==="data"&&this.getDataTimestamps();for(f=h,m=0;f<r;f=+e.add(f,l,a),m++)x2(u,f,g);return(f===r||s.bounds==="ticks"||m===1)&&x2(u,f,g),Object.keys(u).sort(b2).map(p=>+p)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const s=this.options.time.displayFormats,i=this._unit,a=n||s[i];return this._adapter.format(e,a)}_tickFormatFunction(e,n,r,s){const i=this.options,a=i.ticks.callback;if(a)return ct(a,[e,n,r],this);const l=i.time.displayFormats,c=this._unit,d=this._majorUnit,u=c&&l[c],h=d&&l[d],f=r[n],m=d&&h&&f&&f.major;return this._adapter.format(e,s||(m?h:u))}generateTickLabels(e){let n,r,s;for(n=0,r=e.length;n<r;++n)s=e[n],s.label=this._tickFormatFunction(s.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,s=es(this.isHorizontal()?n.maxRotation:n.minRotation),i=Math.cos(s),a=Math.sin(s),l=this._resolveTickFontOptions(0).size;return{w:r*i+l*a,h:r*a+l*i}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,s=r[n.unit]||r.millisecond,i=this._tickFormatFunction(e,0,M2(this,[e],this._majorUnit),s),a=this._getLabelSize(i),l=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return l>0?l:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(n=0,r=s.length;n<r;++n)e=e.concat(s[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const s=this.getLabels();for(n=0,r=s.length;n<r;++n)e.push(k2(this,s[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return EC(e.sort(b2))}}W(Pl,"id","time"),W(Pl,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Ll(t,e,n){let r=0,s=t.length-1,i,a,l,c;n?(e>=t[r].pos&&e<=t[s].pos&&({lo:r,hi:s}=Es(t,"pos",e)),{pos:i,time:l}=t[r],{pos:a,time:c}=t[s]):(e>=t[r].time&&e<=t[s].time&&({lo:r,hi:s}=Es(t,"time",e)),{time:i,pos:l}=t[r],{time:a,pos:c}=t[s]);const d=a-i;return d?l+(c-l)*(e-i)/d:l}class S2 extends Pl{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=Ll(n,this.min),this._tableRange=Ll(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,s=[],i=[];let a,l,c,d,u;for(a=0,l=e.length;a<l;++a)d=e[a],d>=n&&d<=r&&s.push(d);if(s.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,l=s.length;a<l;++a)u=s[a+1],c=s[a-1],d=s[a],Math.round((u+c)/2)!==d&&i.push({time:d,pos:a/(l-1)});return i}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((s,i)=>s-i)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Ll(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Ll(this._table,r*this._tableRange+this._minPos,!0)}}W(S2,"id","timeseries"),W(S2,"defaults",Pl.defaults);const v2={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},hv={type:{type:String,required:!0},destroyDelay:{type:Number,default:0},...v2,...{ariaLabel:{type:String},ariaDescribedby:{type:String}}},fv=o.version[0]==="2"?(t,e)=>Object.assign(t,{attrs:e}):(t,e)=>Object.assign(t,e);function vi(t){return o.isProxy(t)?o.toRaw(t):t}function mv(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t;return o.isProxy(e)?new Proxy(t,{}):t}function pv(t,e){const n=t.options;n&&e&&Object.assign(n,e)}function T2(t,e){t.labels=e}function D2(t,e,n){const r=[];t.datasets=e.map(s=>{const i=t.datasets.find(a=>a[n]===s[n]);return!i||!s.data||r.includes(i)?{...s}:(r.push(i),Object.assign(i,s),i)})}function gv(t,e){const n={labels:[],datasets:[]};return T2(n,t.labels),D2(n,t.datasets,e),n}const _v=o.defineComponent({props:hv,setup(t,e){let{expose:n,slots:r}=e;const s=o.ref(null),i=o.shallowRef(null);n({chart:i});const a=()=>{if(!s.value)return;const{type:d,data:u,options:h,plugins:f,datasetIdKey:m}=t,g=gv(u,m),p=mv(g,u);i.value=new zo(s.value,{type:d,data:p,options:{...h},plugins:f})},l=()=>{const d=o.toRaw(i.value);d&&(t.destroyDelay>0?setTimeout(()=>{d.destroy(),i.value=null},t.destroyDelay):(d.destroy(),i.value=null))},c=d=>{d.update(t.updateMode)};return o.onMounted(a),o.onUnmounted(l),o.watch([()=>t.options,()=>t.data],(d,u)=>{let[h,f]=d,[m,g]=u;const p=o.toRaw(i.value);if(!p)return;let _=!1;if(h){const y=vi(h),C=vi(m);y&&y!==C&&(pv(p,y),_=!0)}if(f){const y=vi(f.labels),C=vi(g.labels),k=vi(f.datasets),v=vi(g.datasets);y!==C&&(T2(p.config.data,y),_=!0),k&&k!==v&&(D2(p.config.data,k,t.datasetIdKey),_=!0)}_&&o.nextTick(()=>{c(p)})},{deep:!0}),()=>o.h("canvas",{role:"img",ariaLabel:t.ariaLabel,ariaDescribedby:t.ariaDescribedby,ref:s},[o.h("p",{},[r.default?r.default():""])])}});function yv(t,e){return zo.register(e),o.defineComponent({props:v2,setup(n,r){let{expose:s}=r;const i=o.shallowRef(null),a=l=>{i.value=l==null?void 0:l.chart};return s({chart:i}),()=>o.h(_v,fv({ref:a},{type:t,...n}))}})}const O2=yv("line",gl),wv={class:"chart-container"},t1={__name:"LineChart",props:{data:{type:Array,required:!0},dataType:{type:String,required:!0},isMask:{type:Boolean,default:!1},ticksCallback:{type:Function,default:t=>t},borderColor:{type:String,default:"#007AFF"},gradient:{type:Object,default:{height:450,startColor:"rgba(0, 122, 255, 0.1)",endColor:"rgba(0, 122, 255, 0)"}}},setup(t){zo.register(Tl,Ol,Yo,wr,YS,o2);const e=t,n=o.ref(0);let r=o.reactive({isEmpty:!0});const s=h=>{const f=new Set,m=[];let g=[];switch(e.dataType){case"balanceChartData":h.length===0?g=[0,0]:g=h.map(_=>(f.add(_.date),Et(_.balance*Mc(),2)));break;case"performanceChartData":h.length===0?g=[0,0]:g=h.reduce((_,y,C)=>{f.add(y.date);const k=C?_[C-1]:0,v=Et(k+y.pnl_to_deposit,2);return _.push(v),_},[]);break}m.push({data:g});const p=Array.from(f);return p.length===1?(p.push(...p),m.forEach(_=>{_.data.push(..._.data)}),r.isEmpty=!1):p.length===0?(r.isEmpty=!0,p.push(0,0)):r.isEmpty=!1,{labels:p,datasets:m}},i=o.computed(()=>s(e.data)),a=h=>{const m=h.chart.ctx.createLinearGradient(0,0,0,e.gradient.height);return m.addColorStop(0,e.gradient.startColor),m.addColorStop(1,e.gradient.endColor),m},l=(h,f)=>{let m=document.querySelector(`#${h}-${e.dataType}`);return m||(m=document.createElement("div"),m.classList.add(h),m.setAttribute("id",`${h}-${e.dataType}`),f.canvas.parentNode.appendChild(m)),m},c=h=>{if(!r.isEmpty){const{chart:f,tooltip:m}=h,g=l("chart-tooltip",f);if(m.opacity===0){g.style.opacity="0";return}if(m.body){const M=m.title||[],T=m.body.map(O=>O.lines),S=document.createElement("div");for(S.classList.add("chart-tooltip-middle"),S.innerHTML=`<div class="chart-tooltip-content">
40
40
  ${e.dataType==="balanceChartData"?`${pa()}${Me(e.isMask,dh(T[0]),{repeat:6})}`:`${Me(e.isMask,dh(T[0]),{repeat:3})}%`}
41
41
  <span> | ${uh(M[0])}, ${p6(M[0])}</span></div>`;g.firstChild;)g.firstChild.remove();g.appendChild(S)}const{offsetLeft:p,offsetTop:_,clientWidth:y}=f.canvas;let C=p+m.caretX;const k=_+m.caretY,v=g.clientWidth;C+v>y&&(C-=v),g.style.opacity="1",g.style.left=C+"px",g.style.top=k+"px"}},d=h=>{const{chart:f}=h,m=l("chart-line",f),g=f.chartArea;f.canvas.addEventListener("mousemove",function(p){const _=f.canvas.getBoundingClientRect(),y=p.clientX-_.left,C=p.clientY-_.top;y>=g.left&&y<=g.right&&C>=g.top&&C<=g.bottom?(m.style.left=y+"px",m.style.top=g.top+"px",m.style.height=g.bottom-g.top+"px",m.style.display="flex"):m.style.display="none"}),f.canvas.addEventListener("mouseout",function(){m.style.display="none"})},u=o.computed(()=>({responsive:!0,maintainAspectRatio:!1,animation:{duration:1500},scales:{x:{ticks:{display:!r.isEmpty,callback:function(h){return uh(this.getLabelForValue(h)).slice(0,3)},color:"#8E8E93",font:{size:14,weight:400,family:"'SF Pro Display', sans-serif"},padding:15,align:"center"},grid:{display:!1},border:{color:"#EDEDED"}},y:{ticks:{display:!r.isEmpty,callback:function(h){return e.ticksCallback(h)},color:"#8E8E93",font:{size:14,weight:400,family:"'SF Pro Display', sans-serif"},padding:15},grid:{color:"#EDEDED",drawTicks:!1},border:{display:!1,dash:[4,4],dashOffset:1}}},plugins:{tooltip:{enabled:!1,position:"nearest",external:c},legend:!1},elements:{line:{backgroundColor:h=>a(h),tension:.3,borderWidth:2,borderColor:e.borderColor,fill:"start",spanGaps:!0},point:{pointStyle:"circle",pointRadius:1,pointHoverRadius:8,pointBackgroundColor:e.borderColor,pointBorderWidth:0,pointHoverBorderWidth:3,pointBorderColor:"#fff",pointHoverBorderColor:"#fff",pointHitRadius:50}},onHover:d}));return o.watch(()=>e.isMask,()=>{n.value+=1},{immediate:!0}),(h,f)=>(o.openBlock(),o.createElementBlock("div",wv,[(o.openBlock(),o.createBlock(o.unref(O2),{key:n.value,data:i.value,options:u.value},null,8,["data","options"]))]))}},n1={__name:"SimpleLineChart",props:{data:{type:Array,required:!0},borderColor:{type:String,default:"#56B683"},gradient:{type:Object,default:{height:200,startColor:"rgba(86, 182, 131, 0.1)",endColor:"rgba(86, 182, 131, 0)"}}},setup(t){zo.register(Tl,Ol,Yo,wr,o2);const e=t,n=a=>{const l=new Set,c=[],d=a.map(h=>(l.add(h.date),h.balance));return c.push({data:d}),{labels:Array.from(l),datasets:c}},r=o.computed(()=>n(e.data)),s=a=>{const c=a.chart.ctx.createLinearGradient(0,0,0,e.gradient.height);return c.addColorStop(0,e.gradient.startColor),c.addColorStop(1,e.gradient.endColor),c},i=o.ref({responsive:!0,maintainAspectRatio:!1,animation:{duration:1500},interaction:{mode:"index",intersect:!1},scales:{x:{display:!1},y:{display:!1}},plugins:{tooltip:!1,legend:!1},elements:{line:{backgroundColor:a=>s(a),tension:.3,borderWidth:4,borderColor:e.borderColor,fill:"start",spanGaps:!0},point:{pointStyle:!1}}});return(a,l)=>(o.openBlock(),o.createBlock(o.unref(O2),{data:r.value,options:i.value},null,8,["data","options"]))}},bv=t=>(o.pushScopeId("data-v-af1e1a1d"),t=t(),o.popScopeId(),t),kv={class:"account-balance-widget"},Cv={class:"account-balance-widget__top"},xv={class:"account-balance-widget__title-wrapper"},Mv=bv(()=>o.createElementVNode("div",{class:"account-balance-widget__title"},"Account Balance",-1)),Sv=Oe({__name:"AccountBalanceWidget",props:{balanceChartData:{type:Array,default:[]},isShare:{type:Boolean,default:!1},isMask:{type:Boolean,default:!1}},setup(t){const e=o.ref("week"),n=s=>{const i=s*Mc();return i>=1e3||i<=-1e3?Me(r.isMask,Et(i/1e3,2)+"k",{repeat:3}):Et(i,2)},r=t;return(s,i)=>(o.openBlock(),o.createElementBlock("div",kv,[o.createElementVNode("div",Cv,[o.createElementVNode("div",xv,[Mv,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("This graphic widget displays changes to your deposit over a specific time period. ")]),_:1})]),t.isShare?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(o.unref(Ws),{key:0,modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=a=>e.value=a),onOnChange:i[1]||(i[1]=a=>s.$emit("onChange",e.value))},null,8,["modelValue"]))]),o.createVNode(o.unref(t1),{data:t.balanceChartData,"data-type":"balanceChartData","ticks-callback":n,isMask:t.isMask},null,8,["data","isMask"])]))}},[["__scopeId","data-v-af1e1a1d"]]),E2=t=>(o.pushScopeId("data-v-313ab42e"),t=t(),o.popScopeId(),t),vv={class:"balance-widget"},Tv={class:"balance-part"},Dv={class:"balance-part__top"},Ov={class:"balance-part__title-wrapper"},Ev=E2(()=>o.createElementVNode("div",{class:"balance-part__title"},"Balance",-1)),$v={class:"balance-part__content"},Pv={class:"balance-part__content__wrapper"},Lv={class:"balance-part__content__count"},Vv={class:"balance-part__content__bitcoin"},Nv={key:0,class:"devider"},Bv={key:1,class:"personal-target-part"},Av={class:"personal-target-part__top"},Fv={class:"personal-target-part__title-wrapper"},Rv=E2(()=>o.createElementVNode("div",{class:"personal-target-part__title"},"Personal target",-1)),Iv={class:"personal-target-part__content"},Hv={class:"personal-target-part__content__current"},zv={class:"personal-target-part__content__from"},Yv=Oe({__name:"BalanceWidget",props:{BTC:{type:Number,default:0},USDT:{type:Number,default:0},delta:{type:Number,default:0},balanceChartData:{type:Array,default:[]},currentProfit:{type:Number,default:0},profit:{type:Number,default:0},drawdown:{type:Number,default:0},isPercentage:Boolean,isShare:{type:Boolean,default:!1},isHidden:{type:Boolean,default:!1},isMaskBalance:{type:Boolean,default:!1},isMaskPersonalTarget:{type:Boolean,default:!1}},emits:["switchModal","switchVisibility"],setup(t,{emit:e}){const n=e,r=()=>{n("switchVisibility")};return(s,i)=>(o.openBlock(),o.createElementBlock("div",vv,[o.createElementVNode("div",Tv,[o.createElementVNode("div",Dv,[o.createElementVNode("div",Ov,[Ev,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("Displays the balance of your deposit in USD and BTC equivalent, additionally showing the growth/fall of your balance.")]),_:1})]),t.isShare?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",{key:0,class:"balance-part__visibility-switcher",onClick:r},[o.withDirectives(o.createVNode(o.unref(Le),{icon:"eye"},null,512),[[o.vShow,t.isHidden]]),o.withDirectives(o.createVNode(o.unref(Le),{icon:"eye-slash"},null,512),[[o.vShow,!t.isHidden]])]))]),o.createElementVNode("div",$v,[o.createElementVNode("div",Pv,[o.createElementVNode("div",Lv,o.toDisplayString(o.unref(Me)(t.isMaskBalance,o.unref(Ke)(t.USDT),{prefix:"$"})),1),t.delta?(o.openBlock(),o.createBlock(o.unref(sc),{key:0,"is-hidden":t.isMaskBalance,percentage:"",delta:t.delta},null,8,["is-hidden","delta"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",Vv,"= "+o.toDisplayString(o.unref(Me)(t.isMaskBalance,t.BTC))+" BTC",1)]),t.isShare?(o.openBlock(),o.createBlock(o.unref(n1),{key:0,class:"balance-part__chart balance-part__chart--share",data:t.balanceChartData,gradient:{height:500,startColor:"rgba(86, 182, 131, 0.1)",endColor:"rgba(86, 182, 131, 0)"}},null,8,["data","gradient"])):(o.openBlock(),o.createBlock(o.unref(n1),{key:1,class:"balance-part__chart",data:t.balanceChartData},null,8,["data"]))]),t.isShare?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Nv)),t.isShare?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Bv,[o.createElementVNode("div",Av,[o.createElementVNode("div",Fv,[Rv,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode(" In this widget, set your desired balance growth target in $ or % for a specific period. It will display your PNL relative to the goal, helping you know when to stop or pay closer attention. ")]),_:1})]),o.createElementVNode("div",{class:"balance-part__modal-switcher",onClick:i[0]||(i[0]=a=>n("switchModal"))},[o.createVNode(o.unref(Le),{icon:"settings"})])]),o.createElementVNode("div",Iv,[o.createElementVNode("div",Hv,o.toDisplayString(o.unref(Me)(t.isMaskPersonalTarget,o.unref(Ke)(t.currentProfit,{isPercentage:t.isPercentage,isFixed:!0}),{prefix:"$",repeat:5})),1),o.createElementVNode("div",zv,"/ "+o.toDisplayString(o.unref(Me)(t.isMaskPersonalTarget,o.unref(Ke)(t.profit,{isPercentage:t.isPercentage,isFixed:!0}))),1)]),o.createVNode(o.unref(R3),{"current-profit":t.currentProfit,"is-hidden":t.isMaskPersonalTarget,drawdown:t.drawdown,profit:t.profit,"is-percentage":t.isPercentage},null,8,["current-profit","is-hidden","drawdown","profit","is-percentage"])]))]))}},[["__scopeId","data-v-313ab42e"]]),Vl=t=>(o.pushScopeId("data-v-105f730b"),t=t(),o.popScopeId(),t),Wv={class:"calendar-widget"},jv={class:"calendar-widget__calendar"},Zv={class:"calendar-widget__top"},Uv={class:"calendar-widget__title-wrapper"},qv=Vl(()=>o.createElementVNode("div",{class:"calendar-widget__title"},"Calendar",-1)),Gv={class:"stat-calendar"},Kv={class:"stat-calendar__week-days"},Xv={key:0,class:"stat-calendar__row-wrapper"},Jv={class:"stat-calendar__row"},Qv=["onClick"],eT=Vl(()=>o.createElementVNode("div",{class:"calendar-widget__divider"},null,-1)),tT={key:0,class:"calendar-widget__day"},nT={class:"calendar-widget__day__title"},rT={class:"calendar-widget__day__content"},sT={class:"calendar-widget__point"},iT={class:"calendar-widget__point__title"},oT=Vl(()=>o.createElementVNode("div",{class:"calendar-widget__point__line"},null,-1)),aT={class:"calendar-widget__day__trades"},lT={class:"calendar-widget__point"},cT={class:"calendar-widget__point__title"},dT=Vl(()=>o.createElementVNode("div",{class:"calendar-widget__point__line"},null,-1)),uT=Oe({__name:"CalendarWidget",props:{rows:Array,dailyStatData:Object,currentDate:Date,isCurrentDate:Function,isCurrentDay:Function,isMask:{type:Boolean,default:!1}},emits:["setNewDate","chooseMonth"],setup(t,{emit:e}){const n=["Su","Mo","Tu","We","Th","Fr","Sa"],r=o.ref(null),s=o.ref(null),i=e,a=t,l=u=>{r.value=u.year,s.value=u.month,i("chooseMonth",u)};o.nextTick(()=>{const u=new Date;r.value=u.getFullYear(),s.value=u.getMonth()});const c=o.computed(()=>[{title:"Total trades",value:a.dailyStatData&&a.dailyStatData.trades_total_count||0},{title:"Winrate",value:Ke(a.dailyStatData&&a.dailyStatData.win_rate||0,{isPercentage:!0,isFixed:!0}),class:a.dailyStatData&&a.dailyStatData.win_rate>=50?"-win":"-loss"},{title:"Return",value:Ke(a.dailyStatData&&a.dailyStatData.return_total||0),class:a.dailyStatData&&a.dailyStatData.return_total>=0?"-win":"-loss"},{title:"Return on winners",value:Ke(a.dailyStatData&&a.dailyStatData.return_win||0)},{title:"Return on losers",value:Ke(a.dailyStatData&&a.dailyStatData.return_lose||0)},{title:"Commission",value:Ke(a.dailyStatData&&a.dailyStatData.commission||0)}]),d=o.computed(()=>[{title:"Win trades",value:a.dailyStatData&&a.dailyStatData.trades_win_count||0,isPositive:!0},{title:"Loss trades",value:-(a.dailyStatData&&a.dailyStatData.trades_lose_count)||0,isNegative:!1}]);return(u,h)=>{var f,m;return o.openBlock(),o.createElementBlock("div",Wv,[o.createElementVNode("div",jv,[o.createElementVNode("div",Zv,[o.createElementVNode("div",Uv,[qv,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("A widget that displays the performance of your trades in a calendar format. Here you can see profitable and unprofitable days with detailed statistics for each day. ")]),_:1})]),t.currentDate?(o.openBlock(),o.createBlock(o.unref(F3),{key:0,"current-date":t.currentDate,onOnChange:l,year:r.value,"onUpdate:year":h[0]||(h[0]=g=>r.value=g),month:s.value,"onUpdate:month":h[1]||(h[1]=g=>s.value=g)},null,8,["current-date","year","month"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",Gv,[o.createElementVNode("div",Kv,[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(n,(g,p)=>o.createElementVNode("div",{class:o.normalizeClass(["stat-calendar__week-day",{"-current":t.isCurrentDay(p)}])},o.toDisplayString(g),3)),64))]),t.rows?(o.openBlock(),o.createElementBlock("div",Xv,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(t.rows,g=>(o.openBlock(),o.createElementBlock("div",Jv,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(g,p=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["stat-calendar__day",{"-empty":!p.date,"-current":t.isCurrentDate(p.date),"-positive":p.win,"-negative":p.win===!1}]),onClick:_=>i("setNewDate",p.date)},o.toDisplayString(p.date?p.date:""),11,Qv))),256))]))),256))])):o.createCommentVNode("",!0)])]),eT,t.dailyStatData&&!t.dailyStatData.isNull?(o.openBlock(),o.createElementBlock("div",tT,[o.createElementVNode("div",nT,o.toDisplayString(t.currentDate.getDate()+" "+t.currentDate.toLocaleString("en-us",{month:"long"})),1),o.createElementVNode("div",rT,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.value,g=>(o.openBlock(),o.createElementBlock("div",sT,[o.createElementVNode("div",iT,o.toDisplayString(g.title),1),oT,o.createElementVNode("div",{class:o.normalizeClass(["calendar-widget__point__value",g.class?g.class:""])},o.toDisplayString(o.unref(Me)(t.isMask,g.value,{repeat:5})),3)]))),256)),o.createVNode(o.unref(xm),{isHidden:t.isMask,long:(f=t.dailyStatData)==null?void 0:f.long_count,short:(m=t.dailyStatData)==null?void 0:m.short_count},null,8,["isHidden","long","short"]),o.createElementVNode("div",aT,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(d.value,g=>(o.openBlock(),o.createElementBlock("div",lT,[o.createElementVNode("div",cT,o.toDisplayString(g.title),1),dT,o.createVNode(o.unref(sc),{isHidden:t.isMask,"is-positive":g.isPositive,"is-negative":g.isNegative,delta:g.value},null,8,["isHidden","is-positive","is-negative","delta"])]))),256))])])])):(o.openBlock(),o.createBlock(o.unref(gu),{key:1,class:"-empty"}))])}}},[["__scopeId","data-v-105f730b"]]),r1=t=>(o.pushScopeId("data-v-4ce47bda"),t=t(),o.popScopeId(),t),hT={class:"commission-widget"},fT={class:"commission-widget__content"},mT={class:"commission-widget__top"},pT={class:"commission-widget__title-wrapper"},gT=r1(()=>o.createElementVNode("div",{class:"commission-widget__title"},"Commissions and Fees",-1)),_T={class:"commission-widget__info"},yT={class:"commission-widget__total-wrapper"},wT=r1(()=>o.createElementVNode("div",{class:"commission-widget__total-wrapper__title"},"Total",-1)),bT={class:"commission-widget__total-wrapper__total"},kT={class:"commission-widget__total-wrapper__value"},CT={class:"commission-widget__points"},xT={class:"commission-widget__point"},MT={class:"commission-widget__point__title"},ST=r1(()=>o.createElementVNode("div",{class:"commission-widget__point__line"},null,-1)),vT=Oe({__name:"CommissionsFeesWidget",props:{commission:Number,commissionData:Object,isMask:{type:Boolean,default:!1}},emits:["onChange"],setup(t,{emit:e}){const n=o.ref("week"),r=e,s=t,i=o.computed(()=>s.commissionData&&s.commissionData.commission||0),a=o.computed(()=>s.commissionData&&s.commissionData.pnl||0),l=o.computed(()=>[{title:"AVG fees per trade",value:`${Ke(s.commissionData&&s.commissionData.fees_per_trade||0)}`},{title:"PNL / Commission",value:a.value&&i.value?`${Ke(a.value)}/${Ke(i.value)}`:`${Ke(0)}`},{title:"AVG fees per day",value:`${Ke(s.commissionData&&s.commissionData.fees_per_day||0)}`},{title:"Funding",value:`${Ke(s.commissionData&&s.commissionData.funding||0)}`}]);return(c,d)=>(o.openBlock(),o.createElementBlock("div",hT,[o.createElementVNode("div",fT,[o.createElementVNode("div",mT,[o.createElementVNode("div",pT,[gT,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("This widget helps traders finally understand how much money they spent on commissions and funding. ")]),_:1})]),o.createVNode(o.unref(Ws),{modelValue:n.value,"onUpdate:modelValue":d[0]||(d[0]=u=>n.value=u),onOnChange:d[1]||(d[1]=u=>r("onChange",n.value))},null,8,["modelValue"])]),o.createElementVNode("div",_T,[o.createElementVNode("div",yT,[wT,o.createElementVNode("div",bT,[o.createElementVNode("div",kT,o.toDisplayString(o.unref(Me)(t.isMask,o.unref(Ke)(i.value),{repeat:5})),1)])]),o.createElementVNode("div",CT,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,(u,h)=>(o.openBlock(),o.createElementBlock("div",xT,[o.createElementVNode("div",MT,o.toDisplayString(u.title),1),ST,o.createElementVNode("div",{class:o.normalizeClass(["commission-widget__point__value",u.class?u.class:""])},o.toDisplayString(o.unref(Me)(t.isMask,u.value,{repeat:5})),3)]))),256))])])])]))}},[["__scopeId","data-v-4ce47bda"]]),TT=t=>(o.pushScopeId("data-v-7187c939"),t=t(),o.popScopeId(),t),DT={class:"performance-widget"},OT={class:"performance-widget__top"},ET={class:"performance-widget__title-wrapper"},$T=TT(()=>o.createElementVNode("div",{class:"performance-widget__title"},"Performance (cumulative)",-1)),PT=Oe({__name:"PerformanceWidget",props:{performanceChartData:{type:Array,default:[]},isShare:{type:Boolean,default:!1},isMask:{type:Boolean,default:!1}},setup(t){const e=o.ref("week"),n=t,r=s=>Me(n.isMask,Et(s,2)+"%",{repeat:3});return(s,i)=>(o.openBlock(),o.createElementBlock("div",DT,[o.createElementVNode("div",OT,[o.createElementVNode("div",ET,[$T,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("The linear graphics widget displays the profit as a percentage of the deposit. ")]),_:1})]),t.isShare?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(o.unref(Ws),{key:0,modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=a=>e.value=a),onOnChange:i[1]||(i[1]=a=>s.$emit("onChange",e.value))},null,8,["modelValue"]))]),o.createVNode(o.unref(t1),{data:t.performanceChartData,"data-type":"performanceChartData","ticks-callback":r,isMask:t.isMask},null,8,["data","isMask"])]))}},[["__scopeId","data-v-7187c939"]]),s1=t=>(o.pushScopeId("data-v-20b275a1"),t=t(),o.popScopeId(),t),LT={class:"return-widget"},VT={class:"return-widget__content"},NT={class:"return-widget__top"},BT={class:"return-widget__title-wrapper"},AT=s1(()=>o.createElementVNode("div",{class:"return-widget__title"},"Return",-1)),FT={class:"return-widget__info"},RT={class:"return-widget__total-wrapper"},IT=s1(()=>o.createElementVNode("div",{class:"return-widget__total-wrapper__title"},"Total",-1)),HT={class:"return-widget__total-wrapper__total"},zT={class:"return-widget__points"},YT={class:"return-widget__point"},WT={class:"return-widget__point__title"},jT=s1(()=>o.createElementVNode("div",{class:"return-widget__point__line"},null,-1)),ZT=["innerHTML"],UT=Oe({__name:"ReturnWidget",props:{totalReturn:{type:Number,default:0},win:{type:Number,default:0},lose:{type:Number,default:0},returnPeriod:{type:Number,default:0},profitFactor:{type:Number,default:0},daily:{type:Number,default:0},changeRate:{type:Number,default:0},isShare:{type:Boolean,default:!1},isMask:{type:Boolean,default:!1}},emits:["onChange"],setup(t,{emit:e}){const n=o.ref("week"),r=e,s=t,i=o.computed(()=>[{title:"Average return per trade",value:s.totalReturn,options:{isPlus:!0,isFixed:!0},class:s.totalReturn===0?"":s.totalReturn>0?"-win":"-loss"},{title:"Daily return",value:s.daily,options:{isPlus:!0,isFixed:!0},class:s.daily===0?"":s.daily>0?"-win":"-loss"},{title:"Return on winners",value:s.win,class:"-win"},{title:"Return on losers",value:s.lose,class:"-loss"}]),a=o.computed(()=>s.returnPeriod>0),l=o.computed(()=>s.returnPeriod<0),c=o.computed(()=>s.profitFactor>1?"-positive":"-negative"),d=o.computed(()=>s.profitFactor>0?`Your profit factor is ${Me(s.isMask,Et(s.profitFactor),{repeat:5})}. <br /> You earn ${Me(s.isMask,Ke(s.profitFactor),{repeat:5,prefix:"$"})} on every ${Me(s.isMask,"$1",{repeat:5,prefix:"$"})} loss.`:`Your profit factor is ${Me(s.isMask,Et(s.profitFactor),{repeat:5})}. <br/> You loss ${Me(s.isMask,Ke(Math.abs(s.profitFactor)),{repeat:5,prefix:"$"})} on every ${Me(s.isMask,"$1",{repeat:5,prefix:"$"})} earn. `);return(u,h)=>(o.openBlock(),o.createElementBlock("div",LT,[o.createElementVNode("div",VT,[o.createElementVNode("div",NT,[o.createElementVNode("div",BT,[AT,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("This widget displays an increase in NET profit in dollars and percentage relative to the deposit for the specified period you have chosen. ")]),_:1})]),t.isShare?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(o.unref(Ws),{key:0,modelValue:n.value,"onUpdate:modelValue":h[0]||(h[0]=f=>n.value=f),onOnChange:h[1]||(h[1]=f=>r("onChange",n.value))},null,8,["modelValue"]))]),o.createElementVNode("div",FT,[o.createElementVNode("div",RT,[IT,o.createElementVNode("div",HT,[o.createElementVNode("div",{class:o.normalizeClass(["return-widget__total-wrapper__value",{"-positive":a.value,"-negative":l.value}])},o.toDisplayString(o.unref(Me)(t.isMask,o.unref(Ke)(t.returnPeriod,{isPlus:!0,isFixed:!0}),{repeat:5})),3),s.changeRate?(o.openBlock(),o.createBlock(o.unref(sc),{key:0,percentage:"",isHidden:t.isMask,delta:s.changeRate},null,8,["isHidden","delta"])):o.createCommentVNode("",!0)])]),o.createElementVNode("div",zT,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,f=>(o.openBlock(),o.createElementBlock("div",YT,[o.createElementVNode("div",WT,o.toDisplayString(f.title),1),jT,o.createElementVNode("div",{class:o.normalizeClass(["return-widget__point__value",f.class?f.class:""])},o.toDisplayString(o.unref(Me)(t.isMask,o.unref(Ke)(f.value,f.options),{repeat:5,prefix:"$"})),3)]))),256))])])]),t.profitFactor?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(["return-widget__profit",c.value])},[o.createVNode(o.unref(Le),{icon:"tip",class:"return-widget__profit__icon"}),o.createElementVNode("div",{class:"return-widget__profit__text",innerHTML:d.value},null,8,ZT)],2)):o.createCommentVNode("",!0)]))}},[["__scopeId","data-v-20b275a1"]]),$2=t=>(o.pushScopeId("data-v-d9b5a9e6"),t=t(),o.popScopeId(),t),qT={class:"top-positions-widget"},GT={class:"top-positions-widget__top"},KT={class:"top-positions-widget__title-wrapper"},XT=$2(()=>o.createElementVNode("div",{class:"top-positions-widget__title"},"Top Positions",-1)),JT={key:0,class:"top-positions-widget__returns"},QT={class:"top-positions-widget__return"},eD={class:"top-positions-widget__return__left"},tD=$2(()=>o.createElementVNode("div",{class:"top-positions-widget__return__line"},null,-1)),nD={class:"top-positions-widget__return__pair"},rD={class:"top-positions-widget__return__right"},sD={class:"top-positions-widget__return__pnl"},iD=Oe({__name:"TopPositionsWidget",props:{topPositions:{type:Array,default:[]},isMask:{type:Boolean,default:!1}},emits:["onChange"],setup(t,{emit:e}){const n=o.ref("week"),r=e;return(s,i)=>(o.openBlock(),o.createElementBlock("div",qT,[o.createElementVNode("div",GT,[o.createElementVNode("div",KT,[XT,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("Helps you find the top profitable positions. We calculate only net PNL, taking into account commission and funding. ")]),_:1})]),o.createVNode(o.unref(Ws),{modelValue:n.value,"onUpdate:modelValue":i[0]||(i[0]=a=>n.value=a),onOnChange:i[1]||(i[1]=a=>r("onChange",n.value))},null,8,["modelValue"])]),t.topPositions&&t.topPositions.length?(o.openBlock(),o.createElementBlock("div",JT,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(t.topPositions,a=>(o.openBlock(),o.createElementBlock("div",QT,[o.createElementVNode("div",eD,[tD,o.createElementVNode("div",nD,o.toDisplayString(o.unref(g6)(a.pair)),1)]),o.createElementVNode("div",rD,[o.createElementVNode("div",sD,o.toDisplayString(o.unref(Me)(t.isMask,o.unref(Ke)(a.pnl,{isFixed:!0,isPlus:!0},{repeat:5}))),1),o.createElementVNode("div",{class:o.normalizeClass(["top-positions-widget__return__roi",a.roi<0?"-negative":"-positive"])},[o.createVNode(o.unref(Le),{icon:"bxs_up-arrow"}),o.createElementVNode("span",null,o.toDisplayString(o.unref(Me)(t.isMask,o.unref(Ke)(a.roi,{isPercentage:!0,isFixed:!0},{repeat:2}))),1)],2)])]))),256))])):(o.openBlock(),o.createBlock(o.unref(gu),{key:1,title:"No more pair",subtitle:"No data available for the specified period",icon:"coins-add"}))]))}},[["__scopeId","data-v-d9b5a9e6"]]),i1=t=>(o.pushScopeId("data-v-139cca32"),t=t(),o.popScopeId(),t),oD={class:"trade-widget"},aD={class:"trade-widget__content"},lD={class:"trade-widget__top"},cD={class:"trade-widget__title-wrapper"},dD=i1(()=>o.createElementVNode("div",{class:"trade-widget__title"},"Trades Performance",-1)),uD={class:"trade-widget__info"},hD={class:"trade-widget__total-wrapper"},fD=i1(()=>o.createElementVNode("div",{class:"trade-widget__total-wrapper__title"},"Total",-1)),mD={class:"trade-widget__total-wrapper__total"},pD={class:"trade-widget__total-wrapper__value"},gD={class:"trade-widget__points"},_D={class:"trade-widget__point"},yD={class:"trade-widget__point__title"},wD=i1(()=>o.createElementVNode("div",{class:"trade-widget__point__line"},null,-1)),bD=Oe({__name:"TradePerformanceWidget",props:{totalTrades:Number,tradePoints:Array,isMask:{type:Boolean,default:!1}},emits:["onChange"],setup(t,{emit:e}){const n=o.ref("week"),r=e;return(s,i)=>(o.openBlock(),o.createElementBlock("div",oD,[o.createElementVNode("div",aD,[o.createElementVNode("div",lD,[o.createElementVNode("div",cD,[dD,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("It displays the number of profitable and unprofitable positions. This widget is very useful for understanding your trading opportunities. ")]),_:1})]),o.createVNode(o.unref(Ws),{modelValue:n.value,"onUpdate:modelValue":i[0]||(i[0]=a=>n.value=a),onOnChange:i[1]||(i[1]=a=>r("onChange",n.value))},null,8,["modelValue"])]),o.createElementVNode("div",uD,[o.createElementVNode("div",hD,[fD,o.createElementVNode("div",mD,[o.createElementVNode("div",pD,o.toDisplayString(o.unref(Me)(t.isMask,t.totalTrades,{repeat:5})),1)])]),o.createElementVNode("div",gD,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(t.tradePoints,a=>(o.openBlock(),o.createElementBlock("div",_D,[o.createElementVNode("div",yD,o.toDisplayString(a.title),1),wD,o.createElementVNode("div",{class:o.normalizeClass(["trade-widget__point__value",a.class?a.class:""])},o.toDisplayString(o.unref(Me)(t.isMask,a.value,{repeat:5})),3)]))),256))])])])]))}},[["__scopeId","data-v-139cca32"]]),o1=t=>(o.pushScopeId("data-v-cbc80015"),t=t(),o.popScopeId(),t),kD={class:"winrate-widget"},CD={class:"winrate-widget__winrate"},xD={class:"winrate-widget__title-wrapper"},MD=o1(()=>o.createElementVNode("div",{class:"winrate-widget__title"},"Daily Winrate",-1)),SD={class:"winrate-widget__chart"},vD={class:"winrate-widget__data"},TD={class:"winrate-widget__data_value"},DD=o1(()=>o.createElementVNode("div",{class:"winrate-widget__data_title"},"Winrate",-1)),OD={class:"winrate-widget__average-rr"},ED={class:"winrate-widget__title-wrapper"},$D=o1(()=>o.createElementVNode("div",{class:"winrate-widget__title"},"Average RR",-1)),PD=Oe({__name:"WinrateWidget",props:{winrate:{type:Number,default:0},minRR:{type:Number,default:0},averageRR:{type:Number,default:0},maxRR:{type:Number,default:0},isMask:{type:Boolean,default:!1}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",kD,[o.createElementVNode("div",CD,[o.createElementVNode("div",xD,[MD,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("Displays the percentage of your successful positions. ")]),_:1})]),o.createElementVNode("div",SD,[o.renderSlot(e.$slots,"roundSlider",{},void 0,!0),o.createElementVNode("div",vD,[o.createElementVNode("div",TD,o.toDisplayString(o.unref(Me)(t.isMask,o.unref(Et)(t.winrate,2)))+"%",1),DD])])]),o.createElementVNode("div",OD,[o.createElementVNode("div",ED,[$D,o.createVNode(o.unref(pn),{alternative:""},{default:o.withCtx(()=>[o.createTextVNode("Risk Reward, defines the ratio of potential profit to loss you can get. ")]),_:1})]),o.createVNode(o.unref(P2),{avg:t.averageRR,min:t.minRR,max:t.maxRR,isMask:t.isMask},null,8,["avg","min","max","isMask"])])]))}},[["__scopeId","data-v-cbc80015"]]),LD=t=>(o.pushScopeId("data-v-e6d713b2"),t=t(),o.popScopeId(),t),VD={class:"average-rr-line-container"},ND={class:"average-rr-line"},BD={key:0,class:"average-rr-line__progress"},AD=[LD(()=>o.createElementVNode("div",{class:"average-rr-line__dot"},null,-1))],FD={class:"coefficients"},RD={class:"coefficients__value -min"},ID={class:"coefficients__value -avg"},HD={class:"coefficients__value -max"},P2=Oe({__name:"AverageRRLine",props:{min:{type:Number,default:0},avg:{type:Number,default:0},max:{type:Number,default:0},isMask:{type:Boolean,default:!1}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",VD,[o.createElementVNode("div",ND,[t.avg&&t.max?(o.openBlock(),o.createElementBlock("div",BD,AD)):o.createCommentVNode("",!0)]),o.createElementVNode("div",FD,[o.createElementVNode("div",RD,o.toDisplayString(o.unref(Me)(t.isMask,t.min,{repeat:3})),1),o.createElementVNode("div",ID,o.toDisplayString(o.unref(Me)(t.isMask,o.unref(Et)(t.avg))),1),o.createElementVNode("div",HD,o.toDisplayString(o.unref(Me)(t.isMask,o.unref(Et)(t.max),{repeat:3})),1)])]))}},[["__scopeId","data-v-e6d713b2"]]);function L2(t){return o.getCurrentScope()?(o.onScopeDispose(t),!0):!1}function Zo(t){return typeof t=="function"?t():o.unref(t)}const V2=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const zD=Object.prototype.toString,YD=t=>zD.call(t)==="[object Object]",Uo=()=>{},a1=WD();function WD(){var t,e;return V2&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&(/iP(ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}const N2={mounted:"mounted",updated:"updated",unmounted:"unmounted"};function jD(...t){if(t.length!==1)return o.toRef(...t);const e=t[0];return typeof e=="function"?o.readonly(o.customRef(()=>({get:e,set:Uo}))):o.ref(e)}function qo(t){var e;const n=Zo(t);return(e=n==null?void 0:n.$el)!=null?e:n}const B2=V2?window:void 0;function Nl(...t){let e,n,r,s;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,s]=t,e=B2):[e,n,r,s]=t,!e)return Uo;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const i=[],a=()=>{i.forEach(u=>u()),i.length=0},l=(u,h,f,m)=>(u.addEventListener(h,f,m),()=>u.removeEventListener(h,f,m)),c=o.watch(()=>[qo(e),Zo(s)],([u,h])=>{if(a(),!u)return;const f=YD(h)?{...h}:h;i.push(...n.flatMap(m=>r.map(g=>l(u,m,g,f))))},{immediate:!0,flush:"post"}),d=()=>{c(),a()};return L2(d),d}let A2=!1;function F2(t,e,n={}){const{window:r=B2,ignore:s=[],capture:i=!0,detectIframe:a=!1}=n;if(!r)return Uo;a1&&!A2&&(A2=!0,Array.from(r.document.body.children).forEach(f=>f.addEventListener("click",Uo)),r.document.documentElement.addEventListener("click",Uo));let l=!0;const c=f=>s.some(m=>{if(typeof m=="string")return Array.from(r.document.querySelectorAll(m)).some(g=>g===f.target||f.composedPath().includes(g));{const g=qo(m);return g&&(f.target===g||f.composedPath().includes(g))}}),u=[Nl(r,"click",f=>{const m=qo(t);if(!(!m||m===f.target||f.composedPath().includes(m))){if(f.detail===0&&(l=!c(f)),!l){l=!0;return}e(f)}},{passive:!0,capture:i}),Nl(r,"pointerdown",f=>{const m=qo(t);l=!c(f)&&!!(m&&!f.composedPath().includes(m))},{passive:!0}),a&&Nl(r,"blur",f=>{setTimeout(()=>{var m;const g=qo(t);((m=r.document.activeElement)==null?void 0:m.tagName)==="IFRAME"&&!(g!=null&&g.contains(r.document.activeElement))&&e(f)},0)})].filter(Boolean);return()=>u.forEach(f=>f())}const R2={[N2.mounted](t,e){const n=!e.modifiers.bubble;if(typeof e.value=="function")t.__onClickOutside_stop=F2(t,e.value,{capture:n});else{const[r,s]=e.value;t.__onClickOutside_stop=F2(t,r,Object.assign({capture:n},s))}},[N2.unmounted](t){t.__onClickOutside_stop()}};function l1(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function I2(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!n||n.tagName==="BODY"?!1:I2(n)}}function ZD(t){const e=t||window.event,n=e.target;return I2(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)}const Bl=new WeakMap;function UD(t,e=!1){const n=o.ref(e);let r=null;o.watch(jD(t),a=>{const l=l1(Zo(a));if(l){const c=l;Bl.get(c)||Bl.set(c,c.style.overflow),n.value&&(c.style.overflow="hidden")}},{immediate:!0});const s=()=>{const a=l1(Zo(t));!a||n.value||(a1&&(r=Nl(a,"touchmove",l=>{ZD(l)},{passive:!1})),a.style.overflow="hidden",n.value=!0)},i=()=>{var a;const l=l1(Zo(t));!l||!n.value||(a1&&(r==null||r()),l.style.overflow=(a=Bl.get(l))!=null?a:"",Bl.delete(l),n.value=!1)};return L2(i),o.computed({get(){return n.value},set(a){a?s():i()}})}function qD(){let t=!1;const e=o.ref(!1);return(n,r)=>{if(e.value=r.value,t)return;t=!0;const s=UD(n,r.value);o.watch(e,i=>s.value=i)}}qD();//! moment.js
42
42
  //! version : 2.30.1