diff --git a/app/dist/assets/index-9d610b1d.js b/app/dist/assets/index-f6a8dc80.js similarity index 98% rename from app/dist/assets/index-9d610b1d.js rename to app/dist/assets/index-f6a8dc80.js index c6d9dafc..c12412c0 100644 --- a/app/dist/assets/index-9d610b1d.js +++ b/app/dist/assets/index-f6a8dc80.js @@ -167,5 +167,5 @@ function print() { __p += __j.call(arguments, '') } * Released under the MIT License */class Animator{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,s,o){const r=n.listeners[o],l=n.duration;r.forEach(a=>a({chart:t,initial:n.initial,numSteps:l,currentStep:Math.min(s-n.start,l)}))}_refresh(){this._request||(this._running=!0,this._request=requestAnimFrame.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((s,o)=>{if(!s.running||!s.items.length)return;const r=s.items;let l=r.length-1,a=!1,c;for(;l>=0;--l)c=r[l],c._active?(c._total>s.duration&&(s.duration=c._total),c.tick(t),a=!0):(r[l]=r[r.length-1],r.pop());a&&(o.draw(),this._notify(o,s,t,"progress")),r.length||(s.running=!1,this._notify(o,s,t,"complete"),s.initial=!1),n+=r.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let s=n.get(t);return s||(s={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,s)),s}listen(t,n,s){this._getAnims(t).listeners[n].push(s)}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((s,o)=>Math.max(s,o._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 s=n.items;let o=s.length-1;for(;o>=0;--o)s[o].cancel();n.items=[],this._notify(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var animator=new Animator;const transparent="transparent",interpolators={boolean(i,t,n){return n>.5?t:i},color(i,t,n){const s=color(i||transparent),o=s.valid&&color(t||transparent);return o&&o.valid?o.mix(s,n).hexString():t},number(i,t,n){return i+(t-i)*n}};class Animation{constructor(t,n,s,o){const r=n[s];o=resolve([t.to,o,r,t.from]);const l=resolve([t.from,r,o]);this._active=!0,this._fn=t.fn||interpolators[t.type||typeof l],this._easing=effects[t.easing]||effects.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=s,this._from=l,this._to=o,this._promises=void 0}active(){return this._active}update(t,n,s){if(this._active){this._notify(!1);const o=this._target[this._prop],r=s-this._start,l=this._duration-r;this._start=s,this._duration=Math.floor(Math.max(l,t.duration)),this._total+=r,this._loop=!!t.loop,this._to=resolve([t.to,n,o,t.from]),this._from=resolve([t.from,o,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,s=this._duration,o=this._prop,r=this._from,l=this._loop,a=this._to;let c;if(this._active=r!==a&&(l||n1?2-c:c,c=this._easing(Math.min(1,Math.max(0,c))),this._target[o]=this._fn(r,a,c)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,s)=>{t.push({res:n,rej:s})})}_notify(t){const n=t?"res":"rej",s=this._promises||[];for(let o=0;o{const r=t[o];if(!isObject(r))return;const l={};for(const a of n)l[a]=r[a];(isArray(r.properties)&&r.properties||[o]).forEach(a=>{(a===o||!s.has(a))&&s.set(a,l)})})}_animateOptions(t,n){const s=n.options,o=resolveTargetOptions(t,s);if(!o)return[];const r=this._createAnimations(o,s);return s.$shared&&awaitAll(t.options.$animations,s).then(()=>{t.options=s},()=>{}),r}_createAnimations(t,n){const s=this._properties,o=[],r=t.$animations||(t.$animations={}),l=Object.keys(n),a=Date.now();let c;for(c=l.length-1;c>=0;--c){const u=l[c];if(u.charAt(0)==="$")continue;if(u==="options"){o.push(...this._animateOptions(t,n));continue}const f=n[u];let h=r[u];const p=s.get(u);if(h)if(p&&h.active()){h.update(p,f,a);continue}else h.cancel();if(!p||!p.duration){t[u]=f;continue}r[u]=h=new Animation(p,t,u,f),o.push(h)}return o}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const s=this._createAnimations(t,n);if(s.length)return animator.add(this._chart,s),!0}}function awaitAll(i,t){const n=[],s=Object.keys(t);for(let o=0;o0||!n&&r<0)return o.index}return null}function updateStacks(i,t){const{chart:n,_cachedMeta:s}=i,o=n._stacks||(n._stacks={}),{iScale:r,vScale:l,index:a}=s,c=r.axis,u=l.axis,f=getStackKey(r,l,s),h=t.length;let p;for(let m=0;mn[s].axis===t).shift()}function createDatasetContext(i,t){return createContext(i,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function createDataContext(i,t,n){return createContext(i,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function clearStacks(i,t){const n=i.controller.index,s=i.vScale&&i.vScale.axis;if(s){t=t||i._parsed;for(const o of t){const r=o._stacks;if(!r||r[s]===void 0||r[s][n]===void 0)return;delete r[s][n],r[s]._visualValues!==void 0&&r[s]._visualValues[n]!==void 0&&delete r[s]._visualValues[n]}}}const isDirectUpdateMode=i=>i==="reset"||i==="none",cloneIfNotShared=(i,t)=>t?i:Object.assign({},i),createStack=(i,t,n)=>i&&!t.hidden&&t._stacked&&{keys:getSortedDatasetIndices(n,!0),values:null};class DatasetController{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=isStacked(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&&clearStacks(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,s=this.getDataset(),o=(h,p,m,b)=>h==="x"?p:h==="r"?b:m,r=n.xAxisID=valueOrDefault(s.xAxisID,getFirstScaleId(t,"x")),l=n.yAxisID=valueOrDefault(s.yAxisID,getFirstScaleId(t,"y")),a=n.rAxisID=valueOrDefault(s.rAxisID,getFirstScaleId(t,"r")),c=n.indexAxis,u=n.iAxisID=o(c,r,l,a),f=n.vAxisID=o(c,l,r,a);n.xScale=this.getScaleForId(r),n.yScale=this.getScaleForId(l),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(u),n.vScale=this.getScaleForId(f)}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&&unlistenArrayEvents(this._data,this),t._stacked&&clearStacks(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),s=this._data;if(isObject(n))this._data=convertObjectDataToArray(n);else if(s!==n){if(s){unlistenArrayEvents(s,this);const o=this._cachedMeta;clearStacks(o),o._parsed=[]}n&&Object.isExtensible(n)&&listenArrayEvents(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,s=this.getDataset();let o=!1;this._dataCheck();const r=n._stacked;n._stacked=isStacked(n.vScale,n),n.stack!==s.stack&&(o=!0,clearStacks(n),n.stack=s.stack),this._resyncElements(t),(o||r!==n._stacked)&&updateStacks(this,n._parsed)}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:s,_data:o}=this,{iScale:r,_stacked:l}=s,a=r.axis;let c=t===0&&n===o.length?!0:s._sorted,u=t>0&&s._parsed[t-1],f,h,p;if(this._parsing===!1)s._parsed=o,s._sorted=!0,p=o;else{isArray(o[t])?p=this.parseArrayData(s,o,t,n):isObject(o[t])?p=this.parseObjectData(s,o,t,n):p=this.parsePrimitiveData(s,o,t,n);const m=()=>h[a]===null||u&&h[a]v||h=0;--p)if(!b()){this.updateRangeFromParsed(u,t,m,c);break}}return u}getAllParsedValues(t){const n=this._cachedMeta._parsed,s=[];let o,r,l;for(o=0,r=n.length;o=0&&tthis.getContext(s,o,n),v=u.resolveNamedOptions(p,m,b,h);return v.$shared&&(v.$shared=c,r[l]=Object.freeze(cloneIfNotShared(v,c))),v}_resolveAnimations(t,n,s){const o=this.chart,r=this._cachedDataOpts,l=`animation-${n}`,a=r[l];if(a)return a;let c;if(o.options.animation!==!1){const f=this.chart.config,h=f.datasetAnimationScopeKeys(this._type,n),p=f.getOptionScopes(this.getDataset(),h);c=f.createResolver(p,this.getContext(t,s,n))}const u=new Animations(o,c&&c.animations);return c&&c._cacheable&&(r[l]=Object.freeze(u)),u}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||isDirectUpdateMode(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const s=this.resolveDataElementOptions(t,n),o=this._sharedOptions,r=this.getSharedOptions(s),l=this.includeOptions(n,r)||r!==o;return this.updateSharedOptions(r,n,s),{sharedOptions:r,includeOptions:l}}updateElement(t,n,s,o){isDirectUpdateMode(o)?Object.assign(t,s):this._resolveAnimations(n,o).update(t,s)}updateSharedOptions(t,n,s){t&&!isDirectUpdateMode(n)&&this._resolveAnimations(void 0,n).update(t,s)}_setStyle(t,n,s,o){t.active=o;const r=this.getStyle(n,o);this._resolveAnimations(n,s,o).update(t,{options:!o&&this.getSharedOptions(r)||r})}removeHoverStyle(t,n,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,n,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,s=this._cachedMeta.data;for(const[a,c,u]of this._syncList)this[a](c,u);this._syncList=[];const o=s.length,r=n.length,l=Math.min(r,o);l&&this.parse(0,l),r>o?this._insertElements(o,r-o,t):r{for(u.length+=n,a=u.length-1;a>=l;a--)u[a]=u[a-n]};for(c(r),a=t;a_angleBetween(S,a,c,!0)?1:Math.max(T,T*n,x,x*n),b=(S,T,x)=>_angleBetween(S,a,c,!0)?-1:Math.min(T,T*n,x,x*n),v=m(0,u,h),k=m(HALF_PI,f,p),w=b(PI,u,h),C=b(PI+HALF_PI,f,p);s=(v-w)/2,o=(k-C)/2,r=-(v+w)/2,l=-(k+C)/2}return{ratioX:s,ratioY:o,offsetX:r,offsetY:l}}class DoughnutController extends DatasetController{constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const s=this.getDataset().data,o=this._cachedMeta;if(this._parsing===!1)o._parsed=s;else{let r=c=>+s[c];if(isObject(s[t])){const{key:c="value"}=this._parsing;r=u=>+resolveObjectKey(s[u],c)}let l,a;for(l=t,a=t+n;l0&&!isNaN(t)?TAU*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,s=this.chart,o=s.data.labels||[],r=formatNumber(n._parsed[t],s.options.locale);return{label:o[t]||"",value:r}}getMaxBorderWidth(t){let n=0;const s=this.chart;let o,r,l,a,c;if(!t){for(o=0,r=s.data.datasets.length;ot!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),xe(DoughnutController,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:s,color:o}}=t.legend.options;return n.labels.map((r,l)=>{const c=t.getDatasetMeta(0).controller.getStyle(l);return{text:r,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:o,lineWidth:c.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(l),index:l}})}return[]}},onClick(t,n,s){s.chart.toggleDataVisibility(n.index),s.chart.update()}}}});function abstract(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class DateAdapterBase{constructor(t){xe(this,"options");this.options=t||{}}static override(t){Object.assign(DateAdapterBase.prototype,t)}init(){}formats(){return abstract()}parse(){return abstract()}format(){return abstract()}add(){return abstract()}diff(){return abstract()}startOf(){return abstract()}endOf(){return abstract()}}var adapters={_date:DateAdapterBase};function binarySearch(i,t,n,s){const{controller:o,data:r,_sorted:l}=i,a=o._cachedMeta.iScale;if(a&&t===a.axis&&t!=="r"&&l&&r.length){const c=a._reversePixels?_rlookupByKey:_lookupByKey;if(s){if(o._sharedOptions){const u=r[0],f=typeof u.getRange=="function"&&u.getRange(t);if(f){const h=c(r,t,n-f),p=c(r,t,n+f);return{lo:h.lo,hi:p.hi}}}}else return c(r,t,n)}return{lo:0,hi:r.length-1}}function evaluateInteractionItems(i,t,n,s,o){const r=i.getSortedVisibleDatasetMetas(),l=n[t];for(let a=0,c=r.length;a{c[l](t[n],o)&&(r.push({element:c,datasetIndex:u,index:f}),a=a||c.inRange(t.x,t.y,o))}),s&&!a?[]:r}var Interaction={evaluateInteractionItems,modes:{index(i,t,n,s){const o=getRelativePosition(t,i),r=n.axis||"x",l=n.includeInvisible||!1,a=n.intersect?getIntersectItems(i,o,r,s,l):getNearestItems(i,o,r,!1,s,l),c=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(u=>{const f=a[0].index,h=u.data[f];h&&!h.skip&&c.push({element:h,datasetIndex:u.index,index:f})}),c):[]},dataset(i,t,n,s){const o=getRelativePosition(t,i),r=n.axis||"xy",l=n.includeInvisible||!1;let a=n.intersect?getIntersectItems(i,o,r,s,l):getNearestItems(i,o,r,!1,s,l);if(a.length>0){const c=a[0].datasetIndex,u=i.getDatasetMeta(c).data;a=[];for(let f=0;fn.pos===t)}function filterDynamicPositionByAxis(i,t){return i.filter(n=>STATIC_POSITIONS.indexOf(n.pos)===-1&&n.box.axis===t)}function sortByWeight(i,t){return i.sort((n,s)=>{const o=t?s:n,r=t?n:s;return o.weight===r.weight?o.index-r.index:o.weight-r.weight})}function wrapBoxes(i){const t=[];let n,s,o,r,l,a;for(n=0,s=(i||[]).length;nu.box.fullSize),!0),s=sortByWeight(filterByPosition(t,"left"),!0),o=sortByWeight(filterByPosition(t,"right")),r=sortByWeight(filterByPosition(t,"top"),!0),l=sortByWeight(filterByPosition(t,"bottom")),a=filterDynamicPositionByAxis(t,"x"),c=filterDynamicPositionByAxis(t,"y");return{fullSize:n,leftAndTop:s.concat(r),rightAndBottom:o.concat(c).concat(l).concat(a),chartArea:filterByPosition(t,"chartArea"),vertical:s.concat(o).concat(c),horizontal:r.concat(l).concat(a)}}function getCombinedMax(i,t,n,s){return Math.max(i[n],t[n])+Math.max(i[s],t[s])}function updateMaxPadding(i,t){i.top=Math.max(i.top,t.top),i.left=Math.max(i.left,t.left),i.bottom=Math.max(i.bottom,t.bottom),i.right=Math.max(i.right,t.right)}function updateDims(i,t,n,s){const{pos:o,box:r}=n,l=i.maxPadding;if(!isObject(o)){n.size&&(i[o]-=n.size);const h=s[n.stack]||{size:0,count:1};h.size=Math.max(h.size,n.horizontal?r.height:r.width),n.size=h.size/h.count,i[o]+=n.size}r.getPadding&&updateMaxPadding(l,r.getPadding());const a=Math.max(0,t.outerWidth-getCombinedMax(l,i,"left","right")),c=Math.max(0,t.outerHeight-getCombinedMax(l,i,"top","bottom")),u=a!==i.w,f=c!==i.h;return i.w=a,i.h=c,n.horizontal?{same:u,other:f}:{same:f,other:u}}function handleMaxPadding(i){const t=i.maxPadding;function n(s){const o=Math.max(t[s]-i[s],0);return i[s]+=o,o}i.y+=n("top"),i.x+=n("left"),n("right"),n("bottom")}function getMargins(i,t){const n=t.maxPadding;function s(o){const r={left:0,top:0,right:0,bottom:0};return o.forEach(l=>{r[l]=Math.max(t[l],n[l])}),r}return s(i?["left","right"]:["top","bottom"])}function fitBoxes(i,t,n,s){const o=[];let r,l,a,c,u,f;for(r=0,l=i.length,u=0;r{typeof v.beforeLayout=="function"&&v.beforeLayout()});const f=c.reduce((v,k)=>k.box.options&&k.box.options.display===!1?v:v+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:n,padding:o,availableWidth:r,availableHeight:l,vBoxMaxWidth:r/2/f,hBoxMaxHeight:l/2}),p=Object.assign({},o);updateMaxPadding(p,toPadding(s));const m=Object.assign({maxPadding:p,w:r,h:l,x:o.left,y:o.top},o),b=setLayoutDims(c.concat(u),h);fitBoxes(a.fullSize,m,h,b),fitBoxes(c,m,h,b),fitBoxes(u,m,h,b)&&fitBoxes(c,m,h,b),handleMaxPadding(m),placeBoxes(a.leftAndTop,m,h,b),m.x+=m.w,m.y+=m.h,placeBoxes(a.rightAndBottom,m,h,b),i.chartArea={left:m.left,top:m.top,right:m.left+m.w,bottom:m.top+m.h,height:m.h,width:m.w},each(a.chartArea,v=>{const k=v.box;Object.assign(k,i.chartArea),k.update(m.w,m.h,{left:0,top:0,right:0,bottom:0})})}};class BasePlatform{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,s){}removeEventListener(t,n,s){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,s,o){return n=Math.max(0,n||t.width),s=s||t.height,{width:n,height:Math.max(0,o?Math.floor(n/o):s)}}isAttached(t){return!0}updateConfig(t){}}class BasicPlatform extends BasePlatform{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const EXPANDO_KEY="$chartjs",EVENT_TYPES={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},isNullOrEmpty=i=>i===null||i==="";function initCanvas(i,t){const n=i.style,s=i.getAttribute("height"),o=i.getAttribute("width");if(i[EXPANDO_KEY]={initial:{height:s,width:o,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",isNullOrEmpty(o)){const r=readUsedSize(i,"width");r!==void 0&&(i.width=r)}if(isNullOrEmpty(s))if(i.style.height==="")i.height=i.width/(t||2);else{const r=readUsedSize(i,"height");r!==void 0&&(i.height=r)}return i}const eventListenerOptions=supportsEventListenerOptions?{passive:!0}:!1;function addListener(i,t,n){i.addEventListener(t,n,eventListenerOptions)}function removeListener(i,t,n){i.canvas.removeEventListener(t,n,eventListenerOptions)}function fromNativeEvent(i,t){const n=EVENT_TYPES[i.type]||i.type,{x:s,y:o}=getRelativePosition(i,t);return{type:n,chart:t,native:i,x:s!==void 0?s:null,y:o!==void 0?o:null}}function nodeListContains(i,t){for(const n of i)if(n===t||n.contains(t))return!0}function createAttachObserver(i,t,n){const s=i.canvas,o=new MutationObserver(r=>{let l=!1;for(const a of r)l=l||nodeListContains(a.addedNodes,s),l=l&&!nodeListContains(a.removedNodes,s);l&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}function createDetachObserver(i,t,n){const s=i.canvas,o=new MutationObserver(r=>{let l=!1;for(const a of r)l=l||nodeListContains(a.removedNodes,s),l=l&&!nodeListContains(a.addedNodes,s);l&&n()});return o.observe(document,{childList:!0,subtree:!0}),o}const drpListeningCharts=new Map;let oldDevicePixelRatio=0;function onWindowResize(){const i=window.devicePixelRatio;i!==oldDevicePixelRatio&&(oldDevicePixelRatio=i,drpListeningCharts.forEach((t,n)=>{n.currentDevicePixelRatio!==i&&t()}))}function listenDevicePixelRatioChanges(i,t){drpListeningCharts.size||window.addEventListener("resize",onWindowResize),drpListeningCharts.set(i,t)}function unlistenDevicePixelRatioChanges(i){drpListeningCharts.delete(i),drpListeningCharts.size||window.removeEventListener("resize",onWindowResize)}function createResizeObserver(i,t,n){const s=i.canvas,o=s&&_getParentNode(s);if(!o)return;const r=throttled((a,c)=>{const u=o.clientWidth;n(a,c),u{const c=a[0],u=c.contentRect.width,f=c.contentRect.height;u===0&&f===0||r(u,f)});return l.observe(o),listenDevicePixelRatioChanges(i,r),l}function releaseObserver(i,t,n){n&&n.disconnect(),t==="resize"&&unlistenDevicePixelRatioChanges(i)}function createProxyAndListen(i,t,n){const s=i.canvas,o=throttled(r=>{i.ctx!==null&&n(fromNativeEvent(r,i))},i);return addListener(s,t,o),o}class DomPlatform extends BasePlatform{acquireContext(t,n){const s=t&&t.getContext&&t.getContext("2d");return s&&s.canvas===t?(initCanvas(t,n),s):null}releaseContext(t){const n=t.canvas;if(!n[EXPANDO_KEY])return!1;const s=n[EXPANDO_KEY].initial;["height","width"].forEach(r=>{const l=s[r];isNullOrUndef(l)?n.removeAttribute(r):n.setAttribute(r,l)});const o=s.style||{};return Object.keys(o).forEach(r=>{n.style[r]=o[r]}),n.width=n.width,delete n[EXPANDO_KEY],!0}addEventListener(t,n,s){this.removeEventListener(t,n);const o=t.$proxies||(t.$proxies={}),l={attach:createAttachObserver,detach:createDetachObserver,resize:createResizeObserver}[n]||createProxyAndListen;o[n]=l(t,n,s)}removeEventListener(t,n){const s=t.$proxies||(t.$proxies={}),o=s[n];if(!o)return;({attach:releaseObserver,detach:releaseObserver,resize:releaseObserver}[n]||removeListener)(t,n,o),s[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,s,o){return getMaximumSize(t,n,s,o)}isAttached(t){const n=_getParentNode(t);return!!(n&&n.isConnected)}}function _detectPlatform(i){return!_isDomSupported()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?BasicPlatform:DomPlatform}var Bi;let Element$1=(Bi=class{constructor(){xe(this,"x");xe(this,"y");xe(this,"active",!1);xe(this,"options");xe(this,"$animations")}tooltipPosition(t){const{x:n,y:s}=this.getProps(["x","y"],t);return{x:n,y:s}}hasValue(){return isNumber(this.x)&&isNumber(this.y)}getProps(t,n){const s=this.$animations;if(!n||!s)return this;const o={};return t.forEach(r=>{o[r]=s[r]&&s[r].active()?s[r]._to:this[r]}),o}},xe(Bi,"defaults",{}),xe(Bi,"defaultRoutes"),Bi);function autoSkip(i,t){const n=i.options.ticks,s=determineMaxTicks(i),o=Math.min(n.maxTicksLimit||s,s),r=n.major.enabled?getMajorIndices(t):[],l=r.length,a=r[0],c=r[l-1],u=[];if(l>o)return skipMajors(t,u,r,l/o),u;const f=calculateSpacing(r,t,o);if(l>0){let h,p;const m=l>1?Math.round((c-a)/(l-1)):null;for(skip(t,u,f,isNullOrUndef(m)?0:a-m,a),h=0,p=l-1;ho)return c}return Math.max(o,1)}function getMajorIndices(i){const t=[];let n,s;for(n=0,s=i.length;ni==="left"?"right":i==="right"?"left":i,offsetFromEdge=(i,t,n)=>t==="top"||t==="left"?i[t]+n:i[t]-n,getTicksLimit=(i,t)=>Math.min(t||i,i);function sample(i,t){const n=[],s=i.length/t,o=i.length;let r=0;for(;rl+a)))return c}function garbageCollect(i,t){each(i,n=>{const s=n.gc,o=s.length/2;let r;if(o>t){for(r=0;rs?s:n,s=o&&n>s?n:s,{min:finiteOrDefault(n,finiteOrDefault(s,n)),max:finiteOrDefault(s,finiteOrDefault(n,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){callback(this.options.beforeUpdate,[this])}update(t,n,s){const{beginAtZero:o,grace:r,ticks:l}=this.options,a=l.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=n,this._margins=s=Object.assign({left:0,right:0,top:0,bottom:0},s),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+s.left+s.right:this.height+s.top+s.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=_addGrace(this,r,o),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const c=a=r||s<=1||!this.isHorizontal()){this.labelRotation=o;return}const f=this._getLabelSizes(),h=f.widest.width,p=f.highest.height,m=_limitValue(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/s:m/(s-1),h+6>a&&(a=m/(s-(t.offset?.5:1)),c=this.maxHeight-getTickMarkLength(t.grid)-n.padding-getTitleHeight(t.title,this.chart.options.font),u=Math.sqrt(h*h+p*p),l=toDegrees(Math.min(Math.asin(_limitValue((f.highest.height+6)/a,-1,1)),Math.asin(_limitValue(c/u,-1,1))-Math.asin(_limitValue(p/u,-1,1)))),l=Math.max(o,Math.min(r,l))),this.labelRotation=l}afterCalculateLabelRotation(){callback(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){callback(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:s,title:o,grid:r}}=this,l=this._isVisible(),a=this.isHorizontal();if(l){const c=getTitleHeight(o,n.options.font);if(a?(t.width=this.maxWidth,t.height=getTickMarkLength(r)+c):(t.height=this.maxHeight,t.width=getTickMarkLength(r)+c),s.display&&this.ticks.length){const{first:u,last:f,widest:h,highest:p}=this._getLabelSizes(),m=s.padding*2,b=toRadians(this.labelRotation),v=Math.cos(b),k=Math.sin(b);if(a){const w=s.mirror?0:k*h.width+v*p.height;t.height=Math.min(this.maxHeight,t.height+w+m)}else{const w=s.mirror?0:v*h.width+k*p.height;t.width=Math.min(this.maxWidth,t.width+w+m)}this._calculatePadding(u,f,k,v)}}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,s,o){const{ticks:{align:r,padding:l},position:a}=this.options,c=this.labelRotation!==0,u=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const f=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let p=0,m=0;c?u?(p=o*t.width,m=s*n.height):(p=s*t.height,m=o*n.width):r==="start"?m=n.width:r==="end"?p=t.width:r!=="inner"&&(p=t.width/2,m=n.width/2),this.paddingLeft=Math.max((p-f+l)*this.width/(this.width-f),0),this.paddingRight=Math.max((m-h+l)*this.width/(this.width-h),0)}else{let f=n.height/2,h=t.height/2;r==="start"?(f=0,h=t.height):r==="end"&&(f=n.height,h=0),this.paddingTop=f+l,this.paddingBottom=h+l}}_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(){callback(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,s;for(n=0,s=t.length;n({width:l[E]||0,height:a[E]||0});return{first:M(0),last:M(n-1),widest:M(A),highest:M(R),widths:l,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 _int16Range(this._alignToPixels?_alignPixel(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*o?a/s:c/o:c*o0}_computeGridLineItems(t){const n=this.axis,s=this.chart,o=this.options,{grid:r,position:l,border:a}=o,c=r.offset,u=this.isHorizontal(),h=this.ticks.length+(c?1:0),p=getTickMarkLength(r),m=[],b=a.setContext(this.getContext()),v=b.display?b.width:0,k=v/2,w=function(H){return _alignPixel(s,H,v)};let C,S,T,x,A,R,M,E,L,I,O,z;if(l==="top")C=w(this.bottom),R=this.bottom-p,E=C-k,I=w(t.top)+k,z=t.bottom;else if(l==="bottom")C=w(this.top),I=t.top,z=w(t.bottom)-k,R=C+k,E=this.top+p;else if(l==="left")C=w(this.right),A=this.right-p,M=C-k,L=w(t.left)+k,O=t.right;else if(l==="right")C=w(this.left),L=t.left,O=w(t.right)-k,A=C+k,M=this.left+p;else if(n==="x"){if(l==="center")C=w((t.top+t.bottom)/2+.5);else if(isObject(l)){const H=Object.keys(l)[0],D=l[H];C=w(this.chart.scales[H].getPixelForValue(D))}I=t.top,z=t.bottom,R=C+k,E=R+p}else if(n==="y"){if(l==="center")C=w((t.left+t.right)/2);else if(isObject(l)){const H=Object.keys(l)[0],D=l[H];C=w(this.chart.scales[H].getPixelForValue(D))}A=C-k,M=A-p,L=t.left,O=t.right}const N=valueOrDefault(o.ticks.maxTicksLimit,h),F=Math.max(1,Math.ceil(h/N));for(S=0;Sr.value===t);return o>=0?n.setContext(this.getContext(o)).lineWidth:0}drawGrid(t){const n=this.options.grid,s=this.ctx,o=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let r,l;const a=(c,u,f)=>{!f.width||!f.color||(s.save(),s.lineWidth=f.width,s.strokeStyle=f.color,s.setLineDash(f.borderDash||[]),s.lineDashOffset=f.borderDashOffset,s.beginPath(),s.moveTo(c.x,c.y),s.lineTo(u.x,u.y),s.stroke(),s.restore())};if(n.display)for(r=0,l=o.length;r{this.draw(r)}}]:[{z:s,draw:r=>{this.drawBackground(),this.drawGrid(r),this.drawTitle()}},{z:o,draw:()=>{this.drawBorder()}},{z:n,draw:r=>{this.drawLabels(r)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),s=this.axis+"AxisID",o=[];let r,l;for(r=0,l=n.length;r{const s=n.split("."),o=s.pop(),r=[i].concat(s).join("."),l=t[n].split("."),a=l.pop(),c=l.join(".");defaults.route(r,o,c,a)})}function isIChartComponent(i){return"id"in i&&"defaults"in i}class Registry{constructor(){this.controllers=new TypedRegistry(DatasetController,"datasets",!0),this.elements=new TypedRegistry(Element$1,"elements"),this.plugins=new TypedRegistry(Object,"plugins"),this.scales=new TypedRegistry(Scale,"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,s){[...n].forEach(o=>{const r=s||this._getRegistryForType(o);s||r.isForType(o)||r===this.plugins&&o.id?this._exec(t,r,o):each(o,l=>{const a=s||this._getRegistryForType(l);this._exec(t,a,l)})})}_exec(t,n,s){const o=_capitalize(t);callback(s["before"+o],[],s),n[t](s),callback(s["after"+o],[],s)}_getRegistryForType(t){for(let n=0;nr.filter(a=>!l.some(c=>a.plugin.id===c.plugin.id));this._notify(o(n,s),t,"stop"),this._notify(o(s,n),t,"start")}}function allPlugins(i){const t={},n=[],s=Object.keys(registry.plugins.items);for(let r=0;r1&&idMatchesAxis(i[0].toLowerCase());if(s)return s}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function getAxisFromDataset(i,t,n){if(n[t+"AxisID"]===i)return{axis:t}}function retrieveAxisFromDatasets(i,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(s=>s.xAxisID===i||s.yAxisID===i);if(n.length)return getAxisFromDataset(i,"x",n[0])||getAxisFromDataset(i,"y",n[0])}return{}}function mergeScaleConfig(i,t){const n=overrides[i.type]||{scales:{}},s=t.scales||{},o=getIndexAxis(i.type,t),r=Object.create(null);return Object.keys(s).forEach(l=>{const a=s[l];if(!isObject(a))return console.error(`Invalid scale configuration for scale: ${l}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${l}`);const c=determineAxis(l,a,retrieveAxisFromDatasets(l,i),defaults.scales[a.type]),u=getDefaultScaleIDFromAxis(c,o),f=n.scales||{};r[l]=mergeIf(Object.create(null),[{axis:c},a,f[c],f[u]])}),i.data.datasets.forEach(l=>{const a=l.type||i.type,c=l.indexAxis||getIndexAxis(a,t),f=(overrides[a]||{}).scales||{};Object.keys(f).forEach(h=>{const p=getAxisFromDefaultScaleID(h,c),m=l[p+"AxisID"]||p;r[m]=r[m]||Object.create(null),mergeIf(r[m],[{axis:p},s[m],f[h]])})}),Object.keys(r).forEach(l=>{const a=r[l];mergeIf(a,[defaults.scales[a.type],defaults.scale])}),r}function initOptions(i){const t=i.options||(i.options={});t.plugins=valueOrDefault(t.plugins,{}),t.scales=mergeScaleConfig(i,t)}function initData(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function initConfig(i){return i=i||{},i.data=initData(i.data),initOptions(i),i}const keyCache=new Map,keysCached=new Set;function cachedKeys(i,t){let n=keyCache.get(i);return n||(n=t(),keyCache.set(i,n),keysCached.add(n)),n}const addIfFound=(i,t,n)=>{const s=resolveObjectKey(t,n);s!==void 0&&i.add(s)};class Config{constructor(t){this._config=initConfig(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=initData(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(),initOptions(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return cachedKeys(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return cachedKeys(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return cachedKeys(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,s=this.type;return cachedKeys(`${s}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const s=this._scopeCache;let o=s.get(t);return(!o||n)&&(o=new Map,s.set(t,o)),o}getOptionScopes(t,n,s){const{options:o,type:r}=this,l=this._cachedScopes(t,s),a=l.get(n);if(a)return a;const c=new Set;n.forEach(f=>{t&&(c.add(t),f.forEach(h=>addIfFound(c,t,h))),f.forEach(h=>addIfFound(c,o,h)),f.forEach(h=>addIfFound(c,overrides[r]||{},h)),f.forEach(h=>addIfFound(c,defaults,h)),f.forEach(h=>addIfFound(c,descriptors,h))});const u=Array.from(c);return u.length===0&&u.push(Object.create(null)),keysCached.has(n)&&l.set(n,u),u}chartOptionScopes(){const{options:t,type:n}=this;return[t,overrides[n]||{},defaults.datasets[n]||{},{type:n},defaults,descriptors]}resolveNamedOptions(t,n,s,o=[""]){const r={$shared:!0},{resolver:l,subPrefixes:a}=getResolver(this._resolverCache,t,o);let c=l;if(needContext(l,n)){r.$shared=!1,s=isFunction(s)?s():s;const u=this.createResolver(t,s,a);c=_attachContext(l,s,u)}for(const u of n)r[u]=c[u];return r}createResolver(t,n,s=[""],o){const{resolver:r}=getResolver(this._resolverCache,t,s);return isObject(n)?_attachContext(r,n,void 0,o):r}}function getResolver(i,t,n){let s=i.get(t);s||(s=new Map,i.set(t,s));const o=n.join();let r=s.get(o);return r||(r={resolver:_createResolver(t,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},s.set(o,r)),r}const hasFunction=i=>isObject(i)&&Object.getOwnPropertyNames(i).reduce((t,n)=>t||isFunction(i[n]),!1);function needContext(i,t){const{isScriptable:n,isIndexable:s}=_descriptors(i);for(const o of t){const r=n(o),l=s(o),a=(l||r)&&i[o];if(r&&(isFunction(a)||hasFunction(a))||l&&isArray(a))return!0}return!1}var version="4.3.2";const KNOWN_POSITIONS=["top","bottom","left","right","chartArea"];function positionIsHorizontal(i,t){return i==="top"||i==="bottom"||KNOWN_POSITIONS.indexOf(i)===-1&&t==="x"}function compare2Level(i,t){return function(n,s){return n[i]===s[i]?n[t]-s[t]:n[i]-s[i]}}function onAnimationsComplete(i){const t=i.chart,n=t.options.animation;t.notifyPlugins("afterRender"),callback(n&&n.onComplete,[i],t)}function onAnimationProgress(i){const t=i.chart,n=t.options.animation;callback(n&&n.onProgress,[i],t)}function getCanvas(i){return _isDomSupported()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}const instances={},getChart=i=>{const t=getCanvas(i);return Object.values(instances).filter(n=>n.canvas===t).pop()};function moveNumericKeys(i,t,n){const s=Object.keys(i);for(const o of s){const r=+o;if(r>=t){const l=i[o];delete i[o],(n>0||r>t)&&(i[r+n]=l)}}}function determineLastEvent(i,t,n,s){return!n||i.type==="mouseout"?null:s?t:i}function getDatasetArea(i){const{xScale:t,yScale:n}=i;if(t&&n)return{left:t.left,right:t.right,top:n.top,bottom:n.bottom}}var ln;let Chart$1=(ln=class{static register(...t){registry.add(...t),invalidatePlugins()}static unregister(...t){registry.remove(...t),invalidatePlugins()}constructor(t,n){const s=this.config=new Config(n),o=getCanvas(t),r=getChart(o);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");const l=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||_detectPlatform(o)),this.platform.updateConfig(s);const a=this.platform.acquireContext(o,l.aspectRatio),c=a&&a.canvas,u=c&&c.height,f=c&&c.width;if(this.id=uid(),this.ctx=a,this.canvas=c,this.width=f,this.height=u,this._options=l,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 PluginService,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=debounce(h=>this.update(h),l.resizeDelay||0),this._dataChanges=[],instances[this.id]=this,!a||!c){console.error("Failed to create chart: can't acquire context from the given item");return}animator.listen(this,"complete",onAnimationsComplete),animator.listen(this,"progress",onAnimationProgress),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:s,height:o,_aspectRatio:r}=this;return isNullOrUndef(t)?n&&r?r:o?s/o: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 registry}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():retinaScale(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return clearCanvas(this.canvas,this.ctx),this}stop(){return animator.stop(this),this}resize(t,n){animator.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const s=this.options,o=this.canvas,r=s.maintainAspectRatio&&this.aspectRatio,l=this.platform.getMaximumSize(o,t,n,r),a=s.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=l.width,this.height=l.height,this._aspectRatio=this.aspectRatio,retinaScale(this,a,!0)&&(this.notifyPlugins("resize",{size:l}),callback(s.onResize,[this,l],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};each(n,(s,o)=>{s.id=o})}buildOrUpdateScales(){const t=this.options,n=t.scales,s=this.scales,o=Object.keys(s).reduce((l,a)=>(l[a]=!1,l),{});let r=[];n&&(r=r.concat(Object.keys(n).map(l=>{const a=n[l],c=determineAxis(l,a),u=c==="r",f=c==="x";return{options:a,dposition:u?"chartArea":f?"bottom":"left",dtype:u?"radialLinear":f?"category":"linear"}}))),each(r,l=>{const a=l.options,c=a.id,u=determineAxis(c,a),f=valueOrDefault(a.type,l.dtype);(a.position===void 0||positionIsHorizontal(a.position,u)!==positionIsHorizontal(l.dposition))&&(a.position=l.dposition),o[c]=!0;let h=null;if(c in s&&s[c].type===f)h=s[c];else{const p=registry.getScale(f);h=new p({id:c,type:f,ctx:this.ctx,chart:this}),s[h.id]=h}h.init(a,t)}),each(o,(l,a)=>{l||delete s[a]}),each(s,l=>{layouts.configure(this,l,l.options),layouts.addBox(this,l)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,s=t.length;if(t.sort((o,r)=>o.index-r.index),s>n){for(let o=n;on.length&&delete this._stacks,t.forEach((s,o)=>{n.filter(r=>r===s._dataset).length===0&&this._destroyDatasetMeta(o)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let s,o;for(this._removeUnreferencedMetasets(),s=0,o=n.length;s{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const n=this.config;n.update();const s=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;const r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let l=0;for(let u=0,f=this.data.datasets.length;u{u.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(compare2Level("z","_idx"));const{_active:a,_lastEvent:c}=this;c?this._eventHandler(c,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){each(this.scales,t=>{layouts.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!setsEqual(n,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:s,start:o,count:r}of n){const l=s==="_removeElements"?-r:r;moveNumericKeys(t,o,l)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,s=r=>new Set(t.filter(l=>l[0]===r).map((l,a)=>a+","+l.splice(1).join(","))),o=s(0);for(let r=1;rr.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;layouts.update(this,this.width,this.height,t);const n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],each(this.boxes,o=>{s&&o.position==="chartArea"||(o.configure&&o.configure(),this._layers.push(...o._layers()))},this),this._layers.forEach((o,r)=>{o._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,s=this.data.datasets.length;n=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,s=t._clip,o=!s.disabled,r=getDatasetArea(t)||this.chartArea,l={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",l)!==!1&&(o&&clipArea(n,{left:s.left===!1?0:r.left-s.left,right:s.right===!1?this.width:r.right+s.right,top:s.top===!1?0:r.top-s.top,bottom:s.bottom===!1?this.height:r.bottom+s.bottom}),t.controller.draw(),o&&unclipArea(n),l.cancelable=!1,this.notifyPlugins("afterDatasetDraw",l))}isPointInArea(t){return _isPointInArea(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,s,o){const r=Interaction.modes[n];return typeof r=="function"?r(this,t,s,o):[]}getDatasetMeta(t){const n=this.data.datasets[t],s=this._metasets;let o=s.filter(r=>r&&r._dataset===n).pop();return o||(o={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},s.push(o)),o}getContext(){return this.$context||(this.$context=createContext(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!n.hidden}setDatasetVisibility(t,n){const s=this.getDatasetMeta(t);s.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,s){const o=s?"show":"hide",r=this.getDatasetMeta(t),l=r.controller._resolveAnimations(void 0,o);defined(n)?(r.data[n].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),l.update(r,{visible:s}),this.update(a=>a.datasetIndex===t?o: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(),animator.remove(this),t=0,n=this.data.datasets.length;t{n.addEventListener(this,r,l),t[r]=l},o=(r,l,a)=>{r.offsetX=l,r.offsetY=a,this._eventHandler(r)};each(this.options.events,r=>s(r,o))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,s=(c,u)=>{n.addEventListener(this,c,u),t[c]=u},o=(c,u)=>{t[c]&&(n.removeEventListener(this,c,u),delete t[c])},r=(c,u)=>{this.canvas&&this.resize(c,u)};let l;const a=()=>{o("attach",a),this.attached=!0,this.resize(),s("resize",r),s("detach",l)};l=()=>{this.attached=!1,o("resize",r),this._stop(),this._resize(0,0),s("attach",a)},n.isAttached(this.canvas)?a():l()}unbindEvents(){each(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},each(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,s){const o=s?"set":"remove";let r,l,a,c;for(n==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+o+"DatasetHoverStyle"]()),a=0,c=t.length;a{const a=this.getDatasetMeta(r);if(!a)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:a.data[l],index:l}});!_elementsEqual(s,n)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,n))}notifyPlugins(t,n,s){return this._plugins.notify(this,t,n,s)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,s){const o=this.options.hover,r=(c,u)=>c.filter(f=>!u.some(h=>f.datasetIndex===h.datasetIndex&&f.index===h.index)),l=r(n,t),a=s?t:r(t,n);l.length&&this.updateHoverStyle(l,o.mode,!1),a.length&&o.mode&&this.updateHoverStyle(a,o.mode,!0)}_eventHandler(t,n){const s={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},o=l=>(l.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,o)===!1)return;const r=this._handleEvent(t,n,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,o),(r||s.changed)&&this.render(),this}_handleEvent(t,n,s){const{_active:o=[],options:r}=this,l=n,a=this._getActiveElements(t,o,s,l),c=_isClickEvent(t),u=determineLastEvent(t,this._lastEvent,s,c);s&&(this._lastEvent=null,callback(r.onHover,[t,a,this],this),c&&callback(r.onClick,[t,a,this],this));const f=!_elementsEqual(a,o);return(f||n)&&(this._active=a,this._updateHoverStyles(a,o,n)),this._lastEvent=u,f}_getActiveElements(t,n,s,o){if(t.type==="mouseout")return[];if(!s)return n;const r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,o)}},xe(ln,"defaults",defaults),xe(ln,"instances",instances),xe(ln,"overrides",overrides),xe(ln,"registry",registry),xe(ln,"version",version),xe(ln,"getChart",getChart),ln);function invalidatePlugins(){return each(Chart$1.instances,i=>i._plugins.invalidate())}function clipArc(i,t,n){const{startAngle:s,pixelMargin:o,x:r,y:l,outerRadius:a,innerRadius:c}=t;let u=o/a;i.beginPath(),i.arc(r,l,a,s-u,n+u),c>o?(u=o/c,i.arc(r,l,c,n+u,s-u,!0)):i.arc(r,l,o,n+HALF_PI,s-HALF_PI),i.closePath(),i.clip()}function toRadiusCorners(i){return _readValueToProps(i,["outerStart","outerEnd","innerStart","innerEnd"])}function parseBorderRadius$1(i,t,n,s){const o=toRadiusCorners(i.options.borderRadius),r=(n-t)/2,l=Math.min(r,s*t/2),a=c=>{const u=(n-Math.min(r,c))*s/2;return _limitValue(c,0,Math.min(r,u))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:_limitValue(o.innerStart,0,l),innerEnd:_limitValue(o.innerEnd,0,l)}}function rThetaToXY(i,t,n,s){return{x:n+i*Math.cos(t),y:s+i*Math.sin(t)}}function pathArc(i,t,n,s,o,r){const{x:l,y:a,startAngle:c,pixelMargin:u,innerRadius:f}=t,h=Math.max(t.outerRadius+s+n-u,0),p=f>0?f+s+n+u:0;let m=0;const b=o-c;if(s){const F=f>0?f-s:0,H=h>0?h-s:0,D=(F+H)/2,G=D!==0?b*D/(D+s):b;m=(b-G)/2}const v=Math.max(.001,b*h-n/PI)/h,k=(b-v)/2,w=c+k+m,C=o-k-m,{outerStart:S,outerEnd:T,innerStart:x,innerEnd:A}=parseBorderRadius$1(t,p,h,C-w),R=h-S,M=h-T,E=w+S/R,L=C-T/M,I=p+x,O=p+A,z=w+x/I,N=C-A/O;if(i.beginPath(),r){const F=(E+L)/2;if(i.arc(l,a,h,E,F),i.arc(l,a,h,F,L),T>0){const V=rThetaToXY(M,L,l,a);i.arc(V.x,V.y,T,L,C+HALF_PI)}const H=rThetaToXY(O,C,l,a);if(i.lineTo(H.x,H.y),A>0){const V=rThetaToXY(O,N,l,a);i.arc(V.x,V.y,A,C+HALF_PI,N+Math.PI)}const D=(C-A/p+(w+x/p))/2;if(i.arc(l,a,p,C-A/p,D,!0),i.arc(l,a,p,D,w+x/p,!0),x>0){const V=rThetaToXY(I,z,l,a);i.arc(V.x,V.y,x,z+Math.PI,w-HALF_PI)}const G=rThetaToXY(R,w,l,a);if(i.lineTo(G.x,G.y),S>0){const V=rThetaToXY(R,E,l,a);i.arc(V.x,V.y,S,w-HALF_PI,E)}}else{i.moveTo(l,a);const F=Math.cos(E)*h+l,H=Math.sin(E)*h+a;i.lineTo(F,H);const D=Math.cos(L)*h+l,G=Math.sin(L)*h+a;i.lineTo(D,G)}i.closePath()}function drawArc(i,t,n,s,o){const{fullCircles:r,startAngle:l,circumference:a}=t;let c=t.endAngle;if(r){pathArc(i,t,n,s,c,o);for(let u=0;u=TAU||_angleBetween(l,c,u),k=_isBetween(a,f+m,h+m);return v&&k}getCenterPoint(n){const{x:s,y:o,startAngle:r,endAngle:l,innerRadius:a,outerRadius:c}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:u,spacing:f}=this.options,h=(r+l)/2,p=(a+c+f+u)/2;return{x:s+Math.cos(h)*p,y:o+Math.sin(h)*p}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:s,circumference:o}=this,r=(s.offset||0)/4,l=(s.spacing||0)/2,a=s.circular;if(this.pixelMargin=s.borderAlign==="inner"?.33:0,this.fullCircles=o>TAU?Math.floor(o/TAU):0,o===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const c=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(c)*r,Math.sin(c)*r);const u=1-Math.sin(Math.min(PI,o||0)),f=r*u;n.fillStyle=s.backgroundColor,n.strokeStyle=s.borderColor,drawArc(n,this,f,l,a),drawBorder(n,this,f,l,a),n.restore()}}xe(ArcElement,"id","arc"),xe(ArcElement,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),xe(ArcElement,"defaultRoutes",{backgroundColor:"backgroundColor"}),xe(ArcElement,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});const getBoxSize=(i,t)=>{let{boxHeight:n=t,boxWidth:s=t}=i;return i.usePointStyle&&(n=Math.min(n,t),s=i.pointStyleWidth||Math.min(s,t)),{boxWidth:s,boxHeight:n,itemHeight:Math.max(t,n)}},itemsEqual=(i,t)=>i!==null&&t!==null&&i.datasetIndex===t.datasetIndex&&i.index===t.index;class Legend extends Element$1{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,s){this.maxWidth=t,this.maxHeight=n,this._margins=s,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let n=callback(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(s=>t.filter(s,this.chart.data))),t.sort&&(n=n.sort((s,o)=>t.sort(s,o,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 s=t.labels,o=toFont(s.font),r=o.size,l=this._computeTitleHeight(),{boxWidth:a,itemHeight:c}=getBoxSize(s,r);let u,f;n.font=o.string,this.isHorizontal()?(u=this.maxWidth,f=this._fitRows(l,r,a,c)+10):(f=this.maxHeight,u=this._fitCols(l,o,a,c)+10),this.width=Math.min(u,t.maxWidth||this.maxWidth),this.height=Math.min(f,t.maxHeight||this.maxHeight)}_fitRows(t,n,s,o){const{ctx:r,maxWidth:l,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],u=this.lineWidths=[0],f=o+a;let h=t;r.textAlign="left",r.textBaseline="middle";let p=-1,m=-f;return this.legendItems.forEach((b,v)=>{const k=s+n/2+r.measureText(b.text).width;(v===0||u[u.length-1]+k+2*a>l)&&(h+=f,u[u.length-(v>0?0:1)]=0,m+=f,p++),c[v]={left:0,top:m,row:p,width:k,height:o},u[u.length-1]+=k+a}),h}_fitCols(t,n,s,o){const{ctx:r,maxHeight:l,options:{labels:{padding:a}}}=this,c=this.legendHitBoxes=[],u=this.columnSizes=[],f=l-t;let h=a,p=0,m=0,b=0,v=0;return this.legendItems.forEach((k,w)=>{const{itemWidth:C,itemHeight:S}=calculateItemSize(s,n,r,k,o);w>0&&m+S+2*a>f&&(h+=p+a,u.push({width:p,height:m}),b+=p+a,v++,p=m=0),c[w]={left:b,top:m,col:v,width:C,height:S},p=Math.max(p,C),m+=S+a}),h+=p,u.push({width:p,height:m}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:s,labels:{padding:o},rtl:r}}=this,l=getRtlAdapter(r,this.left,this.width);if(this.isHorizontal()){let a=0,c=_alignStartEnd(s,this.left+o,this.right-this.lineWidths[a]);for(const u of n)a!==u.row&&(a=u.row,c=_alignStartEnd(s,this.left+o,this.right-this.lineWidths[a])),u.top+=this.top+t+o,u.left=l.leftForLtr(l.x(c),u.width),c+=u.width+o}else{let a=0,c=_alignStartEnd(s,this.top+t+o,this.bottom-this.columnSizes[a].height);for(const u of n)u.col!==a&&(a=u.col,c=_alignStartEnd(s,this.top+t+o,this.bottom-this.columnSizes[a].height)),u.top=c,u.left+=this.left+o,u.left=l.leftForLtr(l.x(u.left),u.width),c+=u.height+o}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;clipArea(t,this),this._draw(),unclipArea(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:s,ctx:o}=this,{align:r,labels:l}=t,a=defaults.color,c=getRtlAdapter(t.rtl,this.left,this.width),u=toFont(l.font),{padding:f}=l,h=u.size,p=h/2;let m;this.drawTitle(),o.textAlign=c.textAlign("left"),o.textBaseline="middle",o.lineWidth=.5,o.font=u.string;const{boxWidth:b,boxHeight:v,itemHeight:k}=getBoxSize(l,h),w=function(A,R,M){if(isNaN(b)||b<=0||isNaN(v)||v<0)return;o.save();const E=valueOrDefault(M.lineWidth,1);if(o.fillStyle=valueOrDefault(M.fillStyle,a),o.lineCap=valueOrDefault(M.lineCap,"butt"),o.lineDashOffset=valueOrDefault(M.lineDashOffset,0),o.lineJoin=valueOrDefault(M.lineJoin,"miter"),o.lineWidth=E,o.strokeStyle=valueOrDefault(M.strokeStyle,a),o.setLineDash(valueOrDefault(M.lineDash,[])),l.usePointStyle){const L={radius:v*Math.SQRT2/2,pointStyle:M.pointStyle,rotation:M.rotation,borderWidth:E},I=c.xPlus(A,b/2),O=R+p;drawPointLegend(o,L,I,O,l.pointStyleWidth&&b)}else{const L=R+Math.max((h-v)/2,0),I=c.leftForLtr(A,b),O=toTRBLCorners(M.borderRadius);o.beginPath(),Object.values(O).some(z=>z!==0)?addRoundedRectPath(o,{x:I,y:L,w:b,h:v,radius:O}):o.rect(I,L,b,v),o.fill(),E!==0&&o.stroke()}o.restore()},C=function(A,R,M){renderText(o,M.text,A,R+k/2,u,{strikethrough:M.hidden,textAlign:c.textAlign(M.textAlign)})},S=this.isHorizontal(),T=this._computeTitleHeight();S?m={x:_alignStartEnd(r,this.left+f,this.right-s[0]),y:this.top+f+T,line:0}:m={x:this.left+f,y:_alignStartEnd(r,this.top+T+f,this.bottom-n[0].height),line:0},overrideTextDirection(this.ctx,t.textDirection);const x=k+f;this.legendItems.forEach((A,R)=>{o.strokeStyle=A.fontColor,o.fillStyle=A.fontColor;const M=o.measureText(A.text).width,E=c.textAlign(A.textAlign||(A.textAlign=l.textAlign)),L=b+p+M;let I=m.x,O=m.y;c.setWidth(this.width),S?R>0&&I+L+f>this.right&&(O=m.y+=x,m.line++,I=m.x=_alignStartEnd(r,this.left+f,this.right-s[m.line])):R>0&&O+x>this.bottom&&(I=m.x=I+n[m.line].width+f,m.line++,O=m.y=_alignStartEnd(r,this.top+T+f,this.bottom-n[m.line].height));const z=c.x(I);if(w(z,O,A),I=_textX(E,I+b+p,S?I+L:this.right,t.rtl),C(c.x(I),O,A),S)m.x+=L+f;else if(typeof A.text!="string"){const N=u.lineHeight;m.y+=calculateLegendItemHeight(A,N)+f}else m.y+=x}),restoreTextDirection(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,s=toFont(n.font),o=toPadding(n.padding);if(!n.display)return;const r=getRtlAdapter(t.rtl,this.left,this.width),l=this.ctx,a=n.position,c=s.size/2,u=o.top+c;let f,h=this.left,p=this.width;if(this.isHorizontal())p=Math.max(...this.lineWidths),f=this.top+u,h=_alignStartEnd(t.align,h,this.right-p);else{const b=this.columnSizes.reduce((v,k)=>Math.max(v,k.height),0);f=u+_alignStartEnd(t.align,this.top,this.bottom-b-t.labels.padding-this._computeTitleHeight())}const m=_alignStartEnd(a,h,h+p);l.textAlign=r.textAlign(_toLeftRightCenter(a)),l.textBaseline="middle",l.strokeStyle=n.color,l.fillStyle=n.color,l.font=s.string,renderText(l,n.text,m,f,s)}_computeTitleHeight(){const t=this.options.title,n=toFont(t.font),s=toPadding(t.padding);return t.display?n.lineHeight+s.height:0}_getLegendItemAt(t,n){let s,o,r;if(_isBetween(t,this.left,this.right)&&_isBetween(n,this.top,this.bottom)){for(r=this.legendHitBoxes,s=0;sr.length>l.length?r:l)),t+n.size/2+s.measureText(o).width}function calculateItemHeight(i,t,n){let s=i;return typeof t.text!="string"&&(s=calculateLegendItemHeight(t,n)),s}function calculateLegendItemHeight(i,t){const n=i.text?i.text.length:0;return t*n}function isListened(i,t){return!!((i==="mousemove"||i==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(i==="click"||i==="mouseup"))}var plugin_legend={id:"legend",_element:Legend,start(i,t,n){const s=i.legend=new Legend({ctx:i.ctx,options:n,chart:i});layouts.configure(i,s,n),layouts.addBox(i,s)},stop(i){layouts.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,t,n){const s=i.legend;layouts.configure(i,s,n),s.options=n},afterUpdate(i){const t=i.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(i,t){t.replay||i.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,t,n){const s=t.datasetIndex,o=n.chart;o.isDatasetVisible(s)?(o.hide(s),t.hidden=!0):(o.show(s),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){const t=i.data.datasets,{labels:{usePointStyle:n,pointStyle:s,textAlign:o,color:r,useBorderRadius:l,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(c=>{const u=c.controller.getStyle(n?0:void 0),f=toPadding(u.borderWidth);return{text:t[c.index].label,fillStyle:u.backgroundColor,fontColor:r,hidden:!c.visible,lineCap:u.borderCapStyle,lineDash:u.borderDash,lineDashOffset:u.borderDashOffset,lineJoin:u.borderJoinStyle,lineWidth:(f.width+f.height)/4,strokeStyle:u.borderColor,pointStyle:s||u.pointStyle,rotation:u.rotation,textAlign:o||u.textAlign,borderRadius:l&&(a||u.borderRadius),datasetIndex:c.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}};class Title extends Element$1{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 s=this.options;if(this.left=0,this.top=0,!s.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=n;const o=isArray(s.text)?s.text.length:1;this._padding=toPadding(s.padding);const r=o*toFont(s.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=r:this.width=r}isHorizontal(){const t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){const{top:n,left:s,bottom:o,right:r,options:l}=this,a=l.align;let c=0,u,f,h;return this.isHorizontal()?(f=_alignStartEnd(a,s,r),h=n+t,u=r-s):(l.position==="left"?(f=s+t,h=_alignStartEnd(a,o,n),c=PI*-.5):(f=r-t,h=_alignStartEnd(a,n,o),c=PI*.5),u=o-n),{titleX:f,titleY:h,maxWidth:u,rotation:c}}draw(){const t=this.ctx,n=this.options;if(!n.display)return;const s=toFont(n.font),r=s.lineHeight/2+this._padding.top,{titleX:l,titleY:a,maxWidth:c,rotation:u}=this._drawArgs(r);renderText(t,n.text,0,0,s,{color:n.color,maxWidth:c,rotation:u,textAlign:_toLeftRightCenter(n.align),textBaseline:"middle",translation:[l,a]})}}function createTitle(i,t){const n=new Title({ctx:i.ctx,options:t,chart:i});layouts.configure(i,n,t),layouts.addBox(i,n),i.titleBlock=n}var plugin_title={id:"title",_element:Title,start(i,t,n){createTitle(i,n)},stop(i){const t=i.titleBlock;layouts.removeBox(i,t),delete i.titleBlock},beforeUpdate(i,t,n){const s=i.titleBlock;layouts.configure(i,s,n),s.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 positioners={average(i){if(!i.length)return!1;let t,n,s=0,o=0,r=0;for(t=0,n=i.length;t-1?i.split(` -`):i}function createTooltipItem(i,t){const{element:n,datasetIndex:s,index:o}=t,r=i.getDatasetMeta(s).controller,{label:l,value:a}=r.getLabelAndValue(o);return{chart:i,label:l,parsed:r.getParsed(o),raw:i.data.datasets[s].data[o],formattedValue:a,dataset:r.getDataset(),dataIndex:o,datasetIndex:s,element:n}}function getTooltipSize(i,t){const n=i.chart.ctx,{body:s,footer:o,title:r}=i,{boxWidth:l,boxHeight:a}=t,c=toFont(t.bodyFont),u=toFont(t.titleFont),f=toFont(t.footerFont),h=r.length,p=o.length,m=s.length,b=toPadding(t.padding);let v=b.height,k=0,w=s.reduce((T,x)=>T+x.before.length+x.lines.length+x.after.length,0);if(w+=i.beforeBody.length+i.afterBody.length,h&&(v+=h*u.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),w){const T=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;v+=m*T+(w-m)*c.lineHeight+(w-1)*t.bodySpacing}p&&(v+=t.footerMarginTop+p*f.lineHeight+(p-1)*t.footerSpacing);let C=0;const S=function(T){k=Math.max(k,n.measureText(T).width+C)};return n.save(),n.font=u.string,each(i.title,S),n.font=c.string,each(i.beforeBody.concat(i.afterBody),S),C=t.displayColors?l+2+t.boxPadding:0,each(s,T=>{each(T.before,S),each(T.lines,S),each(T.after,S)}),C=0,n.font=f.string,each(i.footer,S),n.restore(),k+=b.width,{width:k,height:v}}function determineYAlign(i,t){const{y:n,height:s}=t;return ni.height-s/2?"bottom":"center"}function doesNotFitWithAlign(i,t,n,s){const{x:o,width:r}=s,l=n.caretSize+n.caretPadding;if(i==="left"&&o+r+l>t.width||i==="right"&&o-r-l<0)return!0}function determineXAlign(i,t,n,s){const{x:o,width:r}=n,{width:l,chartArea:{left:a,right:c}}=i;let u="center";return s==="center"?u=o<=(a+c)/2?"left":"right":o<=r/2?u="left":o>=l-r/2&&(u="right"),doesNotFitWithAlign(u,i,t,n)&&(u="center"),u}function determineAlignment(i,t,n){const s=n.yAlign||t.yAlign||determineYAlign(i,n);return{xAlign:n.xAlign||t.xAlign||determineXAlign(i,t,n,s),yAlign:s}}function alignX(i,t){let{x:n,width:s}=i;return t==="right"?n-=s:t==="center"&&(n-=s/2),n}function alignY(i,t,n){let{y:s,height:o}=i;return t==="top"?s+=n:t==="bottom"?s-=o+n:s-=o/2,s}function getBackgroundPoint(i,t,n,s){const{caretSize:o,caretPadding:r,cornerRadius:l}=i,{xAlign:a,yAlign:c}=n,u=o+r,{topLeft:f,topRight:h,bottomLeft:p,bottomRight:m}=toTRBLCorners(l);let b=alignX(t,a);const v=alignY(t,c,u);return c==="center"?a==="left"?b+=u:a==="right"&&(b-=u):a==="left"?b-=Math.max(f,p)+o:a==="right"&&(b+=Math.max(h,m)+o),{x:_limitValue(b,0,s.width-t.width),y:_limitValue(v,0,s.height-t.height)}}function getAlignedX(i,t,n){const s=toPadding(n.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function getBeforeAfterBodyLines(i){return pushOrConcat([],splitNewlines(i))}function createTooltipContext(i,t,n){return createContext(i,{tooltip:t,tooltipItems:n,type:"tooltip"})}function overrideCallbacks(i,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?i.override(n):i}const defaultCallbacks={beforeTitle:noop,title(i){if(i.length>0){const t=i[0],n=t.chart.data.labels,s=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?defaultCallbacks[t].call(n,s):o}class Tooltip extends Element$1{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,s=this.options.setContext(this.getContext()),o=s.enabled&&n.options.animation&&s.animations,r=new Animations(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=createTooltipContext(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:s}=n,o=invokeCallbackWithFallback(s,"beforeTitle",this,t),r=invokeCallbackWithFallback(s,"title",this,t),l=invokeCallbackWithFallback(s,"afterTitle",this,t);let a=[];return a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a=pushOrConcat(a,splitNewlines(l)),a}getBeforeBody(t,n){return getBeforeAfterBodyLines(invokeCallbackWithFallback(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:s}=n,o=[];return each(t,r=>{const l={before:[],lines:[],after:[]},a=overrideCallbacks(s,r);pushOrConcat(l.before,splitNewlines(invokeCallbackWithFallback(a,"beforeLabel",this,r))),pushOrConcat(l.lines,invokeCallbackWithFallback(a,"label",this,r)),pushOrConcat(l.after,splitNewlines(invokeCallbackWithFallback(a,"afterLabel",this,r))),o.push(l)}),o}getAfterBody(t,n){return getBeforeAfterBodyLines(invokeCallbackWithFallback(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:s}=n,o=invokeCallbackWithFallback(s,"beforeFooter",this,t),r=invokeCallbackWithFallback(s,"footer",this,t),l=invokeCallbackWithFallback(s,"afterFooter",this,t);let a=[];return a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a=pushOrConcat(a,splitNewlines(l)),a}_createItems(t){const n=this._active,s=this.chart.data,o=[],r=[],l=[];let a=[],c,u;for(c=0,u=n.length;ct.filter(f,h,p,s))),t.itemSort&&(a=a.sort((f,h)=>t.itemSort(f,h,s))),each(a,f=>{const h=overrideCallbacks(t.callbacks,f);o.push(invokeCallbackWithFallback(h,"labelColor",this,f)),r.push(invokeCallbackWithFallback(h,"labelPointStyle",this,f)),l.push(invokeCallbackWithFallback(h,"labelTextColor",this,f))}),this.labelColors=o,this.labelPointStyles=r,this.labelTextColors=l,this.dataPoints=a,a}update(t,n){const s=this.options.setContext(this.getContext()),o=this._active;let r,l=[];if(!o.length)this.opacity!==0&&(r={opacity:0});else{const a=positioners[s.position].call(this,o,this._eventPosition);l=this._createItems(s),this.title=this.getTitle(l,s),this.beforeBody=this.getBeforeBody(l,s),this.body=this.getBody(l,s),this.afterBody=this.getAfterBody(l,s),this.footer=this.getFooter(l,s);const c=this._size=getTooltipSize(this,s),u=Object.assign({},a,c),f=determineAlignment(this.chart,s,u),h=getBackgroundPoint(s,u,f,this.chart);this.xAlign=f.xAlign,this.yAlign=f.yAlign,r={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=l,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,s,o){const r=this.getCaretPosition(t,s,o);n.lineTo(r.x1,r.y1),n.lineTo(r.x2,r.y2),n.lineTo(r.x3,r.y3)}getCaretPosition(t,n,s){const{xAlign:o,yAlign:r}=this,{caretSize:l,cornerRadius:a}=s,{topLeft:c,topRight:u,bottomLeft:f,bottomRight:h}=toTRBLCorners(a),{x:p,y:m}=t,{width:b,height:v}=n;let k,w,C,S,T,x;return r==="center"?(T=m+v/2,o==="left"?(k=p,w=k-l,S=T+l,x=T-l):(k=p+b,w=k+l,S=T-l,x=T+l),C=k):(o==="left"?w=p+Math.max(c,f)+l:o==="right"?w=p+b-Math.max(u,h)-l:w=this.caretX,r==="top"?(S=m,T=S-l,k=w-l,C=w+l):(S=m+v,T=S+l,k=w+l,C=w-l),x=S),{x1:k,x2:w,x3:C,y1:S,y2:T,y3:x}}drawTitle(t,n,s){const o=this.title,r=o.length;let l,a,c;if(r){const u=getRtlAdapter(s.rtl,this.x,this.width);for(t.x=getAlignedX(this,s.titleAlign,s),n.textAlign=u.textAlign(s.titleAlign),n.textBaseline="middle",l=toFont(s.titleFont),a=s.titleSpacing,n.fillStyle=s.titleColor,n.font=l.string,c=0;cC!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,addRoundedRectPath(t,{x:v,y:b,w:u,h:c,radius:w}),t.fill(),t.stroke(),t.fillStyle=l.backgroundColor,t.beginPath(),addRoundedRectPath(t,{x:k,y:b+1,w:u-2,h:c-2,radius:w}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(v,b,u,c),t.strokeRect(v,b,u,c),t.fillStyle=l.backgroundColor,t.fillRect(k,b+1,u-2,c-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,n,s){const{body:o}=this,{bodySpacing:r,bodyAlign:l,displayColors:a,boxHeight:c,boxWidth:u,boxPadding:f}=s,h=toFont(s.bodyFont);let p=h.lineHeight,m=0;const b=getRtlAdapter(s.rtl,this.x,this.width),v=function(M){n.fillText(M,b.x(t.x+m),t.y+p/2),t.y+=p+r},k=b.textAlign(l);let w,C,S,T,x,A,R;for(n.textAlign=l,n.textBaseline="middle",n.font=h.string,t.x=getAlignedX(this,k,s),n.fillStyle=s.bodyColor,each(this.beforeBody,v),m=a&&k!=="right"?l==="center"?u/2+f:u+2+f:0,T=0,A=o.length;T0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,s=this.$animations,o=s&&s.x,r=s&&s.y;if(o||r){const l=positioners[t.position].call(this,this._active,this._eventPosition);if(!l)return;const a=this._size=getTooltipSize(this,t),c=Object.assign({},l,this._size),u=determineAlignment(n,t,c),f=getBackgroundPoint(t,c,u,n);(o._to!==f.x||r._to!==f.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=a.width,this.height=a.height,this.caretX=l.x,this.caretY=l.y,this._resolveAnimations().update(this,f))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(n);const o={width:this.width,height:this.height},r={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const l=toPadding(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=s,this.drawBackground(r,t,o,n),overrideTextDirection(t,n.textDirection),r.y+=l.top,this.drawTitle(r,t,n),this.drawBody(r,t,n),this.drawFooter(r,t,n),restoreTextDirection(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const s=this._active,o=t.map(({datasetIndex:a,index:c})=>{const u=this.chart.getDatasetMeta(a);if(!u)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:u.data[c],index:c}}),r=!_elementsEqual(s,o),l=this._positionChanged(o,n);(r||l)&&(this._active=o,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,s=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,r=this._active||[],l=this._getActiveElements(t,r,n,s),a=this._positionChanged(l,t),c=n||!_elementsEqual(l,r)||a;return c&&(this._active=l,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,s,o){const r=this.options;if(t.type==="mouseout")return[];if(!o)return n;const l=this.chart.getElementsAtEventForMode(t,r.mode,r,s);return r.reverse&&l.reverse(),l}_positionChanged(t,n){const{caretX:s,caretY:o,options:r}=this,l=positioners[r.position].call(this,t,n);return l!==!1&&(s!==l.x||o!==l.y)}}xe(Tooltip,"positioners",positioners);var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners,afterInit(i,t,n){n&&(i.tooltip=new Tooltip({chart:i,options:n}))},beforeUpdate(i,t,n){i.tooltip&&i.tooltip.initialize(n)},reset(i,t,n){i.tooltip&&i.tooltip.initialize(n)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",n)}},afterEvent(i,t){if(i.tooltip){const n=t.replay;i.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:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const addIfString=(i,t,n,s)=>(typeof t=="string"?(n=i.push(t)-1,s.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function findOrAddLabel(i,t,n,s){const o=i.indexOf(t);if(o===-1)return addIfString(i,t,n,s);const r=i.lastIndexOf(t);return o!==r?n:o}const validIndex=(i,t)=>i===null?null:_limitValue(Math.round(i),0,t);function _getLabelForValue(i){const t=this.getLabels();return i>=0&&in.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}xe(CategoryScale,"id","category"),xe(CategoryScale,"defaults",{ticks:{callback:_getLabelForValue}});function generateTicks$1(i,t){const n=[],{bounds:o,step:r,min:l,max:a,precision:c,count:u,maxTicks:f,maxDigits:h,includeBounds:p}=i,m=r||1,b=f-1,{min:v,max:k}=t,w=!isNullOrUndef(l),C=!isNullOrUndef(a),S=!isNullOrUndef(u),T=(k-v)/(h+1);let x=niceNum((k-v)/b/m)*m,A,R,M,E;if(x<1e-14&&!w&&!C)return[{value:v},{value:k}];E=Math.ceil(k/x)-Math.floor(v/x),E>b&&(x=niceNum(E*x/b/m)*m),isNullOrUndef(c)||(A=Math.pow(10,c),x=Math.ceil(x*A)/A),o==="ticks"?(R=Math.floor(v/x)*x,M=Math.ceil(k/x)*x):(R=v,M=k),w&&C&&r&&almostWhole((a-l)/r,x/1e3)?(E=Math.round(Math.min((a-l)/x,f)),x=(a-l)/E,R=l,M=a):S?(R=w?l:R,M=C?a:M,E=u-1,x=(M-R)/E):(E=(M-R)/x,almostEquals(E,Math.round(E),x/1e3)?E=Math.round(E):E=Math.ceil(E));const L=Math.max(_decimalPlaces(x),_decimalPlaces(R));A=Math.pow(10,isNullOrUndef(c)?L:c),R=Math.round(R*A)/A,M=Math.round(M*A)/A;let I=0;for(w&&(p&&R!==l?(n.push({value:l}),Ra)break;n.push({value:O})}return C&&p&&M!==a?n.length&&almostEquals(n[n.length-1].value,a,relativeLabelSize(a,T,i))?n[n.length-1].value=a:n.push({value:a}):(!C||M===a)&&n.push({value:M}),n}function relativeLabelSize(i,t,{horizontal:n,minRotation:s}){const o=toRadians(s),r=(n?Math.sin(o):Math.cos(o))||.001,l=.75*t*(""+i).length;return Math.min(t/r,l)}class LinearScaleBase extends Scale{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 isNullOrUndef(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:s}=this.getUserBounds();let{min:o,max:r}=this;const l=c=>o=n?o:c,a=c=>r=s?r:c;if(t){const c=sign(o),u=sign(r);c<0&&u<0?a(0):c>0&&u>0&&l(0)}if(o===r){let c=r===0?1:Math.abs(r*.05);a(r+c),t||l(o-c)}this.min=o,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:s}=t,o;return s?(o=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,o>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${o} ticks. Limiting to 1000.`),o=1e3)):(o=this.computeTickLimit(),n=n||11),n&&(o=Math.min(n,o)),o}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const o={maxTicks:s,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},r=this._range||this,l=generateTicks$1(o,r);return t.bounds==="ticks"&&_setMinAndMaxByKey(l,this,"value"),t.reverse?(l.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),l}configure(){const t=this.ticks;let n=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const o=(s-n)/Math.max(t.length-1,1)/2;n-=o,s+=o}this._startValue=n,this._endValue=s,this._valueRange=s-n}getLabelForValue(t){return formatNumber(t,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=isNumberFinite(t)?t:0,this.max=isNumberFinite(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,s=toRadians(this.options.ticks.minRotation),o=(t?Math.sin(s):Math.cos(s))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,r.lineHeight/o))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}xe(LinearScale,"id","linear"),xe(LinearScale,"defaults",{ticks:{callback:Ticks.formatters.numeric}});const log10Floor=i=>Math.floor(log10(i)),changeExponent=(i,t)=>Math.pow(10,log10Floor(i)+t);function isMajor(i){return i/Math.pow(10,log10Floor(i))===1}function steps(i,t,n){const s=Math.pow(10,n),o=Math.floor(i/s);return Math.ceil(t/s)-o}function startExp(i,t){const n=t-i;let s=log10Floor(n);for(;steps(i,t,s)>10;)s++;for(;steps(i,t,s)<10;)s--;return Math.min(s,log10Floor(i))}function generateTicks(i,{min:t,max:n}){t=finiteOrDefault(i.min,t);const s=[],o=log10Floor(t);let r=startExp(t,n),l=r<0?Math.pow(10,Math.abs(r)):1;const a=Math.pow(10,r),c=o>r?Math.pow(10,o):0,u=Math.round((t-c)*l)/l,f=Math.floor((t-c)/a/10)*a*10;let h=Math.floor((u-f)/Math.pow(10,r)),p=finiteOrDefault(i.min,Math.round((c+f+h*Math.pow(10,r))*l)/l);for(;p=10?h=h<15?15:20:h++,h>=20&&(r++,h=2,l=r>=0?1:l),p=Math.round((c+f+h*Math.pow(10,r))*l)/l;const m=finiteOrDefault(i.max,p);return s.push({value:m,major:isMajor(m),significand:h}),s}class LogarithmicScale extends Scale{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const s=LinearScaleBase.prototype.parse.apply(this,[t,n]);if(s===0){this._zero=!0;return}return isNumberFinite(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=isNumberFinite(t)?Math.max(0,t):null,this.max=isNumberFinite(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!isNumberFinite(this._userMin)&&(this.min=t===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let s=this.min,o=this.max;const r=a=>s=t?s:a,l=a=>o=n?o:a;s===o&&(s<=0?(r(1),l(10)):(r(changeExponent(s,-1)),l(changeExponent(o,1)))),s<=0&&r(changeExponent(o,-1)),o<=0&&l(changeExponent(s,1)),this.min=s,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},s=generateTicks(n,this);return t.bounds==="ticks"&&_setMinAndMaxByKey(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":formatNumber(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=log10(t),this._valueRange=log10(this.max)-log10(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(log10(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}xe(LogarithmicScale,"id","logarithmic"),xe(LogarithmicScale,"defaults",{ticks:{callback:Ticks.formatters.logarithmic,major:{enabled:!0}}});function getTickBackdropHeight(i){const t=i.ticks;if(t.display&&i.display){const n=toPadding(t.backdropPadding);return valueOrDefault(t.font&&t.font.size,defaults.font.size)+n.height}return 0}function measureLabelSize(i,t,n){return n=isArray(n)?n:[n],{w:_longestText(i,t.string,n),h:n.length*t.lineHeight}}function determineLimits(i,t,n,s,o){return i===s||i===o?{start:t-n/2,end:t+n/2}:io?{start:t-n,end:t}:{start:t,end:t+n}}function fitWithPointLabels(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},n=Object.assign({},t),s=[],o=[],r=i._pointLabels.length,l=i.options.pointLabels,a=l.centerPointLabels?PI/r:0;for(let c=0;ct.r&&(a=(s.end-t.r)/r,i.r=Math.max(i.r,t.r+a)),o.startt.b&&(c=(o.end-t.b)/l,i.b=Math.max(i.b,t.b+c))}function createPointLabelItem(i,t,n){const s=i.drawingArea,{extra:o,additionalAngle:r,padding:l,size:a}=n,c=i.getPointPosition(t,s+o+l,r),u=Math.round(toDegrees(_normalizeAngle(c.angle+HALF_PI))),f=yForAngle(c.y,a.h,u),h=getTextAlignForAngle(u),p=leftForTextAlign(c.x,a.w,h);return{visible:!0,x:c.x,y:f,textAlign:h,left:p,top:f,right:p+a.w,bottom:f+a.h}}function isNotOverlapped(i,t){if(!t)return!0;const{left:n,top:s,right:o,bottom:r}=i;return!(_isPointInArea({x:n,y:s},t)||_isPointInArea({x:n,y:r},t)||_isPointInArea({x:o,y:s},t)||_isPointInArea({x:o,y:r},t))}function buildPointLabelItems(i,t,n){const s=[],o=i._pointLabels.length,r=i.options,{centerPointLabels:l,display:a}=r.pointLabels,c={extra:getTickBackdropHeight(r)/2,additionalAngle:l?PI/o:0};let u;for(let f=0;f270||n<90)&&(i-=t),i}function drawPointLabelBox(i,t,n){const{left:s,top:o,right:r,bottom:l}=n,{backdropColor:a}=t;if(!isNullOrUndef(a)){const c=toTRBLCorners(t.borderRadius),u=toPadding(t.backdropPadding);i.fillStyle=a;const f=s-u.left,h=o-u.top,p=r-s+u.width,m=l-o+u.height;Object.values(c).some(b=>b!==0)?(i.beginPath(),addRoundedRectPath(i,{x:f,y:h,w:p,h:m,radius:c}),i.fill()):i.fillRect(f,h,p,m)}}function drawPointLabels(i,t){const{ctx:n,options:{pointLabels:s}}=i;for(let o=t-1;o>=0;o--){const r=i._pointLabelItems[o];if(!r.visible)continue;const l=s.setContext(i.getPointLabelContext(o));drawPointLabelBox(n,l,r);const a=toFont(l.font),{x:c,y:u,textAlign:f}=r;renderText(n,i._pointLabels[o],c,u+a.lineHeight/2,a,{color:l.color,textAlign:f,textBaseline:"middle"})}}function pathRadiusLine(i,t,n,s){const{ctx:o}=i;if(n)o.arc(i.xCenter,i.yCenter,t,0,TAU);else{let r=i.getPointPosition(0,t);o.moveTo(r.x,r.y);for(let l=1;l{const o=callback(this.options.pointLabels.callback,[n,s],this);return o||o===0?o:""}).filter((n,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,s,o){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((s-o)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,s,o))}getIndexAngle(t){const n=TAU/(this._pointLabels.length||1),s=this.options.startAngle||0;return _normalizeAngle(t*n+toRadians(s))}getDistanceFromCenterForValue(t){if(isNullOrUndef(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(isNullOrUndef(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){c=this.getDistanceFromCenterForValue(f.value);const p=this.getContext(h),m=o.setContext(p),b=r.setContext(p);drawRadiusLine(this,m,c,l,b)}}),s.display){for(t.save(),a=l-1;a>=0;a--){const f=s.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:p}=f;!p||!h||(t.lineWidth=p,t.strokeStyle=h,t.setLineDash(f.borderDash),t.lineDashOffset=f.borderDashOffset,c=this.getDistanceFromCenterForValue(n.ticks.reverse?this.min:this.max),u=this.getPointPosition(a,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(u.x,u.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,s=n.ticks;if(!s.display)return;const o=this.getIndexAngle(0);let r,l;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(o),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&!n.reverse)return;const u=s.setContext(this.getContext(c)),f=toFont(u.font);if(r=this.getDistanceFromCenterForValue(this.ticks[c].value),u.showLabelBackdrop){t.font=f.string,l=t.measureText(a.label).width,t.fillStyle=u.backdropColor;const h=toPadding(u.backdropPadding);t.fillRect(-l/2-h.left,-r-f.size/2-h.top,l+h.width,f.size+h.height)}renderText(t,a.label,0,-r,f,{color:u.color,strokeColor:u.textStrokeColor,strokeWidth:u.textStrokeWidth})}),t.restore()}drawTitle(){}}xe(RadialLinearScale,"id","radialLinear"),xe(RadialLinearScale,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),xe(RadialLinearScale,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),xe(RadialLinearScale,"descriptors",{angleLines:{_fallback:"grid"}});const INTERVALS={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}},UNITS=Object.keys(INTERVALS);function sorter(i,t){return i-t}function parse(i,t){if(isNullOrUndef(t))return null;const n=i._adapter,{parser:s,round:o,isoWeekday:r}=i._parseOpts;let l=t;return typeof s=="function"&&(l=s(l)),isNumberFinite(l)||(l=typeof s=="string"?n.parse(l,s):n.parse(l)),l===null?null:(o&&(l=o==="week"&&(isNumber(r)||r===!0)?n.startOf(l,"isoWeek",r):n.startOf(l,o)),+l)}function determineUnitForAutoTicks(i,t,n,s){const o=UNITS.length;for(let r=UNITS.indexOf(i);r=UNITS.indexOf(n);r--){const l=UNITS[r];if(INTERVALS[l].common&&i._adapter.diff(o,s,l)>=t-1)return l}return UNITS[n?UNITS.indexOf(n):0]}function determineMajorUnit(i){for(let t=UNITS.indexOf(i)+1,n=UNITS.length;t=t?n[s]:n[o];i[r]=!0}}function setMajorTicks(i,t,n,s){const o=i._adapter,r=+o.startOf(t[0].value,s),l=t[t.length-1].value;let a,c;for(a=r;a<=l;a=+o.add(a,1,s))c=n[a],c>=0&&(t[c].major=!0);return t}function ticksFromTimestamps(i,t,n){const s=[],o={},r=t.length;let l,a;for(l=0;l+t.value))}initOffsets(t=[]){let n=0,s=0,o,r;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?n=1-o:n=(this.getDecimalForValue(t[1])-o)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?s=r:s=(r-this.getDecimalForValue(t[t.length-2]))/2);const l=t.length<3?.5:.25;n=_limitValue(n,0,l),s=_limitValue(s,0,l),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){const t=this._adapter,n=this.min,s=this.max,o=this.options,r=o.time,l=r.unit||determineUnitForAutoTicks(r.minUnit,n,s,this._getLabelCapacity(n)),a=valueOrDefault(o.ticks.stepSize,1),c=l==="week"?r.isoWeekday:!1,u=isNumber(c)||c===!0,f={};let h=n,p,m;if(u&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,u?"day":l),t.diff(s,n,l)>1e5*a)throw new Error(n+" and "+s+" are too far apart with stepSize of "+a+" "+l);const b=o.ticks.source==="data"&&this.getDataTimestamps();for(p=h,m=0;p+v)}getLabelForValue(t){const n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(t,s.tooltipFormat):n.format(t,s.displayFormats.datetime)}format(t,n){const o=this.options.time.displayFormats,r=this._unit,l=n||o[r];return this._adapter.format(t,l)}_tickFormatFunction(t,n,s,o){const r=this.options,l=r.ticks.callback;if(l)return callback(l,[t,n,s],this);const a=r.time.displayFormats,c=this._unit,u=this._majorUnit,f=c&&a[c],h=u&&a[u],p=s[n],m=u&&h&&p&&p.major;return this._adapter.format(t,o||(m?h:f))}generateTickLabels(t){let n,s,o;for(n=0,s=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,s;if(t.length)return t;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(n=0,s=o.length;n=i[s].pos&&t<=i[o].pos&&({lo:s,hi:o}=_lookupByKey(i,"pos",t)),{pos:r,time:a}=i[s],{pos:l,time:c}=i[o]):(t>=i[s].time&&t<=i[o].time&&({lo:s,hi:o}=_lookupByKey(i,"time",t)),{time:r,pos:a}=i[s],{time:l,pos:c}=i[o]);const u=l-r;return u?a+(c-a)*(t-r)/u:a}class TimeSeriesScale extends TimeScale{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=interpolate(n,this.min),this._tableRange=interpolate(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:s}=this,o=[],r=[];let l,a,c,u,f;for(l=0,a=t.length;l=n&&u<=s&&o.push(u);if(o.length<2)return[{time:n,pos:0},{time:s,pos:1}];for(l=0,a=o.length;lo-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),s=this.getLabelTimestamps();return n.length&&s.length?t=this.normalize(n.concat(s)):t=n.length?n:s,t=this._cache.all=t,t}getDecimalForValue(t){return(interpolate(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return interpolate(this._table,s*this._tableRange+this._minPos,!0)}}xe(TimeSeriesScale,"id","timeseries"),xe(TimeSeriesScale,"defaults",TimeScale.defaults);const eventPrefix=/^on/,events=[];Object.keys(globalThis).forEach(i=>{eventPrefix.test(i)&&events.push(i.replace(eventPrefix,""))});function useForwardEvents(i){const t=current_component,n=[];function s(o){bubble(t,o)}onMount(()=>{const o=i();events.forEach(o instanceof Element?r=>n.push(listen(o,r,s)):r=>n.push(o.$on(r,s)))}),onDestroy(()=>{for(;n.length;)n.pop()()})}function create_fragment$8(i){let t,n=[i[1]],s={};for(let o=0;o{n(2,c=new Chart$1(u,{type:s,data:o,options:r,plugins:l}))}),afterUpdate(()=>{c&&(n(2,c.data=o,c),Object.assign(c.options,r),c.update(a))}),onDestroy(()=>{c&&c.destroy(),n(2,c=null)}),useForwardEvents(()=>u);function h(p){binding_callbacks[p?"unshift":"push"](()=>{u=p,n(0,u)})}return i.$$set=p=>{n(9,t=assign(assign({},t),exclude_internal_props(p))),"type"in p&&n(3,s=p.type),"data"in p&&n(4,o=p.data),"options"in p&&n(5,r=p.options),"plugins"in p&&n(6,l=p.plugins),"updateMode"in p&&n(7,a=p.updateMode),"chart"in p&&n(2,c=p.chart)},t=exclude_internal_props(t),[u,f,c,s,o,r,l,a,h]}class Chart extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$8,create_fragment$8,safe_not_equal,{type:3,data:4,options:5,plugins:6,updateMode:7,chart:2})}}function create_fragment$7(i){let t,n,s;const o=[{type:"doughnut"},i[1]];function r(a){i[4](a)}let l={};for(let a=0;abind(t,"chart",r,i[0])),{c(){create_component(t.$$.fragment)},m(a,c){mount_component(t,a,c),s=!0},p(a,[c]){const u=c&2?get_spread_update(o,[o[0],get_spread_object(a[1])]):{};!n&&c&1&&(n=!0,u.chart=a[0],add_flush_callback(()=>n=!1)),t.$set(u)},i(a){s||(transition_in(t.$$.fragment,a),s=!0)},o(a){transition_out(t.$$.fragment,a),s=!1},d(a){i[3](null),destroy_component(t,a)}}}function instance$7(i,t,n){Chart$1.register(DoughnutController);let{chart:s=null}=t,o,r;useForwardEvents(()=>r);function l(c){binding_callbacks[c?"unshift":"push"](()=>{r=c,n(2,r)})}function a(c){s=c,n(0,s)}return i.$$set=c=>{n(5,t=assign(assign({},t),exclude_internal_props(c))),"chart"in c&&n(0,s=c.chart)},i.$$.update=()=>{n(1,o=t)},t=exclude_internal_props(t),[s,o,r,l,a]}class Doughnut extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$7,create_fragment$7,safe_not_equal,{chart:0})}}const NodeStats_svelte_svelte_type_style_lang="";function get_each_context(i,t,n){const s=i.slice();return s[15]=t[n],s}function create_default_slot$2(i){let t;return{c(){t=text("Get Stats")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_3$1(i){let t,n,s;return n=new ToastNotification$1({props:{title:"Error",subtitle:i[2]}}),n.$on("close",i[9]),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","stat svelte-yc2k2m")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,r){const l={};r&4&&(l.subtitle=o[2]),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_if_block_2$1(i){let t,n,s;return n=new Loading$1({props:{small:!0}}),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","loader")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_if_block$6(i){let t,n,s,o;const r=[create_if_block_1$3,create_else_block$6],l=[];function a(c,u){return c[4].length===1?0:1}return t=a(i),n=l[t]=r[t](i),{c(){n.c(),s=empty$1()},m(c,u){l[t].m(c,u),insert(c,s,u),o=!0},p(c,u){let f=t;t=a(c),t===f?l[t].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),n=l[t],n?n.p(c,u):(n=l[t]=r[t](c),n.c()),transition_in(n,1),n.m(s.parentNode,s))},i(c){o||(transition_in(n),o=!0)},o(c){transition_out(n),o=!1},d(c){l[t].d(c),c&&detach(s)}}}function create_else_block$6(i){let t,n,s=i[5],o=[];for(let l=0;ltransition_out(o[l],1,1,()=>{o[l]=null});return{c(){t=element("div");for(let l=0;l{A=null}),check_outros()),E[6]?R?L&64&&transition_in(R,1):(R=create_if_block_2$1(),R.c(),transition_in(R,1),R.m(o,v)):R&&(group_outros(),transition_out(R,1,1,()=>{R=null}),check_outros()),E[4]!==null?M?(M.p(E,L),L&16&&transition_in(M,1)):(M=create_if_block$6(E),M.c(),transition_in(M,1),M.m(w,null)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros()),(!S||L&2&&C!==(C=`display: ${E[1]?"block":"none"}`))&&attr(o,"style",C)},i(E){S||(transition_in(n.$$.fragment,E),transition_in(a.$$.fragment,E),transition_in(A),transition_in(R),transition_in(M),S=!0)},o(E){transition_out(n.$$.fragment,E),transition_out(a.$$.fragment,E),transition_out(A),transition_out(R),transition_out(M),S=!1},d(E){E&&detach(t),destroy_component(n),destroy_component(a),A&&A.d(),R&&R.d(),M&&M.d(),T=!1,x()}}}function instance$6(i,t,n){let s;component_subscribe(i,selectedNode,C=>n(11,s=C)),Chart$1.register(plugin_title,plugin_tooltip,plugin_legend,ArcElement,CategoryScale);let o=!1,r="",l,{nodeName:a=""}=t,c={container_name:"",cpu_total_usage:0,system_cpu_usage:0,memory_usage:0},u=0,f=[{...c}],h=v(),p=!1;function m(C){n(2,r=C),n(3,l=setTimeout(()=>{n(2,r=""),n(1,o=!1)},6e3))}async function b(){n(1,o=!0),n(6,p=!0),n(4,f=[{...c}]),n(5,h=[]);let C=[];if(s)C=await get_container_stat(`${s==null?void 0:s.name}.sphinx`),typeof C=="string"?m(C):n(4,f=[{container_name:C[0].container_name,cpu_total_usage:C[0].cpu_total_usage,system_cpu_usage:C[0].system_cpu_usage,memory_usage:C[0].memory_usage}]);else if(C=await get_container_stat(),typeof C=="string")m(C);else if(C.length>0){n(4,f=[]);for(let S=0;Su&&(u=f[T].memory_usage);let S=u*.1;u=Number(((u+S)/1e6).toFixed(2));for(let T=0;T{n(4,f=[{...c}])});const k=()=>n(1,o=!o),w=C=>{C.preventDefault(),n(2,r=""),n(3,l=null),n(1,o=!1)};return i.$$set=C=>{"nodeName"in C&&n(0,a=C.nodeName)},[a,o,r,l,f,h,p,b,k,w]}class NodeStats extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$6,create_fragment$6,safe_not_equal,{nodeName:0})}}const NodeAction_svelte_svelte_type_style_lang="";function create_else_block$5(i){let t,n;return t=new Button$1({props:{kind:"primary",disabled:i[0],class:"btn-start",iconDescription:`Start ${i[1].name}`,icon:Play,size:"field"}}),t.$on("click",i[6]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.disabled=s[0]),o&2&&(r.iconDescription=`Start ${s[1].name}`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$2(i){let t,n;return t=new InlineLoading$1({props:{description:`Restarting ${i[1].name}...`}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&2&&(r.description=`Restarting ${s[1].name}...`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$5(i){let t,n;return t=new Button$1({props:{kind:"secondary",disabled:i[0],class:"btn-stop",iconDescription:`Stop ${i[1].name}`,icon:Power,size:"field"}}),t.$on("click",i[5]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.disabled=s[0]),o&2&&(r.iconDescription=`Stop ${s[1].name}`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$5(i){let t,n,s,o;const r=[create_if_block$5,create_if_block_1$2,create_else_block$5],l=[];function a(c,u){return c[2]==="running"?0:c[2]==="restarting"?1:2}return n=a(i),s=l[n]=r[n](i),{c(){t=element("aside"),s.c(),attr(t,"class","node-action-wrap svelte-1ckxb2j")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n===f?l[n].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s?s.p(c,u):(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$5(i,t,n){let s,o;component_subscribe(i,selectedNode,b=>n(1,s=b)),component_subscribe(i,node_state,b=>n(2,o=b));let r=!1;const l=createEventDispatcher();function a(){s.name&&l("stop_message",{text:s.name})}function c(){s.name&&l("start_message",{text:s.name})}async function u(){const b=await list_containers();b&&containers.set(b)}async function f(b){n(0,r=!0),await start_container(b),u(),c(),n(0,r=!1)}async function h(b){n(0,r=!0),await stop_container(b),u(),a(),n(0,r=!1)}return[r,s,o,f,h,()=>h(`${s.name}.sphinx`),()=>f(`${s.name}.sphinx`)]}class NodeAction extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$5,create_fragment$5,safe_not_equal,{})}}const NodeUpdate_svelte_svelte_type_style_lang="";function create_else_block$4(i){let t,n;return t=new Button$1({props:{kind:"primary",disabled:i[0],class:"btn-stop",iconDescription:`Upgrade ${i[1].name}`,icon:Upgrade,size:"field"}}),t.$on("click",i[2]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.disabled=s[0]),o&2&&(r.iconDescription=`Upgrade ${s[1].name}`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$4(i){let t,n;return t=new InlineLoading$1({props:{description:`Updating ${i[1].name}...`}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&2&&(r.description=`Updating ${s[1].name}...`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$4(i){let t,n,s,o;const r=[create_if_block$4,create_else_block$4],l=[];function a(c,u){return c[0]?0:1}return n=a(i),s=l[n]=r[n](i),{c(){t=element("aside"),s.c(),attr(t,"class","node-action-wrap svelte-1ckxb2j")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n===f?l[n].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s?s.p(c,u):(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$4(i,t,n){let s;component_subscribe(i,selectedNode,l=>n(1,s=l));let o=!1;async function r(){let l=s.name;l&&(n(0,o=!0),await update_node(l),await getImageVersion(stack,selectedNode),n(0,o=!1))}return[o,s,r]}class NodeUpdate extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$4,create_fragment$4,safe_not_equal,{})}}const ChangePassword_svelte_svelte_type_style_lang="";function create_else_block$3(i){let t,n,s,o,r,l,a=i[4]&&create_if_block_1$1(i);return r=new Form$1({props:{$$slots:{default:[create_default_slot$1]},$$scope:{ctx:i}}}),r.$on("submit",i[12]),{c(){t=element("section"),n=element("h3"),n.textContent="Change your password",s=space(),a&&a.c(),o=space(),create_component(r.$$.fragment),attr(n,"class","header-text svelte-153kz09"),attr(t,"class","login-wrap svelte-153kz09")},m(c,u){insert(c,t,u),append(t,n),append(t,s),a&&a.m(t,null),append(t,o),mount_component(r,t,null),l=!0},p(c,u){c[4]?a?(a.p(c,u),u&16&&transition_in(a,1)):(a=create_if_block_1$1(c),a.c(),transition_in(a,1),a.m(t,o)):a&&(group_outros(),transition_out(a,1,1,()=>{a=null}),check_outros());const f={};u&16462&&(f.$$scope={dirty:u,ctx:c}),r.$set(f)},i(c){l||(transition_in(a),transition_in(r.$$.fragment,c),l=!0)},o(c){transition_out(a),transition_out(r.$$.fragment,c),l=!1},d(c){c&&detach(t),a&&a.d(),destroy_component(r)}}}function create_if_block$3(i){let t,n;return t=new Loading$1({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$1(i){let t,n;return t=new InlineNotification$1({props:{lowContrast:!0,kind:"success",title:"Success:",subtitle:"Your password has been changed.",timeout:3e3}}),t.$on("close",i[8]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot_1(i){let t;return{c(){t=text("Change Password")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_default_slot$1(i){let t,n,s,o,r,l,a,c,u,f,h,p,m,b,v,k,w,C;function S(E){i[9](E)}let T={labelText:"Old Password",placeholder:"Enter your old password",type:"password"};i[3]!==void 0&&(T.value=i[3]),t=new TextInput$1({props:T}),binding_callbacks.push(()=>bind(t,"value",S,i[3]));function x(E){i[10](E)}let A={labelText:"New Password",placeholder:"Enter your new password",type:"password"};i[2]!==void 0&&(A.value=i[2]),l=new TextInput$1({props:A}),binding_callbacks.push(()=>bind(l,"value",x,i[2]));function R(E){i[11](E)}let M={labelText:"Confirm Password",placeholder:"Confirm your password",type:"password"};return i[1]!==void 0&&(M.value=i[1]),h=new TextInput$1({props:M}),binding_callbacks.push(()=>bind(h,"value",R,i[1])),w=new Button$1({props:{disabled:i[6],class:"peer-btn",size:"field",type:"submit",icon:Password,$$slots:{default:[create_default_slot_1]},$$scope:{ctx:i}}}),w.$on("click",i[7]),{c(){create_component(t.$$.fragment),s=space(),o=element("div"),r=space(),create_component(l.$$.fragment),c=space(),u=element("div"),f=space(),create_component(h.$$.fragment),m=space(),b=element("div"),v=space(),k=element("center"),create_component(w.$$.fragment),attr(o,"class","spacer"),attr(u,"class","spacer"),attr(b,"class","spacer")},m(E,L){mount_component(t,E,L),insert(E,s,L),insert(E,o,L),insert(E,r,L),mount_component(l,E,L),insert(E,c,L),insert(E,u,L),insert(E,f,L),mount_component(h,E,L),insert(E,m,L),insert(E,b,L),insert(E,v,L),insert(E,k,L),mount_component(w,k,null),C=!0},p(E,L){const I={};!n&&L&8&&(n=!0,I.value=E[3],add_flush_callback(()=>n=!1)),t.$set(I);const O={};!a&&L&4&&(a=!0,O.value=E[2],add_flush_callback(()=>a=!1)),l.$set(O);const z={};!p&&L&2&&(p=!0,z.value=E[1],add_flush_callback(()=>p=!1)),h.$set(z);const N={};L&64&&(N.disabled=E[6]),L&16384&&(N.$$scope={dirty:L,ctx:E}),w.$set(N)},i(E){C||(transition_in(t.$$.fragment,E),transition_in(l.$$.fragment,E),transition_in(h.$$.fragment,E),transition_in(w.$$.fragment,E),C=!0)},o(E){transition_out(t.$$.fragment,E),transition_out(l.$$.fragment,E),transition_out(h.$$.fragment,E),transition_out(w.$$.fragment,E),C=!1},d(E){destroy_component(t,E),E&&detach(s),E&&detach(o),E&&detach(r),destroy_component(l,E),E&&detach(c),E&&detach(u),E&&detach(f),destroy_component(h,E),E&&detach(m),E&&detach(b),E&&detach(v),E&&detach(k),destroy_component(w)}}}function create_fragment$3(i){let t,n,s,o,r,l,a,c,u,f;s=new ArrowLeft({props:{size:32}});const h=[create_if_block$3,create_else_block$3],p=[];function m(b,v){return b[5]?0:1}return l=m(i),a=p[l]=h[l](i),{c(){t=element("main"),n=element("div"),create_component(s.$$.fragment),o=space(),r=element("div"),a.c(),attr(n,"class","back svelte-153kz09"),attr(r,"class","container svelte-153kz09"),attr(t,"class","svelte-153kz09")},m(b,v){insert(b,t,v),append(t,n),mount_component(s,n,null),append(t,o),append(t,r),p[l].m(r,null),c=!0,u||(f=[listen(n,"click",function(){is_function(i[0])&&i[0].apply(this,arguments)}),listen(n,"keypress",keypress_handler)],u=!0)},p(b,[v]){i=b;let k=l;l=m(i),l===k?p[l].p(i,v):(group_outros(),transition_out(p[k],1,1,()=>{p[k]=null}),check_outros(),a=p[l],a?a.p(i,v):(a=p[l]=h[l](i),a.c()),transition_in(a,1),a.m(r,null))},i(b){c||(transition_in(s.$$.fragment,b),transition_in(a),c=!0)},o(b){transition_out(s.$$.fragment,b),transition_out(a),c=!1},d(b){b&&detach(t),destroy_component(s),p[l].d(),u=!1,run_all(f)}}}const keypress_handler=()=>{};function instance$3(i,t,n){let s,o,r,l,a;component_subscribe(i,activeUser,w=>n(13,a=w));let{back:c=()=>{}}=t,u=!1,f=!1;async function h(){try{n(5,f=!0),await update_password(o,s,a)&&(n(4,u=!0),n(3,s=""),n(2,o=""),n(1,r="")),n(5,f=!1)}catch{n(5,f=!1)}}const p=w=>{w.preventDefault(),n(4,u=!1)};function m(w){s=w,n(3,s)}function b(w){o=w,n(2,o)}function v(w){r=w,n(1,r)}function k(w){bubble.call(this,i,w)}return i.$$set=w=>{"back"in w&&n(0,c=w.back)},i.$$.update=()=>{i.$$.dirty&14&&n(6,l=!s||!o||!r||o!==r)},n(3,s=""),n(2,o=""),n(1,r=""),[c,r,o,s,u,f,l,h,p,m,b,v,k]}class ChangePassword extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$3,create_fragment$3,safe_not_equal,{back:0})}}const RestartNode_svelte_svelte_type_style_lang="";function create_else_block$2(i){let t,n;return t=new Button$1({props:{kind:"primary",disabled:i[0],class:"btn-restart",iconDescription:`Restart ${i[1].name}`,icon:Restart,size:"field"}}),t.$on("click",i[2]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.disabled=s[0]),o&2&&(r.iconDescription=`Restart ${s[1].name}`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$2(i){let t,n;return t=new InlineLoading$1({props:{description:`Restarting ${i[1].name}...`}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&2&&(r.description=`Restarting ${s[1].name}...`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$2(i){let t,n,s,o;const r=[create_if_block$2,create_else_block$2],l=[];function a(c,u){return c[0]?0:1}return n=a(i),s=l[n]=r[n](i),{c(){t=element("aside"),s.c(),attr(t,"class","node-action-wrap svelte-1ckxb2j")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n===f?l[n].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s?s.p(c,u):(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$2(i,t,n){let s;component_subscribe(i,selectedNode,l=>n(1,s=l));let o=!1;async function r(){let l=s.name;l&&(console.log("restart!",l),n(0,o=!0),await restart_node(l),await getImageVersion(stack,selectedNode),n(0,o=!1))}return[o,s,r]}class RestartNode extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$2,create_fragment$2,safe_not_equal,{})}}const Dashboard_svelte_svelte_type_style_lang="";function create_if_block_5(i){let t,n;return t=new InlineLoading$1({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_4(i){let t,n,s,o,r,l,a,c;return t=new NodeLogs({props:{nodeName:i[1].name}}),s=new NodeAction({}),s.$on("stop_message",i[9]),s.$on("start_message",i[10]),r=new NodeUpdate({}),a=new RestartNode({}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment),o=space(),create_component(r.$$.fragment),l=space(),create_component(a.$$.fragment)},m(u,f){mount_component(t,u,f),insert(u,n,f),mount_component(s,u,f),insert(u,o,f),mount_component(r,u,f),insert(u,l,f),mount_component(a,u,f),c=!0},p(u,f){const h={};f&2&&(h.nodeName=u[1].name),t.$set(h)},i(u){c||(transition_in(t.$$.fragment,u),transition_in(s.$$.fragment,u),transition_in(r.$$.fragment,u),transition_in(a.$$.fragment,u),c=!0)},o(u){transition_out(t.$$.fragment,u),transition_out(s.$$.fragment,u),transition_out(r.$$.fragment,u),transition_out(a.$$.fragment,u),c=!1},d(u){destroy_component(t,u),u&&detach(n),destroy_component(s,u),u&&detach(o),destroy_component(r,u),u&&detach(l),destroy_component(a,u)}}}function create_if_block_3(i){let t,n;return t=new NodeStats({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot(i){let t,n,s,o,r,l;return t=new OverflowMenuItem$1({props:{text:"Update"}}),t.$on("click",i[7]),s=new OverflowMenuItem$1({props:{text:"Change Password"}}),s.$on("click",i[6]),r=new OverflowMenuItem$1({props:{text:"Logout"}}),r.$on("click",logoutUser),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment),o=space(),create_component(r.$$.fragment)},m(a,c){mount_component(t,a,c),insert(a,n,c),mount_component(s,a,c),insert(a,o,c),mount_component(r,a,c),l=!0},p:noop$2,i(a){l||(transition_in(t.$$.fragment,a),transition_in(s.$$.fragment,a),transition_in(r.$$.fragment,a),l=!0)},o(a){transition_out(t.$$.fragment,a),transition_out(s.$$.fragment,a),transition_out(r.$$.fragment,a),l=!1},d(a){destroy_component(t,a),a&&detach(n),destroy_component(s,a),a&&detach(o),destroy_component(r,a)}}}function create_if_block_1(i){let t,n,s,o,r;const l=[create_if_block_2,create_else_block$1],a=[];function c(u,f){return u[2].nodes.length?0:1}return t=c(i),n=a[t]=l[t](i),o=new Controller({props:{updateBody:i[8]}}),{c(){n.c(),s=space(),create_component(o.$$.fragment)},m(u,f){a[t].m(u,f),insert(u,s,f),mount_component(o,u,f),r=!0},p(u,f){let h=t;t=c(u),t===h?a[t].p(u,f):(group_outros(),transition_out(a[h],1,1,()=>{a[h]=null}),check_outros(),n=a[t],n?n.p(u,f):(n=a[t]=l[t](u),n.c()),transition_in(n,1),n.m(s.parentNode,s))},i(u){r||(transition_in(n),transition_in(o.$$.fragment,u),r=!0)},o(u){transition_out(n),transition_out(o.$$.fragment,u),r=!1},d(u){a[t].d(u),u&&detach(s),destroy_component(o,u)}}}function create_if_block$1(i){let t,n;return t=new ChangePassword({props:{back:i[5]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_else_block$1(i){let t,n,s,o;return s=new Loading$1({}),{c(){t=element("div"),n=text(`letting +`):i}function createTooltipItem(i,t){const{element:n,datasetIndex:s,index:o}=t,r=i.getDatasetMeta(s).controller,{label:l,value:a}=r.getLabelAndValue(o);return{chart:i,label:l,parsed:r.getParsed(o),raw:i.data.datasets[s].data[o],formattedValue:a,dataset:r.getDataset(),dataIndex:o,datasetIndex:s,element:n}}function getTooltipSize(i,t){const n=i.chart.ctx,{body:s,footer:o,title:r}=i,{boxWidth:l,boxHeight:a}=t,c=toFont(t.bodyFont),u=toFont(t.titleFont),f=toFont(t.footerFont),h=r.length,p=o.length,m=s.length,b=toPadding(t.padding);let v=b.height,k=0,w=s.reduce((T,x)=>T+x.before.length+x.lines.length+x.after.length,0);if(w+=i.beforeBody.length+i.afterBody.length,h&&(v+=h*u.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),w){const T=t.displayColors?Math.max(a,c.lineHeight):c.lineHeight;v+=m*T+(w-m)*c.lineHeight+(w-1)*t.bodySpacing}p&&(v+=t.footerMarginTop+p*f.lineHeight+(p-1)*t.footerSpacing);let C=0;const S=function(T){k=Math.max(k,n.measureText(T).width+C)};return n.save(),n.font=u.string,each(i.title,S),n.font=c.string,each(i.beforeBody.concat(i.afterBody),S),C=t.displayColors?l+2+t.boxPadding:0,each(s,T=>{each(T.before,S),each(T.lines,S),each(T.after,S)}),C=0,n.font=f.string,each(i.footer,S),n.restore(),k+=b.width,{width:k,height:v}}function determineYAlign(i,t){const{y:n,height:s}=t;return ni.height-s/2?"bottom":"center"}function doesNotFitWithAlign(i,t,n,s){const{x:o,width:r}=s,l=n.caretSize+n.caretPadding;if(i==="left"&&o+r+l>t.width||i==="right"&&o-r-l<0)return!0}function determineXAlign(i,t,n,s){const{x:o,width:r}=n,{width:l,chartArea:{left:a,right:c}}=i;let u="center";return s==="center"?u=o<=(a+c)/2?"left":"right":o<=r/2?u="left":o>=l-r/2&&(u="right"),doesNotFitWithAlign(u,i,t,n)&&(u="center"),u}function determineAlignment(i,t,n){const s=n.yAlign||t.yAlign||determineYAlign(i,n);return{xAlign:n.xAlign||t.xAlign||determineXAlign(i,t,n,s),yAlign:s}}function alignX(i,t){let{x:n,width:s}=i;return t==="right"?n-=s:t==="center"&&(n-=s/2),n}function alignY(i,t,n){let{y:s,height:o}=i;return t==="top"?s+=n:t==="bottom"?s-=o+n:s-=o/2,s}function getBackgroundPoint(i,t,n,s){const{caretSize:o,caretPadding:r,cornerRadius:l}=i,{xAlign:a,yAlign:c}=n,u=o+r,{topLeft:f,topRight:h,bottomLeft:p,bottomRight:m}=toTRBLCorners(l);let b=alignX(t,a);const v=alignY(t,c,u);return c==="center"?a==="left"?b+=u:a==="right"&&(b-=u):a==="left"?b-=Math.max(f,p)+o:a==="right"&&(b+=Math.max(h,m)+o),{x:_limitValue(b,0,s.width-t.width),y:_limitValue(v,0,s.height-t.height)}}function getAlignedX(i,t,n){const s=toPadding(n.padding);return t==="center"?i.x+i.width/2:t==="right"?i.x+i.width-s.right:i.x+s.left}function getBeforeAfterBodyLines(i){return pushOrConcat([],splitNewlines(i))}function createTooltipContext(i,t,n){return createContext(i,{tooltip:t,tooltipItems:n,type:"tooltip"})}function overrideCallbacks(i,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?i.override(n):i}const defaultCallbacks={beforeTitle:noop,title(i){if(i.length>0){const t=i[0],n=t.chart.data.labels,s=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(s>0&&t.dataIndex"u"?defaultCallbacks[t].call(n,s):o}class Tooltip extends Element$1{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,s=this.options.setContext(this.getContext()),o=s.enabled&&n.options.animation&&s.animations,r=new Animations(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=createTooltipContext(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:s}=n,o=invokeCallbackWithFallback(s,"beforeTitle",this,t),r=invokeCallbackWithFallback(s,"title",this,t),l=invokeCallbackWithFallback(s,"afterTitle",this,t);let a=[];return a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a=pushOrConcat(a,splitNewlines(l)),a}getBeforeBody(t,n){return getBeforeAfterBodyLines(invokeCallbackWithFallback(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:s}=n,o=[];return each(t,r=>{const l={before:[],lines:[],after:[]},a=overrideCallbacks(s,r);pushOrConcat(l.before,splitNewlines(invokeCallbackWithFallback(a,"beforeLabel",this,r))),pushOrConcat(l.lines,invokeCallbackWithFallback(a,"label",this,r)),pushOrConcat(l.after,splitNewlines(invokeCallbackWithFallback(a,"afterLabel",this,r))),o.push(l)}),o}getAfterBody(t,n){return getBeforeAfterBodyLines(invokeCallbackWithFallback(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:s}=n,o=invokeCallbackWithFallback(s,"beforeFooter",this,t),r=invokeCallbackWithFallback(s,"footer",this,t),l=invokeCallbackWithFallback(s,"afterFooter",this,t);let a=[];return a=pushOrConcat(a,splitNewlines(o)),a=pushOrConcat(a,splitNewlines(r)),a=pushOrConcat(a,splitNewlines(l)),a}_createItems(t){const n=this._active,s=this.chart.data,o=[],r=[],l=[];let a=[],c,u;for(c=0,u=n.length;ct.filter(f,h,p,s))),t.itemSort&&(a=a.sort((f,h)=>t.itemSort(f,h,s))),each(a,f=>{const h=overrideCallbacks(t.callbacks,f);o.push(invokeCallbackWithFallback(h,"labelColor",this,f)),r.push(invokeCallbackWithFallback(h,"labelPointStyle",this,f)),l.push(invokeCallbackWithFallback(h,"labelTextColor",this,f))}),this.labelColors=o,this.labelPointStyles=r,this.labelTextColors=l,this.dataPoints=a,a}update(t,n){const s=this.options.setContext(this.getContext()),o=this._active;let r,l=[];if(!o.length)this.opacity!==0&&(r={opacity:0});else{const a=positioners[s.position].call(this,o,this._eventPosition);l=this._createItems(s),this.title=this.getTitle(l,s),this.beforeBody=this.getBeforeBody(l,s),this.body=this.getBody(l,s),this.afterBody=this.getAfterBody(l,s),this.footer=this.getFooter(l,s);const c=this._size=getTooltipSize(this,s),u=Object.assign({},a,c),f=determineAlignment(this.chart,s,u),h=getBackgroundPoint(s,u,f,this.chart);this.xAlign=f.xAlign,this.yAlign=f.yAlign,r={opacity:1,x:h.x,y:h.y,width:c.width,height:c.height,caretX:a.x,caretY:a.y}}this._tooltipItems=l,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,s,o){const r=this.getCaretPosition(t,s,o);n.lineTo(r.x1,r.y1),n.lineTo(r.x2,r.y2),n.lineTo(r.x3,r.y3)}getCaretPosition(t,n,s){const{xAlign:o,yAlign:r}=this,{caretSize:l,cornerRadius:a}=s,{topLeft:c,topRight:u,bottomLeft:f,bottomRight:h}=toTRBLCorners(a),{x:p,y:m}=t,{width:b,height:v}=n;let k,w,C,S,T,x;return r==="center"?(T=m+v/2,o==="left"?(k=p,w=k-l,S=T+l,x=T-l):(k=p+b,w=k+l,S=T-l,x=T+l),C=k):(o==="left"?w=p+Math.max(c,f)+l:o==="right"?w=p+b-Math.max(u,h)-l:w=this.caretX,r==="top"?(S=m,T=S-l,k=w-l,C=w+l):(S=m+v,T=S+l,k=w+l,C=w-l),x=S),{x1:k,x2:w,x3:C,y1:S,y2:T,y3:x}}drawTitle(t,n,s){const o=this.title,r=o.length;let l,a,c;if(r){const u=getRtlAdapter(s.rtl,this.x,this.width);for(t.x=getAlignedX(this,s.titleAlign,s),n.textAlign=u.textAlign(s.titleAlign),n.textBaseline="middle",l=toFont(s.titleFont),a=s.titleSpacing,n.fillStyle=s.titleColor,n.font=l.string,c=0;cC!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,addRoundedRectPath(t,{x:v,y:b,w:u,h:c,radius:w}),t.fill(),t.stroke(),t.fillStyle=l.backgroundColor,t.beginPath(),addRoundedRectPath(t,{x:k,y:b+1,w:u-2,h:c-2,radius:w}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(v,b,u,c),t.strokeRect(v,b,u,c),t.fillStyle=l.backgroundColor,t.fillRect(k,b+1,u-2,c-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,n,s){const{body:o}=this,{bodySpacing:r,bodyAlign:l,displayColors:a,boxHeight:c,boxWidth:u,boxPadding:f}=s,h=toFont(s.bodyFont);let p=h.lineHeight,m=0;const b=getRtlAdapter(s.rtl,this.x,this.width),v=function(M){n.fillText(M,b.x(t.x+m),t.y+p/2),t.y+=p+r},k=b.textAlign(l);let w,C,S,T,x,A,R;for(n.textAlign=l,n.textBaseline="middle",n.font=h.string,t.x=getAlignedX(this,k,s),n.fillStyle=s.bodyColor,each(this.beforeBody,v),m=a&&k!=="right"?l==="center"?u/2+f:u+2+f:0,T=0,A=o.length;T0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,s=this.$animations,o=s&&s.x,r=s&&s.y;if(o||r){const l=positioners[t.position].call(this,this._active,this._eventPosition);if(!l)return;const a=this._size=getTooltipSize(this,t),c=Object.assign({},l,this._size),u=determineAlignment(n,t,c),f=getBackgroundPoint(t,c,u,n);(o._to!==f.x||r._to!==f.y)&&(this.xAlign=u.xAlign,this.yAlign=u.yAlign,this.width=a.width,this.height=a.height,this.caretX=l.x,this.caretY=l.y,this._resolveAnimations().update(this,f))}}_willRender(){return!!this.opacity}draw(t){const n=this.options.setContext(this.getContext());let s=this.opacity;if(!s)return;this._updateAnimationTarget(n);const o={width:this.width,height:this.height},r={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;const l=toPadding(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=s,this.drawBackground(r,t,o,n),overrideTextDirection(t,n.textDirection),r.y+=l.top,this.drawTitle(r,t,n),this.drawBody(r,t,n),this.drawFooter(r,t,n),restoreTextDirection(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const s=this._active,o=t.map(({datasetIndex:a,index:c})=>{const u=this.chart.getDatasetMeta(a);if(!u)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:u.data[c],index:c}}),r=!_elementsEqual(s,o),l=this._positionChanged(o,n);(r||l)&&(this._active=o,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,s=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const o=this.options,r=this._active||[],l=this._getActiveElements(t,r,n,s),a=this._positionChanged(l,t),c=n||!_elementsEqual(l,r)||a;return c&&(this._active=l,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,s,o){const r=this.options;if(t.type==="mouseout")return[];if(!o)return n;const l=this.chart.getElementsAtEventForMode(t,r.mode,r,s);return r.reverse&&l.reverse(),l}_positionChanged(t,n){const{caretX:s,caretY:o,options:r}=this,l=positioners[r.position].call(this,t,n);return l!==!1&&(s!==l.x||o!==l.y)}}xe(Tooltip,"positioners",positioners);var plugin_tooltip={id:"tooltip",_element:Tooltip,positioners,afterInit(i,t,n){n&&(i.tooltip=new Tooltip({chart:i,options:n}))},beforeUpdate(i,t,n){i.tooltip&&i.tooltip.initialize(n)},reset(i,t,n){i.tooltip&&i.tooltip.initialize(n)},afterDraw(i){const t=i.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(i.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",n)}},afterEvent(i,t){if(i.tooltip){const n=t.replay;i.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:(i,t)=>t.bodyFont.size,boxWidth:(i,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:defaultCallbacks},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const addIfString=(i,t,n,s)=>(typeof t=="string"?(n=i.push(t)-1,s.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function findOrAddLabel(i,t,n,s){const o=i.indexOf(t);if(o===-1)return addIfString(i,t,n,s);const r=i.lastIndexOf(t);return o!==r?n:o}const validIndex=(i,t)=>i===null?null:_limitValue(Math.round(i),0,t);function _getLabelForValue(i){const t=this.getLabels();return i>=0&&in.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}xe(CategoryScale,"id","category"),xe(CategoryScale,"defaults",{ticks:{callback:_getLabelForValue}});function generateTicks$1(i,t){const n=[],{bounds:o,step:r,min:l,max:a,precision:c,count:u,maxTicks:f,maxDigits:h,includeBounds:p}=i,m=r||1,b=f-1,{min:v,max:k}=t,w=!isNullOrUndef(l),C=!isNullOrUndef(a),S=!isNullOrUndef(u),T=(k-v)/(h+1);let x=niceNum((k-v)/b/m)*m,A,R,M,E;if(x<1e-14&&!w&&!C)return[{value:v},{value:k}];E=Math.ceil(k/x)-Math.floor(v/x),E>b&&(x=niceNum(E*x/b/m)*m),isNullOrUndef(c)||(A=Math.pow(10,c),x=Math.ceil(x*A)/A),o==="ticks"?(R=Math.floor(v/x)*x,M=Math.ceil(k/x)*x):(R=v,M=k),w&&C&&r&&almostWhole((a-l)/r,x/1e3)?(E=Math.round(Math.min((a-l)/x,f)),x=(a-l)/E,R=l,M=a):S?(R=w?l:R,M=C?a:M,E=u-1,x=(M-R)/E):(E=(M-R)/x,almostEquals(E,Math.round(E),x/1e3)?E=Math.round(E):E=Math.ceil(E));const L=Math.max(_decimalPlaces(x),_decimalPlaces(R));A=Math.pow(10,isNullOrUndef(c)?L:c),R=Math.round(R*A)/A,M=Math.round(M*A)/A;let I=0;for(w&&(p&&R!==l?(n.push({value:l}),Ra)break;n.push({value:O})}return C&&p&&M!==a?n.length&&almostEquals(n[n.length-1].value,a,relativeLabelSize(a,T,i))?n[n.length-1].value=a:n.push({value:a}):(!C||M===a)&&n.push({value:M}),n}function relativeLabelSize(i,t,{horizontal:n,minRotation:s}){const o=toRadians(s),r=(n?Math.sin(o):Math.cos(o))||.001,l=.75*t*(""+i).length;return Math.min(t/r,l)}class LinearScaleBase extends Scale{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 isNullOrUndef(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:s}=this.getUserBounds();let{min:o,max:r}=this;const l=c=>o=n?o:c,a=c=>r=s?r:c;if(t){const c=sign(o),u=sign(r);c<0&&u<0?a(0):c>0&&u>0&&l(0)}if(o===r){let c=r===0?1:Math.abs(r*.05);a(r+c),t||l(o-c)}this.min=o,this.max=r}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:s}=t,o;return s?(o=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,o>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${o} ticks. Limiting to 1000.`),o=1e3)):(o=this.computeTickLimit(),n=n||11),n&&(o=Math.min(n,o)),o}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,n=t.ticks;let s=this.getTickLimit();s=Math.max(2,s);const o={maxTicks:s,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},r=this._range||this,l=generateTicks$1(o,r);return t.bounds==="ticks"&&_setMinAndMaxByKey(l,this,"value"),t.reverse?(l.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),l}configure(){const t=this.ticks;let n=this.min,s=this.max;if(super.configure(),this.options.offset&&t.length){const o=(s-n)/Math.max(t.length-1,1)/2;n-=o,s+=o}this._startValue=n,this._endValue=s,this._valueRange=s-n}getLabelForValue(t){return formatNumber(t,this.chart.options.locale,this.options.ticks.format)}}class LinearScale extends LinearScaleBase{determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=isNumberFinite(t)?t:0,this.max=isNumberFinite(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,s=toRadians(this.options.ticks.minRotation),o=(t?Math.sin(s):Math.cos(s))||.001,r=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,r.lineHeight/o))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}xe(LinearScale,"id","linear"),xe(LinearScale,"defaults",{ticks:{callback:Ticks.formatters.numeric}});const log10Floor=i=>Math.floor(log10(i)),changeExponent=(i,t)=>Math.pow(10,log10Floor(i)+t);function isMajor(i){return i/Math.pow(10,log10Floor(i))===1}function steps(i,t,n){const s=Math.pow(10,n),o=Math.floor(i/s);return Math.ceil(t/s)-o}function startExp(i,t){const n=t-i;let s=log10Floor(n);for(;steps(i,t,s)>10;)s++;for(;steps(i,t,s)<10;)s--;return Math.min(s,log10Floor(i))}function generateTicks(i,{min:t,max:n}){t=finiteOrDefault(i.min,t);const s=[],o=log10Floor(t);let r=startExp(t,n),l=r<0?Math.pow(10,Math.abs(r)):1;const a=Math.pow(10,r),c=o>r?Math.pow(10,o):0,u=Math.round((t-c)*l)/l,f=Math.floor((t-c)/a/10)*a*10;let h=Math.floor((u-f)/Math.pow(10,r)),p=finiteOrDefault(i.min,Math.round((c+f+h*Math.pow(10,r))*l)/l);for(;p=10?h=h<15?15:20:h++,h>=20&&(r++,h=2,l=r>=0?1:l),p=Math.round((c+f+h*Math.pow(10,r))*l)/l;const m=finiteOrDefault(i.max,p);return s.push({value:m,major:isMajor(m),significand:h}),s}class LogarithmicScale extends Scale{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,n){const s=LinearScaleBase.prototype.parse.apply(this,[t,n]);if(s===0){this._zero=!0;return}return isNumberFinite(s)&&s>0?s:null}determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=isNumberFinite(t)?Math.max(0,t):null,this.max=isNumberFinite(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!isNumberFinite(this._userMin)&&(this.min=t===changeExponent(this.min,0)?changeExponent(this.min,-1):changeExponent(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let s=this.min,o=this.max;const r=a=>s=t?s:a,l=a=>o=n?o:a;s===o&&(s<=0?(r(1),l(10)):(r(changeExponent(s,-1)),l(changeExponent(o,1)))),s<=0&&r(changeExponent(o,-1)),o<=0&&l(changeExponent(s,1)),this.min=s,this.max=o}buildTicks(){const t=this.options,n={min:this._userMin,max:this._userMax},s=generateTicks(n,this);return t.bounds==="ticks"&&_setMinAndMaxByKey(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}getLabelForValue(t){return t===void 0?"0":formatNumber(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=log10(t),this._valueRange=log10(this.max)-log10(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(log10(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const n=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+n*this._valueRange)}}xe(LogarithmicScale,"id","logarithmic"),xe(LogarithmicScale,"defaults",{ticks:{callback:Ticks.formatters.logarithmic,major:{enabled:!0}}});function getTickBackdropHeight(i){const t=i.ticks;if(t.display&&i.display){const n=toPadding(t.backdropPadding);return valueOrDefault(t.font&&t.font.size,defaults.font.size)+n.height}return 0}function measureLabelSize(i,t,n){return n=isArray(n)?n:[n],{w:_longestText(i,t.string,n),h:n.length*t.lineHeight}}function determineLimits(i,t,n,s,o){return i===s||i===o?{start:t-n/2,end:t+n/2}:io?{start:t-n,end:t}:{start:t,end:t+n}}function fitWithPointLabels(i){const t={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},n=Object.assign({},t),s=[],o=[],r=i._pointLabels.length,l=i.options.pointLabels,a=l.centerPointLabels?PI/r:0;for(let c=0;ct.r&&(a=(s.end-t.r)/r,i.r=Math.max(i.r,t.r+a)),o.startt.b&&(c=(o.end-t.b)/l,i.b=Math.max(i.b,t.b+c))}function createPointLabelItem(i,t,n){const s=i.drawingArea,{extra:o,additionalAngle:r,padding:l,size:a}=n,c=i.getPointPosition(t,s+o+l,r),u=Math.round(toDegrees(_normalizeAngle(c.angle+HALF_PI))),f=yForAngle(c.y,a.h,u),h=getTextAlignForAngle(u),p=leftForTextAlign(c.x,a.w,h);return{visible:!0,x:c.x,y:f,textAlign:h,left:p,top:f,right:p+a.w,bottom:f+a.h}}function isNotOverlapped(i,t){if(!t)return!0;const{left:n,top:s,right:o,bottom:r}=i;return!(_isPointInArea({x:n,y:s},t)||_isPointInArea({x:n,y:r},t)||_isPointInArea({x:o,y:s},t)||_isPointInArea({x:o,y:r},t))}function buildPointLabelItems(i,t,n){const s=[],o=i._pointLabels.length,r=i.options,{centerPointLabels:l,display:a}=r.pointLabels,c={extra:getTickBackdropHeight(r)/2,additionalAngle:l?PI/o:0};let u;for(let f=0;f270||n<90)&&(i-=t),i}function drawPointLabelBox(i,t,n){const{left:s,top:o,right:r,bottom:l}=n,{backdropColor:a}=t;if(!isNullOrUndef(a)){const c=toTRBLCorners(t.borderRadius),u=toPadding(t.backdropPadding);i.fillStyle=a;const f=s-u.left,h=o-u.top,p=r-s+u.width,m=l-o+u.height;Object.values(c).some(b=>b!==0)?(i.beginPath(),addRoundedRectPath(i,{x:f,y:h,w:p,h:m,radius:c}),i.fill()):i.fillRect(f,h,p,m)}}function drawPointLabels(i,t){const{ctx:n,options:{pointLabels:s}}=i;for(let o=t-1;o>=0;o--){const r=i._pointLabelItems[o];if(!r.visible)continue;const l=s.setContext(i.getPointLabelContext(o));drawPointLabelBox(n,l,r);const a=toFont(l.font),{x:c,y:u,textAlign:f}=r;renderText(n,i._pointLabels[o],c,u+a.lineHeight/2,a,{color:l.color,textAlign:f,textBaseline:"middle"})}}function pathRadiusLine(i,t,n,s){const{ctx:o}=i;if(n)o.arc(i.xCenter,i.yCenter,t,0,TAU);else{let r=i.getPointPosition(0,t);o.moveTo(r.x,r.y);for(let l=1;l{const o=callback(this.options.pointLabels.callback,[n,s],this);return o||o===0?o:""}).filter((n,s)=>this.chart.getDataVisibility(s))}fit(){const t=this.options;t.display&&t.pointLabels.display?fitWithPointLabels(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,n,s,o){this.xCenter+=Math.floor((t-n)/2),this.yCenter+=Math.floor((s-o)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,n,s,o))}getIndexAngle(t){const n=TAU/(this._pointLabels.length||1),s=this.options.startAngle||0;return _normalizeAngle(t*n+toRadians(s))}getDistanceFromCenterForValue(t){if(isNullOrUndef(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(isNullOrUndef(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){c=this.getDistanceFromCenterForValue(f.value);const p=this.getContext(h),m=o.setContext(p),b=r.setContext(p);drawRadiusLine(this,m,c,l,b)}}),s.display){for(t.save(),a=l-1;a>=0;a--){const f=s.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:p}=f;!p||!h||(t.lineWidth=p,t.strokeStyle=h,t.setLineDash(f.borderDash),t.lineDashOffset=f.borderDashOffset,c=this.getDistanceFromCenterForValue(n.ticks.reverse?this.min:this.max),u=this.getPointPosition(a,c),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(u.x,u.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,n=this.options,s=n.ticks;if(!s.display)return;const o=this.getIndexAngle(0);let r,l;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(o),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,c)=>{if(c===0&&!n.reverse)return;const u=s.setContext(this.getContext(c)),f=toFont(u.font);if(r=this.getDistanceFromCenterForValue(this.ticks[c].value),u.showLabelBackdrop){t.font=f.string,l=t.measureText(a.label).width,t.fillStyle=u.backdropColor;const h=toPadding(u.backdropPadding);t.fillRect(-l/2-h.left,-r-f.size/2-h.top,l+h.width,f.size+h.height)}renderText(t,a.label,0,-r,f,{color:u.color,strokeColor:u.textStrokeColor,strokeWidth:u.textStrokeWidth})}),t.restore()}drawTitle(){}}xe(RadialLinearScale,"id","radialLinear"),xe(RadialLinearScale,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ticks.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),xe(RadialLinearScale,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),xe(RadialLinearScale,"descriptors",{angleLines:{_fallback:"grid"}});const INTERVALS={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}},UNITS=Object.keys(INTERVALS);function sorter(i,t){return i-t}function parse(i,t){if(isNullOrUndef(t))return null;const n=i._adapter,{parser:s,round:o,isoWeekday:r}=i._parseOpts;let l=t;return typeof s=="function"&&(l=s(l)),isNumberFinite(l)||(l=typeof s=="string"?n.parse(l,s):n.parse(l)),l===null?null:(o&&(l=o==="week"&&(isNumber(r)||r===!0)?n.startOf(l,"isoWeek",r):n.startOf(l,o)),+l)}function determineUnitForAutoTicks(i,t,n,s){const o=UNITS.length;for(let r=UNITS.indexOf(i);r=UNITS.indexOf(n);r--){const l=UNITS[r];if(INTERVALS[l].common&&i._adapter.diff(o,s,l)>=t-1)return l}return UNITS[n?UNITS.indexOf(n):0]}function determineMajorUnit(i){for(let t=UNITS.indexOf(i)+1,n=UNITS.length;t=t?n[s]:n[o];i[r]=!0}}function setMajorTicks(i,t,n,s){const o=i._adapter,r=+o.startOf(t[0].value,s),l=t[t.length-1].value;let a,c;for(a=r;a<=l;a=+o.add(a,1,s))c=n[a],c>=0&&(t[c].major=!0);return t}function ticksFromTimestamps(i,t,n){const s=[],o={},r=t.length;let l,a;for(l=0;l+t.value))}initOffsets(t=[]){let n=0,s=0,o,r;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?n=1-o:n=(this.getDecimalForValue(t[1])-o)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?s=r:s=(r-this.getDecimalForValue(t[t.length-2]))/2);const l=t.length<3?.5:.25;n=_limitValue(n,0,l),s=_limitValue(s,0,l),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){const t=this._adapter,n=this.min,s=this.max,o=this.options,r=o.time,l=r.unit||determineUnitForAutoTicks(r.minUnit,n,s,this._getLabelCapacity(n)),a=valueOrDefault(o.ticks.stepSize,1),c=l==="week"?r.isoWeekday:!1,u=isNumber(c)||c===!0,f={};let h=n,p,m;if(u&&(h=+t.startOf(h,"isoWeek",c)),h=+t.startOf(h,u?"day":l),t.diff(s,n,l)>1e5*a)throw new Error(n+" and "+s+" are too far apart with stepSize of "+a+" "+l);const b=o.ticks.source==="data"&&this.getDataTimestamps();for(p=h,m=0;p+v)}getLabelForValue(t){const n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(t,s.tooltipFormat):n.format(t,s.displayFormats.datetime)}format(t,n){const o=this.options.time.displayFormats,r=this._unit,l=n||o[r];return this._adapter.format(t,l)}_tickFormatFunction(t,n,s,o){const r=this.options,l=r.ticks.callback;if(l)return callback(l,[t,n,s],this);const a=r.time.displayFormats,c=this._unit,u=this._majorUnit,f=c&&a[c],h=u&&a[u],p=s[n],m=u&&h&&p&&p.major;return this._adapter.format(t,o||(m?h:f))}generateTickLabels(t){let n,s,o;for(n=0,s=t.length;n0?a:1}getDataTimestamps(){let t=this._cache.data||[],n,s;if(t.length)return t;const o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(n=0,s=o.length;n=i[s].pos&&t<=i[o].pos&&({lo:s,hi:o}=_lookupByKey(i,"pos",t)),{pos:r,time:a}=i[s],{pos:l,time:c}=i[o]):(t>=i[s].time&&t<=i[o].time&&({lo:s,hi:o}=_lookupByKey(i,"time",t)),{time:r,pos:a}=i[s],{time:l,pos:c}=i[o]);const u=l-r;return u?a+(c-a)*(t-r)/u:a}class TimeSeriesScale extends TimeScale{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=interpolate(n,this.min),this._tableRange=interpolate(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:s}=this,o=[],r=[];let l,a,c,u,f;for(l=0,a=t.length;l=n&&u<=s&&o.push(u);if(o.length<2)return[{time:n,pos:0},{time:s,pos:1}];for(l=0,a=o.length;lo-r)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),s=this.getLabelTimestamps();return n.length&&s.length?t=this.normalize(n.concat(s)):t=n.length?n:s,t=this._cache.all=t,t}getDecimalForValue(t){return(interpolate(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return interpolate(this._table,s*this._tableRange+this._minPos,!0)}}xe(TimeSeriesScale,"id","timeseries"),xe(TimeSeriesScale,"defaults",TimeScale.defaults);const eventPrefix=/^on/,events=[];Object.keys(globalThis).forEach(i=>{eventPrefix.test(i)&&events.push(i.replace(eventPrefix,""))});function useForwardEvents(i){const t=current_component,n=[];function s(o){bubble(t,o)}onMount(()=>{const o=i();events.forEach(o instanceof Element?r=>n.push(listen(o,r,s)):r=>n.push(o.$on(r,s)))}),onDestroy(()=>{for(;n.length;)n.pop()()})}function create_fragment$8(i){let t,n=[i[1]],s={};for(let o=0;o{n(2,c=new Chart$1(u,{type:s,data:o,options:r,plugins:l}))}),afterUpdate(()=>{c&&(n(2,c.data=o,c),Object.assign(c.options,r),c.update(a))}),onDestroy(()=>{c&&c.destroy(),n(2,c=null)}),useForwardEvents(()=>u);function h(p){binding_callbacks[p?"unshift":"push"](()=>{u=p,n(0,u)})}return i.$$set=p=>{n(9,t=assign(assign({},t),exclude_internal_props(p))),"type"in p&&n(3,s=p.type),"data"in p&&n(4,o=p.data),"options"in p&&n(5,r=p.options),"plugins"in p&&n(6,l=p.plugins),"updateMode"in p&&n(7,a=p.updateMode),"chart"in p&&n(2,c=p.chart)},t=exclude_internal_props(t),[u,f,c,s,o,r,l,a,h]}class Chart extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$8,create_fragment$8,safe_not_equal,{type:3,data:4,options:5,plugins:6,updateMode:7,chart:2})}}function create_fragment$7(i){let t,n,s;const o=[{type:"doughnut"},i[1]];function r(a){i[4](a)}let l={};for(let a=0;abind(t,"chart",r,i[0])),{c(){create_component(t.$$.fragment)},m(a,c){mount_component(t,a,c),s=!0},p(a,[c]){const u=c&2?get_spread_update(o,[o[0],get_spread_object(a[1])]):{};!n&&c&1&&(n=!0,u.chart=a[0],add_flush_callback(()=>n=!1)),t.$set(u)},i(a){s||(transition_in(t.$$.fragment,a),s=!0)},o(a){transition_out(t.$$.fragment,a),s=!1},d(a){i[3](null),destroy_component(t,a)}}}function instance$7(i,t,n){Chart$1.register(DoughnutController);let{chart:s=null}=t,o,r;useForwardEvents(()=>r);function l(c){binding_callbacks[c?"unshift":"push"](()=>{r=c,n(2,r)})}function a(c){s=c,n(0,s)}return i.$$set=c=>{n(5,t=assign(assign({},t),exclude_internal_props(c))),"chart"in c&&n(0,s=c.chart)},i.$$.update=()=>{n(1,o=t)},t=exclude_internal_props(t),[s,o,r,l,a]}class Doughnut extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$7,create_fragment$7,safe_not_equal,{chart:0})}}const NodeStats_svelte_svelte_type_style_lang="";function get_each_context(i,t,n){const s=i.slice();return s[15]=t[n],s}function create_default_slot$2(i){let t;return{c(){t=text("Get Stats")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_3$1(i){let t,n,s;return n=new ToastNotification$1({props:{title:"Error",subtitle:i[2]}}),n.$on("close",i[9]),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","stat svelte-yc2k2m")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,r){const l={};r&4&&(l.subtitle=o[2]),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_if_block_2$1(i){let t,n,s;return n=new Loading$1({props:{small:!0}}),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","loader")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_if_block$6(i){let t,n,s,o;const r=[create_if_block_1$3,create_else_block$6],l=[];function a(c,u){return c[4].length===1?0:1}return t=a(i),n=l[t]=r[t](i),{c(){n.c(),s=empty$1()},m(c,u){l[t].m(c,u),insert(c,s,u),o=!0},p(c,u){let f=t;t=a(c),t===f?l[t].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),n=l[t],n?n.p(c,u):(n=l[t]=r[t](c),n.c()),transition_in(n,1),n.m(s.parentNode,s))},i(c){o||(transition_in(n),o=!0)},o(c){transition_out(n),o=!1},d(c){l[t].d(c),c&&detach(s)}}}function create_else_block$6(i){let t,n,s=i[5],o=[];for(let l=0;ltransition_out(o[l],1,1,()=>{o[l]=null});return{c(){t=element("div");for(let l=0;l{A=null}),check_outros()),E[6]?R?L&64&&transition_in(R,1):(R=create_if_block_2$1(),R.c(),transition_in(R,1),R.m(o,v)):R&&(group_outros(),transition_out(R,1,1,()=>{R=null}),check_outros()),E[4]!==null?M?(M.p(E,L),L&16&&transition_in(M,1)):(M=create_if_block$6(E),M.c(),transition_in(M,1),M.m(w,null)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros()),(!S||L&2&&C!==(C=`display: ${E[1]?"block":"none"}`))&&attr(o,"style",C)},i(E){S||(transition_in(n.$$.fragment,E),transition_in(a.$$.fragment,E),transition_in(A),transition_in(R),transition_in(M),S=!0)},o(E){transition_out(n.$$.fragment,E),transition_out(a.$$.fragment,E),transition_out(A),transition_out(R),transition_out(M),S=!1},d(E){E&&detach(t),destroy_component(n),destroy_component(a),A&&A.d(),R&&R.d(),M&&M.d(),T=!1,x()}}}function instance$6(i,t,n){let s;component_subscribe(i,selectedNode,C=>n(11,s=C)),Chart$1.register(plugin_title,plugin_tooltip,plugin_legend,ArcElement,CategoryScale);let o=!1,r="",l,{nodeName:a=""}=t,c={container_name:"",cpu_total_usage:0,system_cpu_usage:0,memory_usage:0},u=0,f=[{...c}],h=v(),p=!1;function m(C){n(2,r=C),n(3,l=setTimeout(()=>{n(2,r=""),n(1,o=!1)},6e3))}async function b(){n(1,o=!0),n(6,p=!0),n(4,f=[{...c}]),n(5,h=[]);let C=[];if(s)C=await get_container_stat(`${s==null?void 0:s.name}.sphinx`),typeof C=="string"?m(C):n(4,f=[{container_name:C[0].container_name,cpu_total_usage:C[0].cpu_total_usage,system_cpu_usage:C[0].system_cpu_usage,memory_usage:C[0].memory_usage}]);else if(C=await get_container_stat(),typeof C=="string")m(C);else if(C.length>0){n(4,f=[]);for(let S=0;Su&&(u=f[T].memory_usage);let S=u*.1;u=Number(((u+S)/1e6).toFixed(2));for(let T=0;T{n(4,f=[{...c}])});const k=()=>n(1,o=!o),w=C=>{C.preventDefault(),n(2,r=""),n(3,l=null),n(1,o=!1)};return i.$$set=C=>{"nodeName"in C&&n(0,a=C.nodeName)},[a,o,r,l,f,h,p,b,k,w]}class NodeStats extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$6,create_fragment$6,safe_not_equal,{nodeName:0})}}const NodeAction_svelte_svelte_type_style_lang="";function create_else_block$5(i){let t,n;return t=new Button$1({props:{kind:"primary",disabled:i[0],class:"btn-start",iconDescription:`Start ${i[1].name}`,icon:Play,size:"field"}}),t.$on("click",i[6]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.disabled=s[0]),o&2&&(r.iconDescription=`Start ${s[1].name}`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$2(i){let t,n;return t=new InlineLoading$1({props:{description:`Restarting ${i[1].name}...`}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&2&&(r.description=`Restarting ${s[1].name}...`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$5(i){let t,n;return t=new Button$1({props:{kind:"secondary",disabled:i[0],class:"btn-stop",iconDescription:`Stop ${i[1].name}`,icon:Power,size:"field"}}),t.$on("click",i[5]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.disabled=s[0]),o&2&&(r.iconDescription=`Stop ${s[1].name}`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$5(i){let t,n,s,o;const r=[create_if_block$5,create_if_block_1$2,create_else_block$5],l=[];function a(c,u){return c[2]==="running"?0:c[2]==="restarting"?1:2}return n=a(i),s=l[n]=r[n](i),{c(){t=element("aside"),s.c(),attr(t,"class","node-action-wrap svelte-1ckxb2j")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n===f?l[n].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s?s.p(c,u):(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$5(i,t,n){let s,o;component_subscribe(i,selectedNode,b=>n(1,s=b)),component_subscribe(i,node_state,b=>n(2,o=b));let r=!1;const l=createEventDispatcher();function a(){s.name&&l("stop_message",{text:s.name})}function c(){s.name&&l("start_message",{text:s.name})}async function u(){const b=await list_containers();b&&containers.set(b)}async function f(b){n(0,r=!0),await start_container(b),u(),c(),n(0,r=!1)}async function h(b){n(0,r=!0),await stop_container(b),u(),a(),n(0,r=!1)}return[r,s,o,f,h,()=>h(`${s.name}.sphinx`),()=>f(`${s.name}.sphinx`)]}class NodeAction extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$5,create_fragment$5,safe_not_equal,{})}}const NodeUpdate_svelte_svelte_type_style_lang="";function create_else_block$4(i){let t,n;return t=new Button$1({props:{kind:"primary",disabled:i[0],class:"btn-stop",iconDescription:`Upgrade ${i[1].name}`,icon:Upgrade,size:"field"}}),t.$on("click",i[2]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.disabled=s[0]),o&2&&(r.iconDescription=`Upgrade ${s[1].name}`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$4(i){let t,n;return t=new InlineLoading$1({props:{description:`Updating ${i[1].name}...`}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&2&&(r.description=`Updating ${s[1].name}...`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$4(i){let t,n,s,o;const r=[create_if_block$4,create_else_block$4],l=[];function a(c,u){return c[0]?0:1}return n=a(i),s=l[n]=r[n](i),{c(){t=element("aside"),s.c(),attr(t,"class","node-action-wrap svelte-1ckxb2j")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n===f?l[n].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s?s.p(c,u):(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$4(i,t,n){let s;component_subscribe(i,selectedNode,a=>n(1,s=a));let o=!1,{updateBody:r=()=>{}}=t;async function l(){let a=s.name;a&&(n(0,o=!0),await update_node(a),await getImageVersion(stack,selectedNode),r(),n(0,o=!1))}return i.$$set=a=>{"updateBody"in a&&n(3,r=a.updateBody)},[o,s,l,r]}class NodeUpdate extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$4,create_fragment$4,safe_not_equal,{updateBody:3})}}const ChangePassword_svelte_svelte_type_style_lang="";function create_else_block$3(i){let t,n,s,o,r,l,a=i[4]&&create_if_block_1$1(i);return r=new Form$1({props:{$$slots:{default:[create_default_slot$1]},$$scope:{ctx:i}}}),r.$on("submit",i[12]),{c(){t=element("section"),n=element("h3"),n.textContent="Change your password",s=space(),a&&a.c(),o=space(),create_component(r.$$.fragment),attr(n,"class","header-text svelte-153kz09"),attr(t,"class","login-wrap svelte-153kz09")},m(c,u){insert(c,t,u),append(t,n),append(t,s),a&&a.m(t,null),append(t,o),mount_component(r,t,null),l=!0},p(c,u){c[4]?a?(a.p(c,u),u&16&&transition_in(a,1)):(a=create_if_block_1$1(c),a.c(),transition_in(a,1),a.m(t,o)):a&&(group_outros(),transition_out(a,1,1,()=>{a=null}),check_outros());const f={};u&16462&&(f.$$scope={dirty:u,ctx:c}),r.$set(f)},i(c){l||(transition_in(a),transition_in(r.$$.fragment,c),l=!0)},o(c){transition_out(a),transition_out(r.$$.fragment,c),l=!1},d(c){c&&detach(t),a&&a.d(),destroy_component(r)}}}function create_if_block$3(i){let t,n;return t=new Loading$1({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$1(i){let t,n;return t=new InlineNotification$1({props:{lowContrast:!0,kind:"success",title:"Success:",subtitle:"Your password has been changed.",timeout:3e3}}),t.$on("close",i[8]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot_1(i){let t;return{c(){t=text("Change Password")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_default_slot$1(i){let t,n,s,o,r,l,a,c,u,f,h,p,m,b,v,k,w,C;function S(E){i[9](E)}let T={labelText:"Old Password",placeholder:"Enter your old password",type:"password"};i[3]!==void 0&&(T.value=i[3]),t=new TextInput$1({props:T}),binding_callbacks.push(()=>bind(t,"value",S,i[3]));function x(E){i[10](E)}let A={labelText:"New Password",placeholder:"Enter your new password",type:"password"};i[2]!==void 0&&(A.value=i[2]),l=new TextInput$1({props:A}),binding_callbacks.push(()=>bind(l,"value",x,i[2]));function R(E){i[11](E)}let M={labelText:"Confirm Password",placeholder:"Confirm your password",type:"password"};return i[1]!==void 0&&(M.value=i[1]),h=new TextInput$1({props:M}),binding_callbacks.push(()=>bind(h,"value",R,i[1])),w=new Button$1({props:{disabled:i[6],class:"peer-btn",size:"field",type:"submit",icon:Password,$$slots:{default:[create_default_slot_1]},$$scope:{ctx:i}}}),w.$on("click",i[7]),{c(){create_component(t.$$.fragment),s=space(),o=element("div"),r=space(),create_component(l.$$.fragment),c=space(),u=element("div"),f=space(),create_component(h.$$.fragment),m=space(),b=element("div"),v=space(),k=element("center"),create_component(w.$$.fragment),attr(o,"class","spacer"),attr(u,"class","spacer"),attr(b,"class","spacer")},m(E,L){mount_component(t,E,L),insert(E,s,L),insert(E,o,L),insert(E,r,L),mount_component(l,E,L),insert(E,c,L),insert(E,u,L),insert(E,f,L),mount_component(h,E,L),insert(E,m,L),insert(E,b,L),insert(E,v,L),insert(E,k,L),mount_component(w,k,null),C=!0},p(E,L){const I={};!n&&L&8&&(n=!0,I.value=E[3],add_flush_callback(()=>n=!1)),t.$set(I);const O={};!a&&L&4&&(a=!0,O.value=E[2],add_flush_callback(()=>a=!1)),l.$set(O);const z={};!p&&L&2&&(p=!0,z.value=E[1],add_flush_callback(()=>p=!1)),h.$set(z);const N={};L&64&&(N.disabled=E[6]),L&16384&&(N.$$scope={dirty:L,ctx:E}),w.$set(N)},i(E){C||(transition_in(t.$$.fragment,E),transition_in(l.$$.fragment,E),transition_in(h.$$.fragment,E),transition_in(w.$$.fragment,E),C=!0)},o(E){transition_out(t.$$.fragment,E),transition_out(l.$$.fragment,E),transition_out(h.$$.fragment,E),transition_out(w.$$.fragment,E),C=!1},d(E){destroy_component(t,E),E&&detach(s),E&&detach(o),E&&detach(r),destroy_component(l,E),E&&detach(c),E&&detach(u),E&&detach(f),destroy_component(h,E),E&&detach(m),E&&detach(b),E&&detach(v),E&&detach(k),destroy_component(w)}}}function create_fragment$3(i){let t,n,s,o,r,l,a,c,u,f;s=new ArrowLeft({props:{size:32}});const h=[create_if_block$3,create_else_block$3],p=[];function m(b,v){return b[5]?0:1}return l=m(i),a=p[l]=h[l](i),{c(){t=element("main"),n=element("div"),create_component(s.$$.fragment),o=space(),r=element("div"),a.c(),attr(n,"class","back svelte-153kz09"),attr(r,"class","container svelte-153kz09"),attr(t,"class","svelte-153kz09")},m(b,v){insert(b,t,v),append(t,n),mount_component(s,n,null),append(t,o),append(t,r),p[l].m(r,null),c=!0,u||(f=[listen(n,"click",function(){is_function(i[0])&&i[0].apply(this,arguments)}),listen(n,"keypress",keypress_handler)],u=!0)},p(b,[v]){i=b;let k=l;l=m(i),l===k?p[l].p(i,v):(group_outros(),transition_out(p[k],1,1,()=>{p[k]=null}),check_outros(),a=p[l],a?a.p(i,v):(a=p[l]=h[l](i),a.c()),transition_in(a,1),a.m(r,null))},i(b){c||(transition_in(s.$$.fragment,b),transition_in(a),c=!0)},o(b){transition_out(s.$$.fragment,b),transition_out(a),c=!1},d(b){b&&detach(t),destroy_component(s),p[l].d(),u=!1,run_all(f)}}}const keypress_handler=()=>{};function instance$3(i,t,n){let s,o,r,l,a;component_subscribe(i,activeUser,w=>n(13,a=w));let{back:c=()=>{}}=t,u=!1,f=!1;async function h(){try{n(5,f=!0),await update_password(o,s,a)&&(n(4,u=!0),n(3,s=""),n(2,o=""),n(1,r="")),n(5,f=!1)}catch{n(5,f=!1)}}const p=w=>{w.preventDefault(),n(4,u=!1)};function m(w){s=w,n(3,s)}function b(w){o=w,n(2,o)}function v(w){r=w,n(1,r)}function k(w){bubble.call(this,i,w)}return i.$$set=w=>{"back"in w&&n(0,c=w.back)},i.$$.update=()=>{i.$$.dirty&14&&n(6,l=!s||!o||!r||o!==r)},n(3,s=""),n(2,o=""),n(1,r=""),[c,r,o,s,u,f,l,h,p,m,b,v,k]}class ChangePassword extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$3,create_fragment$3,safe_not_equal,{back:0})}}const RestartNode_svelte_svelte_type_style_lang="";function create_else_block$2(i){let t,n;return t=new Button$1({props:{kind:"primary",disabled:i[0],class:"btn-restart",iconDescription:`Restart ${i[1].name}`,icon:Restart,size:"field"}}),t.$on("click",i[2]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.disabled=s[0]),o&2&&(r.iconDescription=`Restart ${s[1].name}`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$2(i){let t,n;return t=new InlineLoading$1({props:{description:`Restarting ${i[1].name}...`}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&2&&(r.description=`Restarting ${s[1].name}...`),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$2(i){let t,n,s,o;const r=[create_if_block$2,create_else_block$2],l=[];function a(c,u){return c[0]?0:1}return n=a(i),s=l[n]=r[n](i),{c(){t=element("aside"),s.c(),attr(t,"class","node-action-wrap svelte-1ckxb2j")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n===f?l[n].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s?s.p(c,u):(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$2(i,t,n){let s;component_subscribe(i,selectedNode,l=>n(1,s=l));let o=!1;async function r(){let l=s.name;l&&(console.log("restart!",l),n(0,o=!0),await restart_node(l),await getImageVersion(stack,selectedNode),n(0,o=!1))}return[o,s,r]}class RestartNode extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$2,create_fragment$2,safe_not_equal,{})}}const Dashboard_svelte_svelte_type_style_lang="";function create_if_block_5(i){let t,n;return t=new InlineLoading$1({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_4(i){let t,n,s,o,r,l,a,c;return t=new NodeLogs({props:{nodeName:i[1].name}}),s=new NodeAction({}),s.$on("stop_message",i[9]),s.$on("start_message",i[10]),r=new NodeUpdate({props:{updateBody:i[8]}}),a=new RestartNode({}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment),o=space(),create_component(r.$$.fragment),l=space(),create_component(a.$$.fragment)},m(u,f){mount_component(t,u,f),insert(u,n,f),mount_component(s,u,f),insert(u,o,f),mount_component(r,u,f),insert(u,l,f),mount_component(a,u,f),c=!0},p(u,f){const h={};f&2&&(h.nodeName=u[1].name),t.$set(h)},i(u){c||(transition_in(t.$$.fragment,u),transition_in(s.$$.fragment,u),transition_in(r.$$.fragment,u),transition_in(a.$$.fragment,u),c=!0)},o(u){transition_out(t.$$.fragment,u),transition_out(s.$$.fragment,u),transition_out(r.$$.fragment,u),transition_out(a.$$.fragment,u),c=!1},d(u){destroy_component(t,u),u&&detach(n),destroy_component(s,u),u&&detach(o),destroy_component(r,u),u&&detach(l),destroy_component(a,u)}}}function create_if_block_3(i){let t,n;return t=new NodeStats({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot(i){let t,n,s,o,r,l;return t=new OverflowMenuItem$1({props:{text:"Update"}}),t.$on("click",i[7]),s=new OverflowMenuItem$1({props:{text:"Change Password"}}),s.$on("click",i[6]),r=new OverflowMenuItem$1({props:{text:"Logout"}}),r.$on("click",logoutUser),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment),o=space(),create_component(r.$$.fragment)},m(a,c){mount_component(t,a,c),insert(a,n,c),mount_component(s,a,c),insert(a,o,c),mount_component(r,a,c),l=!0},p:noop$2,i(a){l||(transition_in(t.$$.fragment,a),transition_in(s.$$.fragment,a),transition_in(r.$$.fragment,a),l=!0)},o(a){transition_out(t.$$.fragment,a),transition_out(s.$$.fragment,a),transition_out(r.$$.fragment,a),l=!1},d(a){destroy_component(t,a),a&&detach(n),destroy_component(s,a),a&&detach(o),destroy_component(r,a)}}}function create_if_block_1(i){let t,n,s,o,r;const l=[create_if_block_2,create_else_block$1],a=[];function c(u,f){return u[2].nodes.length?0:1}return t=c(i),n=a[t]=l[t](i),o=new Controller({props:{updateBody:i[8]}}),{c(){n.c(),s=space(),create_component(o.$$.fragment)},m(u,f){a[t].m(u,f),insert(u,s,f),mount_component(o,u,f),r=!0},p(u,f){let h=t;t=c(u),t===h?a[t].p(u,f):(group_outros(),transition_out(a[h],1,1,()=>{a[h]=null}),check_outros(),n=a[t],n?n.p(u,f):(n=a[t]=l[t](u),n.c()),transition_in(n,1),n.m(s.parentNode,s))},i(u){r||(transition_in(n),transition_in(o.$$.fragment,u),r=!0)},o(u){transition_out(n),transition_out(o.$$.fragment,u),r=!1},d(u){a[t].d(u),u&&detach(s),destroy_component(o,u)}}}function create_if_block$1(i){let t,n;return t=new ChangePassword({props:{back:i[5]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_else_block$1(i){let t,n,s,o;return s=new Loading$1({}),{c(){t=element("div"),n=text(`letting `),create_component(s.$$.fragment),attr(t,"class","loader svelte-12tdqbl")},m(r,l){insert(r,t,l),append(t,n),mount_component(s,t,null),o=!0},p:noop$2,i(r){o||(transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(s.$$.fragment,r),o=!1},d(r){r&&detach(t),destroy_component(s)}}}function create_if_block_2(i){let t=i[0],n,s,o=create_key_block();return{c(){o.c(),n=empty$1()},m(r,l){o.m(r,l),insert(r,n,l),s=!0},p(r,l){l&1&&safe_not_equal(t,t=r[0])?(group_outros(),transition_out(o,1,1,noop$2),check_outros(),o=create_key_block(),o.c(),transition_in(o,1),o.m(n.parentNode,n)):o.p(r,l)},i(r){s||(transition_in(o),s=!0)},o(r){transition_out(o),s=!1},d(r){r&&detach(n),o.d(r)}}}function create_key_block(i){let t,n;return t=new Flow({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$1(i){let t,n,s,o,r,l,a,c,u,f,h,p,m,b,v,k,w,C,S,T,x,A,R,M,E,L,I,O=!i[2].ready&&create_if_block_5(),z=i[1]&&i[1].place==="Internal"&&create_if_block_4(i),N=i[2].ready&&create_if_block_3();A=new OverflowMenu$1({props:{icon:User,flipped:!0,$$slots:{default:[create_default_slot]},$$scope:{ctx:i}}});const F=[create_if_block$1,create_if_block_1],H=[];function D(G,V){return G[3]==="change_password"?0:G[3]==="main"?1:-1}return~(E=D(i))&&(L=H[E]=F[E](i)),{c(){t=element("main"),n=element("header"),s=element("div"),o=element("div"),r=element("img"),a=space(),c=element("div"),u=element("span"),f=text("Sphinx Stack"),p=space(),m=element("p"),b=text(i[4]),v=space(),O&&O.c(),k=space(),w=element("section"),z&&z.c(),C=space(),S=element("div"),N&&N.c(),T=space(),x=element("section"),create_component(A.$$.fragment),R=space(),M=element("div"),L&&L.c(),attr(r,"class","logo svelte-12tdqbl"),attr(r,"alt","Sphinx icon"),src_url_equal(r.src,l="favicon.jpeg")||attr(r,"src",l),attr(u,"class","stack-title svelte-12tdqbl"),attr(u,"style",h=`color:${i[2].ready?"white":"#999"}`),attr(m,"class","swarm_version svelte-12tdqbl"),attr(o,"class","lefty logo-wrap svelte-12tdqbl"),attr(w,"class","header-btn-wrap svelte-12tdqbl"),attr(s,"class","head_section svelte-12tdqbl"),attr(x,"class","menu-btn svelte-12tdqbl"),attr(S,"class","head_section svelte-12tdqbl"),attr(n,"class","svelte-12tdqbl"),attr(M,"class","body svelte-12tdqbl"),attr(t,"class","svelte-12tdqbl")},m(G,V){insert(G,t,V),append(t,n),append(n,s),append(s,o),append(o,r),append(o,a),append(o,c),append(c,u),append(u,f),append(c,p),append(c,m),append(m,b),append(o,v),O&&O.m(o,null),append(s,k),append(s,w),z&&z.m(w,null),append(n,C),append(n,S),N&&N.m(S,null),append(S,T),append(S,x),mount_component(A,x,null),append(t,R),append(t,M),~E&&H[E].m(M,null),i[13](M),I=!0},p(G,[V]){(!I||V&4&&h!==(h=`color:${G[2].ready?"white":"#999"}`))&&attr(u,"style",h),(!I||V&16)&&set_data(b,G[4]),G[2].ready?O&&(group_outros(),transition_out(O,1,1,()=>{O=null}),check_outros()):O?V&4&&transition_in(O,1):(O=create_if_block_5(),O.c(),transition_in(O,1),O.m(o,null)),G[1]&&G[1].place==="Internal"?z?(z.p(G,V),V&2&&transition_in(z,1)):(z=create_if_block_4(G),z.c(),transition_in(z,1),z.m(w,null)):z&&(group_outros(),transition_out(z,1,1,()=>{z=null}),check_outros()),G[2].ready?N?V&4&&transition_in(N,1):(N=create_if_block_3(),N.c(),transition_in(N,1),N.m(S,T)):N&&(group_outros(),transition_out(N,1,1,()=>{N=null}),check_outros());const Z={};V&1048576&&(Z.$$scope={dirty:V,ctx:G}),A.$set(Z);let Q=E;E=D(G),E===Q?~E&&H[E].p(G,V):(L&&(group_outros(),transition_out(H[Q],1,1,()=>{H[Q]=null}),check_outros()),~E?(L=H[E],L?L.p(G,V):(L=H[E]=F[E](G),L.c()),transition_in(L,1),L.m(M,null)):L=null)},i(G){I||(transition_in(O),transition_in(z),transition_in(N),transition_in(A.$$.fragment,G),transition_in(L),I=!0)},o(G){transition_out(O),transition_out(z),transition_out(N),transition_out(A.$$.fragment,G),transition_out(L),I=!1},d(G){G&&detach(t),O&&O.d(),z&&z.d(),N&&N.d(),destroy_component(A),~E&&H[E].d(),i[13](null)}}}function instance$1(i,t,n){let s,o,r,l;component_subscribe(i,nodes_exited,A=>n(12,s=A)),component_subscribe(i,selectedNode,A=>n(1,o=A)),component_subscribe(i,stack,A=>n(2,r=A)),component_subscribe(i,swarmVersion,A=>n(4,l=A));let a="";async function c(){await getImageVersion(stack,selectedNode),[...r.nodes],n(0,C)}async function u(){let A=!1;for(;!A;)await f()&&(A=!0),await sleep$1(3e3)}async function f(){const A=await get_config();return A.nodes!==r.nodes&&(stack.set(A),c()),A.ready}async function h(){try{const A=await get_signedin_user_details();typeof A=="object"&¤t_swarm_user.set(A)}catch(A){console.log(`Error getting user: ${A}`)}}async function p(){const A=await list_containers();A&&containers.set(A)}onMount(()=>{h(),p(),u()});let m="main";async function b(){n(3,m="main")}function v(){n(3,m="change_password")}async function k(){await update_swarm()}function w(){n(0,C)}let C;function S(A){C==null||C.classList.add(`${A.detail.text}-stopped`)}function T(A){C!=null&&C.classList.contains(`${A.detail.text}-stopped`)&&(C==null||C.classList.remove(`${A.detail.text}-stopped`))}function x(A){binding_callbacks[A?"unshift":"push"](()=>{C=A,n(0,C)})}return i.$$.update=()=>{i.$$.dirty&4&&[...r.nodes],i.$$.dirty&2051&&C&&(o?(C.classList.remove(`selected-${a}`),C.classList.add(`selected-${o.name}`),n(11,a=o.name)):C.classList.remove(`selected-${a}`)),i.$$.dirty&4097&&s&&s.forEach(A=>{C==null||C.classList.add(`selected-${A}`),C==null||C.classList.add(`${A}-stopped`)})},[C,o,r,m,l,b,v,k,w,S,T,a,s,x]}class Dashboard extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1,create_fragment$1,safe_not_equal,{})}}function create_else_block(i){let t,n;return t=new Dashboard({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block(i){let t,n;return t=new Login$1({props:{saveUserToStore}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p:noop$2,i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment(i){let t,n,s,o,r,l,a,c;const u=[create_if_block,create_else_block],f=[];function h(p,m){return p[0]?1:0}return l=h(i),a=f[l]=u[l](i),{c(){t=element("link"),n=element("link"),s=element("link"),o=space(),r=element("main"),a.c(),attr(t,"rel","preconnect"),attr(t,"href","https://fonts.googleapis.com"),attr(n,"rel","preconnect"),attr(n,"href","https://fonts.gstatic.com"),attr(n,"crossorigin","anonymous"),attr(s,"href","https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"),attr(s,"rel","stylesheet")},m(p,m){append(document.head,t),append(document.head,n),append(document.head,s),insert(p,o,m),insert(p,r,m),f[l].m(r,null),c=!0},p(p,[m]){let b=l;l=h(p),l===b?f[l].p(p,m):(group_outros(),transition_out(f[b],1,1,()=>{f[b]=null}),check_outros(),a=f[l],a?a.p(p,m):(a=f[l]=u[l](p),a.c()),transition_in(a,1),a.m(r,null))},i(p){c||(transition_in(a),c=!0)},o(p){transition_out(a),c=!1},d(p){detach(t),detach(n),detach(s),p&&detach(o),p&&detach(r),f[l].d()}}}function instance(i,t,n){let s;return component_subscribe(i,activeUser,o=>n(0,s=o)),[s]}class App extends SvelteComponent{constructor(t){super(),init$1(this,t,instance,create_fragment,safe_not_equal,{})}}new App({target:document.getElementById("app")}); diff --git a/app/dist/index.html b/app/dist/index.html index f0122d1c..7685cb73 100644 --- a/app/dist/index.html +++ b/app/dist/index.html @@ -6,7 +6,7 @@ Sphinx Stack - +