From 3c1ba3b1a26a4a32d4b36c79fa6cbf04abac0489 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Tue, 19 Dec 2023 21:17:48 -0600 Subject: [PATCH] during size changes, silently sync the DOM of cursor, select, hover pts. close #875. --- demos/index.html | 1 + demos/update-cursor-select-resize.html | 75 +++++++++++++++++++++ dist/uPlot.cjs.js | 92 ++++++++++++++++++++------ dist/uPlot.esm.js | 92 ++++++++++++++++++++------ dist/uPlot.iife.js | 92 ++++++++++++++++++++------ dist/uPlot.iife.min.js | 2 +- src/uPlot.js | 92 ++++++++++++++++++++------ 7 files changed, 357 insertions(+), 89 deletions(-) create mode 100644 demos/update-cursor-select-resize.html diff --git a/demos/index.html b/demos/index.html index 5e8ccf45..2a7a2dcb 100644 --- a/demos/index.html +++ b/demos/index.html @@ -80,6 +80,7 @@

μPlot Demos

Gradient fills & strokes (vt & hz, scale-affixed & data-relative) Scale direction & orientation (e.g. rotation, inversion) Draggable y scales via axes + Maintains location of cursor/select/hoverPts during resize (test) Russian month names on date/time axis Dynamically add or delete series diff --git a/demos/update-cursor-select-resize.html b/demos/update-cursor-select-resize.html new file mode 100644 index 00000000..64d922bf --- /dev/null +++ b/demos/update-cursor-select-resize.html @@ -0,0 +1,75 @@ + + + + + Keep selection and cursor in sync with resize (test) + + + + + + + + \ No newline at end of file diff --git a/dist/uPlot.cjs.js b/dist/uPlot.cjs.js index eb1a1153..1d6facfc 100644 --- a/dist/uPlot.cjs.js +++ b/dist/uPlot.cjs.js @@ -3214,6 +3214,13 @@ function uPlot(opts, data, then) { let plotLftCss = 0; let plotTopCss = 0; + // previous values for diffing + let _plotLftCss = plotLftCss; + let _plotTopCss = plotTopCss; + let _plotWidCss = plotWidCss; + let _plotHgtCss = plotHgtCss; + + let plotLft = 0; let plotTop = 0; let plotWid = 0; @@ -3237,9 +3244,6 @@ function uPlot(opts, data, then) { shouldConvergeSize = true; shouldSetSize = true; - if (cursor.left >= 0) - shouldSetCursor = shouldSetLegend = true; - commit(); } @@ -3267,11 +3271,6 @@ function uPlot(opts, data, then) { const CYCLE_LIMIT = 3; function convergeSize() { - let _plotLft = plotLft; - let _plotTop = plotTop; - let _plotWid = plotWid; - let _plotHgt = plotHgt; - let converged = false; let cycleNum = 0; @@ -3287,15 +3286,6 @@ function uPlot(opts, data, then) { if (!converged) { calcSize(self.width, self.height); shouldSetSize = true; - - if ( - plotLft != _plotLft || - plotTop != _plotTop || - plotWid != _plotWid || - plotHgt != _plotHgt - ) { - resetYSeries(false); - } } } } @@ -3411,6 +3401,9 @@ function uPlot(opts, data, then) { // series-intersection markers let cursorPts = [null]; + // position caches in CSS pixels + let cursorPtsLft = [null]; + let cursorPtsTop = [null]; function initCursorPt(s, si) { if (si > 0) { @@ -3476,7 +3469,12 @@ function uPlot(opts, data, then) { activeIdxs.splice(i, 0, null); let pt = initCursorPt(s, i); - pt && cursorPts.splice(i, 0, pt); + + if (pt != null) { + cursorPts.splice(i, 0, pt); + cursorPtsLft.splice(i, 0, 0); + cursorPtsTop.splice(i, 0, 0); + } } fire("addSeries", i); @@ -3508,7 +3506,11 @@ function uPlot(opts, data, then) { if (cursor.show) { activeIdxs.splice(i, 1); - cursorPts.length > 1 && cursorPts.splice(i, 1)[0].remove(); + if (cursorPts.length > 1) { + cursorPts.splice(i, 1)[0].remove(); + cursorPtsLft.splice(i, 1); + cursorPtsTop.splice(i, 1); + } } // TODO: de-init no-longer-needed scales? @@ -4583,6 +4585,47 @@ function uPlot(opts, data, then) { syncRect(true); + if ( + plotLftCss != _plotLftCss || + plotTopCss != _plotTopCss || + plotWidCss != _plotWidCss || + plotHgtCss != _plotHgtCss + ) { + resetYSeries(false); + + let pctWid = plotWidCss / _plotWidCss; + let pctHgt = plotHgtCss / _plotHgtCss; + + if (cursor.show && !shouldSetCursor && cursor.left >= 0) { + cursor.left *= pctWid; + cursor.top *= pctHgt; + + vCursor && elTrans(vCursor, round(cursor.left), 0, plotWidCss, plotHgtCss); + hCursor && elTrans(hCursor, 0, round(cursor.top), plotWidCss, plotHgtCss); + + for (let i = 1; i < cursorPts.length; i++) { + cursorPtsLft[i] *= pctWid; + cursorPtsTop[i] *= pctHgt; + elTrans(cursorPts[i], incrRoundUp(cursorPtsLft[i], 1), incrRoundUp(cursorPtsTop[i], 1), plotWidCss, plotHgtCss); + } + } + + if (select.show && !shouldSetSelect && select.left >= 0 && select.width > 0) { + select.left *= pctWid; + select.width *= pctWid; + select.top *= pctHgt; + select.height *= pctHgt; + + for (let prop in _hideProps) + setStylePx(selectDiv, prop, select[prop]); + } + + _plotLftCss = plotLftCss; + _plotTopCss = plotTopCss; + _plotWidCss = plotWidCss; + _plotHgtCss = plotHgtCss; + } + fire("setSize"); shouldSetSize = false; @@ -5065,11 +5108,11 @@ function uPlot(opts, data, then) { activeIdxs[i] = idx2; - let xPos2 = incrRoundUp(idx2 == idx ? xPos : valToPosX(mode == 1 ? data[0][idx2] : data[i][0][idx2], scaleX, xDim, 0), 1); + let xPos2 = idx2 == idx ? xPos : valToPosX(mode == 1 ? data[0][idx2] : data[i][0][idx2], scaleX, xDim, 0); if (i > 0 && s.show) { // this doesnt really work for state timeline, heatmap, status history (where the value maps to color, not y coords) - let yPos = yVal2 == null ? -10 : incrRoundUp(valToPosY(yVal2, mode == 1 ? scales[s.scale] : scales[s.facets[1].scale], yDim, 0), 1); + let yPos = yVal2 == null ? -10 : valToPosY(yVal2, mode == 1 ? scales[s.scale] : scales[s.facets[1].scale], yDim, 0); if (cursorFocus && mode == 1 && yVal2 != null) { let dist = abs(focus.dist(self, i, idx2, yPos, mouseTop1)); @@ -5136,8 +5179,13 @@ function uPlot(opts, data, then) { ptWid = ptHgt = cursor.points.size(self, i); } + elSize(cursorPts[i], ptWid, ptHgt, centered); - elTrans(cursorPts[i], ptLft, ptTop, plotWidCss, plotHgtCss); + + cursorPtsLft[i] = ptLft; + cursorPtsTop[i] = ptTop; + + elTrans(cursorPts[i], incrRoundUp(ptLft, 1), incrRoundUp(ptTop, 1), plotWidCss, plotHgtCss); } } } diff --git a/dist/uPlot.esm.js b/dist/uPlot.esm.js index da9f4d8a..7efb9403 100644 --- a/dist/uPlot.esm.js +++ b/dist/uPlot.esm.js @@ -3212,6 +3212,13 @@ function uPlot(opts, data, then) { let plotLftCss = 0; let plotTopCss = 0; + // previous values for diffing + let _plotLftCss = plotLftCss; + let _plotTopCss = plotTopCss; + let _plotWidCss = plotWidCss; + let _plotHgtCss = plotHgtCss; + + let plotLft = 0; let plotTop = 0; let plotWid = 0; @@ -3235,9 +3242,6 @@ function uPlot(opts, data, then) { shouldConvergeSize = true; shouldSetSize = true; - if (cursor.left >= 0) - shouldSetCursor = shouldSetLegend = true; - commit(); } @@ -3265,11 +3269,6 @@ function uPlot(opts, data, then) { const CYCLE_LIMIT = 3; function convergeSize() { - let _plotLft = plotLft; - let _plotTop = plotTop; - let _plotWid = plotWid; - let _plotHgt = plotHgt; - let converged = false; let cycleNum = 0; @@ -3285,15 +3284,6 @@ function uPlot(opts, data, then) { if (!converged) { calcSize(self.width, self.height); shouldSetSize = true; - - if ( - plotLft != _plotLft || - plotTop != _plotTop || - plotWid != _plotWid || - plotHgt != _plotHgt - ) { - resetYSeries(false); - } } } } @@ -3409,6 +3399,9 @@ function uPlot(opts, data, then) { // series-intersection markers let cursorPts = [null]; + // position caches in CSS pixels + let cursorPtsLft = [null]; + let cursorPtsTop = [null]; function initCursorPt(s, si) { if (si > 0) { @@ -3474,7 +3467,12 @@ function uPlot(opts, data, then) { activeIdxs.splice(i, 0, null); let pt = initCursorPt(s, i); - pt && cursorPts.splice(i, 0, pt); + + if (pt != null) { + cursorPts.splice(i, 0, pt); + cursorPtsLft.splice(i, 0, 0); + cursorPtsTop.splice(i, 0, 0); + } } fire("addSeries", i); @@ -3506,7 +3504,11 @@ function uPlot(opts, data, then) { if (cursor.show) { activeIdxs.splice(i, 1); - cursorPts.length > 1 && cursorPts.splice(i, 1)[0].remove(); + if (cursorPts.length > 1) { + cursorPts.splice(i, 1)[0].remove(); + cursorPtsLft.splice(i, 1); + cursorPtsTop.splice(i, 1); + } } // TODO: de-init no-longer-needed scales? @@ -4581,6 +4583,47 @@ function uPlot(opts, data, then) { syncRect(true); + if ( + plotLftCss != _plotLftCss || + plotTopCss != _plotTopCss || + plotWidCss != _plotWidCss || + plotHgtCss != _plotHgtCss + ) { + resetYSeries(false); + + let pctWid = plotWidCss / _plotWidCss; + let pctHgt = plotHgtCss / _plotHgtCss; + + if (cursor.show && !shouldSetCursor && cursor.left >= 0) { + cursor.left *= pctWid; + cursor.top *= pctHgt; + + vCursor && elTrans(vCursor, round(cursor.left), 0, plotWidCss, plotHgtCss); + hCursor && elTrans(hCursor, 0, round(cursor.top), plotWidCss, plotHgtCss); + + for (let i = 1; i < cursorPts.length; i++) { + cursorPtsLft[i] *= pctWid; + cursorPtsTop[i] *= pctHgt; + elTrans(cursorPts[i], incrRoundUp(cursorPtsLft[i], 1), incrRoundUp(cursorPtsTop[i], 1), plotWidCss, plotHgtCss); + } + } + + if (select.show && !shouldSetSelect && select.left >= 0 && select.width > 0) { + select.left *= pctWid; + select.width *= pctWid; + select.top *= pctHgt; + select.height *= pctHgt; + + for (let prop in _hideProps) + setStylePx(selectDiv, prop, select[prop]); + } + + _plotLftCss = plotLftCss; + _plotTopCss = plotTopCss; + _plotWidCss = plotWidCss; + _plotHgtCss = plotHgtCss; + } + fire("setSize"); shouldSetSize = false; @@ -5063,11 +5106,11 @@ function uPlot(opts, data, then) { activeIdxs[i] = idx2; - let xPos2 = incrRoundUp(idx2 == idx ? xPos : valToPosX(mode == 1 ? data[0][idx2] : data[i][0][idx2], scaleX, xDim, 0), 1); + let xPos2 = idx2 == idx ? xPos : valToPosX(mode == 1 ? data[0][idx2] : data[i][0][idx2], scaleX, xDim, 0); if (i > 0 && s.show) { // this doesnt really work for state timeline, heatmap, status history (where the value maps to color, not y coords) - let yPos = yVal2 == null ? -10 : incrRoundUp(valToPosY(yVal2, mode == 1 ? scales[s.scale] : scales[s.facets[1].scale], yDim, 0), 1); + let yPos = yVal2 == null ? -10 : valToPosY(yVal2, mode == 1 ? scales[s.scale] : scales[s.facets[1].scale], yDim, 0); if (cursorFocus && mode == 1 && yVal2 != null) { let dist = abs(focus.dist(self, i, idx2, yPos, mouseTop1)); @@ -5134,8 +5177,13 @@ function uPlot(opts, data, then) { ptWid = ptHgt = cursor.points.size(self, i); } + elSize(cursorPts[i], ptWid, ptHgt, centered); - elTrans(cursorPts[i], ptLft, ptTop, plotWidCss, plotHgtCss); + + cursorPtsLft[i] = ptLft; + cursorPtsTop[i] = ptTop; + + elTrans(cursorPts[i], incrRoundUp(ptLft, 1), incrRoundUp(ptTop, 1), plotWidCss, plotHgtCss); } } } diff --git a/dist/uPlot.iife.js b/dist/uPlot.iife.js index 788163ca..a0bd1e49 100644 --- a/dist/uPlot.iife.js +++ b/dist/uPlot.iife.js @@ -3215,6 +3215,13 @@ var uPlot = (function () { let plotLftCss = 0; let plotTopCss = 0; + // previous values for diffing + let _plotLftCss = plotLftCss; + let _plotTopCss = plotTopCss; + let _plotWidCss = plotWidCss; + let _plotHgtCss = plotHgtCss; + + let plotLft = 0; let plotTop = 0; let plotWid = 0; @@ -3238,9 +3245,6 @@ var uPlot = (function () { shouldConvergeSize = true; shouldSetSize = true; - if (cursor.left >= 0) - shouldSetCursor = shouldSetLegend = true; - commit(); } @@ -3268,11 +3272,6 @@ var uPlot = (function () { const CYCLE_LIMIT = 3; function convergeSize() { - let _plotLft = plotLft; - let _plotTop = plotTop; - let _plotWid = plotWid; - let _plotHgt = plotHgt; - let converged = false; let cycleNum = 0; @@ -3288,15 +3287,6 @@ var uPlot = (function () { if (!converged) { calcSize(self.width, self.height); shouldSetSize = true; - - if ( - plotLft != _plotLft || - plotTop != _plotTop || - plotWid != _plotWid || - plotHgt != _plotHgt - ) { - resetYSeries(false); - } } } } @@ -3412,6 +3402,9 @@ var uPlot = (function () { // series-intersection markers let cursorPts = [null]; + // position caches in CSS pixels + let cursorPtsLft = [null]; + let cursorPtsTop = [null]; function initCursorPt(s, si) { if (si > 0) { @@ -3477,7 +3470,12 @@ var uPlot = (function () { activeIdxs.splice(i, 0, null); let pt = initCursorPt(s, i); - pt && cursorPts.splice(i, 0, pt); + + if (pt != null) { + cursorPts.splice(i, 0, pt); + cursorPtsLft.splice(i, 0, 0); + cursorPtsTop.splice(i, 0, 0); + } } fire("addSeries", i); @@ -3509,7 +3507,11 @@ var uPlot = (function () { if (cursor.show) { activeIdxs.splice(i, 1); - cursorPts.length > 1 && cursorPts.splice(i, 1)[0].remove(); + if (cursorPts.length > 1) { + cursorPts.splice(i, 1)[0].remove(); + cursorPtsLft.splice(i, 1); + cursorPtsTop.splice(i, 1); + } } // TODO: de-init no-longer-needed scales? @@ -4584,6 +4586,47 @@ var uPlot = (function () { syncRect(true); + if ( + plotLftCss != _plotLftCss || + plotTopCss != _plotTopCss || + plotWidCss != _plotWidCss || + plotHgtCss != _plotHgtCss + ) { + resetYSeries(false); + + let pctWid = plotWidCss / _plotWidCss; + let pctHgt = plotHgtCss / _plotHgtCss; + + if (cursor.show && !shouldSetCursor && cursor.left >= 0) { + cursor.left *= pctWid; + cursor.top *= pctHgt; + + vCursor && elTrans(vCursor, round(cursor.left), 0, plotWidCss, plotHgtCss); + hCursor && elTrans(hCursor, 0, round(cursor.top), plotWidCss, plotHgtCss); + + for (let i = 1; i < cursorPts.length; i++) { + cursorPtsLft[i] *= pctWid; + cursorPtsTop[i] *= pctHgt; + elTrans(cursorPts[i], incrRoundUp(cursorPtsLft[i], 1), incrRoundUp(cursorPtsTop[i], 1), plotWidCss, plotHgtCss); + } + } + + if (select.show && !shouldSetSelect && select.left >= 0 && select.width > 0) { + select.left *= pctWid; + select.width *= pctWid; + select.top *= pctHgt; + select.height *= pctHgt; + + for (let prop in _hideProps) + setStylePx(selectDiv, prop, select[prop]); + } + + _plotLftCss = plotLftCss; + _plotTopCss = plotTopCss; + _plotWidCss = plotWidCss; + _plotHgtCss = plotHgtCss; + } + fire("setSize"); shouldSetSize = false; @@ -5066,11 +5109,11 @@ var uPlot = (function () { activeIdxs[i] = idx2; - let xPos2 = incrRoundUp(idx2 == idx ? xPos : valToPosX(mode == 1 ? data[0][idx2] : data[i][0][idx2], scaleX, xDim, 0), 1); + let xPos2 = idx2 == idx ? xPos : valToPosX(mode == 1 ? data[0][idx2] : data[i][0][idx2], scaleX, xDim, 0); if (i > 0 && s.show) { // this doesnt really work for state timeline, heatmap, status history (where the value maps to color, not y coords) - let yPos = yVal2 == null ? -10 : incrRoundUp(valToPosY(yVal2, mode == 1 ? scales[s.scale] : scales[s.facets[1].scale], yDim, 0), 1); + let yPos = yVal2 == null ? -10 : valToPosY(yVal2, mode == 1 ? scales[s.scale] : scales[s.facets[1].scale], yDim, 0); if (cursorFocus && mode == 1 && yVal2 != null) { let dist = abs(focus.dist(self, i, idx2, yPos, mouseTop1)); @@ -5137,8 +5180,13 @@ var uPlot = (function () { ptWid = ptHgt = cursor.points.size(self, i); } + elSize(cursorPts[i], ptWid, ptHgt, centered); - elTrans(cursorPts[i], ptLft, ptTop, plotWidCss, plotHgtCss); + + cursorPtsLft[i] = ptLft; + cursorPtsTop[i] = ptTop; + + elTrans(cursorPts[i], incrRoundUp(ptLft, 1), incrRoundUp(ptTop, 1), plotWidCss, plotHgtCss); } } } diff --git a/dist/uPlot.iife.min.js b/dist/uPlot.iife.min.js index 5287eab0..0f785a89 100644 --- a/dist/uPlot.iife.min.js +++ b/dist/uPlot.iife.min.js @@ -1,2 +1,2 @@ /*! https://github.com/leeoniya/uPlot (v1.6.27) */ -var uPlot=function(){"use strict";const e="u-off",l="u-label",t="width",n="height",i="top",o="bottom",s="left",r="right",u="#000",a=u+"0",f="mousemove",c="mousedown",h="mouseup",d="mouseenter",p="mouseleave",m="dblclick",g="change",x="dppxchange",w="--",_="undefined"!=typeof window,b=_?document:null,v=_?window:null,k=_?navigator:null;let y,M;function S(e,l){if(null!=l){let t=e.classList;!t.contains(l)&&t.add(l)}}function E(e,l){let t=e.classList;t.contains(l)&&t.remove(l)}function T(e,l,t){e.style[l]=t+"px"}function z(e,l,t,n){let i=b.createElement(e);return null!=l&&S(i,l),null!=t&&t.insertBefore(i,n),i}function D(e,l){return z("div",e,l)}const P=new WeakMap;function A(l,t,n,i,o){let s="translate("+t+"px,"+n+"px)";s!=P.get(l)&&(l.style.transform=s,P.set(l,s),0>t||0>n||t>i||n>o?S(l,e):E(l,e))}const W=new WeakMap;function Y(e,l,t){let n=l+t;n!=W.get(e)&&(W.set(e,n),e.style.background=l,e.style.borderColor=t)}const C=new WeakMap;function F(e,l,t,n){let i=l+""+t;i!=C.get(e)&&(C.set(e,i),e.style.height=t+"px",e.style.width=l+"px",e.style.marginLeft=n?-l/2+"px":0,e.style.marginTop=n?-t/2+"px":0)}const H={passive:!0},R={...H,capture:!0};function G(e,l,t,n){l.addEventListener(e,t,n?R:H)}function I(e,l,t,n){l.removeEventListener(e,t,n?R:H)}function L(e,l,t,n){let i;t=t||0;let o=2147483647>=(n=n||l.length-1);for(;n-t>1;)i=o?t+n>>1:te((t+n)/2),e>l[i]?t=i:n=i;return e-l[t]>l[n]-e?n:t}function O(e,l,t,n){for(let i=1==n?l:t;i>=l&&t>=i;i+=n)if(null!=e[i])return i;return-1}function N(e,l,t,n){let i=ue(e),o=ue(l),s=10==t?ae:fe;e==l&&(-1==i?(e*=t,l/=t):(e/=t,l*=t));let r=1==o?ie:te,u=(1==i?te:ie)(s(le(e))),a=r(s(le(l))),f=re(t,u),c=re(t,a);return 10==t&&(0>u&&(f=Se(f,-u)),0>a&&(c=Se(c,-a))),n||2==t?(e=f*i,l=c*o):(e=Me(e,f),l=ye(l,c)),[e,l]}function j(e,l,t,n){let i=N(e,l,t,n);return 0==e&&(i[0]=0),0==l&&(i[1]=0),i}_&&function e(){let l=devicePixelRatio;y!=l&&(y=l,M&&I(g,M,e),M=matchMedia(`(min-resolution: ${y-.001}dppx) and (max-resolution: ${y+.001}dppx)`),G(g,M,e),v.dispatchEvent(new CustomEvent(x)))}();const U=.1,B={mode:3,pad:U},V={pad:0,soft:null,mode:0},J={min:V,max:V};function q(e,l,t,n){return Fe(t)?X(e,l,t):(V.pad=t,V.soft=n?0:null,V.mode=n?3:0,X(e,l,J))}function K(e,l){return null==e?l:e}function X(e,l,t){let n=t.min,i=t.max,o=K(n.pad,0),s=K(i.pad,0),r=K(n.hard,-he),u=K(i.hard,he),a=K(n.soft,he),f=K(i.soft,-he),c=K(n.mode,0),h=K(i.mode,0),d=l-e,p=ae(d),m=se(le(e),le(l)),g=ae(m),x=le(g-p);(1e-9>d||x>10)&&(d=0,0!=e&&0!=l||(d=1e-9,2==c&&a!=he&&(o=0),2==h&&f!=-he&&(s=0)));let w=d||m||1e3,_=ae(w),b=re(10,te(_)),v=Se(Me(e-w*(0==d?0==e?.1:1:o),b/10),9),k=a>e||1!=c&&(3!=c||v>a)&&(2!=c||a>v)?he:a,y=se(r,k>v&&e>=k?k:oe(k,v)),M=Se(ye(l+w*(0==d?0==l?.1:1:s),b/10),9),S=l>f||1!=h&&(3!=h||f>M)&&(2!=h||M>f)?-he:f,E=oe(u,M>S&&S>=l?S:se(S,M));return y==E&&0==y&&(E=100),[y,E]}const Z=new Intl.NumberFormat(_?k.language:"en-US"),$=e=>Z.format(e),Q=Math,ee=Q.PI,le=Q.abs,te=Q.floor,ne=Q.round,ie=Q.ceil,oe=Q.min,se=Q.max,re=Q.pow,ue=Q.sign,ae=Q.log10,fe=Q.log2,ce=(e,l=1)=>Q.asinh(e/l),he=1/0;function de(e){return 1+(0|ae((e^e>>31)-(e>>31)))}function pe(e,l,t){return oe(se(e,l),t)}function me(e){return"function"==typeof e?e:()=>e}const ge=e=>e,xe=(e,l)=>l,we=()=>null,_e=()=>!0,be=(e,l)=>e==l,ve=e=>Se(e,14);function ke(e,l){return ve(Se(ve(e/l))*l)}function ye(e,l){return ve(ie(ve(e/l))*l)}function Me(e,l){return ve(te(ve(e/l))*l)}function Se(e,l=0){if(Ye(e))return e;let t=10**l;return ne(e*t*(1+Number.EPSILON))/t}const Ee=new Map;function Te(e){return((""+e).split(".")[1]||"").length}function ze(e,l,t,n){let i=[],o=n.map(Te);for(let s=l;t>s;s++){let l=le(s),t=Se(re(e,s),l);for(let e=0;n.length>e;e++){let r=n[e]*t,u=(0>r||0>s?l:0)+(o[e]>s?o[e]:0),a=Se(r,u);i.push(a),Ee.set(a,u)}}return i}const De={},Pe=[],Ae=[null,null],We=Array.isArray,Ye=Number.isInteger;function Ce(e){return"string"==typeof e}function Fe(e){let l=!1;if(null!=e){let t=e.constructor;l=null==t||t==Object}return l}function He(e){return null!=e&&"object"==typeof e}const Re=Object.getPrototypeOf(Uint8Array);function Ge(e,l=Fe){let t;if(We(e)){let n=e.find((e=>null!=e));if(We(n)||l(n)){t=Array(e.length);for(let n=0;e.length>n;n++)t[n]=Ge(e[n],l)}else t=e.slice()}else if(e instanceof Re)t=e.slice();else if(l(e)){t={};for(let n in e)t[n]=Ge(e[n],l)}else t=e;return t}function Ie(e){let l=arguments;for(let t=1;l.length>t;t++){let n=l[t];for(let l in n)Fe(e[l])?Ie(e[l],Ge(n[l])):e[l]=Ge(n[l])}return e}function Le(e,l,t){for(let n,i=0,o=-1;l.length>i;i++){let s=l[i];if(s>o){for(n=s-1;n>=0&&null==e[n];)e[n--]=null;for(n=s+1;t>n&&null==e[n];)e[o=n++]=null}}}const Oe="undefined"==typeof queueMicrotask?e=>Promise.resolve().then(e):queueMicrotask,Ne=["January","February","March","April","May","June","July","August","September","October","November","December"],je=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Ue(e){return e.slice(0,3)}const Be=je.map(Ue),Ve=Ne.map(Ue),Je={MMMM:Ne,MMM:Ve,WWWW:je,WWW:Be};function qe(e){return(10>e?"0":"")+e}const Ke={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,l)=>l.MMMM[e.getMonth()],MMM:(e,l)=>l.MMM[e.getMonth()],MM:e=>qe(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>qe(e.getDate()),D:e=>e.getDate(),WWWW:(e,l)=>l.WWWW[e.getDay()],WWW:(e,l)=>l.WWW[e.getDay()],HH:e=>qe(e.getHours()),H:e=>e.getHours(),h:e=>{let l=e.getHours();return 0==l?12:l>12?l-12:l},AA:e=>12>e.getHours()?"AM":"PM",aa:e=>12>e.getHours()?"am":"pm",a:e=>12>e.getHours()?"a":"p",mm:e=>qe(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>qe(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>function(e){return(10>e?"00":100>e?"0":"")+e}(e.getMilliseconds())};function Xe(e,l){l=l||Je;let t,n=[],i=/\{([a-z]+)\}|[^{]+/gi;for(;t=i.exec(e);)n.push("{"==t[0][0]?Ke[t[1]]:t[0]);return e=>{let t="";for(let i=0;n.length>i;i++)t+="string"==typeof n[i]?n[i]:n[i](e,l);return t}}const Ze=(new Intl.DateTimeFormat).resolvedOptions().timeZone,$e=e=>e%1==0,Qe=[1,2,2.5,5],el=ze(10,-16,0,Qe),ll=ze(10,0,16,Qe),tl=ll.filter($e),nl=el.concat(ll),il="{YYYY}",ol="\n"+il,sl="{M}/{D}",rl="\n"+sl,ul=rl+"/{YY}",al="{aa}",fl="{h}:{mm}"+al,cl="\n"+fl,hl=":{ss}",dl=null;function pl(e){let l=1e3*e,t=60*l,n=60*t,i=24*n,o=30*i,s=365*i;return[(1==e?ze(10,0,3,Qe).filter($e):ze(10,-3,0,Qe)).concat([l,5*l,10*l,15*l,30*l,t,5*t,10*t,15*t,30*t,n,2*n,3*n,4*n,6*n,8*n,12*n,i,2*i,3*i,4*i,5*i,6*i,7*i,8*i,9*i,10*i,15*i,o,2*o,3*o,4*o,6*o,s,2*s,5*s,10*s,25*s,50*s,100*s]),[[s,il,dl,dl,dl,dl,dl,dl,1],[28*i,"{MMM}",ol,dl,dl,dl,dl,dl,1],[i,sl,ol,dl,dl,dl,dl,dl,1],[n,"{h}"+al,ul,dl,rl,dl,dl,dl,1],[t,fl,ul,dl,rl,dl,dl,dl,1],[l,hl,ul+" "+fl,dl,rl+" "+fl,dl,cl,dl,1],[e,hl+".{fff}",ul+" "+fl,dl,rl+" "+fl,dl,cl,dl,1]],function(l){return(r,u,a,f,c,h)=>{let d=[],p=c>=s,m=c>=o&&s>c,g=l(a),x=Se(g*e,3),w=yl(g.getFullYear(),p?0:g.getMonth(),m||p?1:g.getDate()),_=Se(w*e,3);if(m||p){let t=m?c/o:0,n=p?c/s:0,i=x==_?x:Se(yl(w.getFullYear()+n,w.getMonth()+t,1)*e,3),r=new Date(ne(i/e)),u=r.getFullYear(),a=r.getMonth();for(let o=0;f>=i;o++){let s=yl(u+n*o,a+t*o,1),r=s-l(Se(s*e,3));i=Se((+s+r)*e,3),i>f||d.push(i)}}else{let o=i>c?c:i,s=_+(te(a)-te(x))+ye(x-_,o);d.push(s);let p=l(s),m=p.getHours()+p.getMinutes()/t+p.getSeconds()/n,g=c/n,w=h/r.axes[u]._space;for(;s=Se(s+c,1==e?0:3),f>=s;)if(g>1){let e=te(Se(m+g,6))%24,t=l(s).getHours()-e;t>1&&(t=-1),s-=t*n,m=(m+g)%24,.7>Se((s-d[d.length-1])/c,3)*w||d.push(s)}else d.push(s)}return d}}]}const[ml,gl,xl]=pl(1),[wl,_l,bl]=pl(.001);function vl(e,l){return e.map((e=>e.map(((t,n)=>0==n||8==n||null==t?t:l(1==n||0==e[8]?t:e[1]+t)))))}function kl(e,l){return(t,n,i,o,s)=>{let r,u,a,f,c,h,d=l.find((e=>s>=e[0]))||l[l.length-1];return n.map((l=>{let t=e(l),n=t.getFullYear(),i=t.getMonth(),o=t.getDate(),s=t.getHours(),p=t.getMinutes(),m=t.getSeconds(),g=n!=r&&d[2]||i!=u&&d[3]||o!=a&&d[4]||s!=f&&d[5]||p!=c&&d[6]||m!=h&&d[7]||d[1];return r=n,u=i,a=o,f=s,c=p,h=m,g(t)}))}}function yl(e,l,t){return new Date(e,l,t)}function Ml(e,l){return l(e)}function Sl(e,l){return(t,n,i,o)=>null==o?w:l(e(n))}ze(2,-53,53,[1]);const El={show:!0,live:!0,isolate:!1,mount:()=>{},markers:{show:!0,width:2,stroke:function(e,l){let t=e.series[l];return t.width?t.stroke(e,l):t.points.width?t.points.stroke(e,l):null},fill:function(e,l){return e.series[l].fill(e,l)},dash:"solid"},idx:null,idxs:null,values:[]},Tl=[0,0];function zl(e,l,t,n=!0){return e=>{0==e.button&&(!n||e.target==l)&&t(e)}}function Dl(e,l,t,n=!0){return e=>{(!n||e.target==l)&&t(e)}}const Pl={show:!0,x:!0,y:!0,lock:!1,move:function(e,l,t){return Tl[0]=l,Tl[1]=t,Tl},points:{show:function(e,l){let i=e.cursor.points,o=D(),s=i.size(e,l);T(o,t,s),T(o,n,s);let r=s/-2;T(o,"marginLeft",r),T(o,"marginTop",r);let u=i.width(e,l,s);return u&&T(o,"borderWidth",u),o},size:function(e,l){return e.series[l].points.size},width:0,stroke:function(e,l){let t=e.series[l].points;return t._stroke||t._fill},fill:function(e,l){let t=e.series[l].points;return t._fill||t._stroke}},bind:{mousedown:zl,mouseup:zl,click:zl,dblclick:zl,mousemove:Dl,mouseleave:Dl,mouseenter:Dl},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,l)=>{l.stopPropagation(),l.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,l,t,n,i)=>n-i,prox:-1,bias:0},left:-10,top:-10,idx:null,dataIdx:function(e,l,t){return t},idxs:null,event:null},Al={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Wl=Ie({},Al,{filter:xe}),Yl=Ie({},Wl,{size:10}),Cl=Ie({},Al,{show:!1}),Fl='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Hl="bold "+Fl,Rl={show:!0,scale:"x",stroke:u,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Hl,side:2,grid:Wl,ticks:Yl,border:Cl,font:Fl,lineGap:1.5,rotate:0},Gl={show:!0,scale:"x",auto:!1,sorted:1,min:he,max:-he,idxs:[]};function Il(e,l){return l.map((e=>null==e?"":$(e)))}function Ll(e,l,t,n,i,o,s){let r=[],u=Ee.get(i)||0;for(let e=t=s?t:Se(ye(t,i),u);n>=e;e=Se(e+i,u))r.push(Object.is(e,-0)?0:e);return r}function Ol(e,l,t,n,i){const o=[],s=e.scales[e.axes[l].scale].log,r=te((10==s?ae:fe)(t));i=re(s,r),10==s&&0>r&&(i=Se(i,-r));let u=t;do{o.push(u),u+=i,10==s&&(u=Se(u,Ee.get(i))),i*s>u||(i=u)}while(n>=u);return o}function Nl(e,l,t,n,i){let o=e.scales[e.axes[l].scale].asinh,s=n>o?Ol(e,l,se(o,t),n,i):[o],r=0>n||t>0?[]:[0];return(-o>t?Ol(e,l,se(o,-n),-t,i):[o]).reverse().map((e=>-e)).concat(r,s)}const jl=/./,Ul=/[12357]/,Bl=/[125]/,Vl=/1/,Jl=(e,l,t,n)=>e.map(((e,i)=>4==l&&0==e||i%n==0&&t.test(e.toExponential()[0>e?1:0])?e:null));function ql(e,l,t){let n=e.axes[t],i=n.scale,o=e.scales[i],s=e.valToPos,r=n._space,u=s(10,i),a=s(9,i)-ue)return Jl(l.slice().reverse(),o.distr,a,ie(r/e)).reverse()}return Jl(l,o.distr,a,1)}function Kl(e,l,t){let n=e.axes[t],i=n.scale,o=n._space,s=e.valToPos,r=le(s(1,i)-s(2,i));return o>r?Jl(l.slice().reverse(),3,jl,ie(o/r)).reverse():l}function Xl(e,l,t,n){return null==n?w:null==l?"":$(l)}const Zl={show:!0,scale:"y",stroke:u,space:30,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Hl,side:3,grid:Wl,ticks:Yl,border:Cl,font:Fl,lineGap:1.5,rotate:0},$l={scale:null,auto:!0,sorted:0,min:he,max:-he},Ql=(e,l,t,n,i)=>i,et={show:!0,auto:!0,sorted:0,gaps:Ql,alpha:1,facets:[Ie({},$l,{scale:"x"}),Ie({},$l,{scale:"y"})]},lt={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Ql,alpha:1,points:{show:function(e,l){let{scale:t,idxs:n}=e.series[0],i=e._data[0],o=e.valToPos(i[n[0]],t,!0),s=e.valToPos(i[n[1]],t,!0);return le(s-o)/(e.series[l].points.space*y)>=n[1]-n[0]},filter:null},values:null,min:he,max:-he,idxs:[],path:null,clip:null};function tt(e,l,t){return t/10}const nt={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},it=Ie({},nt,{time:!1,ori:1}),ot={};function st(e){let l=ot[e];return l||(l={key:e,plots:[],sub(e){l.plots.push(e)},unsub(e){l.plots=l.plots.filter((l=>l!=e))},pub(e,t,n,i,o,s,r){for(let u=0;l.plots.length>u;u++)l.plots[u]!=t&&l.plots[u].pub(e,t,n,i,o,s,r)}},null!=e&&(ot[e]=l)),l}function rt(e,l,t){const n=e.mode,i=e.series[l],o=2==n?e._data[l]:e._data,s=e.scales,r=e.bbox;let u=o[0],a=2==n?o[1]:o[l],f=2==n?s[i.facets[0].scale]:s[e.series[0].scale],c=2==n?s[i.facets[1].scale]:s[i.scale],h=r.left,d=r.top,p=r.width,m=r.height,g=e.valToPosH,x=e.valToPosV;return 0==f.ori?t(i,u,a,f,c,g,x,h,d,p,m,mt,xt,_t,vt,yt):t(i,u,a,f,c,x,g,d,h,m,p,gt,wt,bt,kt,Mt)}function ut(e,l){let t=0,n=0,i=K(e.bands,Pe);for(let e=0;i.length>e;e++){let o=i[e];o.series[0]==l?t=o.dir:o.series[1]==l&&(n|=1==o.dir?1:2)}return[t,1==n?-1:2==n?1:3==n?2:0]}function at(e,l,t,n,i){let o=e.series[l],s=e.scales[2==e.mode?o.facets[1].scale:o.scale];return-1==i?s.min:1==i?s.max:3==s.distr?1==s.dir?s.min:s.max:0}function ft(e,l,t,n,i,o){return rt(e,l,((e,l,s,r,u,a,f,c,h,d,p)=>{let m=e.pxRound;const g=0==r.ori?xt:wt;let x,w;1==r.dir*(0==r.ori?1:-1)?(x=t,w=n):(x=n,w=t);let _=m(a(l[x],r,d,c)),b=m(f(s[x],u,p,h)),v=m(a(l[w],r,d,c)),k=m(f(1==o?u.max:u.min,u,p,h)),y=new Path2D(i);return g(y,v,k),g(y,_,k),g(y,_,b),y}))}function ct(e,l,t,n,i,o){let s=null;if(e.length>0){s=new Path2D;const r=0==l?_t:bt;let u=t;for(let l=0;e.length>l;l++){let t=e[l];if(t[1]>t[0]){let e=t[0]-u;e>0&&r(s,u,n,e,n+o),u=t[1]}}let a=t+i-u,f=10;a>0&&r(s,u,n-f/2,a,n+o+f)}return s}function ht(e,l,t,n,i,o,s){let r=[],u=e.length;for(let a=1==i?t:n;a>=t&&n>=a;a+=i)if(null===l[a]){let f=a,c=a;if(1==i)for(;++a<=n&&null===l[a];)c=a;else for(;--a>=t&&null===l[a];)c=a;let h=o(e[f]),d=c==f?h:o(e[c]),p=f-i;h=s>0||0>p||p>=u?h:o(e[p]);let m=c+i;d=0>s||0>m||m>=u?d:o(e[m]),h>d||r.push([h,d])}return r}function dt(e){return 0==e?ge:1==e?ne:l=>ke(l,e)}function pt(e){let l=0==e?mt:gt,t=0==e?(e,l,t,n,i,o)=>{e.arcTo(l,t,n,i,o)}:(e,l,t,n,i,o)=>{e.arcTo(t,l,i,n,o)},n=0==e?(e,l,t,n,i)=>{e.rect(l,t,n,i)}:(e,l,t,n,i)=>{e.rect(t,l,i,n)};return(e,i,o,s,r,u=0,a=0)=>{0==u&&0==a?n(e,i,o,s,r):(u=oe(u,s/2,r/2),a=oe(a,s/2,r/2),l(e,i+u,o),t(e,i+s,o,i+s,o+r,u),t(e,i+s,o+r,i,o+r,a),t(e,i,o+r,i,o,a),t(e,i,o,i+s,o,u),e.closePath())}}const mt=(e,l,t)=>{e.moveTo(l,t)},gt=(e,l,t)=>{e.moveTo(t,l)},xt=(e,l,t)=>{e.lineTo(l,t)},wt=(e,l,t)=>{e.lineTo(t,l)},_t=pt(0),bt=pt(1),vt=(e,l,t,n,i,o)=>{e.arc(l,t,n,i,o)},kt=(e,l,t,n,i,o)=>{e.arc(t,l,n,i,o)},yt=(e,l,t,n,i,o,s)=>{e.bezierCurveTo(l,t,n,i,o,s)},Mt=(e,l,t,n,i,o,s)=>{e.bezierCurveTo(t,l,i,n,s,o)};function St(){return(e,l,t,n,i)=>rt(e,l,((l,o,s,r,u,a,f,c,h,d,p)=>{let m,g,{pxRound:x,points:w}=l;0==r.ori?(m=mt,g=vt):(m=gt,g=kt);const _=Se(w.width*y,3);let b=(w.size-w.width)/2*y,v=Se(2*b,3),k=new Path2D,M=new Path2D,{left:S,top:E,width:T,height:z}=e.bbox;_t(M,S-v,E-v,T+2*v,z+2*v);const D=e=>{if(null!=s[e]){let l=x(a(o[e],r,d,c)),t=x(f(s[e],u,p,h));m(k,l+b,t),g(k,l,t,b,0,2*ee)}};if(i)i.forEach(D);else for(let e=t;n>=e;e++)D(e);return{stroke:_>0?k:null,fill:k,clip:M,flags:3}}))}function Et(e){return(l,t,n,i,o,s)=>{n!=i&&(o!=n&&s!=n&&e(l,t,n),o!=i&&s!=i&&e(l,t,i),e(l,t,s))}}const Tt=Et(xt),zt=Et(wt);function Dt(e){const l=K(e?.alignGaps,0);return(e,t,n,i)=>rt(e,t,((o,s,r,u,a,f,c,h,d,p,m)=>{let g,x,w=o.pxRound,_=e=>w(f(e,u,p,h)),b=e=>w(c(e,a,m,d));0==u.ori?(g=xt,x=Tt):(g=wt,x=zt);const v=u.dir*(0==u.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},y=k.stroke;let M,S,E,T=he,z=-he,D=_(s[1==v?n:i]),P=O(r,n,i,1*v),A=O(r,n,i,-1*v),W=_(s[P]),Y=_(s[A]),C=!1;for(let e=1==v?n:i;e>=n&&i>=e;e+=v){let l=_(s[e]),t=r[e];l==D?null!=t?(S=b(t),T==he&&(g(y,l,S),M=S),T=oe(S,T),z=se(S,z)):null===t&&(C=!0):(T!=he&&(x(y,D,T,z,M,S),E=D),null!=t?(S=b(t),g(y,l,S),T=z=M=S):(T=he,z=-he,null===t&&(C=!0)),D=l)}T!=he&&T!=z&&E!=D&&x(y,D,T,z,M,S);let[F,H]=ut(e,t);if(null!=o.fill||0!=F){let l=k.fill=new Path2D(y),n=b(o.fillTo(e,t,o.min,o.max,F));g(l,Y,n),g(l,W,n)}if(!o.spanGaps){let a=[];C&&a.push(...ht(s,r,n,i,v,_,l)),k.gaps=a=o.gaps(e,t,n,i,a),k.clip=ct(a,u.ori,h,d,p,m)}return 0!=H&&(k.band=2==H?[ft(e,t,n,i,y,-1),ft(e,t,n,i,y,1)]:ft(e,t,n,i,y,H)),k}))}function Pt(e,l,t,n,i){const o=e.length;if(2>o)return null;const s=new Path2D;if(t(s,e[0],l[0]),2==o)n(s,e[1],l[1]);else{let t=Array(o),n=Array(o-1),r=Array(o-1),u=Array(o-1);for(let t=0;o-1>t;t++)r[t]=l[t+1]-l[t],u[t]=e[t+1]-e[t],n[t]=r[t]/u[t];t[0]=n[0];for(let e=1;o-1>e;e++)0===n[e]||0===n[e-1]||n[e-1]>0!=n[e]>0?t[e]=0:(t[e]=3*(u[e-1]+u[e])/((2*u[e]+u[e-1])/n[e-1]+(u[e]+2*u[e-1])/n[e]),isFinite(t[e])||(t[e]=0));t[o-1]=n[o-2];for(let n=0;o-1>n;n++)i(s,e[n]+u[n]/3,l[n]+t[n]*u[n]/3,e[n+1]-u[n]/3,l[n+1]-t[n+1]*u[n]/3,e[n+1],l[n+1])}return s}const At=new Set;function Wt(){for(let e of At)e.syncRect(!0)}_&&(G("resize",v,Wt),G("scroll",v,Wt,!0),G(x,v,(()=>{Jt.pxRatio=y})));const Yt=Dt(),Ct=St();function Ft(e,l,t,n){return(n?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map(((e,n)=>Ht(e,n,l,t)))}function Ht(e,l,t,n){return Ie({},0==l?t:n,e)}function Rt(e,l,t){return null==l?Ae:[l,t]}const Gt=Rt;function It(e,l,t){return null==l?Ae:q(l,t,U,!0)}function Lt(e,l,t,n){return null==l?Ae:N(l,t,e.scales[n].log,!1)}const Ot=Lt;function Nt(e,l,t,n){return null==l?Ae:j(l,t,e.scales[n].log,!1)}const jt=Nt;function Ut(e,l,t,n,i){let o=se(de(e),de(l)),s=l-e,r=L(i/n*s,t);do{let e=t[r],l=n*e/s;if(l>=i&&17>=o+(5>e?Ee.get(e):0))return[e,l]}while(++r(l=ne((t=+n)*y))+"px")),l,t]}function Vt(e){e.show&&[e.font,e.labelFont].forEach((e=>{let l=Se(e[2]*y,1);e[0]=e[0].replace(/[0-9.]+px/,l+"px"),e[1]=l}))}function Jt(u,g,_){const k={mode:K(u.mode,1)},M=k.mode;function P(e,l){return((3==l.distr?ae(e>0?e:l.clamp(k,e,l.min,l.max,l.key)):4==l.distr?ce(e,l.asinh):e)-l._min)/(l._max-l._min)}function W(e,l,t,n){let i=P(e,l);return n+t*(-1==l.dir?1-i:i)}function C(e,l,t,n){let i=P(e,l);return n+t*(-1==l.dir?i:1-i)}function H(e,l,t,n){return 0==l.ori?W(e,l,t,n):C(e,l,t,n)}k.valToPosH=W,k.valToPosV=C;let R=!1;k.status=0;const O=k.root=D("uplot");null!=u.id&&(O.id=u.id),S(O,u.class),u.title&&(D("u-title",O).textContent=u.title);const V=z("canvas"),J=k.ctx=V.getContext("2d"),X=D("u-wrap",O);G("click",X,(e=>{e.target===$&&(Dn!=Sn||Pn!=En)&&Hn.click(k,e)}),!0);const Z=k.under=D("u-under",X);X.appendChild(V);const $=k.over=D("u-over",X),te=+K((u=Ge(u)).pxAlign,1),ue=dt(te);(u.plugins||[]).forEach((e=>{e.opts&&(u=e.opts(k,u)||u)}));const fe=u.ms||.001,de=k.series=1==M?Ft(u.series||[],Gl,lt,!1):function(e,l){return e.map(((e,t)=>0==t?null:Ie({},l,e)))}(u.series||[null],et),ge=k.axes=Ft(u.axes||[],Rl,Zl,!0),ve=k.scales={},Me=k.bands=u.bands||[];Me.forEach((e=>{e.fill=me(e.fill||null),e.dir=K(e.dir,-1)}));const ze=2==M?de[1].facets[0].scale:de[0].scale,Ye={axes:function(){for(let e=0;ge.length>e;e++){let l=ge[e];if(!l.show||!l._show)continue;let t,n,u=l.side,a=u%2,f=l.stroke(k,e),c=0==u||3==u?-1:1;if(l.label){let e=ne((l._lpos+l.labelGap*c)*y);sn(l.labelFont[0],f,"center",2==u?i:o),J.save(),1==a?(t=n=0,J.translate(e,ne(Ul+Vl/2)),J.rotate((3==u?-ee:ee)/2)):(t=ne(jl+Bl/2),n=e),J.fillText(l.label,t,n),J.restore()}let[h,d]=l._found;if(0==d)continue;let p=ve[l.scale],m=0==a?Bl:Vl,g=0==a?jl:Ul,x=ne(l.gap*y),w=l._splits,_=2==p.distr?w.map((e=>en[e])):w,b=2==p.distr?en[w[1]]-en[w[0]]:h,v=l.ticks,M=l.border,S=v.show?ne(v.size*y):0,E=l._rotate*-ee/180,T=ue(l._pos*y),z=T+(S+x)*c;n=0==a?z:0,t=1==a?z:0,sn(l.font[0],f,1==l.align?s:2==l.align?r:E>0?s:0>E?r:0==a?"center":3==u?r:s,E||1==a?"middle":2==u?i:o);let D=l.font[1]*l.lineGap,P=w.map((e=>ue(H(e,p,m,g)))),A=l._values;for(let e=0;A.length>e;e++){let l=A[e];if(null!=l){0==a?t=P[e]:n=P[e],l=""+l;let i=-1==l.indexOf("\n")?[l]:l.split(/\n/gm);for(let e=0;i.length>e;e++){let l=i[e];E?(J.save(),J.translate(t,n+e*D),J.rotate(E),J.fillText(l,0,0),J.restore()):J.fillText(l,t,n+e*D)}}}v.show&&mn(P,v.filter(k,_,e,d,b),a,u,T,S,Se(v.width*y,3),v.stroke(k,e),v.dash,v.cap);let W=l.grid;W.show&&mn(P,W.filter(k,_,e,d,b),a,0==a?2:1,0==a?Ul:jl,0==a?Vl:Bl,Se(W.width*y,3),W.stroke(k,e),W.dash,W.cap),M.show&&mn([T],[1],0==a?1:0,0==a?1:2,1==a?Ul:jl,1==a?Vl:Bl,Se(M.width*y,3),M.stroke(k,e),M.dash,M.cap)}wi("drawAxes")},series:function(){St>0&&(de.forEach(((e,l)=>{if(l>0&&e.show&&(an(l,!1),an(l,!0),null==e._paths)){let t=2==M?[0,g[l][0].length-1]:function(e){let l=pe(Et-1,0,St-1),t=pe(Tt+1,0,St-1);for(;null==e[l]&&l>0;)l--;for(;null==e[t]&&St-1>t;)t++;return[l,t]}(g[l]);e._paths=e.paths(k,l,t[0],t[1])}})),de.forEach(((e,l)=>{if(l>0&&e.show){Qt!=e.alpha&&(J.globalAlpha=Qt=e.alpha),null!=e._paths&&fn(l,!1);{let t=null!=e._paths?e._paths.gaps:null,n=e.points.show(k,l,Et,Tt,t),i=e.points.filter(k,l,n,t);(n||i)&&(e.points._paths=e.points.paths(k,l,Et,Tt,i),fn(l,!0))}1!=Qt&&(J.globalAlpha=Qt=1),wi("drawSeries",l)}})))}},Re=(u.drawOrder||["axes","series"]).map((e=>Ye[e]));function Le(e){let l=ve[e];if(null==l){let t=(u.scales||De)[e]||De;if(null!=t.from)Le(t.from),ve[e]=Ie({},ve[t.from],t,{key:e});else{l=ve[e]=Ie({},e==ze?nt:it,t),l.key=e;let n=l.time,i=l.range,o=We(i);if((e!=ze||2==M&&!n)&&(!o||null!=i[0]&&null!=i[1]||(i={min:null==i[0]?B:{mode:1,hard:i[0],soft:i[0]},max:null==i[1]?B:{mode:1,hard:i[1],soft:i[1]}},o=!1),!o&&Fe(i))){let e=i;i=(l,t,n)=>null==t?Ae:q(t,n,e)}l.range=me(i||(n?Gt:e==ze?3==l.distr?Ot:4==l.distr?jt:Rt:3==l.distr?Lt:4==l.distr?Nt:It)),l.auto=me(!o&&l.auto),l.clamp=me(l.clamp||tt),l._min=l._max=null}}}Le("x"),Le("y"),1==M&&de.forEach((e=>{Le(e.scale)})),ge.forEach((e=>{Le(e.scale)}));for(let e in u.scales)Le(e);const Ne=ve[ze],je=Ne.distr;let Ue,Be;0==Ne.ori?(S(O,"u-hz"),Ue=W,Be=C):(S(O,"u-vt"),Ue=C,Be=W);const Ve={};for(let e in ve){let l=ve[e];null==l.min&&null==l.max||(Ve[e]={min:l.min,max:l.max},l.min=l.max=null)}const Je=u.tzDate||(e=>new Date(ne(e/fe))),qe=u.fmtDate||Xe,Ke=1==fe?xl(Je):bl(Je),Ze=kl(Je,vl(1==fe?gl:_l,qe)),$e=Sl(Je,Ml("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",qe)),Qe=[],el=k.legend=Ie({},El,u.legend),ll=el.show,il=el.markers;let ol,sl,rl;el.idxs=Qe,il.width=me(il.width),il.dash=me(il.dash),il.stroke=me(il.stroke),il.fill=me(il.fill);let ul,al=[],fl=[],cl=!1,hl={};if(el.live){const e=de[1]?de[1].values:null;cl=null!=e,ul=cl?e(k,1,0):{_:0};for(let e in ul)hl[e]=w}if(ll)if(ol=z("table","u-legend",O),rl=z("tbody",null,ol),el.mount(k,ol),cl){sl=z("thead",null,ol,rl);let e=z("tr",null,sl);for(var dl in z("th",null,e),ul)z("th",l,e).textContent=dl}else S(ol,"u-inline"),el.live&&S(ol,"u-live");const pl={show:!0},yl={show:!1},Tl=new Map;function zl(e,l,t,n=!0){const i=Tl.get(l)||{},o=pt.bind[e](k,l,t,n);o&&(G(e,l,i[e]=o),Tl.set(l,i))}function Dl(e,l){const t=Tl.get(l)||{};for(let n in t)null!=e&&n!=e||(I(n,l,t[n]),delete t[n]);null==e&&Tl.delete(l)}let Al=0,Wl=0,Yl=0,Cl=0,Fl=0,Hl=0,jl=0,Ul=0,Bl=0,Vl=0;k.bbox={};let Jl=!1,$l=!1,Ql=!1,ot=!1,rt=!1,ut=!1;function ft(e,l,t){(t||e!=k.width||l!=k.height)&&ct(e,l),wn(!1),Ql=!0,$l=!0,0>pt.left||(ot=ut=!0),Wn()}function ct(e,l){k.width=Al=Yl=e,k.height=Wl=Cl=l,Fl=Hl=0,function(){let e=!1,l=!1,t=!1,n=!1;ge.forEach((i=>{if(i.show&&i._show){let{side:o,_size:s}=i,r=s+(null!=i.label?i.labelSize:0);r>0&&(o%2?(Yl-=r,3==o?(Fl+=r,n=!0):t=!0):(Cl-=r,0==o?(Hl+=r,e=!0):l=!0))}})),vt[0]=e,vt[1]=t,vt[2]=l,vt[3]=n,Yl-=Mt[1]+Mt[3],Fl+=Mt[3],Cl-=Mt[2]+Mt[0],Hl+=Mt[0]}(),function(){let e=Fl+Yl,l=Hl+Cl,t=Fl,n=Hl;function i(i,o){switch(i){case 1:return e+=o,e-o;case 2:return l+=o,l-o;case 3:return t-=o,t+o;case 0:return n-=o,n+o}}ge.forEach((e=>{if(e.show&&e._show){let l=e.side;e._pos=i(l,e._size),null!=e.label&&(e._lpos=i(l,e.labelSize))}}))}();let t=k.bbox;jl=t.left=ke(Fl*y,.5),Ul=t.top=ke(Hl*y,.5),Bl=t.width=ke(Yl*y,.5),Vl=t.height=ke(Cl*y,.5)}const ht=3;k.setSize=function({width:e,height:l}){ft(e,l)};const pt=k.cursor=Ie({},Pl,{drag:{y:2==M}},u.cursor),mt=e=>{pt.event=e};pt.idxs=Qe,pt._lock=!1;let gt=pt.points;gt.show=me(gt.show),gt.size=me(gt.size),gt.stroke=me(gt.stroke),gt.width=me(gt.width),gt.fill=me(gt.fill);const xt=k.focus=Ie({},u.focus||{alpha:.3},pt.focus),wt=xt.prox>=0;let _t=[null];function bt(t,n){if(1==M||n>0){let e=1==M&&ve[t.scale].time,l=t.value;t.value=e?Ce(l)?Sl(Je,Ml(l,qe)):l||$e:l||Xl,t.label=t.label||(e?"Time":"Value")}if(n>0){t.width=null==t.width?1:t.width,t.paths=t.paths||Yt||we,t.fillTo=me(t.fillTo||at),t.pxAlign=+K(t.pxAlign,te),t.pxRound=dt(t.pxAlign),t.stroke=me(t.stroke||null),t.fill=me(t.fill||null),t._stroke=t._fill=t._paths=t._focus=null;let e=function(e){return Se(1*(3+2*(e||1)),3)}(se(1,t.width)),l=t.points=Ie({},{size:e,width:se(1,.2*e),stroke:t.stroke,space:2*e,paths:Ct,_stroke:null,_fill:null},t.points);l.show=me(l.show),l.filter=me(l.filter),l.fill=me(l.fill),l.stroke=me(l.stroke),l.paths=me(l.paths),l.pxAlign=t.pxAlign}if(ll){let i=function(t,n){if(0==n&&(cl||!el.live||2==M))return Ae;let i=[],o=z("tr","u-series",rl,rl.childNodes[n]);S(o,t.class),t.show||S(o,e);let s=z("th",null,o);if(il.show){let e=D("u-marker",s);if(n>0){let l=il.width(k,n);l&&(e.style.border=l+"px "+il.dash(k,n)+" "+il.stroke(k,n)),e.style.background=il.fill(k,n)}}let r=D(l,s);for(var u in r.textContent=t.label,n>0&&(il.show||(r.style.color=t.width>0?il.stroke(k,n):il.fill(k,n)),zl("click",s,(e=>{if(pt._lock)return;mt(e);let l=de.indexOf(t);if((e.ctrlKey||e.metaKey)!=el.isolate){let e=de.some(((e,t)=>t>0&&t!=l&&e.show));de.forEach(((t,n)=>{n>0&&jn(n,e?n==l?pl:yl:pl,!0,bi.setSeries)}))}else jn(l,{show:!t.show},!0,bi.setSeries)}),!1),wt&&zl(d,s,(e=>{pt._lock||(mt(e),jn(de.indexOf(t),Jn,!0,bi.setSeries))}),!1)),ul){let e=z("td","u-value",o);e.textContent="--",i.push(e)}return[o,i]}(t,n);al.splice(n,0,i[0]),fl.splice(n,0,i[1]),el.values.push(null)}if(pt.show){Qe.splice(n,0,null);let e=function(e,l){if(l>0){let t=pt.points.show(k,l);if(t)return S(t,"u-cursor-pt"),S(t,e.class),A(t,-10,-10,Yl,Cl),$.insertBefore(t,_t[l]),t}}(t,n);e&&_t.splice(n,0,e)}wi("addSeries",n)}k.addSeries=function(e,l){l=null==l?de.length:l,e=1==M?Ht(e,l,Gl,lt):Ht(e,l,null,et),de.splice(l,0,e),bt(de[l],l)},k.delSeries=function(e){if(de.splice(e,1),ll){el.values.splice(e,1),fl.splice(e,1);let l=al.splice(e,1)[0];Dl(null,l.firstChild),l.remove()}pt.show&&(Qe.splice(e,1),_t.length>1&&_t.splice(e,1)[0].remove()),wi("delSeries",e)};const vt=[!1,!1,!1,!1];function kt(e,l,t){let[n,i,o,s]=t,r=l%2,u=0;return 0==r&&(s||i)&&(u=0==l&&!n||2==l&&!o?ne(Rl.size/3):0),1==r&&(n||o)&&(u=1==l&&!i||3==l&&!s?ne(Zl.size/2):0),u}const yt=k.padding=(u.padding||[kt,kt,kt,kt]).map((e=>me(K(e,kt)))),Mt=k._padding=yt.map(((e,l)=>e(k,l,vt,0)));let St,Et=null,Tt=null;const zt=1==M?de[0].idxs:null;let Dt,Pt,Wt,Jt,qt,Kt,Xt,Zt,$t,Qt,en=null,ln=!1;function tn(e,l){if(g=null==e?[]:e,2==M){St=0;for(let e=1;de.length>e;e++)St+=g[e][0].length;k._data=g}else{0==g.length&&(g=[[]]),en=g[0],St=en.length;let e=g;if(2==je){e=g.slice();let l=e[0]=Array(St);for(let e=0;St>e;e++)l[e]=e}k._data=g=e}if(k.data=g,wn(!0),wi("setData"),2==je&&(Ql=!0),!1!==l){let e=Ne;e.auto(k,ln)?nn():Nn(ze,e.min,e.max),ot=ot||pt.left>=0,ut=!0,Wn()}}function nn(){let e,l;ln=!0,1==M&&(St>0?(Et=zt[0]=0,Tt=zt[1]=St-1,e=g[0][Et],l=g[0][Tt],2==je?(e=Et,l=Tt):e==l&&(3==je?[e,l]=N(e,e,Ne.log,!1):4==je?[e,l]=j(e,e,Ne.log,!1):Ne.time?l=e+ne(86400/fe):[e,l]=q(e,l,U,!0))):(Et=zt[0]=e=null,Tt=zt[1]=l=null)),Nn(ze,e,l)}function on(e,l,t,n,i,o){e??=a,t??=Pe,n??="butt",i??=a,o??="round",e!=Dt&&(J.strokeStyle=Dt=e),i!=Pt&&(J.fillStyle=Pt=i),l!=Wt&&(J.lineWidth=Wt=l),o!=qt&&(J.lineJoin=qt=o),n!=Kt&&(J.lineCap=Kt=n),t!=Jt&&J.setLineDash(Jt=t)}function sn(e,l,t,n){l!=Pt&&(J.fillStyle=Pt=l),e!=Xt&&(J.font=Xt=e),t!=Zt&&(J.textAlign=Zt=t),n!=$t&&(J.textBaseline=$t=n)}function rn(e,l,t,n,i=0){if(n.length>0&&e.auto(k,ln)&&(null==l||null==l.min)){let l=K(Et,0),o=K(Tt,n.length-1),s=null==t.min?3==e.distr?function(e,l,t){let n=he,i=-he;for(let o=l;t>=o;o++){let l=e[o];null!=l&&l>0&&(n>l&&(n=l),l>i&&(i=l))}return[n==he?1:n,i==-he?10:i]}(n,l,o):function(e,l,t,n){let i=he,o=-he;if(1==n)i=e[l],o=e[t];else if(-1==n)i=e[t],o=e[l];else for(let n=l;t>=n;n++){let l=e[n];null!=l&&(i>l&&(i=l),l>o&&(o=l))}return[i,o]}(n,l,o,i):[t.min,t.max];e.min=oe(e.min,t.min=s[0]),e.max=se(e.max,t.max=s[1])}}k.setData=tn;const un={min:null,max:null};function an(e,l){let t=l?de[e].points:de[e];t._stroke=t.stroke(k,e),t._fill=t.fill(k,e)}function fn(e,l){let t=l?de[e].points:de[e],{stroke:n,fill:i,clip:o,flags:s,_stroke:r=t._stroke,_fill:u=t._fill,_width:a=t.width}=t._paths;a=Se(a*y,3);let f=null,c=a%2/2;l&&null==u&&(u=a>0?"#fff":r);let h=1==t.pxAlign&&c>0;if(h&&J.translate(c,c),!l){let e=jl-a/2,l=Ul-a/2,t=Bl+a,n=Vl+a;f=new Path2D,f.rect(e,l,t,n)}l?hn(r,a,t.dash,t.cap,u,n,i,s,o):function(e,l,t,n,i,o,s,r,u,a,f){let c=!1;0!=u&&Me.forEach(((h,d)=>{if(h.series[0]==e){let e,p=de[h.series[1]],m=g[h.series[1]],x=(p._paths||De).band;We(x)&&(x=1==h.dir?x[0]:x[1]);let w=null;p.show&&x&&function(e,l,t){for(l=K(l,0),t=K(t,e.length-1);t>=l;){if(null!=e[l])return!0;l++}return!1}(m,Et,Tt)?(w=h.fill(k,d)||o,e=p._paths.clip):x=null,hn(l,t,n,i,w,s,r,u,a,f,e,x),c=!0}})),c||hn(l,t,n,i,o,s,r,u,a,f)}(e,r,a,t.dash,t.cap,u,n,i,s,f,o),h&&J.translate(-c,-c)}const cn=3;function hn(e,l,t,n,i,o,s,r,u,a,f,c){on(e,l,t,n,i),(u||a||c)&&(J.save(),u&&J.clip(u),a&&J.clip(a)),c?(r&cn)==cn?(J.clip(c),f&&J.clip(f),pn(i,s),dn(e,o,l)):2&r?(pn(i,s),J.clip(c),dn(e,o,l)):1&r&&(J.save(),J.clip(c),f&&J.clip(f),pn(i,s),J.restore(),dn(e,o,l)):(pn(i,s),dn(e,o,l)),(u||a||c)&&J.restore()}function dn(e,l,t){t>0&&(l instanceof Map?l.forEach(((e,l)=>{J.strokeStyle=Dt=l,J.stroke(e)})):null!=l&&e&&J.stroke(l))}function pn(e,l){l instanceof Map?l.forEach(((e,l)=>{J.fillStyle=Pt=l,J.fill(e)})):null!=l&&e&&J.fill(l)}function mn(e,l,t,n,i,o,s,r,u,a){let f=s%2/2;1==te&&J.translate(f,f),on(r,s,u,a,r),J.beginPath();let c,h,d,p,m=i+(0==n||3==n?-o:o);0==t?(h=i,p=m):(c=i,d=m);for(let n=0;e.length>n;n++)null!=l[n]&&(0==t?c=d=e[n]:h=p=e[n],J.moveTo(c,h),J.lineTo(d,p));J.stroke(),1==te&&J.translate(-f,-f)}function gn(e){let l=!0;return ge.forEach(((t,n)=>{if(!t.show)return;let i=ve[t.scale];if(null==i.min)return void(t._show&&(l=!1,t._show=!1,wn(!1)));t._show||(l=!1,t._show=!0,wn(!1));let o=t.side,s=o%2,{min:r,max:u}=i,[a,f]=function(e,l,t,n){let i,o=ge[e];if(n>0){let s=o._space=o.space(k,e,l,t,n);i=Ut(l,t,o._incrs=o.incrs(k,e,l,t,n,s),n,s)}else i=[0,0];return o._found=i}(n,r,u,0==s?Yl:Cl);if(0==f)return;let c=t._splits=t.splits(k,n,r,u,a,f,2==i.distr),h=2==i.distr?c.map((e=>en[e])):c,d=2==i.distr?en[c[1]]-en[c[0]]:a,p=t._values=t.values(k,t.filter(k,h,n,f,d),n,f,d);t._rotate=2==o?t.rotate(k,p,n,f):0;let m=t._size;t._size=ie(t.size(k,p,n,e)),null!=m&&t._size!=m&&(l=!1)})),l}function xn(e){let l=!0;return yt.forEach(((t,n)=>{let i=t(k,n,vt,e);i!=Mt[n]&&(l=!1),Mt[n]=i})),l}function wn(e){de.forEach(((l,t)=>{t>0&&(l._paths=null,e&&(1==M?(l.min=null,l.max=null):l.facets.forEach((e=>{e.min=null,e.max=null}))))}))}let _n,bn,vn,kn,yn,Mn,Sn,En,Tn,zn,Dn,Pn,An=!1;function Wn(){An||(Oe(Yn),An=!0)}function Yn(){Jl&&(function(){for(let e in ve){let l=ve[e];null==Ve[e]&&(null==l.min||null!=Ve[ze]&&l.auto(k,ln))&&(Ve[e]=un)}for(let e in ve){let l=ve[e];null==Ve[e]&&null!=l.from&&null!=Ve[l.from]&&(Ve[e]=un)}null!=Ve[ze]&&wn(!0);let e={};for(let l in Ve){let t=Ve[l];if(null!=t){let n=e[l]=Ge(ve[l],He);if(null!=t.min)Ie(n,t);else if(l!=ze||2==M)if(0==St&&null==n.from){let e=n.range(k,null,null,l);n.min=e[0],n.max=e[1]}else n.min=he,n.max=-he}}if(St>0){de.forEach(((l,t)=>{if(1==M){let n=l.scale,i=Ve[n];if(null==i)return;let o=e[n];if(0==t){let e=o.range(k,o.min,o.max,n);o.min=e[0],o.max=e[1],Et=L(o.min,g[0]),Tt=L(o.max,g[0]),Tt-Et>1&&(o.min>g[0][Et]&&Et++,g[0][Tt]>o.max&&Tt--),l.min=en[Et],l.max=en[Tt]}else l.show&&l.auto&&rn(o,i,l,g[t],l.sorted);l.idxs[0]=Et,l.idxs[1]=Tt}else if(t>0&&l.show&&l.auto){let[n,i]=l.facets,o=n.scale,s=i.scale,[r,u]=g[t];rn(e[o],Ve[o],n,r,n.sorted),rn(e[s],Ve[s],i,u,i.sorted),l.min=i.min,l.max=i.max}}));for(let l in e){let t=e[l],n=Ve[l];if(null==t.from&&(null==n||null==n.min)){let e=t.range(k,t.min==he?null:t.min,t.max==-he?null:t.max,l);t.min=e[0],t.max=e[1]}}}for(let l in e){let t=e[l];if(null!=t.from){let n=e[t.from];if(null==n.min)t.min=t.max=null;else{let e=t.range(k,n.min,n.max,l);t.min=e[0],t.max=e[1]}}}let l={},t=!1;for(let n in e){let i=e[n],o=ve[n];if(o.min!=i.min||o.max!=i.max){o.min=i.min,o.max=i.max;let e=o.distr;o._min=3==e?ae(o.min):4==e?ce(o.min,o.asinh):o.min,o._max=3==e?ae(o.max):4==e?ce(o.max,o.asinh):o.max,l[n]=t=!0}}if(t){de.forEach(((e,t)=>{2==M?t>0&&l.y&&(e._paths=null):l[e.scale]&&(e._paths=null)}));for(let e in l)Ql=!0,wi("setScale",e);pt.show&&pt.left>=0&&(ot=ut=!0)}for(let e in Ve)Ve[e]=null}(),Jl=!1),Ql&&(function(){let e=jl,l=Ul,t=Bl,n=Vl,i=!1,o=0;for(;!i;){o++;let s=gn(o),r=xn(o);i=o==ht||s&&r,i||(ct(k.width,k.height),$l=!0,jl==e&&Ul==l&&Bl==t&&Vl==n||wn(!1))}}(),Ql=!1),$l&&(T(Z,s,Fl),T(Z,i,Hl),T(Z,t,Yl),T(Z,n,Cl),T($,s,Fl),T($,i,Hl),T($,t,Yl),T($,n,Cl),T(X,t,Al),T(X,n,Wl),V.width=ne(Al*y),V.height=ne(Wl*y),ge.forEach((({_el:l,_show:t,_size:n,_pos:i,side:o})=>{if(null!=l)if(t){let t=o%2==1;T(l,t?"left":"top",i-(3===o||0===o?n:0)),T(l,t?"width":"height",n),T(l,t?"top":"left",t?Hl:Fl),T(l,t?"height":"width",t?Cl:Yl),E(l,e)}else S(l,e)})),Dt=Pt=Wt=qt=Kt=Xt=Zt=$t=Jt=null,Qt=1,ni(!0),wi("setSize"),$l=!1),Al>0&&Wl>0&&(J.clearRect(0,0,V.width,V.height),wi("drawClear"),Re.forEach((e=>e())),wi("draw")),In.show&&rt&&(On(In),rt=!1),pt.show&&ot&&(li(null,!0,!1),ot=!1),el.show&&el.live&&ut&&(Qn(),ut=!1),R||(R=!0,k.status=1,wi("ready")),ln=!1,An=!1}function Cn(e,l){let t=ve[e];if(null==t.from){if(0==St){let n=t.range(k,l.min,l.max,e);l.min=n[0],l.max=n[1]}if(l.min>l.max){let e=l.min;l.min=l.max,l.max=e}if(St>1&&null!=l.min&&null!=l.max&&1e-16>l.max-l.min)return;e==ze&&2==t.distr&&St>0&&(l.min=L(l.min,g[0]),l.max=L(l.max,g[0]),l.min==l.max&&l.max++),Ve[e]=l,Jl=!0,Wn()}}k.redraw=(e,l)=>{Ql=l||!1,!1!==e?Nn(ze,Ne.min,Ne.max):Wn()},k.setScale=Cn;let Fn=!1;const Hn=pt.drag;let Rn=Hn.x,Gn=Hn.y;pt.show&&(pt.x&&(_n=D("u-cursor-x",$)),pt.y&&(bn=D("u-cursor-y",$)),0==Ne.ori?(vn=_n,kn=bn):(vn=bn,kn=_n),Dn=pt.left,Pn=pt.top);const In=k.select=Ie({show:!0,over:!0,left:0,width:0,top:0,height:0},u.select),Ln=In.show?D("u-select",In.over?$:Z):null;function On(e,l){if(In.show){for(let l in e)In[l]=e[l],l in si&&T(Ln,l,e[l]);!1!==l&&wi("setSelect")}}function Nn(e,l,t){Cn(e,{min:l,max:t})}function jn(l,t,n,i){null!=t.focus&&function(e){if(e!=Vn){let l=null==e,t=1!=xt.alpha;de.forEach(((n,i)=>{let o=l||0==i||i==e;n._focus=l?null:o,t&&function(e,l){de[e].alpha=l,pt.show&&_t[e]&&(_t[e].style.opacity=l),ll&&al[e]&&(al[e].style.opacity=l)}(i,o?1:xt.alpha)})),Vn=e,t&&Wn()}}(l),null!=t.show&&de.forEach(((n,i)=>{0>=i||l!=i&&null!=l||(n.show=t.show,function(l){let t=ll?al[l]:null;de[l].show?t&&E(t,e):(t&&S(t,e),_t.length>1&&A(_t[l],-10,-10,Yl,Cl))}(i),Nn(2==M?n.facets[1].scale:n.scale,null,null),Wn())})),!1!==n&&wi("setSeries",l,t),i&&yi("setSeries",k,l,t)}let Un,Bn,Vn;k.setSelect=On,k.setSeries=jn,k.addBand=function(e,l){e.fill=me(e.fill||null),e.dir=K(e.dir,-1),Me.splice(l=null==l?Me.length:l,0,e)},k.setBand=function(e,l){Ie(Me[e],l)},k.delBand=function(e){null==e?Me.length=0:Me.splice(e,1)};const Jn={focus:!0};function qn(e,l,t){let n=ve[l];t&&(e=e/y-(1==n.ori?Hl:Fl));let i=Yl;1==n.ori&&(i=Cl,e=i-e),-1==n.dir&&(e=i-e);let o=n._min,s=o+e/i*(n._max-o),r=n.distr;return 3==r?re(10,s):4==r?((e,l=1)=>Q.sinh(e)*l)(s,n.asinh):s}function Kn(e,l){T(Ln,s,In.left=e),T(Ln,t,In.width=l)}function Xn(e,l){T(Ln,i,In.top=e),T(Ln,n,In.height=l)}ll&&wt&&zl(p,ol,(e=>{pt._lock||(mt(e),null!=Vn&&jn(null,Jn,!0,bi.setSeries))})),k.valToIdx=e=>L(e,g[0]),k.posToIdx=function(e,l){return L(qn(e,ze,l),g[0],Et,Tt)},k.posToVal=qn,k.valToPos=(e,l,t)=>0==ve[l].ori?W(e,ve[l],t?Bl:Yl,t?jl:0):C(e,ve[l],t?Vl:Cl,t?Ul:0),k.batch=function(e){e(k),Wn()},k.setCursor=(e,l,t)=>{Dn=e.left,Pn=e.top,li(null,l,t)};let Zn=0==Ne.ori?Kn:Xn,$n=1==Ne.ori?Kn:Xn;function Qn(e,l){null!=e&&(e.idxs?e.idxs.forEach(((e,l)=>{Qe[l]=e})):(e=>void 0===e)(e.idx)||Qe.fill(e.idx),el.idx=Qe[0]);for(let e=0;de.length>e;e++)(e>0||1==M&&!cl)&&ei(e,Qe[e]);ll&&el.live&&function(){if(ll&&el.live)for(let e=2==M?1:0;de.length>e;e++){if(0==e&&cl)continue;let l=el.values[e],t=0;for(let n in l)fl[e][t++].firstChild.nodeValue=l[n]}}(),ut=!1,!1!==l&&wi("setLegend")}function ei(e,l){let t,n=de[e],i=0==e&&2==je?en:g[e];cl?t=n.values(k,e,l)??hl:(t=n.value(k,null==l?null:i[l],e,l),t=null==t?hl:{_:t}),el.values[e]=t}function li(e,l,t){let n;Tn=Dn,zn=Pn,[Dn,Pn]=pt.move(k,Dn,Pn),pt.show&&(vn&&A(vn,ne(Dn),0,Yl,Cl),kn&&A(kn,0,ne(Pn),Yl,Cl)),Un=he;let i=0==Ne.ori?Yl:Cl,o=1==Ne.ori?Yl:Cl;if(0>Dn||0==St||Et>Tt){n=null;for(let e=0;de.length>e;e++)e>0&&_t.length>1&&A(_t[e],-10,-10,Yl,Cl);wt&&jn(null,Jn,!0,null==e&&bi.setSeries),el.live&&(Qe.fill(n),ut=!0)}else{let e,l,t;1==M&&(e=0==Ne.ori?Dn:Pn,l=qn(e,ze),n=L(l,g[0],Et,Tt),t=Ue(g[0][n],Ne,i,0));for(let e=2==M?1:0;de.length>e;e++){let s=de[e],r=Qe[e],u=null==r?null:1==M?g[e][r]:g[e][1][r],a=pt.dataIdx(k,e,n,l),f=null==a?null:1==M?g[e][a]:g[e][1][a];ut=ut||f!=u||a!=r,Qe[e]=a;let c=ye(a==n?t:Ue(1==M?g[0][a]:g[e][0][a],Ne,i,0),1);if(e>0&&s.show){let l,t,n=null==f?-10:ye(Be(f,1==M?ve[s.scale]:ve[s.facets[1].scale],o,0),1);if(wt&&1==M&&null!=f){let l=le(xt.dist(k,e,a,n,Pn));if(Un>l){let t=xt.bias;if(0!=t){let n=qn(1==Ne.ori?Dn:Pn,s.scale),i=0>n?-1:1;i!=(0>f?-1:1)||(1==i?1==t?n>f:f>n:1==t?f>n:n>f)||(Un=l,Bn=e)}else Un=l,Bn=e}}if(0==Ne.ori?(l=c,t=n):(l=n,t=c),ut&&_t.length>1){Y(_t[e],pt.points.fill(k,e),pt.points.stroke(k,e));let n,i,o,s,r=!0,u=pt.points.bbox;if(null!=u){r=!1;let l=u(k,e);o=l.left,s=l.top,n=l.width,i=l.height}else o=l,s=t,n=i=pt.points.size(k,e);F(_t[e],n,i,r),A(_t[e],o,s,Yl,Cl)}}}}if(pt.idx=n,pt.left=Dn,pt.top=Pn,ut&&(el.idx=n,Qn()),In.show&&Fn)if(null!=e){let[l,t]=bi.scales,[n,s]=bi.match,[r,u]=e.cursor.sync.scales,a=e.cursor.drag;if(Rn=a._x,Gn=a._y,Rn||Gn){let a,f,c,h,d,{left:p,top:m,width:g,height:x}=e.select,w=e.scales[l].ori,_=e.posToVal,b=null!=l&&n(l,r),v=null!=t&&s(t,u);b&&Rn?(0==w?(a=p,f=g):(a=m,f=x),c=ve[l],h=Ue(_(a,r),c,i,0),d=Ue(_(a+f,r),c,i,0),Zn(oe(h,d),le(d-h))):Zn(0,i),v&&Gn?(1==w?(a=p,f=g):(a=m,f=x),c=ve[t],h=Be(_(a,u),c,o,0),d=Be(_(a+f,u),c,o,0),$n(oe(h,d),le(d-h))):$n(0,o)}else ri()}else{let e=le(Tn-yn),l=le(zn-Mn);if(1==Ne.ori){let t=e;e=l,l=t}Rn=Hn.x&&e>=Hn.dist,Gn=Hn.y&&l>=Hn.dist;let t,n,s=Hn.uni;null!=s?Rn&&Gn&&(Rn=e>=s,Gn=l>=s,Rn||Gn||(l>e?Gn=!0:Rn=!0)):Hn.x&&Hn.y&&(Rn||Gn)&&(Rn=Gn=!0),Rn&&(0==Ne.ori?(t=Sn,n=Dn):(t=En,n=Pn),Zn(oe(t,n),le(n-t)),Gn||$n(0,o)),Gn&&(1==Ne.ori?(t=Sn,n=Dn):(t=En,n=Pn),$n(oe(t,n),le(n-t)),Rn||Zn(0,i)),Rn||Gn||(Zn(0,0),$n(0,0))}if(Hn._x=Rn,Hn._y=Gn,null==e){if(t){if(null!=vi){let[e,l]=bi.scales;bi.values[0]=null!=e?qn(0==Ne.ori?Dn:Pn,e):null,bi.values[1]=null!=l?qn(1==Ne.ori?Dn:Pn,l):null}yi(f,k,Dn,Pn,Yl,Cl,n)}if(wt){let e=t&&bi.setSeries,l=xt.prox;null==Vn?Un>l||jn(Bn,Jn,!0,e):Un>l?jn(null,Jn,!0,e):Bn!=Vn&&jn(Bn,Jn,!0,e)}}!1!==l&&wi("setCursor")}k.setLegend=Qn;let ti=null;function ni(e=!1){e?ti=null:(ti=$.getBoundingClientRect(),wi("syncRect",ti))}function ii(e,l,t,n,i,o){pt._lock||Fn&&null!=e&&0==e.movementX&&0==e.movementY||(oi(e,l,t,n,i,o,0,!1,null!=e),null!=e?li(null,!0,!0):li(l,!0,!1))}function oi(e,l,t,n,i,o,s,r,u){if(null==ti&&ni(!1),mt(e),null!=e)t=e.clientX-ti.left,n=e.clientY-ti.top;else{if(0>t||0>n)return Dn=-10,void(Pn=-10);let[e,s]=bi.scales,r=l.cursor.sync,[u,a]=r.values,[f,c]=r.scales,[h,d]=bi.match,p=l.axes[0].side%2==1,m=0==Ne.ori?Yl:Cl,g=1==Ne.ori?Yl:Cl,x=p?o:i,w=p?i:o,_=p?n:t,b=p?t:n;if(t=null!=f?h(e,f)?H(u,ve[e],m,0):-10:m*(_/x),n=null!=c?d(s,c)?H(a,ve[s],g,0):-10:g*(b/w),1==Ne.ori){let e=t;t=n,n=e}}u&&(t>1&&Yl-1>t||(t=ke(t,Yl)),n>1&&Cl-1>n||(n=ke(n,Cl))),r?(yn=t,Mn=n,[Sn,En]=pt.move(k,t,n)):(Dn=t,Pn=n)}Object.defineProperty(k,"rect",{get:()=>(null==ti&&ni(!1),ti)});const si={width:0,height:0,left:0,top:0};function ri(){On(si,!1)}let ui,ai,fi,ci;function hi(e,l,t,n,i,o){Fn=!0,Rn=Gn=Hn._x=Hn._y=!1,oi(e,l,t,n,i,o,0,!0,!1),null!=e&&(zl(h,b,di,!1),yi(c,k,Sn,En,Yl,Cl,null));let{left:s,top:r,width:u,height:a}=In;ui=s,ai=r,fi=u,ci=a,ri()}function di(e,l,t,n,i,o){Fn=Hn._x=Hn._y=!1,oi(e,l,t,n,i,o,0,!1,!0);let{left:s,top:r,width:u,height:a}=In,f=u>0||a>0,c=ui!=s||ai!=r||fi!=u||ci!=a;if(f&&c&&On(In),Hn.setScale&&f&&c){let e=s,l=u,t=r,n=a;if(1==Ne.ori&&(e=r,l=a,t=s,n=u),Rn&&Nn(ze,qn(e,ze),qn(e+l,ze)),Gn)for(let e in ve){let l=ve[e];e!=ze&&null==l.from&&l.min!=he&&Nn(e,qn(t+n,e),qn(t,e))}ri()}else pt.lock&&(pt._lock=!pt._lock,pt._lock||li(null,!0,!1));null!=e&&(Dl(h,b),yi(h,k,Dn,Pn,Yl,Cl,null))}function pi(e){pt._lock||(mt(e),nn(),ri(),null!=e&&yi(m,k,Dn,Pn,Yl,Cl,null))}function mi(){ge.forEach(Vt),ft(k.width,k.height,!0)}G(x,v,mi);const gi={};gi.mousedown=hi,gi.mousemove=ii,gi.mouseup=di,gi.dblclick=pi,gi.setSeries=(e,l,t,n)=>{-1!=(t=(0,bi.match[2])(k,l,t))&&jn(t,n,!0,!1)},pt.show&&(zl(c,$,hi),zl(f,$,ii),zl(d,$,(e=>{mt(e),ni(!1)})),zl(p,$,(function(e){if(pt._lock)return;mt(e);let l=Fn;if(Fn){let e,l,t=!0,n=!0,i=10;0==Ne.ori?(e=Rn,l=Gn):(e=Gn,l=Rn),e&&l&&(t=i>=Dn||Dn>=Yl-i,n=i>=Pn||Pn>=Cl-i),e&&t&&(Dn=Sn>Dn?0:Yl),l&&n&&(Pn=En>Pn?0:Cl),li(null,!0,!0),Fn=!1}Dn=-10,Pn=-10,li(null,!0,!0),l&&(Fn=l)})),zl(m,$,pi),At.add(k),k.syncRect=ni);const xi=k.hooks=u.hooks||{};function wi(e,l,t){e in xi&&xi[e].forEach((e=>{e.call(null,k,l,t)}))}(u.plugins||[]).forEach((e=>{for(let l in e.hooks)xi[l]=(xi[l]||[]).concat(e.hooks[l])}));const _i=(e,l,t)=>t,bi=Ie({key:null,setSeries:!1,filters:{pub:_e,sub:_e},scales:[ze,de[1]?de[1].scale:null],match:[be,be,_i],values:[null,null]},pt.sync);2==bi.match.length&&bi.match.push(_i),pt.sync=bi;const vi=bi.key,ki=st(vi);function yi(e,l,t,n,i,o,s){bi.filters.pub(e,l,t,n,i,o,s)&&ki.pub(e,l,t,n,i,o,s)}function Mi(){wi("init",u,g),tn(g||u.data,!1),Ve[ze]?Cn(ze,Ve[ze]):nn(),rt=In.show&&(In.width>0||In.height>0),ot=ut=!0,ft(u.width,u.height)}return ki.sub(k),k.pub=function(e,l,t,n,i,o,s){bi.filters.sub(e,l,t,n,i,o,s)&&gi[e](null,l,t,n,i,o,s)},k.destroy=function(){ki.unsub(k),At.delete(k),Tl.clear(),I(x,v,mi),O.remove(),ol?.remove(),wi("destroy")},de.forEach(bt),ge.forEach((function(e,l){if(e._show=e.show,e.show){let t=ve[e.scale];null==t&&(e.scale=e.side%2?de[1].scale:ze,t=ve[e.scale]);let n=t.time;e.size=me(e.size),e.space=me(e.space),e.rotate=me(e.rotate),We(e.incrs)&&e.incrs.forEach((e=>{!Ee.has(e)&&Ee.set(e,Te(e))})),e.incrs=me(e.incrs||(2==t.distr?tl:n?1==fe?ml:wl:nl)),e.splits=me(e.splits||(n&&1==t.distr?Ke:3==t.distr?Ol:4==t.distr?Nl:Ll)),e.stroke=me(e.stroke),e.grid.stroke=me(e.grid.stroke),e.ticks.stroke=me(e.ticks.stroke),e.border.stroke=me(e.border.stroke);let i=e.values;e.values=We(i)&&!We(i[0])?me(i):n?We(i)?kl(Je,vl(i,qe)):Ce(i)?function(e,l){let t=Xe(l);return(l,n)=>n.map((l=>t(e(l))))}(Je,i):i||Ze:i||Il,e.filter=me(e.filter||(3>t.distr||10!=t.log?3==t.distr&&2==t.log?Kl:xe:ql)),e.font=Bt(e.font),e.labelFont=Bt(e.labelFont),e._size=e.size(k,null,l,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(vt[l]=!0,e._el=D("u-axis",X))}})),_?_ instanceof HTMLElement?(_.appendChild(O),Mi()):_(k,Mi):Mi(),k}Jt.assign=Ie,Jt.fmtNum=$,Jt.rangeNum=q,Jt.rangeLog=N,Jt.rangeAsinh=j,Jt.orient=rt,Jt.pxRatio=y,Jt.join=function(e,l){if(function(e){let l=e[0][0],t=l.length;for(let n=1;e.length>n;n++){let i=e[n][0];if(i.length!=t)return!1;if(i!=l)for(let e=0;t>e;e++)if(i[e]!=l[e])return!1}return!0}(e)){let l=e[0].slice();for(let t=1;e.length>t;t++)l.push(...e[t].slice(1));return function(e,l=100){const t=e.length;if(1>=t)return!0;let n=0,i=t-1;for(;i>=n&&null==e[n];)n++;for(;i>=n&&null==e[i];)i--;if(n>=i)return!0;const o=se(1,te((i-n+1)/l));for(let l=e[n],t=n+o;i>=t;t+=o){const n=e[t];if(null!=n){if(l>=n)return!1;l=n}}return!0}(l[0])||(l=function(e){let l=e[0],t=l.length,n=Array(t);for(let e=0;n.length>e;e++)n[e]=e;n.sort(((e,t)=>l[e]-l[t]));let i=[];for(let l=0;e.length>l;l++){let o=e[l],s=Array(t);for(let e=0;t>e;e++)s[e]=o[n[e]];i.push(s)}return i}(l)),l}let t=new Set;for(let l=0;e.length>l;l++){let n=e[l][0],i=n.length;for(let e=0;i>e;e++)t.add(n[e])}let n=[Array.from(t).sort(((e,l)=>e-l))],i=n[0].length,o=new Map;for(let e=0;i>e;e++)o.set(n[0][e],e);for(let t=0;e.length>t;t++){let s=e[t],r=s[0];for(let e=1;s.length>e;e++){let u=s[e],a=Array(i).fill(void 0),f=l?l[t][e]:1,c=[];for(let e=0;u.length>e;e++){let l=u[e],t=o.get(r[e]);null===l?0!=f&&(a[t]=l,2==f&&c.push(t)):a[t]=l}Le(a,c,i),n.push(a)}}return n},Jt.fmtDate=Xe,Jt.tzDate=function(e,l){let t;return"UTC"==l||"Etc/UTC"==l?t=new Date(+e+6e4*e.getTimezoneOffset()):l==Ze?t=e:(t=new Date(e.toLocaleString("en-US",{timeZone:l})),t.setMilliseconds(e.getMilliseconds())),t},Jt.sync=st;{Jt.addGap=function(e,l,t){let n=e[e.length-1];n&&n[0]==l?n[1]=t:e.push([l,t])},Jt.clipGaps=ct;let e=Jt.paths={points:St};e.linear=Dt,e.stepped=function(e){const l=K(e.align,1),t=K(e.ascDesc,!1),n=K(e.alignGaps,0),i=K(e.extend,!1);return(e,o,s,r)=>rt(e,o,((u,a,f,c,h,d,p,m,g,x,w)=>{let _=u.pxRound,{left:b,width:v}=e.bbox,k=e=>_(d(e,c,x,m)),M=e=>_(p(e,h,w,g)),S=0==c.ori?xt:wt;const E={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},T=E.stroke,z=c.dir*(0==c.ori?1:-1);s=O(f,s,r,1),r=O(f,s,r,-1);let D=M(f[1==z?s:r]),P=k(a[1==z?s:r]),A=P,W=P;i&&-1==l&&(W=b,S(T,W,D)),S(T,P,D);for(let e=1==z?s:r;e>=s&&r>=e;e+=z){let t=f[e];if(null==t)continue;let n=k(a[e]),i=M(t);1==l?S(T,n,D):S(T,A,i),S(T,n,i),D=i,A=n}let Y=A;i&&1==l&&(Y=b+v,S(T,Y,D));let[C,F]=ut(e,o);if(null!=u.fill||0!=C){let l=E.fill=new Path2D(T),t=M(u.fillTo(e,o,u.min,u.max,C));S(l,Y,t),S(l,W,t)}if(!u.spanGaps){let i=[];i.push(...ht(a,f,s,r,z,k,n));let h=u.width*y/2,d=t||1==l?h:-h,p=t||-1==l?-h:h;i.forEach((e=>{e[0]+=d,e[1]+=p})),E.gaps=i=u.gaps(e,o,s,r,i),E.clip=ct(i,c.ori,m,g,x,w)}return 0!=F&&(E.band=2==F?[ft(e,o,s,r,T,-1),ft(e,o,s,r,T,1)]:ft(e,o,s,r,T,F)),E}))},e.bars=function(e){const l=K((e=e||De).size,[.6,he,1]),t=e.align||0,n=(e.gap||0)*y;let i=e.radius;i=null==i?[0,0]:"number"==typeof i?[i,0]:i;const o=me(i),s=1-l[0],r=K(l[1],he)*y,u=K(l[2],1)*y,a=K(e.disp,De),f=K(e.each,(()=>{})),{fill:c,stroke:h}=a;return(e,l,i,d)=>rt(e,l,((p,m,g,x,w,_,b,v,k,M,S)=>{let E,T,z=p.pxRound;0==x.ori?[E,T]=o(e,l):[T,E]=o(e,l);const D=x.dir*(0==x.ori?1:-1);let P,A,W=0==x.ori?_t:bt,Y=0==x.ori?f:(e,l,t,n,i,o,s)=>{f(e,l,t,i,n,s,o)},C=K(e.bands,Pe).find((e=>e.series[0]==l)),F=p.fillTo(e,l,p.min,p.max,null!=C?C.dir:0),H=z(b(F,w,S,k)),R=z(p.width*y),G=!1,I=null,L=null,O=null,N=null;null==c||0!=R&&null==h||(G=!0,I=c.values(e,l,i,d),L=new Map,new Set(I).forEach((e=>{null!=e&&L.set(e,new Path2D)})),R>0&&(O=h.values(e,l,i,d),N=new Map,new Set(O).forEach((e=>{null!=e&&N.set(e,new Path2D)}))));let{x0:j,size:U}=a;if(null!=j&&null!=U){m=j.values(e,l,i,d),2==j.unit&&(m=m.map((l=>e.posToVal(v+l*M,x.key,!0))));let t=U.values(e,l,i,d);A=2==U.unit?t[0]*M:_(t[0],x,M,v)-_(0,x,M,v),A/2>R||(R=0),A=z(pe(A-R,u,r)),P=1==D?-R/2:A+R/2}else{let e=M;if(m.length>1){let l=null;for(let t=0,n=1/0;m.length>t;t++)if(void 0!==g[t]){if(null!=l){let i=le(m[t]-m[l]);n>i&&(n=i,e=le(_(m[t],x,M,v)-_(m[l],x,M,v)))}l=t}}let l=e*s;A=e-l-n,A/2>R||(R=0),5>l+n&&(z=ge),A=z(pe(e-l,u,r)-R-n),P=(0==t?A/2:t==D?0:A)-t*D*n/2}const B={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},V=G?null:new Path2D;let J=null;if(null!=C)J=e.data[C.series[1]];else{let{y0:t,y1:n}=a;null!=t&&null!=n&&(g=n.values(e,l,i,d),J=t.values(e,l,i,d))}let q=E*A,X=T*A;for(let t=1==D?i:d;t>=i&&d>=t;t+=D){let n=g[t];if(null==n)continue;if(null!=J){let e=J[t]??0;if(n-e==0)continue;H=b(e,w,S,k)}let i=_(2!=x.distr||null!=a?m[t]:t,x,M,v),o=b(K(n,F),w,S,k),s=z(i-P),r=z(se(o,H)),u=z(oe(o,H)),f=r-u;if(null!=n){let i=0>n?X:q,o=0>n?q:X;G?(R>0&&null!=O[t]&&W(N.get(O[t]),s,u+te(R/2),A,se(0,f-R),i,o),null!=I[t]&&W(L.get(I[t]),s,u+te(R/2),A,se(0,f-R),i,o)):W(V,s,u+te(R/2),A,se(0,f-R),i,o),Y(e,l,t,s-R/2,u,A+R,f)}}return R>0?B.stroke=G?N:V:G||(B._fill=0==p.width?p._fill:p._stroke??p._fill,B.width=0),B.fill=G?L:V,B}))},e.spline=function(e){return function(e,l){const t=K(l?.alignGaps,0);return(l,n,i,o)=>rt(l,n,((s,r,u,a,f,c,h,d,p,m,g)=>{let x,w,_,b=s.pxRound,v=e=>b(c(e,a,m,d)),k=e=>b(h(e,f,g,p));0==a.ori?(x=mt,_=xt,w=yt):(x=gt,_=wt,w=Mt);const y=a.dir*(0==a.ori?1:-1);i=O(u,i,o,1),o=O(u,i,o,-1);let M=v(r[1==y?i:o]),S=M,E=[],T=[];for(let e=1==y?i:o;e>=i&&o>=e;e+=y)if(null!=u[e]){let l=v(r[e]);E.push(S=l),T.push(k(u[e]))}const z={stroke:e(E,T,x,_,w,b),fill:null,clip:null,band:null,gaps:null,flags:1},D=z.stroke;let[P,A]=ut(l,n);if(null!=s.fill||0!=P){let e=z.fill=new Path2D(D),t=k(s.fillTo(l,n,s.min,s.max,P));_(e,S,t),_(e,M,t)}if(!s.spanGaps){let e=[];e.push(...ht(r,u,i,o,y,v,t)),z.gaps=e=s.gaps(l,n,i,o,e),z.clip=ct(e,a.ori,d,p,m,g)}return 0!=A&&(z.band=2==A?[ft(l,n,i,o,D,-1),ft(l,n,i,o,D,1)]:ft(l,n,i,o,D,A)),z}))}(Pt,e)}}return Jt}(); +var uPlot=function(){"use strict";const e="u-off",l="u-label",t="width",n="height",i="top",o="bottom",s="left",r="right",u="#000",a=u+"0",f="mousemove",c="mousedown",h="mouseup",d="mouseenter",p="mouseleave",m="dblclick",g="change",w="dppxchange",x="--",_="undefined"!=typeof window,b=_?document:null,v=_?window:null,k=_?navigator:null;let y,M;function S(e,l){if(null!=l){let t=e.classList;!t.contains(l)&&t.add(l)}}function E(e,l){let t=e.classList;t.contains(l)&&t.remove(l)}function T(e,l,t){e.style[l]=t+"px"}function z(e,l,t,n){let i=b.createElement(e);return null!=l&&S(i,l),null!=t&&t.insertBefore(i,n),i}function D(e,l){return z("div",e,l)}const P=new WeakMap;function A(l,t,n,i,o){let s="translate("+t+"px,"+n+"px)";s!=P.get(l)&&(l.style.transform=s,P.set(l,s),0>t||0>n||t>i||n>o?S(l,e):E(l,e))}const W=new WeakMap;function Y(e,l,t){let n=l+t;n!=W.get(e)&&(W.set(e,n),e.style.background=l,e.style.borderColor=t)}const C=new WeakMap;function F(e,l,t,n){let i=l+""+t;i!=C.get(e)&&(C.set(e,i),e.style.height=t+"px",e.style.width=l+"px",e.style.marginLeft=n?-l/2+"px":0,e.style.marginTop=n?-t/2+"px":0)}const H={passive:!0},R={...H,capture:!0};function G(e,l,t,n){l.addEventListener(e,t,n?R:H)}function I(e,l,t,n){l.removeEventListener(e,t,n?R:H)}function L(e,l,t,n){let i;t=t||0;let o=2147483647>=(n=n||l.length-1);for(;n-t>1;)i=o?t+n>>1:te((t+n)/2),e>l[i]?t=i:n=i;return e-l[t]>l[n]-e?n:t}function O(e,l,t,n){for(let i=1==n?l:t;i>=l&&t>=i;i+=n)if(null!=e[i])return i;return-1}function N(e,l,t,n){let i=ue(e),o=ue(l),s=10==t?ae:fe;e==l&&(-1==i?(e*=t,l/=t):(e/=t,l*=t));let r=1==o?ie:te,u=(1==i?te:ie)(s(le(e))),a=r(s(le(l))),f=re(t,u),c=re(t,a);return 10==t&&(0>u&&(f=Se(f,-u)),0>a&&(c=Se(c,-a))),n||2==t?(e=f*i,l=c*o):(e=Me(e,f),l=ye(l,c)),[e,l]}function j(e,l,t,n){let i=N(e,l,t,n);return 0==e&&(i[0]=0),0==l&&(i[1]=0),i}_&&function e(){let l=devicePixelRatio;y!=l&&(y=l,M&&I(g,M,e),M=matchMedia(`(min-resolution: ${y-.001}dppx) and (max-resolution: ${y+.001}dppx)`),G(g,M,e),v.dispatchEvent(new CustomEvent(w)))}();const U=.1,B={mode:3,pad:U},V={pad:0,soft:null,mode:0},J={min:V,max:V};function q(e,l,t,n){return Fe(t)?X(e,l,t):(V.pad=t,V.soft=n?0:null,V.mode=n?3:0,X(e,l,J))}function K(e,l){return null==e?l:e}function X(e,l,t){let n=t.min,i=t.max,o=K(n.pad,0),s=K(i.pad,0),r=K(n.hard,-he),u=K(i.hard,he),a=K(n.soft,he),f=K(i.soft,-he),c=K(n.mode,0),h=K(i.mode,0),d=l-e,p=ae(d),m=se(le(e),le(l)),g=ae(m),w=le(g-p);(1e-9>d||w>10)&&(d=0,0!=e&&0!=l||(d=1e-9,2==c&&a!=he&&(o=0),2==h&&f!=-he&&(s=0)));let x=d||m||1e3,_=ae(x),b=re(10,te(_)),v=Se(Me(e-x*(0==d?0==e?.1:1:o),b/10),9),k=a>e||1!=c&&(3!=c||v>a)&&(2!=c||a>v)?he:a,y=se(r,k>v&&e>=k?k:oe(k,v)),M=Se(ye(l+x*(0==d?0==l?.1:1:s),b/10),9),S=l>f||1!=h&&(3!=h||f>M)&&(2!=h||M>f)?-he:f,E=oe(u,M>S&&S>=l?S:se(S,M));return y==E&&0==y&&(E=100),[y,E]}const Z=new Intl.NumberFormat(_?k.language:"en-US"),$=e=>Z.format(e),Q=Math,ee=Q.PI,le=Q.abs,te=Q.floor,ne=Q.round,ie=Q.ceil,oe=Q.min,se=Q.max,re=Q.pow,ue=Q.sign,ae=Q.log10,fe=Q.log2,ce=(e,l=1)=>Q.asinh(e/l),he=1/0;function de(e){return 1+(0|ae((e^e>>31)-(e>>31)))}function pe(e,l,t){return oe(se(e,l),t)}function me(e){return"function"==typeof e?e:()=>e}const ge=e=>e,we=(e,l)=>l,xe=()=>null,_e=()=>!0,be=(e,l)=>e==l,ve=e=>Se(e,14);function ke(e,l){return ve(Se(ve(e/l))*l)}function ye(e,l){return ve(ie(ve(e/l))*l)}function Me(e,l){return ve(te(ve(e/l))*l)}function Se(e,l=0){if(Ye(e))return e;let t=10**l;return ne(e*t*(1+Number.EPSILON))/t}const Ee=new Map;function Te(e){return((""+e).split(".")[1]||"").length}function ze(e,l,t,n){let i=[],o=n.map(Te);for(let s=l;t>s;s++){let l=le(s),t=Se(re(e,s),l);for(let e=0;n.length>e;e++){let r=n[e]*t,u=(0>r||0>s?l:0)+(o[e]>s?o[e]:0),a=Se(r,u);i.push(a),Ee.set(a,u)}}return i}const De={},Pe=[],Ae=[null,null],We=Array.isArray,Ye=Number.isInteger;function Ce(e){return"string"==typeof e}function Fe(e){let l=!1;if(null!=e){let t=e.constructor;l=null==t||t==Object}return l}function He(e){return null!=e&&"object"==typeof e}const Re=Object.getPrototypeOf(Uint8Array);function Ge(e,l=Fe){let t;if(We(e)){let n=e.find((e=>null!=e));if(We(n)||l(n)){t=Array(e.length);for(let n=0;e.length>n;n++)t[n]=Ge(e[n],l)}else t=e.slice()}else if(e instanceof Re)t=e.slice();else if(l(e)){t={};for(let n in e)t[n]=Ge(e[n],l)}else t=e;return t}function Ie(e){let l=arguments;for(let t=1;l.length>t;t++){let n=l[t];for(let l in n)Fe(e[l])?Ie(e[l],Ge(n[l])):e[l]=Ge(n[l])}return e}function Le(e,l,t){for(let n,i=0,o=-1;l.length>i;i++){let s=l[i];if(s>o){for(n=s-1;n>=0&&null==e[n];)e[n--]=null;for(n=s+1;t>n&&null==e[n];)e[o=n++]=null}}}const Oe="undefined"==typeof queueMicrotask?e=>Promise.resolve().then(e):queueMicrotask,Ne=["January","February","March","April","May","June","July","August","September","October","November","December"],je=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Ue(e){return e.slice(0,3)}const Be=je.map(Ue),Ve=Ne.map(Ue),Je={MMMM:Ne,MMM:Ve,WWWW:je,WWW:Be};function qe(e){return(10>e?"0":"")+e}const Ke={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,l)=>l.MMMM[e.getMonth()],MMM:(e,l)=>l.MMM[e.getMonth()],MM:e=>qe(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>qe(e.getDate()),D:e=>e.getDate(),WWWW:(e,l)=>l.WWWW[e.getDay()],WWW:(e,l)=>l.WWW[e.getDay()],HH:e=>qe(e.getHours()),H:e=>e.getHours(),h:e=>{let l=e.getHours();return 0==l?12:l>12?l-12:l},AA:e=>12>e.getHours()?"AM":"PM",aa:e=>12>e.getHours()?"am":"pm",a:e=>12>e.getHours()?"a":"p",mm:e=>qe(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>qe(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>function(e){return(10>e?"00":100>e?"0":"")+e}(e.getMilliseconds())};function Xe(e,l){l=l||Je;let t,n=[],i=/\{([a-z]+)\}|[^{]+/gi;for(;t=i.exec(e);)n.push("{"==t[0][0]?Ke[t[1]]:t[0]);return e=>{let t="";for(let i=0;n.length>i;i++)t+="string"==typeof n[i]?n[i]:n[i](e,l);return t}}const Ze=(new Intl.DateTimeFormat).resolvedOptions().timeZone,$e=e=>e%1==0,Qe=[1,2,2.5,5],el=ze(10,-16,0,Qe),ll=ze(10,0,16,Qe),tl=ll.filter($e),nl=el.concat(ll),il="{YYYY}",ol="\n"+il,sl="{M}/{D}",rl="\n"+sl,ul=rl+"/{YY}",al="{aa}",fl="{h}:{mm}"+al,cl="\n"+fl,hl=":{ss}",dl=null;function pl(e){let l=1e3*e,t=60*l,n=60*t,i=24*n,o=30*i,s=365*i;return[(1==e?ze(10,0,3,Qe).filter($e):ze(10,-3,0,Qe)).concat([l,5*l,10*l,15*l,30*l,t,5*t,10*t,15*t,30*t,n,2*n,3*n,4*n,6*n,8*n,12*n,i,2*i,3*i,4*i,5*i,6*i,7*i,8*i,9*i,10*i,15*i,o,2*o,3*o,4*o,6*o,s,2*s,5*s,10*s,25*s,50*s,100*s]),[[s,il,dl,dl,dl,dl,dl,dl,1],[28*i,"{MMM}",ol,dl,dl,dl,dl,dl,1],[i,sl,ol,dl,dl,dl,dl,dl,1],[n,"{h}"+al,ul,dl,rl,dl,dl,dl,1],[t,fl,ul,dl,rl,dl,dl,dl,1],[l,hl,ul+" "+fl,dl,rl+" "+fl,dl,cl,dl,1],[e,hl+".{fff}",ul+" "+fl,dl,rl+" "+fl,dl,cl,dl,1]],function(l){return(r,u,a,f,c,h)=>{let d=[],p=c>=s,m=c>=o&&s>c,g=l(a),w=Se(g*e,3),x=yl(g.getFullYear(),p?0:g.getMonth(),m||p?1:g.getDate()),_=Se(x*e,3);if(m||p){let t=m?c/o:0,n=p?c/s:0,i=w==_?w:Se(yl(x.getFullYear()+n,x.getMonth()+t,1)*e,3),r=new Date(ne(i/e)),u=r.getFullYear(),a=r.getMonth();for(let o=0;f>=i;o++){let s=yl(u+n*o,a+t*o,1),r=s-l(Se(s*e,3));i=Se((+s+r)*e,3),i>f||d.push(i)}}else{let o=i>c?c:i,s=_+(te(a)-te(w))+ye(w-_,o);d.push(s);let p=l(s),m=p.getHours()+p.getMinutes()/t+p.getSeconds()/n,g=c/n,x=h/r.axes[u]._space;for(;s=Se(s+c,1==e?0:3),f>=s;)if(g>1){let e=te(Se(m+g,6))%24,t=l(s).getHours()-e;t>1&&(t=-1),s-=t*n,m=(m+g)%24,.7>Se((s-d[d.length-1])/c,3)*x||d.push(s)}else d.push(s)}return d}}]}const[ml,gl,wl]=pl(1),[xl,_l,bl]=pl(.001);function vl(e,l){return e.map((e=>e.map(((t,n)=>0==n||8==n||null==t?t:l(1==n||0==e[8]?t:e[1]+t)))))}function kl(e,l){return(t,n,i,o,s)=>{let r,u,a,f,c,h,d=l.find((e=>s>=e[0]))||l[l.length-1];return n.map((l=>{let t=e(l),n=t.getFullYear(),i=t.getMonth(),o=t.getDate(),s=t.getHours(),p=t.getMinutes(),m=t.getSeconds(),g=n!=r&&d[2]||i!=u&&d[3]||o!=a&&d[4]||s!=f&&d[5]||p!=c&&d[6]||m!=h&&d[7]||d[1];return r=n,u=i,a=o,f=s,c=p,h=m,g(t)}))}}function yl(e,l,t){return new Date(e,l,t)}function Ml(e,l){return l(e)}function Sl(e,l){return(t,n,i,o)=>null==o?x:l(e(n))}ze(2,-53,53,[1]);const El={show:!0,live:!0,isolate:!1,mount:()=>{},markers:{show:!0,width:2,stroke:function(e,l){let t=e.series[l];return t.width?t.stroke(e,l):t.points.width?t.points.stroke(e,l):null},fill:function(e,l){return e.series[l].fill(e,l)},dash:"solid"},idx:null,idxs:null,values:[]},Tl=[0,0];function zl(e,l,t,n=!0){return e=>{0==e.button&&(!n||e.target==l)&&t(e)}}function Dl(e,l,t,n=!0){return e=>{(!n||e.target==l)&&t(e)}}const Pl={show:!0,x:!0,y:!0,lock:!1,move:function(e,l,t){return Tl[0]=l,Tl[1]=t,Tl},points:{show:function(e,l){let i=e.cursor.points,o=D(),s=i.size(e,l);T(o,t,s),T(o,n,s);let r=s/-2;T(o,"marginLeft",r),T(o,"marginTop",r);let u=i.width(e,l,s);return u&&T(o,"borderWidth",u),o},size:function(e,l){return e.series[l].points.size},width:0,stroke:function(e,l){let t=e.series[l].points;return t._stroke||t._fill},fill:function(e,l){let t=e.series[l].points;return t._fill||t._stroke}},bind:{mousedown:zl,mouseup:zl,click:zl,dblclick:zl,mousemove:Dl,mouseleave:Dl,mouseenter:Dl},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,l)=>{l.stopPropagation(),l.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,l,t,n,i)=>n-i,prox:-1,bias:0},left:-10,top:-10,idx:null,dataIdx:function(e,l,t){return t},idxs:null,event:null},Al={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Wl=Ie({},Al,{filter:we}),Yl=Ie({},Wl,{size:10}),Cl=Ie({},Al,{show:!1}),Fl='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Hl="bold "+Fl,Rl={show:!0,scale:"x",stroke:u,space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Hl,side:2,grid:Wl,ticks:Yl,border:Cl,font:Fl,lineGap:1.5,rotate:0},Gl={show:!0,scale:"x",auto:!1,sorted:1,min:he,max:-he,idxs:[]};function Il(e,l){return l.map((e=>null==e?"":$(e)))}function Ll(e,l,t,n,i,o,s){let r=[],u=Ee.get(i)||0;for(let e=t=s?t:Se(ye(t,i),u);n>=e;e=Se(e+i,u))r.push(Object.is(e,-0)?0:e);return r}function Ol(e,l,t,n,i){const o=[],s=e.scales[e.axes[l].scale].log,r=te((10==s?ae:fe)(t));i=re(s,r),10==s&&0>r&&(i=Se(i,-r));let u=t;do{o.push(u),u+=i,10==s&&(u=Se(u,Ee.get(i))),i*s>u||(i=u)}while(n>=u);return o}function Nl(e,l,t,n,i){let o=e.scales[e.axes[l].scale].asinh,s=n>o?Ol(e,l,se(o,t),n,i):[o],r=0>n||t>0?[]:[0];return(-o>t?Ol(e,l,se(o,-n),-t,i):[o]).reverse().map((e=>-e)).concat(r,s)}const jl=/./,Ul=/[12357]/,Bl=/[125]/,Vl=/1/,Jl=(e,l,t,n)=>e.map(((e,i)=>4==l&&0==e||i%n==0&&t.test(e.toExponential()[0>e?1:0])?e:null));function ql(e,l,t){let n=e.axes[t],i=n.scale,o=e.scales[i],s=e.valToPos,r=n._space,u=s(10,i),a=s(9,i)-ue)return Jl(l.slice().reverse(),o.distr,a,ie(r/e)).reverse()}return Jl(l,o.distr,a,1)}function Kl(e,l,t){let n=e.axes[t],i=n.scale,o=n._space,s=e.valToPos,r=le(s(1,i)-s(2,i));return o>r?Jl(l.slice().reverse(),3,jl,ie(o/r)).reverse():l}function Xl(e,l,t,n){return null==n?x:null==l?"":$(l)}const Zl={show:!0,scale:"y",stroke:u,space:30,gap:5,size:50,labelGap:0,labelSize:30,labelFont:Hl,side:3,grid:Wl,ticks:Yl,border:Cl,font:Fl,lineGap:1.5,rotate:0},$l={scale:null,auto:!0,sorted:0,min:he,max:-he},Ql=(e,l,t,n,i)=>i,et={show:!0,auto:!0,sorted:0,gaps:Ql,alpha:1,facets:[Ie({},$l,{scale:"x"}),Ie({},$l,{scale:"y"})]},lt={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Ql,alpha:1,points:{show:function(e,l){let{scale:t,idxs:n}=e.series[0],i=e._data[0],o=e.valToPos(i[n[0]],t,!0),s=e.valToPos(i[n[1]],t,!0);return le(s-o)/(e.series[l].points.space*y)>=n[1]-n[0]},filter:null},values:null,min:he,max:-he,idxs:[],path:null,clip:null};function tt(e,l,t){return t/10}const nt={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},it=Ie({},nt,{time:!1,ori:1}),ot={};function st(e){let l=ot[e];return l||(l={key:e,plots:[],sub(e){l.plots.push(e)},unsub(e){l.plots=l.plots.filter((l=>l!=e))},pub(e,t,n,i,o,s,r){for(let u=0;l.plots.length>u;u++)l.plots[u]!=t&&l.plots[u].pub(e,t,n,i,o,s,r)}},null!=e&&(ot[e]=l)),l}function rt(e,l,t){const n=e.mode,i=e.series[l],o=2==n?e._data[l]:e._data,s=e.scales,r=e.bbox;let u=o[0],a=2==n?o[1]:o[l],f=2==n?s[i.facets[0].scale]:s[e.series[0].scale],c=2==n?s[i.facets[1].scale]:s[i.scale],h=r.left,d=r.top,p=r.width,m=r.height,g=e.valToPosH,w=e.valToPosV;return 0==f.ori?t(i,u,a,f,c,g,w,h,d,p,m,mt,wt,_t,vt,yt):t(i,u,a,f,c,w,g,d,h,m,p,gt,xt,bt,kt,Mt)}function ut(e,l){let t=0,n=0,i=K(e.bands,Pe);for(let e=0;i.length>e;e++){let o=i[e];o.series[0]==l?t=o.dir:o.series[1]==l&&(n|=1==o.dir?1:2)}return[t,1==n?-1:2==n?1:3==n?2:0]}function at(e,l,t,n,i){let o=e.series[l],s=e.scales[2==e.mode?o.facets[1].scale:o.scale];return-1==i?s.min:1==i?s.max:3==s.distr?1==s.dir?s.min:s.max:0}function ft(e,l,t,n,i,o){return rt(e,l,((e,l,s,r,u,a,f,c,h,d,p)=>{let m=e.pxRound;const g=0==r.ori?wt:xt;let w,x;1==r.dir*(0==r.ori?1:-1)?(w=t,x=n):(w=n,x=t);let _=m(a(l[w],r,d,c)),b=m(f(s[w],u,p,h)),v=m(a(l[x],r,d,c)),k=m(f(1==o?u.max:u.min,u,p,h)),y=new Path2D(i);return g(y,v,k),g(y,_,k),g(y,_,b),y}))}function ct(e,l,t,n,i,o){let s=null;if(e.length>0){s=new Path2D;const r=0==l?_t:bt;let u=t;for(let l=0;e.length>l;l++){let t=e[l];if(t[1]>t[0]){let e=t[0]-u;e>0&&r(s,u,n,e,n+o),u=t[1]}}let a=t+i-u,f=10;a>0&&r(s,u,n-f/2,a,n+o+f)}return s}function ht(e,l,t,n,i,o,s){let r=[],u=e.length;for(let a=1==i?t:n;a>=t&&n>=a;a+=i)if(null===l[a]){let f=a,c=a;if(1==i)for(;++a<=n&&null===l[a];)c=a;else for(;--a>=t&&null===l[a];)c=a;let h=o(e[f]),d=c==f?h:o(e[c]),p=f-i;h=s>0||0>p||p>=u?h:o(e[p]);let m=c+i;d=0>s||0>m||m>=u?d:o(e[m]),h>d||r.push([h,d])}return r}function dt(e){return 0==e?ge:1==e?ne:l=>ke(l,e)}function pt(e){let l=0==e?mt:gt,t=0==e?(e,l,t,n,i,o)=>{e.arcTo(l,t,n,i,o)}:(e,l,t,n,i,o)=>{e.arcTo(t,l,i,n,o)},n=0==e?(e,l,t,n,i)=>{e.rect(l,t,n,i)}:(e,l,t,n,i)=>{e.rect(t,l,i,n)};return(e,i,o,s,r,u=0,a=0)=>{0==u&&0==a?n(e,i,o,s,r):(u=oe(u,s/2,r/2),a=oe(a,s/2,r/2),l(e,i+u,o),t(e,i+s,o,i+s,o+r,u),t(e,i+s,o+r,i,o+r,a),t(e,i,o+r,i,o,a),t(e,i,o,i+s,o,u),e.closePath())}}const mt=(e,l,t)=>{e.moveTo(l,t)},gt=(e,l,t)=>{e.moveTo(t,l)},wt=(e,l,t)=>{e.lineTo(l,t)},xt=(e,l,t)=>{e.lineTo(t,l)},_t=pt(0),bt=pt(1),vt=(e,l,t,n,i,o)=>{e.arc(l,t,n,i,o)},kt=(e,l,t,n,i,o)=>{e.arc(t,l,n,i,o)},yt=(e,l,t,n,i,o,s)=>{e.bezierCurveTo(l,t,n,i,o,s)},Mt=(e,l,t,n,i,o,s)=>{e.bezierCurveTo(t,l,i,n,s,o)};function St(){return(e,l,t,n,i)=>rt(e,l,((l,o,s,r,u,a,f,c,h,d,p)=>{let m,g,{pxRound:w,points:x}=l;0==r.ori?(m=mt,g=vt):(m=gt,g=kt);const _=Se(x.width*y,3);let b=(x.size-x.width)/2*y,v=Se(2*b,3),k=new Path2D,M=new Path2D,{left:S,top:E,width:T,height:z}=e.bbox;_t(M,S-v,E-v,T+2*v,z+2*v);const D=e=>{if(null!=s[e]){let l=w(a(o[e],r,d,c)),t=w(f(s[e],u,p,h));m(k,l+b,t),g(k,l,t,b,0,2*ee)}};if(i)i.forEach(D);else for(let e=t;n>=e;e++)D(e);return{stroke:_>0?k:null,fill:k,clip:M,flags:3}}))}function Et(e){return(l,t,n,i,o,s)=>{n!=i&&(o!=n&&s!=n&&e(l,t,n),o!=i&&s!=i&&e(l,t,i),e(l,t,s))}}const Tt=Et(wt),zt=Et(xt);function Dt(e){const l=K(e?.alignGaps,0);return(e,t,n,i)=>rt(e,t,((o,s,r,u,a,f,c,h,d,p,m)=>{let g,w,x=o.pxRound,_=e=>x(f(e,u,p,h)),b=e=>x(c(e,a,m,d));0==u.ori?(g=wt,w=Tt):(g=xt,w=zt);const v=u.dir*(0==u.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},y=k.stroke;let M,S,E,T=he,z=-he,D=_(s[1==v?n:i]),P=O(r,n,i,1*v),A=O(r,n,i,-1*v),W=_(s[P]),Y=_(s[A]),C=!1;for(let e=1==v?n:i;e>=n&&i>=e;e+=v){let l=_(s[e]),t=r[e];l==D?null!=t?(S=b(t),T==he&&(g(y,l,S),M=S),T=oe(S,T),z=se(S,z)):null===t&&(C=!0):(T!=he&&(w(y,D,T,z,M,S),E=D),null!=t?(S=b(t),g(y,l,S),T=z=M=S):(T=he,z=-he,null===t&&(C=!0)),D=l)}T!=he&&T!=z&&E!=D&&w(y,D,T,z,M,S);let[F,H]=ut(e,t);if(null!=o.fill||0!=F){let l=k.fill=new Path2D(y),n=b(o.fillTo(e,t,o.min,o.max,F));g(l,Y,n),g(l,W,n)}if(!o.spanGaps){let a=[];C&&a.push(...ht(s,r,n,i,v,_,l)),k.gaps=a=o.gaps(e,t,n,i,a),k.clip=ct(a,u.ori,h,d,p,m)}return 0!=H&&(k.band=2==H?[ft(e,t,n,i,y,-1),ft(e,t,n,i,y,1)]:ft(e,t,n,i,y,H)),k}))}function Pt(e,l,t,n,i){const o=e.length;if(2>o)return null;const s=new Path2D;if(t(s,e[0],l[0]),2==o)n(s,e[1],l[1]);else{let t=Array(o),n=Array(o-1),r=Array(o-1),u=Array(o-1);for(let t=0;o-1>t;t++)r[t]=l[t+1]-l[t],u[t]=e[t+1]-e[t],n[t]=r[t]/u[t];t[0]=n[0];for(let e=1;o-1>e;e++)0===n[e]||0===n[e-1]||n[e-1]>0!=n[e]>0?t[e]=0:(t[e]=3*(u[e-1]+u[e])/((2*u[e]+u[e-1])/n[e-1]+(u[e]+2*u[e-1])/n[e]),isFinite(t[e])||(t[e]=0));t[o-1]=n[o-2];for(let n=0;o-1>n;n++)i(s,e[n]+u[n]/3,l[n]+t[n]*u[n]/3,e[n+1]-u[n]/3,l[n+1]-t[n+1]*u[n]/3,e[n+1],l[n+1])}return s}const At=new Set;function Wt(){for(let e of At)e.syncRect(!0)}_&&(G("resize",v,Wt),G("scroll",v,Wt,!0),G(w,v,(()=>{Jt.pxRatio=y})));const Yt=Dt(),Ct=St();function Ft(e,l,t,n){return(n?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map(((e,n)=>Ht(e,n,l,t)))}function Ht(e,l,t,n){return Ie({},0==l?t:n,e)}function Rt(e,l,t){return null==l?Ae:[l,t]}const Gt=Rt;function It(e,l,t){return null==l?Ae:q(l,t,U,!0)}function Lt(e,l,t,n){return null==l?Ae:N(l,t,e.scales[n].log,!1)}const Ot=Lt;function Nt(e,l,t,n){return null==l?Ae:j(l,t,e.scales[n].log,!1)}const jt=Nt;function Ut(e,l,t,n,i){let o=se(de(e),de(l)),s=l-e,r=L(i/n*s,t);do{let e=t[r],l=n*e/s;if(l>=i&&17>=o+(5>e?Ee.get(e):0))return[e,l]}while(++r(l=ne((t=+n)*y))+"px")),l,t]}function Vt(e){e.show&&[e.font,e.labelFont].forEach((e=>{let l=Se(e[2]*y,1);e[0]=e[0].replace(/[0-9.]+px/,l+"px"),e[1]=l}))}function Jt(u,g,_){const k={mode:K(u.mode,1)},M=k.mode;function P(e,l){return((3==l.distr?ae(e>0?e:l.clamp(k,e,l.min,l.max,l.key)):4==l.distr?ce(e,l.asinh):e)-l._min)/(l._max-l._min)}function W(e,l,t,n){let i=P(e,l);return n+t*(-1==l.dir?1-i:i)}function C(e,l,t,n){let i=P(e,l);return n+t*(-1==l.dir?i:1-i)}function H(e,l,t,n){return 0==l.ori?W(e,l,t,n):C(e,l,t,n)}k.valToPosH=W,k.valToPosV=C;let R=!1;k.status=0;const O=k.root=D("uplot");null!=u.id&&(O.id=u.id),S(O,u.class),u.title&&(D("u-title",O).textContent=u.title);const V=z("canvas"),J=k.ctx=V.getContext("2d"),X=D("u-wrap",O);G("click",X,(e=>{e.target===$&&(Fn!=An||Hn!=Wn)&&Nn.click(k,e)}),!0);const Z=k.under=D("u-under",X);X.appendChild(V);const $=k.over=D("u-over",X),te=+K((u=Ge(u)).pxAlign,1),ue=dt(te);(u.plugins||[]).forEach((e=>{e.opts&&(u=e.opts(k,u)||u)}));const fe=u.ms||.001,de=k.series=1==M?Ft(u.series||[],Gl,lt,!1):function(e,l){return e.map(((e,t)=>0==t?null:Ie({},l,e)))}(u.series||[null],et),ge=k.axes=Ft(u.axes||[],Rl,Zl,!0),ve=k.scales={},Me=k.bands=u.bands||[];Me.forEach((e=>{e.fill=me(e.fill||null),e.dir=K(e.dir,-1)}));const ze=2==M?de[1].facets[0].scale:de[0].scale,Ye={axes:function(){for(let e=0;ge.length>e;e++){let l=ge[e];if(!l.show||!l._show)continue;let t,n,u=l.side,a=u%2,f=l.stroke(k,e),c=0==u||3==u?-1:1;if(l.label){let e=ne((l._lpos+l.labelGap*c)*y);hn(l.labelFont[0],f,"center",2==u?i:o),J.save(),1==a?(t=n=0,J.translate(e,ne($l+ot/2)),J.rotate((3==u?-ee:ee)/2)):(t=ne(Jl+Ql/2),n=e),J.fillText(l.label,t,n),J.restore()}let[h,d]=l._found;if(0==d)continue;let p=ve[l.scale],m=0==a?Ql:ot,g=0==a?Jl:$l,w=ne(l.gap*y),x=l._splits,_=2==p.distr?x.map((e=>rn[e])):x,b=2==p.distr?rn[x[1]]-rn[x[0]]:h,v=l.ticks,M=l.border,S=v.show?ne(v.size*y):0,E=l._rotate*-ee/180,T=ue(l._pos*y),z=T+(S+w)*c;n=0==a?z:0,t=1==a?z:0,hn(l.font[0],f,1==l.align?s:2==l.align?r:E>0?s:0>E?r:0==a?"center":3==u?r:s,E||1==a?"middle":2==u?i:o);let D=l.font[1]*l.lineGap,P=x.map((e=>ue(H(e,p,m,g)))),A=l._values;for(let e=0;A.length>e;e++){let l=A[e];if(null!=l){0==a?t=P[e]:n=P[e],l=""+l;let i=-1==l.indexOf("\n")?[l]:l.split(/\n/gm);for(let e=0;i.length>e;e++){let l=i[e];E?(J.save(),J.translate(t,n+e*D),J.rotate(E),J.fillText(l,0,0),J.restore()):J.fillText(l,t,n+e*D)}}}v.show&&vn(P,v.filter(k,_,e,d,b),a,u,T,S,Se(v.width*y,3),v.stroke(k,e),v.dash,v.cap);let W=l.grid;W.show&&vn(P,W.filter(k,_,e,d,b),a,0==a?2:1,0==a?$l:Jl,0==a?ot:Ql,Se(W.width*y,3),W.stroke(k,e),W.dash,W.cap),M.show&&vn([T],[1],0==a?1:0,0==a?1:2,1==a?$l:Jl,1==a?ot:Ql,Se(M.width*y,3),M.stroke(k,e),M.dash,M.cap)}Mi("drawAxes")},series:function(){Wt>0&&(de.forEach(((e,l)=>{if(l>0&&e.show&&(mn(l,!1),mn(l,!0),null==e._paths)){let t=2==M?[0,g[l][0].length-1]:function(e){let l=pe(Jt-1,0,Wt-1),t=pe(qt+1,0,Wt-1);for(;null==e[l]&&l>0;)l--;for(;null==e[t]&&Wt-1>t;)t++;return[l,t]}(g[l]);e._paths=e.paths(k,l,t[0],t[1])}})),de.forEach(((e,l)=>{if(l>0&&e.show){sn!=e.alpha&&(J.globalAlpha=sn=e.alpha),null!=e._paths&&gn(l,!1);{let t=null!=e._paths?e._paths.gaps:null,n=e.points.show(k,l,Jt,qt,t),i=e.points.filter(k,l,n,t);(n||i)&&(e.points._paths=e.points.paths(k,l,Jt,qt,i),gn(l,!0))}1!=sn&&(J.globalAlpha=sn=1),Mi("drawSeries",l)}})))}},Re=(u.drawOrder||["axes","series"]).map((e=>Ye[e]));function Le(e){let l=ve[e];if(null==l){let t=(u.scales||De)[e]||De;if(null!=t.from)Le(t.from),ve[e]=Ie({},ve[t.from],t,{key:e});else{l=ve[e]=Ie({},e==ze?nt:it,t),l.key=e;let n=l.time,i=l.range,o=We(i);if((e!=ze||2==M&&!n)&&(!o||null!=i[0]&&null!=i[1]||(i={min:null==i[0]?B:{mode:1,hard:i[0],soft:i[0]},max:null==i[1]?B:{mode:1,hard:i[1],soft:i[1]}},o=!1),!o&&Fe(i))){let e=i;i=(l,t,n)=>null==t?Ae:q(t,n,e)}l.range=me(i||(n?Gt:e==ze?3==l.distr?Ot:4==l.distr?jt:Rt:3==l.distr?Lt:4==l.distr?Nt:It)),l.auto=me(!o&&l.auto),l.clamp=me(l.clamp||tt),l._min=l._max=null}}}Le("x"),Le("y"),1==M&&de.forEach((e=>{Le(e.scale)})),ge.forEach((e=>{Le(e.scale)}));for(let e in u.scales)Le(e);const Ne=ve[ze],je=Ne.distr;let Ue,Be;0==Ne.ori?(S(O,"u-hz"),Ue=W,Be=C):(S(O,"u-vt"),Ue=C,Be=W);const Ve={};for(let e in ve){let l=ve[e];null==l.min&&null==l.max||(Ve[e]={min:l.min,max:l.max},l.min=l.max=null)}const Je=u.tzDate||(e=>new Date(ne(e/fe))),qe=u.fmtDate||Xe,Ke=1==fe?wl(Je):bl(Je),Ze=kl(Je,vl(1==fe?gl:_l,qe)),$e=Sl(Je,Ml("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",qe)),Qe=[],el=k.legend=Ie({},El,u.legend),ll=el.show,il=el.markers;let ol,sl,rl;el.idxs=Qe,il.width=me(il.width),il.dash=me(il.dash),il.stroke=me(il.stroke),il.fill=me(il.fill);let ul,al=[],fl=[],cl=!1,hl={};if(el.live){const e=de[1]?de[1].values:null;cl=null!=e,ul=cl?e(k,1,0):{_:0};for(let e in ul)hl[e]=x}if(ll)if(ol=z("table","u-legend",O),rl=z("tbody",null,ol),el.mount(k,ol),cl){sl=z("thead",null,ol,rl);let e=z("tr",null,sl);for(var dl in z("th",null,e),ul)z("th",l,e).textContent=dl}else S(ol,"u-inline"),el.live&&S(ol,"u-live");const pl={show:!0},yl={show:!1},Tl=new Map;function zl(e,l,t,n=!0){const i=Tl.get(l)||{},o=xt.bind[e](k,l,t,n);o&&(G(e,l,i[e]=o),Tl.set(l,i))}function Dl(e,l){const t=Tl.get(l)||{};for(let n in t)null!=e&&n!=e||(I(n,l,t[n]),delete t[n]);null==e&&Tl.delete(l)}let Al=0,Wl=0,Yl=0,Cl=0,Fl=0,Hl=0,jl=Fl,Ul=Hl,Bl=Yl,Vl=Cl,Jl=0,$l=0,Ql=0,ot=0;k.bbox={};let rt=!1,ut=!1,ft=!1,ct=!1,ht=!1,pt=!1;function mt(e,l,t){(t||e!=k.width||l!=k.height)&>(e,l),Mn(!1),ft=!0,ut=!0,Gn()}function gt(e,l){k.width=Al=Yl=e,k.height=Wl=Cl=l,Fl=Hl=0,function(){let e=!1,l=!1,t=!1,n=!1;ge.forEach((i=>{if(i.show&&i._show){let{side:o,_size:s}=i,r=s+(null!=i.label?i.labelSize:0);r>0&&(o%2?(Yl-=r,3==o?(Fl+=r,n=!0):t=!0):(Cl-=r,0==o?(Hl+=r,e=!0):l=!0))}})),Tt[0]=e,Tt[1]=t,Tt[2]=l,Tt[3]=n,Yl-=Pt[1]+Pt[3],Fl+=Pt[3],Cl-=Pt[2]+Pt[0],Hl+=Pt[0]}(),function(){let e=Fl+Yl,l=Hl+Cl,t=Fl,n=Hl;function i(i,o){switch(i){case 1:return e+=o,e-o;case 2:return l+=o,l-o;case 3:return t-=o,t+o;case 0:return n-=o,n+o}}ge.forEach((e=>{if(e.show&&e._show){let l=e.side;e._pos=i(l,e._size),null!=e.label&&(e._lpos=i(l,e.labelSize))}}))}();let t=k.bbox;Jl=t.left=ke(Fl*y,.5),$l=t.top=ke(Hl*y,.5),Ql=t.width=ke(Yl*y,.5),ot=t.height=ke(Cl*y,.5)}const wt=3;k.setSize=function({width:e,height:l}){mt(e,l)};const xt=k.cursor=Ie({},Pl,{drag:{y:2==M}},u.cursor),_t=e=>{xt.event=e};xt.idxs=Qe,xt._lock=!1;let bt=xt.points;bt.show=me(bt.show),bt.size=me(bt.size),bt.stroke=me(bt.stroke),bt.width=me(bt.width),bt.fill=me(bt.fill);const vt=k.focus=Ie({},u.focus||{alpha:.3},xt.focus),kt=vt.prox>=0;let yt=[null],Mt=[null],St=[null];function Et(t,n){if(1==M||n>0){let e=1==M&&ve[t.scale].time,l=t.value;t.value=e?Ce(l)?Sl(Je,Ml(l,qe)):l||$e:l||Xl,t.label=t.label||(e?"Time":"Value")}if(n>0){t.width=null==t.width?1:t.width,t.paths=t.paths||Yt||xe,t.fillTo=me(t.fillTo||at),t.pxAlign=+K(t.pxAlign,te),t.pxRound=dt(t.pxAlign),t.stroke=me(t.stroke||null),t.fill=me(t.fill||null),t._stroke=t._fill=t._paths=t._focus=null;let e=function(e){return Se(1*(3+2*(e||1)),3)}(se(1,t.width)),l=t.points=Ie({},{size:e,width:se(1,.2*e),stroke:t.stroke,space:2*e,paths:Ct,_stroke:null,_fill:null},t.points);l.show=me(l.show),l.filter=me(l.filter),l.fill=me(l.fill),l.stroke=me(l.stroke),l.paths=me(l.paths),l.pxAlign=t.pxAlign}if(ll){let i=function(t,n){if(0==n&&(cl||!el.live||2==M))return Ae;let i=[],o=z("tr","u-series",rl,rl.childNodes[n]);S(o,t.class),t.show||S(o,e);let s=z("th",null,o);if(il.show){let e=D("u-marker",s);if(n>0){let l=il.width(k,n);l&&(e.style.border=l+"px "+il.dash(k,n)+" "+il.stroke(k,n)),e.style.background=il.fill(k,n)}}let r=D(l,s);for(var u in r.textContent=t.label,n>0&&(il.show||(r.style.color=t.width>0?il.stroke(k,n):il.fill(k,n)),zl("click",s,(e=>{if(xt._lock)return;_t(e);let l=de.indexOf(t);if((e.ctrlKey||e.metaKey)!=el.isolate){let e=de.some(((e,t)=>t>0&&t!=l&&e.show));de.forEach(((t,n)=>{n>0&&Kn(n,e?n==l?pl:yl:pl,!0,Ei.setSeries)}))}else Kn(l,{show:!t.show},!0,Ei.setSeries)}),!1),kt&&zl(d,s,(e=>{xt._lock||(_t(e),Kn(de.indexOf(t),Qn,!0,Ei.setSeries))}),!1)),ul){let e=z("td","u-value",o);e.textContent="--",i.push(e)}return[o,i]}(t,n);al.splice(n,0,i[0]),fl.splice(n,0,i[1]),el.values.push(null)}if(xt.show){Qe.splice(n,0,null);let e=function(e,l){if(l>0){let t=xt.points.show(k,l);if(t)return S(t,"u-cursor-pt"),S(t,e.class),A(t,-10,-10,Yl,Cl),$.insertBefore(t,yt[l]),t}}(t,n);null!=e&&(yt.splice(n,0,e),Mt.splice(n,0,0),St.splice(n,0,0))}Mi("addSeries",n)}k.addSeries=function(e,l){l=null==l?de.length:l,e=1==M?Ht(e,l,Gl,lt):Ht(e,l,null,et),de.splice(l,0,e),Et(de[l],l)},k.delSeries=function(e){if(de.splice(e,1),ll){el.values.splice(e,1),fl.splice(e,1);let l=al.splice(e,1)[0];Dl(null,l.firstChild),l.remove()}xt.show&&(Qe.splice(e,1),yt.length>1&&(yt.splice(e,1)[0].remove(),Mt.splice(e,1),St.splice(e,1))),Mi("delSeries",e)};const Tt=[!1,!1,!1,!1];function zt(e,l,t){let[n,i,o,s]=t,r=l%2,u=0;return 0==r&&(s||i)&&(u=0==l&&!n||2==l&&!o?ne(Rl.size/3):0),1==r&&(n||o)&&(u=1==l&&!i||3==l&&!s?ne(Zl.size/2):0),u}const Dt=k.padding=(u.padding||[zt,zt,zt,zt]).map((e=>me(K(e,zt)))),Pt=k._padding=Dt.map(((e,l)=>e(k,l,Tt,0)));let Wt,Jt=null,qt=null;const Kt=1==M?de[0].idxs:null;let Xt,Zt,$t,Qt,en,ln,tn,nn,on,sn,rn=null,un=!1;function an(e,l){if(g=null==e?[]:e,2==M){Wt=0;for(let e=1;de.length>e;e++)Wt+=g[e][0].length;k._data=g}else{0==g.length&&(g=[[]]),rn=g[0],Wt=rn.length;let e=g;if(2==je){e=g.slice();let l=e[0]=Array(Wt);for(let e=0;Wt>e;e++)l[e]=e}k._data=g=e}if(k.data=g,Mn(!0),Mi("setData"),2==je&&(ft=!0),!1!==l){let e=Ne;e.auto(k,un)?fn():qn(ze,e.min,e.max),ct=ct||xt.left>=0,pt=!0,Gn()}}function fn(){let e,l;un=!0,1==M&&(Wt>0?(Jt=Kt[0]=0,qt=Kt[1]=Wt-1,e=g[0][Jt],l=g[0][qt],2==je?(e=Jt,l=qt):e==l&&(3==je?[e,l]=N(e,e,Ne.log,!1):4==je?[e,l]=j(e,e,Ne.log,!1):Ne.time?l=e+ne(86400/fe):[e,l]=q(e,l,U,!0))):(Jt=Kt[0]=e=null,qt=Kt[1]=l=null)),qn(ze,e,l)}function cn(e,l,t,n,i,o){e??=a,t??=Pe,n??="butt",i??=a,o??="round",e!=Xt&&(J.strokeStyle=Xt=e),i!=Zt&&(J.fillStyle=Zt=i),l!=$t&&(J.lineWidth=$t=l),o!=en&&(J.lineJoin=en=o),n!=ln&&(J.lineCap=ln=n),t!=Qt&&J.setLineDash(Qt=t)}function hn(e,l,t,n){l!=Zt&&(J.fillStyle=Zt=l),e!=tn&&(J.font=tn=e),t!=nn&&(J.textAlign=nn=t),n!=on&&(J.textBaseline=on=n)}function dn(e,l,t,n,i=0){if(n.length>0&&e.auto(k,un)&&(null==l||null==l.min)){let l=K(Jt,0),o=K(qt,n.length-1),s=null==t.min?3==e.distr?function(e,l,t){let n=he,i=-he;for(let o=l;t>=o;o++){let l=e[o];null!=l&&l>0&&(n>l&&(n=l),l>i&&(i=l))}return[n==he?1:n,i==-he?10:i]}(n,l,o):function(e,l,t,n){let i=he,o=-he;if(1==n)i=e[l],o=e[t];else if(-1==n)i=e[t],o=e[l];else for(let n=l;t>=n;n++){let l=e[n];null!=l&&(i>l&&(i=l),l>o&&(o=l))}return[i,o]}(n,l,o,i):[t.min,t.max];e.min=oe(e.min,t.min=s[0]),e.max=se(e.max,t.max=s[1])}}k.setData=an;const pn={min:null,max:null};function mn(e,l){let t=l?de[e].points:de[e];t._stroke=t.stroke(k,e),t._fill=t.fill(k,e)}function gn(e,l){let t=l?de[e].points:de[e],{stroke:n,fill:i,clip:o,flags:s,_stroke:r=t._stroke,_fill:u=t._fill,_width:a=t.width}=t._paths;a=Se(a*y,3);let f=null,c=a%2/2;l&&null==u&&(u=a>0?"#fff":r);let h=1==t.pxAlign&&c>0;if(h&&J.translate(c,c),!l){let e=Jl-a/2,l=$l-a/2,t=Ql+a,n=ot+a;f=new Path2D,f.rect(e,l,t,n)}l?xn(r,a,t.dash,t.cap,u,n,i,s,o):function(e,l,t,n,i,o,s,r,u,a,f){let c=!1;0!=u&&Me.forEach(((h,d)=>{if(h.series[0]==e){let e,p=de[h.series[1]],m=g[h.series[1]],w=(p._paths||De).band;We(w)&&(w=1==h.dir?w[0]:w[1]);let x=null;p.show&&w&&function(e,l,t){for(l=K(l,0),t=K(t,e.length-1);t>=l;){if(null!=e[l])return!0;l++}return!1}(m,Jt,qt)?(x=h.fill(k,d)||o,e=p._paths.clip):w=null,xn(l,t,n,i,x,s,r,u,a,f,e,w),c=!0}})),c||xn(l,t,n,i,o,s,r,u,a,f)}(e,r,a,t.dash,t.cap,u,n,i,s,f,o),h&&J.translate(-c,-c)}const wn=3;function xn(e,l,t,n,i,o,s,r,u,a,f,c){cn(e,l,t,n,i),(u||a||c)&&(J.save(),u&&J.clip(u),a&&J.clip(a)),c?(r&wn)==wn?(J.clip(c),f&&J.clip(f),bn(i,s),_n(e,o,l)):2&r?(bn(i,s),J.clip(c),_n(e,o,l)):1&r&&(J.save(),J.clip(c),f&&J.clip(f),bn(i,s),J.restore(),_n(e,o,l)):(bn(i,s),_n(e,o,l)),(u||a||c)&&J.restore()}function _n(e,l,t){t>0&&(l instanceof Map?l.forEach(((e,l)=>{J.strokeStyle=Xt=l,J.stroke(e)})):null!=l&&e&&J.stroke(l))}function bn(e,l){l instanceof Map?l.forEach(((e,l)=>{J.fillStyle=Zt=l,J.fill(e)})):null!=l&&e&&J.fill(l)}function vn(e,l,t,n,i,o,s,r,u,a){let f=s%2/2;1==te&&J.translate(f,f),cn(r,s,u,a,r),J.beginPath();let c,h,d,p,m=i+(0==n||3==n?-o:o);0==t?(h=i,p=m):(c=i,d=m);for(let n=0;e.length>n;n++)null!=l[n]&&(0==t?c=d=e[n]:h=p=e[n],J.moveTo(c,h),J.lineTo(d,p));J.stroke(),1==te&&J.translate(-f,-f)}function kn(e){let l=!0;return ge.forEach(((t,n)=>{if(!t.show)return;let i=ve[t.scale];if(null==i.min)return void(t._show&&(l=!1,t._show=!1,Mn(!1)));t._show||(l=!1,t._show=!0,Mn(!1));let o=t.side,s=o%2,{min:r,max:u}=i,[a,f]=function(e,l,t,n){let i,o=ge[e];if(n>0){let s=o._space=o.space(k,e,l,t,n);i=Ut(l,t,o._incrs=o.incrs(k,e,l,t,n,s),n,s)}else i=[0,0];return o._found=i}(n,r,u,0==s?Yl:Cl);if(0==f)return;let c=t._splits=t.splits(k,n,r,u,a,f,2==i.distr),h=2==i.distr?c.map((e=>rn[e])):c,d=2==i.distr?rn[c[1]]-rn[c[0]]:a,p=t._values=t.values(k,t.filter(k,h,n,f,d),n,f,d);t._rotate=2==o?t.rotate(k,p,n,f):0;let m=t._size;t._size=ie(t.size(k,p,n,e)),null!=m&&t._size!=m&&(l=!1)})),l}function yn(e){let l=!0;return Dt.forEach(((t,n)=>{let i=t(k,n,Tt,e);i!=Pt[n]&&(l=!1),Pt[n]=i})),l}function Mn(e){de.forEach(((l,t)=>{t>0&&(l._paths=null,e&&(1==M?(l.min=null,l.max=null):l.facets.forEach((e=>{e.min=null,e.max=null}))))}))}let Sn,En,Tn,zn,Dn,Pn,An,Wn,Yn,Cn,Fn,Hn,Rn=!1;function Gn(){Rn||(Oe(In),Rn=!0)}function In(){if(rt&&(function(){for(let e in ve){let l=ve[e];null==Ve[e]&&(null==l.min||null!=Ve[ze]&&l.auto(k,un))&&(Ve[e]=pn)}for(let e in ve){let l=ve[e];null==Ve[e]&&null!=l.from&&null!=Ve[l.from]&&(Ve[e]=pn)}null!=Ve[ze]&&Mn(!0);let e={};for(let l in Ve){let t=Ve[l];if(null!=t){let n=e[l]=Ge(ve[l],He);if(null!=t.min)Ie(n,t);else if(l!=ze||2==M)if(0==Wt&&null==n.from){let e=n.range(k,null,null,l);n.min=e[0],n.max=e[1]}else n.min=he,n.max=-he}}if(Wt>0){de.forEach(((l,t)=>{if(1==M){let n=l.scale,i=Ve[n];if(null==i)return;let o=e[n];if(0==t){let e=o.range(k,o.min,o.max,n);o.min=e[0],o.max=e[1],Jt=L(o.min,g[0]),qt=L(o.max,g[0]),qt-Jt>1&&(o.min>g[0][Jt]&&Jt++,g[0][qt]>o.max&&qt--),l.min=rn[Jt],l.max=rn[qt]}else l.show&&l.auto&&dn(o,i,l,g[t],l.sorted);l.idxs[0]=Jt,l.idxs[1]=qt}else if(t>0&&l.show&&l.auto){let[n,i]=l.facets,o=n.scale,s=i.scale,[r,u]=g[t];dn(e[o],Ve[o],n,r,n.sorted),dn(e[s],Ve[s],i,u,i.sorted),l.min=i.min,l.max=i.max}}));for(let l in e){let t=e[l],n=Ve[l];if(null==t.from&&(null==n||null==n.min)){let e=t.range(k,t.min==he?null:t.min,t.max==-he?null:t.max,l);t.min=e[0],t.max=e[1]}}}for(let l in e){let t=e[l];if(null!=t.from){let n=e[t.from];if(null==n.min)t.min=t.max=null;else{let e=t.range(k,n.min,n.max,l);t.min=e[0],t.max=e[1]}}}let l={},t=!1;for(let n in e){let i=e[n],o=ve[n];if(o.min!=i.min||o.max!=i.max){o.min=i.min,o.max=i.max;let e=o.distr;o._min=3==e?ae(o.min):4==e?ce(o.min,o.asinh):o.min,o._max=3==e?ae(o.max):4==e?ce(o.max,o.asinh):o.max,l[n]=t=!0}}if(t){de.forEach(((e,t)=>{2==M?t>0&&l.y&&(e._paths=null):l[e.scale]&&(e._paths=null)}));for(let e in l)ft=!0,Mi("setScale",e);xt.show&&xt.left>=0&&(ct=pt=!0)}for(let e in Ve)Ve[e]=null}(),rt=!1),ft&&(function(){let e=!1,l=0;for(;!e;){l++;let t=kn(l),n=yn(l);e=l==wt||t&&n,e||(gt(k.width,k.height),ut=!0)}}(),ft=!1),ut){if(T(Z,s,Fl),T(Z,i,Hl),T(Z,t,Yl),T(Z,n,Cl),T($,s,Fl),T($,i,Hl),T($,t,Yl),T($,n,Cl),T(X,t,Al),T(X,n,Wl),V.width=ne(Al*y),V.height=ne(Wl*y),ge.forEach((({_el:l,_show:t,_size:n,_pos:i,side:o})=>{if(null!=l)if(t){let t=o%2==1;T(l,t?"left":"top",i-(3===o||0===o?n:0)),T(l,t?"width":"height",n),T(l,t?"top":"left",t?Hl:Fl),T(l,t?"height":"width",t?Cl:Yl),E(l,e)}else S(l,e)})),Xt=Zt=$t=en=ln=tn=nn=on=Qt=null,sn=1,ai(!0),Fl!=jl||Hl!=Ul||Yl!=Bl||Cl!=Vl){Mn(!1);let e=Yl/Bl,l=Cl/Vl;if(xt.show&&!ct&&xt.left>=0){xt.left*=e,xt.top*=l,Tn&&A(Tn,ne(xt.left),0,Yl,Cl),zn&&A(zn,0,ne(xt.top),Yl,Cl);for(let t=1;yt.length>t;t++)Mt[t]*=e,St[t]*=l,A(yt[t],ye(Mt[t],1),ye(St[t],1),Yl,Cl)}if(Bn.show&&!ht&&Bn.left>=0&&Bn.width>0){Bn.left*=e,Bn.width*=e,Bn.top*=l,Bn.height*=l;for(let e in hi)T(Vn,e,Bn[e])}jl=Fl,Ul=Hl,Bl=Yl,Vl=Cl}Mi("setSize"),ut=!1}Al>0&&Wl>0&&(J.clearRect(0,0,V.width,V.height),Mi("drawClear"),Re.forEach((e=>e())),Mi("draw")),Bn.show&&ht&&(Jn(Bn),ht=!1),xt.show&&ct&&(ri(null,!0,!1),ct=!1),el.show&&el.live&&pt&&(oi(),pt=!1),R||(R=!0,k.status=1,Mi("ready")),un=!1,Rn=!1}function Ln(e,l){let t=ve[e];if(null==t.from){if(0==Wt){let n=t.range(k,l.min,l.max,e);l.min=n[0],l.max=n[1]}if(l.min>l.max){let e=l.min;l.min=l.max,l.max=e}if(Wt>1&&null!=l.min&&null!=l.max&&1e-16>l.max-l.min)return;e==ze&&2==t.distr&&Wt>0&&(l.min=L(l.min,g[0]),l.max=L(l.max,g[0]),l.min==l.max&&l.max++),Ve[e]=l,rt=!0,Gn()}}k.redraw=(e,l)=>{ft=l||!1,!1!==e?qn(ze,Ne.min,Ne.max):Gn()},k.setScale=Ln;let On=!1;const Nn=xt.drag;let jn=Nn.x,Un=Nn.y;xt.show&&(xt.x&&(Sn=D("u-cursor-x",$)),xt.y&&(En=D("u-cursor-y",$)),0==Ne.ori?(Tn=Sn,zn=En):(Tn=En,zn=Sn),Fn=xt.left,Hn=xt.top);const Bn=k.select=Ie({show:!0,over:!0,left:0,width:0,top:0,height:0},u.select),Vn=Bn.show?D("u-select",Bn.over?$:Z):null;function Jn(e,l){if(Bn.show){for(let l in e)Bn[l]=e[l],l in hi&&T(Vn,l,e[l]);!1!==l&&Mi("setSelect")}}function qn(e,l,t){Ln(e,{min:l,max:t})}function Kn(l,t,n,i){null!=t.focus&&function(e){if(e!=$n){let l=null==e,t=1!=vt.alpha;de.forEach(((n,i)=>{let o=l||0==i||i==e;n._focus=l?null:o,t&&function(e,l){de[e].alpha=l,xt.show&&yt[e]&&(yt[e].style.opacity=l),ll&&al[e]&&(al[e].style.opacity=l)}(i,o?1:vt.alpha)})),$n=e,t&&Gn()}}(l),null!=t.show&&de.forEach(((n,i)=>{0>=i||l!=i&&null!=l||(n.show=t.show,function(l){let t=ll?al[l]:null;de[l].show?t&&E(t,e):(t&&S(t,e),yt.length>1&&A(yt[l],-10,-10,Yl,Cl))}(i),qn(2==M?n.facets[1].scale:n.scale,null,null),Gn())})),!1!==n&&Mi("setSeries",l,t),i&&Di("setSeries",k,l,t)}let Xn,Zn,$n;k.setSelect=Jn,k.setSeries=Kn,k.addBand=function(e,l){e.fill=me(e.fill||null),e.dir=K(e.dir,-1),Me.splice(l=null==l?Me.length:l,0,e)},k.setBand=function(e,l){Ie(Me[e],l)},k.delBand=function(e){null==e?Me.length=0:Me.splice(e,1)};const Qn={focus:!0};function ei(e,l,t){let n=ve[l];t&&(e=e/y-(1==n.ori?Hl:Fl));let i=Yl;1==n.ori&&(i=Cl,e=i-e),-1==n.dir&&(e=i-e);let o=n._min,s=o+e/i*(n._max-o),r=n.distr;return 3==r?re(10,s):4==r?((e,l=1)=>Q.sinh(e)*l)(s,n.asinh):s}function li(e,l){T(Vn,s,Bn.left=e),T(Vn,t,Bn.width=l)}function ti(e,l){T(Vn,i,Bn.top=e),T(Vn,n,Bn.height=l)}ll&&kt&&zl(p,ol,(e=>{xt._lock||(_t(e),null!=$n&&Kn(null,Qn,!0,Ei.setSeries))})),k.valToIdx=e=>L(e,g[0]),k.posToIdx=function(e,l){return L(ei(e,ze,l),g[0],Jt,qt)},k.posToVal=ei,k.valToPos=(e,l,t)=>0==ve[l].ori?W(e,ve[l],t?Ql:Yl,t?Jl:0):C(e,ve[l],t?ot:Cl,t?$l:0),k.batch=function(e){e(k),Gn()},k.setCursor=(e,l,t)=>{Fn=e.left,Hn=e.top,ri(null,l,t)};let ni=0==Ne.ori?li:ti,ii=1==Ne.ori?li:ti;function oi(e,l){null!=e&&(e.idxs?e.idxs.forEach(((e,l)=>{Qe[l]=e})):(e=>void 0===e)(e.idx)||Qe.fill(e.idx),el.idx=Qe[0]);for(let e=0;de.length>e;e++)(e>0||1==M&&!cl)&&si(e,Qe[e]);ll&&el.live&&function(){if(ll&&el.live)for(let e=2==M?1:0;de.length>e;e++){if(0==e&&cl)continue;let l=el.values[e],t=0;for(let n in l)fl[e][t++].firstChild.nodeValue=l[n]}}(),pt=!1,!1!==l&&Mi("setLegend")}function si(e,l){let t,n=de[e],i=0==e&&2==je?rn:g[e];cl?t=n.values(k,e,l)??hl:(t=n.value(k,null==l?null:i[l],e,l),t=null==t?hl:{_:t}),el.values[e]=t}function ri(e,l,t){let n;Yn=Fn,Cn=Hn,[Fn,Hn]=xt.move(k,Fn,Hn),xt.show&&(Tn&&A(Tn,ne(Fn),0,Yl,Cl),zn&&A(zn,0,ne(Hn),Yl,Cl)),Xn=he;let i=0==Ne.ori?Yl:Cl,o=1==Ne.ori?Yl:Cl;if(0>Fn||0==Wt||Jt>qt){n=null;for(let e=0;de.length>e;e++)e>0&&yt.length>1&&A(yt[e],-10,-10,Yl,Cl);kt&&Kn(null,Qn,!0,null==e&&Ei.setSeries),el.live&&(Qe.fill(n),pt=!0)}else{let e,l,t;1==M&&(e=0==Ne.ori?Fn:Hn,l=ei(e,ze),n=L(l,g[0],Jt,qt),t=Ue(g[0][n],Ne,i,0));for(let e=2==M?1:0;de.length>e;e++){let s=de[e],r=Qe[e],u=null==r?null:1==M?g[e][r]:g[e][1][r],a=xt.dataIdx(k,e,n,l),f=null==a?null:1==M?g[e][a]:g[e][1][a];pt=pt||f!=u||a!=r,Qe[e]=a;let c=a==n?t:Ue(1==M?g[0][a]:g[e][0][a],Ne,i,0);if(e>0&&s.show){let l,t,n=null==f?-10:Be(f,1==M?ve[s.scale]:ve[s.facets[1].scale],o,0);if(kt&&1==M&&null!=f){let l=le(vt.dist(k,e,a,n,Hn));if(Xn>l){let t=vt.bias;if(0!=t){let n=ei(1==Ne.ori?Fn:Hn,s.scale),i=0>n?-1:1;i!=(0>f?-1:1)||(1==i?1==t?n>f:f>n:1==t?f>n:n>f)||(Xn=l,Zn=e)}else Xn=l,Zn=e}}if(0==Ne.ori?(l=c,t=n):(l=n,t=c),pt&&yt.length>1){Y(yt[e],xt.points.fill(k,e),xt.points.stroke(k,e));let n,i,o,s,r=!0,u=xt.points.bbox;if(null!=u){r=!1;let l=u(k,e);o=l.left,s=l.top,n=l.width,i=l.height}else o=l,s=t,n=i=xt.points.size(k,e);F(yt[e],n,i,r),Mt[e]=o,St[e]=s,A(yt[e],ye(o,1),ye(s,1),Yl,Cl)}}}}if(xt.idx=n,xt.left=Fn,xt.top=Hn,pt&&(el.idx=n,oi()),Bn.show&&On)if(null!=e){let[l,t]=Ei.scales,[n,s]=Ei.match,[r,u]=e.cursor.sync.scales,a=e.cursor.drag;if(jn=a._x,Un=a._y,jn||Un){let a,f,c,h,d,{left:p,top:m,width:g,height:w}=e.select,x=e.scales[l].ori,_=e.posToVal,b=null!=l&&n(l,r),v=null!=t&&s(t,u);b&&jn?(0==x?(a=p,f=g):(a=m,f=w),c=ve[l],h=Ue(_(a,r),c,i,0),d=Ue(_(a+f,r),c,i,0),ni(oe(h,d),le(d-h))):ni(0,i),v&&Un?(1==x?(a=p,f=g):(a=m,f=w),c=ve[t],h=Be(_(a,u),c,o,0),d=Be(_(a+f,u),c,o,0),ii(oe(h,d),le(d-h))):ii(0,o)}else di()}else{let e=le(Yn-Dn),l=le(Cn-Pn);if(1==Ne.ori){let t=e;e=l,l=t}jn=Nn.x&&e>=Nn.dist,Un=Nn.y&&l>=Nn.dist;let t,n,s=Nn.uni;null!=s?jn&&Un&&(jn=e>=s,Un=l>=s,jn||Un||(l>e?Un=!0:jn=!0)):Nn.x&&Nn.y&&(jn||Un)&&(jn=Un=!0),jn&&(0==Ne.ori?(t=An,n=Fn):(t=Wn,n=Hn),ni(oe(t,n),le(n-t)),Un||ii(0,o)),Un&&(1==Ne.ori?(t=An,n=Fn):(t=Wn,n=Hn),ii(oe(t,n),le(n-t)),jn||ni(0,i)),jn||Un||(ni(0,0),ii(0,0))}if(Nn._x=jn,Nn._y=Un,null==e){if(t){if(null!=Ti){let[e,l]=Ei.scales;Ei.values[0]=null!=e?ei(0==Ne.ori?Fn:Hn,e):null,Ei.values[1]=null!=l?ei(1==Ne.ori?Fn:Hn,l):null}Di(f,k,Fn,Hn,Yl,Cl,n)}if(kt){let e=t&&Ei.setSeries,l=vt.prox;null==$n?Xn>l||Kn(Zn,Qn,!0,e):Xn>l?Kn(null,Qn,!0,e):Zn!=$n&&Kn(Zn,Qn,!0,e)}}!1!==l&&Mi("setCursor")}k.setLegend=oi;let ui=null;function ai(e=!1){e?ui=null:(ui=$.getBoundingClientRect(),Mi("syncRect",ui))}function fi(e,l,t,n,i,o){xt._lock||On&&null!=e&&0==e.movementX&&0==e.movementY||(ci(e,l,t,n,i,o,0,!1,null!=e),null!=e?ri(null,!0,!0):ri(l,!0,!1))}function ci(e,l,t,n,i,o,s,r,u){if(null==ui&&ai(!1),_t(e),null!=e)t=e.clientX-ui.left,n=e.clientY-ui.top;else{if(0>t||0>n)return Fn=-10,void(Hn=-10);let[e,s]=Ei.scales,r=l.cursor.sync,[u,a]=r.values,[f,c]=r.scales,[h,d]=Ei.match,p=l.axes[0].side%2==1,m=0==Ne.ori?Yl:Cl,g=1==Ne.ori?Yl:Cl,w=p?o:i,x=p?i:o,_=p?n:t,b=p?t:n;if(t=null!=f?h(e,f)?H(u,ve[e],m,0):-10:m*(_/w),n=null!=c?d(s,c)?H(a,ve[s],g,0):-10:g*(b/x),1==Ne.ori){let e=t;t=n,n=e}}u&&(t>1&&Yl-1>t||(t=ke(t,Yl)),n>1&&Cl-1>n||(n=ke(n,Cl))),r?(Dn=t,Pn=n,[An,Wn]=xt.move(k,t,n)):(Fn=t,Hn=n)}Object.defineProperty(k,"rect",{get:()=>(null==ui&&ai(!1),ui)});const hi={width:0,height:0,left:0,top:0};function di(){Jn(hi,!1)}let pi,mi,gi,wi;function xi(e,l,t,n,i,o){On=!0,jn=Un=Nn._x=Nn._y=!1,ci(e,l,t,n,i,o,0,!0,!1),null!=e&&(zl(h,b,_i,!1),Di(c,k,An,Wn,Yl,Cl,null));let{left:s,top:r,width:u,height:a}=Bn;pi=s,mi=r,gi=u,wi=a,di()}function _i(e,l,t,n,i,o){On=Nn._x=Nn._y=!1,ci(e,l,t,n,i,o,0,!1,!0);let{left:s,top:r,width:u,height:a}=Bn,f=u>0||a>0,c=pi!=s||mi!=r||gi!=u||wi!=a;if(f&&c&&Jn(Bn),Nn.setScale&&f&&c){let e=s,l=u,t=r,n=a;if(1==Ne.ori&&(e=r,l=a,t=s,n=u),jn&&qn(ze,ei(e,ze),ei(e+l,ze)),Un)for(let e in ve){let l=ve[e];e!=ze&&null==l.from&&l.min!=he&&qn(e,ei(t+n,e),ei(t,e))}di()}else xt.lock&&(xt._lock=!xt._lock,xt._lock||ri(null,!0,!1));null!=e&&(Dl(h,b),Di(h,k,Fn,Hn,Yl,Cl,null))}function bi(e){xt._lock||(_t(e),fn(),di(),null!=e&&Di(m,k,Fn,Hn,Yl,Cl,null))}function vi(){ge.forEach(Vt),mt(k.width,k.height,!0)}G(w,v,vi);const ki={};ki.mousedown=xi,ki.mousemove=fi,ki.mouseup=_i,ki.dblclick=bi,ki.setSeries=(e,l,t,n)=>{-1!=(t=(0,Ei.match[2])(k,l,t))&&Kn(t,n,!0,!1)},xt.show&&(zl(c,$,xi),zl(f,$,fi),zl(d,$,(e=>{_t(e),ai(!1)})),zl(p,$,(function(e){if(xt._lock)return;_t(e);let l=On;if(On){let e,l,t=!0,n=!0,i=10;0==Ne.ori?(e=jn,l=Un):(e=Un,l=jn),e&&l&&(t=i>=Fn||Fn>=Yl-i,n=i>=Hn||Hn>=Cl-i),e&&t&&(Fn=An>Fn?0:Yl),l&&n&&(Hn=Wn>Hn?0:Cl),ri(null,!0,!0),On=!1}Fn=-10,Hn=-10,ri(null,!0,!0),l&&(On=l)})),zl(m,$,bi),At.add(k),k.syncRect=ai);const yi=k.hooks=u.hooks||{};function Mi(e,l,t){e in yi&&yi[e].forEach((e=>{e.call(null,k,l,t)}))}(u.plugins||[]).forEach((e=>{for(let l in e.hooks)yi[l]=(yi[l]||[]).concat(e.hooks[l])}));const Si=(e,l,t)=>t,Ei=Ie({key:null,setSeries:!1,filters:{pub:_e,sub:_e},scales:[ze,de[1]?de[1].scale:null],match:[be,be,Si],values:[null,null]},xt.sync);2==Ei.match.length&&Ei.match.push(Si),xt.sync=Ei;const Ti=Ei.key,zi=st(Ti);function Di(e,l,t,n,i,o,s){Ei.filters.pub(e,l,t,n,i,o,s)&&zi.pub(e,l,t,n,i,o,s)}function Pi(){Mi("init",u,g),an(g||u.data,!1),Ve[ze]?Ln(ze,Ve[ze]):fn(),ht=Bn.show&&(Bn.width>0||Bn.height>0),ct=pt=!0,mt(u.width,u.height)}return zi.sub(k),k.pub=function(e,l,t,n,i,o,s){Ei.filters.sub(e,l,t,n,i,o,s)&&ki[e](null,l,t,n,i,o,s)},k.destroy=function(){zi.unsub(k),At.delete(k),Tl.clear(),I(w,v,vi),O.remove(),ol?.remove(),Mi("destroy")},de.forEach(Et),ge.forEach((function(e,l){if(e._show=e.show,e.show){let t=ve[e.scale];null==t&&(e.scale=e.side%2?de[1].scale:ze,t=ve[e.scale]);let n=t.time;e.size=me(e.size),e.space=me(e.space),e.rotate=me(e.rotate),We(e.incrs)&&e.incrs.forEach((e=>{!Ee.has(e)&&Ee.set(e,Te(e))})),e.incrs=me(e.incrs||(2==t.distr?tl:n?1==fe?ml:xl:nl)),e.splits=me(e.splits||(n&&1==t.distr?Ke:3==t.distr?Ol:4==t.distr?Nl:Ll)),e.stroke=me(e.stroke),e.grid.stroke=me(e.grid.stroke),e.ticks.stroke=me(e.ticks.stroke),e.border.stroke=me(e.border.stroke);let i=e.values;e.values=We(i)&&!We(i[0])?me(i):n?We(i)?kl(Je,vl(i,qe)):Ce(i)?function(e,l){let t=Xe(l);return(l,n)=>n.map((l=>t(e(l))))}(Je,i):i||Ze:i||Il,e.filter=me(e.filter||(3>t.distr||10!=t.log?3==t.distr&&2==t.log?Kl:we:ql)),e.font=Bt(e.font),e.labelFont=Bt(e.labelFont),e._size=e.size(k,null,l,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(Tt[l]=!0,e._el=D("u-axis",X))}})),_?_ instanceof HTMLElement?(_.appendChild(O),Pi()):_(k,Pi):Pi(),k}Jt.assign=Ie,Jt.fmtNum=$,Jt.rangeNum=q,Jt.rangeLog=N,Jt.rangeAsinh=j,Jt.orient=rt,Jt.pxRatio=y,Jt.join=function(e,l){if(function(e){let l=e[0][0],t=l.length;for(let n=1;e.length>n;n++){let i=e[n][0];if(i.length!=t)return!1;if(i!=l)for(let e=0;t>e;e++)if(i[e]!=l[e])return!1}return!0}(e)){let l=e[0].slice();for(let t=1;e.length>t;t++)l.push(...e[t].slice(1));return function(e,l=100){const t=e.length;if(1>=t)return!0;let n=0,i=t-1;for(;i>=n&&null==e[n];)n++;for(;i>=n&&null==e[i];)i--;if(n>=i)return!0;const o=se(1,te((i-n+1)/l));for(let l=e[n],t=n+o;i>=t;t+=o){const n=e[t];if(null!=n){if(l>=n)return!1;l=n}}return!0}(l[0])||(l=function(e){let l=e[0],t=l.length,n=Array(t);for(let e=0;n.length>e;e++)n[e]=e;n.sort(((e,t)=>l[e]-l[t]));let i=[];for(let l=0;e.length>l;l++){let o=e[l],s=Array(t);for(let e=0;t>e;e++)s[e]=o[n[e]];i.push(s)}return i}(l)),l}let t=new Set;for(let l=0;e.length>l;l++){let n=e[l][0],i=n.length;for(let e=0;i>e;e++)t.add(n[e])}let n=[Array.from(t).sort(((e,l)=>e-l))],i=n[0].length,o=new Map;for(let e=0;i>e;e++)o.set(n[0][e],e);for(let t=0;e.length>t;t++){let s=e[t],r=s[0];for(let e=1;s.length>e;e++){let u=s[e],a=Array(i).fill(void 0),f=l?l[t][e]:1,c=[];for(let e=0;u.length>e;e++){let l=u[e],t=o.get(r[e]);null===l?0!=f&&(a[t]=l,2==f&&c.push(t)):a[t]=l}Le(a,c,i),n.push(a)}}return n},Jt.fmtDate=Xe,Jt.tzDate=function(e,l){let t;return"UTC"==l||"Etc/UTC"==l?t=new Date(+e+6e4*e.getTimezoneOffset()):l==Ze?t=e:(t=new Date(e.toLocaleString("en-US",{timeZone:l})),t.setMilliseconds(e.getMilliseconds())),t},Jt.sync=st;{Jt.addGap=function(e,l,t){let n=e[e.length-1];n&&n[0]==l?n[1]=t:e.push([l,t])},Jt.clipGaps=ct;let e=Jt.paths={points:St};e.linear=Dt,e.stepped=function(e){const l=K(e.align,1),t=K(e.ascDesc,!1),n=K(e.alignGaps,0),i=K(e.extend,!1);return(e,o,s,r)=>rt(e,o,((u,a,f,c,h,d,p,m,g,w,x)=>{let _=u.pxRound,{left:b,width:v}=e.bbox,k=e=>_(d(e,c,w,m)),M=e=>_(p(e,h,x,g)),S=0==c.ori?wt:xt;const E={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},T=E.stroke,z=c.dir*(0==c.ori?1:-1);s=O(f,s,r,1),r=O(f,s,r,-1);let D=M(f[1==z?s:r]),P=k(a[1==z?s:r]),A=P,W=P;i&&-1==l&&(W=b,S(T,W,D)),S(T,P,D);for(let e=1==z?s:r;e>=s&&r>=e;e+=z){let t=f[e];if(null==t)continue;let n=k(a[e]),i=M(t);1==l?S(T,n,D):S(T,A,i),S(T,n,i),D=i,A=n}let Y=A;i&&1==l&&(Y=b+v,S(T,Y,D));let[C,F]=ut(e,o);if(null!=u.fill||0!=C){let l=E.fill=new Path2D(T),t=M(u.fillTo(e,o,u.min,u.max,C));S(l,Y,t),S(l,W,t)}if(!u.spanGaps){let i=[];i.push(...ht(a,f,s,r,z,k,n));let h=u.width*y/2,d=t||1==l?h:-h,p=t||-1==l?-h:h;i.forEach((e=>{e[0]+=d,e[1]+=p})),E.gaps=i=u.gaps(e,o,s,r,i),E.clip=ct(i,c.ori,m,g,w,x)}return 0!=F&&(E.band=2==F?[ft(e,o,s,r,T,-1),ft(e,o,s,r,T,1)]:ft(e,o,s,r,T,F)),E}))},e.bars=function(e){const l=K((e=e||De).size,[.6,he,1]),t=e.align||0,n=(e.gap||0)*y;let i=e.radius;i=null==i?[0,0]:"number"==typeof i?[i,0]:i;const o=me(i),s=1-l[0],r=K(l[1],he)*y,u=K(l[2],1)*y,a=K(e.disp,De),f=K(e.each,(()=>{})),{fill:c,stroke:h}=a;return(e,l,i,d)=>rt(e,l,((p,m,g,w,x,_,b,v,k,M,S)=>{let E,T,z=p.pxRound;0==w.ori?[E,T]=o(e,l):[T,E]=o(e,l);const D=w.dir*(0==w.ori?1:-1);let P,A,W=0==w.ori?_t:bt,Y=0==w.ori?f:(e,l,t,n,i,o,s)=>{f(e,l,t,i,n,s,o)},C=K(e.bands,Pe).find((e=>e.series[0]==l)),F=p.fillTo(e,l,p.min,p.max,null!=C?C.dir:0),H=z(b(F,x,S,k)),R=z(p.width*y),G=!1,I=null,L=null,O=null,N=null;null==c||0!=R&&null==h||(G=!0,I=c.values(e,l,i,d),L=new Map,new Set(I).forEach((e=>{null!=e&&L.set(e,new Path2D)})),R>0&&(O=h.values(e,l,i,d),N=new Map,new Set(O).forEach((e=>{null!=e&&N.set(e,new Path2D)}))));let{x0:j,size:U}=a;if(null!=j&&null!=U){m=j.values(e,l,i,d),2==j.unit&&(m=m.map((l=>e.posToVal(v+l*M,w.key,!0))));let t=U.values(e,l,i,d);A=2==U.unit?t[0]*M:_(t[0],w,M,v)-_(0,w,M,v),A/2>R||(R=0),A=z(pe(A-R,u,r)),P=1==D?-R/2:A+R/2}else{let e=M;if(m.length>1){let l=null;for(let t=0,n=1/0;m.length>t;t++)if(void 0!==g[t]){if(null!=l){let i=le(m[t]-m[l]);n>i&&(n=i,e=le(_(m[t],w,M,v)-_(m[l],w,M,v)))}l=t}}let l=e*s;A=e-l-n,A/2>R||(R=0),5>l+n&&(z=ge),A=z(pe(e-l,u,r)-R-n),P=(0==t?A/2:t==D?0:A)-t*D*n/2}const B={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},V=G?null:new Path2D;let J=null;if(null!=C)J=e.data[C.series[1]];else{let{y0:t,y1:n}=a;null!=t&&null!=n&&(g=n.values(e,l,i,d),J=t.values(e,l,i,d))}let q=E*A,X=T*A;for(let t=1==D?i:d;t>=i&&d>=t;t+=D){let n=g[t];if(null==n)continue;if(null!=J){let e=J[t]??0;if(n-e==0)continue;H=b(e,x,S,k)}let i=_(2!=w.distr||null!=a?m[t]:t,w,M,v),o=b(K(n,F),x,S,k),s=z(i-P),r=z(se(o,H)),u=z(oe(o,H)),f=r-u;if(null!=n){let i=0>n?X:q,o=0>n?q:X;G?(R>0&&null!=O[t]&&W(N.get(O[t]),s,u+te(R/2),A,se(0,f-R),i,o),null!=I[t]&&W(L.get(I[t]),s,u+te(R/2),A,se(0,f-R),i,o)):W(V,s,u+te(R/2),A,se(0,f-R),i,o),Y(e,l,t,s-R/2,u,A+R,f)}}return R>0?B.stroke=G?N:V:G||(B._fill=0==p.width?p._fill:p._stroke??p._fill,B.width=0),B.fill=G?L:V,B}))},e.spline=function(e){return function(e,l){const t=K(l?.alignGaps,0);return(l,n,i,o)=>rt(l,n,((s,r,u,a,f,c,h,d,p,m,g)=>{let w,x,_,b=s.pxRound,v=e=>b(c(e,a,m,d)),k=e=>b(h(e,f,g,p));0==a.ori?(w=mt,_=wt,x=yt):(w=gt,_=xt,x=Mt);const y=a.dir*(0==a.ori?1:-1);i=O(u,i,o,1),o=O(u,i,o,-1);let M=v(r[1==y?i:o]),S=M,E=[],T=[];for(let e=1==y?i:o;e>=i&&o>=e;e+=y)if(null!=u[e]){let l=v(r[e]);E.push(S=l),T.push(k(u[e]))}const z={stroke:e(E,T,w,_,x,b),fill:null,clip:null,band:null,gaps:null,flags:1},D=z.stroke;let[P,A]=ut(l,n);if(null!=s.fill||0!=P){let e=z.fill=new Path2D(D),t=k(s.fillTo(l,n,s.min,s.max,P));_(e,S,t),_(e,M,t)}if(!s.spanGaps){let e=[];e.push(...ht(r,u,i,o,y,v,t)),z.gaps=e=s.gaps(l,n,i,o,e),z.clip=ct(e,a.ori,d,p,m,g)}return 0!=A&&(z.band=2==A?[ft(l,n,i,o,D,-1),ft(l,n,i,o,D,1)]:ft(l,n,i,o,D,A)),z}))}(Pt,e)}}return Jt}(); diff --git a/src/uPlot.js b/src/uPlot.js index d13e662d..3234b47a 100644 --- a/src/uPlot.js +++ b/src/uPlot.js @@ -705,6 +705,13 @@ export default function uPlot(opts, data, then) { let plotLftCss = 0; let plotTopCss = 0; + // previous values for diffing + let _plotLftCss = plotLftCss; + let _plotTopCss = plotTopCss; + let _plotWidCss = plotWidCss; + let _plotHgtCss = plotHgtCss; + + let plotLft = 0; let plotTop = 0; let plotWid = 0; @@ -728,9 +735,6 @@ export default function uPlot(opts, data, then) { shouldConvergeSize = true; shouldSetSize = true; - if (cursor.left >= 0) - shouldSetCursor = shouldSetLegend = true; - commit(); } @@ -758,11 +762,6 @@ export default function uPlot(opts, data, then) { const CYCLE_LIMIT = 3; function convergeSize() { - let _plotLft = plotLft; - let _plotTop = plotTop; - let _plotWid = plotWid; - let _plotHgt = plotHgt; - let converged = false; let cycleNum = 0; @@ -778,15 +777,6 @@ export default function uPlot(opts, data, then) { if (!converged) { calcSize(self.width, self.height); shouldSetSize = true; - - if ( - plotLft != _plotLft || - plotTop != _plotTop || - plotWid != _plotWid || - plotHgt != _plotHgt - ) { - resetYSeries(false); - } } } } @@ -902,6 +892,9 @@ export default function uPlot(opts, data, then) { // series-intersection markers let cursorPts = [null]; + // position caches in CSS pixels + let cursorPtsLft = [null]; + let cursorPtsTop = [null]; function initCursorPt(s, si) { if (si > 0) { @@ -967,7 +960,12 @@ export default function uPlot(opts, data, then) { activeIdxs.splice(i, 0, null); let pt = initCursorPt(s, i); - pt && cursorPts.splice(i, 0, pt); + + if (pt != null) { + cursorPts.splice(i, 0, pt); + cursorPtsLft.splice(i, 0, 0); + cursorPtsTop.splice(i, 0, 0); + } } fire("addSeries", i); @@ -999,7 +997,11 @@ export default function uPlot(opts, data, then) { if (cursor.show) { activeIdxs.splice(i, 1); - cursorPts.length > 1 && cursorPts.splice(i, 1)[0].remove(); + if (cursorPts.length > 1) { + cursorPts.splice(i, 1)[0].remove(); + cursorPtsLft.splice(i, 1); + cursorPtsTop.splice(i, 1); + } } // TODO: de-init no-longer-needed scales? @@ -2074,6 +2076,47 @@ export default function uPlot(opts, data, then) { syncRect(true); + if ( + plotLftCss != _plotLftCss || + plotTopCss != _plotTopCss || + plotWidCss != _plotWidCss || + plotHgtCss != _plotHgtCss + ) { + resetYSeries(false); + + let pctWid = plotWidCss / _plotWidCss; + let pctHgt = plotHgtCss / _plotHgtCss; + + if (cursor.show && !shouldSetCursor && cursor.left >= 0) { + cursor.left *= pctWid; + cursor.top *= pctHgt; + + vCursor && elTrans(vCursor, round(cursor.left), 0, plotWidCss, plotHgtCss); + hCursor && elTrans(hCursor, 0, round(cursor.top), plotWidCss, plotHgtCss); + + for (let i = 1; i < cursorPts.length; i++) { + cursorPtsLft[i] *= pctWid; + cursorPtsTop[i] *= pctHgt; + elTrans(cursorPts[i], incrRoundUp(cursorPtsLft[i], 1), incrRoundUp(cursorPtsTop[i], 1), plotWidCss, plotHgtCss); + } + } + + if (select.show && !shouldSetSelect && select.left >= 0 && select.width > 0) { + select.left *= pctWid; + select.width *= pctWid; + select.top *= pctHgt; + select.height *= pctHgt; + + for (let prop in _hideProps) + setStylePx(selectDiv, prop, select[prop]); + } + + _plotLftCss = plotLftCss; + _plotTopCss = plotTopCss; + _plotWidCss = plotWidCss; + _plotHgtCss = plotHgtCss; + } + fire("setSize"); shouldSetSize = false; @@ -2556,11 +2599,11 @@ export default function uPlot(opts, data, then) { activeIdxs[i] = idx2; - let xPos2 = incrRoundUp(idx2 == idx ? xPos : valToPosX(mode == 1 ? data[0][idx2] : data[i][0][idx2], scaleX, xDim, 0), 1); + let xPos2 = idx2 == idx ? xPos : valToPosX(mode == 1 ? data[0][idx2] : data[i][0][idx2], scaleX, xDim, 0); if (i > 0 && s.show) { // this doesnt really work for state timeline, heatmap, status history (where the value maps to color, not y coords) - let yPos = yVal2 == null ? -10 : incrRoundUp(valToPosY(yVal2, mode == 1 ? scales[s.scale] : scales[s.facets[1].scale], yDim, 0), 1); + let yPos = yVal2 == null ? -10 : valToPosY(yVal2, mode == 1 ? scales[s.scale] : scales[s.facets[1].scale], yDim, 0); if (cursorFocus && mode == 1 && yVal2 != null) { let dist = abs(focus.dist(self, i, idx2, yPos, mouseTop1)); @@ -2627,8 +2670,13 @@ export default function uPlot(opts, data, then) { ptWid = ptHgt = cursor.points.size(self, i); } + elSize(cursorPts[i], ptWid, ptHgt, centered); - elTrans(cursorPts[i], ptLft, ptTop, plotWidCss, plotHgtCss); + + cursorPtsLft[i] = ptLft; + cursorPtsTop[i] = ptTop; + + elTrans(cursorPts[i], incrRoundUp(ptLft, 1), incrRoundUp(ptTop, 1), plotWidCss, plotHgtCss); } } }