From 2050265aed7f7ca66f276f29b90a8fdb9ac26364 Mon Sep 17 00:00:00 2001 From: manel Date: Sat, 13 Jan 2024 14:53:45 +0100 Subject: [PATCH] Showing btc balance --- app/Models/Total.php | 3 +- app/Services/SupabaseService.php | 6 ++- .../2024_01_11_120158_create_totals_table.php | 1 + public/build/assets/app2.js | 2 +- resources/js/Pages/Dashboard.vue | 7 ++- .../js/components/Dashboard/BalancesChart.vue | 2 +- .../components/dashboard/chart.blade.php | 46 ------------------- .../dashboard/simple-chart.blade.php | 27 ----------- tests/Unit/SupabaseServiceTest.php | 4 +- tests/responses/totals.json | 1 + 10 files changed, 19 insertions(+), 80 deletions(-) delete mode 100644 resources/views/components/dashboard/chart.blade.php delete mode 100644 resources/views/components/dashboard/simple-chart.blade.php diff --git a/app/Models/Total.php b/app/Models/Total.php index 3165a7e..6c158b3 100644 --- a/app/Models/Total.php +++ b/app/Models/Total.php @@ -11,7 +11,8 @@ class Total extends Model protected $casts = [ 'price' => 'float', 'balance' => 'float', + 'price_eur' => 'float', 'btc_price' => 'float', - 'price_eur' => 'float' + 'btc_price_eur' => 'float' ]; } diff --git a/app/Services/SupabaseService.php b/app/Services/SupabaseService.php index 1ebbd10..df783d6 100644 --- a/app/Services/SupabaseService.php +++ b/app/Services/SupabaseService.php @@ -22,11 +22,13 @@ public function getHistoricalBalances() return [ 'prices' => $balances->pluck('price')->toArray(), 'ethereum' => $balances->pluck('balance')->toArray(), - 'bitcoin' => $balances->pluck('btc_price')->toArray(), + 'btc_prices' => $balances->pluck('btc_price')->toArray(), 'prices_eur' => $balances->pluck('price_eur')->toArray(), + 'btc_prices_eur' => $balances->pluck('btc_price_eur')->toArray(), 'totals' => $balances->map(fn ($balance) => $balance->price * $balance->balance)->toArray(), 'totals_eur' => $balances->map(fn ($balance) => $balance->price_eur * $balance->balance)->toArray(), - 'dates' => $balances->map(fn ($balance) => Carbon::parse($balance->created_at)->format('M d Y'))->toArray() + 'dates' => $balances->map(fn ($balance) => Carbon::parse($balance->created_at)->format('M d Y'))->toArray(), + 'bitcoin' => $balances->map(fn ($balance) => $balance->btc_price ? (($balance->price * $balance->balance) / $balance->btc_price) : null)->toArray() ]; } } diff --git a/database/migrations/2024_01_11_120158_create_totals_table.php b/database/migrations/2024_01_11_120158_create_totals_table.php index 12096aa..e296c68 100644 --- a/database/migrations/2024_01_11_120158_create_totals_table.php +++ b/database/migrations/2024_01_11_120158_create_totals_table.php @@ -17,6 +17,7 @@ public function up(): void $table->string('balance'); $table->string('price_eur'); $table->string('btc_price')->nullable(); + $table->string('btc_price_eur')->nullable(); $table->timestamps(); }); } diff --git a/public/build/assets/app2.js b/public/build/assets/app2.js index 2c944c1..17888ff 100644 --- a/public/build/assets/app2.js +++ b/public/build/assets/app2.js @@ -15,7 +15,7 @@ var Rb=Object.defineProperty;var Fb=(e,t,n)=>t in e?Rb(e,t,{enumerable:!0,config * Released under the MIT License */class Jv{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,i,r){const s=n.listeners[r],o=n.duration;s.forEach(a=>a({chart:t,initial:n.initial,numSteps:o,currentStep:Math.min(i-n.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=Yg.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((i,r)=>{if(!i.running||!i.items.length)return;const s=i.items;let o=s.length-1,a=!1,l;for(;o>=0;--o)l=s[o],l._active?(l._total>i.duration&&(i.duration=l._total),l.tick(t),a=!0):(s[o]=s[s.length-1],s.pop());a&&(r.draw(),this._notify(r,i,t,"progress")),s.length||(i.running=!1,this._notify(r,i,t,"complete"),i.initial=!1),n+=s.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let i=n.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,i)),i}listen(t,n,i){this._getAnims(t).listeners[n].push(i)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((i,r)=>Math.max(i,r._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);if(!n||!n.items.length)return;const i=n.items;let r=i.length-1;for(;r>=0;--r)i[r].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var _n=new Jv;const Kh="transparent",Qv={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const i=Lh(e||Kh),r=i.valid&&Lh(t||Kh);return r&&r.valid?r.mix(i,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Zv{constructor(t,n,i,r){const s=n[i];r=wo([t.to,r,s,t.from]);const o=wo([t.from,s,r]);this._active=!0,this._fn=t.fn||Qv[t.type||typeof o],this._easing=gs[t.easing]||gs.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=i,this._from=o,this._to=r,this._promises=void 0}active(){return this._active}update(t,n,i){if(this._active){this._notify(!1);const r=this._target[this._prop],s=i-this._start,o=this._duration-s;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=s,this._loop=!!t.loop,this._to=wo([t.to,n,r,t.from]),this._from=wo([t.from,r,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,i=this._duration,r=this._prop,s=this._from,o=this._loop,a=this._to;let l;if(this._active=s!==a&&(o||n1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[r]=this._fn(s,a,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,i)=>{t.push({res:n,rej:i})})}_notify(t){const n=t?"res":"rej",i=this._promises||[];for(let r=0;r{const s=t[r];if(!bt(s))return;const o={};for(const a of n)o[a]=s[a];(Ct(s.properties)&&s.properties||[r]).forEach(a=>{(a===r||!i.has(a))&&i.set(a,o)})})}_animateOptions(t,n){const i=n.options,r=ew(t,i);if(!r)return[];const s=this._createAnimations(r,i);return i.$shared&&tw(t.options.$animations,i).then(()=>{t.options=i},()=>{}),s}_createAnimations(t,n){const i=this._properties,r=[],s=t.$animations||(t.$animations={}),o=Object.keys(n),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){r.push(...this._animateOptions(t,n));continue}const u=n[c];let h=s[c];const d=i.get(c);if(h)if(d&&h.active()){h.update(d,u,a);continue}else h.cancel();if(!d||!d.duration){t[c]=u;continue}s[c]=h=new Zv(d,t,c,u),r.push(h)}return r}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const i=this._createAnimations(t,n);if(i.length)return _n.add(this._chart,i),!0}}function tw(e,t){const n=[],i=Object.keys(t);for(let r=0;r0||!n&&s<0)return r.index}return null}function Jh(e,t){const{chart:n,_cachedMeta:i}=e,r=n._stacks||(n._stacks={}),{iScale:s,vScale:o,index:a}=i,l=s.axis,c=o.axis,u=sw(s,o,i),h=t.length;let d;for(let g=0;gn[i].axis===t).shift()}function lw(e,t){return ni(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function cw(e,t,n){return ni(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function zr(e,t){const n=e.controller.index,i=e.vScale&&e.vScale.axis;if(i){t=t||e._parsed;for(const r of t){const s=r._stacks;if(!s||s[i]===void 0||s[i][n]===void 0)return;delete s[i][n],s[i]._visualValues!==void 0&&s[i]._visualValues[n]!==void 0&&delete s[i]._visualValues[n]}}}const ic=e=>e==="reset"||e==="none",Qh=(e,t)=>t?e:Object.assign({},e),uw=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:cm(n,!0),values:null};class ys{constructor(t,n){this.chart=t,this._ctx=t.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 t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Gh(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&zr(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,i=this.getDataset(),r=(h,d,g,p)=>h==="x"?d:h==="r"?p:g,s=n.xAxisID=ft(i.xAxisID,nc(t,"x")),o=n.yAxisID=ft(i.yAxisID,nc(t,"y")),a=n.rAxisID=ft(i.rAxisID,nc(t,"r")),l=n.indexAxis,c=n.iAxisID=r(l,s,o,a),u=n.vAxisID=r(l,o,s,a);n.xScale=this.getScaleForId(s),n.yScale=this.getScaleForId(o),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Fh(this._data,this),t._stacked&&zr(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),i=this._data;if(bt(n))this._data=rw(n);else if(i!==n){if(i){Fh(i,this);const r=this._cachedMeta;zr(r),r._parsed=[]}n&&Object.isExtensible(n)&&W0(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,i=this.getDataset();let r=!1;this._dataCheck();const s=n._stacked;n._stacked=Gh(n.vScale,n),n.stack!==i.stack&&(r=!0,zr(n),n.stack=i.stack),this._resyncElements(t),(r||s!==n._stacked)&&Jh(this,n._parsed)}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:i,_data:r}=this,{iScale:s,_stacked:o}=i,a=s.axis;let l=t===0&&n===r.length?!0:i._sorted,c=t>0&&i._parsed[t-1],u,h,d;if(this._parsing===!1)i._parsed=r,i._sorted=!0,d=r;else{Ct(r[t])?d=this.parseArrayData(i,r,t,n):bt(r[t])?d=this.parseObjectData(i,r,t,n):d=this.parsePrimitiveData(i,r,t,n);const g=()=>h[a]===null||c&&h[a]y||h=0;--d)if(!p()){this.updateRangeFromParsed(c,t,g,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,i=[];let r,s,o;for(r=0,s=n.length;r=0&&tthis.getContext(i,r,n),y=c.resolveNamedOptions(d,g,p,h);return y.$shared&&(y.$shared=l,s[o]=Object.freeze(Qh(y,l))),y}_resolveAnimations(t,n,i){const r=this.chart,s=this._cachedDataOpts,o=`animation-${n}`,a=s[o];if(a)return a;let l;if(r.options.animation!==!1){const u=this.chart.config,h=u.datasetAnimationScopeKeys(this._type,n),d=u.getOptionScopes(this.getDataset(),h);l=u.createResolver(d,this.getContext(t,i,n))}const c=new lm(r,l&&l.animations);return l&&l._cacheable&&(s[o]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||ic(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const i=this.resolveDataElementOptions(t,n),r=this._sharedOptions,s=this.getSharedOptions(i),o=this.includeOptions(n,s)||s!==r;return this.updateSharedOptions(s,n,i),{sharedOptions:s,includeOptions:o}}updateElement(t,n,i,r){ic(r)?Object.assign(t,i):this._resolveAnimations(n,r).update(t,i)}updateSharedOptions(t,n,i){t&&!ic(n)&&this._resolveAnimations(void 0,n).update(t,i)}_setStyle(t,n,i,r){t.active=r;const s=this.getStyle(n,r);this._resolveAnimations(n,i,r).update(t,{options:!r&&this.getSharedOptions(s)||s})}removeHoverStyle(t,n,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,n,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,i=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const r=i.length,s=n.length,o=Math.min(s,r);o&&this.parse(0,o),s>r?this._insertElements(r,s-r,t):s{for(c.length+=n,a=c.length-1;a>=o;a--)c[a]=c[a-n]};for(l(s),a=t;a0&&this.getParsed(n-1);for(let E=0;E=A){C.skip=!0;continue}const k=this.getParsed(E),B=St(k[g]),L=C[d]=o.getPixelForValue(k[d],E),V=C[g]=s||B?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,k,l):k[g],E);C.skip=isNaN(L)||isNaN(V)||B,C.stop=E>0&&Math.abs(k[d]-S[d])>b,y&&(C.parsed=k,C.raw=c.data[E]),h&&(C.options=u||this.resolveDataElementOptions(E,P.active?"active":r)),x||this.updateElement(P,E,C,r),S=k}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,i=n.options&&n.options.borderWidth||0,r=t.data||[];if(!r.length)return i;const s=r[0].size(this.resolveDataElementOptions(0)),o=r[r.length-1].size(this.resolveDataElementOptions(r.length-1));return Math.max(i,s,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}et(Ko,"id","line"),et(Ko,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),et(Ko,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});function pi(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class lf{constructor(t){et(this,"options");this.options=t||{}}static override(t){Object.assign(lf.prototype,t)}init(){}formats(){return pi()}parse(){return pi()}format(){return pi()}add(){return pi()}diff(){return pi()}startOf(){return pi()}endOf(){return pi()}}var fw={_date:lf};function hw(e,t,n,i){const{controller:r,data:s,_sorted:o}=e,a=r._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&o&&s.length){const l=a._reversePixels?H0:wi;if(i){if(r._sharedOptions){const c=s[0],u=typeof c.getRange=="function"&&c.getRange(t);if(u){const h=l(s,t,n-u),d=l(s,t,n+u);return{lo:h.lo,hi:d.hi}}}}else return l(s,t,n)}return{lo:0,hi:s.length-1}}function js(e,t,n,i,r){const s=e.getSortedVisibleDatasetMetas(),o=n[t];for(let a=0,l=s.length;a{l[o](t[n],r)&&(s.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(t.x,t.y,r))}),i&&!a?[]:s}var mw={evaluateInteractionItems:js,modes:{index(e,t,n,i){const r=mi(t,e),s=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?rc(e,r,s,i,o):sc(e,r,s,!1,i,o),l=[];return a.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,h=c.data[u];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,i){const r=mi(t,e),s=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?rc(e,r,s,i,o):sc(e,r,s,!1,i,o);if(a.length>0){const l=a[0].datasetIndex,c=e.getDatasetMeta(l).data;a=[];for(let u=0;un.pos===t)}function td(e,t){return e.filter(n=>um.indexOf(n.pos)===-1&&n.box.axis===t)}function Ur(e,t){return e.sort((n,i)=>{const r=t?i:n,s=t?n:i;return r.weight===s.weight?r.index-s.index:r.weight-s.weight})}function yw(e){const t=[];let n,i,r,s,o,a;for(n=0,i=(e||[]).length;nc.box.fullSize),!0),i=Ur(Wr(t,"left"),!0),r=Ur(Wr(t,"right")),s=Ur(Wr(t,"top"),!0),o=Ur(Wr(t,"bottom")),a=td(t,"x"),l=td(t,"y");return{fullSize:n,leftAndTop:i.concat(s),rightAndBottom:r.concat(l).concat(o).concat(a),chartArea:Wr(t,"chartArea"),vertical:i.concat(r).concat(l),horizontal:s.concat(o).concat(a)}}function ed(e,t,n,i){return Math.max(e[n],t[n])+Math.max(e[i],t[i])}function fm(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function vw(e,t,n,i){const{pos:r,box:s}=n,o=e.maxPadding;if(!bt(r)){n.size&&(e[r]-=n.size);const h=i[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?s.height:s.width),n.size=h.size/h.count,e[r]+=n.size}s.getPadding&&fm(o,s.getPadding());const a=Math.max(0,t.outerWidth-ed(o,e,"left","right")),l=Math.max(0,t.outerHeight-ed(o,e,"top","bottom")),c=a!==e.w,u=l!==e.h;return e.w=a,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function ww(e){const t=e.maxPadding;function n(i){const r=Math.max(t[i]-e[i],0);return e[i]+=r,r}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function Sw(e,t){const n=t.maxPadding;function i(r){const s={left:0,top:0,right:0,bottom:0};return r.forEach(o=>{s[o]=Math.max(t[o],n[o])}),s}return i(e?["left","right"]:["top","bottom"])}function is(e,t,n,i){const r=[];let s,o,a,l,c,u;for(s=0,o=e.length,c=0;s{typeof y.beforeLayout=="function"&&y.beforeLayout()});const u=l.reduce((y,b)=>b.box.options&&b.box.options.display===!1?y:y+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:r,availableWidth:s,availableHeight:o,vBoxMaxWidth:s/2/u,hBoxMaxHeight:o/2}),d=Object.assign({},r);fm(d,se(i));const g=Object.assign({maxPadding:d,w:s,h:o,x:r.left,y:r.top},r),p=_w(l.concat(c),h);is(a.fullSize,g,h,p),is(l,g,h,p),is(c,g,h,p)&&is(l,g,h,p),ww(g),nd(a.leftAndTop,g,h,p),g.x+=g.w,g.y+=g.h,nd(a.rightAndBottom,g,h,p),e.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},xt(a.chartArea,y=>{const b=y.box;Object.assign(b,e.chartArea),b.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})})}};class hm{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,i){}removeEventListener(t,n,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,i,r){return n=Math.max(0,n||t.width),i=i||t.height,{width:n,height:Math.max(0,r?Math.floor(n/r):i)}}isAttached(t){return!0}updateConfig(t){}}class Ow extends hm{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const qo="$chartjs",Aw={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},id=e=>e===null||e==="";function Ew(e,t){const n=e.style,i=e.getAttribute("height"),r=e.getAttribute("width");if(e[qo]={initial:{height:i,width:r,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",id(r)){const s=zh(e,"width");s!==void 0&&(e.width=s)}if(id(i))if(e.style.height==="")e.height=e.width/(t||2);else{const s=zh(e,"height");s!==void 0&&(e.height=s)}return e}const dm=Nv?{passive:!0}:!1;function Pw(e,t,n){e.addEventListener(t,n,dm)}function Cw(e,t,n){e.canvas.removeEventListener(t,n,dm)}function Tw(e,t){const n=Aw[e.type]||e.type,{x:i,y:r}=mi(e,t);return{type:n,chart:t,native:e,x:i!==void 0?i:null,y:r!==void 0?r:null}}function _a(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function Mw(e,t,n){const i=e.canvas,r=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||_a(a.addedNodes,i),o=o&&!_a(a.removedNodes,i);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}function kw(e,t,n){const i=e.canvas,r=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||_a(a.removedNodes,i),o=o&&!_a(a.addedNodes,i);o&&n()});return r.observe(document,{childList:!0,subtree:!0}),r}const Is=new Map;let rd=0;function pm(){const e=window.devicePixelRatio;e!==rd&&(rd=e,Is.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function Rw(e,t){Is.size||window.addEventListener("resize",pm),Is.set(e,t)}function Fw(e){Is.delete(e),Is.size||window.removeEventListener("resize",pm)}function Iw(e,t,n){const i=e.canvas,r=i&&af(i);if(!r)return;const s=Gg((a,l)=>{const c=r.clientWidth;n(a,l),c{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||s(c,u)});return o.observe(r),Rw(e,s),o}function oc(e,t,n){n&&n.disconnect(),t==="resize"&&Fw(e)}function Dw(e,t,n){const i=e.canvas,r=Gg(s=>{e.ctx!==null&&n(Tw(s,e))},e);return Pw(i,t,r),r}class Lw extends hm{acquireContext(t,n){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(Ew(t,n),i):null}releaseContext(t){const n=t.canvas;if(!n[qo])return!1;const i=n[qo].initial;["height","width"].forEach(s=>{const o=i[s];St(o)?n.removeAttribute(s):n.setAttribute(s,o)});const r=i.style||{};return Object.keys(r).forEach(s=>{n.style[s]=r[s]}),n.width=n.width,delete n[qo],!0}addEventListener(t,n,i){this.removeEventListener(t,n);const r=t.$proxies||(t.$proxies={}),o={attach:Mw,detach:kw,resize:Iw}[n]||Dw;r[n]=o(t,n,i)}removeEventListener(t,n){const i=t.$proxies||(t.$proxies={}),r=i[n];if(!r)return;({attach:oc,detach:oc,resize:oc}[n]||Cw)(t,n,r),i[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,i,r){return $v(t,n,i,r)}isAttached(t){const n=af(t);return!!(n&&n.isConnected)}}function $w(e){return!rm()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?Ow:Lw}var zo;let $i=(zo=class{constructor(){et(this,"x");et(this,"y");et(this,"active",!1);et(this,"options");et(this,"$animations")}tooltipPosition(t){const{x:n,y:i}=this.getProps(["x","y"],t);return{x:n,y:i}}hasValue(){return Fs(this.x)&&Fs(this.y)}getProps(t,n){const i=this.$animations;if(!n||!i)return this;const r={};return t.forEach(s=>{r[s]=i[s]&&i[s].active()?i[s]._to:this[s]}),r}},et(zo,"defaults",{}),et(zo,"defaultRoutes"),zo);function Nw(e,t){const n=e.options.ticks,i=Bw(e),r=Math.min(n.maxTicksLimit||i,i),s=n.major.enabled?Hw(t):[],o=s.length,a=s[0],l=s[o-1],c=[];if(o>r)return zw(t,c,s,o/r),c;const u=jw(s,t,r);if(o>0){let h,d;const g=o>1?Math.round((l-a)/(o-1)):null;for(Eo(t,c,u,St(g)?0:a-g,a),h=0,d=o-1;hr)return l}return Math.max(r,1)}function Hw(e){const t=[];let n,i;for(n=0,i=e.length;ne==="left"?"right":e==="right"?"left":e,sd=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,od=(e,t)=>Math.min(t||e,e);function ad(e,t){const n=[],i=e.length/t,r=e.length;let s=0;for(;so+a)))return l}function Kw(e,t){xt(e,n=>{const i=n.gc,r=i.length/2;let s;if(r>t){for(s=0;si?i:n,i=r&&n>i?n:i,{min:ve(n,ve(i,n)),max:ve(i,ve(n,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){wt(this.options.beforeUpdate,[this])}update(t,n,i){const{beginAtZero:r,grace:s,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=gv(this,s,r),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a=s||i<=1||!this.isHorizontal()){this.labelRotation=r;return}const u=this._getLabelSizes(),h=u.widest.width,d=u.highest.height,g=Pe(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/i:g/(i-1),h+6>a&&(a=g/(i-(t.offset?.5:1)),l=this.maxHeight-Vr(t.grid)-n.padding-ld(t.title,this.chart.options.font),c=Math.sqrt(h*h+d*d),o=Xu(Math.min(Math.asin(Pe((u.highest.height+6)/a,-1,1)),Math.asin(Pe(l/c,-1,1))-Math.asin(Pe(d/c,-1,1)))),o=Math.max(r,Math.min(s,o))),this.labelRotation=o}afterCalculateLabelRotation(){wt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){wt(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:i,title:r,grid:s}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=ld(r,n.options.font);if(a?(t.width=this.maxWidth,t.height=Vr(s)+l):(t.height=this.maxHeight,t.width=Vr(s)+l),i.display&&this.ticks.length){const{first:c,last:u,widest:h,highest:d}=this._getLabelSizes(),g=i.padding*2,p=Vn(this.labelRotation),y=Math.cos(p),b=Math.sin(p);if(a){const x=i.mirror?0:b*h.width+y*d.height;t.height=Math.min(this.maxHeight,t.height+x+g)}else{const x=i.mirror?0:y*h.width+b*d.height;t.width=Math.min(this.maxWidth,t.width+x+g)}this._calculatePadding(c,u,b,y)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,i,r){const{ticks:{align:s,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let d=0,g=0;l?c?(d=r*t.width,g=i*n.height):(d=i*t.height,g=r*n.width):s==="start"?g=n.width:s==="end"?d=t.width:s!=="inner"&&(d=t.width/2,g=n.width/2),this.paddingLeft=Math.max((d-u+o)*this.width/(this.width-u),0),this.paddingRight=Math.max((g-h+o)*this.width/(this.width-h),0)}else{let u=n.height/2,h=t.height/2;s==="start"?(u=0,h=t.height):s==="end"&&(u=n.height,h=0),this.paddingTop=u+o,this.paddingBottom=h+o}}_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(){wt(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,i;for(n=0,i=t.length;n({width:o[B]||0,height:a[B]||0});return{first:k(0),last:k(n-1),widest:k(P),highest:k(C),widths:o,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return j0(this._alignToPixels?di(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&ta*r?a/i:l/r:l*r0}_computeGridLineItems(t){const n=this.axis,i=this.chart,r=this.options,{grid:s,position:o,border:a}=r,l=s.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),d=Vr(s),g=[],p=a.setContext(this.getContext()),y=p.display?p.width:0,b=y/2,x=function(H){return di(i,H,y)};let A,w,S,E,P,C,k,B,L,V,U,J;if(o==="top")A=x(this.bottom),C=this.bottom-d,B=A-b,V=x(t.top)+b,J=t.bottom;else if(o==="bottom")A=x(this.top),V=t.top,J=x(t.bottom)-b,C=A+b,B=this.top+d;else if(o==="left")A=x(this.right),P=this.right-d,k=A-b,L=x(t.left)+b,U=t.right;else if(o==="right")A=x(this.left),L=t.left,U=x(t.right)-b,P=A+b,k=this.left+d;else if(n==="x"){if(o==="center")A=x((t.top+t.bottom)/2+.5);else if(bt(o)){const H=Object.keys(o)[0],Q=o[H];A=x(this.chart.scales[H].getPixelForValue(Q))}V=t.top,J=t.bottom,C=A+b,B=C+d}else if(n==="y"){if(o==="center")A=x((t.left+t.right)/2);else if(bt(o)){const H=Object.keys(o)[0],Q=o[H];A=x(this.chart.scales[H].getPixelForValue(Q))}P=A-b,k=P-d,L=t.left,U=t.right}const yt=ft(r.ticks.maxTicksLimit,h),tt=Math.max(1,Math.ceil(h/yt));for(w=0;ws.value===t);return r>=0?n.setContext(this.getContext(r)).lineWidth:0}drawGrid(t){const n=this.options.grid,i=this.ctx,r=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let s,o;const a=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(n.display)for(s=0,o=r.length;s{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:r,draw:()=>{this.drawBorder()}},{z:n,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",r=[];let s,o;for(s=0,o=n.length;s{const i=n.split("."),r=i.pop(),s=[e].concat(i).join("."),o=t[n].split("."),a=o.pop(),l=o.join(".");Tt.route(s,r,l,a)})}function Zw(e){return"id"in e&&"defaults"in e}class tS{constructor(){this.controllers=new Po(ys,"datasets",!0),this.elements=new Po($i,"elements"),this.plugins=new Po(Object,"plugins"),this.scales=new Po(Ni,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,i){[...n].forEach(r=>{const s=i||this._getRegistryForType(r);i||s.isForType(r)||s===this.plugins&&r.id?this._exec(t,s,r):xt(r,o=>{const a=i||this._getRegistryForType(o);this._exec(t,a,o)})})}_exec(t,n,i){const r=Gu(t);wt(i["before"+r],[],i),n[t](i),wt(i["after"+r],[],i)}_getRegistryForType(t){for(let n=0;ns.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(r(n,i),t,"stop"),this._notify(r(i,n),t,"start")}}function nS(e){const t={},n=[],i=Object.keys(Ze.plugins.items);for(let s=0;s1&&cd(e[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function ud(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function cS(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(i=>i.xAxisID===e||i.yAxisID===e);if(n.length)return ud(e,"x",n[0])||ud(e,"y",n[0])}return{}}function uS(e,t){const n=Di[e.type]||{scales:{}},i=t.scales||{},r=Hc(e.type,t),s=Object.create(null);return Object.keys(i).forEach(o=>{const a=i[o];if(!bt(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=zc(o,a,cS(o,e),Tt.scales[a.type]),c=aS(l,r),u=n.scales||{};s[o]=ds(Object.create(null),[{axis:l},a,u[l],u[c]])}),e.data.datasets.forEach(o=>{const a=o.type||e.type,l=o.indexAxis||Hc(a,t),u=(Di[a]||{}).scales||{};Object.keys(u).forEach(h=>{const d=oS(h,l),g=o[d+"AxisID"]||d;s[g]=s[g]||Object.create(null),ds(s[g],[{axis:d},i[g],u[h]])})}),Object.keys(s).forEach(o=>{const a=s[o];ds(a,[Tt.scales[a.type],Tt.scale])}),s}function gm(e){const t=e.options||(e.options={});t.plugins=ft(t.plugins,{}),t.scales=uS(e,t)}function mm(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function fS(e){return e=e||{},e.data=mm(e.data),gm(e),e}const fd=new Map,ym=new Set;function Co(e,t){let n=fd.get(e);return n||(n=t(),fd.set(e,n),ym.add(n)),n}const Kr=(e,t,n)=>{const i=da(t,n);i!==void 0&&e.add(i)};class hS{constructor(t){this._config=fS(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=mm(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),gm(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Co(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Co(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Co(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,i=this.type;return Co(`${i}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const i=this._scopeCache;let r=i.get(t);return(!r||n)&&(r=new Map,i.set(t,r)),r}getOptionScopes(t,n,i){const{options:r,type:s}=this,o=this._cachedScopes(t,i),a=o.get(n);if(a)return a;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(h=>Kr(l,t,h))),u.forEach(h=>Kr(l,r,h)),u.forEach(h=>Kr(l,Di[s]||{},h)),u.forEach(h=>Kr(l,Tt,h)),u.forEach(h=>Kr(l,Bc,h))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),ym.has(n)&&o.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,Di[n]||{},Tt.datasets[n]||{},{type:n},Tt,Bc]}resolveNamedOptions(t,n,i,r=[""]){const s={$shared:!0},{resolver:o,subPrefixes:a}=hd(this._resolverCache,t,r);let l=o;if(pS(o,n)){s.$shared=!1,i=Qn(i)?i():i;const c=this.createResolver(t,i,a);l=dr(o,i,c)}for(const c of n)s[c]=l[c];return s}createResolver(t,n,i=[""],r){const{resolver:s}=hd(this._resolverCache,t,i);return bt(n)?dr(s,n,void 0,r):s}}function hd(e,t,n){let i=e.get(t);i||(i=new Map,e.set(t,i));const r=n.join();let s=i.get(r);return s||(s={resolver:rf(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},i.set(r,s)),s}const dS=e=>bt(e)&&Object.getOwnPropertyNames(e).reduce((t,n)=>t||Qn(e[n]),!1);function pS(e,t){const{isScriptable:n,isIndexable:i}=Zg(e);for(const r of t){const s=n(r),o=i(r),a=(o||s)&&e[r];if(s&&(Qn(a)||dS(a))||o&&Ct(a))return!0}return!1}var gS="4.4.0";const mS=["top","bottom","left","right","chartArea"];function dd(e,t){return e==="top"||e==="bottom"||mS.indexOf(e)===-1&&t==="x"}function pd(e,t){return function(n,i){return n[e]===i[e]?n[t]-i[t]:n[e]-i[e]}}function gd(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),wt(n&&n.onComplete,[e],t)}function yS(e){const t=e.chart,n=t.options.animation;wt(n&&n.onProgress,[e],t)}function bm(e){return rm()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const Yo={},md=e=>{const t=bm(e);return Object.values(Yo).filter(n=>n.canvas===t).pop()};function bS(e,t,n){const i=Object.keys(e);for(const r of i){const s=+r;if(s>=t){const o=e[r];delete e[r],(n>0||s>t)&&(e[s+n]=o)}}}function _S(e,t,n,i){return!n||e.type==="mouseout"?null:i?t:e}function To(e,t,n){return e.options.clip?e[n]:t[n]}function xS(e,t){const{xScale:n,yScale:i}=e;return n&&i?{left:To(n,t,"left"),right:To(n,t,"right"),top:To(i,t,"top"),bottom:To(i,t,"bottom")}:t}var jn;let Hs=(jn=class{static register(...t){Ze.add(...t),yd()}static unregister(...t){Ze.remove(...t),yd()}constructor(t,n){const i=this.config=new hS(n),r=bm(t),s=md(r);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const o=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||$w(r)),this.platform.updateConfig(i);const a=this.platform.acquireContext(r,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=P0(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=o,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 eS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=V0(h=>this.update(h),o.resizeDelay||0),this._dataChanges=[],Yo[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}_n.listen(this,"complete",gd),_n.listen(this,"progress",yS),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:i,height:r,_aspectRatio:s}=this;return St(t)?n&&s?s:r?i/r:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ze}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():Hh(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Nh(this.canvas,this.ctx),this}stop(){return _n.stop(this),this}resize(t,n){_n.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const i=this.options,r=this.canvas,s=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(r,t,n,s),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,Hh(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),wt(i.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};xt(n,(i,r)=>{i.id=r})}buildOrUpdateScales(){const t=this.options,n=t.scales,i=this.scales,r=Object.keys(i).reduce((o,a)=>(o[a]=!1,o),{});let s=[];n&&(s=s.concat(Object.keys(n).map(o=>{const a=n[o],l=zc(o,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),xt(s,o=>{const a=o.options,l=a.id,c=zc(l,a),u=ft(a.type,o.dtype);(a.position===void 0||dd(a.position,c)!==dd(o.dposition))&&(a.position=o.dposition),r[l]=!0;let h=null;if(l in i&&i[l].type===u)h=i[l];else{const d=Ze.getScale(u);h=new d({id:l,type:u,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(a,t)}),xt(r,(o,a)=>{o||delete i[a]}),xt(i,o=>{Ce.configure(this,o,o.options),Ce.addBox(this,o)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,i=t.length;if(t.sort((r,s)=>r.index-s.index),i>n){for(let r=n;rn.length&&delete this._stacks,t.forEach((i,r)=>{n.filter(s=>s===i._dataset).length===0&&this._destroyDatasetMeta(r)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let i,r;for(this._removeUnreferencedMetasets(),i=0,r=n.length;i{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const i=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),r=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,u=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(pd("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){xt(this.scales,t=>{Ce.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Th(n,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:i,start:r,count:s}of n){const o=i==="_removeElements"?-s:s;bS(t,r,o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,i=s=>new Set(t.filter(o=>o[0]===s).map((o,a)=>a+","+o.splice(1).join(","))),r=i(0);for(let s=1;ss.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ce.update(this,this.width,this.height,t);const n=this.chartArea,i=n.width<=0||n.height<=0;this._layers=[],xt(this.boxes,r=>{i&&r.position==="chartArea"||(r.configure&&r.configure(),this._layers.push(...r._layers()))},this),this._layers.forEach((r,s)=>{r._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,i=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,i=t._clip,r=!i.disabled,s=xS(t,this.chartArea),o={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(r&&ef(n,{left:i.left===!1?0:s.left-i.left,right:i.right===!1?this.width:s.right+i.right,top:i.top===!1?0:s.top-i.top,bottom:i.bottom===!1?this.height:s.bottom+i.bottom}),t.controller.draw(),r&&nf(n),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(t){return On(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,i,r){const s=mw.modes[n];return typeof s=="function"?s(this,t,i,r):[]}getDatasetMeta(t){const n=this.data.datasets[t],i=this._metasets;let r=i.filter(s=>s&&s._dataset===n).pop();return r||(r={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},i.push(r)),r}getContext(){return this.$context||(this.$context=ni(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!n.hidden}setDatasetVisibility(t,n){const i=this.getDatasetMeta(t);i.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,i){const r=i?"show":"hide",s=this.getDatasetMeta(t),o=s.controller._resolveAnimations(void 0,r);pa(n)?(s.data[n].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(s,{visible:i}),this.update(a=>a.datasetIndex===t?r:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),_n.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,s,o),t[s]=o},r=(s,o,a)=>{s.offsetX=o,s.offsetY=a,this._eventHandler(s)};xt(this.options.events,s=>i(s,r))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,i=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},r=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},s=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{r("attach",a),this.attached=!0,this.resize(),i("resize",s),i("detach",o)};o=()=>{this.attached=!1,r("resize",s),this._stop(),this._resize(0,0),i("attach",a)},n.isAttached(this.canvas)?a():o()}unbindEvents(){xt(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},xt(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,i){const r=i?"set":"remove";let s,o,a,l;for(n==="dataset"&&(s=this.getDatasetMeta(t[0].datasetIndex),s.controller["_"+r+"DatasetHoverStyle"]()),a=0,l=t.length;a{const a=this.getDatasetMeta(s);if(!a)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:a.data[o],index:o}});!fa(i,n)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,n))}notifyPlugins(t,n,i){return this._plugins.notify(this,t,n,i)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,i){const r=this.options.hover,s=(l,c)=>l.filter(u=>!c.some(h=>u.datasetIndex===h.datasetIndex&&u.index===h.index)),o=s(n,t),a=i?t:s(t,n);o.length&&this.updateHoverStyle(o,r.mode,!1),a.length&&r.mode&&this.updateHoverStyle(a,r.mode,!0)}_eventHandler(t,n){const i={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},r=o=>(o.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,r)===!1)return;const s=this._handleEvent(t,n,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,r),(s||i.changed)&&this.render(),this}_handleEvent(t,n,i){const{_active:r=[],options:s}=this,o=n,a=this._getActiveElements(t,r,i,o),l=F0(t),c=_S(t,this._lastEvent,i,l);i&&(this._lastEvent=null,wt(s.onHover,[t,a,this],this),l&&wt(s.onClick,[t,a,this],this));const u=!fa(a,r);return(u||n)&&(this._active=a,this._updateHoverStyles(a,r,n)),this._lastEvent=c,u}_getActiveElements(t,n,i,r){if(t.type==="mouseout")return[];if(!i)return n;const s=this.options.hover;return this.getElementsAtEventForMode(t,s.mode,s,r)}},et(jn,"defaults",Tt),et(jn,"instances",Yo),et(jn,"overrides",Di),et(jn,"registry",Ze),et(jn,"version",gS),et(jn,"getChart",md),jn);function yd(){return xt(Hs.instances,e=>e._plugins.invalidate())}function _m(e,t,n=t){e.lineCap=ft(n.borderCapStyle,t.borderCapStyle),e.setLineDash(ft(n.borderDash,t.borderDash)),e.lineDashOffset=ft(n.borderDashOffset,t.borderDashOffset),e.lineJoin=ft(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=ft(n.borderWidth,t.borderWidth),e.strokeStyle=ft(n.borderColor,t.borderColor)}function vS(e,t,n){e.lineTo(n.x,n.y)}function wS(e){return e.stepped?sv:e.tension||e.cubicInterpolationMode==="monotone"?ov:vS}function xm(e,t,n={}){const i=e.length,{start:r=0,end:s=i-1}=n,{start:o,end:a}=t,l=Math.max(r,o),c=Math.min(s,a),u=ra&&s>a;return{count:i,start:l,loop:t.loop,ilen:c(o+(c?a-S:S))%s,w=()=>{y!==b&&(e.lineTo(u,b),e.lineTo(u,y),e.lineTo(u,x))};for(l&&(g=r[A(0)],e.moveTo(g.x,g.y)),d=0;d<=a;++d){if(g=r[A(d)],g.skip)continue;const S=g.x,E=g.y,P=S|0;P===p?(Eb&&(b=E),u=(h*u+S)/++h):(w(),e.lineTo(S,E),p=P,h=0,y=b=E),x=E}w()}function Wc(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?OS:SS}function AS(e){return e.stepped?Bv:e.tension||e.cubicInterpolationMode==="monotone"?jv:yi}function ES(e,t,n,i){let r=t._path;r||(r=t._path=new Path2D,t.path(r,n,i)&&r.closePath()),_m(e,t.options),e.stroke(r)}function PS(e,t,n,i){const{segments:r,options:s}=t,o=Wc(t);for(const a of r)_m(e,s,a.style),e.beginPath(),o(e,t,a,{start:n,end:n+i-1})&&e.closePath(),e.stroke()}const CS=typeof Path2D=="function";function TS(e,t,n,i){CS&&!t.options.segment?ES(e,t,n,i):PS(e,t,n,i)}class tr extends $i{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){const r=i.spanGaps?this._loop:this._fullLoop;kv(this._points,i,t,r,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Yv(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,i=t.length;return i&&n[t[i-1].end]}interpolate(t,n){const i=this.options,r=t[n],s=this.points,o=Vv(this,{property:n,start:r,end:r});if(!o.length)return;const a=[],l=AS(i);let c,u;for(c=0,u=o.length;ct!=="borderDash"&&t!=="fill"});function bd(e,t,n,i){const r=e.options,{[n]:s}=e.getProps([n],i);return Math.abs(t-s){let{boxHeight:n=t,boxWidth:i=t}=e;return e.usePointStyle&&(n=Math.min(n,t),i=e.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:n,itemHeight:Math.max(t,n)}},MS=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class xd extends $i{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,i){this.maxWidth=t,this.maxHeight=n,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=wt(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(i=>t.filter(i,this.chart.data))),t.sort&&(n=n.sort((i,r)=>t.sort(i,r,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const i=t.labels,r=Ht(i.font),s=r.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=_d(i,s);let c,u;n.font=r.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(o,s,a,l)+10):(u=this.maxHeight,c=this._fitCols(o,r,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,i,r){const{ctx:s,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=r+a;let h=t;s.textAlign="left",s.textBaseline="middle";let d=-1,g=-u;return this.legendItems.forEach((p,y)=>{const b=i+n/2+s.measureText(p.text).width;(y===0||c[c.length-1]+b+2*a>o)&&(h+=u,c[c.length-(y>0?0:1)]=0,g+=u,d++),l[y]={left:0,top:g,row:d,width:b,height:r},c[c.length-1]+=b+a}),h}_fitCols(t,n,i,r){const{ctx:s,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=o-t;let h=a,d=0,g=0,p=0,y=0;return this.legendItems.forEach((b,x)=>{const{itemWidth:A,itemHeight:w}=kS(i,n,s,b,r);x>0&&g+w+2*a>u&&(h+=d+a,c.push({width:d,height:g}),p+=d+a,y++,d=g=0),l[x]={left:p,top:g,col:y,width:A,height:w},d=Math.max(d,A),g+=w+a}),h+=d,c.push({width:d,height:g}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:i,labels:{padding:r},rtl:s}}=this,o=or(s,this.left,this.width);if(this.isHorizontal()){let a=0,l=ee(i,this.left+r,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=ee(i,this.left+r,this.right-this.lineWidths[a])),c.top+=this.top+t+r,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+r}else{let a=0,l=ee(i,this.top+t+r,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=ee(i,this.top+t+r,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+r,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+r}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;ef(t,this),this._draw(),nf(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:i,ctx:r}=this,{align:s,labels:o}=t,a=Tt.color,l=or(t.rtl,this.left,this.width),c=Ht(o.font),{padding:u}=o,h=c.size,d=h/2;let g;this.drawTitle(),r.textAlign=l.textAlign("left"),r.textBaseline="middle",r.lineWidth=.5,r.font=c.string;const{boxWidth:p,boxHeight:y,itemHeight:b}=_d(o,h),x=function(P,C,k){if(isNaN(p)||p<=0||isNaN(y)||y<0)return;r.save();const B=ft(k.lineWidth,1);if(r.fillStyle=ft(k.fillStyle,a),r.lineCap=ft(k.lineCap,"butt"),r.lineDashOffset=ft(k.lineDashOffset,0),r.lineJoin=ft(k.lineJoin,"miter"),r.lineWidth=B,r.strokeStyle=ft(k.strokeStyle,a),r.setLineDash(ft(k.lineDash,[])),o.usePointStyle){const L={radius:y*Math.SQRT2/2,pointStyle:k.pointStyle,rotation:k.rotation,borderWidth:B},V=l.xPlus(P,p/2),U=C+d;Jg(r,L,V,U,o.pointStyleWidth&&p)}else{const L=C+Math.max((h-y)/2,0),V=l.leftForLtr(P,p),U=sr(k.borderRadius);r.beginPath(),Object.values(U).some(J=>J!==0)?ya(r,{x:V,y:L,w:p,h:y,radius:U}):r.rect(V,L,p,y),r.fill(),B!==0&&r.stroke()}r.restore()},A=function(P,C,k){Li(r,k.text,P,C+b/2,c,{strikethrough:k.hidden,textAlign:l.textAlign(k.textAlign)})},w=this.isHorizontal(),S=this._computeTitleHeight();w?g={x:ee(s,this.left+u,this.right-i[0]),y:this.top+u+S,line:0}:g={x:this.left+u,y:ee(s,this.top+S+u,this.bottom-n[0].height),line:0},sm(this.ctx,t.textDirection);const E=b+u;this.legendItems.forEach((P,C)=>{r.strokeStyle=P.fontColor,r.fillStyle=P.fontColor;const k=r.measureText(P.text).width,B=l.textAlign(P.textAlign||(P.textAlign=o.textAlign)),L=p+d+k;let V=g.x,U=g.y;l.setWidth(this.width),w?C>0&&V+L+u>this.right&&(U=g.y+=E,g.line++,V=g.x=ee(s,this.left+u,this.right-i[g.line])):C>0&&U+E>this.bottom&&(V=g.x=V+n[g.line].width+u,g.line++,U=g.y=ee(s,this.top+S+u,this.bottom-n[g.line].height));const J=l.x(V);if(x(J,U,P),V=K0(B,V+p+d,w?V+L:this.right,t.rtl),A(l.x(V),U,P),w)g.x+=L+u;else if(typeof P.text!="string"){const yt=c.lineHeight;g.y+=vm(P,yt)+u}else g.y+=E}),om(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,i=Ht(n.font),r=se(n.padding);if(!n.display)return;const s=or(t.rtl,this.left,this.width),o=this.ctx,a=n.position,l=i.size/2,c=r.top+l;let u,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),u=this.top+c,h=ee(t.align,h,this.right-d);else{const p=this.columnSizes.reduce((y,b)=>Math.max(y,b.height),0);u=c+ee(t.align,this.top,this.bottom-p-t.labels.padding-this._computeTitleHeight())}const g=ee(a,h,h+d);o.textAlign=s.textAlign(Qu(a)),o.textBaseline="middle",o.strokeStyle=n.color,o.fillStyle=n.color,o.font=i.string,Li(o,n.text,g,u,i)}_computeTitleHeight(){const t=this.options.title,n=Ht(t.font),i=se(t.padding);return t.display?n.lineHeight+i.height:0}_getLegendItemAt(t,n){let i,r,s;if(ns(t,this.left,this.right)&&ns(n,this.top,this.bottom)){for(s=this.legendHitBoxes,i=0;is.length>o.length?s:o)),t+n.size/2+i.measureText(r).width}function FS(e,t,n){let i=e;return typeof t.text!="string"&&(i=vm(t,n)),i}function vm(e,t){const n=e.text?e.text.length:0;return t*n}function IS(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var wm={id:"legend",_element:xd,start(e,t,n){const i=e.legend=new xd({ctx:e.ctx,options:n,chart:e});Ce.configure(e,i,n),Ce.addBox(e,i)},stop(e){Ce.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const i=e.legend;Ce.configure(e,i,n),i.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const i=t.datasetIndex,r=n.chart;r.isDatasetVisible(i)?(r.hide(i),t.hidden=!0):(r.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:i,textAlign:r,color:s,useBorderRadius:o,borderRadius:a}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=se(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:s,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:i||c.pointStyle,rotation:c.rotation,textAlign:r||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};class Sm extends $i{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n){const i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const r=Ct(i.text)?i.text.length:1;this._padding=se(i.padding);const s=r*Ht(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=s:this.width=s}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:i,bottom:r,right:s,options:o}=this,a=o.align;let l=0,c,u,h;return this.isHorizontal()?(u=ee(a,i,s),h=n+t,c=s-i):(o.position==="left"?(u=i+t,h=ee(a,r,n),l=$t*-.5):(u=s-t,h=ee(a,n,r),l=$t*.5),c=r-n),{titleX:u,titleY:h,maxWidth:c,rotation:l}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const i=Ht(n.font),s=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(s);Li(t,n.text,0,0,i,{color:n.color,maxWidth:l,rotation:c,textAlign:Qu(n.align),textBaseline:"middle",translation:[o,a]})}}function DS(e,t){const n=new Sm({ctx:e.ctx,options:t,chart:e});Ce.configure(e,n,t),Ce.addBox(e,n),e.titleBlock=n}var Om={id:"title",_element:Sm,start(e,t,n){DS(e,n)},stop(e){const t=e.titleBlock;Ce.removeBox(e,t),delete e.titleBlock},beforeUpdate(e,t,n){const i=e.titleBlock;Ce.configure(e,i,n),i.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const rs={average(e){if(!e.length)return!1;let t,n,i=0,r=0,s=0;for(t=0,n=e.length;t-1?e.split(` -`):e}function LS(e,t){const{element:n,datasetIndex:i,index:r}=t,s=e.getDatasetMeta(i).controller,{label:o,value:a}=s.getLabelAndValue(r);return{chart:e,label:o,parsed:s.getParsed(r),raw:e.data.datasets[i].data[r],formattedValue:a,dataset:s.getDataset(),dataIndex:r,datasetIndex:i,element:n}}function vd(e,t){const n=e.chart.ctx,{body:i,footer:r,title:s}=e,{boxWidth:o,boxHeight:a}=t,l=Ht(t.bodyFont),c=Ht(t.titleFont),u=Ht(t.footerFont),h=s.length,d=r.length,g=i.length,p=se(t.padding);let y=p.height,b=0,x=i.reduce((S,E)=>S+E.before.length+E.lines.length+E.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,h&&(y+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){const S=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=g*S+(x-g)*l.lineHeight+(x-1)*t.bodySpacing}d&&(y+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let A=0;const w=function(S){b=Math.max(b,n.measureText(S).width+A)};return n.save(),n.font=c.string,xt(e.title,w),n.font=l.string,xt(e.beforeBody.concat(e.afterBody),w),A=t.displayColors?o+2+t.boxPadding:0,xt(i,S=>{xt(S.before,w),xt(S.lines,w),xt(S.after,w)}),A=0,n.font=u.string,xt(e.footer,w),n.restore(),b+=p.width,{width:b,height:y}}function $S(e,t){const{y:n,height:i}=t;return ne.height-i/2?"bottom":"center"}function NS(e,t,n,i){const{x:r,width:s}=i,o=n.caretSize+n.caretPadding;if(e==="left"&&r+s+o>t.width||e==="right"&&r-s-o<0)return!0}function BS(e,t,n,i){const{x:r,width:s}=n,{width:o,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=r<=(a+l)/2?"left":"right":r<=s/2?c="left":r>=o-s/2&&(c="right"),NS(c,e,t,n)&&(c="center"),c}function wd(e,t,n){const i=n.yAlign||t.yAlign||$S(e,n);return{xAlign:n.xAlign||t.xAlign||BS(e,t,n,i),yAlign:i}}function jS(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function HS(e,t,n){let{y:i,height:r}=e;return t==="top"?i+=n:t==="bottom"?i-=r+n:i-=r/2,i}function Sd(e,t,n,i){const{caretSize:r,caretPadding:s,cornerRadius:o}=e,{xAlign:a,yAlign:l}=n,c=r+s,{topLeft:u,topRight:h,bottomLeft:d,bottomRight:g}=sr(o);let p=jS(t,a);const y=HS(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,d)+r:a==="right"&&(p+=Math.max(h,g)+r),{x:Pe(p,0,i.width-t.width),y:Pe(y,0,i.height-t.height)}}function Mo(e,t,n){const i=se(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function Od(e){return Je([],xn(e))}function zS(e,t,n){return ni(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Ad(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Am={beforeTitle:bn,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?Am[t].call(n,i):r}class Uc extends $i{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),r=i.enabled&&n.options.animation&&i.animations,s=new lm(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=zS(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,r=ge(i,"beforeTitle",this,t),s=ge(i,"title",this,t),o=ge(i,"afterTitle",this,t);let a=[];return a=Je(a,xn(r)),a=Je(a,xn(s)),a=Je(a,xn(o)),a}getBeforeBody(t,n){return Od(ge(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,r=[];return xt(t,s=>{const o={before:[],lines:[],after:[]},a=Ad(i,s);Je(o.before,xn(ge(a,"beforeLabel",this,s))),Je(o.lines,ge(a,"label",this,s)),Je(o.after,xn(ge(a,"afterLabel",this,s))),r.push(o)}),r}getAfterBody(t,n){return Od(ge(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,r=ge(i,"beforeFooter",this,t),s=ge(i,"footer",this,t),o=ge(i,"afterFooter",this,t);let a=[];return a=Je(a,xn(r)),a=Je(a,xn(s)),a=Je(a,xn(o)),a}_createItems(t){const n=this._active,i=this.chart.data,r=[],s=[],o=[];let a=[],l,c;for(l=0,c=n.length;lt.filter(u,h,d,i))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,i))),xt(a,u=>{const h=Ad(t.callbacks,u);r.push(ge(h,"labelColor",this,u)),s.push(ge(h,"labelPointStyle",this,u)),o.push(ge(h,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=a,a}update(t,n){const i=this.options.setContext(this.getContext()),r=this._active;let s,o=[];if(!r.length)this.opacity!==0&&(s={opacity:0});else{const a=rs[i.position].call(this,r,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=vd(this,i),c=Object.assign({},a,l),u=wd(this.chart,i,c),h=Sd(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,s={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,s&&this._resolveAnimations().update(this,s),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,r){const s=this.getCaretPosition(t,i,r);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(t,n,i){const{xAlign:r,yAlign:s}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:h}=sr(a),{x:d,y:g}=t,{width:p,height:y}=n;let b,x,A,w,S,E;return s==="center"?(S=g+y/2,r==="left"?(b=d,x=b-o,w=S+o,E=S-o):(b=d+p,x=b+o,w=S-o,E=S+o),A=b):(r==="left"?x=d+Math.max(l,u)+o:r==="right"?x=d+p-Math.max(c,h)-o:x=this.caretX,s==="top"?(w=g,S=w-o,b=x-o,A=x+o):(w=g+y,S=w+o,b=x+o,A=x-o),E=w),{x1:b,x2:x,x3:A,y1:w,y2:S,y3:E}}drawTitle(t,n,i){const r=this.title,s=r.length;let o,a,l;if(s){const c=or(i.rtl,this.x,this.width);for(t.x=Mo(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",o=Ht(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=o.string,l=0;lA!==0)?(t.beginPath(),t.fillStyle=s.multiKeyBackground,ya(t,{x:y,y:p,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),ya(t,{x:b,y:p+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=s.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=o.backgroundColor,t.fillRect(b,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:r}=this,{bodySpacing:s,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,h=Ht(i.bodyFont);let d=h.lineHeight,g=0;const p=or(i.rtl,this.x,this.width),y=function(k){n.fillText(k,p.x(t.x+g),t.y+d/2),t.y+=d+s},b=p.textAlign(o);let x,A,w,S,E,P,C;for(n.textAlign=o,n.textBaseline="middle",n.font=h.string,t.x=Mo(this,b,i),n.fillStyle=i.bodyColor,xt(this.beforeBody,y),g=a&&b!=="right"?o==="center"?c/2+u:c+2+u:0,S=0,P=r.length;S0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,r=i&&i.x,s=i&&i.y;if(r||s){const o=rs[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=vd(this,t),l=Object.assign({},o,this._size),c=wd(n,t,l),u=Sd(t,l,c,n);(r._to!==u.x||s._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},s={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=se(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(s,t,r,n),sm(t,n.textDirection),s.y+=o.top,this.drawTitle(s,t,n),this.drawBody(s,t,n),this.drawFooter(s,t,n),om(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,r=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),s=!fa(i,r),o=this._positionChanged(r,n);(s||o)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,s=this._active||[],o=this._getActiveElements(t,s,n,i),a=this._positionChanged(o,t),l=n||!fa(o,s)||a;return l&&(this._active=o,(r.enabled||r.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,r){const s=this.options;if(t.type==="mouseout")return[];if(!r)return n;const o=this.chart.getElementsAtEventForMode(t,s.mode,s,i);return s.reverse&&o.reverse(),o}_positionChanged(t,n){const{caretX:i,caretY:r,options:s}=this,o=rs[s.position].call(this,t,n);return o!==!1&&(i!==o.x||r!==o.y)}}et(Uc,"positioners",rs);var Em={id:"tooltip",_element:Uc,positioners:rs,afterInit(e,t,n){n&&(e.tooltip=new Uc({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Am},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const WS=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function US(e,t,n,i){const r=e.indexOf(t);if(r===-1)return WS(e,t,n,i);const s=e.lastIndexOf(t);return r!==s?n:r}const VS=(e,t)=>e===null?null:Pe(Math.round(e),0,t);function Ed(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}et(xa,"id","category"),et(xa,"defaults",{ticks:{callback:Ed}});function KS(e,t){const n=[],{bounds:r,step:s,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:h,includeBounds:d}=e,g=s||1,p=u-1,{min:y,max:b}=t,x=!St(o),A=!St(a),w=!St(c),S=(b-y)/(h+1);let E=kh((b-y)/p/g)*g,P,C,k,B;if(E<1e-14&&!x&&!A)return[{value:y},{value:b}];B=Math.ceil(b/E)-Math.floor(y/E),B>p&&(E=kh(B*E/p/g)*g),St(l)||(P=Math.pow(10,l),E=Math.ceil(E*P)/P),r==="ticks"?(C=Math.floor(y/E)*E,k=Math.ceil(b/E)*E):(C=y,k=b),x&&A&&s&&$0((a-o)/s,E/1e3)?(B=Math.round(Math.min((a-o)/E,u)),E=(a-o)/B,C=o,k=a):w?(C=x?o:C,k=A?a:k,B=c-1,E=(k-C)/B):(B=(k-C)/E,ps(B,Math.round(B),E/1e3)?B=Math.round(B):B=Math.ceil(B));const L=Math.max(Rh(E),Rh(C));P=Math.pow(10,St(l)?L:l),C=Math.round(C*P)/P,k=Math.round(k*P)/P;let V=0;for(x&&(d&&C!==o?(n.push({value:o}),Ca)break;n.push({value:U})}return A&&d&&k!==a?n.length&&ps(n[n.length-1].value,a,Pd(a,S,e))?n[n.length-1].value=a:n.push({value:a}):(!A||k===a)&&n.push({value:k}),n}function Pd(e,t,{horizontal:n,minRotation:i}){const r=Vn(i),s=(n?Math.sin(r):Math.cos(r))||.001,o=.75*t*(""+e).length;return Math.min(t/s,o)}class va extends Ni{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return St(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:r,max:s}=this;const o=l=>r=n?r:l,a=l=>s=i?s:l;if(t){const l=hr(r),c=hr(s);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(r===s){let l=s===0?1:Math.abs(s*.05);a(s+l),t||o(r-l)}this.min=r,this.max=s}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,r;return i?(r=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const r={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,o=KS(r,s);return t.bounds==="ticks"&&Vg(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const r=(i-n)/Math.max(t.length-1,1)/2;n-=r,i+=r}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return tf(t,this.chart.options.locale,this.options.ticks.format)}}class wa extends va{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Kt(t)?t:0,this.max=Kt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=Vn(this.options.ticks.minRotation),r=(t?Math.sin(i):Math.cos(i))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/r))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}et(wa,"id","linear"),et(wa,"defaults",{ticks:{callback:qa.formatters.numeric}});const Ds=e=>Math.floor(Un(e)),gi=(e,t)=>Math.pow(10,Ds(e)+t);function Cd(e){return e/Math.pow(10,Ds(e))===1}function Td(e,t,n){const i=Math.pow(10,n),r=Math.floor(e/i);return Math.ceil(t/i)-r}function qS(e,t){const n=t-e;let i=Ds(n);for(;Td(e,t,i)>10;)i++;for(;Td(e,t,i)<10;)i--;return Math.min(i,Ds(e))}function YS(e,{min:t,max:n}){t=ve(e.min,t);const i=[],r=Ds(t);let s=qS(t,n),o=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=r>s?Math.pow(10,r):0,c=Math.round((t-l)*o)/o,u=Math.floor((t-l)/a/10)*a*10;let h=Math.floor((c-u)/Math.pow(10,s)),d=ve(e.min,Math.round((l+u+h*Math.pow(10,s))*o)/o);for(;d=10?h=h<15?15:20:h++,h>=20&&(s++,h=2,o=s>=0?1:o),d=Math.round((l+u+h*Math.pow(10,s))*o)/o;const g=ve(e.max,d);return i.push({value:g,major:Cd(g),significand:h}),i}class Md extends Ni{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const i=va.prototype.parse.apply(this,[t,n]);if(i===0){this._zero=!0;return}return Kt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Kt(t)?Math.max(0,t):null,this.max=Kt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Kt(this._userMin)&&(this.min=t===gi(this.min,0)?gi(this.min,-1):gi(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let i=this.min,r=this.max;const s=a=>i=t?i:a,o=a=>r=n?r:a;i===r&&(i<=0?(s(1),o(10)):(s(gi(i,-1)),o(gi(r,1)))),i<=0&&s(gi(r,-1)),r<=0&&o(gi(i,1)),this.min=i,this.max=r}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},i=YS(n,this);return t.bounds==="ticks"&&Vg(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":tf(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Un(t),this._valueRange=Un(this.max)-Un(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Un(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}et(Md,"id","logarithmic"),et(Md,"defaults",{ticks:{callback:qa.formatters.logarithmic,major:{enabled:!0}}});function Vc(e){const t=e.ticks;if(t.display&&e.display){const n=se(t.backdropPadding);return ft(t.font&&t.font.size,Tt.font.size)+n.height}return 0}function GS(e,t,n){return n=Ct(n)?n:[n],{w:rv(e,t.string,n),h:n.length*t.lineHeight}}function kd(e,t,n,i,r){return e===i||e===r?{start:t-n/2,end:t+n/2}:er?{start:t-n,end:t}:{start:t,end:t+n}}function XS(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),i=[],r=[],s=e._pointLabels.length,o=e.options.pointLabels,a=o.centerPointLabels?$t/s:0;for(let l=0;lt.r&&(a=(i.end-t.r)/s,e.r=Math.max(e.r,t.r+a)),r.startt.b&&(l=(r.end-t.b)/o,e.b=Math.max(e.b,t.b+l))}function QS(e,t,n){const i=e.drawingArea,{extra:r,additionalAngle:s,padding:o,size:a}=n,l=e.getPointPosition(t,i+r+o,s),c=Math.round(Xu($e(l.angle+we))),u=i1(l.y,a.h,c),h=e1(c),d=n1(l.x,a.w,h);return{visible:!0,x:l.x,y:u,textAlign:h,left:d,top:u,right:d+a.w,bottom:u+a.h}}function ZS(e,t){if(!t)return!0;const{left:n,top:i,right:r,bottom:s}=e;return!(On({x:n,y:i},t)||On({x:n,y:s},t)||On({x:r,y:i},t)||On({x:r,y:s},t))}function t1(e,t,n){const i=[],r=e._pointLabels.length,s=e.options,{centerPointLabels:o,display:a}=s.pointLabels,l={extra:Vc(s)/2,additionalAngle:o?$t/r:0};let c;for(let u=0;u270||n<90)&&(e-=t),e}function r1(e,t,n){const{left:i,top:r,right:s,bottom:o}=n,{backdropColor:a}=t;if(!St(a)){const l=sr(t.borderRadius),c=se(t.backdropPadding);e.fillStyle=a;const u=i-c.left,h=r-c.top,d=s-i+c.width,g=o-r+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),ya(e,{x:u,y:h,w:d,h:g,radius:l}),e.fill()):e.fillRect(u,h,d,g)}}function s1(e,t){const{ctx:n,options:{pointLabels:i}}=e;for(let r=t-1;r>=0;r--){const s=e._pointLabelItems[r];if(!s.visible)continue;const o=i.setContext(e.getPointLabelContext(r));r1(n,o,s);const a=Ht(o.font),{x:l,y:c,textAlign:u}=s;Li(n,e._pointLabels[r],l,c+a.lineHeight/2,a,{color:o.color,textAlign:u,textBaseline:"middle"})}}function Pm(e,t,n,i){const{ctx:r}=e;if(n)r.arc(e.xCenter,e.yCenter,t,0,Te);else{let s=e.getPointPosition(0,t);r.moveTo(s.x,s.y);for(let o=1;o{const r=wt(this.options.pointLabels.callback,[n,i],this);return r||r===0?r:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?XS(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,i,r){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((i-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,i,r))}getIndexAngle(t){const n=Te/(this._pointLabels.length||1),i=this.options.startAngle||0;return $e(t*n+Vn(i))}getDistanceFromCenterForValue(t){if(St(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(St(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t{if(h!==0){l=this.getDistanceFromCenterForValue(u.value);const d=this.getContext(h),g=r.setContext(d),p=s.setContext(d);o1(this,g,l,o,p)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const u=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=u;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const r=this.getIndexAngle(0);let s,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(r),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!n.reverse)return;const c=i.setContext(this.getContext(l)),u=Ht(c.font);if(s=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const h=se(c.backdropPadding);t.fillRect(-o/2-h.left,-s-u.size/2-h.top,o+h.width,u.size+h.height)}Li(t,a.label,0,-s,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}et(ko,"id","radialLinear"),et(ko,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:qa.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),et(ko,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),et(ko,"descriptors",{angleLines:{_fallback:"grid"}});const Ga={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}},be=Object.keys(Ga);function Rd(e,t){return e-t}function Fd(e,t){if(St(t))return null;const n=e._adapter,{parser:i,round:r,isoWeekday:s}=e._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),Kt(o)||(o=typeof i=="string"?n.parse(o,i):n.parse(o)),o===null?null:(r&&(o=r==="week"&&(Fs(s)||s===!0)?n.startOf(o,"isoWeek",s):n.startOf(o,r)),+o)}function Id(e,t,n,i){const r=be.length;for(let s=be.indexOf(e);s=be.indexOf(n);s--){const o=be[s];if(Ga[o].common&&e._adapter.diff(r,i,o)>=t-1)return o}return be[n?be.indexOf(n):0]}function c1(e){for(let t=be.indexOf(e)+1,n=be.length;t=t?n[i]:n[r];e[s]=!0}}function u1(e,t,n,i){const r=e._adapter,s=+r.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=s;a<=o;a=+r.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function Ld(e,t,n){const i=[],r={},s=t.length;let o,a;for(o=0;o+t.value))}initOffsets(t=[]){let n=0,i=0,r,s;this.options.offset&&t.length&&(r=this.getDecimalForValue(t[0]),t.length===1?n=1-r:n=(this.getDecimalForValue(t[1])-r)/2,s=this.getDecimalForValue(t[t.length-1]),t.length===1?i=s:i=(s-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;n=Pe(n,0,o),i=Pe(i,0,o),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,r=this.options,s=r.time,o=s.unit||Id(s.minUnit,n,i,this._getLabelCapacity(n)),a=ft(r.ticks.stepSize,1),l=o==="week"?s.isoWeekday:!1,c=Fs(l)||l===!0,u={};let h=n,d,g;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":o),t.diff(i,n,o)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+o);const p=r.ticks.source==="data"&&this.getDataTimestamps();for(d=h,g=0;d+y)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const r=this.options.time.displayFormats,s=this._unit,o=n||r[s];return this._adapter.format(t,o)}_tickFormatFunction(t,n,i,r){const s=this.options,o=s.ticks.callback;if(o)return wt(o,[t,n,i],this);const a=s.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],h=c&&a[c],d=i[n],g=c&&h&&d&&d.major;return this._adapter.format(t,r||(g?h:u))}generateTickLabels(t){let n,i,r;for(n=0,i=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,i=r.length;n=e[i].pos&&t<=e[r].pos&&({lo:i,hi:r}=wi(e,"pos",t)),{pos:s,time:a}=e[i],{pos:o,time:l}=e[r]):(t>=e[i].time&&t<=e[r].time&&({lo:i,hi:r}=wi(e,"time",t)),{time:s,pos:a}=e[i],{time:o,pos:l}=e[r]);const c=o-s;return c?a+(l-a)*(t-s)/c:a}class $d extends Sa{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Ro(n,this.min),this._tableRange=Ro(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,r=[],s=[];let o,a,l,c,u;for(o=0,a=t.length;o=n&&c<=i&&r.push(c);if(r.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(o=0,a=r.length;or-s)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Ro(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return Ro(this._table,i*this._tableRange+this._minPos,!0)}}et($d,"id","timeseries"),et($d,"defaults",Sa.defaults);const Cm={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},f1={type:{type:String,required:!0},...Cm},h1=Fg[0]==="2"?(e,t)=>Object.assign(e,{attrs:t}):(e,t)=>Object.assign(e,t);function Yi(e){return Ha(e)?pt(e):e}function d1(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e;return Ha(t)?new Proxy(e,{}):e}function p1(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Tm(e,t){e.labels=t}function Mm(e,t,n){const i=[];e.datasets=t.map(r=>{const s=e.datasets.find(o=>o[n]===r[n]);return!s||!r.data||i.includes(s)?{...r}:(i.push(s),Object.assign(s,r),s)})}function g1(e,t){const n={labels:[],datasets:[]};return Tm(n,e.labels),Mm(n,e.datasets,t),n}const m1=Bu({props:f1,setup(e,t){let{expose:n}=t;const i=za(null),r=Lu(null);n({chart:r});const s=()=>{if(!i.value)return;const{type:l,data:c,options:u,plugins:h,datasetIdKey:d}=e,g=g1(c,d),p=d1(g,c);r.value=new Hs(i.value,{type:l,data:p,options:{...u},plugins:h})},o=()=>{const l=pt(r.value);l&&(l.destroy(),r.value=null)},a=l=>{l.update(e.updateMode)};return gg(s),mg(o),ls([()=>e.options,()=>e.data],(l,c)=>{let[u,h]=l,[d,g]=c;const p=pt(r.value);if(!p)return;let y=!1;if(u){const b=Yi(u),x=Yi(d);b&&b!==x&&(p1(p,b),y=!0)}if(h){const b=Yi(h.labels),x=Yi(g.labels),A=Yi(h.datasets),w=Yi(g.datasets);b!==x&&(Tm(p.config.data,b),y=!0),A&&A!==w&&(Mm(p.config.data,A,e.datasetIdKey),y=!0)}y&&a(p)},{deep:!0}),()=>Ei("canvas",{ref:i})}});function y1(e,t){return Hs.register(t),Bu({props:Cm,setup(n,i){let{expose:r}=i;const s=Lu(null),o=a=>{s.value=a==null?void 0:a.chart};return r({chart:s}),()=>Ei(m1,h1({ref:o},{type:e,...n}))}})}const km=y1("line",Ko),cf=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};Hs.register(xa,wa,bs,tr,Om,Em,wm);const b1={components:{Line:km},props:{data:Array,labels:Array},created(){this.chartColor=this.getChange()>=0?"green":"red"},methods:{getChange(){return((this.data.at(-1)-this.data.at(-2))/this.data.at(-2)*100||0).toFixed(2)}}};function _1(e,t,n,i,r,s){const o=oa("Line");return Ee(),Tg(o,{height:"30",data:{labels:n.labels,datasets:[{data:n.data,borderColor:e.chartColor,backgroundColor:e.chartColor}]},options:{elements:{point:{radius:0}},plugins:{legend:{display:!1}},scales:{y:{ticks:{display:!1}},x:{ticks:{display:!1}}}}},null,8,["data"])}const x1=cf(b1,[["render",_1]]);Hs.register(xa,wa,bs,tr,Om,Em,wm);const v1={props:{data:Array,dates:Array,color:String,label:String,total:String,subtotal:String},components:{Line:km},created(){this.chartColor=this.color||(this.getChange()>0?"green":"red")},methods:{getChange(){return((this.data.at(-1)-this.data.at(-2))/this.data.at(-2)*100).toFixed(2)}}},w1={class:"flex flex-col col-span-full sm:col-span-12 bg-white dark:bg-slate-800 shadow-lg border border-slate-200 dark:border-slate-700"},S1={class:"px-5 py-2 border-b border-slate-100 dark:border-slate-700 flex items-center"},O1={class:"font-semibold text-slate-800 dark:text-slate-100"},A1={class:"px-5 py-3"},E1={class:"flex flex-wrap justify-between items-end"},P1={class:"flex items-start"},C1={class:"text-right mr-2 text-slate-800 dark:text-slate-100"},T1={class:"text-3xl font-bold"},M1={class:"text-xl font-semibold h-1"};function k1(e,t,n,i,r,s){const o=oa("Line");return Ee(),Xe("div",w1,[W("header",S1,[W("h2",O1,kt(n.label),1)]),W("div",A1,[W("div",E1,[W("div",P1,[W("div",C1,[W("div",T1,kt(n.total),1),W("div",M1,kt(n.subtotal),1)]),W("div",{class:Le(["text-sm font-semibold text-white px-1.5 rounded-full",{"bg-red-700":s.getChange()<0,"bg-green-700":s.getChange()>=0}])},kt(s.getChange())+"%",3)])])]),W("div",null,[Rt(o,{height:"100",data:{labels:n.dates,datasets:[{data:n.data}]},options:{color:"white",borderColor:e.chartColor,backgroundColor:e.chartColor,elements:{point:{radius:2}},plugins:{legend:{display:!1}},scales:{y:{ticks:{color:"white"}},x:{ticks:{color:"white"}}}}},null,8,["data","options"])])])}const R1=cf(v1,[["render",k1]]),F1={components:{TokenChart:x1,BalancesChart:R1},props:{tokens:Array,balance:Number,balances:Object,transactions:Array},data(){return{loading:!1}},created(){this.totals={usd:this.balances.totals.at(-1),eth:this.balances.ethereum.at(-1),eur:this.balances.totals_eur.at(-1),pricesUsd:this.balances.prices.at(-1),pricesEur:this.balances.prices_eur.at(-1)},this.weeklyLast=this.tokens.slice(0,7).at(-1)},methods:{getDailyChange(e){const t=this.tokens[1][e].price;return((this.tokens[0][e].price-t)/t*100).toFixed(2)},getWeeklyApy(e){const t=this.tokens[0][e].balance;return((t-(this.weeklyLast[e]||0).balance)/t*100||0).toFixed(2)},getWeeklyGain(e){const t=this.tokens[0][e];return((t.balance-(this.weeklyLast[e]||0).balance)*t.price).toFixed(2)},getMonthlyApy(e){const t=this.tokens[0][e].balance;return((t-(this.tokens.at(-1)[e]||0).balance)/t*100||0).toFixed(2)},getMonthlyGain(e){const t=this.tokens[0][e];return((t.balance-(this.tokens.at(-1)[e]||0).balance)*t.price).toFixed(2)},getTokensHistory(e){return this.tokens.map(t=>t[e]||0).reverse()},getBalanceHistory(e){return this.getTokensHistory(e).map(({balance:t})=>t)},getPriceHistory(e){return this.getTokensHistory(e).map(t=>t.balance*t.price)},refreshTokens(){this.loading=!0,axios.get("get-tokens").then(({data:e})=>{e.balances.forEach(t=>{const n=this.tokens[0][t.pool];n.price=t.price,n.balance=t.balance,n.price_eur=t.price_eur}),this.totals={usd:0,eth:0,eur:0,pricesEur:e.ethereumPrice.eur,pricesUsd:e.ethereumPrice.usd},e.balances.forEach(t=>{this.totals.usd+=t.price*t.balance,this.totals.eur+=t.price_eur*t.balance,this.totals.eth+=t.price*t.balance/this.totals.pricesUsd}),this.loading=!1})},currencyFormat(e){return new Intl.NumberFormat().format(e)}}},I1={class:"flex"},D1={class:"w-1/3"},L1={class:"w-1/3"},$1={class:"w-1/3"},N1={class:"col-span-full xl:col-span-12 bg-white dark:bg-slate-800 shadow-lg rounded-sm border border-slate-200 dark:border-slate-700 mt-4"},B1={class:"p-4 border-b border-slate-100 dark:border-slate-700 inline-flex"},j1=W("h2",{class:"font-semibold text-slate-800 dark:text-slate-100 mr-2"},"Balances",-1),H1=["disabled"],z1={class:"table-autodark:text-slate-300 mx-auto w-full sortable"},W1=W("thead",{class:"text-xs uppercase text-slate-400 dark:text-slate-500 bg-slate-50 dark:bg-slate-700 dark:bg-opacity-50 rounded-sm cursor-pointer"},[W("tr",null,[W("th",{class:"p-2 text-left pl-5"}," Name "),W("th",{class:"p-2 text-right"}," Balance "),W("th",{class:"p-2 text-right"}," EUR Price "),W("th",{class:"p-2 text-right"}," USD Price "),W("th",{class:"p-2 text-right"}," 24h "),W("th",{class:"p-2 text-right"}," Total EUR "),W("th",{class:"p-2 text-right"}," Total USD "),W("th",{class:"p-2 text-right"}," Total ETH "),W("th",{class:"p-2 text-right"}," 7 D APY "),W("th",{class:"p-2 text-right"}," 7 D gain "),W("th",{class:"p-2 text-right"}," 30 D APY "),W("th",{class:"p-2 text-right"}," 30 D gain "),W("th",{class:"p-2 text-center"}," Last 30 D balance "),W("th",{class:"p-2 text-center"}," Last 30 D price ")])],-1),U1={class:"text-sm font-medium divide-y divide-slate-100 dark:divide-slate-700"},V1={class:"p-2 text-slate-800 dark:text-slate-100 pl-3 w-1/3"},K1={class:"p-2 text-right text-yellow-300"},q1={class:"p-2 text-right text-red-300"},Y1={class:"p-2 text-right text-red-300"},G1={class:"p-2 text-right text-white"},X1={class:"p-2 text-right text-emerald-300"},J1={class:"p-2 text-right text-emerald-300"},Q1={class:"p-2 text-right text-sky-300"},Z1={class:"p-2 text-right text-emerald-300"},tO={class:"p-2 text-right text-emerald-300"},eO={class:"p-2 text-right text-emerald-300"},nO={class:"p-2 text-right text-emerald-300"},iO={class:"p-2 w-2/12"},rO={class:"p-2 w-2/12"},sO={class:"col-span-full xl:col-span-12 bg-white dark:bg-slate-800 shadow-lg rounded-sm border border-slate-200 dark:border-slate-700 mt-4"},oO={class:"p-4 border-b border-slate-100 dark:border-slate-700"},aO={class:"font-semibold text-slate-800 dark:text-slate-100"},lO={class:"font-normal"},cO={class:"table-autodark:text-slate-300 mx-auto w-full sortable"},uO=W("thead",{class:"text-xs uppercase text-slate-400 dark:text-slate-500 bg-slate-50 dark:bg-slate-700 dark:bg-opacity-50 rounded-sm cursor-pointer"},[W("tr",null,[W("th",{class:"p-2 text-left pl-5"}," Title "),W("th",{class:"p-2 text-left pl-5"}," Type "),W("th",{class:"p-2 text-left pl-5"}," Status "),W("th",{class:"p-2 text-left pl-5"}," Primary Amount "),W("th",{class:"p-2 text-left pl-5"}," Secondary Amount "),W("th",{class:"p-2 text-left pl-5"}," Created On ")])],-1),fO={class:"text-sm font-medium divide-y divide-slate-100 dark:divide-slate-700"},hO=["innerHTML"],dO={class:"p-2 text-slate-800 dark:text-slate-100"},pO={class:"p-2 text-slate-800 dark:text-slate-100"},gO=["innerHTML"],mO={class:"p-2 text-slate-800 dark:text-slate-100"},yO={class:"p-2 text-slate-800 dark:text-slate-100"};function bO(e,t,n,i,r,s){const o=oa("balances-chart"),a=oa("token-chart");return Ee(),Xe(ye,null,[W("div",I1,[W("div",D1,[Rt(o,{label:"ETH Price",dates:n.balances.dates,data:n.balances.prices,total:"$"+s.currencyFormat(e.totals.pricesUsd),subtotal:`(${s.currencyFormat(e.totals.pricesEur)} €)`},null,8,["dates","data","total","subtotal"])]),W("div",L1,[Rt(o,{color:"blue",label:"ETH",dates:n.balances.dates,data:n.balances.ethereum,total:e.totals.eth.toFixed(3)},null,8,["dates","data","total"])]),W("div",$1,[Rt(o,{label:"Total",dates:n.balances.dates,data:n.balances.totals,total:"$"+s.currencyFormat(e.totals.usd.toFixed(2)),subtotal:`(${s.currencyFormat(e.totals.eur.toFixed(2))} €)`},null,8,["dates","data","total","subtotal"])])]),W("div",N1,[W("header",B1,[j1,W("button",{class:Le(["bg-gray-500 hover:bg-gray-700 font-bold py-2 px-4 rounded inline-flex items-center h-6",{"bg-gray-700":r.loading}]),disabled:r.loading,onClick:t[0]||(t[0]=(...l)=>s.refreshTokens&&s.refreshTokens(...l))},[W("i",{class:Le(["fa fa-refresh",{"animate-spin":r.loading}]),style:{"font-size":"15px"}},null,2)],10,H1)]),W("table",z1,[W1,W("tbody",U1,[(Ee(!0),Xe(ye,null,ih(n.tokens[0],(l,c)=>(Ee(),Xe("tr",null,[W("td",V1,kt(l.pool),1),W("td",K1,kt(s.currencyFormat(l.balance.toFixed(2))),1),W("td",q1,kt(s.currencyFormat(l.price_eur.toFixed(2))),1),W("td",Y1," $"+kt(s.currencyFormat(l.price.toFixed(2))),1),W("td",G1,[W("span",{class:Le({"text-red-500":s.getDailyChange(c,l.price)<0,"text-green-500":s.getDailyChange(c,l.price)>0})},kt(s.currencyFormat(s.getDailyChange(c,l.price)))+"%",3)]),W("td",X1,kt(s.currencyFormat((l.price_eur*l.balance).toFixed(2))),1),W("td",J1," $"+kt(s.currencyFormat((l.price*l.balance).toFixed(2))),1),W("td",Q1,kt(s.currencyFormat(l.price*l.balance/e.totals.pricesUsd)),1),W("td",Z1,[s.getWeeklyApy(c)!=0?(Ee(),Xe("span",{key:0,class:Le({"text-red-500":s.getWeeklyApy(c)<0,"text-green-500":s.getWeeklyApy(c)>0})},kt(s.currencyFormat(s.getWeeklyApy(c)))+"%",3)):yo("",!0)]),W("td",tO,[s.getWeeklyGain(c)!=0?(Ee(),Xe("span",{key:0,class:Le({"text-red-500":s.getWeeklyGain(c)<0,"text-green-500":s.getWeeklyGain(c)>0})},"$"+kt(s.currencyFormat(s.getWeeklyGain(c))),3)):yo("",!0)]),W("td",eO,[s.getMonthlyApy(c)!=0?(Ee(),Xe("span",{key:0,class:Le({"text-red-500":s.getMonthlyApy(c)<0,"text-green-500":s.getMonthlyApy(c)>0})},kt(s.currencyFormat(s.getMonthlyApy(c)))+"%",3)):yo("",!0)]),W("td",nO,[s.getMonthlyGain(c)!=0?(Ee(),Xe("span",{key:0,class:Le({"text-red-500":s.getMonthlyGain(c)<0,"text-green-500":s.getMonthlyGain(c)>0})},"$"+kt(s.currencyFormat(s.getMonthlyGain(c))),3)):yo("",!0)]),W("td",iO,[Rt(a,{labels:Object.keys(n.tokens),data:s.getBalanceHistory(l.pool)},null,8,["labels","data"])]),W("td",rO,[Rt(a,{labels:Object.keys(n.tokens),data:s.getPriceHistory(l.pool)},null,8,["labels","data"])])]))),256))])])]),W("div",sO,[W("header",oO,[W("h2",aO,[zu("Wise balance: "),W("p",lO,kt(n.balance)+" EUR",1)])]),W("table",cO,[uO,W("tbody",fO,[(Ee(!0),Xe(ye,null,ih(n.transactions,l=>(Ee(),Xe("tr",null,[W("td",{class:"p-2 w-1/4 text-slate-800 dark:text-slate-100 pl-3",innerHTML:l.title},null,8,hO),W("td",dO,kt(l.type),1),W("td",pO,kt(l.status),1),W("td",{class:"p-2 text-slate-800 dark:text-slate-100",innerHTML:l.primaryAmount},null,8,gO),W("td",mO,kt(l.secondaryAmount),1),W("td",yO,kt(l.createdOn),1)]))),256))])])])],64)}const _O=cf(F1,[["render",bO]]),xO=Object.freeze(Object.defineProperty({__proto__:null,default:_O},Symbol.toStringTag,{value:"Module"}));function Rm(e,t){return function(){return e.apply(t,arguments)}}const{toString:vO}=Object.prototype,{getPrototypeOf:uf}=Object,Xa=(e=>t=>{const n=vO.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),un=e=>(e=e.toLowerCase(),t=>Xa(t)===e),Ja=e=>t=>typeof t===e,{isArray:Or}=Array,Ls=Ja("undefined");function wO(e){return e!==null&&!Ls(e)&&e.constructor!==null&&!Ls(e.constructor)&&Me(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Fm=un("ArrayBuffer");function SO(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Fm(e.buffer),t}const OO=Ja("string"),Me=Ja("function"),Im=Ja("number"),Qa=e=>e!==null&&typeof e=="object",AO=e=>e===!0||e===!1,Go=e=>{if(Xa(e)!=="object")return!1;const t=uf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},EO=un("Date"),PO=un("File"),CO=un("Blob"),TO=un("FileList"),MO=e=>Qa(e)&&Me(e.pipe),kO=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Me(e.append)&&((t=Xa(e))==="formdata"||t==="object"&&Me(e.toString)&&e.toString()==="[object FormData]"))},RO=un("URLSearchParams"),FO=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zs(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let i,r;if(typeof e!="object"&&(e=[e]),Or(e))for(i=0,r=e.length;i0;)if(r=n[i],t===r.toLowerCase())return r;return null}const Lm=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),$m=e=>!Ls(e)&&e!==Lm;function Kc(){const{caseless:e}=$m(this)&&this||{},t={},n=(i,r)=>{const s=e&&Dm(t,r)||r;Go(t[s])&&Go(i)?t[s]=Kc(t[s],i):Go(i)?t[s]=Kc({},i):Or(i)?t[s]=i.slice():t[s]=i};for(let i=0,r=arguments.length;i(zs(t,(r,s)=>{n&&Me(r)?e[s]=Rm(r,n):e[s]=r},{allOwnKeys:i}),e),DO=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),LO=(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},$O=(e,t,n,i)=>{let r,s,o;const a={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),s=r.length;s-- >0;)o=r[s],(!i||i(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&uf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},NO=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return i!==-1&&i===n},BO=e=>{if(!e)return null;if(Or(e))return e;let t=e.length;if(!Im(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},jO=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&uf(Uint8Array)),HO=(e,t)=>{const i=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=i.next())&&!r.done;){const s=r.value;t.call(e,s[0],s[1])}},zO=(e,t)=>{let n;const i=[];for(;(n=e.exec(t))!==null;)i.push(n);return i},WO=un("HTMLFormElement"),UO=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,r){return i.toUpperCase()+r}),Nd=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),VO=un("RegExp"),Nm=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};zs(n,(r,s)=>{let o;(o=t(r,s,e))!==!1&&(i[s]=o||r)}),Object.defineProperties(e,i)},KO=e=>{Nm(e,(t,n)=>{if(Me(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=e[n];if(Me(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},qO=(e,t)=>{const n={},i=r=>{r.forEach(s=>{n[s]=!0})};return Or(e)?i(e):i(String(e).split(t)),n},YO=()=>{},GO=(e,t)=>(e=+e,Number.isFinite(e)?e:t),ac="abcdefghijklmnopqrstuvwxyz",Bd="0123456789",Bm={DIGIT:Bd,ALPHA:ac,ALPHA_DIGIT:ac+ac.toUpperCase()+Bd},XO=(e=16,t=Bm.ALPHA_DIGIT)=>{let n="";const{length:i}=t;for(;e--;)n+=t[Math.random()*i|0];return n};function JO(e){return!!(e&&Me(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const QO=e=>{const t=new Array(10),n=(i,r)=>{if(Qa(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[r]=i;const s=Or(i)?[]:{};return zs(i,(o,a)=>{const l=n(o,r+1);!Ls(l)&&(s[a]=l)}),t[r]=void 0,s}}return i};return n(e,0)},ZO=un("AsyncFunction"),tA=e=>e&&(Qa(e)||Me(e))&&Me(e.then)&&Me(e.catch),R={isArray:Or,isArrayBuffer:Fm,isBuffer:wO,isFormData:kO,isArrayBufferView:SO,isString:OO,isNumber:Im,isBoolean:AO,isObject:Qa,isPlainObject:Go,isUndefined:Ls,isDate:EO,isFile:PO,isBlob:CO,isRegExp:VO,isFunction:Me,isStream:MO,isURLSearchParams:RO,isTypedArray:jO,isFileList:TO,forEach:zs,merge:Kc,extend:IO,trim:FO,stripBOM:DO,inherits:LO,toFlatObject:$O,kindOf:Xa,kindOfTest:un,endsWith:NO,toArray:BO,forEachEntry:HO,matchAll:zO,isHTMLForm:WO,hasOwnProperty:Nd,hasOwnProp:Nd,reduceDescriptors:Nm,freezeMethods:KO,toObjectSet:qO,toCamelCase:UO,noop:YO,toFiniteNumber:GO,findKey:Dm,global:Lm,isContextDefined:$m,ALPHABET:Bm,generateString:XO,isSpecCompliantForm:JO,toJSONObject:QO,isAsyncFn:ZO,isThenable:tA};function dt(e,t,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r)}R.inherits(dt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:R.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const jm=dt.prototype,Hm={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Hm[e]={value:e}});Object.defineProperties(dt,Hm);Object.defineProperty(jm,"isAxiosError",{value:!0});dt.from=(e,t,n,i,r,s)=>{const o=Object.create(jm);return R.toFlatObject(e,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),dt.call(o,e.message,t,n,i,r),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};const eA=null;function qc(e){return R.isPlainObject(e)||R.isArray(e)}function zm(e){return R.endsWith(e,"[]")?e.slice(0,-2):e}function jd(e,t,n){return e?e.concat(t).map(function(r,s){return r=zm(r),!n&&s?"["+r+"]":r}).join(n?".":""):t}function nA(e){return R.isArray(e)&&!e.some(qc)}const iA=R.toFlatObject(R,{},null,function(t){return/^is[A-Z]/.test(t)});function Za(e,t,n){if(!R.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=R.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!R.isUndefined(b[y])});const i=n.metaTokens,r=n.visitor||u,s=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&R.isSpecCompliantForm(t);if(!R.isFunction(r))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(R.isDate(p))return p.toISOString();if(!l&&R.isBlob(p))throw new dt("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(p)||R.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,y,b){let x=p;if(p&&!b&&typeof p=="object"){if(R.endsWith(y,"{}"))y=i?y:y.slice(0,-2),p=JSON.stringify(p);else if(R.isArray(p)&&nA(p)||(R.isFileList(p)||R.endsWith(y,"[]"))&&(x=R.toArray(p)))return y=zm(y),x.forEach(function(w,S){!(R.isUndefined(w)||w===null)&&t.append(o===!0?jd([y],S,s):o===null?y:y+"[]",c(w))}),!1}return qc(p)?!0:(t.append(jd(b,y,s),c(p)),!1)}const h=[],d=Object.assign(iA,{defaultVisitor:u,convertValue:c,isVisitable:qc});function g(p,y){if(!R.isUndefined(p)){if(h.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(p),R.forEach(p,function(x,A){(!(R.isUndefined(x)||x===null)&&r.call(t,x,R.isString(A)?A.trim():A,y,d))===!0&&g(x,y?y.concat(A):[A])}),h.pop()}}if(!R.isObject(e))throw new TypeError("data must be an object");return g(e),t}function Hd(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function ff(e,t){this._pairs=[],e&&Za(e,this,t)}const Wm=ff.prototype;Wm.append=function(t,n){this._pairs.push([t,n])};Wm.toString=function(t){const n=t?function(i){return t.call(this,i,Hd)}:Hd;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function rA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Um(e,t,n){if(!t)return e;const i=n&&n.encode||rA,r=n&&n.serialize;let s;if(r?s=r(t,n):s=R.isURLSearchParams(t)?t.toString():new ff(t,n).toString(i),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class sA{constructor(){this.handlers=[]}use(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){R.forEach(this.handlers,function(i){i!==null&&t(i)})}}const zd=sA,Vm={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oA=typeof URLSearchParams<"u"?URLSearchParams:ff,aA=typeof FormData<"u"?FormData:null,lA=typeof Blob<"u"?Blob:null,cA=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),uA=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),on={isBrowser:!0,classes:{URLSearchParams:oA,FormData:aA,Blob:lA},isStandardBrowserEnv:cA,isStandardBrowserWebWorkerEnv:uA,protocols:["http","https","file","blob","url","data"]};function fA(e,t){return Za(e,new on.classes.URLSearchParams,Object.assign({visitor:function(n,i,r,s){return on.isNode&&R.isBuffer(n)?(this.append(i,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function hA(e){return R.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dA(e){const t={},n=Object.keys(e);let i;const r=n.length;let s;for(i=0;i=n.length;return o=!o&&R.isArray(r)?r.length:o,l?(R.hasOwnProp(r,o)?r[o]=[r[o],i]:r[o]=i,!a):((!r[o]||!R.isObject(r[o]))&&(r[o]=[]),t(n,i,r[o],s)&&R.isArray(r[o])&&(r[o]=dA(r[o])),!a)}if(R.isFormData(e)&&R.isFunction(e.entries)){const n={};return R.forEachEntry(e,(i,r)=>{t(hA(i),r,n,0)}),n}return null}function pA(e,t,n){if(R.isString(e))try{return(t||JSON.parse)(e),R.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}const hf={transitional:Vm,adapter:["xhr","http"],transformRequest:[function(t,n){const i=n.getContentType()||"",r=i.indexOf("application/json")>-1,s=R.isObject(t);if(s&&R.isHTMLForm(t)&&(t=new FormData(t)),R.isFormData(t))return r&&r?JSON.stringify(Km(t)):t;if(R.isArrayBuffer(t)||R.isBuffer(t)||R.isStream(t)||R.isFile(t)||R.isBlob(t))return t;if(R.isArrayBufferView(t))return t.buffer;if(R.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return fA(t,this.formSerializer).toString();if((a=R.isFileList(t))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Za(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return s||r?(n.setContentType("application/json",!1),pA(t)):t}],transformResponse:[function(t){const n=this.transitional||hf.transitional,i=n&&n.forcedJSONParsing,r=this.responseType==="json";if(t&&R.isString(t)&&(i&&!this.responseType||r)){const o=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(a){if(o)throw a.name==="SyntaxError"?dt.from(a,dt.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:on.classes.FormData,Blob:on.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};R.forEach(["delete","get","head","post","put","patch"],e=>{hf.headers[e]={}});const df=hf,gA=R.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),mA=e=>{const t={};let n,i,r;return e&&e.split(` +`):e}function LS(e,t){const{element:n,datasetIndex:i,index:r}=t,s=e.getDatasetMeta(i).controller,{label:o,value:a}=s.getLabelAndValue(r);return{chart:e,label:o,parsed:s.getParsed(r),raw:e.data.datasets[i].data[r],formattedValue:a,dataset:s.getDataset(),dataIndex:r,datasetIndex:i,element:n}}function vd(e,t){const n=e.chart.ctx,{body:i,footer:r,title:s}=e,{boxWidth:o,boxHeight:a}=t,l=Ht(t.bodyFont),c=Ht(t.titleFont),u=Ht(t.footerFont),h=s.length,d=r.length,g=i.length,p=se(t.padding);let y=p.height,b=0,x=i.reduce((S,E)=>S+E.before.length+E.lines.length+E.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,h&&(y+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),x){const S=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;y+=g*S+(x-g)*l.lineHeight+(x-1)*t.bodySpacing}d&&(y+=t.footerMarginTop+d*u.lineHeight+(d-1)*t.footerSpacing);let A=0;const w=function(S){b=Math.max(b,n.measureText(S).width+A)};return n.save(),n.font=c.string,xt(e.title,w),n.font=l.string,xt(e.beforeBody.concat(e.afterBody),w),A=t.displayColors?o+2+t.boxPadding:0,xt(i,S=>{xt(S.before,w),xt(S.lines,w),xt(S.after,w)}),A=0,n.font=u.string,xt(e.footer,w),n.restore(),b+=p.width,{width:b,height:y}}function $S(e,t){const{y:n,height:i}=t;return ne.height-i/2?"bottom":"center"}function NS(e,t,n,i){const{x:r,width:s}=i,o=n.caretSize+n.caretPadding;if(e==="left"&&r+s+o>t.width||e==="right"&&r-s-o<0)return!0}function BS(e,t,n,i){const{x:r,width:s}=n,{width:o,chartArea:{left:a,right:l}}=e;let c="center";return i==="center"?c=r<=(a+l)/2?"left":"right":r<=s/2?c="left":r>=o-s/2&&(c="right"),NS(c,e,t,n)&&(c="center"),c}function wd(e,t,n){const i=n.yAlign||t.yAlign||$S(e,n);return{xAlign:n.xAlign||t.xAlign||BS(e,t,n,i),yAlign:i}}function jS(e,t){let{x:n,width:i}=e;return t==="right"?n-=i:t==="center"&&(n-=i/2),n}function HS(e,t,n){let{y:i,height:r}=e;return t==="top"?i+=n:t==="bottom"?i-=r+n:i-=r/2,i}function Sd(e,t,n,i){const{caretSize:r,caretPadding:s,cornerRadius:o}=e,{xAlign:a,yAlign:l}=n,c=r+s,{topLeft:u,topRight:h,bottomLeft:d,bottomRight:g}=sr(o);let p=jS(t,a);const y=HS(t,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,d)+r:a==="right"&&(p+=Math.max(h,g)+r),{x:Pe(p,0,i.width-t.width),y:Pe(y,0,i.height-t.height)}}function Mo(e,t,n){const i=se(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-i.right:e.x+i.left}function Od(e){return Je([],xn(e))}function zS(e,t,n){return ni(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function Ad(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const Am={beforeTitle:bn,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex"u"?Am[t].call(n,i):r}class Uc extends $i{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,i=this.options.setContext(this.getContext()),r=i.enabled&&n.options.animation&&i.animations,s=new lm(this.chart,r);return r._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=zS(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:i}=n,r=ge(i,"beforeTitle",this,t),s=ge(i,"title",this,t),o=ge(i,"afterTitle",this,t);let a=[];return a=Je(a,xn(r)),a=Je(a,xn(s)),a=Je(a,xn(o)),a}getBeforeBody(t,n){return Od(ge(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:i}=n,r=[];return xt(t,s=>{const o={before:[],lines:[],after:[]},a=Ad(i,s);Je(o.before,xn(ge(a,"beforeLabel",this,s))),Je(o.lines,ge(a,"label",this,s)),Je(o.after,xn(ge(a,"afterLabel",this,s))),r.push(o)}),r}getAfterBody(t,n){return Od(ge(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:i}=n,r=ge(i,"beforeFooter",this,t),s=ge(i,"footer",this,t),o=ge(i,"afterFooter",this,t);let a=[];return a=Je(a,xn(r)),a=Je(a,xn(s)),a=Je(a,xn(o)),a}_createItems(t){const n=this._active,i=this.chart.data,r=[],s=[],o=[];let a=[],l,c;for(l=0,c=n.length;lt.filter(u,h,d,i))),t.itemSort&&(a=a.sort((u,h)=>t.itemSort(u,h,i))),xt(a,u=>{const h=Ad(t.callbacks,u);r.push(ge(h,"labelColor",this,u)),s.push(ge(h,"labelPointStyle",this,u)),o.push(ge(h,"labelTextColor",this,u))}),this.labelColors=r,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=a,a}update(t,n){const i=this.options.setContext(this.getContext()),r=this._active;let s,o=[];if(!r.length)this.opacity!==0&&(s={opacity:0});else{const a=rs[i.position].call(this,r,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const l=this._size=vd(this,i),c=Object.assign({},a,l),u=wd(this.chart,i,c),h=Sd(i,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,s={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,s&&this._resolveAnimations().update(this,s),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,i,r){const s=this.getCaretPosition(t,i,r);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(t,n,i){const{xAlign:r,yAlign:s}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:h}=sr(a),{x:d,y:g}=t,{width:p,height:y}=n;let b,x,A,w,S,E;return s==="center"?(S=g+y/2,r==="left"?(b=d,x=b-o,w=S+o,E=S-o):(b=d+p,x=b+o,w=S-o,E=S+o),A=b):(r==="left"?x=d+Math.max(l,u)+o:r==="right"?x=d+p-Math.max(c,h)-o:x=this.caretX,s==="top"?(w=g,S=w-o,b=x-o,A=x+o):(w=g+y,S=w+o,b=x+o,A=x-o),E=w),{x1:b,x2:x,x3:A,y1:w,y2:S,y3:E}}drawTitle(t,n,i){const r=this.title,s=r.length;let o,a,l;if(s){const c=or(i.rtl,this.x,this.width);for(t.x=Mo(this,i.titleAlign,i),n.textAlign=c.textAlign(i.titleAlign),n.textBaseline="middle",o=Ht(i.titleFont),a=i.titleSpacing,n.fillStyle=i.titleColor,n.font=o.string,l=0;lA!==0)?(t.beginPath(),t.fillStyle=s.multiKeyBackground,ya(t,{x:y,y:p,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),ya(t,{x:b,y:p+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=s.multiKeyBackground,t.fillRect(y,p,c,l),t.strokeRect(y,p,c,l),t.fillStyle=o.backgroundColor,t.fillRect(b,p+1,c-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,n,i){const{body:r}=this,{bodySpacing:s,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=i,h=Ht(i.bodyFont);let d=h.lineHeight,g=0;const p=or(i.rtl,this.x,this.width),y=function(k){n.fillText(k,p.x(t.x+g),t.y+d/2),t.y+=d+s},b=p.textAlign(o);let x,A,w,S,E,P,C;for(n.textAlign=o,n.textBaseline="middle",n.font=h.string,t.x=Mo(this,b,i),n.fillStyle=i.bodyColor,xt(this.beforeBody,y),g=a&&b!=="right"?o==="center"?c/2+u:c+2+u:0,S=0,P=r.length;S0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,i=this.$animations,r=i&&i.x,s=i&&i.y;if(r||s){const o=rs[t.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=vd(this,t),l=Object.assign({},o,this._size),c=wd(n,t,l),u=Sd(t,l,c,n);(r._to!==u.x||s._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(n);const r={width:this.width,height:this.height},s={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=se(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(s,t,r,n),sm(t,n.textDirection),s.y+=o.top,this.drawTitle(s,t,n),this.drawBody(s,t,n),this.drawFooter(s,t,n),om(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const i=this._active,r=t.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),s=!fa(i,r),o=this._positionChanged(r,n);(s||o)&&(this._active=r,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,i=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const r=this.options,s=this._active||[],o=this._getActiveElements(t,s,n,i),a=this._positionChanged(o,t),l=n||!fa(o,s)||a;return l&&(this._active=o,(r.enabled||r.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,i,r){const s=this.options;if(t.type==="mouseout")return[];if(!r)return n;const o=this.chart.getElementsAtEventForMode(t,s.mode,s,i);return s.reverse&&o.reverse(),o}_positionChanged(t,n){const{caretX:i,caretY:r,options:s}=this,o=rs[s.position].call(this,t,n);return o!==!1&&(i!==o.x||r!==o.y)}}et(Uc,"positioners",rs);var Em={id:"tooltip",_element:Uc,positioners:rs,afterInit(e,t,n){n&&(e.tooltip=new Uc({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Am},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const WS=(e,t,n,i)=>(typeof t=="string"?(n=e.push(t)-1,i.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function US(e,t,n,i){const r=e.indexOf(t);if(r===-1)return WS(e,t,n,i);const s=e.lastIndexOf(t);return r!==s?n:r}const VS=(e,t)=>e===null?null:Pe(Math.round(e),0,t);function Ed(e){const t=this.getLabels();return e>=0&&en.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}et(xa,"id","category"),et(xa,"defaults",{ticks:{callback:Ed}});function KS(e,t){const n=[],{bounds:r,step:s,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:h,includeBounds:d}=e,g=s||1,p=u-1,{min:y,max:b}=t,x=!St(o),A=!St(a),w=!St(c),S=(b-y)/(h+1);let E=kh((b-y)/p/g)*g,P,C,k,B;if(E<1e-14&&!x&&!A)return[{value:y},{value:b}];B=Math.ceil(b/E)-Math.floor(y/E),B>p&&(E=kh(B*E/p/g)*g),St(l)||(P=Math.pow(10,l),E=Math.ceil(E*P)/P),r==="ticks"?(C=Math.floor(y/E)*E,k=Math.ceil(b/E)*E):(C=y,k=b),x&&A&&s&&$0((a-o)/s,E/1e3)?(B=Math.round(Math.min((a-o)/E,u)),E=(a-o)/B,C=o,k=a):w?(C=x?o:C,k=A?a:k,B=c-1,E=(k-C)/B):(B=(k-C)/E,ps(B,Math.round(B),E/1e3)?B=Math.round(B):B=Math.ceil(B));const L=Math.max(Rh(E),Rh(C));P=Math.pow(10,St(l)?L:l),C=Math.round(C*P)/P,k=Math.round(k*P)/P;let V=0;for(x&&(d&&C!==o?(n.push({value:o}),Ca)break;n.push({value:U})}return A&&d&&k!==a?n.length&&ps(n[n.length-1].value,a,Pd(a,S,e))?n[n.length-1].value=a:n.push({value:a}):(!A||k===a)&&n.push({value:k}),n}function Pd(e,t,{horizontal:n,minRotation:i}){const r=Vn(i),s=(n?Math.sin(r):Math.cos(r))||.001,o=.75*t*(""+e).length;return Math.min(t/s,o)}class va extends Ni{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return St(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:i}=this.getUserBounds();let{min:r,max:s}=this;const o=l=>r=n?r:l,a=l=>s=i?s:l;if(t){const l=hr(r),c=hr(s);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(r===s){let l=s===0?1:Math.abs(s*.05);a(s+l),t||o(r-l)}this.min=r,this.max=s}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:i}=t,r;return i?(r=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,r>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${r} ticks. Limiting to 1000.`),r=1e3)):(r=this.computeTickLimit(),n=n||11),n&&(r=Math.min(n,r)),r}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const r={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,o=KS(r,s);return t.bounds==="ticks"&&Vg(o,this,"value"),t.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const t=this.ticks;let n=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const r=(i-n)/Math.max(t.length-1,1)/2;n-=r,i+=r}this._startValue=n,this._endValue=i,this._valueRange=i-n}getLabelForValue(t){return tf(t,this.chart.options.locale,this.options.ticks.format)}}class wa extends va{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Kt(t)?t:0,this.max=Kt(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,i=Vn(this.options.ticks.minRotation),r=(t?Math.sin(i):Math.cos(i))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/r))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}et(wa,"id","linear"),et(wa,"defaults",{ticks:{callback:qa.formatters.numeric}});const Ds=e=>Math.floor(Un(e)),gi=(e,t)=>Math.pow(10,Ds(e)+t);function Cd(e){return e/Math.pow(10,Ds(e))===1}function Td(e,t,n){const i=Math.pow(10,n),r=Math.floor(e/i);return Math.ceil(t/i)-r}function qS(e,t){const n=t-e;let i=Ds(n);for(;Td(e,t,i)>10;)i++;for(;Td(e,t,i)<10;)i--;return Math.min(i,Ds(e))}function YS(e,{min:t,max:n}){t=ve(e.min,t);const i=[],r=Ds(t);let s=qS(t,n),o=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=r>s?Math.pow(10,r):0,c=Math.round((t-l)*o)/o,u=Math.floor((t-l)/a/10)*a*10;let h=Math.floor((c-u)/Math.pow(10,s)),d=ve(e.min,Math.round((l+u+h*Math.pow(10,s))*o)/o);for(;d=10?h=h<15?15:20:h++,h>=20&&(s++,h=2,o=s>=0?1:o),d=Math.round((l+u+h*Math.pow(10,s))*o)/o;const g=ve(e.max,d);return i.push({value:g,major:Cd(g),significand:h}),i}class Md extends Ni{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const i=va.prototype.parse.apply(this,[t,n]);if(i===0){this._zero=!0;return}return Kt(i)&&i>0?i:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Kt(t)?Math.max(0,t):null,this.max=Kt(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Kt(this._userMin)&&(this.min=t===gi(this.min,0)?gi(this.min,-1):gi(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let i=this.min,r=this.max;const s=a=>i=t?i:a,o=a=>r=n?r:a;i===r&&(i<=0?(s(1),o(10)):(s(gi(i,-1)),o(gi(r,1)))),i<=0&&s(gi(r,-1)),r<=0&&o(gi(i,1)),this.min=i,this.max=r}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},i=YS(n,this);return t.bounds==="ticks"&&Vg(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":tf(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Un(t),this._valueRange=Un(this.max)-Un(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Un(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}et(Md,"id","logarithmic"),et(Md,"defaults",{ticks:{callback:qa.formatters.logarithmic,major:{enabled:!0}}});function Vc(e){const t=e.ticks;if(t.display&&e.display){const n=se(t.backdropPadding);return ft(t.font&&t.font.size,Tt.font.size)+n.height}return 0}function GS(e,t,n){return n=Ct(n)?n:[n],{w:rv(e,t.string,n),h:n.length*t.lineHeight}}function kd(e,t,n,i,r){return e===i||e===r?{start:t-n/2,end:t+n/2}:er?{start:t-n,end:t}:{start:t,end:t+n}}function XS(e){const t={l:e.left+e._padding.left,r:e.right-e._padding.right,t:e.top+e._padding.top,b:e.bottom-e._padding.bottom},n=Object.assign({},t),i=[],r=[],s=e._pointLabels.length,o=e.options.pointLabels,a=o.centerPointLabels?$t/s:0;for(let l=0;lt.r&&(a=(i.end-t.r)/s,e.r=Math.max(e.r,t.r+a)),r.startt.b&&(l=(r.end-t.b)/o,e.b=Math.max(e.b,t.b+l))}function QS(e,t,n){const i=e.drawingArea,{extra:r,additionalAngle:s,padding:o,size:a}=n,l=e.getPointPosition(t,i+r+o,s),c=Math.round(Xu($e(l.angle+we))),u=i1(l.y,a.h,c),h=e1(c),d=n1(l.x,a.w,h);return{visible:!0,x:l.x,y:u,textAlign:h,left:d,top:u,right:d+a.w,bottom:u+a.h}}function ZS(e,t){if(!t)return!0;const{left:n,top:i,right:r,bottom:s}=e;return!(On({x:n,y:i},t)||On({x:n,y:s},t)||On({x:r,y:i},t)||On({x:r,y:s},t))}function t1(e,t,n){const i=[],r=e._pointLabels.length,s=e.options,{centerPointLabels:o,display:a}=s.pointLabels,l={extra:Vc(s)/2,additionalAngle:o?$t/r:0};let c;for(let u=0;u270||n<90)&&(e-=t),e}function r1(e,t,n){const{left:i,top:r,right:s,bottom:o}=n,{backdropColor:a}=t;if(!St(a)){const l=sr(t.borderRadius),c=se(t.backdropPadding);e.fillStyle=a;const u=i-c.left,h=r-c.top,d=s-i+c.width,g=o-r+c.height;Object.values(l).some(p=>p!==0)?(e.beginPath(),ya(e,{x:u,y:h,w:d,h:g,radius:l}),e.fill()):e.fillRect(u,h,d,g)}}function s1(e,t){const{ctx:n,options:{pointLabels:i}}=e;for(let r=t-1;r>=0;r--){const s=e._pointLabelItems[r];if(!s.visible)continue;const o=i.setContext(e.getPointLabelContext(r));r1(n,o,s);const a=Ht(o.font),{x:l,y:c,textAlign:u}=s;Li(n,e._pointLabels[r],l,c+a.lineHeight/2,a,{color:o.color,textAlign:u,textBaseline:"middle"})}}function Pm(e,t,n,i){const{ctx:r}=e;if(n)r.arc(e.xCenter,e.yCenter,t,0,Te);else{let s=e.getPointPosition(0,t);r.moveTo(s.x,s.y);for(let o=1;o{const r=wt(this.options.pointLabels.callback,[n,i],this);return r||r===0?r:""}).filter((n,i)=>this.chart.getDataVisibility(i))}fit(){const t=this.options;t.display&&t.pointLabels.display?XS(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,i,r){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((i-r)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,i,r))}getIndexAngle(t){const n=Te/(this._pointLabels.length||1),i=this.options.startAngle||0;return $e(t*n+Vn(i))}getDistanceFromCenterForValue(t){if(St(t))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*n:(t-this.min)*n}getValueForDistanceFromCenter(t){if(St(t))return NaN;const n=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(t){const n=this._pointLabels||[];if(t>=0&&t{if(h!==0){l=this.getDistanceFromCenterForValue(u.value);const d=this.getContext(h),g=r.setContext(d),p=s.setContext(d);o1(this,g,l,o,p)}}),i.display){for(t.save(),a=o-1;a>=0;a--){const u=i.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:d}=u;!d||!h||(t.lineWidth=d,t.strokeStyle=h,t.setLineDash(u.borderDash),t.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.ticks.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,i=n.ticks;if(!i.display)return;const r=this.getIndexAngle(0);let s,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(r),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&!n.reverse)return;const c=i.setContext(this.getContext(l)),u=Ht(c.font);if(s=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=u.string,o=t.measureText(a.label).width,t.fillStyle=c.backdropColor;const h=se(c.backdropPadding);t.fillRect(-o/2-h.left,-s-u.size/2-h.top,o+h.width,u.size+h.height)}Li(t,a.label,0,-s,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}}et(ko,"id","radialLinear"),et(ko,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:qa.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),et(ko,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),et(ko,"descriptors",{angleLines:{_fallback:"grid"}});const Ga={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}},be=Object.keys(Ga);function Rd(e,t){return e-t}function Fd(e,t){if(St(t))return null;const n=e._adapter,{parser:i,round:r,isoWeekday:s}=e._parseOpts;let o=t;return typeof i=="function"&&(o=i(o)),Kt(o)||(o=typeof i=="string"?n.parse(o,i):n.parse(o)),o===null?null:(r&&(o=r==="week"&&(Fs(s)||s===!0)?n.startOf(o,"isoWeek",s):n.startOf(o,r)),+o)}function Id(e,t,n,i){const r=be.length;for(let s=be.indexOf(e);s=be.indexOf(n);s--){const o=be[s];if(Ga[o].common&&e._adapter.diff(r,i,o)>=t-1)return o}return be[n?be.indexOf(n):0]}function c1(e){for(let t=be.indexOf(e)+1,n=be.length;t=t?n[i]:n[r];e[s]=!0}}function u1(e,t,n,i){const r=e._adapter,s=+r.startOf(t[0].value,i),o=t[t.length-1].value;let a,l;for(a=s;a<=o;a=+r.add(a,1,i))l=n[a],l>=0&&(t[l].major=!0);return t}function Ld(e,t,n){const i=[],r={},s=t.length;let o,a;for(o=0;o+t.value))}initOffsets(t=[]){let n=0,i=0,r,s;this.options.offset&&t.length&&(r=this.getDecimalForValue(t[0]),t.length===1?n=1-r:n=(this.getDecimalForValue(t[1])-r)/2,s=this.getDecimalForValue(t[t.length-1]),t.length===1?i=s:i=(s-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;n=Pe(n,0,o),i=Pe(i,0,o),this._offsets={start:n,end:i,factor:1/(n+1+i)}}_generate(){const t=this._adapter,n=this.min,i=this.max,r=this.options,s=r.time,o=s.unit||Id(s.minUnit,n,i,this._getLabelCapacity(n)),a=ft(r.ticks.stepSize,1),l=o==="week"?s.isoWeekday:!1,c=Fs(l)||l===!0,u={};let h=n,d,g;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":o),t.diff(i,n,o)>1e5*a)throw new Error(n+" and "+i+" are too far apart with stepSize of "+a+" "+o);const p=r.ticks.source==="data"&&this.getDataTimestamps();for(d=h,g=0;d+y)}getLabelForValue(t){const n=this._adapter,i=this.options.time;return i.tooltipFormat?n.format(t,i.tooltipFormat):n.format(t,i.displayFormats.datetime)}format(t,n){const r=this.options.time.displayFormats,s=this._unit,o=n||r[s];return this._adapter.format(t,o)}_tickFormatFunction(t,n,i,r){const s=this.options,o=s.ticks.callback;if(o)return wt(o,[t,n,i],this);const a=s.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],h=c&&a[c],d=i[n],g=c&&h&&d&&d.major;return this._adapter.format(t,r||(g?h:u))}generateTickLabels(t){let n,i,r;for(n=0,i=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,i;if(t.length)return t;const r=this.getMatchingVisibleMetas();if(this._normalized&&r.length)return this._cache.data=r[0].controller.getAllParsedValues(this);for(n=0,i=r.length;n=e[i].pos&&t<=e[r].pos&&({lo:i,hi:r}=wi(e,"pos",t)),{pos:s,time:a}=e[i],{pos:o,time:l}=e[r]):(t>=e[i].time&&t<=e[r].time&&({lo:i,hi:r}=wi(e,"time",t)),{time:s,pos:a}=e[i],{time:o,pos:l}=e[r]);const c=o-s;return c?a+(l-a)*(t-s)/c:a}class $d extends Sa{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=Ro(n,this.min),this._tableRange=Ro(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:i}=this,r=[],s=[];let o,a,l,c,u;for(o=0,a=t.length;o=n&&c<=i&&r.push(c);if(r.length<2)return[{time:n,pos:0},{time:i,pos:1}];for(o=0,a=r.length;or-s)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),i=this.getLabelTimestamps();return n.length&&i.length?t=this.normalize(n.concat(i)):t=n.length?n:i,t=this._cache.all=t,t}getDecimalForValue(t){return(Ro(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,i=this.getDecimalForPixel(t)/n.factor-n.end;return Ro(this._table,i*this._tableRange+this._minPos,!0)}}et($d,"id","timeseries"),et($d,"defaults",Sa.defaults);const Cm={data:{type:Object,required:!0},options:{type:Object,default:()=>({})},plugins:{type:Array,default:()=>[]},datasetIdKey:{type:String,default:"label"},updateMode:{type:String,default:void 0}},f1={type:{type:String,required:!0},...Cm},h1=Fg[0]==="2"?(e,t)=>Object.assign(e,{attrs:t}):(e,t)=>Object.assign(e,t);function Yi(e){return Ha(e)?pt(e):e}function d1(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e;return Ha(t)?new Proxy(e,{}):e}function p1(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function Tm(e,t){e.labels=t}function Mm(e,t,n){const i=[];e.datasets=t.map(r=>{const s=e.datasets.find(o=>o[n]===r[n]);return!s||!r.data||i.includes(s)?{...r}:(i.push(s),Object.assign(s,r),s)})}function g1(e,t){const n={labels:[],datasets:[]};return Tm(n,e.labels),Mm(n,e.datasets,t),n}const m1=Bu({props:f1,setup(e,t){let{expose:n}=t;const i=za(null),r=Lu(null);n({chart:r});const s=()=>{if(!i.value)return;const{type:l,data:c,options:u,plugins:h,datasetIdKey:d}=e,g=g1(c,d),p=d1(g,c);r.value=new Hs(i.value,{type:l,data:p,options:{...u},plugins:h})},o=()=>{const l=pt(r.value);l&&(l.destroy(),r.value=null)},a=l=>{l.update(e.updateMode)};return gg(s),mg(o),ls([()=>e.options,()=>e.data],(l,c)=>{let[u,h]=l,[d,g]=c;const p=pt(r.value);if(!p)return;let y=!1;if(u){const b=Yi(u),x=Yi(d);b&&b!==x&&(p1(p,b),y=!0)}if(h){const b=Yi(h.labels),x=Yi(g.labels),A=Yi(h.datasets),w=Yi(g.datasets);b!==x&&(Tm(p.config.data,b),y=!0),A&&A!==w&&(Mm(p.config.data,A,e.datasetIdKey),y=!0)}y&&a(p)},{deep:!0}),()=>Ei("canvas",{ref:i})}});function y1(e,t){return Hs.register(t),Bu({props:Cm,setup(n,i){let{expose:r}=i;const s=Lu(null),o=a=>{s.value=a==null?void 0:a.chart};return r({chart:s}),()=>Ei(m1,h1({ref:o},{type:e,...n}))}})}const km=y1("line",Ko),cf=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n};Hs.register(xa,wa,bs,tr,Om,Em,wm);const b1={components:{Line:km},props:{data:Array,labels:Array},created(){this.chartColor=this.getChange()>=0?"green":"red"},methods:{getChange(){return((this.data.at(-1)-this.data.at(-2))/this.data.at(-2)*100||0).toFixed(2)}}};function _1(e,t,n,i,r,s){const o=oa("Line");return Ee(),Tg(o,{height:"30",data:{labels:n.labels,datasets:[{data:n.data,borderColor:e.chartColor,backgroundColor:e.chartColor}]},options:{elements:{point:{radius:0}},plugins:{legend:{display:!1}},scales:{y:{ticks:{display:!1}},x:{ticks:{display:!1}}}}},null,8,["data"])}const x1=cf(b1,[["render",_1]]);Hs.register(xa,wa,bs,tr,Om,Em,wm);const v1={props:{data:Array,dates:Array,color:String,label:String,total:String,subtotal:String},components:{Line:km},created(){this.chartColor=this.color||(this.getChange()>0?"green":"red")},methods:{getChange(){return((this.data.at(-1)-this.data.at(-2))/this.data.at(-2)*100).toFixed(2)}}},w1={class:"flex flex-col col-span-full sm:col-span-12 bg-white dark:bg-slate-800 shadow-lg border border-slate-200 dark:border-slate-700"},S1={class:"px-5 py-2 border-b border-slate-100 dark:border-slate-700 flex items-center"},O1={class:"font-semibold text-slate-800 dark:text-slate-100"},A1={class:"px-5 py-3"},E1={class:"flex flex-wrap justify-between items-end"},P1={class:"flex items-start"},C1={class:"text-right mr-2 text-slate-800 dark:text-slate-100"},T1={class:"text-3xl font-bold"},M1={class:"text-lg font-semibold h-1.5"};function k1(e,t,n,i,r,s){const o=oa("Line");return Ee(),Xe("div",w1,[W("header",S1,[W("h2",O1,kt(n.label),1)]),W("div",A1,[W("div",E1,[W("div",P1,[W("div",C1,[W("div",T1,kt(n.total),1),W("div",M1,kt(n.subtotal),1)]),W("div",{class:Le(["text-sm font-semibold text-white px-1.5 rounded-full",{"bg-red-700":s.getChange()<0,"bg-green-700":s.getChange()>=0}])},kt(s.getChange())+"%",3)])])]),W("div",null,[Rt(o,{height:"100",data:{labels:n.dates,datasets:[{data:n.data}]},options:{color:"white",borderColor:e.chartColor,backgroundColor:e.chartColor,elements:{point:{radius:2}},plugins:{legend:{display:!1}},scales:{y:{ticks:{color:"white"}},x:{ticks:{color:"white"}}}}},null,8,["data","options"])])])}const R1=cf(v1,[["render",k1]]),F1={components:{TokenChart:x1,BalancesChart:R1},props:{tokens:Array,balance:Number,balances:Object,transactions:Array},data(){return{loading:!1}},created(){this.totals={usd:this.balances.totals.at(-1),btc:this.balances.bitcoin.at(-1),eth:this.balances.ethereum.at(-1),eur:this.balances.totals_eur.at(-1),pricesUsd:this.balances.prices.at(-1),pricesEur:this.balances.prices_eur.at(-1)}},methods:{getDailyChange(e){const t=this.tokens[1][e].price;return((this.tokens[0][e].price-t)/t*100).toFixed(2)},getWeeklyApy(e){const t=this.tokens[0][e].balance;return((t-(this.tokens[6][e]||0).balance)/t*100||0).toFixed(2)},getWeeklyGain(e){const t=this.tokens[0][e];return((t.balance-(this.tokens[6][e]||0).balance)*t.price).toFixed(2)},getMonthlyApy(e){const t=this.tokens[0][e].balance;return((t-(this.tokens.at(-1)[e]||0).balance)/t*100||0).toFixed(2)},getMonthlyGain(e){const t=this.tokens[0][e];return((t.balance-(this.tokens.at(-1)[e]||0).balance)*t.price).toFixed(2)},getTokensHistory(e){return this.tokens.map(t=>t[e]||0).reverse()},getBalanceHistory(e){return this.getTokensHistory(e).map(({balance:t})=>t)},getPriceHistory(e){return this.getTokensHistory(e).map(t=>t.balance*t.price)},refreshTokens(){this.loading=!0,axios.get("get-tokens").then(({data:e})=>{e.balances.forEach(t=>{const n=this.tokens[0][t.pool];n.price=t.price,n.balance=t.balance,n.price_eur=t.price_eur}),this.totals={usd:0,eth:0,eur:0,pricesEur:e.ethereumPrice.eur,pricesUsd:e.ethereumPrice.usd},e.balances.forEach(t=>{this.totals.usd+=t.price*t.balance,this.totals.eur+=t.price_eur*t.balance,this.totals.eth+=t.price*t.balance/this.totals.pricesUsd}),this.loading=!1})},currencyFormat(e){return new Intl.NumberFormat().format(e)}}},I1={class:"flex"},D1={class:"w-1/3"},L1={class:"w-1/3"},$1={class:"w-1/3"},N1={class:"col-span-full xl:col-span-12 bg-white dark:bg-slate-800 shadow-lg rounded-sm border border-slate-200 dark:border-slate-700 mt-4"},B1={class:"p-4 border-b border-slate-100 dark:border-slate-700 inline-flex"},j1=W("h2",{class:"font-semibold text-slate-800 dark:text-slate-100 mr-2"},"Balances",-1),H1=["disabled"],z1={class:"table-autodark:text-slate-300 mx-auto w-full sortable"},W1=W("thead",{class:"text-xs uppercase text-slate-400 dark:text-slate-500 bg-slate-50 dark:bg-slate-700 dark:bg-opacity-50 rounded-sm cursor-pointer"},[W("tr",null,[W("th",{class:"p-2 text-left pl-5"}," Name "),W("th",{class:"p-2 text-right"}," Balance "),W("th",{class:"p-2 text-right"}," EUR Price "),W("th",{class:"p-2 text-right"}," USD Price "),W("th",{class:"p-2 text-right"}," 24h "),W("th",{class:"p-2 text-right"}," Total EUR "),W("th",{class:"p-2 text-right"}," Total USD "),W("th",{class:"p-2 text-right"}," Total ETH "),W("th",{class:"p-2 text-right"}," 7 D APY "),W("th",{class:"p-2 text-right"}," 7 D gain "),W("th",{class:"p-2 text-right"}," 30 D APY "),W("th",{class:"p-2 text-right"}," 30 D gain "),W("th",{class:"p-2 text-center"}," Last 30 D balance "),W("th",{class:"p-2 text-center"}," Last 30 D price ")])],-1),U1={class:"text-sm font-medium divide-y divide-slate-100 dark:divide-slate-700"},V1={class:"p-2 text-slate-800 dark:text-slate-100 pl-3 w-1/3"},K1={class:"p-2 text-right text-yellow-300"},q1={class:"p-2 text-right text-red-300"},Y1={class:"p-2 text-right text-red-300"},G1={class:"p-2 text-right text-white"},X1={class:"p-2 text-right text-emerald-300"},J1={class:"p-2 text-right text-emerald-300"},Q1={class:"p-2 text-right text-sky-300"},Z1={class:"p-2 text-right text-emerald-300"},tO={class:"p-2 text-right text-emerald-300"},eO={class:"p-2 text-right text-emerald-300"},nO={class:"p-2 text-right text-emerald-300"},iO={class:"p-2 w-2/12"},rO={class:"p-2 w-2/12"},sO={class:"col-span-full xl:col-span-12 bg-white dark:bg-slate-800 shadow-lg rounded-sm border border-slate-200 dark:border-slate-700 mt-4"},oO={class:"p-4 border-b border-slate-100 dark:border-slate-700"},aO={class:"font-semibold text-slate-800 dark:text-slate-100"},lO={class:"font-normal"},cO={class:"table-autodark:text-slate-300 mx-auto w-full sortable"},uO=W("thead",{class:"text-xs uppercase text-slate-400 dark:text-slate-500 bg-slate-50 dark:bg-slate-700 dark:bg-opacity-50 rounded-sm cursor-pointer"},[W("tr",null,[W("th",{class:"p-2 text-left pl-5"}," Title "),W("th",{class:"p-2 text-left pl-5"}," Type "),W("th",{class:"p-2 text-left pl-5"}," Status "),W("th",{class:"p-2 text-left pl-5"}," Primary Amount "),W("th",{class:"p-2 text-left pl-5"}," Secondary Amount "),W("th",{class:"p-2 text-left pl-5"}," Created On ")])],-1),fO={class:"text-sm font-medium divide-y divide-slate-100 dark:divide-slate-700"},hO=["innerHTML"],dO={class:"p-2 text-slate-800 dark:text-slate-100"},pO={class:"p-2 text-slate-800 dark:text-slate-100"},gO=["innerHTML"],mO={class:"p-2 text-slate-800 dark:text-slate-100"},yO={class:"p-2 text-slate-800 dark:text-slate-100"};function bO(e,t,n,i,r,s){const o=oa("balances-chart"),a=oa("token-chart");return Ee(),Xe(ye,null,[W("div",I1,[W("div",D1,[Rt(o,{label:"ETH Price",dates:n.balances.dates,data:n.balances.prices,total:"$"+s.currencyFormat(e.totals.pricesUsd),subtotal:`(${s.currencyFormat(e.totals.pricesEur)} €)`},null,8,["dates","data","total","subtotal"])]),W("div",L1,[Rt(o,{color:"blue",label:"ETH",dates:n.balances.dates,data:n.balances.ethereum,total:e.totals.eth.toFixed(3),subtotal:`(${e.totals.btc.toFixed(3)} BTC)`},null,8,["dates","data","total","subtotal"])]),W("div",$1,[Rt(o,{label:"Total",dates:n.balances.dates,data:n.balances.totals,total:"$"+s.currencyFormat(e.totals.usd.toFixed(2)),subtotal:`(${s.currencyFormat(e.totals.eur.toFixed(2))} €)`},null,8,["dates","data","total","subtotal"])])]),W("div",N1,[W("header",B1,[j1,W("button",{class:Le(["bg-gray-500 hover:bg-gray-700 font-bold py-2 px-4 rounded inline-flex items-center h-6",{"bg-gray-700":r.loading}]),disabled:r.loading,onClick:t[0]||(t[0]=(...l)=>s.refreshTokens&&s.refreshTokens(...l))},[W("i",{class:Le(["fa fa-refresh",{"animate-spin":r.loading}]),style:{"font-size":"15px"}},null,2)],10,H1)]),W("table",z1,[W1,W("tbody",U1,[(Ee(!0),Xe(ye,null,ih(n.tokens[0],(l,c)=>(Ee(),Xe("tr",null,[W("td",V1,kt(l.pool),1),W("td",K1,kt(s.currencyFormat(l.balance.toFixed(2))),1),W("td",q1,kt(s.currencyFormat(l.price_eur.toFixed(2))),1),W("td",Y1," $"+kt(s.currencyFormat(l.price.toFixed(2))),1),W("td",G1,[W("span",{class:Le({"text-red-500":s.getDailyChange(c,l.price)<0,"text-green-500":s.getDailyChange(c,l.price)>0})},kt(s.currencyFormat(s.getDailyChange(c,l.price)))+"%",3)]),W("td",X1,kt(s.currencyFormat((l.price_eur*l.balance).toFixed(2))),1),W("td",J1," $"+kt(s.currencyFormat((l.price*l.balance).toFixed(2))),1),W("td",Q1,kt(s.currencyFormat(l.price*l.balance/e.totals.pricesUsd)),1),W("td",Z1,[s.getWeeklyApy(c)!=0?(Ee(),Xe("span",{key:0,class:Le({"text-red-500":s.getWeeklyApy(c)<0,"text-green-500":s.getWeeklyApy(c)>0})},kt(s.currencyFormat(s.getWeeklyApy(c)))+"%",3)):yo("",!0)]),W("td",tO,[s.getWeeklyGain(c)!=0?(Ee(),Xe("span",{key:0,class:Le({"text-red-500":s.getWeeklyGain(c)<0,"text-green-500":s.getWeeklyGain(c)>0})},"$"+kt(s.currencyFormat(s.getWeeklyGain(c))),3)):yo("",!0)]),W("td",eO,[s.getMonthlyApy(c)!=0?(Ee(),Xe("span",{key:0,class:Le({"text-red-500":s.getMonthlyApy(c)<0,"text-green-500":s.getMonthlyApy(c)>0})},kt(s.currencyFormat(s.getMonthlyApy(c)))+"%",3)):yo("",!0)]),W("td",nO,[s.getMonthlyGain(c)!=0?(Ee(),Xe("span",{key:0,class:Le({"text-red-500":s.getMonthlyGain(c)<0,"text-green-500":s.getMonthlyGain(c)>0})},"$"+kt(s.currencyFormat(s.getMonthlyGain(c))),3)):yo("",!0)]),W("td",iO,[Rt(a,{labels:Object.keys(n.tokens),data:s.getBalanceHistory(l.pool)},null,8,["labels","data"])]),W("td",rO,[Rt(a,{labels:Object.keys(n.tokens),data:s.getPriceHistory(l.pool)},null,8,["labels","data"])])]))),256))])])]),W("div",sO,[W("header",oO,[W("h2",aO,[zu("Wise balance: "),W("p",lO,kt(n.balance)+" EUR",1)])]),W("table",cO,[uO,W("tbody",fO,[(Ee(!0),Xe(ye,null,ih(n.transactions,l=>(Ee(),Xe("tr",null,[W("td",{class:"p-2 w-1/4 text-slate-800 dark:text-slate-100 pl-3",innerHTML:l.title},null,8,hO),W("td",dO,kt(l.type),1),W("td",pO,kt(l.status),1),W("td",{class:"p-2 text-slate-800 dark:text-slate-100",innerHTML:l.primaryAmount},null,8,gO),W("td",mO,kt(l.secondaryAmount),1),W("td",yO,kt(l.createdOn),1)]))),256))])])])],64)}const _O=cf(F1,[["render",bO]]),xO=Object.freeze(Object.defineProperty({__proto__:null,default:_O},Symbol.toStringTag,{value:"Module"}));function Rm(e,t){return function(){return e.apply(t,arguments)}}const{toString:vO}=Object.prototype,{getPrototypeOf:uf}=Object,Xa=(e=>t=>{const n=vO.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),un=e=>(e=e.toLowerCase(),t=>Xa(t)===e),Ja=e=>t=>typeof t===e,{isArray:Or}=Array,Ls=Ja("undefined");function wO(e){return e!==null&&!Ls(e)&&e.constructor!==null&&!Ls(e.constructor)&&Me(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Fm=un("ArrayBuffer");function SO(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Fm(e.buffer),t}const OO=Ja("string"),Me=Ja("function"),Im=Ja("number"),Qa=e=>e!==null&&typeof e=="object",AO=e=>e===!0||e===!1,Go=e=>{if(Xa(e)!=="object")return!1;const t=uf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},EO=un("Date"),PO=un("File"),CO=un("Blob"),TO=un("FileList"),MO=e=>Qa(e)&&Me(e.pipe),kO=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Me(e.append)&&((t=Xa(e))==="formdata"||t==="object"&&Me(e.toString)&&e.toString()==="[object FormData]"))},RO=un("URLSearchParams"),FO=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zs(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let i,r;if(typeof e!="object"&&(e=[e]),Or(e))for(i=0,r=e.length;i0;)if(r=n[i],t===r.toLowerCase())return r;return null}const Lm=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),$m=e=>!Ls(e)&&e!==Lm;function Kc(){const{caseless:e}=$m(this)&&this||{},t={},n=(i,r)=>{const s=e&&Dm(t,r)||r;Go(t[s])&&Go(i)?t[s]=Kc(t[s],i):Go(i)?t[s]=Kc({},i):Or(i)?t[s]=i.slice():t[s]=i};for(let i=0,r=arguments.length;i(zs(t,(r,s)=>{n&&Me(r)?e[s]=Rm(r,n):e[s]=r},{allOwnKeys:i}),e),DO=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),LO=(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},$O=(e,t,n,i)=>{let r,s,o;const a={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),s=r.length;s-- >0;)o=r[s],(!i||i(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&uf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},NO=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return i!==-1&&i===n},BO=e=>{if(!e)return null;if(Or(e))return e;let t=e.length;if(!Im(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},jO=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&uf(Uint8Array)),HO=(e,t)=>{const i=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=i.next())&&!r.done;){const s=r.value;t.call(e,s[0],s[1])}},zO=(e,t)=>{let n;const i=[];for(;(n=e.exec(t))!==null;)i.push(n);return i},WO=un("HTMLFormElement"),UO=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,r){return i.toUpperCase()+r}),Nd=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),VO=un("RegExp"),Nm=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};zs(n,(r,s)=>{let o;(o=t(r,s,e))!==!1&&(i[s]=o||r)}),Object.defineProperties(e,i)},KO=e=>{Nm(e,(t,n)=>{if(Me(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=e[n];if(Me(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},qO=(e,t)=>{const n={},i=r=>{r.forEach(s=>{n[s]=!0})};return Or(e)?i(e):i(String(e).split(t)),n},YO=()=>{},GO=(e,t)=>(e=+e,Number.isFinite(e)?e:t),ac="abcdefghijklmnopqrstuvwxyz",Bd="0123456789",Bm={DIGIT:Bd,ALPHA:ac,ALPHA_DIGIT:ac+ac.toUpperCase()+Bd},XO=(e=16,t=Bm.ALPHA_DIGIT)=>{let n="";const{length:i}=t;for(;e--;)n+=t[Math.random()*i|0];return n};function JO(e){return!!(e&&Me(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const QO=e=>{const t=new Array(10),n=(i,r)=>{if(Qa(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[r]=i;const s=Or(i)?[]:{};return zs(i,(o,a)=>{const l=n(o,r+1);!Ls(l)&&(s[a]=l)}),t[r]=void 0,s}}return i};return n(e,0)},ZO=un("AsyncFunction"),tA=e=>e&&(Qa(e)||Me(e))&&Me(e.then)&&Me(e.catch),R={isArray:Or,isArrayBuffer:Fm,isBuffer:wO,isFormData:kO,isArrayBufferView:SO,isString:OO,isNumber:Im,isBoolean:AO,isObject:Qa,isPlainObject:Go,isUndefined:Ls,isDate:EO,isFile:PO,isBlob:CO,isRegExp:VO,isFunction:Me,isStream:MO,isURLSearchParams:RO,isTypedArray:jO,isFileList:TO,forEach:zs,merge:Kc,extend:IO,trim:FO,stripBOM:DO,inherits:LO,toFlatObject:$O,kindOf:Xa,kindOfTest:un,endsWith:NO,toArray:BO,forEachEntry:HO,matchAll:zO,isHTMLForm:WO,hasOwnProperty:Nd,hasOwnProp:Nd,reduceDescriptors:Nm,freezeMethods:KO,toObjectSet:qO,toCamelCase:UO,noop:YO,toFiniteNumber:GO,findKey:Dm,global:Lm,isContextDefined:$m,ALPHABET:Bm,generateString:XO,isSpecCompliantForm:JO,toJSONObject:QO,isAsyncFn:ZO,isThenable:tA};function dt(e,t,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r)}R.inherits(dt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:R.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const jm=dt.prototype,Hm={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Hm[e]={value:e}});Object.defineProperties(dt,Hm);Object.defineProperty(jm,"isAxiosError",{value:!0});dt.from=(e,t,n,i,r,s)=>{const o=Object.create(jm);return R.toFlatObject(e,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),dt.call(o,e.message,t,n,i,r),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};const eA=null;function qc(e){return R.isPlainObject(e)||R.isArray(e)}function zm(e){return R.endsWith(e,"[]")?e.slice(0,-2):e}function jd(e,t,n){return e?e.concat(t).map(function(r,s){return r=zm(r),!n&&s?"["+r+"]":r}).join(n?".":""):t}function nA(e){return R.isArray(e)&&!e.some(qc)}const iA=R.toFlatObject(R,{},null,function(t){return/^is[A-Z]/.test(t)});function Za(e,t,n){if(!R.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=R.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!R.isUndefined(b[y])});const i=n.metaTokens,r=n.visitor||u,s=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&R.isSpecCompliantForm(t);if(!R.isFunction(r))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(R.isDate(p))return p.toISOString();if(!l&&R.isBlob(p))throw new dt("Blob is not supported. Use a Buffer instead.");return R.isArrayBuffer(p)||R.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,y,b){let x=p;if(p&&!b&&typeof p=="object"){if(R.endsWith(y,"{}"))y=i?y:y.slice(0,-2),p=JSON.stringify(p);else if(R.isArray(p)&&nA(p)||(R.isFileList(p)||R.endsWith(y,"[]"))&&(x=R.toArray(p)))return y=zm(y),x.forEach(function(w,S){!(R.isUndefined(w)||w===null)&&t.append(o===!0?jd([y],S,s):o===null?y:y+"[]",c(w))}),!1}return qc(p)?!0:(t.append(jd(b,y,s),c(p)),!1)}const h=[],d=Object.assign(iA,{defaultVisitor:u,convertValue:c,isVisitable:qc});function g(p,y){if(!R.isUndefined(p)){if(h.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(p),R.forEach(p,function(x,A){(!(R.isUndefined(x)||x===null)&&r.call(t,x,R.isString(A)?A.trim():A,y,d))===!0&&g(x,y?y.concat(A):[A])}),h.pop()}}if(!R.isObject(e))throw new TypeError("data must be an object");return g(e),t}function Hd(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function ff(e,t){this._pairs=[],e&&Za(e,this,t)}const Wm=ff.prototype;Wm.append=function(t,n){this._pairs.push([t,n])};Wm.toString=function(t){const n=t?function(i){return t.call(this,i,Hd)}:Hd;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function rA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Um(e,t,n){if(!t)return e;const i=n&&n.encode||rA,r=n&&n.serialize;let s;if(r?s=r(t,n):s=R.isURLSearchParams(t)?t.toString():new ff(t,n).toString(i),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class sA{constructor(){this.handlers=[]}use(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){R.forEach(this.handlers,function(i){i!==null&&t(i)})}}const zd=sA,Vm={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oA=typeof URLSearchParams<"u"?URLSearchParams:ff,aA=typeof FormData<"u"?FormData:null,lA=typeof Blob<"u"?Blob:null,cA=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),uA=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),on={isBrowser:!0,classes:{URLSearchParams:oA,FormData:aA,Blob:lA},isStandardBrowserEnv:cA,isStandardBrowserWebWorkerEnv:uA,protocols:["http","https","file","blob","url","data"]};function fA(e,t){return Za(e,new on.classes.URLSearchParams,Object.assign({visitor:function(n,i,r,s){return on.isNode&&R.isBuffer(n)?(this.append(i,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function hA(e){return R.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dA(e){const t={},n=Object.keys(e);let i;const r=n.length;let s;for(i=0;i=n.length;return o=!o&&R.isArray(r)?r.length:o,l?(R.hasOwnProp(r,o)?r[o]=[r[o],i]:r[o]=i,!a):((!r[o]||!R.isObject(r[o]))&&(r[o]=[]),t(n,i,r[o],s)&&R.isArray(r[o])&&(r[o]=dA(r[o])),!a)}if(R.isFormData(e)&&R.isFunction(e.entries)){const n={};return R.forEachEntry(e,(i,r)=>{t(hA(i),r,n,0)}),n}return null}function pA(e,t,n){if(R.isString(e))try{return(t||JSON.parse)(e),R.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}const hf={transitional:Vm,adapter:["xhr","http"],transformRequest:[function(t,n){const i=n.getContentType()||"",r=i.indexOf("application/json")>-1,s=R.isObject(t);if(s&&R.isHTMLForm(t)&&(t=new FormData(t)),R.isFormData(t))return r&&r?JSON.stringify(Km(t)):t;if(R.isArrayBuffer(t)||R.isBuffer(t)||R.isStream(t)||R.isFile(t)||R.isBlob(t))return t;if(R.isArrayBufferView(t))return t.buffer;if(R.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return fA(t,this.formSerializer).toString();if((a=R.isFileList(t))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Za(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return s||r?(n.setContentType("application/json",!1),pA(t)):t}],transformResponse:[function(t){const n=this.transitional||hf.transitional,i=n&&n.forcedJSONParsing,r=this.responseType==="json";if(t&&R.isString(t)&&(i&&!this.responseType||r)){const o=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(a){if(o)throw a.name==="SyntaxError"?dt.from(a,dt.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:on.classes.FormData,Blob:on.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};R.forEach(["delete","get","head","post","put","patch"],e=>{hf.headers[e]={}});const df=hf,gA=R.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),mA=e=>{const t={};let n,i,r;return e&&e.split(` `).forEach(function(o){r=o.indexOf(":"),n=o.substring(0,r).trim().toLowerCase(),i=o.substring(r+1).trim(),!(!n||t[n]&&gA[n])&&(n==="set-cookie"?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)}),t},Wd=Symbol("internals");function qr(e){return e&&String(e).trim().toLowerCase()}function Xo(e){return e===!1||e==null?e:R.isArray(e)?e.map(Xo):String(e)}function yA(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}const bA=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function lc(e,t,n,i,r){if(R.isFunction(i))return i.call(this,t,n);if(r&&(t=n),!!R.isString(t)){if(R.isString(i))return t.indexOf(i)!==-1;if(R.isRegExp(i))return i.test(t)}}function _A(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,i)=>n.toUpperCase()+i)}function xA(e,t){const n=R.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{value:function(r,s,o){return this[i].call(this,t,r,s,o)},configurable:!0})})}class tl{constructor(t){t&&this.set(t)}set(t,n,i){const r=this;function s(a,l,c){const u=qr(l);if(!u)throw new Error("header name must be a non-empty string");const h=R.findKey(r,u);(!h||r[h]===void 0||c===!0||c===void 0&&r[h]!==!1)&&(r[h||l]=Xo(a))}const o=(a,l)=>R.forEach(a,(c,u)=>s(c,u,l));return R.isPlainObject(t)||t instanceof this.constructor?o(t,n):R.isString(t)&&(t=t.trim())&&!bA(t)?o(mA(t),n):t!=null&&s(n,t,i),this}get(t,n){if(t=qr(t),t){const i=R.findKey(this,t);if(i){const r=this[i];if(!n)return r;if(n===!0)return yA(r);if(R.isFunction(n))return n.call(this,r,i);if(R.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=qr(t),t){const i=R.findKey(this,t);return!!(i&&this[i]!==void 0&&(!n||lc(this,this[i],i,n)))}return!1}delete(t,n){const i=this;let r=!1;function s(o){if(o=qr(o),o){const a=R.findKey(i,o);a&&(!n||lc(i,i[a],a,n))&&(delete i[a],r=!0)}}return R.isArray(t)?t.forEach(s):s(t),r}clear(t){const n=Object.keys(this);let i=n.length,r=!1;for(;i--;){const s=n[i];(!t||lc(this,this[s],s,t,!0))&&(delete this[s],r=!0)}return r}normalize(t){const n=this,i={};return R.forEach(this,(r,s)=>{const o=R.findKey(i,s);if(o){n[o]=Xo(r),delete n[s];return}const a=t?_A(s):String(s).trim();a!==s&&delete n[s],n[a]=Xo(r),i[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return R.forEach(this,(i,r)=>{i!=null&&i!==!1&&(n[r]=t&&R.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const i=new this(t);return n.forEach(r=>i.set(r)),i}static accessor(t){const i=(this[Wd]=this[Wd]={accessors:{}}).accessors,r=this.prototype;function s(o){const a=qr(o);i[a]||(xA(r,o),i[a]=!0)}return R.isArray(t)?t.forEach(s):s(t),this}}tl.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);R.reduceDescriptors(tl.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[n]=i}}});R.freezeMethods(tl);const En=tl;function cc(e,t){const n=this||df,i=t||n,r=En.from(i.headers);let s=i.data;return R.forEach(e,function(a){s=a.call(n,s,r.normalize(),t?t.status:void 0)}),r.normalize(),s}function qm(e){return!!(e&&e.__CANCEL__)}function Ws(e,t,n){dt.call(this,e??"canceled",dt.ERR_CANCELED,t,n),this.name="CanceledError"}R.inherits(Ws,dt,{__CANCEL__:!0});function vA(e,t,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):t(new dt("Request failed with status code "+n.status,[dt.ERR_BAD_REQUEST,dt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const wA=on.isStandardBrowserEnv?function(){return{write:function(n,i,r,s,o,a){const l=[];l.push(n+"="+encodeURIComponent(i)),R.isNumber(r)&&l.push("expires="+new Date(r).toGMTString()),R.isString(s)&&l.push("path="+s),R.isString(o)&&l.push("domain="+o),a===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(n){const i=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function SA(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function OA(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Ym(e,t){return e&&!SA(t)?OA(e,t):t}const AA=on.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let i;function r(s){let o=s;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=r(window.location.href),function(o){const a=R.isString(o)?r(o):o;return a.protocol===i.protocol&&a.host===i.host}}():function(){return function(){return!0}}();function EA(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function PA(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r=0,s=0,o;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=i[s];o||(o=c),n[r]=l,i[r]=c;let h=s,d=0;for(;h!==r;)d+=n[h++],h=h%e;if(r=(r+1)%e,r===s&&(s=(s+1)%e),c-o{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,l=i(a),c=s<=o;n=s;const u={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&c?(o-s)/l:void 0,event:r};u[t?"download":"upload"]=!0,e(u)}}const CA=typeof XMLHttpRequest<"u",TA=CA&&function(e){return new Promise(function(n,i){let r=e.data;const s=En.from(e.headers).normalize(),o=e.responseType;let a;function l(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}let c;R.isFormData(r)&&(on.isStandardBrowserEnv||on.isStandardBrowserWebWorkerEnv?s.setContentType(!1):s.getContentType(/^\s*multipart\/form-data/)?R.isString(c=s.getContentType())&&s.setContentType(c.replace(/^\s*(multipart\/form-data);+/,"$1")):s.setContentType("multipart/form-data"));let u=new XMLHttpRequest;if(e.auth){const p=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(p+":"+y))}const h=Ym(e.baseURL,e.url);u.open(e.method.toUpperCase(),Um(h,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function d(){if(!u)return;const p=En.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),b={data:!o||o==="text"||o==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:p,config:e,request:u};vA(function(A){n(A),l()},function(A){i(A),l()},b),u=null}if("onloadend"in u?u.onloadend=d:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(d)},u.onabort=function(){u&&(i(new dt("Request aborted",dt.ECONNABORTED,e,u)),u=null)},u.onerror=function(){i(new dt("Network Error",dt.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let y=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const b=e.transitional||Vm;e.timeoutErrorMessage&&(y=e.timeoutErrorMessage),i(new dt(y,b.clarifyTimeoutError?dt.ETIMEDOUT:dt.ECONNABORTED,e,u)),u=null},on.isStandardBrowserEnv){const p=(e.withCredentials||AA(h))&&e.xsrfCookieName&&wA.read(e.xsrfCookieName);p&&s.set(e.xsrfHeaderName,p)}r===void 0&&s.setContentType(null),"setRequestHeader"in u&&R.forEach(s.toJSON(),function(y,b){u.setRequestHeader(b,y)}),R.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),o&&o!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",Ud(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Ud(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=p=>{u&&(i(!p||p.type?new Ws(null,e,u):p),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const g=EA(h);if(g&&on.protocols.indexOf(g)===-1){i(new dt("Unsupported protocol "+g+":",dt.ERR_BAD_REQUEST,e));return}u.send(r||null)})},Yc={http:eA,xhr:TA};R.forEach(Yc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Vd=e=>`- ${e}`,MA=e=>R.isFunction(e)||e===null||e===!1,Gm={getAdapter:e=>{e=R.isArray(e)?e:[e];const{length:t}=e;let n,i;const r={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since : `+s.map(Vd).join(` diff --git a/resources/js/Pages/Dashboard.vue b/resources/js/Pages/Dashboard.vue index bfd2ddd..a828788 100644 --- a/resources/js/Pages/Dashboard.vue +++ b/resources/js/Pages/Dashboard.vue @@ -16,6 +16,7 @@ :dates="balances.dates" :data="balances.ethereum" :total="totals.eth.toFixed(3)" + :subtotal="`(${totals.btc.toFixed(3)} BTC)`" />
@@ -226,6 +227,7 @@ created() { this.totals = { usd: this.balances.totals.at(-1), + btc: this.balances.bitcoin.at(-1), eth: this.balances.ethereum.at(-1), eur: this.balances.totals_eur.at(-1), pricesUsd: this.balances.prices.at(-1), @@ -282,15 +284,18 @@ this.totals = { usd: 0, eth: 0, + btc: 0, eur: 0, pricesEur: data.ethereumPrice.eur, - pricesUsd: data.ethereumPrice.usd + pricesUsd: data.ethereumPrice.usd, + btcPricesUsd: data.bitcoinPrice.usd } data.balances.forEach(token => { this.totals.usd += token.price * token.balance this.totals.eur += token.price_eur * token.balance this.totals.eth += token.price * token.balance / this.totals.pricesUsd + this.totals.btc += token.price * token.balance / this.totals.btcPricesUsd }) this.loading = false diff --git a/resources/js/components/Dashboard/BalancesChart.vue b/resources/js/components/Dashboard/BalancesChart.vue index e10746f..0f37de5 100644 --- a/resources/js/components/Dashboard/BalancesChart.vue +++ b/resources/js/components/Dashboard/BalancesChart.vue @@ -8,7 +8,7 @@
{{ total }}
-
{{ subtotal }}
+
{{ subtotal }}
-
-

{{ $label }}

-
-
-
-
-
{{ $total }}
- @php($change = (end($data) - $prevTotal = prev($data)) / $prevTotal * 100) - -
$change < 0, - 'bg-green-700' => $change >= 0, - 'text-sm font-semibold text-white px-1.5 rounded-full' - ])>{{ number_format($change, 2) }}%
-
-
-
    -
    -
    -
    -
    - -
    -
    - diff --git a/resources/views/components/dashboard/simple-chart.blade.php b/resources/views/components/dashboard/simple-chart.blade.php deleted file mode 100644 index b8b2c26..0000000 --- a/resources/views/components/dashboard/simple-chart.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -
    - -
    - diff --git a/tests/Unit/SupabaseServiceTest.php b/tests/Unit/SupabaseServiceTest.php index f0c8080..007fbcf 100644 --- a/tests/Unit/SupabaseServiceTest.php +++ b/tests/Unit/SupabaseServiceTest.php @@ -25,11 +25,13 @@ function createEntries($type) { expect(end($dates))->toBe('Nov 08 2024'); expect(end($this->balances['prices']))->toBe(2000.0); - expect(end($this->balances['bitcoin']))->toBe(20000.0); + expect(end($this->balances['bitcoin']))->toBe(200.0); expect(end($this->balances['ethereum']))->toBe(2000.0); expect(end($this->balances['totals']))->toBe(4000000.0); expect(end($this->balances['prices_eur']))->toBe(1900.0); + expect(end($this->balances['btc_prices']))->toBe(20000.0); expect(end($this->balances['totals_eur']))->toBe(3800000.0); + expect(end($this->balances['btc_prices_eur']))->toBe(19000.0); expect(Carbon::parse($dates[0])->lt(Carbon::createFromFormat('M d Y', end($dates))))->toBetrue(); }); diff --git a/tests/responses/totals.json b/tests/responses/totals.json index 1e7c59c..63da718 100644 --- a/tests/responses/totals.json +++ b/tests/responses/totals.json @@ -4,6 +4,7 @@ "price_eur": 1900, "balance": 2000, "btc_price": 20000, + "btc_price_eur": 19000, "created_at": "2024-11-08T00:00:00.000000+00:00" }, {