mirror of https://github.com/ColorlibHQ/AdminLTE
3 lines
35 KiB
JavaScript
3 lines
35 KiB
JavaScript
/*! https://github.com/leeoniya/uPlot (v1.6.5) */
|
|
var uPlot=function(){"use strict";function n(n,r,e,t){var i;e=e||0;for(var l=2147483647>=(t=t||r.length-1);t-e>1;)n>r[i=l?e+t>>1:m((e+t)/2)]?e=i:t=i;return n-r[e]>r[t]-n?t:e}function r(n,r,e,t){for(var i=1==t?r:e;i>=r&&e>=i;i+=t)if(null!=n[i])return i;return-1}var e=[0,0];function t(n,r,t,i){return e[0]=0>t?Y(n,-t):n,e[1]=0>i?Y(r,-i):r,e}function i(n,r,e,i){var l,a,o,s=10==e?k:y;return n==r&&(n/=e,r*=e),i?(l=m(s(n)),a=g(s(r)),n=(o=t(b(e,l),b(e,a),l,a))[0],r=o[1]):(l=m(s(d(n))),a=m(s(d(r))),n=W(n,(o=t(b(e,l),b(e,a),l,a))[0]),r=A(r,o[1])),[n,r]}function l(n,r,e,t){var l=i(n,r,e,t);return 0==n&&(l[0]=0),0==r&&(l[1]=0),l}var a={pad:0,soft:null,mode:0},o={min:a,max:a};function s(n,r,e,t){return V(e)?f(n,r,e):(a.pad=e,a.soft=t?0:null,a.mode=t?3:0,f(n,r,o))}function u(n,r){return null==n?r:n}function f(n,r,e){var t=e.min,i=e.max,l=u(t.pad,0),a=u(i.pad,0),o=u(t.hard,-S),s=u(i.hard,S),f=u(t.soft,S),c=u(i.soft,-S),v=u(t.mode,0),h=u(i.mode,0),p=r-n,g=p||d(r)||1e3,_=k(g),y=b(10,m(_)),M=Y(W(n-g*(0==p?0==n?.1:1:l),y/10),6),z=f>n||1!=v&&(3!=v||M>f)&&(2!=v||f>M)?S:f,T=x(o,z>M&&n>=z?z:w(z,M)),D=Y(A(r+g*(0==p?0==r?.1:1:a),y/10),6),E=r>c||1!=h&&(3!=h||c>D)&&(2!=h||D>c)?-S:c,P=w(s,D>E&&E>=r?E:x(E,D));return T==P&&0==T&&(P=100),[T,P]}var c=new Intl.NumberFormat(navigator.language).format,v=Math,h=v.PI,d=v.abs,m=v.floor,p=v.round,g=v.ceil,w=v.min,x=v.max,b=v.pow,_=v.sqrt,k=v.log10,y=v.log2,M=(n,r)=>(void 0===r&&(r=1),v.asinh(n/r)),S=1/0;function z(n,r){return p(n/r)*r}function T(n,r,e){return w(x(n,r),e)}function D(n){return"function"==typeof n?n:()=>n}var E=(n,r)=>r,P=()=>null;function A(n,r){return g(n/r)*r}function W(n,r){return m(n/r)*r}function Y(n,r){return p(n*(r=Math.pow(10,r)))/r}var C=new Map;function H(n){return((""+n).split(".")[1]||"").length}function F(n,r,e,t){for(var i=[],l=t.map(H),a=r;e>a;a++)for(var o=d(a),s=Y(b(n,a),o),u=0;t.length>u;u++){var f=t[u]*s,c=(0>f||0>a?o:0)+(l[u]>a?l[u]:0),v=Y(f,c);i.push(v),C.set(v,c)}return i}var N={},I=Array.isArray;function L(n){return"string"==typeof n}function V(n){var r=!1;if(null!=n){var e=n.constructor;r=null==e||e==Object}return r}function O(n){var r;if(I(n))r=n.map(O);else if(V(n))for(var e in r={},n)r[e]=O(n[e]);else r=n;return r}function j(n){for(var r=arguments,e=1;r.length>e;e++){var t=r[e];for(var i in t)V(n[i])?j(n[i],O(t[i])):n[i]=O(t[i])}return n}function G(n,r,e){for(var t=0,i=void 0,l=-1;r.length>t;t++){var a=r[t];if(a>l){for(i=a-1;i>=0&&null==n[i];)n[i--]=null;for(i=a+1;e>i&&null==n[i];)n[l=i++]=null}}}var B="undefined"==typeof queueMicrotask?n=>Promise.resolve().then(n):queueMicrotask,R="width",U="height",J="top",q="bottom",Z="left",X="right",K="#000",Q="#0000",$="mousemove",nn="mousedown",rn="mouseup",en="mouseenter",tn="mouseleave",ln="dblclick",an="resize",on="scroll",sn="u-off",un="u-label",fn=document,cn=window,vn=devicePixelRatio;function hn(n,r){null!=r&&n.classList.add(r)}function dn(n,r){n.classList.remove(r)}function mn(n,r,e){n.style[r]=e+"px"}function pn(n,r,e,t){var i=fn.createElement(n);return null!=r&&hn(i,r),null!=e&&e.insertBefore(i,t),i}function gn(n,r){return pn("div",n,r)}function wn(n,r,e,t,i){n.style.transform="translate("+r+"px,"+e+"px)",0>r||0>e||r>t||e>i?hn(n,sn):dn(n,sn)}var xn={passive:!0};function bn(n,r,e){r.addEventListener(n,e,xn)}function _n(n,r,e){r.removeEventListener(n,e,xn)}var kn=["January","February","March","April","May","June","July","August","September","October","November","December"],yn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Mn(n){return n.slice(0,3)}var Sn=yn.map(Mn),zn=kn.map(Mn),Tn={MMMM:kn,MMM:zn,WWWW:yn,WWW:Sn};function Dn(n){return(10>n?"0":"")+n}var En={YYYY:n=>n.getFullYear(),YY:n=>(n.getFullYear()+"").slice(2),MMMM:(n,r)=>r.MMMM[n.getMonth()],MMM:(n,r)=>r.MMM[n.getMonth()],MM:n=>Dn(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>Dn(n.getDate()),D:n=>n.getDate(),WWWW:(n,r)=>r.WWWW[n.getDay()],WWW:(n,r)=>r.WWW[n.getDay()],HH:n=>Dn(n.getHours()),H:n=>n.getHours(),h:n=>{var r=n.getHours();return 0==r?12:r>12?r-12:r},AA:n=>12>n.getHours()?"AM":"PM",aa:n=>12>n.getHours()?"am":"pm",a:n=>12>n.getHours()?"a":"p",mm:n=>Dn(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>Dn(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>function(n){return(10>n?"00":100>n?"0":"")+n}(n.getMilliseconds())};function Pn(n,r){r=r||Tn;for(var e,t=[],i=/\{([a-z]+)\}|[^{]+/gi;e=i.exec(n);)t.push("{"==e[0][0]?En[e[1]]:e[0]);return n=>{for(var e="",i=0;t.length>i;i++)e+="string"==typeof t[i]?t[i]:t[i](n,r);return e}}var An=(new Intl.DateTimeFormat).resolvedOptions().timeZone,Wn=n=>n%1==0,Yn=[1,2,2.5,5],Cn=F(10,-16,0,Yn),Hn=F(10,0,16,Yn),Fn=Hn.filter(Wn),Nn=Cn.concat(Hn),In="{YYYY}",Ln="\n"+In,Vn="{M}/{D}",On="\n"+Vn,jn=On+"/{YY}",Gn="{aa}",Bn="{h}:{mm}"+Gn,Rn="\n"+Bn,Un=":{ss}",Jn=null;function qn(n){var r=1e3*n,e=60*r,t=60*e,i=24*t,l=30*i,a=365*i;return[(1==n?F(10,0,3,Yn).filter(Wn):F(10,-3,0,Yn)).concat([r,5*r,10*r,15*r,30*r,e,5*e,10*e,15*e,30*e,t,2*t,3*t,4*t,6*t,8*t,12*t,i,2*i,3*i,4*i,5*i,6*i,7*i,8*i,9*i,10*i,15*i,l,2*l,3*l,4*l,6*l,a,2*a,5*a,10*a,25*a,50*a,100*a]),[[a,In,Jn,Jn,Jn,Jn,Jn,Jn,1],[28*i,"{MMM}",Ln,Jn,Jn,Jn,Jn,Jn,1],[i,Vn,Ln,Jn,Jn,Jn,Jn,Jn,1],[t,"{h}"+Gn,jn,Jn,On,Jn,Jn,Jn,1],[e,Bn,jn,Jn,On,Jn,Jn,Jn,1],[r,Un,jn+" "+Bn,Jn,On+" "+Bn,Jn,Rn,Jn,1],[n,Un+".{fff}",jn+" "+Bn,Jn,On+" "+Bn,Jn,Rn,Jn,1]],function(r){return(o,s,u,f,c,v)=>{var h=[],d=c>=a,p=c>=l&&a>c,g=r(u),w=g*n,x=lr(g.getFullYear(),d?0:g.getMonth(),p||d?1:g.getDate()),b=x*n;if(p||d)for(var _=p?c/l:0,k=d?c/a:0,y=w==b?w:lr(x.getFullYear()+k,x.getMonth()+_,1)*n,M=new Date(y/n),S=M.getFullYear(),z=M.getMonth(),T=0;f>=y;T++){var D=lr(S+k*T,z+_*T,1);(y=(+D+(D-r(D*n)))*n)>f||h.push(y)}else{var E=i>c?c:i,P=b+(m(u)-m(w))+A(w-b,E);h.push(P);for(var W=r(P),C=W.getHours()+W.getMinutes()/e+W.getSeconds()/t,H=c/t,F=v/o.axes[s]._space;(P=Y(P+c,1==n?0:3))<=f;)if(H>1){var N=m(Y(C+H,6))%24,I=r(P).getHours()-N;I>1&&(I=-1),C=(C+H)%24,.7>Y(((P-=I*t)-h[h.length-1])/c,3)*F||h.push(P)}else h.push(P)}return h}}]}var Zn=qn(1),Xn=Zn[0],Kn=Zn[1],Qn=Zn[2],$n=qn(.001),nr=$n[0],rr=$n[1],er=$n[2];function tr(n,r){return n.map((n=>n.map(((e,t)=>0==t||8==t||null==e?e:r(1==t||0==n[8]?e:n[1]+e)))))}function ir(n,r){return(e,t,i,l,a)=>{var o,s,u,f,c,v,h=r.find((n=>a>=n[0]))||r[r.length-1];return t.map((r=>{var e=n(r),t=e.getFullYear(),i=e.getMonth(),l=e.getDate(),a=e.getHours(),d=e.getMinutes(),m=e.getSeconds(),p=t!=o&&h[2]||i!=s&&h[3]||l!=u&&h[4]||a!=f&&h[5]||d!=c&&h[6]||m!=v&&h[7]||h[1];return o=t,s=i,u=l,f=a,c=d,v=m,p(e)}))}}function lr(n,r,e){return new Date(n,r,e)}function ar(n,r){return r(n)}function or(n,r){return(e,t)=>r(n(t))}function sr(n,r){var e=n.series[r];return e.width?e.stroke(n,r):e.points.width?e.points.stroke(n,r):null}function ur(n,r){return n.series[r].fill(n,r)}F(2,-53,53,[1]);var fr=[0,0];function cr(n,r,e){return n=>{0==n.button&&e(n)}}function vr(n,r,e){return e}var hr={show:!0,x:!0,y:!0,lock:!1,move:function(n,r,e){return fr[0]=r,fr[1]=e,fr},points:{show:function(n,r){var e=n.cursor.points,t=gn(),i=e.stroke(n,r),l=e.fill(n,r);t.style.background=l||i;var a=e.size(n,r),o=e.width(n,r,a);o&&(t.style.border=o+"px solid "+i);var s=a/-2;return mn(t,R,a),mn(t,U,a),mn(t,"marginLeft",s),mn(t,"marginTop",s),t},size:function(n,r){return Ar(n.series[r].width,1)},width:0,stroke:function(n,r){return n.series[r].stroke(n,r)},fill:function(n,r){return n.series[r].stroke(n,r)}},bind:{mousedown:cr,mouseup:cr,click:cr,dblclick:cr,mousemove:vr,mouseleave:vr,mouseenter:vr},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,_x:!1,_y:!1},focus:{prox:-1},left:-10,top:-10,idx:null,dataIdx:function(n,r,e){return e}},dr={show:!0,stroke:"rgba(0,0,0,0.07)",width:2,filter:E},mr=j({},dr,{size:10}),pr='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"',gr="bold "+pr,wr={show:!0,scale:"x",stroke:K,space:50,gap:5,size:50,labelSize:30,labelFont:gr,side:2,grid:dr,ticks:mr,font:pr,rotate:0},xr={show:!0,scale:"x",auto:!1,sorted:1,min:S,max:-S,idxs:[]};function br(n,r){return r.map((n=>null==n?"":c(n)))}function _r(n,r,e,t,i,l,a){for(var o=[],s=C.get(i)||0,u=e=a?e:Y(A(e,i),s);t>=u;u=Y(u+i,s))o.push(Object.is(u,-0)?0:u);return o}function kr(n,r,e,t,i){var l=[],a=n.scales[n.axes[r].scale].log,o=m((10==a?k:y)(e));i=b(a,o),0>o&&(i=Y(i,-o));var s=e;do{l.push(s),i*a>(s=Y(s+i,C.get(i)))||(i=s)}while(t>=s);return l}function yr(n,r,e,t,i){var l=n.scales[n.axes[r].scale].asinh,a=t>l?kr(n,r,x(l,e),t,i):[l],o=0>t||e>0?[]:[0];return(-l>e?kr(n,r,x(l,-t),-e,i):[l]).reverse().map((n=>-n)).concat(o,a)}var Mr=/./,Sr=/[12357]/,zr=/[125]/,Tr=/1/;function Dr(n,r,e){var t=n.axes[e],i=t.scale,l=n.scales[i];if(3==l.distr&&2==l.log)return r;var a=n.valToPos,o=t._space,s=a(10,i),u=a(9,i)-s<o?a(7,i)-s<o?a(5,i)-s<o?Tr:zr:Sr:Mr;return r.map((n=>4==l.distr&&0==n||u.test(n)?n:null))}function Er(n,r){return null==r?"":c(r)}var Pr={show:!0,scale:"y",stroke:K,space:30,gap:5,size:50,labelSize:30,labelFont:gr,side:3,grid:dr,ticks:mr,font:pr,rotate:0};function Ar(n,r){return Y((3+2*(n||1))*r,3)}function Wr(n,r){var e=n.scales[n.series[r].scale],t=n.bands&&n.bands.some((n=>n.series[0]==r));return 3==e.distr||t?e.min:0}var Yr={scale:"y",auto:!0,sorted:0,show:!0,band:!1,spanGaps:!1,alpha:1,points:{show:function(n,r){var e=n.series[0].idxs;return(0==n.scales[n.series[0].scale].ori?n.bbox.width:n.bbox.height)/(n.series[r].points.space*vn)>=e[1]-e[0]}},values:null,min:S,max:-S,idxs:[],path:null,clip:null};function Cr(n,r,e){return e/10}var Hr={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Fr=j({},Hr,{time:!1,ori:1}),Nr={};function Ir(n){var r=Nr[n];if(!r){var e=[];r={key:n,sub:function(n){e.push(n)},unsub:function(n){e=e.filter((r=>r!=n))},pub:function(n,r,t,i,l,a){for(var o=0;e.length>o;o++)e[o]!=r&&e[o].pub(n,r,t,i,l,a,o)}},null!=n&&(Nr[n]=r)}return r}function Lr(n,r,e){var t=n.series[r],i=n.scales,l=n.bbox,a=n._data[0],o=n._data[r],s=i[n.series[0].scale],u=i[t.scale],f=l.left,c=l.top,v=l.width,h=l.height,d=n.valToPosH,m=n.valToPosV;return 0==s.ori?e(t,a,o,s,u,d,m,f,c,v,h,Gr,Rr,Jr,Zr,Kr):e(t,a,o,s,u,m,d,c,f,h,v,Br,Ur,qr,Xr,Qr)}function Vr(n,r,e,t,i){return Lr(n,r,((n,r,l,a,o,s,u,f,c,v,h)=>{var d,m,p=0==a.ori?Rr:Ur;1==a.dir*(0==a.ori?1:-1)?(d=e,m=t):(d=t,m=e);var g=z(s(r[d],a,v,f),.5),w=z(u(l[d],o,h,c),.5),x=z(s(r[m],a,v,f),.5),b=z(u(o.max,o,h,c),.5),_=new Path2D(i);return p(_,x,b),p(_,g,b),p(_,g,w),_}))}function Or(n,r,e,t,i,l){var a=null;if(n.length>0){a=new Path2D;for(var o=0==r?Jr:qr,s=e,u=0;n.length>u;u++){var f=n[u];o(a,s,t,f[0]-s,t+l),s=f[1]}o(a,s,t,e+i-s,t+l)}return a}function jr(n,r,e){if(e>r){var t=n[n.length-1];t&&t[0]==r?t[1]=e:n.push([r,e])}}function Gr(n,r,e){n.moveTo(r,e)}function Br(n,r,e){n.moveTo(e,r)}function Rr(n,r,e){n.lineTo(r,e)}function Ur(n,r,e){n.lineTo(e,r)}function Jr(n,r,e,t,i){n.rect(r,e,t,i)}function qr(n,r,e,t,i){n.rect(e,r,i,t)}function Zr(n,r,e,t,i,l){n.arc(r,e,t,i,l)}function Xr(n,r,e,t,i,l){n.arc(e,r,t,i,l)}function Kr(n,r,e,t,i,l,a){n.bezierCurveTo(r,e,t,i,l,a)}function Qr(n,r,e,t,i,l,a){n.bezierCurveTo(e,r,i,t,a,l)}function $r(n){return(r,e,t,i,l)=>{t!=i&&(n(r,e,t),n(r,e,i),n(r,e,l))}}var ne=$r(Rr),re=$r(Ur);function ee(){return(n,e,t,i)=>Lr(n,e,((l,a,o,s,u,f,c,v,h,d,m)=>{var g,b;0==s.ori?(g=Rr,b=ne):(g=Ur,b=re);var _,k,y,M=s.dir*(0==s.ori?1:-1),T={stroke:new Path2D,fill:null,clip:null,band:null},D=T.stroke,E=S,P=-S,A=[],W=p(f(a[1==M?t:i],s,d,v)),Y=!1,C=r(o,t,i,1*M),H=r(o,t,i,-1*M),F=z(f(a[C],s,d,v),.5),N=z(f(a[H],s,d,v),.5);F>v&&jr(A,v,F);for(var I=1==M?t:i;I>=t&&i>=I;I+=M){var L=p(f(a[I],s,d,v));if(L==W)null!=o[I]?(_=p(c(o[I],u,m,h)),E==S&&g(D,L,_),E=w(_,E),P=x(_,P)):Y||null!==o[I]||(Y=!0);else{var V=!1;E!=S?(b(D,W,E,P,_),k=y=W):Y&&(V=!0,Y=!1),null!=o[I]?(g(D,L,_=p(c(o[I],u,m,h))),E=P=_,L-W>1&&null===o[I-M]&&(V=!0)):(E=S,P=-S,Y||null!==o[I]||(Y=!0)),V&&jr(A,k,L),W=L}}if(E!=S&&E!=P&&y!=W&&b(D,W,E,P,_),v+d>N&&jr(A,N,v+d),null!=l.fill){var O=T.fill=new Path2D(D),j=p(c(l.fillTo(n,e,l.min,l.max),u,m,h));g(O,N,j),g(O,F,j)}return l.spanGaps||(T.clip=Or(A,s.ori,v,h,d,m)),n.bands.length>0&&(T.band=Vr(n,e,t,i,D)),T}))}function te(n,r,e,t,i){var l,a,o,s,u,f,c,v,h,d,m,g,w,x,k,y,M,S,z,T,D,E,P,A,W,Y=new Path2D,C=n.length;t(Y,p(n[0]),p(r[0]));for(var H=0;C-1>H;H++){var F=0==H?0:H-1;a=r[F],s=r[H],u=n[H+1],f=r[H+1],C>H+2?(c=n[H+2],v=r[H+2]):(c=u,v=f),w=_(b((l=n[F])-(o=n[H]),2)+b(a-s,2)),x=_(b(o-u,2)+b(s-f,2)),k=_(b(u-c,2)+b(f-v,2)),T=b(k,e),E=b(k,2*e),D=b(x,e),P=b(x,2*e),(S=3*(W=b(w,e))*(W+D))>0&&(S=1/S),(z=3*T*(T+D))>0&&(z=1/z),d=(-P*a+(y=2*(A=b(w,2*e))+3*W*D+P)*s+A*f)*S,g=(E*s+(M=2*E+3*T*D+P)*f-P*v)*z,0==(h=(-P*l+y*o+A*u)*S)&&0==d&&(h=o,d=s),0==(m=(E*o+M*u-P*c)*z)&&0==g&&(m=u,g=f),i(Y,h,d,m,g,u,f)}return Y}var ie=ee();function le(n,r,e,t){return(t?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map(((n,t)=>ae(n,t,r,e)))}function ae(n,r,e,t){return j({},0==r?e:t,n)}var oe=[null,null];function se(n,r,e){return null==r?oe:[r,e]}var ue=se;function fe(n,r,e){return null==r?oe:s(r,e,.1,!0)}function ce(n,r,e,t){return null==r?oe:i(r,e,n.scales[t].log,!1)}var ve=ce;function he(n,r,e,t){return null==r?oe:l(r,e,n.scales[t].log,!1)}var de=he;function me(n){var r;return[n=n.replace(/(\d+)px/,((n,e)=>(r=p(e*vn))+"px")),r]}function pe(r,e,t){var a={};function o(n,r){return((3==r.distr?k(n>0?n:r.clamp(a,n,r.min,r.max,r.key)):4==r.distr?M(n,r.asinh):n)-r._min)/(r._max-r._min)}function f(n,r,e,t){var i=o(n,r);return t+e*(-1==r.dir?1-i:i)}function c(n,r,e,t){var i=o(n,r);return t+e*(-1==r.dir?i:1-i)}function _(n,r,e,t){return 0==r.ori?f(n,r,e,t):c(n,r,e,t)}a.valToPosH=f,a.valToPosV=c;var y=!1;a.status=0;var W=a.root=gn("uplot");null!=r.id&&(W.id=r.id),hn(W,r.class),r.title&&(gn("u-title",W).textContent=r.title);var H=pn("canvas"),F=a.ctx=H.getContext("2d"),G=gn("u-wrap",W),K=gn("u-under",G);G.appendChild(H);var xn=gn("u-over",G),kn=u((r=O(r)).pxAlign,!0);(r.plugins||[]).forEach((n=>{n.opts&&(r=n.opts(a,r)||r)}));var yn=r.ms||.001,Mn=a.series=le(r.series||[],xr,Yr,!1),Sn=a.axes=le(r.axes||[],wr,Pr,!0),zn=a.scales={},Tn=a.bands=r.bands||[];Tn.forEach((n=>{n.fill=D(n.fill||null)}));var Dn=Mn[0].scale,En={axes:function(){Sn.forEach(((n,r)=>{if(n.show&&n._show){var e=zn[n.scale],t=n.side,i=t%2,l=0==i?Ur:Jr,o=0==i?jr:Rr,s=p(n.gap*vn),u=n.ticks,f=u.show?p(u.size*vn):0,c=n._found,v=c[0],d=c[1],m=n._splits,g=2==e.distr?m.map((n=>Ee[n])):m,w=2==e.distr?Ee[m[1]]-Ee[m[0]]:v,x=n._rotate*-h/180,b=p(n._pos*vn),k=b+(f+s)*(0==i&&0==t||1==i&&3==t?-1:1),y=0==i?k:0,M=1==i?k:0;F.font=n.font[0],F.fillStyle=n.stroke(a,r),F.textAlign=1==n.align?Z:2==n.align?X:x>0?Z:0>x?X:0==i?"center":3==t?X:Z,F.textBaseline=x||1==i?"middle":2==t?J:q;var S=1.5*n.font[1],z=m.map((n=>p(_(n,e,l,o))));if(n._values.forEach(((n,r)=>{null!=n&&(0==i?M=z[r]:y=z[r],(""+n).split(/\n/gm).forEach(((n,r)=>{x?(F.save(),F.translate(M,y+r*S),F.rotate(x),F.fillText(n,0,0),F.restore()):F.fillText(n,M,y+r*S)})))})),n.label){F.save();var T=p(n._lpos*vn);1==i?(M=y=0,F.translate(T,p(Rr+Jr/2)),F.rotate((3==t?-h:h)/2)):(M=p(jr+Ur/2),y=T),F.font=n.labelFont[0],F.textAlign="center",F.textBaseline=2==t?J:q,F.fillText(n.label,M,y),F.restore()}u.show&&He(z,u.filter(a,g,r,d,w),i,t,b,f,Y(u.width*vn,3),u.stroke(a,r),u.dash,u.cap);var D=n.grid;D.show&&He(z,D.filter(a,g,r,d,w),i,0==i?2:1,0==i?Rr:jr,0==i?Jr:Ur,Y(D.width*vn,3),D.stroke(a,r),D.dash,D.cap)}})),Wt("drawAxes")},series:function(){ye>0&&(Mn.forEach(((n,r)=>{if(r>0&&n.show&&null==n._paths){var t=function(n){for(var r=T(ze-1,0,ye-1),e=T(Te+1,0,ye-1);null==n[r]&&r>0;)r--;for(;null==n[e]&&ye-1>e;)e++;return[r,e]}(e[r]);n._paths=n.paths(a,r,t[0],t[1])}})),Mn.forEach(((n,r)=>{r>0&&n.show&&(n._paths&&function(n){var r=Mn[n],e=r._paths,t=e.stroke,i=e.fill,l=e.clip,o=Y(r.width*vn,3),s=o%2/2,u=r._stroke=r.stroke(a,n),f=r._fill=r.fill(a,n);F.globalAlpha=r.alpha;var c=kn&&r.pxAlign;c&&F.translate(s,s),F.save();var v=jr,h=Rr,d=Ur,m=Jr,p=o*vn/2;0==r.min&&(m+=p),0==r.max&&(h-=p,m+=p),F.beginPath(),F.rect(v,h,d,m),F.clip(),l&&F.clip(l),function(n,r,e,t,i,l,o,s){var u=!1;Tn.forEach(((f,c)=>{if(f.series[0]==n){var v=Mn[f.series[1]],h=(v._paths||N).band;F.save();var d=null;v.show&&h&&(d=f.fill(a,c)||l,F.clip(h)),Ce(r,e,t,i,d,o,s),F.restore(),u=!0}})),u||Ce(r,e,t,i,l,o,s)}(n,u,o,r.dash,r.cap,f,t,i),F.restore(),c&&F.translate(-s,-s),F.globalAlpha=1}(r),n.points.show(a,r,ze,Te)&&function(n){var r=Mn[n],t=r.points,i=Y(t.width*vn,3),l=i%2/2,o=t.width>0,s=(t.size-t.width)/2*vn,u=Y(2*s,3),f=kn&&r.pxAlign;f&&F.translate(l,l),F.save(),F.beginPath(),F.rect(jr-u,Rr-u,Ur+2*u,Jr+2*u),F.clip(),F.globalAlpha=r.alpha;var c,v,d,m,g=new Path2D,w=zn[r.scale];0==Vn.ori?(c=Ur,v=jr,d=Jr,m=Rr):(c=Jr,v=Rr,d=Ur,m=jr);for(var x=ze;Te>=x;x++)if(null!=e[n][x]){var b=p(Cn(e[0][x],Vn,c,v)),_=p(Hn(e[n][x],w,d,m));In(g,b+s,_),Ln(g,b,_,s,0,2*h)}var k=t._stroke=t.stroke(a,n),y=t._fill=t.fill(a,n);Ye(k,i,t.dash,t.cap,y||(o?"#fff":r._stroke)),F.fill(g),o&&F.stroke(g),F.globalAlpha=1,F.restore(),f&&F.translate(-l,-l)}(r),Wt("drawSeries",r))})))}},An=(r.drawOrder||["axes","series"]).map((n=>En[n]));function Wn(n){var e=zn[n];if(null==e){var t=(r.scales||N)[n]||N;if(null!=t.from)Wn(t.from),zn[n]=j({},zn[t.from],t);else{(e=zn[n]=j({},n==Dn?Hr:Fr,t)).key=n;var i=e.time,l=e.range;if(n!=Dn&&!I(l)&&V(l)){var a=l;l=(n,r,e)=>null==r?oe:s(r,e,a)}e.range=D(l||(i?ue:n==Dn?3==e.distr?ve:4==e.distr?de:se:3==e.distr?ce:4==e.distr?he:fe)),e.auto=D(e.auto),e.clamp=D(e.clamp||Cr),e._min=e._max=null}}}for(var Yn in Wn("x"),Wn("y"),Mn.forEach((n=>{Wn(n.scale)})),Sn.forEach((n=>{Wn(n.scale)})),r.scales)Wn(Yn);var Cn,Hn,In,Ln,Vn=zn[Dn],On=Vn.distr;0==Vn.ori?(hn(W,"u-hz"),Cn=f,Hn=c,In=Gr,Ln=Zr):(hn(W,"u-vt"),Cn=c,Hn=f,In=Br,Ln=Xr);var jn={};for(var Gn in zn){var Bn=zn[Gn];null==Bn.min&&null==Bn.max||(jn[Gn]={min:Bn.min,max:Bn.max})}var Rn,Un=r.tzDate||(n=>new Date(n/yn)),Jn=r.fmtDate||Pn,qn=1==yn?Qn(Un):er(Un),Zn=ir(Un,tr(1==yn?Kn:rr,Jn)),$n=or(Un,ar("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Jn)),lr=j({show:!0,live:!0},r.legend),fr=lr.show;lr.width=D(u(lr.width,2)),lr.dash=D(lr.dash||"solid"),lr.stroke=D(lr.stroke||sr),lr.fill=D(lr.fill||ur);var cr,vr=[],dr=!1;if(fr){Rn=pn("table","u-legend",W);var mr=Mn[1]?Mn[1].values:null;if(dr=null!=mr){var pr=pn("tr","u-thead",Rn);for(var gr in pn("th",null,pr),cr=mr(a,1,0))pn("th",un,pr).textContent=gr}else cr={_:0},hn(Rn,"u-inline"),lr.live&&hn(Rn,"u-live")}var Mr=new Map;function Sr(n,r,e){var t=Mr.get(r)||{},i=te.bind[n](a,r,e);i&&(bn(n,r,t[n]=i),Mr.set(r,t))}var zr=0,Tr=0,Nr=0,Lr=0,Vr=0,Or=0,jr=0,Rr=0,Ur=0,Jr=0;a.bbox={};var qr=!1,Kr=!1,Qr=!1,$r=!1,ne=!1;function re(n,r){n==a.width&&r==a.height||ee(n,r),Ie(!1),Qr=!0,Kr=!0,$r=!0,ne=!0,Qe()}function ee(n,r){a.width=zr=Nr=n,a.height=Tr=Lr=r,Vr=Or=0,function(){var n=!1,r=!1,e=!1,t=!1;Sn.forEach((i=>{if(i.show&&i._show){var l=i.side,a=l%2,o=i._size+(i.labelSize=null!=i.label?i.labelSize||30:0);o>0&&(a?(Nr-=o,3==l?(Vr+=o,t=!0):e=!0):(Lr-=o,0==l?(Or+=o,n=!0):r=!0))}})),_e[0]=n,_e[1]=e,_e[2]=r,_e[3]=t,Nr-=Se[1]+Se[3],Vr+=Se[3],Lr-=Se[2]+Se[0],Or+=Se[0]}(),function(){var n=Vr+Nr,r=Or+Lr,e=Vr,t=Or;function i(i,l){switch(i){case 1:return(n+=l)-l;case 2:return(r+=l)-l;case 3:return(e-=l)+l;case 0:return(t-=l)+l}}Sn.forEach((n=>{if(n.show&&n._show){var r=n.side;n._pos=i(r,n._size),null!=n.label&&(n._lpos=i(r,n.labelSize))}}))}();var e=a.bbox;jr=e.left=z(Vr*vn,.5),Rr=e.top=z(Or*vn,.5),Ur=e.width=z(Nr*vn,.5),Jr=e.height=z(Lr*vn,.5)}a.setSize=function(n){re(n.width,n.height)};var te=a.cursor=j({},hr,r.cursor);te._lock=!1;var pe=te.points;pe.show=D(pe.show),pe.size=D(pe.size),pe.stroke=D(pe.stroke),pe.width=D(pe.width),pe.fill=D(pe.fill);var ge=a.focus=j({},r.focus||{alpha:.3},te.focus),we=ge.prox>=0,xe=[null];function be(n,r){var e=zn[n.scale].time,t=n.value;if(n.value=e?L(t)?or(Un,ar(t,Jn)):t||$n:t||Er,n.label=n.label||(e?"Time":"Value"),r>0){n.width=null==n.width?1:n.width,n.paths=n.paths||ie||P,n.fillTo=D(n.fillTo||Wr),n.pxAlign=u(n.pxAlign,!0),n.stroke=D(n.stroke||null),n.fill=D(n.fill||null),n._stroke=n._fill=n._paths=n._focus=null;var i=Ar(n.width,1),l=n.points=j({},{size:i,width:x(1,.2*i),stroke:n.stroke,space:2*i,_stroke:null,_fill:null},n.points);l.show=D(l.show),l.fill=D(l.fill),l.stroke=D(l.stroke)}if(fr&&vr.splice(r,0,function(n,r){if(0==r&&(dr||!lr.live))return null;var e=[],t=pn("tr","u-series",Rn,Rn.childNodes[r]);hn(t,n.class),n.show||hn(t,sn);var i=pn("th",null,t),l=gn("u-marker",i);if(r>0){var o=lr.width(a,r);o&&(l.style.border=o+"px "+lr.dash(a,r)+" "+lr.stroke(a,r)),l.style.background=lr.fill(a,r)}var s=gn(un,i);for(var u in s.textContent=n.label,r>0&&(Sr("click",i,(()=>{te._lock||vt(Mn.indexOf(n),{show:!n.show},Yt.setSeries)})),we&&Sr(en,i,(()=>{te._lock||vt(Mn.indexOf(n),ht,Yt.setSeries)}))),cr){var f=pn("td","u-value",t);f.textContent="--",e.push(f)}return e}(n,r)),te.show){var o=function(n,r){if(r>0){var e=te.points.show(a,r);if(e)return hn(e,"u-cursor-pt"),hn(e,n.class),wn(e,-10,-10,Nr,Lr),xn.insertBefore(e,xe[r]),e}}(n,r);o&&xe.splice(r,0,o)}}a.addSeries=function(n,r){n=ae(n,r=null==r?Mn.length:r,xr,Yr),Mn.splice(r,0,n),be(Mn[r],r)},a.delSeries=function(n){Mn.splice(n,1),fr&&vr.splice(n,1)[0][0].parentNode.remove(),xe.length>1&&xe.splice(n,1)[0].remove()},Mn.forEach(be);var _e=[!1,!1,!1,!1];function ke(n,r,e){var t=e[0],i=e[1],l=e[2],a=e[3],o=r%2,s=0;return 0==o&&(a||i)&&(s=0==r&&!t||2==r&&!l?p(wr.size/3):0),1==o&&(t||l)&&(s=1==r&&!i||3==r&&!a?p(Pr.size/2):0),s}Sn.forEach((function(n,r){if(n._show=n.show,n.show){var e=zn[n.scale];null==e&&(n.scale=n.side%2?Mn[1].scale:Dn,e=zn[n.scale]);var t=e.time;n.size=D(n.size),n.space=D(n.space),n.rotate=D(n.rotate),n.incrs=D(n.incrs||(2==e.distr?Fn:t?1==yn?Xn:nr:Nn)),n.splits=D(n.splits||(t&&1==e.distr?qn:3==e.distr?kr:4==e.distr?yr:_r)),n.stroke=D(n.stroke),n.grid.stroke=D(n.grid.stroke),n.ticks.stroke=D(n.ticks.stroke);var i=n.values;n.values=t?I(i)?ir(Un,tr(i,Jn)):L(i)?function(n,r){var e=Pn(r);return(r,t)=>t.map((r=>e(n(r))))}(Un,i):i||Zn:i||br,n.filter=D(n.filter||(3>e.distr?E:Dr)),n.font=me(n.font),n.labelFont=me(n.labelFont),n._size=n.size(a,null,r,0),n._space=n._rotate=n._incrs=n._found=n._splits=n._values=null,n._size>0&&(_e[r]=!0)}}));var ye,Me=a.padding=(r.padding||[ke,ke,ke,ke]).map((n=>D(u(n,ke)))),Se=a._padding=Me.map(((n,r)=>n(a,r,_e,0))),ze=null,Te=null,De=Mn[0].idxs,Ee=null,Pe=!1;function Ae(n,r){if((n=n||[])[0]=n[0]||[],a.data=n,e=n.slice(),ye=(Ee=e[0]).length,2==On&&(e[0]=Ee.map(((n,r)=>r))),a._data=e,Ie(!0),Wt("setData"),!1!==r){var t=Vn;t.auto(a,Pe)?We():ct(Dn,t.min,t.max),$r=!0,ne=!0,Qe()}}function We(){var n,r,t,a,o;Pe=!0,ye>0?(ze=De[0]=0,Te=De[1]=ye-1,a=e[0][ze],o=e[0][Te],2==On?(a=ze,o=Te):1==ye&&(3==On?(a=(n=i(a,a,Vn.log,!1))[0],o=n[1]):4==On?(a=(r=l(a,a,Vn.log,!1))[0],o=r[1]):Vn.time?o=a+86400/yn:(a=(t=s(a,o,.1,!0))[0],o=t[1]))):(ze=De[0]=a=null,Te=De[1]=o=null),ct(Dn,a,o)}function Ye(n,r,e,t,i){F.strokeStyle=n||Q,F.lineWidth=r,F.lineJoin="round",F.lineCap=t||"butt",F.setLineDash(e||[]),F.fillStyle=i||Q}function Ce(n,r,e,t,i,l,a){Ye(n,r,e,t,i),i&&a&&F.fill(a),n&&l&&r&&F.stroke(l)}function He(n,r,e,t,i,l,a,o,s,u){var f=a%2/2;kn&&F.translate(f,f),Ye(o,a,s,u),F.beginPath();var c,v,h,d,m=i+(0==t||3==t?-l:l);0==e?(v=i,d=m):(c=i,h=m),n.forEach(((n,t)=>{null!=r[t]&&(0==e?c=h=n:v=d=n,F.moveTo(c,v),F.lineTo(h,d))})),F.stroke(),kn&&F.translate(-f,-f)}function Fe(n){var r=!0;return Sn.forEach(((e,t)=>{if(e.show){var i=zn[e.scale];if(null!=i.min){e._show||(r=!1,e._show=!0,Ie(!1));var l=e.side,o=i.min,s=i.max,u=function(n,r,e,t){var i,l=Sn[n];if(t>0){var o=l._space=l.space(a,n,r,e,t),s=l._incrs=l.incrs(a,n,r,e,t,o);i=l._found=function(n,r,e,t,i){for(var l=t/(r-n),a=(""+m(n)).length,o=0;e.length>o;o++){var s=e[o]*l,u=10>e[o]?C.get(e[o]):0;if(s>=i&&17>a+u)return[e[o],s]}return[0,0]}(r,e,s,t,o)}else i=[0,0];return i}(t,o,s,0==l%2?Nr:Lr),f=u[0],c=u[1];if(0!=c){var v=e._splits=e.splits(a,t,o,s,f,c,2==i.distr),h=2==i.distr?v.map((n=>Ee[n])):v,d=2==i.distr?Ee[v[1]]-Ee[v[0]]:f,p=e._values=e.values(a,e.filter(a,h,t,c,d),t,c,d);e._rotate=2==l?e.rotate(a,p,t,c):0;var w=e._size;e._size=g(e.size(a,p,t,n)),null!=w&&e._size!=w&&(r=!1)}}else e._show&&(r=!1,e._show=!1,Ie(!1))}})),r}function Ne(n){var r=!0;return Me.forEach(((e,t)=>{var i=e(a,t,_e,n);i!=Se[t]&&(r=!1),Se[t]=i})),r}function Ie(n){Mn.forEach(((r,e)=>{e>0&&(r._paths=null,n&&(r.min=null,r.max=null))}))}a.setData=Ae;var Le,Ve,Oe,je,Ge,Be,Re,Ue,Je,qe,Ze,Xe,Ke=!1;function Qe(){Ke||(B($e),Ke=!0)}function $e(){qr&&(function(){var r=O(zn);for(var t in r){var i=r[t],l=jn[t];if(null!=l&&null!=l.min)j(i,l),t==Dn&&Ie(!0);else if(t!=Dn)if(0==ye&&null==i.from){var o=i.range(a,null,null,t);i.min=o[0],i.max=o[1]}else i.min=S,i.max=-S}if(ye>0)for(var s in Mn.forEach(((t,i)=>{var l=t.scale,o=r[l],s=jn[l];if(0==i){var u=o.range(a,o.min,o.max,l);o.min=u[0],o.max=u[1],ze=n(o.min,e[0]),Te=n(o.max,e[0]),o.min>e[0][ze]&&ze++,e[0][Te]>o.max&&Te--,t.min=Ee[ze],t.max=Ee[Te]}else if(t.show&&t.auto&&o.auto(a,Pe)&&(null==s||null==s.min)){var f=null==t.min?3==o.distr?function(n,r,e){for(var t=S,i=-S,l=r;e>=l;l++)n[l]>0&&(t=w(t,n[l]),i=x(i,n[l]));return[t==S?1:t,i==-S?10:i]}(e[i],ze,Te):function(n,r,e,t){var i=S,l=-S;if(1==t)i=n[r],l=n[e];else if(-1==t)i=n[e],l=n[r];else for(var a=r;e>=a;a++)null!=n[a]&&(i=w(i,n[a]),l=x(l,n[a]));return[i,l]}(e[i],ze,Te,t.sorted):[t.min,t.max];o.min=w(o.min,t.min=f[0]),o.max=x(o.max,t.max=f[1])}t.idxs[0]=ze,t.idxs[1]=Te})),r){var u=r[s],f=jn[s];if(null==u.from&&(null==f||null==f.min)){var c=u.range(a,u.min==S?null:u.min,u.max==-S?null:u.max,s);u.min=c[0],u.max=c[1]}}for(var v in r){var h=r[v];if(null!=h.from){var d=r[h.from],m=h.range(a,d.min,d.max,v);h.min=m[0],h.max=m[1]}}var p={},g=!1;for(var b in r){var _=r[b],y=zn[b];if(y.min!=_.min||y.max!=_.max){y.min=_.min,y.max=_.max;var z=y.distr;y._min=3==z?k(y.min):4==z?M(y.min,y.asinh):y.min,y._max=3==z?k(y.max):4==z?M(y.max,y.asinh):y.max,p[b]=g=!0}}if(g){for(var T in Mn.forEach((n=>{p[n.scale]&&(n._paths=null)})),p)Qr=!0,Wt("setScale",T);te.show&&($r=!0)}for(var D in jn)jn[D]=null}(),qr=!1),Qr&&(function(){for(var n=!1,r=0;!n;){var e=Fe(++r),t=Ne(r);(n=e&&t)||(ee(a.width,a.height),Kr=!0)}}(),Qr=!1),Kr&&(mn(K,Z,Vr),mn(K,J,Or),mn(K,R,Nr),mn(K,U,Lr),mn(xn,Z,Vr),mn(xn,J,Or),mn(xn,R,Nr),mn(xn,U,Lr),mn(G,R,zr),mn(G,U,Tr),H.width=p(zr*vn),H.height=p(Tr*vn),kt(),Wt("setSize"),Kr=!1),te.show&&$r&&(bt(),$r=!1),zr>0&&Tr>0&&(F.clearRect(0,0,H.width,H.height),Wt("drawClear"),An.forEach((n=>n())),Wt("draw")),y||(y=!0,a.status=1,Wt("ready")),Pe=!1,Ke=!1}function nt(r,t){var i=zn[r];if(null==i.from){if(0==ye){var l=i.range(a,t.min,t.max,r);t.min=l[0],t.max=l[1]}if(t.min>t.max){var o=t.min;t.min=t.max,t.max=o}if(ye>1&&null!=t.min&&null!=t.max&&1e-16>t.max-t.min)return;r==Dn&&2==i.distr&&ye>0&&(t.min=n(t.min,e[0]),t.max=n(t.max,e[0])),jn[r]=t,qr=!0,Qe()}}a.redraw=(n,r)=>{Qr=r||!1,!1!==n?ct(Dn,Vn.min,Vn.max):Qe()},a.setScale=nt;var rt=!1,et=te.drag,tt=et.x,it=et.y;te.show&&(te.x&&(Le=gn("u-cursor-x",xn)),te.y&&(Ve=gn("u-cursor-y",xn)),0==Vn.ori?(Oe=Le,je=Ve):(Oe=Ve,je=Le),Ze=te.left,Xe=te.top);var lt,at,ot,st=a.select=j({show:!0,over:!0,left:0,width:0,top:0,height:0},r.select),ut=st.show?gn("u-select",st.over?xn:K):null;function ft(n,r){if(st.show){for(var e in n)mn(ut,e,st[e]=n[e]);!1!==r&&Wt("setSelect")}}function ct(n,r,e){nt(n,{min:r,max:e})}function vt(n,r,e){var t=Mn[n];null!=r.focus&&function(n){if(n!=ot){var r=null==n;Mn.forEach(((e,t)=>{var i=r||0==t||t==n;e._focus=r?null:i,function(n,r){!function(n,r){Mn[n].alpha=r,te.show&&xe[n]&&(xe[n].style.opacity=r),fr&&vr[n]&&(vr[n][0].parentNode.style.opacity=r)}(n,r)}(t,i?1:ge.alpha)})),ot=n,Qe()}}(n),null!=r.show&&(t.show=r.show,function(n){var r=fr?vr[n][0].parentNode:null;Mn[n].show?r&&dn(r,sn):(r&&hn(r,sn),xe.length>1&&wn(xe[n],-10,-10,Nr,Lr))}(n),ct(t.scale,null,null),Qe()),Wt("setSeries",n,r),e&&Ct.pub("setSeries",a,n,r)}a.setSelect=ft,a.setSeries=vt;var ht={focus:!0},dt={focus:!1};function mt(n,r){var e=zn[r],t=Nr;1==e.ori&&(n=(t=Lr)-n),-1==e.dir&&(n=t-n);var i=e._min,l=i+n/t*(e._max-i),a=e.distr;return 3==a?b(10,l):4==a?((n,r)=>(void 0===r&&(r=1),v.sinh(n/r)))(l,e.asinh):l}function pt(n,r){mn(ut,Z,st.left=n),mn(ut,R,st.width=r)}function gt(n,r){mn(ut,J,st.top=n),mn(ut,U,st.height=r)}fr&&we&&bn(tn,Rn,(()=>{te._lock||(vt(null,dt,Yt.setSeries),bt())})),a.valToIdx=r=>n(r,e[0]),a.posToIdx=function(r){return n(mt(r,Dn),e[0],ze,Te)},a.posToVal=mt,a.valToPos=(n,r,e)=>0==zn[r].ori?f(n,zn[r],e?Ur:Nr,e?jr:0):c(n,zn[r],e?Jr:Lr,e?Rr:0),a.batch=function(n){n(a),Qe()},a.setCursor=n=>{Ze=n.left,Xe=n.top,bt()};var wt=0==Vn.ori?pt:gt,xt=1==Vn.ori?pt:gt;function bt(r,t){var i,l;Je=Ze,qe=Xe,i=te.move(a,Ze,Xe),Ze=i[0],Xe=i[1],te.show&&(Oe&&wn(Oe,p(Ze),0,Nr,Lr),je&&wn(je,0,p(Xe),Nr,Lr)),lt=S;var o=0==Vn.ori?Nr:Lr,s=1==Vn.ori?Nr:Lr;if(0>Ze||0==ye||ze>Te){l=null;for(var u=0;Mn.length>u;u++)if(u>0&&xe.length>1&&wn(xe[u],-10,-10,Nr,Lr),fr&&lr.live){if(0==u&&dr)continue;for(var f=0;vr[u].length>f;f++)vr[u][f].firstChild.nodeValue="--"}we&&vt(null,ht,Yt.setSeries)}else{var c=mt(0==Vn.ori?Ze:Xe,Dn);l=n(c,e[0],ze,Te);for(var v=A(Cn(e[0][l],Vn,o,0),.5),h=0;Mn.length>h;h++){var m=Mn[h],g=te.dataIdx(a,h,l,c),x=g==l?v:A(Cn(e[0][g],Vn,o,0),.5);if(h>0&&m.show){var b=e[h][g],_=null==b?-10:A(Hn(b,zn[m.scale],s,0),.5);if(_>0){var k=d(_-Xe);k>lt||(lt=k,at=h)}var M=void 0,z=void 0;0==Vn.ori?(M=x,z=_):(M=_,z=x),xe.length>1&&wn(xe[h],M,z,Nr,Lr)}if(fr&&lr.live){if(g==te.idx&&!ne||0==h&&dr)continue;var T=0==h&&2==On?Ee:e[h],D=dr?m.values(a,h,g):{_:m.value(a,T[g],h,g)},E=0;for(var P in D)vr[h][E++].firstChild.nodeValue=D[P]}}ne=!1}if(st.show&&rt)if(null!=t){var W=Yt.scales,Y=W[0],C=W[1],H=t.cursor.drag;tt=H._x,it=H._y;var F,N,I,L,V,O=t.select,j=O.left,G=O.top,B=O.width,R=O.height,U=t.scales[Y].ori,J=t.posToVal;Y&&(0==U?(F=j,N=B):(F=G,N=R),I=zn[Y],L=Cn(J(F,Y),I,o,0),V=Cn(J(F+N,Y),I,o,0),wt(w(L,V),d(V-L)),C||xt(0,s)),C&&(1==U?(F=j,N=B):(F=G,N=R),I=zn[C],L=Hn(J(F,C),I,s,0),V=Hn(J(F+N,C),I,s,0),xt(w(L,V),d(V-L)),Y||wt(0,o))}else{var q=d(Je-Ge),Z=d(qe-Be);if(1==Vn.ori){var X=q;q=Z,Z=X}tt=et.x&&q>=et.dist,it=et.y&&Z>=et.dist;var K,Q,nn=et.uni;null!=nn?tt&&it&&(it=Z>=nn,(tt=q>=nn)||it||(Z>q?it=!0:tt=!0)):et.x&&et.y&&(tt||it)&&(tt=it=!0),tt&&(0==Vn.ori?(K=Re,Q=Ze):(K=Ue,Q=Xe),wt(w(K,Q),d(Q-K)),it||xt(0,s)),it&&(1==Vn.ori?(K=Re,Q=Ze):(K=Ue,Q=Xe),xt(w(K,Q),d(Q-K)),tt||wt(0,o)),tt||it||(wt(0,0),xt(0,0))}if(te.idx=l,te.left=Ze,te.top=Xe,et._x=tt,et._y=it,null!=r&&(Ct.pub($,a,Ze,Xe,o,s,l),we)){var rn=Yt.setSeries,en=ge.prox;null==ot?lt>en||vt(at,ht,rn):lt>en?vt(null,ht,rn):at!=ot&&vt(at,ht,rn)}y&&Wt("setCursor")}var _t=null;function kt(){_t=xn.getBoundingClientRect()}function yt(n,r,e,t,i,l){te._lock||(Mt(n,r,e,t,i,l,0,!1,null!=n),null!=n?bt(1):bt(null,r))}function Mt(n,r,e,t,i,l,o,s,u){var f;if(null!=n)e=n.clientX-_t.left,t=n.clientY-_t.top;else{if(0>e||0>t)return Ze=-10,void(Xe=-10);var c=Nr,v=Lr,h=i,d=l,m=e,p=t;1==Vn.ori&&(c=Lr,v=Nr);var g=Yt.scales,w=g[0],x=g[1];if(1==r.scales[w].ori&&(h=l,d=i,m=t,p=e),e=null!=w?_(r.posToVal(m,w),zn[w],c,0):c*(m/h),t=null!=x?_(r.posToVal(p,x),zn[x],v,0):v*(p/d),1==Vn.ori){var b=e;e=t,t=b}}u&&(e>1&&Nr-1>e||(e=z(e,Nr)),t>1&&Lr-1>t||(t=z(t,Lr))),s?(Ge=e,Be=t,f=te.move(a,e,t),Re=f[0],Ue=f[1]):(Ze=e,Xe=t)}function St(){ft({width:0,height:0},!1)}function zt(n,r,e,t,i,l){rt=!0,tt=it=et._x=et._y=!1,Mt(n,r,e,t,i,l,0,!0,!1),null!=n&&(Sr(rn,fn,Tt),Ct.pub(nn,a,Re,Ue,Nr,Lr,null))}function Tt(n,r,e,t,i,l){rt=et._x=et._y=!1,Mt(n,r,e,t,i,l,0,!1,!0);var o=st.left,s=st.top,u=st.width,f=st.height,c=u>0||f>0;if(c&&ft(st),et.setScale&&c){var v=o,h=u,d=s,m=f;if(1==Vn.ori&&(v=s,h=f,d=o,m=u),tt&&ct(Dn,mt(v,Dn),mt(v+h,Dn)),it)for(var p in zn){var g=zn[p];p!=Dn&&null==g.from&&g.min!=S&&ct(p,mt(d+m,p),mt(d,p))}St()}else te.lock&&(te._lock=!te._lock,te._lock||bt());null!=n&&(function(n,r){var e=Mr.get(r)||{};_n(n,r,e[n]),e[n]=null}(rn,fn),Ct.pub(rn,a,Ze,Xe,Nr,Lr,null))}function Dt(n){We(),St(),null!=n&&Ct.pub(ln,a,Ze,Xe,Nr,Lr,null)}var Et,Pt={};Pt.mousedown=zt,Pt.mousemove=yt,Pt.mouseup=Tt,Pt.dblclick=Dt,Pt.setSeries=(n,r,e,t)=>{vt(e,t)},te.show&&(Sr(nn,xn,zt),Sr($,xn,yt),Sr(en,xn,kt),Sr(tn,xn,(function(){if(!te._lock){var n=rt;if(rt){var r,e,t=!0,i=!0;0==Vn.ori?(r=tt,e=it):(r=it,e=tt),r&&e&&(t=10>=Ze||Ze>=Nr-10,i=10>=Xe||Xe>=Lr-10),r&&t&&(Ze=Re>Ze?0:Nr),e&&i&&(Xe=Ue>Xe?0:Lr),bt(1),rt=!1}Ze=-10,Xe=-10,bt(1),n&&(rt=n)}})),Sr(ln,xn,Dt),Et=function(n){var r=null;function e(){r=null,n()}return function(){clearTimeout(r),r=setTimeout(e,100)}}(kt),bn(an,cn,Et),bn(on,cn,Et),a.syncRect=kt);var At=a.hooks=r.hooks||{};function Wt(n,r,e){n in At&&At[n].forEach((n=>{n.call(null,a,r,e)}))}(r.plugins||[]).forEach((n=>{for(var r in n.hooks)At[r]=(At[r]||[]).concat(n.hooks[r])}));var Yt=j({key:null,setSeries:!1,scales:[Dn,null]},te.sync),Ct=Ir(Yt.key);function Ht(){Wt("init",r,e),Ae(e||r.data,!1),jn[Dn]?nt(Dn,jn[Dn]):We(),re(r.width,r.height),ft(st,!1)}return Ct.sub(a),a.pub=function(n,r,e,t,i,l,a){Pt[n](null,r,e,t,i,l,a)},a.destroy=function(){Ct.unsub(a),_n(an,cn,Et),_n(on,cn,Et),W.remove(),Wt("destroy")},t?t instanceof HTMLElement?(t.appendChild(W),Ht()):t(a,Ht):Ht(),a}pe.assign=j,pe.fmtNum=c,pe.rangeNum=s,pe.rangeLog=i,pe.rangeAsinh=l,pe.orient=Lr,pe.join=function(n,r){for(var e=new Set,t=0;n.length>t;t++)for(var i=n[t][0],l=i.length,a=0;l>a;a++)e.add(i[a]);for(var o=[Array.from(e).sort(((n,r)=>n-r))],s=o[0].length,u=new Map,f=0;s>f;f++)u.set(o[0][f],f);for(var c=0;n.length>c;c++)for(var v=n[c],h=v[0],d=1;v.length>d;d++){for(var m=v[d],p=Array(s).fill(void 0),g=r?r[c][d]:1,w=[],x=0;m.length>x;x++){var b=m[x],_=u.get(h[x]);null==b?0!=g&&(p[_]=b,2==g&&w.push(_)):p[_]=b}G(p,w,s),o.push(p)}return o},pe.fmtDate=Pn,pe.tzDate=function(n,r){var e;return"Etc/UTC"==r?e=new Date(+n+6e4*n.getTimezoneOffset()):r==An?e=n:(e=new Date(n.toLocaleString("en-US",{timeZone:r}))).setMilliseconds(n.getMilliseconds()),e},pe.sync=Ir,pe.addGap=jr,pe.clipGaps=Or;var ge=pe.paths={};return ge.linear=ee,ge.spline=function(){return(n,e,t,i)=>Lr(n,e,((l,a,o,s,u,f,c,v,h,d,m)=>{var g,w,x;0==s.ori?(g=Gr,x=Rr,w=Kr):(g=Br,x=Ur,w=Qr);var b=1*s.dir*(0==s.ori?1:-1);t=r(o,t,i,1),i=r(o,t,i,-1);for(var _=[],k=!1,y=p(f(a[1==b?t:i],s,d,v)),M=y,S=[],z=[],T=1==b?t:i;T>=t&&i>=T;T+=b){var D=o[T],E=f(a[T],s,d,v);null!=D?(k&&(jr(_,M,E),k=!1),S.push(M=E),z.push(c(o[T],u,m,h))):null===D&&(jr(_,M,E),k=!0)}var P={stroke:te(S,z,.5,g,w),fill:null,clip:null,band:null},A=P.stroke;if(null!=l.fill){var W=P.fill=new Path2D(A),Y=l.fillTo(n,e,l.min,l.max),C=p(c(Y,u,m,h));x(W,M,C),x(W,y,C)}return l.spanGaps||(P.clip=Or(_,s.ori,v,h,d,m)),n.bands.length>0&&(P.band=Vr(n,e,t,i,A)),P}))},ge.stepped=function(n){var e=u(n.align,1);return(n,t,i,l)=>Lr(n,t,((a,o,s,u,f,c,v,h,d,m,g)=>{var w=0==u.ori?Rr:Ur,x={stroke:new Path2D,fill:null,clip:null,band:null},b=x.stroke,_=1*u.dir*(0==u.ori?1:-1);i=r(s,i,l,1),l=r(s,i,l,-1);var k=[],y=!1,M=p(v(s[1==_?i:l],f,g,d)),S=p(c(o[1==_?i:l],u,m,h)),z=S;w(b,S,M);for(var T=1==_?i:l;T>=i&&l>=T;T+=_){var D=s[T],E=p(c(o[T],u,m,h));if(null!=D){var P=p(v(D,f,g,d));if(y){if(jr(k,z,E),M!=P){var A=a.width*vn/2,W=k[k.length-1];W[0]+=A,W[1]-=A}y=!1}1==e?w(b,E,M):w(b,z,P),w(b,E,P),M=P,z=E}else null===D&&(jr(k,z,E),y=!0)}if(null!=a.fill){var Y=x.fill=new Path2D(b),C=a.fillTo(n,t,a.min,a.max),H=p(v(C,f,g,d));w(Y,z,H),w(Y,S,H)}return a.spanGaps||(x.clip=Or(k,u.ori,h,d,m,g)),n.bands.length>0&&(x.band=Vr(n,t,i,l,b)),x}))},ge.bars=function(n){var e=u((n=n||N).size,[.6,S]),t=n.align||0,i=1-e[0],l=u(e[1],S)*vn;return(n,e,a,o)=>Lr(n,e,((s,u,f,c,v,h,d,m,g,b,_)=>{var k,y=0==c.ori?Jr:qr,M=h(u[1],c,b,m)-h(u[0],c,b,m),S=M*i,T=d(s.fillTo(n,e,s.min,s.max),v,_,g),D=p(s.width*vn),E=p(w(l,M-S)-D),P=1==t?0:-1==t?E:E/2,A={stroke:new Path2D,fill:null,clip:null,band:null},W=n.bands.length>0;W&&(A.band=new Path2D,k=z(d(v.max,v,_,g),.5));for(var Y=A.stroke,C=A.band,H=c.dir*(0==c.ori?1:-1),F=1==H?a:o;F>=a&&o>=F;F+=H){var N=f[F];if(null==N){if(!W)continue;var I=r(f,1==H?a:o,F,-H),L=r(f,F,1==H?o:a,H),V=f[I];N=V+(F-I)/(L-I)*(f[L]-V)}var O=h(2==c.distr?F:u[F],c,b,m),j=d(N,v,_,g),G=p(O-P),B=p(x(j,T)),R=p(w(j,T)),U=B-R;null!=f[F]&&y(Y,G,R,E,U),W&&(B=R,y(C,G,R=k,E,U=B-R))}return null!=s.fill&&(A.fill=new Path2D(Y)),A}))},pe}();
|