mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-12-18 12:49:16 +01:00
1 line
No EOL
84 KiB
JavaScript
1 line
No EOL
84 KiB
JavaScript
window.Graph={render:function(t,C){var b=document.createElement("div");b.className="tchart--wrapper";t.appendChild(b);return new this.units.TChart({container:b,data:C})},units:{}};(function(){var t=function(b,a,c,e){return{linear:function(d,f,g,h){return g*d/h+f},easeInOutQuad:function(d,f,g,h){d/=.5*h;if(1>d)return.5*g*d*d+f;d--;return-g/2*(d*(d-2)-1)+f}}[e](c,b,a-b,1)},C=function(b){this.composer=b.composer;this.state=b.state;this.queue={};this.queueSize=0;this.step=this.step.bind(this)};C.prototype={add:function(b){for(var a=0,c=+new Date,e,d,f,g=this.queue;a<b.length;){d=b[a];e=g[d.prop];if(!e){if(d.end==d.state[d.prop]){d.cbEnd&&d.cbEnd(d.state);a++;continue}e={lastStart:1};g[d.prop]=e;this.queueSize++}f=c-e.lastStart;d.duration*=this.state.speed;d.delay*=this.state.speed;e.cbEnd=d.cbEnd;e.state=d.state;e.lastStart=c;e.start=d.state[d.prop];e.end=d.end;e.startDt=c+(d.delay||0);e.endDt=e.startDt+(d.duration||0)-(d.fixed?0:Math.max(d.duration-f,0));e.tween=d.tween||"easeInOutQuad";e.speed=d.speed;e.group=d.group;a++}this.animFrame||(this.animFrame=requestAnimationFrame(this.step))},get:function(b){return this.queue[b]},step:function(){var b=[],a=+new Date,c,e={top:!1,bottom:!1};for(c in this.queue){var d=this.queue[c];var f=a;var g=d.endDt-d.startDt;var h=d.state[c];var k=f<d.startDt;f<d.startDt?f=d.startDt:f>d.endDt&&(f=d.endDt);f=g?(f-d.startDt)/g:k?0:1;f=1>f?"exp"==d.tween?h+(d.end-h)*d.speed:t(d.start,d.end,f,d.tween):d.end;f!=h?(d.state[c]=f,e.top=e.top||d.group.top,e.bottom=e.bottom||d.group.bottom):f==d.end&&b.push(c)}for(a=0;a<b.length;)this.queue[b[a]].cbEnd&&this.queue[b[a]].cbEnd(this.queue[b[a]].state),delete this.queue[b[a]],a++;this.queueSize-=b.length;this.composer.render(e);this.queueSize?this.animFrame=requestAnimationFrame(this.step):delete this.animFrame}};window.Graph.units.TAnimator=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;b.additional.mini&&(this.$canvas=document.createElement("canvas"),this.ctx=this.$canvas.getContext("2d",{alpha:!0}))};C.prototype={onResize:function(){if(this.opts.additional.mini){var b=this.opts.settings.dpi,a=this.opts.additional.mini?this.opts.state.dims.mini:this.opts.state.dims.graph;this.$canvas.width=a.w*b;this.$canvas.height=a.h*b;this.cached=""}},setDarkMode:function(b){this.isDarkMode=b},render:function(){var b,a,c=this.opts,e=c.data.ys,d=c.state,f=c.additional.mini,g=f?d.xg1:d.x1,h=f?d.xg2:d.x2,k=c.settings,m=k["PADD"+(f?"_MINI_AREA":"")][0],w=k["PADD"+(f?"_MINI_AREA":"")][1],r=k["PADD"+(f?"_MINI_AREA":"")][2],q=k["PADD"+(f?"_MINI_AREA":"")][3],n=c.data.x,p=c.settings.dpi,l=f?this.ctx:this.opts.ctx,u=[],B=[],D=f?d.dims.mini:d.dims.graph,E=void 0==d.zoomMorph?0:d.zoomMorph,F=E,G=e.length;if(f){var I=[D.w,D.h,d.xg1,d.xg2,this.isDarkMode,d.zoomMode,E];for(b=0;b<G;b++)I.push(d["om_"+b]),I.push(d["f_"+b]);I=I.join(",");if(I==this.cached){this.opts.ctx.drawImage(this.$canvas,D.l*p,D.t*p);return}this.cached=I}var z=(D.w-w-q)/(h-g);var x=Math.floor(t.TUtils.getXIndex(n,g-q/z));var y=Math.ceil(t.TUtils.getXIndex(n,h+w/z));z*=p;var A=(q+(f?0:D.l))*p-g*z;hBottom=(D.h-r+(f?0:D.t))*p;var Q=[],R=[],P=0,N=0,S=0,O=!1;for(b=0;b<G;b++){var H=f?d["om_"+b]:d["o_"+b];O=O||1>d["f_"+b];1>H&&0<H&&(P=H);0<H&&(Q.push(b),R.push(H),1==H&&d["e_"+b]&&(N++,S=Q.length-1))}var W=Q.length;P=1==N?P:1;var Z=t.TUtils.simplifyData("line",n,e,z,A,Q,x,y,D.w-w-q);x=Z.xInd1;y=Z.xInd2;var J=Z.x,ka=Z.ys,la=!1;for(a=x;a<=y;a++){u[a]=0;for(b=B[a]=0;b<W;b++)B[a]+=(ka[Q[b]].y[a]||0)*R[b];0==B[a]&&(la=!0)}if(la||O)l.fillStyle=this.isDarkMode?"#242f3e":"#fff",l.fillRect(0,0,D.w*p,D.h*p);if(0<E&&!f){1==F&&(this.savedX1=g,this.savedX2=h);if(1>F){var Qa=this.opts.animator.get("x1"),Ra=this.opts.animator.get("x2");x1End=Qa?Qa.end:this.opts.state.x1;x2End=Ra?Ra.end:this.opts.state.x2;var Aa=t.TUtils.getXIndex(n,-1==this.opts.state.zoomDir?this.savedX1:x1End,!0),ua=t.TUtils.getXIndex(n,-1==this.opts.state.zoomDir?this.savedX2:x2End,!0)}else Aa=t.TUtils.getXIndex(n,g,!0),ua=t.TUtils.getXIndex(n,h,!0);ua--;var eb=Math.floor(Aa),Sa=Math.ceil(Aa),Ta=Math.floor(ua),fb=Math.ceil(ua),Ba=0,aa=[];for(b=0;b<W;b++){aa[b]=0;var Ha=e[Q[b]].y;for(a=Sa;a<=Ta;a++){var ha=(Ha[a]||0)*R[b];aa[b]+=ha;Ba+=ha}ha=(Sa-Aa)*(Ha[eb]||0)*R[b];aa[b]+=ha;Ba+=ha;ha=(ua-Ta)*(Ha[fb]||0)*R[b];aa[b]+=ha;Ba+=ha}var Ua=1==this.opts.state.zoomDir?Math.pow(Math.min(Math.max(.85>F?(F-.65)/.2:1-(F-.9)/.15,0),1),.8):this.prevElastic,va=2*Math.PI-Math.PI/(7-F)-Math.PI/8*Ua,gb=va;1==this.opts.state.zoomDir?(F=Math.min(Math.max((F-.25)/.4,0),1),this.prevElastic=Ua):F=Math.min(Math.max(2.4*F-1.4,0),1);var L=[],X=k.PIE_RADIUS*(1>E?2.31:1)*p,T=p*(D.w/2+D.l),ma=p*(D.h/2+D.t+2),Va=2*Math.PI*X/p,hb=1/13;for(b=0;b<W;b++){var ba=aa[b]/Ba;ba=ba||0;var Wa=2*Math.PI*ba,Ia=va-Wa,ib=Math.round(ba*Va*hb);b==W-1&&(Ia=gb-2*Math.PI);var Ja=.2*Math.PI/Va,Ka=e[Q[b]];L.push({st:va+Ja,ed:Ia-Ja,mid:va-Wa/2-Ja/2,additionalPoints:Math.max(ib,4),percentage:0==ba?0:Math.max(Math.round(100*ba),1),percentageText:0==ba?"":.01>ba?"<1%":Math.round(100*ba)+"%",ind:Q[b],value:aa[b],label:Ka.label,color:this.isDarkMode?Ka.colors_n[2]:Ka.colors_d[2]});va=Ia}d.pieAngles=L}var na=p*(D.h-m-r+(f?0:-4));var wa=(D.h-r+(f?0:D.t))*p;var K=0;for(b=0;b<G;b++)if(H=f?d["om_"+b]:d["o_"+b],0<H){var xa=ka[b].y;var ya=H*na;l.fillStyle=this.isDarkMode?e[b].colors_n[0]:e[b].colors_d[0];l.globalAlpha=.9*d["f_"+b]+.1;l.beginPath();if(0!=E&&f){var Xa=this.opts.data.mainPeriodLen*z;l.moveTo(J[y]*z+Xa+A,hBottom-u[y]);if(0<b)for(l.lineTo(J[y]*z+A,hBottom-u[y]),a=y;a>=x+1;a--)l.lineTo(J[a]*z+A,hBottom-(u[a]+F*(u[a-1]-u[a]))),l.lineTo(J[a-1]*z+A,hBottom-u[a-1]);else l.lineTo(J[x]*z+A,hBottom);if(K<W-1)for(a=x;a<=y-1;a++){ca=wa-(xa[a]*ya/B[a]||0);V=hBottom-ca;a==x&&l.lineTo(J[x]*z+A,hBottom-u[x]-V);ca=wa-(xa[a+1]*ya/B[a+1]||0);var La=hBottom-ca,Ma=u[a+1]+La;l.lineTo(J[a+1]*z+A,hBottom-(Ma+F*(u[a]+V-Ma)));l.lineTo(J[a+1]*z+A,hBottom-Ma);a==y-1&&l.lineTo(J[y]*z+Xa+A,hBottom-u[y]-La);u[a]+=V}else l.lineTo(J[x]*z+A<<0,hBottom-na<<0),l.lineTo(J[y]*z+A<<0,hBottom-na<<0);u[y]+=La}else if(0==E){if(0<b)for(l.moveTo(J[y]*z+A<<0,hBottom-u[y]<<0),a=y-1;a>=x;a--)l.lineTo(J[a]*z+A<<0,hBottom-u[a]<<0);else l.moveTo(J[y]*z+A<<0,hBottom<<0),l.lineTo(J[x]*z+A<<0,hBottom<<0);if(K<W-1||la)for(a=x;a<=y;a++){var ca=wa-(xa[a]*ya/B[a]||0),V=hBottom-ca,ia=u[a]+V;ia>na&&(ia=na);l.lineTo(J[a]*z+A<<0,hBottom-ia<<0);u[a]+=V}else l.lineTo(J[x]*z+A<<0,hBottom-na<<0),l.lineTo(J[y]*z+A<<0,hBottom-na<<0)}else{var Y=function(pa,Na,ja,qa){var Ya=0,Za=0;da&&1<N&&(Ya=Math.cos(L[K].mid)*da*8*p,Za=-Math.sin(L[K].mid)*da*8*p);qa>X&&(qa=X);var oa=Math.atan2(ma-Na,pa-T);oa=0>oa?2*Math.PI+oa:oa;pa=Math.pow((ma-Na)*(ma-Na)+(pa-T)*(pa-T),.5);Math.abs(ja-oa)>Math.PI*(1==W?1.5:1)&&(ja-=2*Math.PI);ja<2*-Math.PI&&(ja-=2*-Math.PI);ja=oa+F*(ja-oa);qa=pa+F*(qa-pa);return[T+Math.cos(ja)*qa+Ya,ma-Math.sin(ja)*qa+Za]},ra=1>E?4:L[K].additionalPoints,Oa=!1,Ca=!1,da=d["pieInd_"+Q[K]]||0;0==L[K].percentage&&(l.globalAlpha=0);var M=Y(J[y]*z+A,hBottom-u[y],L[0].st,X);l.moveTo(M[0],M[1]);if(0<K)for(a=y-1;a>=x;a--){var U=J[a]*z+A;U==T&&(Oa=!0);if(U>=T){var ea=(U-T)/(D.w*p/2);0==F&&(ea=0);M=Y(U,hBottom-u[a],L[0].st,X*ea)}else{if(!Oa){Oa=!0;var Pa=(T-U)/(J[a+1]*z+A-U),fa=hBottom-u[a],za=hBottom-u[a+1];M=Y(T,fa+Pa*(za-fa),L[K].st,0);l.lineTo(M[0],M[1])}ea=(T-U)/(D.w*p/2);M=Y(U,hBottom-u[a],L[K].st,X*ea)}l.lineTo(M[0],M[1])}else M=Y(J[x]*z+A,hBottom,L[0].st,X),l.lineTo(M[0],M[1]);if(K<W-1){for(a=0;a<=ra;a++)ca=wa-(xa[x]*ya/B[x]||0),V=hBottom-ca,fa=hBottom-u[x],za=hBottom-u[x]-V,M=Y(J[x]*z+A,fa+a/ra*(za-fa),L[K].st+a/ra*(L[K].ed-L[K].st),X),l.lineTo(M[0],M[1]);for(a=x;a<=y;a++){ca=wa-(xa[a]*ya/B[a]||0);V=hBottom-ca;U=J[a]*z+A;U==T&&(Ca=!0);if(U<=T){ea=(T-U)/(D.w*p/2);var $a=U,ab=hBottom-u[a]-V;M=Y(U,ab,L[K].ed,X*ea)}else Ca||(Ca=!0,Pa=(T-$a)/(U-$a),fa=ab,za=hBottom-u[a]-V,M=Y(T,fa+Pa*(za-fa),L[K].ed,0),l.lineTo(M[0],M[1])),ea=(U-T)/(D.w*p/2),0==F&&(ea=0),M=Y(U,hBottom-u[a]-V,L[0].st,X*ea);l.lineTo(M[0],M[1]);u[a]+=V}U<T&&!Ca&&(M=Y(T,fa,L[K].ed,0),l.lineTo(M[0],M[1]))}else for(a=0;a<=ra;a++)M=Y((J[x]+a/ra*(J[y]-J[x]))*z+A,0,L[K].st+a/ra*(L[0].st-2*Math.PI-L[K].st),X),l.lineTo(M[0],M[1])}l.closePath();l.fill();if(!f&&0<E&&L[K].percentageText){var bb=Math.pow(F,1==this.opts.state.zoomDir?4:20)*H*(.9*d["f_"+b]+.1),sa=Math.max(Math.min(2*L[K].percentage,26),10),ta=k.PIE_RADIUS,Da=2*ta/3,Ea=Math.cos(L[K].mid),Fa=Math.sin(L[K].mid),cb=L[K].percentage<c.data.pieLabelsPercentages.outboard,Ga=0;ia=0;da&&1<N&&(Ga=Ea*da*8*p,ia=-Fa*da*8*p);l.fillStyle="white";l.textAlign="center";l.globalAlpha=bb;L[K].percentage<c.data.pieLabelsPercentages.hoverOnly&&(l.globalAlpha=da*bb);if(cb){sa=Math.max(sa,14);Da=ta+sa/3+13;l.fillStyle=this.isDarkMode?e[b].colors_n[0]:e[b].colors_d[0];l.lineWidth=1;l.strokeStyle=this.isDarkMode?e[b].colors_n[0]:e[b].colors_d[0];var jb=T+Ga+Ea*(ta-1)*p,kb=ma+ia-Fa*(ta-1)*p,lb=T+Ga+Ea*(ta+6*(1-da)-1)*p,mb=ma+ia-Fa*(ta+6*(1-da)-1)*p;l.beginPath();l.moveTo(jb,kb);l.lineTo(lb,mb);l.stroke()}var db=Ea*Da*(S==K?P:1),nb=T+Ga+db*p+(cb?sa/4*L[K].percentageText.length*db/Da*p:0),ob=ma+ia-Fa*Da*(S==K?P:1)*p;l.font="bold "+sa*p+"px "+c.settings.FONTS;l.fillText(L[K].percentageText,nb,ob+sa*p/2.9);l.globalAlpha=1}K++}l.globalAlpha=1;f&&this.opts.ctx.drawImage(this.$canvas,D.l*p,D.t*p)}};t.TAreas=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.ctx=b.ctx;this.items={};this.setAnimation(!1);this.deleteItem=this.deleteItem.bind(this)};C.prototype={onResize:function(){this.setAnimation(!1)},setDarkMode:function(b){this.isDarkMode=b},setAnimation:function(b){this.noAnimation=!b},hideItem:function(b,a){this.items[b].tp=2;this.opts.animator.add([{prop:"ox_"+b,state:this.items[b].state,end:0,duration:this.noAnimation?0:200*a,tween:"linear",group:{top:!0},cbEnd:this.deleteItem}])},deleteItem:function(b){delete this.items[b.ind]},render:function(b){var a=this.opts,c=a.settings.dpi,e=a.data.x,d=a.state,f=a.settings.PADD[1],g=a.settings.PADD[3],h=a.animator,k=this.opts.state.dims.axisX,m=this.opts.state.dims.dates,w=d.zoomMode,r=void 0==d.zoomMorph?0:d.zoomMorph,q=Math.floor(t.TUtils.getXIndex(e,d.x1)),n=Math.ceil(t.TUtils.getXIndex(e,d.x2)),p=q,l=n,u="bar"==a.graphStyle||"step"==a.graphStyle,B=9*(d.zoomMode&&a.data.details?a.data.details.maxXTickLength:a.data.maxXTickLength),D=u?this.opts.data.mainPeriodLen:0,E=u?this.opts.data.detailPeriodLen:0,F=D+(E-D)*r,G=(k.w-f-g)/Math.round((d.x2-d.x1+D)/this.opts.data.mainPeriodLen),I=(k.w-f-g)/Math.round((d.x2-d.x1+E)/this.opts.data.detailPeriodLen),z=G+(I-G)*r;E=Math.pow(2,Math.ceil(Math.log2(B/G)));I=Math.pow(2,Math.ceil(Math.log2(B/I)));D=(k.w-g-f)/(d.x2-d.x1+D*(1-r));1>E&&(E=1);1>I&&(I=1);this.ctx.font=11*c+"px "+a.settings.FONTS;this.ctx.textAlign="center";this.ctx.fillStyle=this.isDarkMode?this.opts.data.axis_n.x:this.opts.data.axis_d.x;var x=1/Math.pow(this.prevXStep?this.prevXStep>G?this.prevXStep/G:G/this.prevXStep:1,5);w&&1==r&&(x/=2);this.prevXStep=G;q=Math.max(q-Math.ceil((g+.5*B)/z),0);n=Math.min(n+Math.ceil((f+.5*B)/z),e.length-1);w&&(p=this.opts.animator.get("x1"),l=this.opts.animator.get("x2"),p=p?p.end:this.opts.state.x1,l=l?l.end:this.opts.state.x2,p=Math.floor(t.TUtils.getXIndex(e,p)),l=Math.floor(t.TUtils.getXIndex(e,l)));if(w)var y=Math.round((Math.min(e[this.opts.state.detailInd2],this.opts.state.xMainMax)-Math.max(e[this.opts.state.detailInd1],this.opts.state.xMainMin))/this.opts.data.mainPeriodLen)+(u?0:1);for(;q<=n;q++)u=0==q%E,G="m",w&&(q<this.opts.state.detailInd1?u=0==q%E&&1>r:q<=this.opts.state.detailInd2?(u=0==Math.max(q-this.opts.state.detailInd1,0)%I,G="d"):u=0==Math.max(q-(this.opts.state.detailInd2-this.opts.state.detailInd1+1-y),0)%E&&1>r),G=e[q]+G,z=this.items[G],u?z?2==z.tp&&(z.tp=1,h.add([{prop:"ox_"+G,state:z.state,end:1,duration:this.noAnimation?0:200*x,tween:"linear",group:{top:!0}}])):(z={tp:1,xi:e[q],i:q,state:{ind:G}},z.state["ox_"+G]=0,this.items[G]=z,h.add([{prop:"ox_"+G,state:z.state,end:1,duration:this.noAnimation?0:200*x,tween:"linear",group:{top:!0}}])):z&&1==z.tp&&this.hideItem(G,x),z&&0<z.state["ox_"+G]&&(u=(z.xi-d.x1+F/2)*D+g,this.ctx.globalAlpha=z.state["ox_"+G]*b,u+B/2>=k.l&&u-B/2<=k.l+k.w&&this.ctx.fillText(a.data.datesShort[q],(u+k.l)*c,(k.t+9)*c));for(q in this.items)z=this.items[q],1==z.tp&&(z.xi<d.x1-g/D||z.xi>d.x2+f/D)&&this.hideItem(q,x);this.ctx.globalAlpha=1;w&&1==r&&l--;l<p&&(l=p);b=a.data.datesRange[p]==a.data.datesRange[l]?a.data.datesRange[p]:a.data.datesRange[p]+" \u2013 "+a.data.datesRange[l];e=13;375>k.w&&(e=11);this.ctx.font="bold "+e*c+"px "+a.settings.FONTS;this.ctx.textAlign="right";this.ctx.fillStyle=this.isDarkMode?"#fff":"#000";this.ctx.fillText(b,(m.l+m.w)*c,(m.t+m.h-7)*c)}};t.TAxisX=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.ctx=b.ctx;this.uuid=1;this.items={};this.setAnimation(!1);this.setForceUpdate(!1);this.deleteItem=this.deleteItem.bind(this)};C.prototype={onResize:function(){this.setAnimation(!1);this.setForceUpdate(!1)},setDarkMode:function(b){this.isDarkMode=b},setAnimation:function(b){this.noAnimation=!b},setForceUpdate:function(b){this.forceUpdate=b},deleteItem:function(b){delete this.items[b.id]},render:function(b){if(this.opts.pairY){var a=this.calcAxisData("y1_0","y2_0");var c=this.calcAxisData("y1_1","y2_1");c.needAnimation&&!a.needAnimation||1>this.opts.state.o_0?this.updateAxisState("y1_1","y2_1","numRight",c,a,c):this.updateAxisState("y1_0","y2_0","numLeft",a,a,c)}else a=this.calcAxisData("y1","y2"),this.updateAxisState("y1","y2","numLeft",a,a,a);this.renderState(b)},calcAxisData:function(b,a){var c=this.opts.state,e=this.opts.settings.PADD[0],d=this.opts.settings.PADD[2],f=!1,g=this.opts.animator.get(b),h=this.opts.animator.get(a);g=g?g.end:c[b];h=h?h.end:c[a];var k=Math.round((h-g)/this.opts.settings.Y_AXIS_RANGE),m=c[a]>h?c[a]/h:h/c[a],w=(this.opts.state.dims.axisYLines.h-e-d)/(c[a]-c[b]);e=(this.opts.state.dims.axisYLines.h-e-d)/(h-g);if(1.05<(c[b]>g?c[b]/g:g/c[b])||1.05<m||this.forceUpdate)f=!0;f=this.items[0]&&f&&!this.noAnimation&&!this.animationInProgress;return{needAnimation:f,y1:g,y2:h,yRealStep:k,yRealStart:g,yScaleCur:w,yScaleEnd:e}},updateAxisState:function(b,a,c,e,d,f){a=this.opts;var g=a.state,h=a.settings.PADD[2],k=a.animator,m=Math.floor(a.settings.Y_AXIS_RANGE),w=!1,r=this.opts.state.dims.axisYLines;e.needAnimation&&(this.animationInProgress=!0);for(var q=0;q<=m;q++){var n=e.yRealStart+Math.round(e.yRealStep*q);var p=d.yRealStart+Math.round(d.yRealStep*q),l=f.yRealStart+Math.round(f.yRealStep*q),u=t.TUtils.getFormatter("yTickFormatter",a.data,g.zoomMorph),B=u(p,d.yRealStep);u=u(Math.max(l,0),f.yRealStep,!0);if(e.needAnimation){var D=r.t+r.h-h-(n-e.y1)*e.yScaleEnd,E=r.t+r.h-h-(this.items[q][c]-e.y1)*e.yScaleEnd,F=r.t+r.h-h-(n-g[b])*e.yScaleCur,G=r.t+r.h-h-(n-e.y1)*e.yScaleEnd;1>Math.abs(E-G)?this.items[q]={numLeft:p,strLeft:B,numRight:l,strRight:u,y:G}:(w=!0,this.uuid++,n={animated:!0,strLeft:this.items[q].strLeft,strRight:this.items[q].strRight,oProp:"oyt_"+this.uuid,yProp:"yyt_"+this.uuid,state:{id:"t_"+this.uuid}},n.state[n.oProp]=1,n.state[n.yProp]=D,this.items[n.state.id]=n,k.add([{prop:n.oProp,state:n.state,end:0,duration:this.noAnimation?0:200,tween:"linear",group:{top:!0}},{prop:n.yProp,state:n.state,end:E,duration:this.noAnimation?0:this.forceUpdate?333:500,fixed:!this.forceUpdate,tween:this.forceUpdate?null:"exp",speed:.18,group:{top:!0},cbEnd:this.deleteItem}]),delete this.items[q],this.uuid++,n={animated:!0,strLeft:B,strRight:u,oProp:"oy_"+q,yProp:"yy_"+q,state:{id:q,numLeft:p,strLeft:B,numRight:l,strRight:u}},n.state[n.oProp]=0,n.state[n.yProp]=F,this.items[n.state.id]=n,k.add([{prop:n.oProp,state:n.state,end:1,duration:this.noAnimation?0:200,tween:"linear",group:{top:!0}},{prop:n.yProp,state:n.state,end:G,duration:this.noAnimation?0:this.forceUpdate?333:500,fixed:!this.forceUpdate,tween:this.forceUpdate?null:"exp",speed:.18,group:{top:!0},cbEnd:function(I){this.items[I.id]={numLeft:I.numLeft,strLeft:I.strLeft,numRight:I.numRight,strRight:I.strRight,y:I["yy_"+I.id]};clearTimeout(this.animationEndTimeout);this.animationEndTimeout=setTimeout(function(){this.animationInProgress=!1}.bind(this),30)}.bind(this)}]))}else this.items[q]&&this.items[q].animated?(this.items[q].numLeft=p,this.items[q].strLeft=B,this.items[q].numRight=l,this.items[q].strRight=u,this.items[q].state.numLeft=p,this.items[q].state.strLeft=B,this.items[q].state.numRight=l,this.items[q].state.strRight=u):this.items[q]={numLeft:p,strLeft:B,numRight:l,strRight:u,y:r.t+r.h-h-(n-e.y1)*e.yScaleEnd}}e.needAnimation&&!w&&(this.animationInProgress=!1);this.forceUpdate=!1},renderState:function(b){var a=this.opts.settings.dpi,c,e=this.opts.state.dims.axisYLeft,d=this.opts.state.dims.axisYRight,f=this.opts.state.dims.axisYLines,g=this.opts.data.ys;this.ctx.font=11*a+"px "+this.opts.settings.FONTS;this.ctx.strokeStyle=this.isDarkMode?"rgba(255, 255, 255, 0.1)":"rgba(24, 45, 59, 0.1)";this.ctx.lineWidth=1*a;this.ctx.lineCap="square";this.ctx.lineJoin="square";for(c in this.items){var h=this.items[c];if(h.animated){var k=h.state[h.yProp];var m=h.state[h.oProp]}else k=h.y,m=1;0<=k-6&&k-16<=e.h&&(this.ctx.globalAlpha=m*(this.opts.pairY?this.opts.state.o_0:1)*b,this.ctx.textAlign="left",this.ctx.fillStyle=this.opts.pairY?this.isDarkMode?g[0].colors_n[1]:g[0].colors_d[1]:this.isDarkMode?this.opts.data.axis_n.y:this.opts.data.axis_d.y,this.ctx.fillText(h.strLeft,e.l*a,(k-7)*a),this.opts.pairY&&(this.ctx.globalAlpha=m*this.opts.state.o_1*b,this.ctx.textAlign="right",this.ctx.fillStyle=this.isDarkMode?g[1].colors_n[1]:g[1].colors_d[1],this.ctx.fillText(h.strRight,(d.l+d.w)*a,(k-7)*a)));k=(k<<0)-.5;0<=k&&k<=e.h&&(this.ctx.beginPath(),this.ctx.globalAlpha=m*b,this.ctx.moveTo(f.l*a,k*a),this.ctx.lineTo((f.l+f.w)*a,k*a),this.ctx.stroke())}this.ctx.globalAlpha=1}};t.TAxisY=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.filteredX1=[];this.filteredX2=[];this.filteredJ=[];this.prevY=[];this.$canvas=document.createElement("canvas");this.ctx=this.$canvas.getContext("2d",{alpha:!1})};C.prototype={onResize:function(){var b=this.opts.settings.dpi,a=this.opts.additional.mini?this.opts.state.dims.mini:this.opts.state.dims.graph;this.$canvas.width=a.w*b;this.$canvas.height=a.h*b;this.cached=""},setDarkMode:function(b){this.isDarkMode=b},render:function(){var b,a;var c=this.opts;var e=c.data.ys,d=c.state,f=c.additional.mini;var g=f?d.xg1:d.x1;var h=f?d.xg2:d.x2;var k=c.settings,m=k["PADD"+(f?"_MINI_BAR":"")][0],w=k["PADD"+(f?"_MINI_BAR":"")][1],r=k["PADD"+(f?"_MINI_BAR":"")][2],q=k["PADD"+(f?"_MINI_BAR":"")][3];k=c.data.x;var n=c.settings.dpi,p=this.ctx,l=f?d.dims.mini:d.dims.graph,u=d.zoomMode,B=d.detailInd1,D=d.detailInd2,E=void 0==d.zoomMorph?0:d.zoomMorph,F=this.filteredX1,G=this.filteredX2,I=this.filteredJ,z=this.prevY,x=e.length,y=[l.w,l.h,f?d.xg1:d.x1,f?d.xg2:d.x2,this.isDarkMode,u];f||(y.push(d.y1),y.push(d.y2));for(b=0;b<x;b++)y.push(f?d["om_"+b]:d["o_"+b]),y.push(d["f_"+b]);y=y.join(",");if(y==this.cached&&(this.opts.ctx.drawImage(this.$canvas,l.l*n,l.t*n),f))return;c=(l.w-w-q)/(h-g+this.opts.data.mainPeriodLen*(1-E));var A=Math.floor(t.TUtils.getXIndex(k,g-q/c));w=Math.ceil(t.TUtils.getXIndex(k,h+w/c));u&&1==E&&(A<this.opts.state.xg1Ind&&(A=this.opts.state.xg1Ind),w>this.opts.state.xg2Ind&&(w=this.opts.state.xg2Ind-1));c*=n;g=q*n-g*c;h=(l.h-r)*n;q=this.opts.data.mainPeriodLen*c;var Q=this.opts.data.detailPeriodLen*c;if(y!=this.cached){p.fillStyle=this.isDarkMode?"#242f3e":"#fff";p.fillRect(0,0,l.w*n,l.h*n);var R=0;for(a=A;a<=w;a++){var P=u?a>=B&&a<=D?Q:q:q;b=Math.round(k[a]*c+g);var N=Math.round(k[a]*c+g+P);0<N-b&&(F[R]=b,G[R]=N,I[R]=a,z[R]=0,R++)}for(b=0;b<x;b++)if(a=f?d["om_"+b]:d["o_"+b],0<a){N=e[b].y;P=e[b].yFrom;var S=f?d.y1m:d.y1;var O=f?d.y2m:d.y2;O=n*(l.h-m-r)/(O-S);S=(l.h-r)*n+S*O;O*=a;p.fillStyle=this.isDarkMode?e[b].colors_n[0]:e[b].colors_d[0];p.globalAlpha=.9*d["f_"+b]+.1;p.beginPath();p.moveTo(Math.round(k[w]*c+g+(1==E?Q:q)),Math.round(h));if(0<b)for(a=R-1;0<=a;a--){var H=h-z[a];p.lineTo(G[a],Math.round(H));p.lineTo(F[a],Math.round(H))}else p.lineTo(Math.round(k[A]*c+g),Math.round(h));for(a=0;a<R;a++)H=I[a],H=(H=u?H>=B&&H<=D?P[H]+E*(N[H]-P[H]):N[H]+E*(N[B]-N[H]):N[H])||0,H=S-H*O,z[a]+=h-H,p.lineTo(F[a],Math.round(h-z[a])),p.lineTo(G[a],Math.round(h-z[a]));p.closePath();p.fill()}p.globalAlpha=1;this.opts.ctx.drawImage(this.$canvas,l.l*n,l.t*n)}if(-1<d.barInd&&!f){this.opts.ctx.fillStyle=this.isDarkMode?"rgba(36, 47, 62, 0.5)":"rgba(255, 255, 255, 0.5)";this.opts.ctx.globalAlpha=d.barO;this.opts.ctx.fillRect(0,0,l.w*n,l.h*n);for(b=f=0;b<x;b++)a=d["o_"+b],0<a&&(N=e[b].y,P=e[b].yFrom,S=d.y1,O=d.y2,O=n*(l.h-m-r)/(O-S),S=(l.h-r)*n+S*O,O*=a,this.opts.ctx.fillStyle=this.isDarkMode?e[b].colors_n[0]:e[b].colors_d[0],this.opts.ctx.globalAlpha=.9*d["f_"+b]+.1,u?d.barInd>=B&&d.barInd<=D?(H=P[d.barInd]+E*(N[d.barInd]-P[d.barInd]),P=Q):(P=q,H=N[d.barInd]+E*(N[B]-N[d.barInd])):(H=N[d.barInd],P=q),H=H||0,A=h-(S-H*O)+f,this.opts.ctx.fillRect(Math.round(k[d.barInd]*c+g),Math.round(h-f+l.t*n),Math.max(Math.round(P),1),Math.round(f)-Math.round(A)),f=A);p.globalAlpha=1}this.cached=y}};t.TBars=C})();(function(){var t=window.Graph.units,C=function(b){this.state={};this.state.masterVisibility=1;this.state.slaveVisibility=0;this.specialZoomTransition=void 0;this.darkMode=!!document.documentElement.classList.contains("dark");var a=11>(!!window.ActiveXObject&&+/msie\s(\d+)/i.exec(navigator.userAgent)[1]||NaN),c=-1!=navigator.userAgent.indexOf("Trident/")&&(-1!=navigator.userAgent.indexOf("rv:")||-1!=navigator.appName.indexOf("Netscape"));this.settings={isIE:a||c,isEdge:/Edge\/\d./i.test(navigator.userAgent),dpi:Math.min(window.devicePixelRatio||1,2),Y_AXIS_RANGE:5.3,PADD:[20,16,20,16],PADD_MINI:[2,0,2,0],PADD_MINI_BAR:[0,0,0,0],PADD_MINI_AREA:[0,0,0,0],Y_LABELS_WIDTH:50,X_LABELS_HEIGHT:12,DATES_HEIGHT:18,DATES_WIDTH:300,MINI_GRAPH_HEIGHT:40,MINI_GRAPH_TOP:14,MINI_GRAPH_BOTTOM:2,FADE_HEIGHT:16,PIE_RADIUS:130,FONTS:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'};this.data={caption:b.data.title,detailsFunc:b.data.x_on_zoom,hasDetail:!!b.data.x_on_zoom,slave:b.slave,yTickFormatter:b.data.yTickFormatter,yTooltipFormatter:b.data.yTooltipFormatter,yMinStep:b.data.yMinStep,xTickFormatter:b.data.xTickFormatter,xTooltipFormatter:b.data.xTooltipFormatter,xRangeFormatter:b.data.xRangeFormatter,strokeWidth:b.data.strokeWidth||"auto",hidden:b.data.hidden||[],tooltipOnHover:!!b.data.tooltipOnHover,forceLegend:b.data.forceLegend,sideLegend:b.data.sideLegend||!1,pieZoomRange:b.data.pieZoomRange||6048E5,pieLabelsPercentages:{outboard:b.data.pieLabelsPercentages&&void 0!=b.data.pieLabelsPercentages.outboard?b.data.pieLabelsPercentages.outboard:5,hoverOnly:b.data.pieLabelsPercentages&&void 0!=b.data.pieLabelsPercentages.hoverOnly?b.data.pieLabelsPercentages.hoverOnly:2},subchart:{show:b.data.subchart&&void 0!=b.data.subchart.show?b.data.subchart.show:!0,defaultZoom:b.data.subchart&&b.data.subchart.defaultZoom}};b.data.y_scaled&&(this.pairY=!0);this.graphStyle="line";a=this.settings;b.data.columns.forEach(function(e,d){var f=e.shift(),g=b.data.types[f];if("x"===g){this.data.x=e;this.state.xCount=e.length;this.state.x1=e[.75*e.length<<0];this.state.x2=e[e.length-1];this.state.xg1=e[0];this.state.xg2=e[e.length-1];this.state.xg1Ind=0;this.state.xg2Ind=e.length-1;this.state.xMainMin=e[0];this.state.xMainMax=e[this.state.xg2Ind];this.state.xgMin=e[0];this.state.xgMax=e[this.state.xg2Ind];var h=this.getDefaultZoom({x1:this.state.x1,x2:this.state.x2,xg1:this.state.xg1,xg2:this.state.xg2,"default":this.data.subchart.defaultZoom});this.state.x1=h.x1;this.state.x2=h.x2;this.data.mainPeriodLen=this.data.x[1]-this.data.x[0];this.data.detailPeriodLen=this.data.mainPeriodLen;this.data.dates=[];this.data.datesShort=[];this.data.datesRange=[];var k=t.TUtils.getFormatter("xTooltipFormatter",this.data,0),m=t.TUtils.getFormatter("xTickFormatter",this.data,0),w=t.TUtils.getFormatter("xRangeFormatter",this.data,0),r=0;e.forEach(function(n,p){this.data.dates[p]=k(n,!1);this.data.datesShort[p]=m(n,!1);this.data.datesRange[p]=w(n,!1);this.data.datesShort[p].length>r&&(r=this.data.datesShort[p].length)}.bind(this));this.data.maxXTickLength=r}if("x"!==g){this.data.ys=this.data.ys||[];this.data.yIds=this.data.yIds||{};h=b.data.colors[f];this.data.ys.push({colors_d:[h,h,h],colors_n:[h,h,h],label:b.data.names[f],y:e,tp:g,id:f});"line"==g||"step"==g?(this.data.axis_d={x:"#8E8E93",y:"#8E8E93"},this.data.axis_n={x:"rgba(163,177,194,0.6)",y:"rgba(163,177,194,0.6)"}):(this.data.axis_d={x:"rgba(37,37,41,0.5)",y:"rgba(37,37,41,0.5)"},this.data.axis_n={x:"rgba(163,177,194,0.6)",y:"rgba(236,242,248,0.5)"});h=this.data.ys.length-1;var q=-1==this.data.hidden.indexOf(f);this.data.yIds[f]=h;this.state["e_"+h]=q;this.state["o_"+h]=q?1:0;this.state["om_"+h]=q?1:0;this.state["pieInd_"+h]=0;this.state["f_"+h]=1;this.graphStyle=g}}.bind(this));this.state.activeColumnsCount=this.data.ys.length;this.updateSpeed();"area"==this.graphStyle&&(a.Y_AXIS_RANGE=4.06,this.data.hasDetail=!0);a=this.reduceGlobalRange({});a.isReduced&&(this.state.x1=a.x1,this.state.x2=a.x2,this.state.xg1=a.xg1,this.state.xg2=a.xg2,this.state.xg1Ind=a.xg1Ind,this.state.xg2Ind=a.xg2Ind);this.onResize=this.onResize.bind(this);this.onSwitcherChange=this.onSwitcherChange.bind(this);this.onSwitcherEnter=this.onSwitcherEnter.bind(this);this.onSwitcherLeave=this.onSwitcherLeave.bind(this);this.onHandleMove=this.onHandleMove.bind(this);this.toggleZoom=this.toggleZoom.bind(this);this.createDOM(b.container);window.addEventListener("resize",this.onResize);document.addEventListener("darkmode",function(e){this.setDarkMode(!this.darkMode)}.bind(this),!1);document.addEventListener("chart-hide-tips",function(e){e.detail.except!=this&&this.tip.toggle(!1)}.bind(this),!1);this.opts=b;this.onResize();this.darkMode&&this.setDarkMode(this.darkMode);window.matchMedia("(-webkit-min-device-pixel-ratio: 1), (min-resolution: 96dpi)").addListener(this.onResize);window.matchMedia("(-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi)").addListener(this.onResize);window.matchMedia("(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)").addListener(this.onResize);window.matchMedia("(-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi)").addListener(this.onResize)};C.prototype={reduceGlobalRange:function(b){var a=void 0==b.x1?this.state.x1:b.x1,c=void 0==b.x2?this.state.x2:b.x2,e=void 0==b.xg1?this.state.xg1:b.xg1,d=void 0==b.xg2?this.state.xg2:b.xg2,f=b.useSaved?this.data.saved.x:this.data.x,g=Math.floor(t.TUtils.getXIndex(f,this.state.xgMin)),h=Math.ceil(t.TUtils.getXIndex(f,this.state.xgMax)),k=h,m=g,w=this.state.zoomMode?"bar"==this.graphStyle||"step"==this.graphStyle?1:2:0;"area"==this.graphStyle&&(w=0);this.data.ys.forEach(function(q,n){var p=b.useSaved?this.data.saved.y[n]:q.y;if(this.state["e_"+n])for(i=g;i<=h-w;i++)v=p[i],void 0!=v&&(k=Math.min(k,i),m=Math.max(m,i))}.bind(this));m+w==h&&(m=h-Math.max(w-1,0));if(k>=m)return{isReduced:!1};var r=f[k];f=f[m];if(e==r&&d==f)return{isReduced:!1};c>f?(a=f-(c-a),c=f,a<r&&(a=r)):a<r&&(c=r+(c-a),a=r,c>f&&(c=f));return{isReduced:!0,x1:a,x2:c,xg1:r,xg2:f,xg1Ind:k,xg2Ind:m}},getDefaultZoom:function(b){if(!b["default"])return{x1:b.x1,x2:b.x2};var a={};a.x1=b["default"][0];a.x2=b["default"][1];a.x1=Math.max(a.x1,b.xg1);a.x2=Math.min(a.x2,b.xg2);a.x1>=a.x2&&(a.x1=b.xg1,a.x2=b.xg2);return a},updateSpeed:function(b){var a=Math.max(1-.25*(this.state.deviceSpeed*this.state.activeColumnsCount*this.state.xCount*Math.pow((this.state.x2-this.state.x1)/(this.state.xMainMax-this.state.xMainMin),.5)/16.66<<0),0);a=Math.pow(a,.85);b=1;this.state.speed=void 0==b?a:b;return this.state.speed},getYMinMax:function(b,a,c,e,d){function f(x,y,A,Q){if(x==Number.MAX_VALUE)c?void 0==A?(x=E.y1m,y=E.y2m):(x=E["y1m_"+A],y=E["y2m_"+A]):void 0==A?(x=E.y1,y=E.y2):(x=E["y1_"+A],y=E["y2_"+A]);else if("bar"==this.graphStyle&&(x=0),x=Math.floor(x),y=Math.ceil(y),e){var R=t.TUtils.roundRange(x,y,D.Y_AXIS_RANGE,Q);x=R.yMin;y=R.yMax;Math.abs(x-y)<D.Y_AXIS_RANGE*r&&(y=x+Math.floor(D.Y_AXIS_RANGE*r))}.1>Math.abs(x-y)&&y++;return{min:x,max:y,range:R}}if("area"==this.graphStyle)return{min:0,max:102};var g=this.state.dims?this.state.dims.graph.w:this.getGraphWidth(this.data.sideLegend).width,h=Number.MAX_VALUE,k=-Number.MAX_VALUE;g=(a-b)/g;var m=t.TUtils.getXIndex(d?this.data.saved.x:this.data.x,b-g*this.settings.PADD[3]),w=t.TUtils.getXIndex(d?this.data.saved.x:this.data.x,a+g*this.settings.PADD[1]),r=this.data.yMinStep||1,q,n,p,l,u=[],B=[],D=this.settings,E=this.state;!d&&this.state.zoomMode?(m=Math.max(m,this.state.detailInd1),w=Math.min(w,this.state.detailInd2)):(m=Math.max(m,0),w=Math.min(w,this.data.x.length-1));var F=Math.floor(m),G=Math.ceil(m),I=Math.floor(w),z=Math.ceil(w);"line"!=this.graphStyle&&"step"!=this.graphStyle||this.data.ys.forEach(function(x,y){var A=d?this.data.saved.y[y]:x.y,Q="step"==this.graphStyle?F:G,R="step"==this.graphStyle?z:I;if(E["e_"+y]||0==y&&this.pairY){for(q=Q;q<=R;q++)n=A[q],void 0!==n&&(n<h&&(h=n),n>k&&(k=n));"line"==this.graphStyle&&(void 0!==A[F]&&void 0!==A[G]&&(p=A[F]+(m-F)*(A[G]-A[F]),p<h&&(h=p),p>k&&(k=p)),void 0!==A[I]&&void 0!==A[z]&&(l=A[I]+(w-I)*(A[z]-A[I]),l<h&&(h=l),l>k&&(k=l)))}this.pairY&&(A=f(h,k,y,void 0),u[y]=A.min,B[y]=A.max,h=Number.MAX_VALUE,k=-Number.MAX_VALUE)}.bind(this));if("bar"==this.graphStyle){a=[];for(b=0;b<this.data.ys.length;b++)E["e_"+b]&&a.push(b);g=a.length;for(q=F;q<=z;q++){for(b=yCur=0;b<g;b++)yCur+=(d?this.data.saved.y[a[b]][q]:this.data.ys[a[b]].y[q])||0;yCur>k&&(k=yCur)}h=0}if(this.pairY)return isNaN(u[0])&&(u[0]=u[1]),isNaN(u[1])&&(u[1]=u[0]),isNaN(B[0])&&(B[0]=B[1]),isNaN(B[1])&&(B[1]=B[0]),{min:u,max:B};b=f(h,k);return{min:b.min,max:b.max}},setDarkMode:function(b){this.darkMode=b;this.graph.setDarkMode(b);this.axisY.setDarkMode(b);this.fade.setDarkMode(b);this.axisX.setDarkMode(b);this.mini.setDarkMode(b);this.handle.setDarkMode(b);this.tip.setDarkMode(b);this.switchers.setDarkMode(b);this.composer.setDarkMode(b)},getGraphWidth:function(b){var a=this.$el.getBoundingClientRect();return b?(b=this.$switchers.getBoundingClientRect(),500<=a.width-b.width?{hasSpaceForLegend:!0,width:Math.max(a.width-b.width,1)}:{hasSpaceForLegend:!1,width:a.width}):{width:a.width}},onResize:function(){var b=Math.min(window.devicePixelRatio||1,2);if(this.ww!=window.innerWidth||b!=this.settings.dpi){this.settings.dpi=b;this.ww=window.innerWidth;this.data.sideLegend&&(this.$switchers.classList.remove("tchart--switchers__no-space"),b=this.getGraphWidth(!0),b.hasSpaceForLegend||this.$switchers.classList.add("tchart--switchers__no-space"),this.$graph.style.width=b.width+"px");b=this.$graph.getBoundingClientRect();var a=this.settings,c=b.height-a.DATES_HEIGHT-a.MINI_GRAPH_HEIGHT-a.MINI_GRAPH_TOP-a.MINI_GRAPH_BOTTOM;this.state.dims={composer:{w:b.width,h:b.height,l:0,t:0},graph:{w:b.width,h:c,l:0,t:a.DATES_HEIGHT},axisYLeft:{w:a.Y_LABELS_WIDTH,h:c,l:a.PADD[3],t:a.DATES_HEIGHT},axisYRight:{w:a.Y_LABELS_WIDTH,h:c,l:b.width-a.PADD[1]-a.Y_LABELS_WIDTH,t:a.DATES_HEIGHT},axisYLines:{w:b.width-a.PADD[1]-a.PADD[3],h:c,l:a.PADD[3],t:a.DATES_HEIGHT},fadeTop:{w:b.width,h:a.FADE_HEIGHT,l:0,t:a.DATES_HEIGHT},fadeBottom:{w:b.width,h:a.FADE_HEIGHT,l:0,t:a.DATES_HEIGHT+c-a.FADE_HEIGHT},axisX:{w:b.width,h:a.X_LABELS_HEIGHT,l:0,t:a.DATES_HEIGHT+c-a.X_LABELS_HEIGHT},dates:{w:a.DATES_WIDTH,h:a.DATES_HEIGHT,l:b.width-a.DATES_WIDTH-a.PADD[1],t:0},mini:{w:b.width-a.PADD[1]-a.PADD[3],h:a.MINI_GRAPH_HEIGHT,l:a.PADD[3],t:a.DATES_HEIGHT+c+a.MINI_GRAPH_TOP},handle:{w:b.width-a.PADD[1]-a.PADD[3],h:a.MINI_GRAPH_HEIGHT+2,l:a.PADD[3],t:a.DATES_HEIGHT+c+a.MINI_GRAPH_TOP-1},tip:{w:b.width,h:c,l:0,t:a.DATES_HEIGHT}};this.graph.onResize();this.axisY.onResize();this.fade.onResize();this.axisX.onResize();this.mini.onResize();this.handle.onResize();this.tip.onResize();this.composer.onResize()}},createDOM:function(b){var a,c=this.settings;this.$el=document.createElement("div");this.$el.className="tchart";this.data.subchart.show||this.$el.classList.add("tchart__no-subchart");this.data.slave&&this.$el.classList.add("tchart__slave");this.$h1=document.createElement("h1");this.$h1.className="tchart--header";this.$h1.textContent=this.data.caption;this.$el.appendChild(this.$h1);this.$zoom=document.createElement("div");this.$zoom.className="tchart--zoom";this.$el.appendChild(this.$zoom);var e=document.createElement("div");this.$zoom.appendChild(e);e=document.createElement("span");e.textContent="Zoom Out";this.$zoom.appendChild(e);this.$zoom.addEventListener("click",function(){this.toggleZoom(!1)}.bind(this));this.$graph=document.createElement("div");this.$graph.className="tchart--graph";this.$el.appendChild(this.$graph);this.$switchers=document.createElement("div");this.$switchers.className="tchart--switchers";this.data.sideLegend&&this.$switchers.classList.add("tchart--switchers__side-legend");this.$el.appendChild(this.$switchers);b.appendChild(this.$el);b=this.getYMinMax(this.state.x1,this.state.x2,!1,!0);e=this.getYMinMax(this.state.xg1,this.state.xg2,!0);if(this.pairY)for(a=0;a<this.data.ys.length;a++)this.state["y1_"+a]=b.min[a],this.state["y2_"+a]=b.max[a],this.state["y1m_"+a]=e.min[a],this.state["y2m_"+a]=e.max[a];else this.state.y1=b.min,this.state.y2=b.max,this.state.y1m=e.min,this.state.y2m=e.max;this.composer=new t.TComposer({$parent:this.$graph,settings:c,chart:this,state:this.state,data:this.data,graphStyle:this.graphStyle});this.animator=new t.TAnimator({state:this.state,composer:this.composer});b={line:"TLines",step:"TLines",bar:"TBars",area:"TAreas"};[["graph",b[this.graphStyle],this.$graph],["axisX","TAxisX",this.$graph],["fade","TFade",this.$graph],["axisY","TAxisY",this.$graph],["tip","TTip",this.$graph,{onClick:this.toggleZoom}],["mini",b[this.graphStyle],this.$graph,{mini:!0}],["handle","THandle",this.$graph,{cb:this.onHandleMove}],["switchers","TSwitchers",this.$switchers,{onClick:this.onSwitcherChange,onLongTap:this.onSwitcherChange,onEnter:this.onSwitcherEnter,onLeave:this.onSwitcherLeave}]].forEach(function(d){this[d[0]]=new t[d[1]]({animator:this.animator,$canvas:this.composer.$canvas,ctx:this.composer.ctx,graphStyle:this.graphStyle,chart:this,pairY:this.pairY,state:this.state,data:this.data,$parent:d[2],settings:c,additional:d[3]||{}});this[d[0]].id=d[0]}.bind(this))},onHandleMove:function(b,a,c,e){this.updateSpeed();var d=[],f=this.getYMinMax(b,a,!1,!0);this.axisX.setAnimation("both"!=c);this.axisY.setAnimation(!0);this.axisY.setForceUpdate(!1);e&&t.TUtils.triggerEvent("chart-hide-tips",{except:null});d.push({prop:"x1",state:this.state,end:b,fixed:!0,duration:0,group:{top:!0,bottom:!0}});d.push({prop:"x2",state:this.state,end:a,fixed:!0,duration:0,group:{top:!0,bottom:!0}});for(i=0;i<this.data.ys.length;i++)"line"!=this.graphStyle&&"step"!=this.graphStyle||d.push({prop:this.pairY?"y1_"+i:"y1",state:this.state,end:this.pairY?f.min[i]:f.min,duration:500,fixed:!0,tween:"exp",speed:.25,group:{top:!0}}),"area"!=this.graphStyle&&d.push({prop:this.pairY?"y2_"+i:"y2",state:this.state,end:this.pairY?f.max[i]:f.max,duration:500,fixed:!0,tween:"exp",speed:.25,group:{top:!0}});this.animator.add(d)},onSwitcherEnter:function(b){clearTimeout(this.switcherLeaveTimeout);var a=[];for(i=0;i<this.data.ys.length;i++)a.push({prop:"f_"+i,state:this.state,end:b==i?1:0,duration:300,tween:"exp",speed:.15,group:{top:!0,bottom:!0}}),a.push({prop:"pieInd_"+i,state:this.state,end:b==i?1:0,duration:300,tween:"exp",speed:.15,group:{top:!0,bottom:!0}});this.animator.add(a)},onSwitcherLeave:function(b){clearTimeout(this.switcherLeaveTimeout);this.switcherLeaveTimeout=setTimeout(function(){var a=[];for(i=0;i<this.data.ys.length;i++)a.push({prop:"f_"+i,state:this.state,end:1,duration:300,tween:"exp",speed:.15,group:{top:!0,bottom:!0}}),a.push({prop:"pieInd_"+i,state:this.state,end:0,duration:300,tween:"exp",speed:.15,group:{top:!0,bottom:!0}});this.animator.add(a)}.bind(this),300)},onSwitcherChange:function(b,a){var c,e=[],d=[],f=[];this.updateSpeed();if("boolean"!=typeof b){var g=!0;a=b;var h=!0;for(c=0;c<this.data.ys.length;c++)h=h&&(c==a?this.state["e_"+c]:!this.state["e_"+c])}for(c=0;c<this.data.ys.length;c++){var k=c==a;f[c]=this.state["e_"+c];g?this.state["e_"+c]=k:k&&(this.state["e_"+c]=!!b);h&&g&&(this.state["e_"+c]=!0);d[c]=this.state["e_"+c]}c=this.reduceGlobalRange({});c.isReduced?(e.push({prop:"x1",state:this.state,end:c.x1,duration:333,group:{top:!0,bottom:!0}}),e.push({prop:"x2",state:this.state,end:c.x2,duration:333,group:{top:!0,bottom:!0}}),e.push({prop:"xg1",state:this.state,end:c.xg1,duration:333,group:{top:!0,bottom:!0}}),e.push({prop:"xg2",state:this.state,end:c.xg2,duration:333,group:{top:!0,bottom:!0}}),this.state.xg1Ind=c.xg1Ind,this.state.xg2Ind=c.xg2Ind,k=this.getYMinMax(c.x1,c.x2,!1,!0),g=this.getYMinMax(c.xg1,c.xg2,!0)):(k=this.getYMinMax(this.state.x1,this.state.x2,!1,!0),g=this.getYMinMax(this.state.xg1,this.state.xg2,!0));t.TUtils.triggerEvent("chart-hide-tips",{except:null});this.axisY.setForceUpdate(!0);this.axisY.setAnimation(!0);for(c=this.state.activeColumnsCount=0;c<d.length;c++)d[c]&&this.state.activeColumnsCount++,f[c]!=d[c]&&(e.push({prop:"o_"+c,state:this.state,end:d[c]?1:0,duration:300,group:{top:!0}}),e.push({prop:"om_"+c,state:this.state,end:d[c]?1:0,duration:"line"==this.graphStyle||"step"==this.graphStyle?166:300,delay:d[c]&&"line"==this.graphStyle||"step"==this.graphStyle?200:0,tween:"linear",group:{bottom:!0}}));for(c=0;c<(this.pairY?d.length:1);c++)"line"!=this.graphStyle&&"step"!=this.graphStyle||e.push({prop:this.pairY?"y1_"+c:"y1",state:this.state,end:this.pairY?k.min[c]:k.min,duration:this.pairY?0:333,group:{top:!0}}),"area"!=this.graphStyle&&e.push({prop:this.pairY?"y2_"+c:"y2",state:this.state,end:this.pairY?k.max[c]:k.max,duration:this.pairY?0:333,group:{top:!0}}),"line"!=this.graphStyle&&"step"!=this.graphStyle||e.push({prop:this.pairY?"y1m_"+c:"y1m",state:this.state,end:this.pairY?g.min[c]:g.min,duration:this.pairY?0:316,group:{bottom:!0}}),"area"!=this.graphStyle&&e.push({prop:this.pairY?"y2m_"+c:"y2m",state:this.state,end:this.pairY?g.max[c]:g.max,duration:this.pairY?0:316,group:{bottom:!0}});this.state.y1m_hidd=this.state.y1m;this.state.y2m_hidd=this.state.y2m;this.state.y1m_show=g.min;this.state.y2m_show=g.max;this.switchers.render(d);this.animator.add(e)},toggleSlave:function(b,a,c,e){var d=[];this.updateSpeed(e);if(this.state.zoomModeSlave!=b){this.state.zoomSpecialOrigin=a;if(b){this.state.zoomModeSlave=!0;this.switchers.switchers.forEach(function(w,r){w.classList.add("tchart--switcher__visible");w.getElementsByTagName("span")[0].textContent=c.names[r]});this.tip.labels.forEach(function(w,r){w.$label.textContent=c.names[r]});this.data.x=c.x;a=[];for(var f=0;f<c.y.length;f++)this.data.ys[f].y=c.y[f],e=-1==c.hidden.indexOf(this.data.ys[f].id),this.state["e_"+f]=e,this.state["o_"+f]=e?1:0,this.state["om_"+f]=e?1:0,a[f]=e;this.switchers.render(a);a=this.data.x[0];e=this.data.x[this.data.x.length-1];this.data.dates=[];this.data.datesShort=[];this.data.datesRange=[];var g=t.TUtils.getFormatter("xTooltipFormatter",this.data,1),h=t.TUtils.getFormatter("xTickFormatter",this.data,1),k=t.TUtils.getFormatter("xRangeFormatter",this.data,1),m=0;for(f=0;f<this.data.x.length;f++)this.data.dates[f]=g(this.data.x[f],!0),this.data.datesShort[f]=h(this.data.x[f],!0),this.data.datesRange[f]=k(this.data.x[f],!0),this.data.datesShort[f].length>m&&(m=this.data.datesShort[f].length);this.data.maxXTickLength=m;this.data.subchart=c.subchart;this.data.hidden=c.hidden;f=this.getDefaultZoom({x1:a,x2:e,xg1:a,xg2:e,"default":this.data.subchart.defaultZoom});this.state.x1=f.x1;this.state.x2=f.x2;this.state.xCount=this.data.x.length;this.state.xg1=a;this.state.xg2=e;this.state.xg1Ind=0;this.state.xg2Ind=this.data.x.length-1;this.state.xMainMin=a;this.state.xMainMax=e;this.state.xgMin=a;this.state.xgMax=e;f=this.reduceGlobalRange({});f.isReduced&&(this.state.x1=f.x1,this.state.x2=f.x2,this.state.xg1=f.xg1,this.state.xg2=f.xg2,this.state.xg1Ind=f.xg1Ind,this.state.xg2Ind=f.xg2Ind);f=this.getYMinMax(this.state.x1,this.state.x2,!1,!0);a=this.getYMinMax(a,e,!0);this.state.y1=f.min;this.state.y2=f.max;this.state.y1m=a.min;this.state.y2m=a.max}else this.switchers.switchers.forEach(function(w,r){w.classList.remove("tchart--switcher__visible")});setTimeout(function(){b||(this.state.zoomModeSlave=!1)}.bind(this),470);this.state.slaveVisibility=b?0:1;d.push({prop:"slaveVisibility",state:this.state,end:b?1:0,duration:450,group:{top:!0,bottom:!0}});this.animator.add(d)}},toggleZoomSpecial:function(b,a,c){var e=[];if(this.state.zoomModeSpecial!=b){var d=this.updateSpeed();if(b){var f=(this.state.x2-this.state.x1)/(this.state.dims.graph.w-this.settings.PADD[3]-this.settings.PADD[1]),g=this.settings.PADD[3]*f;this.state.zoomSpecialOrigin=(a-this.state.x1+g)/(this.state.x2-this.state.x1+g+this.settings.PADD[1]*f);this.state.zoomModeSpecial=!0;this.$h1.classList.add("tchart--header__hidden");this.$zoom.classList.add("tchart--zoom__visible");this.switchers.switchers.forEach(function(h,k){h.classList.remove("tchart--switcher__visible")});this.slaveChart.toggleSlave(!0,this.state.zoomSpecialOrigin,c,d)}else this.$h1.classList.remove("tchart--header__hidden"),this.$zoom.classList.remove("tchart--zoom__visible"),this.switchers.switchers.forEach(function(h,k){h.classList.add("tchart--switcher__visible")}),this.slaveChart.toggleSlave(!1,this.state.zoomSpecialOrigin,null,d);document.body.style.pointerEvents="none";setTimeout(function(){b||(this.state.zoomModeSpecial=!1);document.body.style.pointerEvents=""}.bind(this),470);this.state.masterVisibility=b?1:0;e.push({prop:"masterVisibility",state:this.state,end:b?0:1,duration:450,group:{top:!0,bottom:!0}});this.animator.add(e)}},toggleZoom:function(b,a,c){c&&void 0==this.specialZoomTransition&&(c.columns.length!=this.data.ys.length+1&&(this.specialZoomTransition=!0),this.specialZoomTransition||c.columns.forEach(function(q,n){var p=q[0],l=c.types[p],u=c.names[p];n=this.data.yIds[p];if(void 0!=n){if(p=this.data.ys[n].label,this.data.ys[n].tp!=l||p!=u)this.specialZoomTransition=!0}else"x"!==p&&(this.specialZoomTransition=!0)}.bind(this)),void 0==this.specialZoomTransition&&(this.specialZoomTransition=!1));if(this.specialZoomTransition&&(this.data.master=!0,this.$el.classList.add("tchart__master"),!this.slaveChart)){var e=JSON.parse(JSON.stringify(c));e.yTickFormatter=c.yTickFormatter;e.yTooltipFormatter=c.yTooltipFormatter;e.xTickFormatter=c.xTickFormatter;e.xTooltipFormatter=c.xTooltipFormatter;e.xRangeFormatter=c.xRangeFormatter;e.sideLegend=this.data.sideLegend;this.slaveChart=new t.TChart({container:this.opts.container,slave:!0,data:e});this.slaveChart.setDarkMode(this.darkMode)}c&&!c.details&&(c.details={y:[],names:[]},c.columns.forEach(function(q,n){var p=q.shift(),l=c.names[p];"x"===c.types[p]?c.details.x=q:this.specialZoomTransition?(c.details.y.push(q),c.details.names.push(l)):c.details.y[this.data.yIds[p]]=q}.bind(this)));c&&(c.subchart={show:c.subchart&&void 0!=c.subchart.show?c.subchart.show:!0,defaultZoom:c.subchart&&c.subchart.defaultZoom},c.details.subchart=c.subchart,c.details.hidden=c.hidden||[]);if(this.specialZoomTransition)this.toggleZoomSpecial(b,a,c&&c.details);else{var d=c&&c.details;e=[];if(this.state.zoomMode!=b){if(b){this.state.zoomMode=!0;this.state.zoomDir=1;this.$h1.classList.add("tchart--header__hidden");this.$zoom.classList.add("tchart--zoom__visible");this.zoomEnterSpeed=this.updateSpeed();c&&(this.data.details={yTickFormatter:c.yTickFormatter,yTooltipFormatter:c.yTooltipFormatter,xTickFormatter:c.xTickFormatter,xTooltipFormatter:c.xTooltipFormatter,xRangeFormatter:c.xRangeFormatter,subchart:c.subchart,hidden:c.hidden||[]});if(!this.hasSavedData){this.data.saved={};this.data.saved.x=this.data.x.slice();this.data.saved.dates=this.data.dates.slice();this.data.saved.datesShort=this.data.datesShort.slice();this.data.saved.datesRange=this.data.datesRange.slice();this.data.saved.y=[];for(j=0;j<this.data.ys.length;j++)this.data.saved.y[j]=this.data.ys[j].y.slice();this.hasSavedData=!0}this.data.details&&this.data.details.subchart&&(this.data.details.subchart.show?this.$el.classList.remove("tchart__no-subchart"):this.$el.classList.add("tchart__no-subchart"));this.state.zoomSaved={x1:this.state.x1,x2:this.state.x2,xg1:this.state.xg1,xg2:this.state.xg2,xgMin:this.state.xgMin,xgMax:this.state.xgMax};var f=this.data.mainPeriodLen;var g=a;a+=f;this.data.details&&(a=this.getDefaultZoom({x1:g,x2:a,xg1:d.x[0],xg2:d.x[d.x.length-1],"default":this.data.details.subchart.defaultZoom}),g=a.x1,a=a.x2);if("area"!=this.graphStyle){this.data.detailPeriodLen=d.x[1]-d.x[0];var h=d.x[0];var k=d.x[d.x.length-1]}else{this.data.detailPeriodLen=f;var m=this.data.pieZoomRange;h=g-(m-f)/2;k=h+m;a=g+Math.round(m/7/f)*f;h<this.data.x[0]?(h=this.data.x[0],k=h+m,k>this.data.x[this.data.x.length-1]&&(k=this.data.x[this.data.x.length-1]+f)):k>this.data.x[this.data.x.length-1]&&(k=this.data.x[this.data.x.length-1]+f,h=k-m,h<this.data.x[0]&&(h=this.data.x[0]))}h=Math.round(h/f)*f;k=Math.round(k/f)*f;"area"!=this.graphStyle&&this.insertDetails(h,k,d);this.state.xgMin=h;this.state.xgMax=k}else this.updateSpeed(this.zoomEnterSpeed/("area"==this.graphStyle?2:1)),this.$h1.classList.remove("tchart--header__hidden"),this.$zoom.classList.remove("tchart--zoom__visible"),this.data.details&&(this.data.subchart.show?this.$el.classList.remove("tchart__no-subchart"):this.$el.classList.add("tchart__no-subchart")),this.state.zoomDir=-1,g=this.state.zoomSaved.x1,a=this.state.zoomSaved.x2,h=this.state.zoomSaved.xg1,k=this.state.zoomSaved.xg2,this.state.xgMin=this.state.zoomSaved.xgMin,this.state.xgMax=this.state.zoomSaved.xgMax;this.axisY.setForceUpdate(!0);this.axisY.setAnimation(!0);this.axisX.setAnimation(!0);d=450;var w=f=0;"area"==this.graphStyle&&(d=350,b?w=.95*d:f=.95*d);m=this.reduceGlobalRange({x1:g,x2:a,xg1:h,xg2:k,useSaved:!b});m.isReduced&&(g=m.x1,a=m.x2,h=m.xg1,k=m.xg2);this.state.xg1Ind=Math.floor(t.TUtils.getXIndex(b?this.data.x:this.data.saved.x,h));this.state.xg2Ind=Math.ceil(t.TUtils.getXIndex(b?this.data.x:this.data.saved.x,k));m=this.getYMinMax(g,a,!1,!0,!b);var r=this.getYMinMax(h,k,!0,!1,!b);document.body.style.pointerEvents="none";setTimeout(function(){b||(this.state.zoomMode=!1,"area"!=this.graphStyle&&this.revertDetails());document.body.style.pointerEvents="";this.composer.render({top:!0,bottom:!0})}.bind(this),d+20+("area"==this.graphStyle?.9*d:0));this.state.zoomMorph=b?0:1;e.push({prop:"zoomMorph",state:this.state,end:b?1:0,duration:d,delay:w,group:{top:!0,bottom:!0}});e.push({prop:"x1",state:this.state,end:g,delay:f,duration:d,group:{top:!0,bottom:!0}});e.push({prop:"x2",state:this.state,end:a,delay:f,duration:d,group:{top:!0,bottom:!0}});e.push({prop:"xg1",state:this.state,end:h,delay:f,duration:d,group:{top:!0,bottom:!0}});e.push({prop:"xg2",state:this.state,end:k,delay:f,duration:d,group:{top:!0,bottom:!0}});for(g=0;g<(this.pairY?this.data.ys.length:1);g++)"line"!=this.graphStyle&&"step"!=this.graphStyle||e.push({prop:this.pairY?"y1_"+g:"y1",state:this.state,end:this.pairY?m.min[g]:m.min,delay:f,duration:d,group:{top:!0}}),"area"!=this.graphStyle&&e.push({prop:this.pairY?"y2_"+g:"y2",state:this.state,end:this.pairY?m.max[g]:m.max,delay:f,duration:d,group:{top:!0}}),"line"!=this.graphStyle&&"step"!=this.graphStyle||e.push({prop:this.pairY?"y1m_"+g:"y1m",state:this.state,end:this.pairY?r.min[g]:r.min,delay:f,duration:d,group:{bottom:!0}}),"area"!=this.graphStyle&&e.push({prop:this.pairY?"y2m_"+g:"y2m",state:this.state,end:this.pairY?r.max[g]:r.max,delay:f,duration:d,group:{bottom:!0}});this.animator.add(e)}}},insertDetails:function(b,a,c){b=Math.ceil(t.TUtils.getXIndex(this.data.x,b));var e=Math.ceil(t.TUtils.getXIndex(this.data.x,a)),d=c.x.length-1;a>this.data.x[e]&&e++;a=e-("bar"==this.graphStyle||"step"==this.graphStyle?1:0);e=this.data.x.length-1;var f=[],g=[],h=[],k=[],m,w,r=[],q=[];for(m=0;m<b;m++){var n=m-0;f[n]=this.data.x[m];g[n]=this.data.dates[m];h[n]=this.data.datesShort[m];k[n]=this.data.datesRange[m]}for(j=0;j<this.data.ys.length;j++){r[j]=r[j]||[];var p=r[j];var l=this.data.ys[j].y;for(m=0;m<b;m++)p[m-0]=l[m]}var u=[],B=[],D=[];p=t.TUtils.getFormatter("xTooltipFormatter",this.data,1);var E=t.TUtils.getFormatter("xTickFormatter",this.data,1);l=t.TUtils.getFormatter("xRangeFormatter",this.data,1);for(m=w=0;m<=d;m++)n=m-0+b,f[n]=c.x[m],g[n]=p(f[n],!0),h[n]=E(f[n],!0),k[n]=l(f[n],!0),h[n].length>w&&(w=h[n].length),n=t.TUtils.getXIndex(this.data.x,f[n]),u[m]=n,B[m]=Math.floor(n),D[m]=Math.ceil(n);this.data.details.maxXTickLength=w;for(j=0;j<this.data.ys.length;j++)for(r[j]=r[j]||[],p=r[j],l=this.data.ys[j].y,w=c.y[j],q[j]=q[j]||[],E=q[j],m=0;m<=d;m++){n="bar"==this.graphStyle?l[B[m]]||0:"step"==this.graphStyle?l[B[m]]:l[B[m]]+(u[m]-B[m])*(l[D[m]]-l[B[m]]);var F=w[m];"bar"!==this.graphStyle&&isNaN(n)&&!isNaN(F)&&(n=0);p[m-0+b]=F;E[m-0+b]=n}for(m=a+1;m<=e;m++)n=m-a+d+b,f[n]=this.data.x[m],g[n]=this.data.dates[m],h[n]=this.data.datesShort[m],k[n]=this.data.datesRange[m];for(j=0;j<this.data.ys.length;j++)for(r[j]=r[j]||[],p=r[j],l=this.data.ys[j].y,m=a+1;m<=e;m++)p[m-a+d+b]=l[m];this.state.detailInd1=b;this.state.detailInd2=b+d-0;this.data.x=f;this.data.dates=g;this.data.datesShort=h;this.data.datesRange=k;for(j=0;j<this.data.ys.length;j++)this.data.ys[j].y=r[j],this.data.ys[j].yFrom=q[j]},revertDetails:function(){this.data.x=this.data.saved.x;this.data.dates=this.data.saved.dates;this.data.datesShort=this.data.saved.datesShort;this.data.datesRange=this.data.saved.datesRange;for(i=0;i<this.data.ys.length;i++)this.data.ys[i].y=this.data.saved.y[i]}};t.TChart=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.$canvas=document.createElement("canvas");this.$canvas.className="tchart--graph-canvas";this.ctx=this.$canvas.getContext("2d");b.$parent.appendChild(this.$canvas);this.deviceSpeed=void 0};C.prototype={onResize:function(){var b=this.opts.settings.dpi,a=this.opts.state.dims.composer;this.$canvas.width=a.w*b;this.$canvas.height=a.h*b;this.render({top:!0,bottom:!0})},setDarkMode:function(b){this.isDarkMode=b;this.onResize()},render:function(b){if(void 0==this.deviceSpeed){var a=performance.now(),c=this.opts.state.x1;this.opts.state.x1=this.opts.state.xMainMin;this.renderInner(b);var e=performance.now();this.opts.state.x1=c}this.renderInner(b);void 0==this.deviceSpeed&&(this.deviceSpeed=(e-a)/("line"==this.opts.graphStyle||"step"==this.opts.graphStyle?1.5:2)/(this.opts.data.x.length*this.opts.data.ys.length),this.opts.state.deviceSpeed=this.deviceSpeed)},renderInner:function(b){var a=this.opts.state.dims,c=this.opts.state,e=this.ctx,d=this.opts.settings.dpi,f=this.opts.settings,g=f.PADD,h=void 0==c.zoomMorph?0:c.zoomMorph,k="area"==this.opts.graphStyle&&c.zoomMode&&1>h,m="area"==this.opts.graphStyle&&c.zoomMode&&1==h;this.opts.data.master&&(this.$canvas.style.opacity=c.masterVisibility);this.opts.data.slave&&(this.$canvas.style.opacity=c.slaveVisibility,this.opts.chart.$el.style.visibility=0<c.slaveVisibility?"visible":"hidden");if(b.top){e.clearRect(a.dates.l*d,a.dates.t*d,a.dates.w*d,a.dates.h*d);if("line"==this.opts.graphStyle||"step"==this.opts.graphStyle||"area"==this.opts.graphStyle&&0<h||this.opts.data.slave&&1>c.slaveVisibility||this.opts.data.master&&1>c.masterVisibility)m?e.clearRect(a.graph.l*d,(a.graph.t-18)*d,a.graph.w*d,(a.graph.h+30)*d):e.clearRect(a.graph.l*d,a.graph.t*d,a.graph.w*d,a.graph.h*d);if("area"==this.opts.graphStyle&&0==h||"bar"==this.opts.graphStyle)e.clearRect(a.graph.l*d,a.graph.t*d,a.graph.w*d,(f.PADD[0]+4)*d),e.clearRect(a.graph.l*d,(a.graph.t+g[0])*d,g[3]*d,(a.graph.h-g[0]-g[2])*d),e.clearRect(a.graph.l*d,(a.graph.t+a.graph.h-g[2])*d,a.graph.w*d,g[2]*d),e.clearRect((a.graph.l+a.graph.w-g[1]-1)*d,(a.graph.t+g[0])*d,(g[1]+1)*d,(a.graph.h-g[0]-g[2])*d);k||m||(e.save(),e.beginPath(),e.rect(a.graph.l*d,a.graph.t*d,a.graph.w*d,a.graph.h*d),e.clip());this.opts.data.master&&1>c.masterVisibility&&(e.save(),g=5*(1-c.masterVisibility)+1,e.translate(a.graph.w*c.zoomSpecialOrigin*(1-g),0),e.scale(g,1));this.opts.data.slave&&1>c.slaveVisibility&&(e.save(),g=c.slaveVisibility,e.translate(a.graph.w*c.zoomSpecialOrigin*(1-g),0),e.scale(g,1));g=1;"area"==this.opts.graphStyle&&c.zoomMode&&(g=1-h);if(k){e.save();f=f.PIE_RADIUS;var w=a.graph.w+h*(2*f-a.graph.w),r=a.graph.h-42+h*(2*f-a.graph.h+42);t.TUtils.drawRoundedRect2(e,d,w,r,(a.graph.w-w)/2+a.graph.l,(a.graph.h-42-r)/2+a.graph.t+23,h*f);e.clip()}this.opts.chart.graph.render();k&&e.restore();this.opts.data.master&&1>c.masterVisibility&&e.restore();this.opts.data.slave&&1>c.slaveVisibility&&e.restore();this.opts.chart.axisY.render(g);this.opts.chart.fade.render();k||m||e.restore();this.opts.chart.axisX.render(g)}b.bottom&&(e.clearRect(a.graph.l*d,(a.handle.t-1)*d,a.graph.w*d,(a.handle.h+2)*d),b=this.opts.data.subchart.show,(c=!this.opts.data.master&&!this.opts.data.slave&&this.opts.data.details&&this.opts.data.subchart.show!=this.opts.data.details.subchart.show)&&(b=b?1>h:0<h),b&&(e.save(),t.TUtils.drawRoundedRect(e,d,a.mini.w,a.mini.h,a.mini.l,a.mini.t,7),e.clip(),this.opts.chart.mini.render(),e.restore(),this.opts.chart.handle.render()),c&&0<h&&1>h&&(e.fillStyle=this.isDarkMode?"#242f3e":"#fff",e.globalAlpha=this.opts.data.subchart.show?h:1-h,e.fillRect(a.graph.l*d,(a.handle.t-1)*d,a.graph.w*d,(a.handle.h+2)*d),e.globalAlpha=1))}};t.TComposer=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.onDragStart=this.onDragStart.bind(this);this.onDragMove=this.onDragMove.bind(this);this.onDragEnd=this.onDragEnd.bind(this);this.isTouch=t.TUtils.isTouchDevice();this.skipMoveEnd=!0;var a=b.useElForMove?b.$el:window;b.$el.addEventListener(this.isTouch?"touchstart":"mousedown",this.onDragStart,{passive:!1});a.addEventListener(this.isTouch?"touchmove":"mousemove",this.onDragMove,{passive:!1});a.addEventListener(this.isTouch?"touchend":"mouseup",this.onDragEnd,{passive:!1})};C.prototype={onDragStart:function(b){this.skipMoveEnd=!0;clearTimeout(this.pointerTimeout);this.isTouch&&1<b.touches.length||(this.scroll=void 0,this.x=this.isTouch?b.touches[0].pageX:b.pageX,this.y=this.isTouch?b.touches[0].pageY:b.pageY,this.dY=this.dX=0,this.pageX=this.x,this.pageY=this.y,delete this.prevDx,delete this.prevDy,this.opts.onDragStart({pageX:this.x,pageY:this.y,isTouch:this.isTouch})||(this.skipMoveEnd=!1))},onDragMove:function(b){if(!this.skipMoveEnd&&"v"!=this.scroll){var a=this.isTouch?b.touches[0].pageX:b.pageX,c=this.isTouch?b.touches[0].pageY:b.pageY;this.dX=a-this.x;this.dY=c-this.y;this.pageX=a;this.pageY=c;if(this.isTouch)if("h"==this.scroll)!this.opts.noPrevent&&b.preventDefault();else if(5<Math.abs(this.dX)||5<Math.abs(this.dY))this.scroll=Math.abs(this.dX)>Math.abs(this.dY)?"h":"v";if(this.prevDx!=this.dX||this.prevDy!=this.dY)this.opts.onDragMove&&this.opts.onDragMove({canceled:"v"==this.scroll,d:this.dX,pageX:this.pageX,pageY:this.pageY,isTouch:this.isTouch}),this.prevDx=this.dX,this.prevDy=this.dY}},onDragEnd:function(b){this.skipMoveEnd||(this.skipMoveEnd=!0,this.opts.onDragEnd&&this.opts.onDragEnd({isTouch:this.isTouch,e:b}))}};t.TDrag=C})();(function(){var t=function(C){this.opts=C;this.ctx=C.ctx;"area"!=this.opts.graphStyle&&(this.$fadeTop=document.createElement("canvas"),this.ctxFadeTop=this.$fadeTop.getContext("2d"),"bar"!=this.opts.graphStyle&&(this.$fadeBottom=document.createElement("canvas"),this.ctxFadeBottom=this.$fadeBottom.getContext("2d")))};t.prototype={onResize:function(){var C=this.opts.settings.dpi,b=this.opts.state.dims.fadeTop,a=this.opts.state.dims.fadeBottom;if("area"!=this.opts.graphStyle){var c=this.ctxFadeTop.createLinearGradient(0,0,0,b.h*C);this.isDarkMode?(c.addColorStop(0,"rgba(36,47,62,1)"),c.addColorStop(1,"rgba(36,47,62,0)")):(c.addColorStop(0,"rgba(255,255,255,1)"),c.addColorStop(1,"rgba(255,255,255,0)"));this.$fadeTop.width=b.w*C;this.$fadeTop.height=b.h*C;this.ctxFadeTop.fillStyle=c;this.ctxFadeTop.fillRect(0,0,b.w*C,b.h*C);"bar"!=this.opts.graphStyle&&(b=this.ctxFadeBottom.createLinearGradient(0,0,0,a.h*C),this.isDarkMode?(b.addColorStop(0,"rgba(36,47,62,0)"),b.addColorStop(1,"rgba(36,47,62,1)")):(b.addColorStop(0,"rgba(255,255,255,0)"),b.addColorStop(1,"rgba(255,255,255,1)")),this.$fadeBottom.width=a.w*C,this.$fadeBottom.height=a.h*C,this.ctxFadeBottom.fillStyle=b,this.ctxFadeBottom.fillRect(0,0,a.w*C,a.h*C))}},setDarkMode:function(C){this.isDarkMode=C;this.onResize()},render:function(){var C=this.opts.settings.dpi,b=this.opts.state.dims.fadeTop,a=this.opts.state.dims.fadeBottom;this.$fadeTop&&this.ctx.drawImage(this.$fadeTop,b.l*C,b.t*C);this.$fadeBottom&&this.ctx.drawImage(this.$fadeBottom,a.l*C,a.t*C)}};window.Graph.units.TFade=t})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.ctx=b.ctx;this.isTouch=t.TUtils.isTouchDevice();this.$canvas=b.$canvas;this.drag=new t.TDrag({$el:this.$canvas,onDragStart:function(a){this.canvasPos=t.TUtils.getElemPagePos(this.$canvas);var c=a.pageX-this.canvasPos.x,e=a.pageY-this.canvasPos.y;this._x1=b.state.x1;this._x2=b.state.x2;this.constrainHandleSize(!1);this.tp=this.getTp(c-b.settings.PADD[3],e-(this.opts.state.dims.composer.h-b.settings.MINI_GRAPH_HEIGHT-b.settings.MINI_GRAPH_BOTTOM),a.isTouch);this.firstMove=!0;return!this.tp}.bind(this),onDragMove:function(a){this.onDragMove(a.d);this.firstMove=!1}.bind(this),onDragEnd:function(a){}.bind(this)});this.onMouseMove=this.onMouseMove.bind(this);this.onMouseLeave=this.onMouseLeave.bind(this);this.trackMouse(!0)};C.prototype={getTp:function(b,a,c){var e=this.opts.state.dims.handle,d=this.opts.state,f=this.opts.state.zoomMode;if(0>a||a>e.h)return"";var g=c?.3*e.w:10;c&&14>g&&(g=14);c&&30<g&&(g=30);a=this.prevX1+(c?d.x1==d.xg1?-5:-15:0);e=a+g;c=this.prevX2+(c?d.x2==d.xg2?5:15:0);g=c-g;.01>Math.abs(d.x2-d.x1-(f?this.opts.data.mainPeriodLen:this.minRange))&&(d.x2==d.xg2&&(g=c+1),d.x1==d.xg1&&(e=a-1));return b>e&&b<g?"both":b>=a&&b<=e?"start":b>=g&&b<=c?"end":""},trackMouse:function(b){this.isTouch||(this.$canvas.addEventListener("mousemove",this.onMouseMove),this.$canvas.addEventListener("mouseleave",this.onMouseLeave))},onMouseLeave:function(){this.$canvas.classList.remove("tchart--graph-canvas__handle-pointer");this.$canvas.classList.remove("tchart--graph-canvas__handle-grab");this.$canvas.classList.remove("tchart--graph-canvas__handle-col-resize");delete this.canvasPos},onMouseMove:function(b){this.canvasPos=this.canvasPos||t.TUtils.getElemPagePos(this.$canvas);b=this.getTp(b.pageX-this.canvasPos.x-this.opts.settings.PADD[3],b.pageY-this.canvasPos.y-(this.opts.state.dims.composer.h-this.opts.settings.MINI_GRAPH_HEIGHT-this.opts.settings.MINI_GRAPH_BOTTOM),!1);var a={"":"",both:this.opts.settings.isIE?"pointer":"grab",start:"col-resize",end:"col-resize"};this.onMouseLeave();a[b]&&this.$canvas.classList.add("tchart--graph-canvas__handle-"+a[b])},onResize:function(b){this.constrainHandleSize(!0)},setDarkMode:function(b){this.isDarkMode=b},constrainHandleSize:function(b){var a=32/(this.opts.state.dims.handle.w/(this.opts.state.xg2-this.opts.state.xg1)),c=this.opts.state.x1,e=this.opts.state.x2,d=this.opts.state.xg2;this.minRange=a;e-c<a&&(e=c+a,e>d&&(e=d,c=e-a),b&&this.opts.additional.cb(c,e,"constraint"))},onDragMove:function(b){var a=this.tp,c=this.opts.state;b=b/this.opts.state.dims.handle.w*(c.xg2-c.xg1);var e=this._x1,d=this._x2;if("both"==a){var f=e+b;var g=d+b;f<c.xg1&&(f=c.xg1,g=c.xg1+d-e);g>c.xg2&&(f=c.xg2-(d-e),g=c.xg2)}"start"==a&&(g=c.x2,f=Math.min(Math.max(e+b,c.xg1),g-this.minRange));"end"==a&&(f=c.x1,g=Math.max(Math.min(d+b,c.xg2),f+this.minRange));c.x1==f&&c.x2==g||this.opts.additional.cb(f,g,a,this.firstMove)},render:function(){var b=this.opts.state.dims.handle,a=this.opts.settings.dpi,c=this.opts.state,e=1/(c.xg2-c.xg1),d=Math.round((c.x1-c.xg1)*e*b.w);c=Math.round((c.x2-c.xg1)*e*b.w);e=this.ctx;e.fillStyle=this.isDarkMode?"rgba(48, 66, 89, 0.6)":"rgba(226, 238, 249, 0.6)";t.TUtils.drawRoundedRect(e,a,d+4,b.h-2,b.l,b.t+1,[7,0,0,7]);e.fill();t.TUtils.drawRoundedRect(e,a,b.w-c+4,b.h-2,b.l+c-4,b.t+1,[0,7,7,0]);e.fill();this.isDarkMode||"line"==this.opts.graphStyle||"step"==this.opts.graphStyle||(e.fillStyle="#fff",t.TUtils.drawRoundedRect(e,a,12,b.h+2,b.l+d-1,b.t-1,[8,0,0,8]),e.fill(),t.TUtils.drawRoundedRect(e,a,12,b.h+2,b.l+c-11,b.t-1,[0,8,8,0]),e.fill());e.fillStyle=this.isDarkMode?"#56626D":"#C0D1E1";t.TUtils.drawRoundedRect(e,a,10,b.h,b.l+d,b.t,[7,0,0,7]);e.fill();t.TUtils.drawRoundedRect(e,a,10,b.h,b.l+c-10,b.t,[0,7,7,0]);e.fill();e.fillRect((b.l+d+10)*a,b.t*a,(c-d-20)*a,a);e.fillRect((b.l+d+10)*a,(b.t+b.h-1)*a,(c-d-20)*a,a);e.strokeStyle="#fff";this.ctx.lineCap="round";this.ctx.lineJoin="round";this.ctx.lineWidth=2*a;e.beginPath();e.moveTo((b.l+d+5)*a,(b.t+17)*a);e.lineTo((b.l+d+5)*a,(b.t+25)*a);e.moveTo((b.l+c-5)*a,(b.t+17)*a);e.lineTo((b.l+c-5)*a,(b.t+25)*a);e.stroke();this.prevX1=d;this.prevX2=c}};t.THandle=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.$canvas=document.createElement("canvas");this.ctx=this.$canvas.getContext("2d",{alpha:!0})};C.prototype={onResize:function(){var b=this.opts.settings.dpi,a=this.opts.additional.mini?this.opts.state.dims.mini:this.opts.state.dims.graph;this.$canvas.width=a.w*b;this.$canvas.height=a.h*b;this.cached="";this.ctx.fillStyle=this.isDarkMode?"#242f3e":"#fff";this.ctx.fillRect(0,0,a.w*b,a.h*b)},setDarkMode:function(b){this.isDarkMode=b},render:function(){var b,a=this.opts,c=a.data.ys,e=a.state,d=a.additional.mini,f=d||a.data.master&&1>e.masterVisibility&&0<e.masterVisibility||a.data.slave&&1>e.slaveVisibility&&0<e.slaveVisibility;var g=d?e.xg1:e.x1;var h=d?e.xg2:e.x2;var k=a.settings;var m=k["PADD"+(d?"_MINI":"")][0],w=k["PADD"+(d?"_MINI":"")][1],r=k["PADD"+(d?"_MINI":"")][2],q=k["PADD"+(d?"_MINI":"")][3],n=a.data.x,p=a.settings.dpi,l=f?this.ctx:this.opts.ctx,u=d?e.dims.mini:e.dims.graph,B=e.zoomMode,D=e.detailInd1,E=e.detailInd2,F=void 0==e.zoomMorph?0:e.zoomMorph,G=c.length,I="step"==a.graphStyle;k=(u.w-w-q)/(h-g+(I?this.opts.data.mainPeriodLen*(1-F):0));var z=Math.floor(t.TUtils.getXIndex(n,g-q/k));h=Math.ceil(t.TUtils.getXIndex(n,h+w/k));k*=p;g=(q+(f?0:u.l))*p-g*k;I&&B&&1==F&&(z<this.opts.state.xg1Ind&&(z=this.opts.state.xg1Ind),h>this.opts.state.xg2Ind&&(h=this.opts.state.xg2Ind-1));w=this.opts.data.mainPeriodLen*k;q=this.opts.data.detailPeriodLen*k;if(f){var x=[u.w,u.h,d?e.xg1:e.x1,d?e.xg2:e.x2,this.isDarkMode,B];d||(x.push(e.y1),x.push(e.y2));for(b=0;b<G;b++)x.push(d?e["om_"+b]:e["o_"+b]),x.push(e["f_"+b]);x=x.join(",");if(x==this.cached){this.opts.ctx.drawImage(this.$canvas,u.l*p,u.t*p);return}this.cached=x;l.clearRect(0,0,u.w*p,u.w*p)}b=(a.additional.mini?1:"auto"==a.data.strokeWidth?5<G?1:2:a.data.strokeWidth)*p;x=0==b%2?0:.5;l.lineWidth=b;l.lineCap=a.additional.mini?"square":"round";l.lineJoin=a.additional.mini?"square":"round";for(b=0;b<G;b++){var y=d?e["om_"+b]:e["o_"+b];var A=e["e_"+b];if(0<y){var Q=c[b].y;var R=c[b].yFrom;if(a.pairY){var P=d?e["y1m_"+b]:e["y1_"+b];A=d?e["y2m_"+b]:e["y2_"+b]}else d?A&&1>y?(P=e.y1m_show,A=e.y2m_show):!A&&1>y?(P=e.y1m_hidd,A=e.y2m_hidd):(P=e.y1m,A=e.y2m):(P=e.y1,A=e.y2);A=p*(u.h-m-r)/(A-P);P=(u.h-r+(f?0:u.t))*p+P*A;l.beginPath();l.strokeStyle=this.isDarkMode?c[b].colors_n[0]:c[b].colors_d[0];l.globalAlpha=y*(.9*e["f_"+b]+.1);var N=Number.MAX_VALUE,S=-Number.MAX_VALUE,O=-Number.MAX_VALUE,H=!1,W=!0;for(y=z;y<=h;y++){if(B)if(y>=D&&y<=E){var Z=R[y]+F*(Q[y]-R[y]);var J=q}else Z=Q[y]+F*(Q[D]-Q[y]),J=w;else Z=Q[y],J=w;if(isNaN(Z))W=!0;else{var ka=n[y]*k+g<<0;yc=P-Z*A<<0;ka>O||I&&y==E+1?(H&&(la==N?(l.moveTo(O+x,S-x),l.lineTo(O+x,N-x)):(l.moveTo(O+x,N-x),l.lineTo(O+x,S-x),la!=S&&l.moveTo(O+x,la-x)),H=!1),W&&(l.moveTo(ka+x,yc-x),W=!1),S=N=yc,l.lineTo(ka+x,yc-x),I&&l.lineTo((n[y]*k+J+g<<0)+x,yc-x)):(N=Math.min(N,yc),S=Math.max(S,yc),H=!0);O=ka;var la=yc}}H&&(l.moveTo(O+x,N-x),l.lineTo(O+x,S-x));l.stroke()}}l.globalAlpha=1;f&&this.opts.ctx.drawImage(this.$canvas,u.l*p,u.t*p)}};t.TLines=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;var a,c;this.isTouch=t.TUtils.isTouchDevice();this.enabled=b.data.ys.length;1!=this.enabled||b.data.forceLegend||(b.$parent.style.display="none");this.switchers=b.data.ys.map(function(e,d){var f=document.createElement("div");f.className="tchart--switcher";b.state["e_"+d]?f.classList.toggle("tchart--switcher__active"):this.enabled--;f.setAttribute("data-label",e.label);b.$parent.appendChild(f);var g=document.createElement("span");g.textContent=e.label;f.appendChild(g);this.isTouch||(f.addEventListener("mouseenter",function(w){b.state["e_"+d]&&b.additional.onEnter(d)}),f.addEventListener("mouseleave",function(w){b.state["e_"+d]&&b.additional.onLeave(d)}));f.addEventListener("click",function(w){c?c=!1:(w=f.classList.contains("tchart--switcher__active"))&&1==this.enabled?(f.classList.add("tchart--switcher__denied"),clearTimeout(a),a=setTimeout(function(){f.classList.remove("tchart--switcher__denied")},500)):(this.isTouch||(w?b.additional.onLeave(d):b.additional.onEnter(d)),b.additional.onClick(!w,d))}.bind(this));var h,k,m;this.drag=new t.TDrag({$el:f,noPrevent:!0,useElForMove:!0,onDragStart:function(w){h=w.pageX;k=w.pageY;m=setTimeout(function(){c=!0;if(!this.isTouch)b.additional.onEnter(d);b.additional.onLongTap(d)}.bind(this),500)}.bind(this),onDragMove:function(w){(5<Math.abs(h-w.pageX)||5<Math.abs(k-w.pageY))&&clearTimeout(m)}.bind(this),onDragEnd:function(w){clearTimeout(m)}.bind(this)});return f}.bind(this));this.updateColors()};C.prototype={onResize:function(){},updateColors:function(){for(var b=this.opts.data.ys,a=0;a<this.switchers.length;a++)this.switchers[a].style.color=this.isDarkMode?b[a].colors_n[1]:b[a].colors_d[1]},setDarkMode:function(b){this.isDarkMode=b;this.updateColors()},render:function(b){for(var a=this.enabled=0;a<this.switchers.length;a++)b[a]?(this.enabled++,this.switchers[a].classList.add("tchart--switcher__active")):this.switchers[a].classList.remove("tchart--switcher__active")}};t.TSwitchers=C})();(function(){var t=window.Graph.units,C=function(b){this.opts=b;this.shown=!1;this.isTouch=t.TUtils.isTouchDevice();this.$canvas=b.$canvas;this.cache={};this.$tip=document.createElement("div");this.$tip.className="tchart--tip";b.$parent.appendChild(this.$tip);this.$tipDt=document.createElement("h6");this.$tip.appendChild(this.$tipDt);this.$tipDtText=document.createTextNode("");this.$tipDt.appendChild(this.$tipDtText);this.$tipDtText.nodeValue=".";this.$tipArrow=document.createElement("div");this.$tipArrow.className="tchart--tip-arrow";this.$tip.appendChild(this.$tipArrow);this.$tipLoader=document.createElement("div");this.$tipLoader.className="tchart--tip-loader";this.$tip.appendChild(this.$tipLoader);this.$tipScrollerWrapper=document.createElement("div");this.$tipScrollerWrapper.className="tchart--tip-scroller-wrapper";this.$tip.appendChild(this.$tipScrollerWrapper);this.$tipScroller=document.createElement("div");this.$tipScroller.className="tchart--tip-scroller";this.$tipScrollerWrapper.appendChild(this.$tipScroller);this.updateTipScrollClasses=this.updateTipScrollClasses.bind(this);this.$tipScroller.addEventListener("scroll",this.updateTipScrollClasses);this.labels=[];b.data.ys.forEach(function(a,c){this.labels.push(this.addLabel(a))}.bind(this));"bar"==b.graphStyle&&1<b.data.ys.length&&(this.allLabel=this.addLabel({label:"All",outside:!0}));"area"==b.graphStyle&&(this.pieLabel=this.addLabel({label:"pie",outside:!0}));this.tooltipOnHover=this.isTouch?!1:b.data.tooltipOnHover;"bar"!=b.graphStyle?(this.$line=document.createElement("div"),this.$line.className="tchart--line",b.$parent.appendChild(this.$line),this.$lineFill=document.createElement("div"),this.$line.appendChild(this.$lineFill),"area"!=b.graphStyle&&(this.points=b.data.ys.map(function(a,c){var e=document.createElement("span");this.$line.appendChild(e);return e}.bind(this)))):(b.state.barInd=-1,b.state.barO=0);this.onMouseMove=this.onMouseMove.bind(this);this.onMouseLeave=this.onMouseLeave.bind(this);this.onBodyClick=this.onBodyClick.bind(this);this.onTipClick=this.onTipClick.bind(this);this.tooltipOnHover?(this.$canvas.addEventListener("mousemove",function(a){this.canvasPos=this.canvasPos||t.TUtils.getElemPagePos(this.$canvas);this.dx=a.pageX-this.canvasPos.x;this.dy=a.pageY-this.canvasPos.y;(this.tp=this.getTp(this.dx,this.dy-this.opts.state.dims.tip.t,this.isTouch))?this.shown?this.render({isMove:!0}):(delete this.prevXInd,this.toggle(!0),this.render({})):this.toggle(!1)}.bind(this)),this.$canvas.addEventListener("mouseleave",function(){delete this.canvasPos;this.toggle(!1)}.bind(this)),this.$canvas.addEventListener("click",function(a){if(this.shown)this.onTipClick(a)}.bind(this)),this.$tip.style.pointerEvents="none"):(this.drag=new t.TDrag({$el:this.$canvas,onDragStart:function(a){this.canvasPos=t.TUtils.getElemPagePos(this.$canvas);this.dx=a.pageX-this.canvasPos.x;this.dy=a.pageY-this.canvasPos.y;this.tp=this.getTp(this.dx,this.dy-this.opts.state.dims.tip.t,a.isTouch);delete this.prevXInd;clearTimeout(this.showTimeout);this.showTimeout=setTimeout(function(){this.toggle(!!this.tp);this.tp&&this.render()}.bind(this),this.isTouch?100:30);document.body.removeEventListener("click",this.onBodyClick);return!this.tp}.bind(this),onDragMove:function(a){a.canceled?(clearTimeout(this.showTimeout),this.toggle(!1)):(this.canvasPos=this.canvasPos||t.TUtils.getElemPagePos(this.$canvas),this.dx=a.pageX-this.canvasPos.x,this.dy=a.pageY-this.canvasPos.y,this.render({isMove:!0}))}.bind(this),onDragEnd:function(a){delete this.canvasPos;this.bodyTimeout=setTimeout(function(){document.body.addEventListener("click",this.onBodyClick)}.bind(this),140)}.bind(this)}),this.$tip.addEventListener("click",this.onTipClick));this.trackMouse(!0);this.updateColors()};C.prototype={onResize:function(b){b=this.opts.state.dims.tip;if(this.$line){var a="area"==this.opts.graphStyle?25:16;this.$line.style.top=b.t+"px";this.$line.style.height=b.h+"px";this.$lineFill.style.top=a+"px";this.$lineFill.style.bottom=this.opts.settings.PADD[2]+1+"px"}this.render()},abortDetailCallbacks:function(){this.detailCallbacks&&(this.detailCallbacks.forEach(function(b,a){b.cancelled=!0}),delete this.detailCallbacks)},onTipClick:function(b){if(void 0!=this.prevXInd&&this.opts.additional.onClick&&this.opts.data.hasDetail&&!this.opts.state.zoomMode&&!this.opts.state.zoomModeSpecial&&(b.stopPropagation(),!this.$tip.classList.contains("tchart--tip__loading"))){var a=this.opts.data.x[this.prevXInd];if(this.opts.data.detailsFunc)if(this.$tip.classList.remove("tchart--tip__error"),this.$tip.classList.add("tchart--tip__loading"),this.cache[a])this.toggle(!1,!0),this.opts.additional.onClick(!0,a,this.cache[a]),this.$tip.classList.remove("tchart--tip__loading");else{this.abortDetailCallbacks();b=this.opts.data.detailsFunc(a);var c=this;this.detailCallbacks=this.detailCallbacks||[];var e=function(f){e.cancelled||(c.$tip.classList.remove("tchart--tip__loading"),f&&f.columns?(c.toggle(!1,!0),c.opts.additional.onClick(!0,a,f),c.cache[a]=f):c.$tip.classList.add("tchart--tip__error"))},d=function(f){d.cancelled||(console.log("error:",f),c.$tip.classList.remove("tchart--tip__loading"),c.$tip.classList.add("tchart--tip__error"))};this.detailCallbacks.push(e);this.detailCallbacks.push(d);b.then(e)["catch"](d)}else this.toggle(!1,!0),this.opts.additional.onClick(!0,a)}},updateColors:function(){var b=this.opts.data.ys;this.labels.forEach(function(a,c){this.points&&(this.points[c].style.borderColor=this.isDarkMode?b[c].colors_n[0]:b[c].colors_d[0]);a.$value.style.color=this.isDarkMode?b[c].colors_n[2]:b[c].colors_d[2]}.bind(this));this.allLabel&&(this.allLabel.$value.style.color=this.isDarkMode?"#fff":"#000");this.$lineFill&&(this.$lineFill.style.backgroundColor=this.isDarkMode?"rgba(255, 255, 255, 0.1)":"rgba(24, 45, 59, 0.1)")},setDarkMode:function(b){this.isDarkMode=b;this.updateColors()},addLabel:function(b){var a=document.createElement("div");a.className="tchart--tip-row";b.outside?(this.$tip.appendChild(a),a.classList.add("tchart--tip-row__outside")):this.$tipScroller.appendChild(a);var c=document.createElement("span");a.appendChild(c);var e=document.createTextNode("");e.nodeValue=b.label;c.appendChild(e);if("area"==this.opts.graphStyle){var d=document.createElement("p");a.appendChild(d);var f=document.createTextNode("");d.appendChild(f)}b=document.createElement("div");a.appendChild(b);var g=document.createTextNode("");b.appendChild(g);return{$row:a,$value:b,$valueText:g,$label:c,$labelText:e,$per:d,$perText:f}},getTp:function(b,a,c){if("area"==this.opts.graphStyle&&this.opts.state.zoomMode){var e=this.opts.state.dims.graph;c=e.w/2;e=e.h/2;return Math.pow((e-a)*(e-a)+(b-c)*(b-c),.5)<=this.opts.settings.PIE_RADIUS?"graph":""}e=this.opts.state.dims.tip;return 0>a||a>e.h?"":"graph"},trackMouse:function(b,a){this.isTouch||(this.$canvas.addEventListener("mousemove",this.onMouseMove),this.$canvas.addEventListener("mouseleave",this.onMouseLeave))},onMouseLeave:function(){this.$canvas.classList.remove("tchart--graph-canvas__tip-pointer");delete this.canvasPos},onMouseMove:function(b){this.canvasPos=this.canvasPos||t.TUtils.getElemPagePos(this.$canvas);b=this.getTp(b.pageX-this.canvasPos.x,b.pageY-this.canvasPos.y-this.opts.state.dims.tip.t,!1);this.onMouseLeave();b&&this.$canvas.classList.add("tchart--graph-canvas__tip-pointer")},toggle:function(b,a){var c=this.opts,e=c.state;b&&!this.shown&&(this.$tip.classList.add("tchart--tip__visible"),!this.opts.data.hasDetail||this.opts.state.zoomMode||this.opts.state.zoomModeSpecial?this.$tip.classList.remove("tchart--tip__has-zoom"):this.$tip.classList.add("tchart--tip__has-zoom"),this.$tip.classList.remove("tchart--tip__shiftHide"),this.$line&&this.$line.classList.add("tchart--line__visible"),t.TUtils.triggerEvent("chart-hide-tips",{except:this.opts.chart}));if(!b&&this.shown){delete this.lastCurPieItemInd;if("area"==c.graphStyle&&e.zoomMode){for(var d=[],f=0;f<e.pieAngles.length;f++)d.push({prop:"pieInd_"+e.pieAngles[f].ind,state:c.state,end:0,duration:350,tween:"exp",speed:.2,group:{top:!0}});c.animator.add(d)}a&&(this.$tip.classList.add("tchart--tip__shiftHide"),this.lastTipTop-=12,this.lastTipLeft=this.lastTipLeft<this.opts.state.dims.tip.w/2?this.lastTipLeft-12:this.lastTipLeft+12,this.$tip.style.transform="translate("+this.lastTipLeft+"px,"+this.lastTipTop+"px)",this.$tip.style.webkitTransform="translate("+this.lastTipLeft+"px,"+this.lastTipTop+"px)");this.$tip.classList.remove("tchart--tip__visible");this.$line&&this.$line.classList.remove("tchart--line__visible");this.abortDetailCallbacks();this.$tip.classList.remove("tchart--tip__error");this.$tip.classList.remove("tchart--tip__loading");"bar"==this.opts.graphStyle&&this.opts.animator.add([{prop:"barInd",state:this.opts.state,end:-1,duration:0,delay:150,tween:"linear",group:{top:!0}},{prop:"barO",state:this.opts.state,end:0,duration:150,tween:"exp",speed:.3,group:{top:!0}}]);document.body.removeEventListener("click",this.onBodyClick)}this.shown=b},onBodyClick:function(b){b.target!=this.$canvas&&this.toggle(!1)},renderPieTooltip:function(b){var a=this.opts,c=a.state,e=this.opts.settings;b=e.PADD[0];var d=e.PADD[1],f=e.PADD[2];e=e.PADD[3];var g=c.dims.graph,h=c.dims.tip,k=g.w/2,m=g.h/2,w=t.TUtils.getFormatter("yTooltipFormatter",a.data,c.zoomMorph);m=Math.atan2(m-this.dy+g.t,this.dx-k);m=0>m?2*Math.PI+m:m;var r;for(g=0;g<c.pieAngles.length;g++)k=c.pieAngles[g],m<=k.st&&m>=k.ed&&(r=k),m-2*Math.PI<=k.st&&m-2*Math.PI>=k.ed&&(r=k);if(this.lastCurPieItemInd!=r.ind){m=[];for(g=0;g<c.pieAngles.length;g++)k=c.pieAngles[g],m.push({prop:"pieInd_"+k.ind,state:a.state,end:k==r?1:0,duration:350,tween:"exp",speed:.2,group:{top:!0}});a.animator.add(m)}this.pieLabel.$row.style.display="block";this.labels.forEach(function(q,n){q.$row.style.display="none"}.bind(this));this.pieLabel.$labelText.nodeValue=r.label;this.pieLabel.$valueText.nodeValue=isNaN(r.value)?"n/a":w(r.value);this.pieLabel.$value.style.color=r.color;this.$tip.classList.add("tchart--tip__piemode");this.$line&&this.$line.classList.add("tchart--line__piemode");this.tipH=this.$tip.offsetHeight;this.tipW=this.$tip.offsetWidth;a=this.dx-this.tipW/2;f=Math.min(this.dy-20-this.tipH,h.t+h.h-this.tipH-f);f<h.t+b&&(f=h.t+b);a=Math.min(Math.max(a,e/2),h.w-this.tipW-d/2);this.$tip.style.transform="translate("+(a<<0)+"px,"+(f<<0)+"px)";this.$tip.style.webkitTransform="translate("+(a<<0)+"px,"+(f<<0)+"px)";this.lastCurPieItemInd=r.ind;this.updateTipScrollClasses()},render:function(b){if(this.shown){var a=this.opts,c=a.state,e=this.opts.settings,d=e.PADD[0],f=e.PADD[1],g=e.PADD[2];e=e.PADD[3];var h,k,m,w=0,r=this.opts.state.dims.tip,q=t.TUtils.getFormatter("yTooltipFormatter",a.data,c.zoomMorph),n=("bar"==a.graphStyle||"step"==a.graphStyle?this.opts.data.mainPeriodLen:0)*(1-(void 0==c.zoomMorph?0:c.zoomMorph));b=b||{};this.abortDetailCallbacks();this.$tip.classList.remove("tchart--tip__error");this.$tip.classList.remove("tchart--tip__loading");if("area"==a.graphStyle&&c.zoomMode)this.renderPieTooltip(b);else{this.pieLabel&&(this.pieLabel.$row.style.display="none");var p=t.TUtils.getXIndex(a.data.x,c.x1+(Math.max(Math.min(this.dx,r.w-1),0)-e)/(r.w-f-e)*(c.x2-c.x1+n)),l="bar"==a.graphStyle||"step"==a.graphStyle?Math.floor(p):Math.round(p);if("bar"!==a.graphStyle&&"step"!==a.graphStyle)p=(a.data.x[l]-c.x1)/(c.x2-c.x1+n),p=p*(r.w-e-f)+e<<0,0>p&&l++,p>r.w-1&&l--;else if(this.opts.state.zoomMode||this.opts.state.zoomModeSpecial)l<a.state.detailInd1&&l++,l>a.state.detailInd2&&l--;"bar"==a.graphStyle&&a.animator.add([{prop:"barInd",state:a.state,end:l,duration:0,tween:"linear",group:{top:!0}},{prop:"barO",state:this.opts.state,end:1,duration:150,tween:"exp",speed:.3,group:{top:!0}}]);if(this.prevXInd!=l||!b.isMove){this.$tip.classList.remove("tchart--tip__piemode");this.$line&&this.$line.classList.remove("tchart--line__piemode");this.labels.forEach(function(E,F){var G=a.state["e_"+F]&&!isNaN(a.data.ys[F].y[l])?"block":"none";E.$row.style.display=G;this.points&&(this.points[F].style.display=G);w+="block"==G?1:0}.bind(this));this.itemsVisible=w;this.allLabel&&(this.allLabel.$row.style.display=1<w?"block":"none");this.itemsVisible?(this.$tip.classList.remove("tchart--tip__has_no_items"),this.$line&&this.$line.classList.remove("tchart--line__has_no_items")):(this.$tip.classList.add("tchart--tip__has_no_items"),this.$line&&this.$line.classList.add("tchart--line__has_no_items"));p=0;"step"==a.graphStyle&&(p=this.opts.state.zoomMode?a.data.detailPeriodLen:a.data.mainPeriodLen);p=(a.data.x[l]-c.x1+p/2)/(c.x2-c.x1+n);p=p*(r.w-e-f)+e<<0;this.$line&&(this.$line.style.transform="translateX("+p+"px)");this.$line&&(this.$line.style.webkitTransform="translateX("+p+"px)");this.$tipDtText.nodeValue=a.data.dates[l];var u=0;a.data.ys.forEach(function(E,F){if(a.state["e_"+F]&&!isNaN(E.y[l])&&(this.labels[F].$valueText.nodeValue=q(E.y[l]),u+=E.y[l]||0,this.points)){h=this.points[F];a.pairY?(k=c["y1_"+F],m=c["y2_"+F]):(k=c.y1,m=c.y2);var G=(E.y[l]-k)/(m-k);h.style.transform="translateY("+(r.h-G*(r.h-d-g)-g<<0)+"px)";h.style.webkitTransform="translateY("+(r.h-G*(r.h-d-g)-g<<0)+"px)"}}.bind(this));this.allLabel&&(this.allLabel.$valueText.nodeValue=q(u));b.isMove||(this.maxDateWidth=this.maxPercentageWidth=this.maxValueWidth=this.maxLabelWidth=0,b=window.getComputedStyle(this.$tip),this.rowPaddings=parseInt(b.getPropertyValue("padding-left"),10)+parseInt(b.getPropertyValue("padding-right"),10));"area"==a.graphStyle&&this.fillPercentages(l,u);this.labels.forEach(function(E,F){if(a.state["e_"+F]&&!isNaN(a.data.ys[F].y[l])){var G=E.$label.offsetWidth;G>this.maxLabelWidth&&(this.maxLabelWidth=G);G=E.$value.offsetWidth;G>this.maxValueWidth&&(this.maxValueWidth=G)}}.bind(this));b=this.rowPaddings+this.maxLabelWidth+20+this.maxValueWidth;b+="area"==a.graphStyle?this.maxPercentageWidth:0;n=this.rowPaddings+this.$tipDt.offsetWidth+20;n>this.maxDateWidth&&(this.maxDateWidth=n);b=Math.max(b,this.maxDateWidth);this.$tip.style.width=b+"px";this.tipH=this.$tip.offsetHeight;this.tipW=this.$tip.offsetWidth}b=2>=this.itemsVisible?"center":"side";if("center"==b){var B=this.dx-this.tipW/2,D=Math.min(this.dy-20-this.tipH,r.t+r.h-this.tipH-g);D<r.t+d&&(b="side")}"side"==b&&(B=this.dx>r.w/2?this.dx-this.tipW-20:this.dx+20,D=Math.min(Math.max(this.dy-this.tipH/2,r.t+d),r.t+r.h-this.tipH-g));B=Math.min(Math.max(B,e/2),r.w-this.tipW-f/2);this.$tip.style.transform="translate("+(B<<0)+"px,"+(D<<0)+"px)";this.$tip.style.webkitTransform="translate("+(B<<0)+"px,"+(D<<0)+"px)";this.lastTipLeft=B<<0;this.lastTipTop=D<<0;this.prevXInd=l;this.updateTipScrollClasses()}}},updateTipScrollClasses:function(){this.$tipScroller.scrollHeight>this.$tipScroller.offsetHeight?this.$tip.classList.add("tchart--tip__scroll"):this.$tip.classList.remove("tchart--tip__scroll");0>=this.$tipScroller.scrollTop?this.$tip.classList.remove("tchart--tip__has_less"):this.$tip.classList.add("tchart--tip__has_less");this.$tipScroller.scrollTop>=this.$tipScroller.scrollHeight-this.$tipScroller.offsetHeight?this.$tip.classList.remove("tchart--tip__has_more"):this.$tip.classList.add("tchart--tip__has_more")},fillPercentages:function(b,a){var c=this.opts,e=[],d=2;c.data.ys.forEach(function(f,g){if(c.state["e_"+g]){e[g]=Math.max(Math.round(100*f.y[b]/a),0);if(isNaN(f.y[b])||0==a)e[g]=0;100==e[g]&&(d=3)}}.bind(this));c.data.ys.forEach(function(f,g){if(c.state["e_"+g]){var h=8*d+17;this.labels[g].$label.style.transform="translateX("+h+"px)";this.labels[g].$label.style.webkitTransform="translateX("+h+"px)";this.labels[g].$perText.nodeValue=e[g]+"%";this.labels[g].$per.style.width=h-7+"px";h>this.maxPercentageWidth&&(this.maxPercentageWidth=h)}}.bind(this))}};t.TTip=C})();(function(){Math.log2=Math.log2||function(c){return Math.log(c)*Math.LOG2E};Math.log10=Math.log10||function(c){return Math.log(c)*Math.LOG10E};var t="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),C="Sun Mon Tue Wed Thu Fri Sat".split(" "),b="January February March April May June July August September October November December".split(" "),a={simplifyData:function(c,e,d,f,g,h,k,m,w){c=(m-k)/w;w=[];var r=[];if(1>=c)return{xInd1:k,xInd2:m,x:e,ys:d};for(var q=0,n=-999999999,p=h.length,l;k<=m;k++){var u=e[k]*f+g<<0;(n=u>n)?(w[q]=e[k],q++):l++;for(j=0;j<p;j++){var B=h[j];r[B]=r[B]||{y:[]};var D=d[B].y[k];r[B].y[q-1]=void 0==r[B].y[q-1]?D:r[B].y[q-1]+D;1<q&&(n&&(r[B].y[q-2]/=l),k==m&&(r[B].y[q-1]/=l))}n&&(l=1);n=u}return{isOptimized:1<c,xInd1:0,xInd2:q-1,x:w,ys:r}},getElemPagePos:function(c){c=c.getBoundingClientRect();return{x:c.left+(window.pageXOffset||document.documentElement.scrollLeft),y:c.top+(window.pageYOffset||document.documentElement.scrollTop)}},getXIndex:function(c,e,d){var f=0,g=c.length-1;for(d||(e<c[f]?e=c[f]:e>c[g]&&(e=c[g]));1<Math.abs(f-g);)d=Math.round((f+g)/2),e>=c[f]&&e<=c[d]?g=d:f=d;return f+(e-c[f])/(c[g]-c[f])},triggerEvent:function(c,e){"function"==typeof window.CustomEvent&&document.dispatchEvent(new CustomEvent(c,{detail:e||null}))},isTouchDevice:function(){if("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)return!0;var c=["("," -webkit- -moz- -o- -ms- ".split(" ").join("touch-enabled),("),"heartz)"].join("");return window.matchMedia(c).matches},drawRoundedRect:function(c,e,d,f,g,h,k){d*=e;f*=e;g*=e;h*=e;"number"==typeof k&&(k=[k,k,k,k]);k[0]*=e;k[1]*=e;k[2]*=e;k[3]*=e;c.beginPath();c.moveTo(g+k[0],h);c.lineTo(g+d-k[1],h);c.quadraticCurveTo(g+d,h,g+d,h+k[1]);c.lineTo(g+d,h+f-k[2]);c.quadraticCurveTo(g+d,h+f,g+d-k[2],h+f);c.lineTo(g+k[3],h+f);c.quadraticCurveTo(g,h+f,g,h+f-k[3]);c.lineTo(g,h+k[0]);c.quadraticCurveTo(g,h,g+k[0],h);c.closePath()},drawRoundedRect2:function(c,e,d,f,g,h,k){d*=e;f*=e;g*=e;h*=e;k*=e;d<2*k&&(k=d/2);f<2*k&&(k=f/2);c.beginPath();c.moveTo(g+k,h);c.arcTo(g+d,h,g+d,h+f,k);c.arcTo(g+d,h+f,g,h+f,k);c.arcTo(g,h+f,g,h,k);c.arcTo(g,h,g+d,h,k);c.closePath()},getFormatter:function(c,e,d){var f;.5<d&&e.details&&(f=e.details[c]);return f||e[c]||a[c]},xTooltipFormatter:function(c,e){var d=new Date(c);d=[d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate(),d.getUTCDay(),d.getUTCHours(),d.getUTCMinutes()];return e?(10>d[4]?"0":"")+d[4]+":"+(10>d[5]?"0":"")+d[5]:C[d[3]]+", "+d[2]+" "+t[d[1]]+" "+d[0]},xTickFormatter:function(c,e){var d=new Date(c);d=[d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate(),d.getUTCDay(),d.getUTCHours(),d.getUTCMinutes()];return e?(10>d[4]?"0":"")+d[4]+":"+(10>d[5]?"0":"")+d[5]:d[2]+" "+t[d[1]]},xRangeFormatter:function(c,e){var d=new Date(c);d=[d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()];return d[2]+" "+b[d[1]]+" "+d[0]},yTickFormatter:function(c,e,d){return 0==c?0:1E3>e?Math.floor(c):1E3<=e&&1E6>e?d?Math.floor(10*c/1E3)/10+"K":Math.round(c/1E3)+"K":d?Math.floor(10*c/1E6)/10+"M":Math.round(c/1E6)+"M"},yTooltipFormatter:function(c){return"number"!==typeof c?"string"===typeof c?c:"?":a.statsFormatKMBT(c)},statsFormatKMBT:function(c,e,d){if(0==c)return"0";null==e&&(e=a.statsChooseNumKMBT(c));c=a.statsFormatFixedKMBT(c,e);null==d&&(d=a.statsChoosePrecision(c));return c.toFixed(d)+e},statsFormatFixedKMBT:function(c,e){switch(e){case "K":return c/1E3;case "M":return c/1E6;case "B":return c/1E9;case "T":return c/1E12}return c},statsChoosePrecision:function(c){c=Math.abs(c);return 10<c?0:1<=c?.001>Math.abs(c-Math.floor(c))?0:1:2},statsChooseNumKMBT:function(c){c=Math.abs(c);return 1E12<=c?"T":1E9<=c?"B":1E6<=c?"M":2E3<=c?"K":""},roundRange:function(c,e,d,f){1>Math.abs(e-c)&&(c-=c/10,e+=e/10);if(f)return{yMin:c-(f.yMinOrig-f.yMin)/(f.yMaxOrig-f.yMinOrig)*(e-c),yMax:e+(f.yMax-f.yMaxOrig)/(f.yMaxOrig-f.yMinOrig)*(e-c),yMinOrig:c,yMaxOrig:e};f=function(q){var n=k*q;q=Math.floor(c/n)*n;n=q+d*Math.ceil((e-q)*g/n)*n;return{good:n<=w&&q>=m,yMin:Math.round(q),yMax:Math.round(n),yMinOrig:c,yMaxOrig:e}};for(var g=1/d,h=(e-c)*g,k=Math.max(Math.pow(10,Math.floor(Math.log10(h))),1),m=c-.5*h,w=e+.5*h,r=1;;){h=f(5);if(h.good)break;h=f(2);if(h.good)break;h=f(1);if(h.good)break;k*=.1;r++;if(10<r)return{yMinOrig:c,yMaxOrig:e,yMin:c,yMax:e}}return h}};window.Graph.units.TUtils=a})(); |