  /*!
 * @license
 * TradingView Lightweight Charts v2.1.0-dev+202005300152
 * Copyright (c) 2019 TradingView, Inc.
 * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
 */
!function(){"use strict";var t,i;function n(t,i){var n,s=((n={})[0]=[],n[1]=[t.lineWidth,t.lineWidth],n[2]=[2*t.lineWidth,2*t.lineWidth],n[3]=[6*t.lineWidth,6*t.lineWidth],n[4]=[t.lineWidth,4*t.lineWidth],n)[i];t.setLineDash(s)}function s(t,i,n,s){t.beginPath();var h=t.lineWidth%2?.5:0;t.moveTo(n,i+h),t.lineTo(s,i+h),t.stroke()}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps"}(t||(t={})),function(t){t[t.Solid=0]="Solid",t[t.Dotted=1]="Dotted",t[t.Dashed=2]="Dashed",t[t.LargeDashed=3]="LargeDashed",t[t.SparseDotted=4]="SparseDotted"}(i||(i={}));var h=function(t,i){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])})(t,i)};function r(t,i){function n(){this.constructor=t}h(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var e=function(){return(e=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var h in i=arguments[n])Object.prototype.hasOwnProperty.call(i,h)&&(t[h]=i[h]);return t}).apply(this,arguments)};function u(){for(var t=0,i=0,n=arguments.length;i<n;i++)t+=arguments[i].length;var s=Array(t),h=0;for(i=0;i<n;i++)for(var r=arguments[i],e=0,u=r.length;e<u;e++,h++)s[h]=r[e];return s}function o(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function a(t){if(void 0===t)throw new Error("Value is undefined");return t}function f(t){if(null===t)throw new Error("Value is null");return t}function l(t){return f(a(t))}function c(t){for(var i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];for(var s=0,h=i;s<h.length;s++){var r=h[s];for(var e in r)void 0!==r[e]&&("object"!=typeof r[e]||void 0===t[e]?t[e]=r[e]:c(t[e],r[e]))}return t}function v(t){return"number"==typeof t&&isFinite(t)}function _(t){return"number"==typeof t&&t%1==0}function d(t){return"string"==typeof t}function w(t){return!(t<=0||t>0)}function M(t){return"boolean"==typeof t}function b(t){var i,n,s,h=t;if(!h||"object"!=typeof h)return h;for(n in i=Array.isArray(h)?[]:{},h)h.hasOwnProperty(n)&&(s=h[n],i[n]=s&&"object"==typeof s?b(s):s);return i}function m(t){return null!==t}function p(t){return null===t?void 0:t}var g=function(){function t(){this.t=[]}return t.prototype.i=function(t){this.t=t},t.prototype.s=function(t,i,n,s){this.t.forEach((function(h){t.save(),h.s(t,i,n,s),t.restore()}))},t}(),y=function(){function t(){}return t.prototype.s=function(t,i,n,s){t.save(),t.scale(i,i),this.h(t,n,s),t.restore()},t.prototype.u=function(t,i,n,s){t.save(),t.scale(i,i),this.o(t,n,s),t.restore()},t.prototype.o=function(t,i,n){},t}(),k=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.l=null,i}return r(i,t),i.prototype.v=function(t){this.l=t},i.prototype.h=function(t){if(null!==this.l&&null!==this.l._){var i=this.l._,n=this.l,s=function(s){t.beginPath();for(var h=i.to-1;h>=i.from;--h){var r=n.M[h];t.moveTo(r.m,r.p),t.arc(r.m,r.p,s,0,2*Math.PI)}t.fill()};t.fillStyle=n.g,s(n.k+2),t.fillStyle=n.N,s(n.k)}},i}(y);var N,x,S,D,C={from:0,to:1},T=function(){function t(t,i){this.S=new g,this.D=[],this.C=[],this.T=!0,this.A=t,this.L=i,this.S.i(this.D)}return t.prototype.B=function(t){var i=this,n=this.A.V();n.length!==this.D.length&&(this.C=n.map((function(){return{M:[{m:0,p:0,F:0,P:0}],N:"",g:i.A.O().layout.backgroundColor,k:0,_:null}})),this.D=this.C.map((function(t){var i=new k;return i.v(t),i})),this.S.i(this.D)),this.T=!0},t.prototype.I=function(t,i,n){return this.T&&(this.R(),this.T=!1),this.S},t.prototype.R=function(){var t=this,i=this.A.V(),n=this.L.W(),s=this.A.j();i.forEach((function(i,h){var r=t.C[h],e=i.U(n);if(null!==e){
try{
    var u=f(i.q());
    r.N=i.K().Y(n).H,r.g=t.A.O().layout.backgroundColor,r.k=e.k,r.M[0].P=e.P,r.M[0].p=i.X().$(e.P,u.Z),r.M[0].F=n,r.M[0].m=s.J(n),r._=C
}catch(err){
    console.log('TODO: debug error!!: %s',err.message);
}

}else r._=null}))},t}(),E=function(){function t(t){this.G=t}return t.prototype.s=function(t,i,h,r){if(null!==this.G){var e=this.G.it.tt,u=this.G.nt.tt;if(e||u){t.save();var o=Math.round(this.G.m*i),a=Math.round(this.G.p*i),f=Math.ceil(this.G.st*i),l=Math.ceil(this.G.ht*i);t.lineCap="butt",e&&o>=0&&(t.lineWidth=Math.floor(this.G.it.rt*i),t.strokeStyle=this.G.it.et,t.fillStyle=this.G.it.et,n(t,this.G.it.ut),function(t,i,n,s){t.beginPath();var h=t.lineWidth%2?.5:0;t.moveTo(i+h,n),t.lineTo(i+h,s),t.stroke()}(t,o,0,l)),u&&a>=0&&(t.lineWidth=Math.floor(this.G.nt.rt*i),t.strokeStyle=this.G.nt.et,t.fillStyle=this.G.nt.et,n(t,this.G.nt.ut),s(t,a,0,f)),t.restore()}}},t}(),A=function(){function t(t){this.T=!0,this.ot={it:{rt:1,ut:0,et:"",tt:!1},nt:{rt:1,ut:0,et:"",tt:!1},st:0,ht:0,m:0,p:0},this.at=new E(this.ot),this.ft=t}return t.prototype.B=function(){this.T=!0},t.prototype.I=function(t,i){return this.T&&this.R(),this.at},t.prototype.R=function(){var t=this.ft.tt(),i=f(this.ft.lt()),n=i.ct().O().crosshair,s=this.ot;s.nt.tt=t&&this.ft.vt(i),s.it.tt=t&&this.ft._t(),s.nt.rt=n.horzLine.width,s.nt.ut=n.horzLine.style,s.nt.et=n.horzLine.color,s.it.rt=n.vertLine.width,s.it.ut=n.vertLine.style,s.it.et=n.vertLine.color,s.st=i.dt(),s.ht=i.wt(),s.m=this.ft.Mt(),s.p=this.ft.bt()},t}(),L={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",feldspar:"#d19275",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslateblue:"#8470ff",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",violetred:"#d02090",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function B(t){return function(t,i,n){return w(i)||i<t?t:i>n?n:Math.round(i)}(0,t,255)}function V(t){return function(t,i,n){return w(i)||i<t?t:i>n?n:Math.round(1e4*i)/1e4}(0,t,1)}function z(t){(t=t.toLowerCase())in L&&(t=L[t]);var i,n,s=(i=t,null!==(n=S.re.exec(i))?S.parse(n):null);if(null!==s)return s;var h=function(t){var i=x.re.exec(t);return null!==i?x.parse(i):null}(t);if(null!==h)return h;var r=function(t){var i=N.re.exec(t);return null!==i?N.parse(i):null}(t);if(null!==r)return r;var e=function(t){var i=D.re.exec(t);return null!==i?D.parse(i):null}(t);return null!==e?[e[0],e[1],e[2]]:null}function F(t){var i=z(t);if(null!==i)return i;throw new Error("Passed color string "+t+" does not match any of the known color representations")}function P(t,i){if(i<0||i>255)throw new Error("invalid threshold value, valid values are [0, 255]");return function(t){return.199*t[0]+.687*t[1]+.114*t[2]}(t)>=i?"white":"black"}function O(t){return function(t){return 0===t.indexOf("#")}(t)?t:(n=F(t),s=1,"rgba("+(i=[n[0],n[1],n[2],V(s)])[0]+", "+i[1]+", "+i[2]+", "+i[3]+")");var i,n,s}function I(t){return"black"===P(F(t),160)?"white":"black"}function R(t,i,n,s,h,r){t.fillRect(i,n,r,h),t.fillRect(i+r,n,s-2*r,r),t.fillRect(i+r,n+h-r,s-2*r,r),t.fillRect(i+s-r,n,r,h)}function W(t,i,n){t.save(),t.scale(i,i),n(),t.restore()}function j(t,i,n,s,h,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,n,s,h),t.restore()}!function(t){t.re=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/,t.parse=function(t){return[B(parseInt(t[1]+t[1],16)),B(parseInt(t[2]+t[2],16)),B(parseInt(t[3]+t[3],16))]}}(N||(N={})),function(t){t.re=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,t.parse=function(t){return[B(parseInt(t[1],16)),B(parseInt(t[2],16)),B(parseInt(t[3],16))]}}(x||(x={})),function(t){t.re=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,t.parse=function(t){return[B(parseInt(t[1],10)),B(parseInt(t[2],10)),B(parseInt(t[3],10))]}}(S||(S={})),function(t){t.re=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?[\d]{0,10}(?:\.\d+)?)\s*\)$/,t.parse=function(t){return[B(parseInt(t[1],10)),B(parseInt(t[2],10)),B(parseInt(t[3],10)),V(parseFloat(t[4]))]}}(D||(D={}));var U,q=function(){function t(t,i){this.v(t,i)}return t.prototype.v=function(t,i){this.G=t,this.pt=i},t.prototype.s=function(t,i,n,s,h,r){if(this.G.tt){t.font=i.gt;var e=this.G.yt?i.kt:0,u=i.Nt,o=i.xt,a=i.St,f=i.Dt,l=i.Ct,c=this.G.Tt,v=Math.ceil(n.Et(t,c)),_=i.At,d=i.Lt+o+a,w=Math.ceil(.5*d),M=u+v+f+l+e,b=this.pt.Bt;this.pt.Vt&&(b=this.pt.Vt);var m,p,g=(b=Math.round(b))-w,y=g+d,k="right"===h,N=k?s:0,x=Math.ceil(s*r),S=N;if(t.fillStyle=O(this.pt.zt),t.lineWidth=1,t.lineCap="butt",c){k?(m=N-e,p=(S=N-M)+l):(S=N+M,m=N+e,p=N+u+e+f);var D=Math.max(1,Math.floor(r)),C=Math.max(1,Math.floor(u*r)),T=k?x:0,E=Math.round(g*r),A=Math.round(S*r),L=Math.round(b*r)-Math.floor(.5*r),B=L+D+(L-E),V=Math.round(m*r);t.save(),t.beginPath(),t.moveTo(T,E),t.lineTo(A,E),t.lineTo(A,B),t.lineTo(T,B),t.fill(),t.fillStyle=this.G.Ft,t.fillRect(k?x-C:0,E,C,B-E),this.G.yt&&(t.fillStyle=this.pt.et,t.fillRect(T,L,V-T,D)),t.textAlign="left",t.fillStyle=this.pt.et,W(t,r,(function(){t.fillText(c,p,y-a-_)})),t.restore()}}},t.prototype.wt=function(t,i){return this.G.tt?t.Lt+t.xt+t.St:0},t}(),H=function(){function t(t){this.Pt={Bt:0,et:"#FFF",zt:"#000"},this.Ot={Tt:"",tt:!1,yt:!0,Ft:""},this.It={Tt:"",tt:!1,yt:!1,Ft:""},this.T=!0,this.Rt=new(t||q)(this.Ot,this.Pt),this.Wt=new(t||q)(this.It,this.Pt)}return t.prototype.Tt=function(){return this.Ot.Tt},t.prototype.zt=function(){return this.Pt.zt},t.prototype.et=function(){return I(this.zt())},t.prototype.Bt=function(){return this.jt(),this.Pt.Bt},t.prototype.B=function(){this.T=!0},t.prototype.wt=function(t,i){return void 0===i&&(i=!1),Math.max(this.Rt.wt(t,i),this.Wt.wt(t,i))},t.prototype.Ut=function(){return this.Pt.Vt||0},t.prototype.qt=function(t){this.Pt.Vt=t},t.prototype.Ht=function(){return this.jt(),this.Ot.tt||this.It.tt},t.prototype.Yt=function(){return this.jt(),this.Ot.tt},t.prototype.Kt=function(){return this.jt(),this.It.tt},t.prototype.I=function(){return this.jt(),this.Rt.v(this.Ot,this.Pt),this.Wt.v(this.It,this.Pt),this.Rt},t.prototype.$t=function(){return this.jt(),this.Rt.v(this.Ot,this.Pt),this.Wt.v(this.It,this.Pt),this.Wt},t.prototype.jt=function(){this.T&&(this.Xt(this.Ot,this.It,this.Pt),this.T=!1)},t}(),Y=function(t){function i(i,n,s){var h=t.call(this)||this;return h.ft=i,h.Zt=n,h.Jt=s,h}return r(i,t),i.prototype.Xt=function(t,i,n){t.tt=!1;var s=this.ft.O().horzLine;if(s.labelVisible){var h=this.Zt.q();if(this.ft.tt()&&!this.Zt.Gt()&&null!==h){n.zt=s.labelBackgroundColor,n.et=I(s.labelBackgroundColor);var r=this.Jt(this.Zt);n.Bt=r.Bt,t.Tt=this.Zt.Qt(r.P,h),t.tt=!0}}},i}(H),K=/[1-9]/g,$=function(){function t(){this.G=null}return t.prototype.v=function(t){this.G=t},t.prototype.s=function(t,i,n){var s=this;if(null!==this.G&&!1!==this.G.tt&&0!==this.G.Tt.length){t.font=i.gt;var h=Math.round(i.ti.Et(t,this.G.Tt,K));if(!(h<=0)){t.save();var r=i.ii,e=h+2*r,u=e/2,o=this.G.dt,a=this.G.Bt,l=Math.floor(a-u)+.5;l<0?(a+=Math.abs(0-l),l=Math.floor(a-u)+.5):l+e>o&&(a-=Math.abs(o-(l+e)),l=Math.floor(a-u)+.5);var c=l+e,v=0+i.Nt+i.xt+i.Lt+i.St;t.fillStyle=this.G.zt;var _=Math.round(l*n),d=Math.round(0*n),w=Math.round(c*n),M=Math.round(v*n);t.fillRect(_,d,w-_,M-d);var b=Math.round(this.G.Bt*n),m=d,p=Math.round((m+i.Nt+i.kt)*n);t.fillStyle=this.G.et;var g=Math.max(1,Math.floor(n)),y=Math.floor(.5*n);t.fillRect(b-y,m,g,p-m);var k=v-i.At-i.St;t.textAlign="left",t.fillStyle=this.G.et,W(t,n,(function(){t.fillText(f(s.G).Tt,l+r,k)})),t.restore()}}},t}(),X=function(t){function i(i,n,s){var h=t.call(this)||this;return h.T=!0,h.at=new $,h.ot={tt:!1,zt:"#4c525e",et:"white",Tt:"",dt:0,Bt:NaN},h.L=i,h.ni=n,h.Jt=s,h}return r(i,t),i.prototype.B=function(){this.T=!0},i.prototype.I=function(){return this.T&&(this.R(),this.T=!1),this.at.v(this.ot),this.at},i.prototype.R=function(){var t=this.ot;t.tt=!1;var i=this.L.O().vertLine;if(i.labelVisible){var n=this.ni.j();if(!n.Gt()){var s=n.si(this.L.W());t.dt=n.dt();var h=this.Jt();h.F&&(t.Bt=h.Bt,t.Tt=n.hi(f(s)),t.tt=!0,t.zt=i.labelBackgroundColor,t.et=I(i.labelBackgroundColor))}}},i}(function(){function t(){this.ri="",this.ei="#585858",this.ui=0}return t.prototype.Tt=function(){return this.ri},t.prototype.zt=function(){return this.ei},t.prototype.et=function(){return"black"===P(F(this.ei),150)?"white":"black"},t.prototype.Bt=function(){return this.ui},t}()),Z=function(){function t(){this.oi=null,this.ai=0}return t.prototype.fi=function(){return this.ai},t.prototype.li=function(t){this.ai=t},t.prototype.X=function(){return this.oi},t.prototype.ci=function(t){this.oi=t},t.prototype.vi=function(t,i){return[]},t.prototype._i=function(t){return[]},t.prototype.di=function(){return[]},t}();!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet"}(U||(U={}));var J=function(t){function i(i,n){var s=t.call(this)||this;s.wi=null,s.Mi=NaN,s.bi=0,s.mi=!0,s.pi=new Map,s.gi=!1,s.yi=NaN,s.ki=NaN,s.Ni=NaN,s.xi=NaN,s.ni=i,s.Si=n,s.Di=new T(i,s);var h,r;s.Ci=(h=function(){return s.Mi},r=function(){return s.ki},function(t){var i=r(),n=h();if(t===f(s.wi).Ti())return{P:n,Bt:i};var e=f(t.q());return{P:t.Ei(i,e),Bt:i}});var e=function(t,i){return function(){return{F:s.ni.j().si(t()),Bt:i()}}}((function(){return s.bi}),(function(){return s.Mt()}));return s.Ai=new X(s,i,e),s.Li=new A(s),s}return r(i,t),i.prototype.Bi=function(){return this.bi},i.prototype.O=function(){return this.Si},i.prototype.Vi=function(t,i){this.Ni=t,this.xi=i},i.prototype.zi=function(){this.Ni=NaN,this.xi=NaN},i.prototype.Fi=function(){return this.Ni},i.prototype.Pi=function(){return this.xi},i.prototype.Oi=function(t,i,n){this.gi||(this.gi=!0),this.mi=!0,this.Ii(t,i,n)},i.prototype.W=function(){return this.bi},i.prototype.Mt=function(){return this.yi},i.prototype.bt=function(){return this.ki},i.prototype.tt=function(){return this.mi},i.prototype.Ri=function(){this.mi=!1,this.Wi(),this.Mi=NaN,this.yi=NaN,this.ki=NaN,this.wi=null,this.zi()},i.prototype._i=function(t){return null!==this.wi?[this.Li,this.Di]:[]},i.prototype.vt=function(t){return t===this.wi&&this.Si.horzLine.visible},i.prototype._t=function(){return this.Si.vertLine.visible},i.prototype.vi=function(t,i){this.mi&&this.wi===t||this.pi.clear();var n=[];return this.wi===t&&n.push(this.ji(this.pi,i,this.Ci)),n},i.prototype.di=function(){return this.mi?[this.Ai]:[]},i.prototype.lt=function(){return this.wi},i.prototype.Ui=function(){this.pi.forEach((function(t){return t.B()})),this.Ai.B(),this.Di.B()},i.prototype.qi=function(t){return t&&!t.Ti().Gt()?t.Ti():null},i.prototype.Ii=function(t,i,n){this.Hi(t,i,n)&&this.Ui()},i.prototype.Hi=function(t,i,n){var s=this.yi,h=this.ki,r=this.Mi,e=this.bi,u=this.wi,o=this.qi(n);this.bi=t,this.yi=isNaN(t)?NaN:this.ni.j().J(t),this.wi=n;var a=null!==o?o.q():null;return null!==o&&null!==a?(this.Mi=i,this.ki=o.$(i,a)):(this.Mi=NaN,this.ki=NaN),s!==this.yi||h!==this.ki||e!==this.bi||r!==this.Mi||u!==this.wi},i.prototype.Wi=function(){var t=this.ni.V().map((function(t){return t.Ki().Yi()})).filter(m),i=0===t.length?null:Math.max.apply(Math,t);this.bi=null!==i?i:NaN},i.prototype.ji=function(t,i,n){var s=t.get(i);return void 0===s&&(s=new Y(this,i,n),t.set(i,s)),s},i}(Z),G=".",Q="'";function tt(t,i){if(!v(t))return"n/a";if(!_(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");if(0===i)return t.toString();return("0000000000000000"+t.toString()).slice(-i)}var it=function(){function t(t,i,n,s){if(i||(i=1),v(t)&&_(t)||(t=100),t<0)throw new TypeError("invalid base");this.Zt=t,this.$i=i,this.Xi=s,n&&void 0!==s&&s>0&&2!==s&&4!==s&&8!==s||(this.Zi=n,this.Ji())}return t.prototype.Gi=function(t){var i=t<0?"−":"";return t=Math.abs(t),this.Zi?i+this.Qi(t):i+this.tn(t)},t.prototype.Ji=function(){if(this.in=0,this.Zt>0&&this.$i>0){var t=this.Zt;for(this.Zi&&this.Xi&&(t/=this.Xi);t>1;)t/=10,this.in++}},t.prototype.tn=function(t){var i;i=this.Zi?Math.pow(10,this.in||0):this.Zt/this.$i;var n=Math.floor(t),s="",h=void 0!==this.in?this.in:NaN;if(i>1){var r=+(Math.round(t*i)-n*i).toFixed(this.in);r>=i&&(r-=i,n+=1),s=G+tt(+r.toFixed(this.in)*this.$i,h)}else n=Math.round(n*i)/i,h>0&&(s=G+tt(0,h));return n.toFixed(0)+s},t.prototype.Qi=function(t){var i=this.Zt/this.$i,n=Math.floor(t),s=Math.round(t*i)-n*i;if(s===i&&(s=0,n+=1),!this.in)throw new Error("_fractionalLength is not calculated");var h="";if(this.Xi){var r=s%this.Xi,e=tt(s=(s-r)/this.Xi,this.in),u=2===this.Xi?["0","5"][r]:8===this.Xi?["0","1","2","3","4","5","6","7"][r]:["0","2","5","7"][r];h=e+Q+u}else h=tt(s*this.$i,this.in);return n.toString()+Q+h},t}(),nt=function(t){function i(i){return void 0===i&&(i=100),t.call(this,i)||this}return r(i,t),i.prototype.Gi=function(i){return t.prototype.Gi.call(this,i)+"%"},i}(it),st=function(){function t(){this.nn=[]}return t.prototype.sn=function(t,i,n){var s={hn:t,rn:i,en:!0===n};this.nn.push(s)},t.prototype.un=function(t){var i=this.nn.findIndex((function(i){return t===i.hn}));i>-1&&this.nn.splice(i,1)},t.prototype.on=function(t){this.nn=this.nn.filter((function(i){return i.rn===t}))},t.prototype.an=function(t,i){var n=u(this.nn);this.nn=this.nn.filter((function(t){return!t.en})),n.forEach((function(n){return n.hn(t,i)}))},t.prototype.fn=function(){return this.nn.length>0},t.prototype.ln=function(){this.nn=[]},t}(),ht=function(){function t(t,i){this.cn=t,this.vn=i}return t.prototype._n=function(t){return null!==t&&(this.cn===t.cn&&this.vn===t.vn)},t.prototype.dn=function(){return new t(this.cn,this.vn)},t.prototype.wn=function(){return this.cn},t.prototype.Mn=function(t){this.cn=t},t.prototype.bn=function(){return this.vn},t.prototype.mn=function(t){this.vn=t},t.prototype.pn=function(){return this.vn-this.cn},t.prototype.Gt=function(){return this.vn===this.cn||Number.isNaN(this.vn)||Number.isNaN(this.cn)},t.prototype.gn=function(i){return null===i?this:new t(Math.min(this.wn(),i.wn()),Math.max(this.bn(),i.bn()))},t.prototype.yn=function(t,i){this.cn=Math.min(this.cn,t),this.vn=Math.max(this.vn,i)},t.prototype.kn=function(t,i){this.cn=t,this.vn=i},t.prototype.Nn=function(t){if(v(t)&&0!==this.vn-this.cn){var i=.5*(this.vn+this.cn),n=this.vn-i,s=this.cn-i;n*=t,s*=t,this.vn=i+n,this.cn=i+s}},t.prototype.xn=function(t){v(t)&&(this.vn+=t,this.cn+=t)},t.prototype.Sn=function(t){return t.wn()>this.cn&&t.bn()<this.vn},t.prototype.Dn=function(){return{minValue:this.cn,maxValue:this.vn}},t.Cn=function(i){return null===i?null:new t(i.minValue,i.maxValue)},t}();function rt(t,i,n){return Math.min(Math.max(t,i),n)}function et(t,i,n){return i-t<=n}function ut(t){return t<=0?NaN:Math.log(t)/Math.log(10)}function ot(t){var i=Math.ceil(t);return i%2!=0?i-1:i}function at(t){var i=Math.ceil(t);return i%2==0?i-1:i}function ft(t,i){var n=100*(t-i)/i;return i<0?-n:n}function lt(t,i){var n=ft(t.wn(),i),s=ft(t.bn(),i);return new ht(n,s)}function ct(t,i){var n=100*(t-i)/i+100;return i<0?-n:n}function vt(t,i){var n=ct(t.wn(),i),s=ct(t.bn(),i);return new ht(n,s)}function _t(t){var i=Math.abs(t);if(i<1e-8)return 0;var n=ut(i+1e-4)+4;return t<0?-n:n}function dt(t){var i=Math.abs(t);if(i<1e-8)return 0;var n=Math.pow(10,i-4)-1e-4;return t<0?-n:n}function wt(t){if(null===t)return null;var i=_t(t.wn()),n=_t(t.bn());return new ht(i,n)}var Mt,bt=function(){function t(t,i){if(this.Tn=t,this.En=i,function(t){if(t<0)return!1;for(var i=t;i>1;i/=10)if(i%10!=0)return!1;return!0}(this.Tn))this.An=[2,2.5,2];else{this.An=[];for(var n=this.Tn;1!==n;){if(n%2==0)this.An.push(2),n/=2;else{if(n%5!=0)throw new Error("unexpected base");this.An.push(2),this.An.push(2.5),n/=5}if(this.An.length>100)throw new Error("something wrong with base")}}}return t.prototype.Ln=function(t,i,n){for(var s,h,r,e=0===this.Tn?0:1/this.Tn,u=Math.pow(10,Math.max(0,Math.ceil(ut(t-i)))),o=0,a=this.En[0];;){var f=et(u,e,1e-9)&&u>e+1e-9,l=et(u,n*a,1e-9),c=et(u,1,1e-9);if(!(f&&l&&c))break;u/=a,a=this.En[++o%this.En.length]}if(u<=e+1e-9&&(u=e),u=Math.max(1,u),this.An.length>0&&(s=u,h=1,r=1e-9,Math.abs(s-h)<r))for(o=0,a=this.An[0];et(u,n*a,1e-9)&&u>e+1e-9;)u/=a,a=this.An[++o%this.An.length];return u},t}(),mt=function(){function t(t,i,n,s){this.Bn=[],this.Zt=t,this.Tn=i,this.Vn=n,this.zn=s}return t.prototype.Fn=function(t){if(t<0)throw new Error("base < 0");this.Tn=t},t.prototype.Ln=function(t,i){if(t<i)throw new Error("high < low");var n=this.Zt.wt(),s=(t-i)*this.Pn()/n,h=new bt(this.Tn,[2,2.5,2]),r=new bt(this.Tn,[2,2,2.5]),e=new bt(this.Tn,[2.5,2,2]),u=[];return u.push(h.Ln(t,i,s)),u.push(r.Ln(t,i,s)),u.push(e.Ln(t,i,s)),function(t){if(t.length<1)throw Error("array is empty");for(var i=t[0],n=1;n<t.length;++n)t[n]<i&&(i=t[n]);return i}(u)},t.prototype.On=function(){var t=this.Zt,i=t.q();if(null!==i){var n=t.wt(),s=this.Vn(n-1,i),h=this.Vn(0,i),r=this.Zt.O().entireTextOnly?this.In()/2:0,e=r,u=n-1-r,o=Math.max(s,h),a=Math.min(s,h);if(o!==a){for(var f=this.Ln(o,a),l=o%f,c=o>=a?1:-1,v=null,_=0,d=o-(l+=l<0?f:0);d>a;d-=f){var w=this.zn(d,i,!0);null!==v&&Math.abs(w-v)<this.Pn()||(w<e||w>u||(_<this.Bn.length?(this.Bn[_].Rn=w,this.Bn[_].Wn=t.jn(d)):this.Bn.push({Rn:w,Wn:t.jn(d)}),_++,v=w,t.Un()&&(f=this.Ln(d*c,a))))}this.Bn.length=_}else this.Bn=[]}else this.Bn=[]},t.prototype.qn=function(){return this.Bn},t.prototype.In=function(){return this.Zt.Lt()},t.prototype.Pn=function(){return Math.ceil(2.5*this.In())},t}();function pt(t){return t.slice().sort((function(t,i){return f(t.fi())-f(i.fi())}))}!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(Mt||(Mt={}));var gt,yt=new nt,kt=new it(100,1),Nt=function(){function t(t,i,n,s){this.Hn=0,this.Yn=null,this.Kn=new st,this.$n=null,this.Xn=null,this.Zn=new st,this.Jn={Gn:!1,Qn:null},this.ts=0,this.ns=0,this.ss=new st,this.hs=new st,this.rs=[],this.es=null,this.us=null,this.os=null,this.as=null,this.fs=kt,this.ls=new st,this.cs=t,this.Si=i,this.vs=n,this._s=s,this.ds=new mt(this,100,this.ws.bind(this),this.Ms.bind(this))}return t.prototype.bs=function(){return this.cs},t.prototype.O=function(){return this.Si},t.prototype.ms=function(t){if(c(this.Si,t),this.ps(),void 0!==t.mode&&this.gs({ys:t.mode}),this.ls.an(),void 0!==t.scaleMargins){var i=a(t.scaleMargins.top),n=a(t.scaleMargins.bottom);if(i<0||i>1)throw new Error("Invalid top margin - expect value between 0 and 1, given="+i);if(n<0||n>1||i+n>1)throw new Error("Invalid bottom margin - expect value between 0 and 1, given="+n);if(i+n>1)throw new Error("Invalid margins - sum of margins must be less than 1, given="+(i+n));this.ks(),this.us=null}},t.prototype.Ns=function(){return this.ls},t.prototype.xs=function(){return this.Si.autoScale},t.prototype.Un=function(){return 1===this.Si.mode},t.prototype.Ss=function(){return 2===this.Si.mode},t.prototype.Ds=function(){return 3===this.Si.mode},t.prototype.ys=function(){return{Cs:this.Si.autoScale,Ts:this.Si.invertScale,ys:this.Si.mode}},t.prototype.gs=function(t){var i=this.ys(),n=null;void 0!==t.Cs&&(this.Si.autoScale=t.Cs),void 0!==t.ys&&(this.Si.mode=t.ys,2!==t.ys&&3!==t.ys||(this.Si.autoScale=!0),this.Jn.Gn=!1),1===i.ys&&t.ys!==i.ys&&(!function(t){if(null===t)return!1;var i=dt(t.wn()),n=dt(t.bn());return isFinite(i)&&isFinite(n)}(this.$n)?this.Si.autoScale=!0:null!==(n=function(t){if(null===t)return null;var i=dt(t.wn()),n=dt(t.bn());return new ht(i,n)}(this.$n))&&this.Es(n)),1===t.ys&&t.ys!==i.ys&&null!==(n=wt(this.$n))&&this.Es(n);var s=i.ys!==this.Si.mode;s&&(2===i.ys||this.Ss())&&this.ps(),s&&(3===i.ys||this.Ds())&&this.ps(),void 0!==t.Ts&&i.Ts!==t.Ts&&(this.Si.invertScale=t.Ts,this.As()),this.hs.an(i,this.ys())},t.prototype.Ls=function(){return this.hs},t.prototype.Lt=function(){return this.vs.fontSize},t.prototype.wt=function(){return this.Hn},t.prototype.Bs=function(t){this.Hn!==t&&(this.Hn=t,this.ks(),this.us=null)},t.prototype.Vs=function(){if(this.Yn)return this.Yn;var t=this.wt()-this.zs()-this.Fs();return this.Yn=t,t},t.prototype.Ps=function(){return this.Kn},t.prototype.Os=function(){return this.Is(),this.$n},t.prototype.Rs=function(){return this.Zn},t.prototype.Es=function(t,i,n){var s=this.$n;(i||null===s&&null!==t||null!==s&&!s._n(t))&&(this.us=null,this.$n=t,n||this.Zn.an(s,t))},t.prototype.Gt=function(){return this.Is(),0===this.Hn||!this.$n||this.$n.Gt()},t.prototype.Ws=function(t){return this.Ts()?t:this.wt()-1-t},t.prototype.$=function(t,i){return this.Ss()?t=ft(t,i):this.Ds()&&(t=ct(t,i)),this.Ms(t,i)},t.prototype.js=function(t,i,n){this.Is();for(var s=this.Fs(),h=f(this.Os()),r=h.wn(),e=h.bn(),u=this.Vs()-1,o=this.Ts(),a=u/(e-r),l=void 0===n?0:n.from,c=void 0===n?t.length:n.to,v=this.Us(),_=l;_<c;_++){var d=t[_],w=d.P;if(!isNaN(w)){var M=w;null!==v&&(M=v(d.P,i));var b=s+a*(M-r),m=o?b:this.Hn-1-b;d.p=m}}},t.prototype.qs=function(t,i,n){this.Is();for(var s=this.Fs(),h=f(this.Os()),r=h.wn(),e=h.bn(),u=this.Vs()-1,o=this.Ts(),a=u/(e-r),l=void 0===n?0:n.from,c=void 0===n?t.length:n.to,v=this.Us(),_=l;_<c;_++){var d=t[_],w=d.open,M=d.high,b=d.low,m=d.close;null!==v&&(w=v(d.open,i),M=v(d.high,i),b=v(d.low,i),m=v(d.close,i));var p=s+a*(w-r),g=o?p:this.Hn-1-p;d.Hs=g,p=s+a*(M-r),g=o?p:this.Hn-1-p,d.Ys=g,p=s+a*(b-r),g=o?p:this.Hn-1-p,d.Ks=g,p=s+a*(m-r),g=o?p:this.Hn-1-p,d.$s=g}},t.prototype.Ei=function(t,i){var n=this.ws(t,i);return this.Xs(n,i)},t.prototype.Xs=function(t,i){var n=t;return this.Ss()?n=function(t,i){return i<0&&(t=-t),t/100*i+i}(n,i):this.Ds()&&(n=function(t,i){return t-=100,i<0&&(t=-t),t/100*i+i}(n,i)),n},t.prototype.Zs=function(){return this.rs},t.prototype.Js=function(){if(this.es)return this.es;for(var t=[],i=0;i<this.rs.length;i++){var n=this.rs[i];null===n.fi()&&n.li(i+1),t.push(n)}return t=pt(t),this.es=t,this.es},t.prototype.Gs=function(t){-1===this.rs.indexOf(t)&&(this.rs.push(t),this.ps(),this.Qs())},t.prototype.th=function(t){var i=this.rs.indexOf(t);if(-1===i)throw new Error("source is not attached to scale");this.rs.splice(i,1),this.Gt()&&this.gs({Cs:!0}),this.ps(),this.Qs()},t.prototype.q=function(){for(var t=null,i=0,n=this.rs;i<n.length;i++){var s=n[i].q();null!==s&&((null===t||s.ih<t.ih)&&(t=s))}return null===t?null:t.Z},t.prototype.Ts=function(){return this.Si.invertScale},t.prototype.qn=function(){return this.us||(this.ds.On(),this.us=this.ds.qn(),this.ss.an()),this.us},t.prototype.nh=function(){return this.ss},t.prototype.sh=function(t){this.Ss()||this.Ds()||null===this.os&&null===this.Xn&&(this.Gt()||(this.os=this.Hn-t,this.Xn=f(this.Os()).dn()))},t.prototype.hh=function(t){if(!this.Ss()&&!this.Ds()&&null!==this.os){this.gs({Cs:!1}),(t=this.Hn-t)<0&&(t=0);var i=(this.os+.2*(this.Hn-1))/(t+.2*(this.Hn-1)),n=f(this.Xn).dn();i=Math.max(i,.1),n.Nn(i),this.Es(n)}},t.prototype.rh=function(){this.Ss()||this.Ds()||(this.os=null,this.Xn=null)},t.prototype.eh=function(t){this.xs()||null===this.as&&null===this.Xn&&(this.Gt()||(this.as=t,this.Xn=f(this.Os()).dn()))},t.prototype.uh=function(t){if(!this.xs()&&null!==this.as){var i=f(this.Os()).pn()/(this.Vs()-1),n=t-this.as;this.Ts()&&(n*=-1);var s=n*i,h=f(this.Xn).dn();h.xn(s),this.Es(h,!0),this.us=null}},t.prototype.oh=function(){this.xs()||null!==this.as&&(this.as=null,this.Xn=null)},t.prototype.ah=function(){return this.fs||this.ps(),this.fs},t.prototype.Qt=function(t,i){switch(this.Si.mode){case 2:return this.ah().Gi(ft(t,i));case 3:return this.ah().Gi(ct(t,i));default:return this.fh(t)}},t.prototype.jn=function(t){switch(this.Si.mode){case 2:case 3:return this.ah().Gi(t);default:return this.fh(t)}},t.prototype.lh=function(t){return this.fh(t,f(this.vh()).ah())},t.prototype._h=function(t,i){return t=ft(t,i),yt.Gi(t)},t.prototype.dh=function(){return this.rs},t.prototype.wh=function(t){this.Jn={Qn:t,Gn:!1}},t.prototype.Ui=function(){this.rs.forEach((function(t){return t.Ui()}))},t.prototype.ps=function(){this.us=null;var t=this.vh(),i=100;null!==t&&(i=Math.round(1/t.Mh())),this.fs=kt,this.Ss()?(this.fs=yt,i=100):this.Ds()?(this.fs=new it(100,1),i=100):null!==t&&(this.fs=t.ah()),this.ds=new mt(this,i,this.ws.bind(this),this.Ms.bind(this)),this.ds.On()},t.prototype.Qs=function(){this.es=null},t.prototype.vh=function(){return this.rs[0]||null},t.prototype.zs=function(){return this.Ts()?this.Si.scaleMargins.bottom*this.wt()+this.ns:this.Si.scaleMargins.top*this.wt()+this.ts},t.prototype.Fs=function(){return this.Ts()?this.Si.scaleMargins.top*this.wt()+this.ts:this.Si.scaleMargins.bottom*this.wt()+this.ns},t.prototype.Is=function(){this.Jn.Gn||(this.Jn.Gn=!0,this.bh())},t.prototype.ks=function(){this.Yn=null,this.Kn.an()},t.prototype.Ms=function(t,i){if(this.Is(),this.Gt())return 0;t=this.Un()&&t?_t(t):t;var n=f(this.Os()),s=this.Fs()+(this.Vs()-1)*(t-n.wn())/n.pn();return this.Ws(s)},t.prototype.ws=function(t,i){if(this.Is(),this.Gt())return 0;var n=this.Ws(t),s=f(this.Os()),h=s.wn()+s.pn()*((n-this.Fs())/(this.Vs()-1));return this.Un()?dt(h):h},t.prototype.As=function(){this.us=null,this.ds.On()},t.prototype.bh=function(){var t=this.Jn.Qn;if(null!==t){for(var i=null,n=0,s=0,h=0,r=this.dh();h<r.length;h++){var e=r[h],u=e.q();if(null!==u){var o=e.mh(t.ph(),t.gh()),a=o&&o.Os();if(null!==a){switch(this.Si.mode){case 1:a=wt(a);break;case 2:a=lt(a,u.Z);break;case 3:a=vt(a,u.Z)}if(i=null===i?a:i.gn(f(a)),null!==o){var l=o.yh();null!==l&&(n=Math.max(n,l.above),s=Math.max(n,l.below))}}}}if(n===this.ts&&s===this.ns||(this.ts=n,this.ns=s,this.us=null,this.ks()),null!==i){if(i.wn()===i.bn()){var c=this.vh(),v=5*(null===c||this.Ss()||this.Ds()?1:c.Mh());i=new ht(i.wn()-v,i.bn()+v)}this.Es(i)}else null===this.$n&&this.Es(new ht(-.5,.5));this.Jn.Gn=!0}},t.prototype.Us=function(){return this.Ss()?ft:this.Ds()?ct:this.Un()?_t:null},t.prototype.fh=function(t,i){return void 0===this._s.priceFormatter?(void 0===i&&(i=this.ah()),i.Gi(t)):this._s.priceFormatter(t)},t}();function xt(t){void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)}!function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(gt||(gt={}));var St=function(t){return t.getUTCFullYear()};function Dt(t,i,n){return i.replace(/yyyy/g,function(t){return tt(St(t),4)}(t)).replace(/yy/g,function(t){return tt(St(t)%100,2)}(t)).replace(/MMMM/g,function(t,i){return new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"})}(t,n)).replace(/MMM/g,function(t,i){return new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"})}(t,n)).replace(/MM/g,function(t){return tt(function(t){return t.getUTCMonth()+1}(t),2)}(t)).replace(/dd/g,function(t){return tt(function(t){return t.getUTCDate()}(t),2)}(t))}var Ct=function(){function t(t,i){void 0===t&&(t="yyyy-MM-dd"),void 0===i&&(i="default"),this.kh=t,this.Nh=i}return t.prototype.Gi=function(t){return Dt(t,this.kh,this.Nh)},t}(),Tt=function(){function t(t){this.xh=t||"%h:%m:%s"}return t.prototype.Gi=function(t){return this.xh.replace("%h",tt(t.getUTCHours(),2)).replace("%m",tt(t.getUTCMinutes(),2)).replace("%s",tt(t.getUTCSeconds(),2))},t}(),Et={Sh:"yyyy-MM-dd",Dh:"%h:%m:%s",Ch:" ",Th:"default"},At=function(){function t(t){void 0===t&&(t={});var i=e(e({},Et),t);this.Eh=new Ct(i.Sh,i.Th),this.Ah=new Tt(i.Dh),this.Lh=i.Ch}return t.prototype.Gi=function(t){return""+this.Eh.Gi(t)+this.Lh+this.Ah.Gi(t)},t}(),Lt=function(){function t(t,i){void 0===i&&(i=50),this.Bh=0,this.Vh=1,this.zh=1,this.Fh=new Map,this.Ph=new Map,this.Oh=t,this.Ih=i}return t.prototype.Gi=function(t){var i=void 0===t.businessDay?new Date(1e3*t.timestamp).getTime():new Date(Date.UTC(t.businessDay.year,t.businessDay.month-1,t.businessDay.day)).getTime(),n=this.Fh.get(i);if(void 0!==n)return n.Rh;if(this.Bh===this.Ih){var s=this.Ph.get(this.zh);this.Ph.delete(this.zh),this.Fh.delete(a(s)),this.zh++,this.Bh--}var h=this.Oh(t);return this.Fh.set(i,{Rh:h,Wh:this.Vh}),this.Ph.set(this.Vh,i),this.Bh++,this.Vh++,h},t}(),Bt=function(){function t(t,i){o(t<=i,"right should be >= left"),this.jh=t,this.Uh=i}return t.prototype.ph=function(){return this.jh},t.prototype.gh=function(){return this.Uh},t.prototype.qh=function(){return this.Uh-this.jh+1},t.prototype.Hh=function(t){return this.jh<=t&&t<=this.Uh},t.prototype._n=function(t){return this.jh===t.ph()&&this.Uh===t.gh()},t}();function Vt(t,i){return null===t||null===i?t===i:t._n(i)}function zt(t,i){return t.Bi-i.Bi}var Ft,Pt=function(){function t(){this.Yh=1/0,this.Kh=-1/0,this.$h=new Map,this.Xh=[],this.Zh=new st,this.Fh=null,this.Jh=NaN}return t.prototype.Gh=function(){this.$h.clear(),this.Xh=[],this.Yh=1/0,this.Kh=-1/0,this.Fh=null,this.Zh.an()},t.prototype.gn=function(t){for(var i=this.Xh,n={},s=0,h=t;s<h.length;s++){var r=h[s],e=r.Bi,u=r.Qh,o=this.$h.get(r.Bi);if(o){if(o.Bi===r.Bi&&o.Qh===r.Qh){o.F=r.F;continue}this.tr(o)}this.$h.set(e,r),this.Yh>e&&(this.Yh=e),this.Kh<e&&(this.Kh=e),void 0===(a=i[u])&&(a=[],i[u]=a),a.push(r),n[u]=!0}for(u=i.length;u--;){var a;void 0!==(a=i[u])&&(0===a.length&&delete i[u],n[u]&&a.sort(zt))}this.Fh=null,this.Zh.an()},t.prototype.ir=function(t){var i=this.$h.get(t);return void 0===i?null:i.F},t.prototype.nr=function(t){for(var i=this.Yh,n=this.Kh;n-i>2;){if(1e3*a(this.$h.get(i)).F.timestamp===t)return i;if(1e3*a(this.$h.get(n)).F.timestamp===t)return n;var s=Math.round((i+n)/2);1e3*a(this.$h.get(s)).F.timestamp>t?n=s:i=s}return i},t.prototype.sr=function(t,i){var n=Math.ceil(i/t);if(this.Jh===n&&this.Fh)return this.Fh;this.Jh=n;for(var s=[],h=this.Xh.length;h--;)if(this.Xh[h]){var r=s;s=[];for(var e=r.length,u=0,o=a(this.Xh[h]),f=o.length,l=1/0,c=-1/0,v=0;v<f;v++){for(var _=o[v],d=_.Bi;u<e;){var w=r[u],M=w.Bi;if(!(M<d)){l=M;break}u++,s.push(w),c=M,l=1/0}l-d>=n&&d-c>=n&&(s.push(_),c=d)}for(;u<e;u++)s.push(r[u])}return this.Fh=s,this.Fh},t.prototype.tr=function(t){var i=t.Bi;if(this.$h.get(i)===t){this.$h.delete(i),i<=this.Yh&&this.Yh++,i>=this.Kh&&this.Kh--,this.Kh<this.Yh&&(this.Yh=1/0,this.Kh=-1/0);var n=a(this.Xh[t.Qh]),s=n.indexOf(t);-1!==s&&n.splice(s,1)}},t}(),Ot=function(){function t(){this.hr=[]}return t.prototype.rr=function(){this.hr=[]},t.prototype.er=function(){return this.hr.length},t.prototype.ur=function(){return this.or(0)},t.prototype.Yi=function(){return this.or(this.hr.length-1)},t.prototype.gn=function(t,i){if(0!==i.length)if(0!==this.hr.length){var n=t;if(n<0){var s=Math.abs(n);if(i.length<s)return;this.hr=new Array(s).concat(this.hr);for(var h=0;h<i.length;++h)this.hr[t+h]=i[h]}else{for(var r=n;r<this.hr.length&&r-n<i.length;++r)this.hr[r]=i[r-n];var e=n+i.length;if(e>this.hr.length){s=e-this.hr.length;for(var u=r;u<r+s;++u)this.hr.push(i[u-n])}}}else this.hr=i},t.prototype.ar=function(t){var i=this.lr(t);return null!==i?this.hr[i]:null},t.prototype.cr=function(t,i){if(this.hr.length<1)return null;if(t>this.hr[this.hr.length-1].timestamp)return i?this.hr.length-1:null;for(var n=0;n<this.hr.length;++n){if(t===this.hr[n].timestamp)return n;if(t<this.hr[n].timestamp)return i?n:null}return null},t.prototype.vr=function(t){var i=this.hr;if(!i.length)return null;if(Number.isNaN(t.timestamp))return null;var n=i.length-1;if(t>=i[n])return n;var s=0,h=i[s];if(t<h)return null;if(t===h)return s;for(;n>s+1;){var r=s+n>>1,e=i[r];if(e.timestamp>t.timestamp)n=r;else{if(!(e.timestamp<t.timestamp))return e.timestamp===t.timestamp?r:null;s=r}}return s},t.prototype.or=function(t){return 0<=t&&t<this.er()?t:null},t.prototype.lr=function(t){return 0<=t&&t<this.er()?t:null},t}(),It=function(){function t(t){this._r=t}return t.prototype.dr=function(){return null===this._r?null:new Bt(Math.floor(this._r.ph()),Math.ceil(this._r.gh()))},t.prototype.wr=function(){return this._r},t.prototype.Gn=function(){return null!==this._r},t.Mr=function(){return new t(null)},t}();!function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds"}(Ft||(Ft={}));var Rt=function(){function t(t,i,n){this.br=0,this.mr=null,this.pr=new Ot,this.as=null,this.os=null,this.gr=new Pt,this.yr=new Map,this.kr=It.Mr(),this.Nr=!0,this.xr=new st,this.Sr=new st,this.Dr=new st,this.Cr=null,this.Tr=null,this.Er=null,this.Ar=[],this.Si=i,this._s=n,this.Lr=i.rightOffset,this.Br=i.barSpacing,this.ni=t,this.Vr()}return t.prototype.O=function(){return this.Si},t.prototype.zr=function(t){c(this._s,t),this.Fr(),this.Vr()},t.prototype.ms=function(t,i){c(this.Si,t),this.Si.fixLeftEdge?this.Pr():this.Cr=null,void 0!==t.barSpacing&&this.Or(t.barSpacing),void 0!==t.rightOffset&&this.Ir(t.rightOffset),this.Fr(),this.Vr(),this.Dr.an()},t.prototype.Gt=function(){return 0===this.br||0===this.pr.er()},t.prototype.Rr=function(){return this.Wr(),this.kr.dr()},t.prototype.jr=function(){return this.Wr(),this.kr.wr()},t.prototype.Ur=function(){var t=this.Rr();if(null===t)return null;var i={from:t.ph(),to:t.gh()};return this.qr(i)},t.prototype.qr=function(t){var i=Math.round(t.from),n=Math.round(t.to),s=this.ni.j().Hr(),h=f(s.ur()),r=f(s.Yi());return{from:f(s.ar(Math.max(h,i))),to:f(s.ar(Math.min(r,n)))}},t.prototype.Yr=function(t){var i=this.ni.j().Hr();return{from:f(i.cr(t.from.timestamp,!0)),to:f(i.cr(t.to.timestamp,!0))}},t.prototype.Kr=function(){return this.gr},t.prototype.Hr=function(){return this.pr},t.prototype.dt=function(){return this.br},t.prototype.$r=function(t){if(isFinite(t)&&!(t<=0)&&this.br!==t){if(this.Si.lockVisibleTimeRangeOnResize&&this.br){var i=this.Br*t/this.br;this.Xr(i)}if(null!==this.Cr)if(f(this.Rr()).ph()<=this.Cr){var n=this.br-t;this.Lr-=Math.round(n/this.Br)+1}this.br=t,this.Nr=!0,this.Zr(),this.Jr()}},t.prototype.J=function(t){if(this.Gt()||!_(t))return 0;var i=this.Gr()+this.Lr-t;return this.br-(i+.5)*this.Br},t.prototype.Qr=function(t,i){for(var n=this.Gr(),s=void 0===i?0:i.from,h=void 0===i?t.length:i.to,r=s;r<h;r++){var e=t[r].F,u=n+this.Lr-e,o=this.br-(u+.5)*this.Br;t[r].m=o}},t.prototype.si=function(t){return this.gr.ir(t)},t.prototype.te=function(t){return Math.ceil(this.ie(t))},t.prototype.Ir=function(t){this.Nr=!0,this.Lr=t,this.Jr(),this.ni.ne(),this.ni.se()},t.prototype.he=function(){return this.Br},t.prototype.Or=function(t){this.Xr(t),this.Jr(),this.ni.ne(),this.ni.se()},t.prototype.ee=function(){return this.Lr},t.prototype.qn=function(){if(this.Gt())return null;if(null!==this.Er)return this.Er;for(var t=this.Br,i=5*(this.ni.O().layout.fontSize+4),n=Math.round(i/t),s=f(this.Rr()),h=Math.max(s.ph(),s.ph()-n),r=Math.max(s.gh(),s.gh()-n),e=0,u=0,o=this.gr.sr(t,i);u<o.length;u++){var a=o[u];if(h<=a.Bi&&a.Bi<=r){var l=this.gr.ir(a.Bi);if(null!==l){if(e<this.Ar.length){var c=this.Ar[e];c.Rn=this.J(a.Bi),c.Wn=this.ue(l,a.Qh),c.Qh=a.Qh,c.oe=!1}else this.Ar.push({Rn:this.J(a.Bi),Wn:this.ue(l,a.Qh),Qh:a.Qh,oe:!1});e++}}}return this.Ar.length=e,this.Er=this.Ar,this.Ar},t.prototype.Gh=function(){this.Nr=!0,this.pr=new Ot,this.as=null,this.os=null,this.ae(),this.gr.Gh(),this.Cr=null},t.prototype.fe=function(){this.Nr=!0,this.Or(this.Si.barSpacing),this.Ir(this.Si.rightOffset)},t.prototype.le=function(){return this.Si.fixLeftEdge},t.prototype.ce=function(t){this.Nr=!0,this.mr=t,this.Jr(),this.Pr()},t.prototype.ve=function(t,i){var n=this.ie(t),s=this.he(),h=s+i*(s/10);this.Or(h),this.Si.rightBarStaysOnScroll||this.Ir(this.ee()+(n-this.ie(t)))},t.prototype.sh=function(t){this.as&&this.oh(),null===this.os&&null===this.Tr&&(this.Gt()||(this.os=t,this._e()))},t.prototype.hh=function(t){if(null!==this.Tr){var i=rt(this.br-t,0,this.br),n=rt(this.br-f(this.os),0,this.br);0!==i&&0!==n&&this.Or(this.Tr.he*i/n)}},t.prototype.rh=function(){null!==this.os&&(this.os=null,this.ae())},t.prototype.eh=function(t){null===this.as&&null===this.Tr&&(this.Gt()||(this.as=t,this._e()))},t.prototype.uh=function(t){if(null!==this.as){var i=(this.as-t)/this.he();this.Lr=f(this.Tr).ee+i,this.Nr=!0,this.Jr()}},t.prototype.oh=function(){null!==this.as&&(this.as=null,this.ae())},t.prototype.de=function(){this.we(this.Si.rightOffset)},t.prototype.we=function(t,i){var n=this;if(void 0===i&&(i=400),!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");var s=this.Lr,h=(new Date).getTime(),r=function(){var e=((new Date).getTime()-h)/i,u=e>=1,o=u?t:s+(t-s)*e;n.Ir(o),u||setTimeout(r,20)};r()},t.prototype.B=function(t,i,n){if(this.Nr=!0,i.length>0){var s=this.pr.er();this.pr.gn(t,i),this.Lr<0&&this.pr.er()===s+1&&(this.Lr-=1)}this.gr.gn(n),this.Jr()},t.prototype.Me=function(){return this.xr},t.prototype.be=function(){return this.Sr},t.prototype.me=function(){return this.Dr},t.prototype.Gr=function(){return this.mr||0},t.prototype.pe=function(t){var i=t.qh();this.Xr(this.br/i),this.Lr=t.gh()-this.Gr(),this.Jr(),this.Nr=!0,this.ni.ne(),this.ni.se()},t.prototype.ge=function(){var t=this.pr.ur(),i=this.pr.Yi();null!==t&&null!==i&&this.pe(new Bt(t,i+this.Si.rightOffset))},t.prototype.ye=function(t){var i=new Bt(t.from,t.to);this.pe(i)},t.prototype.hi=function(t){return void 0!==this._s.timeFormatter?this._s.timeFormatter(t.businessDay||t.timestamp):this.ke.Gi(new Date(1e3*t.timestamp))},t.prototype.Ne=function(t){return(this.br+1-t)/this.Br},t.prototype.ie=function(t){var i=this.Ne(t),n=this.Gr()+this.Lr-i;return Math.round(1e6*n)/1e6},t.prototype.Xr=function(t){var i=this.Br;this.Br=t,this.Zr(),i!==this.Br&&(this.Nr=!0,this.xe())},t.prototype.Wr=function(){if(this.Nr)if(this.Nr=!1,this.Gt())this.Se(It.Mr());else{var t=this.Gr(),i=this.br/this.Br,n=this.Lr+t,s=new Bt(n-i+1,n);this.Se(new It(s))}},t.prototype.Zr=function(){if(this.Br<.5&&(this.Br=.5,this.Nr=!0),0!==this.br){var t=.5*this.br;this.Br>t&&(this.Br=t,this.Nr=!0)}},t.prototype.Jr=function(){var t=this.De();this.Lr>t&&(this.Lr=t,this.Nr=!0);var i=this.Ce();null!==i&&this.Lr<i&&(this.Lr=i,this.Nr=!0)},t.prototype.Ce=function(){var t=this.pr.ur(),i=this.mr;if(null===t||null===i)return null;if(null!==this.Cr){var n=this.br/this.Br;return this.Cr-i+n-1}return t-i-1+Math.min(2,this.pr.er())},t.prototype.De=function(){return this.br/this.Br-Math.min(2,this.pr.er())},t.prototype._e=function(){this.Tr={he:this.he(),ee:this.ee()}},t.prototype.ae=function(){this.Tr=null},t.prototype.ue=function(t,i){var n=this,s=this.yr.get(i);return void 0===s&&(s=new Lt((function(t){return n.Te(t,i)})),this.yr.set(i,s)),s.Gi(t)},t.prototype.Te=function(t,i){var n,s=this.Si.timeVisible;return n=i<20&&s?this.Si.secondsVisible?4:3:i<40&&s?3:i<50||i<60?2:i<70?1:0,this.Si.tickMarkFormatter(t,n,this._s.locale)},t.prototype.Se=function(t){var i=this.kr;this.kr=t,Vt(i.dr(),this.kr.dr())||this.xr.an(),Vt(i.wr(),this.kr.wr())||this.Sr.an(),this.xe()},t.prototype.xe=function(){this.Er=null},t.prototype.Fr=function(){this.xe(),this.yr.clear()},t.prototype.Vr=function(){var t=this._s.dateFormat;this.Si.timeVisible?this.ke=new At({Sh:t,Dh:this.Si.secondsVisible?"%h:%m:%s":"%h:%m",Ch:"   ",Th:this._s.locale}):this.ke=new Ct(t,this._s.locale)},t.prototype.Pr=function(){if(this.Si.fixLeftEdge){var t=this.pr.ur();if(null!==t&&this.Cr!==t){this.Cr=t;var i=f(this.Rr()).ph()-t;if(i<0){var n=this.Lr-i-1;this.Ir(n)}}}},t}();function Wt(t){return!v(t)&&!d(t)}function jt(t){return v(t)}function Ut(t,i,n){return void 0!==n?n+=" ":n="",void 0===i&&(i="'Trebuchet MS', Roboto, Ubuntu, sans-serif"),""+n+t+"px "+i}var qt=function(){function t(t){this.Ee={Nt:1,kt:4,Lt:NaN,gt:"",Ae:"",et:"",St:0,Dt:0,Ct:0,xt:0,At:0},this.A=t}return t.prototype.O=function(){var t=this.Ee,i=this.Le(),n=this.Be();return t.Lt===i&&t.Ae===n||(t.Lt=i,t.Ae=n,t.gt=Ut(i,n),t.xt=Math.floor(i/3.5),t.St=t.xt,t.Dt=Math.max(Math.ceil(i/2-t.kt/2),0),t.Ct=Math.ceil(i/2+t.kt/2),t.At=Math.round(i/10)),t.et=this.Ve(),this.Ee},t.prototype.Ve=function(){return this.A.O().layout.textColor},t.prototype.Le=function(){return this.A.O().layout.fontSize},t.prototype.Be=function(){return this.A.O().layout.fontFamily},t}();function Ht(t){return"left"===t||"right"===t}var Yt=function(){function t(){this.G=null}return t.prototype.v=function(t){this.G=t},t.prototype.s=function(t,i,s,h){var r=this;if(null!==this.G){var e=Math.floor(i);t.lineWidth=e;var u=Math.ceil(this.G.ht*i),o=Math.ceil(this.G.st*i);!function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore()}(t,(function(){var s=f(r.G);if(s.ze){t.strokeStyle=s.Fe,n(t,s.Pe),t.beginPath();for(var h=0,a=s.Oe;h<a.length;h++){var l=a[h],c=Math.round(l.Rn*i);t.moveTo(c,-e),t.lineTo(c,u+e)}t.stroke()}if(s.Ie){t.strokeStyle=s.Re,n(t,s.We),t.beginPath();for(var v=0,_=s.je;v<_.length;v++){var d=_[v],w=Math.round(d.Rn*i);t.moveTo(-e,w),t.lineTo(o+e,w)}t.stroke()}}))}},t}(),Kt=function(){function t(t){this.at=new Yt,this.T=!0,this.wi=t}return t.prototype.B=function(){this.T=!0},t.prototype.I=function(t,i){if(this.T){var n=this.wi.ct().O().grid,s={ht:t,st:i,Ie:n.horzLines.visible,ze:n.vertLines.visible,Re:n.horzLines.color,Fe:n.vertLines.color,We:n.horzLines.style,Pe:n.vertLines.style,je:this.wi.Ti().qn(),Oe:this.wi.ct().j().qn()||[]};this.at.v(s),this.T=!1}return this.at},t}(),$t=function(){function t(){this.Ue=new WeakMap,this.T=!0}return t.prototype._i=function(t){var i=this.Ue.get(t);return void 0===i&&(i=[new Kt(t)],this.Ue.set(t,i)),this.T&&(i.forEach((function(t){return t.B()})),this.T=!1),i},t.prototype.qe=function(){this.T=!0},t}();var Xt=function(){function t(t){this.He=new Map,this.Ye=!1,this.Ke=!1,this._r=null,this.$e=t}return t.prototype.Xe=function(t,i){var n=function(t,i){return void 0===t?i:{Ze:Math.max(t.Ze,i.Ze),Cs:t.Cs||i.Cs}}(this.He.get(t),i);this.He.set(t,n)},t.prototype.Je=function(t){this.$e=Math.max(this.$e,t)},t.prototype.Ge=function(){return this.$e},t.prototype.Qe=function(t){var i=this.He.get(t);return void 0===i?{Ze:this.$e}:{Ze:Math.max(this.$e,i.Ze),Cs:i.Cs}},t.prototype.tu=function(){this.Ke=!0,this._r=null},t.prototype.iu=function(){return this.Ke},t.prototype.ye=function(t){this._r=t,this.Ke=!1},t.prototype.nu=function(){return this._r},t.prototype.gn=function(t){var i=this;this.Ye=this.Ye||t.Ye,t.Ke&&this.tu(),t._r&&this.ye(t._r),this.$e=Math.max(this.$e,t.$e),t.He.forEach((function(t,n){i.Xe(n,t)}))},t}(),Zt=function(){function t(t){this.su=t}return t.prototype.Gi=function(t){var i="";return t<0&&(i="-",t=-t),t<995?i+this.hu(t):t<999995?i+this.hu(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this.hu(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.hu(t/1e9)+"B")},t.prototype.hu=function(t){var i=Math.pow(10,this.su);return((t=Math.round(t*i)/i)>=1e-15&&t<1?t.toFixed(this.su).replace(/\.?0+$/,""):String(t)).replace(/(\.[1-9]*)0+$/,(function(t,i){return i}))},t}();function Jt(t,i,n,s){if(0!==i.length){var h=i[s.from].m,r=i[s.from].p;t.moveTo(h,r);for(var e=s.from+1;e<s.to;++e){var u=i[e];if(1===n){var o=i[e-1].p,a=u.m;t.lineTo(a,o)}t.lineTo(u.m,u.p)}}}var Gt=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.l=null,i}return r(i,t),i.prototype.v=function(t){this.l=t},i.prototype.h=function(t){if(null!==this.l&&0!==this.l.M.length&&null!==this.l._){t.lineCap="butt",t.strokeStyle=this.l.N,t.lineWidth=this.l.rt,n(t,this.l.ut),t.lineWidth=1,t.beginPath(),t.moveTo(this.l.M[this.l._.from].m,this.l.ru),t.lineTo(this.l.M[this.l._.from].m,this.l.M[this.l._.from].p),Jt(t,this.l.M,this.l.eu,this.l._),this.l._.to>this.l._.from&&(t.lineTo(this.l.M[this.l._.to-1].m,this.l.ru),t.lineTo(this.l.M[this.l._.from].m,this.l.ru)),t.closePath();var i=t.createLinearGradient(0,0,0,this.l.ru);i.addColorStop(0,this.l.uu),i.addColorStop(1,this.l.ou),t.fillStyle=i,t.fill()}},i}(y),Qt=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.l=null,i}return r(i,t),i.prototype.v=function(t){this.l=t},i.prototype.h=function(t){null!==this.l&&0!==this.l.M.length&&null!==this.l._&&(t.lineCap="square",t.lineWidth=this.l.rt,n(t,this.l.ut),t.strokeStyle=this.l.N,t.lineJoin="miter",t.beginPath(),Jt(t,this.l.M,this.l.eu,this.l._),t.stroke())},i}(y);function ti(t,i,n,s,h){void 0===s&&(s=0),void 0===h&&(h=t.length);for(var r=h-s;0<r;){var e=r>>1,u=s+e;n(t[u],i)?(s=u+1,r-=e+1):r=e}return s}function ii(t,i,n,s,h){void 0===s&&(s=0),void 0===h&&(h=t.length);for(var r=h-s;0<r;){var e=r>>1,u=s+e;n(i,t[u])?r=e:(s=u+1,r-=e+1)}return s}function ni(t,i){return t.F<i}function si(t,i){return t<i.F}function hi(t,i,n){var s=i.ph(),h=i.gh(),r=ti(t,s,ni),e=ii(t,h,si);if(!n)return{from:r,to:e};var u=r,o=e;return r>0&&r<t.length&&t[r].F>=s&&(u=r-1),e>0&&e<t.length&&t[e-1].F<=h&&(o=e+1),{from:u,to:o}}var ri=function(){function t(t,i,n){this.au=!0,this.fu=!0,this.lu=[],this.cu=null,this.vu=t,this._u=i,this.du=n}return t.prototype.B=function(t){this.au=!0,"data"===t&&(this.fu=!0)},t.prototype.wu=function(){this.fu&&(this.Mu(),this.fu=!1),this.au&&(this.bu(),this.au=!1)},t.prototype.mu=function(){this.cu=null},t.prototype.bu=function(){var t=this.vu.X(),i=this._u.j();if(this.mu(),!i.Gt()&&!t.Gt()){var n=i.Rr();if(null!==n&&0!==this.vu.pu().Ki().er()){var s=this.vu.q();null!==s&&(this.cu=hi(this.lu,n,this.du),this.gu(t,i,s.Z))}}},t}(),ei=function(t){function i(i,n){return t.call(this,i,n,!0)||this}return r(i,t),i.prototype.gu=function(t,i,n){i.Qr(this.lu,p(this.cu)),t.js(this.lu,n,p(this.cu))},i.prototype.yu=function(t,i){return{F:t,P:i,m:NaN,p:NaN}},i.prototype.Mu=function(){var t=this,i=this.vu.ku(),n=[],s=this.vu.K();this.vu.Ki().Nu((function(h,r){var e=i(r.Z),u=t.xu(h,e,s);return n.push(u),!1})),this.lu=n},i}(ri),ui=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.at=new g,s.Su=new Gt,s.Du=new Qt,s.at.i([s.Su,s.Du]),s}return r(i,t),i.prototype.I=function(t,i){this.wu();var n=this.vu.O(),s={eu:n.lineType,M:this.lu,N:n.lineColor,ut:n.lineStyle,rt:n.lineWidth,uu:n.topColor,ou:n.bottomColor,ru:t,_:this.cu};return this.Su.v(s),this.Du.v(s),this.at},i.prototype.xu=function(t,i){return this.yu(t,i)},i}(ei);var oi=function(){function t(){this.G=null,this.Cu=0,this.Tu=0}return t.prototype.v=function(t){this.G=t},t.prototype.s=function(t,i,n,s){if(null!==this.G&&0!==this.G.Ki.length&&null!==this.G._){if(this.Cu=Math.max(1,Math.floor(function(t,i){return Math.floor(.3*t*i)}(this.G.he,i))),this.Cu>=2)Math.floor(i)%2!=this.Cu%2&&this.Cu--;this.Tu=this.G.Eu?Math.min(this.Cu,Math.floor(i)):this.Cu;for(var h=null,r=this.G._.from;r<this.G._.to;++r){var e=this.G.Ki[r];h!==e.et&&(t.fillStyle=e.et,h=e.et);var u=Math.floor(.5*this.Tu),o=Math.round(e.m*i),a=o-u,f=this.Tu,l=a+f-1,c=Math.round(e.Ys*i)-u,v=Math.round(e.Ks*i)+u,_=Math.max(v-c,this.Tu);t.fillRect(a,c,f,_);var d=Math.ceil(1.5*this.Cu);if(this.Tu<=this.Cu){if(this.G.Au){var w=o-d,M=Math.max(c,Math.round(e.Hs*i)-u),b=M+f-1;b>c+_-1&&(M=(b=c+_-1)-f+1),t.fillRect(w,M,a-w,b-M+1)}var m=o+d,p=Math.max(c,Math.round(e.$s*i)-u),g=p+f-1;g>c+_-1&&(p=(g=c+_-1)-f+1),t.fillRect(l+1,p,m-l,g-p+1)}}}},t}(),ai=function(t){function i(i,n){return t.call(this,i,n,!1)||this}return r(i,t),i.prototype.gu=function(t,i,n){i.Qr(this.lu,p(this.cu)),t.qs(this.lu,n,p(this.cu))},i.prototype.Lu=function(t,i,n){return{F:t,open:i.Z[0],high:i.Z[1],low:i.Z[2],close:i.Z[3],m:NaN,Hs:NaN,Ys:NaN,Ks:NaN,$s:NaN}},i.prototype.Mu=function(){var t=this,i=[],n=this.vu.K();this.vu.Ki().Nu((function(s,h){var r=t.xu(s,h,n);return i.push(r),!1})),this.lu=i},i}(ri),fi=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.at=new oi,s}return r(i,t),i.prototype.I=function(t,i){this.wu();var n=this.vu.O(),s={Ki:this.lu,he:this._u.j().he(),Au:n.openVisible,Eu:n.thinBars,_:this.cu};return this.at.v(s),this.at},i.prototype.xu=function(t,i,n){return e(e({},this.Lu(t,i,n)),{et:n.Y(t).H})},i}(ai),li=function(){function t(){this.G=null,this.Cu=0}return t.prototype.v=function(t){this.G=t},t.prototype.s=function(t,i,n,s){if(null!==this.G&&0!==this.G.Ki.length&&null!==this.G._){if(this.Cu=function(t,i){var n=Math.floor(.8*t*i),s=Math.floor(t*i),h=Math.min(n,s-1);return Math.max(1,h)}(this.G.he,i),this.Cu>=2)Math.floor(i)%2!=this.Cu%2&&this.Cu--;var h=this.G.Ki;this.G.Bu&&this.Vu(t,h,this.G._,i),this.G.zu&&this.Fu(t,h,this.G._,this.G.he,i);var r=this.Pu(i);(!this.G.zu||this.Cu>2*r)&&this.Ou(t,h,this.G._,i)}},t.prototype.Vu=function(t,i,n,s){if(null!==this.G){var h="",r=Math.min(Math.floor(s),Math.floor(this.G.he*s));r=Math.min(r,this.Cu);for(var e=Math.floor(.5*r),u=n.from;u<n.to;u++){var o=i[u];o.Iu!==h&&(t.fillStyle=o.Iu,h=o.Iu);var a=Math.round(Math.min(o.Hs,o.$s)*s),f=Math.round(Math.max(o.Hs,o.$s)*s),l=Math.round(o.Ys*s),c=Math.round(o.Ks*s),v=Math.round(s*o.m);t.fillRect(v-e,l,r,a-l),t.fillRect(v-e,f+1,r,c-f)}}},t.prototype.Pu=function(t){var i=Math.floor(1*t);this.Cu<=2*i&&(i=Math.floor(.5*(this.Cu-1)));var n=Math.max(1,i);return this.Cu<=2*n?Math.floor(1*t):n},t.prototype.Fu=function(t,i,n,s,h){for(var r="",e=this.Pu(h),u=n.from;u<n.to;u++){var o=i[u];o.Ft!==r&&(t.fillStyle=o.Ft,r=o.Ft);var a=Math.round(o.m*h)-Math.floor(.5*this.Cu),f=a+this.Cu-1,l=Math.round(Math.min(o.Hs,o.$s)*h),c=Math.round(Math.max(o.Hs,o.$s)*h);s>2*e?R(t,a,l,f-a+1,c-l+1,e):t.fillRect(a,l,f-a+1,c-l+1)}},t.prototype.Ou=function(t,i,n,s){if(null!==this.G)for(var h="",r=this.Pu(s),e=n.from;e<n.to;e++){var u=i[e],o=Math.round(Math.min(u.Hs,u.$s)*s),a=Math.round(Math.max(u.Hs,u.$s)*s),f=Math.round(u.m*s)-Math.floor(.5*this.Cu),l=f+this.Cu-1;if(this.G.zu&&(f+=r,o+=r,l-=r,a-=r),!(o>a)){if(u.et!==h){var c=u.et;t.fillStyle=c,h=c}t.fillRect(f,o,l-f+1,a-o+1)}}},t}(),ci=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.at=new li,s}return r(i,t),i.prototype.I=function(t,i){this.wu();var n=this.vu.O(),s={Ki:this.lu,he:this._u.j().he(),Bu:n.wickVisible,zu:n.borderVisible,_:this.cu};return this.at.v(s),this.at},i.prototype.xu=function(t,i,n){var s=n.Y(t);return e(e({},this.Lu(t,i,n)),{et:s.H,Iu:s.Ru,Ft:s.Wu})},i}(ai),vi=function(){function t(){this.G=null,this.ju=[]}return t.prototype.v=function(t){this.G=t,this.ju=[]},t.prototype.s=function(t,i,n,s){if(null!==this.G&&0!==this.G.M.length&&null!==this.G._){this.ju.length||this.Uu(i);for(var h=Math.round(this.G.qu*i),r=Math.max(1,Math.floor(i)),e=this.G._.from;e<this.G._.to;e++){var u=this.G.M[e],o=this.ju[e-this.G._.from],a=Math.round(u.p*i);t.fillStyle=u.et,t.fillRect(o.ph,a,o.gh-o.ph+1,h-a+r)}}},t.prototype.Uu=function(t){if(null!==this.G&&0!==this.G.M.length&&null!==this.G._){var i=Math.ceil(this.G.he*t)<=3?0:Math.max(1,Math.floor(t)),n=Math.round(this.G.he*t)-i;this.ju=new Array(this.G._.to-this.G._.from);for(var s=this.G._.from;s<this.G._.to;s++){var h,r=this.G.M[s],e=Math.round(r.m*t),u=void 0,o=void 0;if(n%2)u=e-(h=(n-1)/2),o=e+h;else u=e-(h=n/2),o=e+h-1;this.ju[s-this.G._.from]={ph:u,gh:o,Hu:e,Yu:r.m*t,F:r.F}}for(s=this.G._.from+1;s<this.G._.to;s++){var a=this.ju[s-this.G._.from],f=this.ju[s-this.G._.from-1];a.F===f.F+1&&(a.ph-f.gh!==i+1&&(f.Hu>f.Yu?f.gh=a.ph-i-1:a.ph=f.gh+i+1))}var l=Math.ceil(this.G.he*t);for(s=this.G._.from;s<this.G._.to;s++){(a=this.ju[s-this.G._.from]).gh<a.ph&&(a.gh=a.ph);var c=a.gh-a.ph+1;l=Math.min(c,l)}if(i>0&&l<4)for(s=this.G._.from;s<this.G._.to;s++){(c=(a=this.ju[s-this.G._.from]).gh-a.ph+1)>l&&(a.Hu>a.Yu?a.gh-=1:a.ph+=1)}}else this.ju=[]},t}();function _i(t){return{M:[],he:t,qu:NaN,_:null}}var di=function(t){function i(i,n){var s=t.call(this,i,n,!1)||this;return s.S=new g,s.Ku=_i(0),s.$u=new Int32Array(0),s.at=new vi,s}return r(i,t),i.prototype.I=function(t,i){return this.wu(),this.S},i.prototype.Mu=function(){var t=this,i=this._u.j().he(),n=this.vu.Xu();this.Ku=_i(i);var s=this.vu.ku();this.$u=new Int32Array(this.vu.Ki().er());var h=0,r=0,e=0,u=this.vu.O().color;this.vu.Ki().Nu((function(i,o){var a=s(o.Z),f=o.Z[4],l=function(t,i,n){return{F:t,P:i,m:NaN,p:NaN,et:n}}(i,a,null!=f?n.Zu(f):u),c=null==f?0:f+1;return++r<t.Ku.M.length?t.Ku.M[r]=l:t.Ku.M.push(l),t.lu[e++]={F:i,m:0},t.$u[h++]=c,!1})),this.at.v(this.Ku),this.S.i([this.at])},i.prototype.mu=function(){t.prototype.mu.call(this),this.Ku._=null},i.prototype.gu=function(t,i,n){if(null!==this.cu){var s=i.he(),h=f(i.Rr()),r=t.$(this.vu.O().base,n);i.Qr(this.Ku.M),t.js(this.Ku.M,n),this.Ku.qu=r,this.Ku._=hi(this.Ku.M,h,!1),this.Ku.he=s,this.at.v(this.Ku)}},i}(ri),wi=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.Du=new Qt,s}return r(i,t),i.prototype.I=function(t,i){this.wu();var n=this.vu.O(),s={M:this.lu,N:n.color,ut:n.lineStyle,eu:n.lineType,rt:n.lineWidth,_:this.cu};return this.Du.v(s),this.Du},i.prototype.xu=function(t,i){return this.yu(t,i)},i}(ei),Mi=/[2-9]/g,bi=function(){function t(t){void 0===t&&(t=50),this.Bh=0,this.Vh=1,this.zh=1,this.Ph={},this.Fh={},this.Ih=t}return t.prototype.Gh=function(){this.Bh=0,this.Fh={},this.Vh=1,this.zh=1,this.Ph={}},t.prototype.Et=function(t,i,n){var s=n||Mi,h=String(i).replace(s,"0");if(this.Fh[h])return this.Fh[h].dt;if(this.Bh===this.Ih){var r=this.Ph[this.zh];delete this.Ph[this.zh],delete this.Fh[r],this.zh++,this.Bh--}var e=t.measureText(h).width;return 0===e&&i.length?0:(this.Fh[h]={dt:e,Wh:this.Vh},this.Ph[this.Vh]=h,this.Bh++,this.Vh++,e)},t}(),mi=function(){function t(t){this.Ju=null,this.Ee=null,this.Gu="right",this.br=0,this.Qu=t}return t.prototype.io=function(t,i,n,s){this.Ju=t,this.Ee=i,this.br=n,this.Gu=s},t.prototype.s=function(t,i){null!==this.Ee&&null!==this.Ju&&this.Ju.s(t,this.Ee,this.Qu,this.br,this.Gu,i)},t}(),pi=function(){function t(t,i,n){this.no=t,this.Qu=new bi(50),this.so=i,this.A=n,this.Le=-1,this.at=new mi(this.Qu)}return t.prototype.B=function(){this.no.B()},t.prototype.I=function(t,i){var n=this.A.ho(this.so);if(null===n)return null;var s=this.so.X();if(null===s)return null;var h=n.ro(s);if("overlay"===h)return null;var r=this.A.eo();return r.Lt!==this.Le&&(this.Le=r.Lt,this.Qu.Gh()),this.at.io(this.no.$t(),r,i,h),this.at},t}(),gi=function(){function t(){this.G=null}return t.prototype.v=function(t){this.G=t},t.prototype.s=function(t,i,h,r){if(null!==this.G&&!1!==this.G.tt){var e=Math.round(this.G.p*i);if(!(e<0||e>Math.ceil(this.G.wt*i))){var u=Math.ceil(this.G.dt*i);t.lineCap="butt",t.strokeStyle=this.G.et,t.lineWidth=Math.floor(this.G.rt*i),n(t,this.G.ut),s(t,e,0,u)}}},t}(),yi=function(){function t(t){this.uo={dt:0,wt:0,p:0,et:"rgba(0, 0, 0, 0)",rt:1,ut:0,tt:!1},this.oo=new gi,this.T=!0,this.vu=t,this._u=t.ct(),this.oo.v(this.uo)}return t.prototype.B=function(){this.T=!0},t.prototype.I=function(t,i){return this.T&&(this.ao(t,i),this.T=!1),this.oo},t}(),ki=function(t){function i(i){return t.call(this,i)||this}return r(i,t),i.prototype.ao=function(t,i){this.uo.tt=!1;var n=this.vu.X(),s=n.ys().ys;if(2===s||3===s){var h=this.vu.O();if(h.baseLineVisible){var r=this.vu.q();null!==r&&(this.uo.tt=!0,this.uo.p=n.$(r.Z,r.Z),this.uo.dt=i,this.uo.wt=t,this.uo.et=h.baseLineColor,this.uo.rt=h.baseLineWidth,this.uo.ut=h.baseLineStyle)}}},i}(yi);function Ni(t,i){return at(Math.min(Math.max(t,12),30)*i)}function xi(t,i){switch(t){case"arrowDown":case"arrowUp":return Ni(i,1);case"circle":return Ni(i,.8);case"square":return Ni(i,.7)}}function Si(t){return ot(Ni(t,1))}function Di(t){return Math.max(Ni(t,.1),3)}function Ci(t,i,n,s,h){var r=xi("square",n),e=(r-1)/2,u=t-e,o=i-e;return s>=u&&s<=u+r&&h>=o&&h<=o+r}function Ti(t,i,n,s,h){var r=(xi("arrowUp",h)-1)/2,e=(at(h/2)-1)/2;i.beginPath(),t?(i.moveTo(n-r,s),i.lineTo(n,s-r),i.lineTo(n+r,s),i.lineTo(n+e,s),i.lineTo(n+e,s+r),i.lineTo(n-e,s+r),i.lineTo(n-e,s)):(i.moveTo(n-r,s),i.lineTo(n,s+r),i.lineTo(n+r,s),i.lineTo(n+e,s),i.lineTo(n+e,s-r),i.lineTo(n-e,s-r),i.lineTo(n-e,s)),i.fill()}function Ei(t,i,n,s,h,r){return Ci(i,n,s,h,r)}var Ai=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.G=null,i.Qu=new bi,i.Le=-1,i.Be="",i.fo="",i}return r(i,t),i.prototype.v=function(t){this.G=t},i.prototype.io=function(t,i){this.Le===t&&this.Be===i||(this.Le=t,this.Be=i,this.fo=Ut(t,i),this.Qu.Gh())},i.prototype.lo=function(t,i){if(null===this.G||null===this.G._)return null;for(var n=this.G._.from;n<this.G._.to;n++){var s=this.G.M[n];if(Bi(s,t,i))return{co:s.vo,_o:s._o}}return null},i.prototype.h=function(t,i,n){if(null!==this.G&&null!==this.G._){t.textBaseline="middle",t.font=this.fo;for(var s=this.G._.from;s<this.G._.to;s++){var h=this.G.M[s];void 0!==h.Tt&&(h.Tt.dt=this.Qu.Et(t,h.Tt.do),h.Tt.wt=this.Le),Li(h,t)}}},i}(y);function Li(t,i){i.fillStyle=t.et,void 0!==t.Tt&&function(t,i,n,s){t.fillText(i,n,s)}(i,t.Tt.do,t.m-t.Tt.dt/2,t.Tt.p),function(t,i){if(0===t.er)return;switch(t.wo){case"arrowDown":return void Ti(!1,i,t.m,t.p,t.er);case"arrowUp":return void Ti(!0,i,t.m,t.p,t.er);case"circle":return void function(t,i,n,s){var h=(xi("circle",s)-1)/2;t.beginPath(),t.arc(i,n,h,0,2*Math.PI,!1),t.fill()}(i,t.m,t.p,t.er);case"square":return void function(t,i,n,s){var h=xi("square",s),r=(h-1)/2,e=i-r,u=n-r;t.fillRect(e,u,h,h)}(i,t.m,t.p,t.er)}t.wo}(t,i)}function Bi(t,i,n){return!(void 0===t.Tt||!function(t,i,n,s,h,r){var e=s/2;return h>=t&&h<=t+n&&r>=i-e&&r<=i+e}(t.m,t.Tt.p,t.Tt.dt,t.Tt.wt,i,n))||function(t,i,n){if(0===t.er)return!1;switch(t.wo){case"arrowDown":case"arrowUp":return Ei(0,t.m,t.p,t.er,i,n);case"circle":return function(t,i,n,s,h){var r=2+xi("circle",n)/2,e=t-s,u=i-h;return Math.sqrt(e*e+u*u)<=r}(t.m,t.p,t.er,i,n);case"square":return Ci(t.m,t.p,t.er,i,n)}t.wo}(t,i,n)}function Vi(t,i,n,s,h,r,e,u,o){var a=v(n)?n:n.close,f=v(n)?n:n.high,l=v(n)?n:n.low,c=v(i.size)?Math.max(i.size,0):1,_=Si(u.he())*c,d=_/2;switch(t.er=_,i.position){case"inBar":return t.p=e.$(a,o),void(void 0!==t.Tt&&(t.Tt.p=t.p+d+r+.6*h));case"aboveBar":return t.p=e.$(f,o)-d-s.Mo,void 0!==t.Tt&&(t.Tt.p=t.p-d-.6*h,s.Mo+=1.2*h),void(s.Mo+=_+r);case"belowBar":return t.p=e.$(l,o)+d+s.bo,void 0!==t.Tt&&(t.Tt.p=t.p+d+r+.6*h,s.bo+=1.2*h),void(s.bo+=_+r)}i.position}var zi=function(){function t(t,i){this.T=!0,this.mo=!0,this.po=!0,this.yo=null,this.at=new Ai,this.ko=t,this.ni=i,this.G={M:[],_:null}}return t.prototype.B=function(t){this.T=!0,this.po=!0,"data"===t&&(this.mo=!0)},t.prototype.I=function(t,i,n){this.T&&this.wu();var s=this.ni.O().layout;return this.at.io(s.fontSize,s.fontFamily),this.at.v(this.G),this.at},t.prototype.No=function(){if(this.po){if(this.ko.xo().length>0){var t=this.ni.j().he(),i=Di(t),n=1.5*Si(t)+2*i;this.yo={above:n,below:n}}else this.yo=null;this.po=!1}return this.yo},t.prototype.wu=function(){var t=this.ko.X(),i=this.ni.j(),n=this.ko.xo();this.mo&&(this.G.M=n.map((function(t){return{F:t.time,m:0,p:0,er:0,wo:t.shape,et:t.color,vo:t.vo,_o:t.id,Tt:void 0}})),this.mo=!1);var s=this.ni.O().layout;this.G._=null;var h=i.Rr();if(null!==h){var r=this.ko.q();if(null!==r&&0!==this.G.M.length){var e=NaN,u=Di(i.he()),o={Mo:u,bo:u};this.G._=hi(this.G.M,h,!0);for(var a=this.G._.from;a<this.G._.to;a++){var f=n[a];f.time!==e&&(o.Mo=u,o.bo=u,e=f.time);var l=this.G.M[a];l.m=i.J(f.time),void 0!==f.text&&f.text.length>0&&(l.Tt={do:f.text,p:0,dt:0,wt:0});var c=this.ko.So(f.time);null!==c&&Vi(l,f,c,o,s.fontSize,u,t,i,r.Z)}this.T=!1}}},t}(),Fi=function(t){function i(i){return t.call(this,i)||this}return r(i,t),i.prototype.ao=function(t,i){var n=this.uo;n.tt=!1;var s=this.vu.O();if(s.priceLineVisible){var h=this.vu.Do(void 0,0===s.priceLineSource);h.Co||(n.tt=!0,n.p=h.Bt,n.et=this.vu.To(h.et),n.dt=i,n.wt=t,n.rt=s.priceLineWidth,n.ut=s.priceLineStyle)}},i}(yi),Pi=function(t){function i(i,n){var s=t.call(this)||this;return s.ft=i,s.G=n,s}return r(i,t),i.prototype.Eo=function(){return this.ft},i.prototype.Ao=function(){return this.G},i.prototype.Xt=function(t,i,n){t.tt=!1,i.tt=!1;var s=this.ft.O(),h=s.lastValueVisible,r=""!==this.ft.Lo(),e=0===s.seriesLastValueMode,u=this.ft.Do(void 0,!1);u.Co||(h&&(t.Tt=this.Bo(u,h,e),t.tt=0!==t.Tt.length),(r||e)&&(i.Tt=this.Vo(u,h,r,e),i.tt=i.Tt.length>0),n.zt=this.ft.To(u.et),n.et=I(n.zt),n.Bt=u.Bt,i.Ft=this.ft.ct().O().layout.backgroundColor,t.Ft=n.zt)},i.prototype.Vo=function(t,i,n,s){var h="",r=this.ft.Lo();return n&&0!==r.length&&(h+=r+" "),i&&s&&(h+=this.ft.X().Ss()?t.zo:t.Fo),h.trim()},i.prototype.Bo=function(t,i,n){return i?n?this.ft.X().Ss()?t.Fo:t.zo:t.Tt:""},i}(H),Oi=function(){function t(t,i){this.$n=t,this.Po=i||null}return t.prototype.Os=function(){return this.$n},t.prototype.yh=function(){return this.Po},t.prototype.Dn=function(){return null===this.$n?null:{priceRange:this.$n.Dn(),margins:this.Po||void 0}},t.Cn=function(i){return null===i?null:new t(ht.Cn(i.priceRange),i.margins)},t}(),Ii=function(t){function i(i,n){var s=t.call(this,i)||this;return s.Oo=n,s}return r(i,t),i.prototype.ao=function(t,i){var n=this.uo;n.tt=!1;var s=this.Oo.Io();if(null!==s){var h=this.Oo.O();n.tt=!0,n.p=s,n.et=h.color,n.dt=i,n.wt=t,n.rt=h.lineWidth,n.ut=h.lineStyle}},i}(yi),Ri=function(t){function i(i,n){var s=t.call(this)||this;return s.ko=i,s.Oo=n,s}return r(i,t),i.prototype.Xt=function(t,i,n){t.tt=!1,i.tt=!1;var s=this.Oo.O();if(s.axisLabelVisible){var h=this.Oo.Io();null!==h&&(t.Tt=this.ko.X().lh(s.price),t.tt=!0,n.zt=s.color,n.et=I(s.color),n.Bt=h)}},i}(H),Wi=function(){function t(t,i){this.ko=t,this.Si=i,this.Ro=new Ii(t,this),this.no=new Ri(t,this)}return t.prototype.ms=function(t){c(this.Si,t),this.B(),this.ko.ct().se()},t.prototype.O=function(){return this.Si},t.prototype.Wo=function(){return this.Ro},t.prototype.jo=function(){return this.no},t.prototype.B=function(){this.Ro.B(),this.no.B()},t.prototype.Io=function(){var t=this.ko,i=t.X();if(t.ct().j().Gt()||i.Gt())return null;var n=t.q();return null===n?null:i.$(this.Si.price,n.Z)},t}(),ji=function(){function t(){this.Uo=0,this.qo=new Map,this.Ho=new Map}return t.prototype.Zu=function(t){return a(this.Ho.get(t))},t.prototype.Yo=function(t){var i=this.qo.get(t);return void 0===i&&(i=this.Uo++,this.qo.set(t,i),this.Ho.set(i,t)),i},t.prototype.rr=function(){this.Uo=0,this.qo.clear(),this.Ho.clear()},t.prototype.er=function(){return this.Ho.size},t}(),Ui=function(t){function i(i){var n=t.call(this)||this;return n.ni=i,n}return r(i,t),i.prototype.ct=function(){return this.ni},i.prototype.Mh=function(){return 0},i.prototype.mh=function(t,i){return null},i}(Z),qi={H:"",Wu:"",Ru:""},Hi=function(){function t(t){this.ko=t}return t.prototype.Y=function(t,i){var n=this.ko.Ko(),s=this.ko.O();switch(n){case"Line":return this.$o(s);case"Area":return this.Xo(s);case"Bar":return this.Zo(s,t,i);case"Candlestick":return this.Jo(s,t,i);case"Histogram":return this.Go(s,t,i)}throw new Error("Unknown chart style")},t.prototype.Zo=function(t,i,n){var s=e({},qi),h=t.upColor,r=t.downColor,u=h,o=r,a=f(this.Qo(i,n)),c=l(a.Z[0])<=l(a.Z[3]);return s.H=c?h:r,s.Wu=c?u:o,s},t.prototype.Jo=function(t,i,n){var s=e({},qi),h=t.upColor,r=t.downColor,u=t.borderUpColor,o=t.borderDownColor,a=t.wickUpColor,c=t.wickDownColor,v=f(this.Qo(i,n)),_=l(v.Z[0])<=l(v.Z[3]);return s.H=_?h:r,s.Wu=_?u:o,s.Ru=_?a:c,s},t.prototype.Xo=function(t){return e(e({},qi),{H:t.lineColor})},t.prototype.$o=function(t){return e(e({},qi),{H:t.color})},t.prototype.Go=function(t,i,n){var s=e({},qi),h=f(this.Qo(i,n)).Z[4];if(null!=h){var r=f(this.ko.Xu());s.H=r.Zu(h)}else s.H=t.color;return s},t.prototype.ta=function(){return this.ko.Ki()},t.prototype.Qo=function(t,i){return void 0!==i?i.Z:this.ta().ar(t)},t}(),Yi=function(){function t(t,i){void 0===t&&(t=null),void 0===i&&(i=null),this.hr=[],this.ia=0,this.na=0,this.sa=!1,this.ha=new Map,this.ra=new Map,this.ea=new Map,this.ua=t||new Map,this.oa=i}return t.prototype.rr=function(){this.hr=[],this.ia=0,this.na=0,this.sa=!1,this.ha.clear(),this.ra.clear(),this.ea.clear()},t.prototype.aa=function(){return this.er()>0?this.hr[this.ia]:null},t.prototype.fa=function(){return this.er()>0?this.hr[this.na-1]:null},t.prototype.ur=function(){return this.er()>0?this.la(this.ia):null},t.prototype.Yi=function(){return this.er()>0?this.la(this.na-1):null},t.prototype.er=function(){return this.na-this.ia},t.prototype.Gt=function(){return 0===this.er()},t.prototype.Hh=function(t){return null!==this.ca(t,0)},t.prototype.ar=function(t){return this.va(t)},t.prototype._a=function(t,i,n){if(this.sa)return!1;var s={Bi:t,Z:n,F:i},h=this.ca(t,0);return this.ra.clear(),this.ea.clear(),null===h?(this.hr.splice(this.da(t),0,s),this.ia=0,this.na=this.hr.length,!0):(this.hr[h]=s,!1)},t.prototype.va=function(t,i,n){void 0===i&&(i=0);var s=this.ca(t,i,n);if(null===s)return null;var h=this.wa(s);return{Bi:this.la(s),F:h.F,Z:h.Z}},t.prototype.Nu=function(t){for(var i=this.ia;i<this.na;++i){if(t(this.la(i),this.wa(i)))break}},t.prototype.Ma=function(i,n){var s=new t(this.ua,this.oa);return s.hr=this.hr,s.ia=this.da(i),s.na=this.ba(n),s.sa=!0,s},t.prototype.ma=function(t,i,n){if(this.Gt())return null;for(var s=null,h=0,r=n;h<r.length;h++){var e=r[h];s=Ki(s,this.pa(t,i,e))}return s},t.prototype.gn=function(t){return this.sa||0===t.length?null:this.Gt()||t[t.length-1].Bi<this.hr[0].Bi?this.ga(t):t[0].Bi>this.hr[this.hr.length-1].Bi?this.ya(t):1===t.length&&t[0].Bi===this.hr[this.hr.length-1].Bi?(this.ka(t[0]),t[0]):this.Na(t)},t.prototype.xa=function(t){if(this.sa)return null;var i=this.ca(t,1);if(null===i)return null;var n=this.hr.splice(i);return this.na=this.hr.length,this.ha.clear(),this.ra.clear(),this.ea.clear(),n.length>0?n[0]:null},t.prototype.la=function(t){return this.hr[t].Bi},t.prototype.wa=function(t){return this.hr[t]},t.prototype.ca=function(t,i,n){var s=this.Sa(t);if(null===s&&0!==i)switch(i){case-1:return this.Da(t,n);case 1:return this.Ca(t,n);default:throw new TypeError("Unknown search mode")}if(!n||null===s||0===i)return s;switch(i){case-1:return this.Ta(s);case 1:return this.Ea(s);default:throw new TypeError("Unknown search mode")}},t.prototype.Ea=function(t){for(var i=f(this.oa);t<this.na&&i(this.wa(t).Z);)t+=1;return t===this.na?null:t},t.prototype.Ta=function(t){for(var i=f(this.oa);t>=this.ia&&i(this.wa(t).Z);)t-=1;return t<this.ia?null:t},t.prototype.Da=function(t,i){var n=this.da(t);n>this.ia&&(n-=1);var s=n!==this.na&&this.la(n)<t?n:null;return i&&null!==s?this.Ta(s):s},t.prototype.Ca=function(t,i){var n=this.ba(t),s=n!==this.na&&t<this.la(n)?n:null;return i&&null!==s?this.Ea(s):s},t.prototype.Sa=function(t){var i=this.da(t);return i===this.na||t<this.hr[i].Bi?null:i},t.prototype.da=function(t){return ti(this.hr,t,(function(t,i){return t.Bi<i}),this.ia,this.na)},t.prototype.ba=function(t){return ii(this.hr,t,(function(t,i){return i.Bi>t}),this.ia,this.na)},t.prototype.Aa=function(t,i,n){var s=null,h=this.ua.get(n.La);if(void 0===h)throw new Error('Plot "'+n.La+'" is not registered');for(var r=t;r<i;r++){var e=h(this.hr[r].Z);null==e||Number.isNaN(e)||(null===s?s={Ba:e,Va:e}:(e<s.Ba&&(s.Ba=e),e>s.Va&&(s.Va=e)))}return s},t.prototype.za=function(t){var i=Math.floor(t.Bi/30);this.ha.forEach((function(t){return t.delete(i)}))},t.prototype.ga=function(t){return o(!this.sa,"collection should not be readonly"),o(0!==t.length,"plotRows should not be empty"),this.ra.clear(),this.ea.clear(),this.ha.clear(),this.hr=t.concat(this.hr),this.ia=0,this.na=this.hr.length,t[0]},t.prototype.ya=function(t){return o(!this.sa,"collection should not be readonly"),o(0!==t.length,"plotRows should not be empty"),this.ra.clear(),this.ea.clear(),this.ha.clear(),this.hr=this.hr.concat(t),this.ia=0,this.na=this.hr.length,t[0]},t.prototype.ka=function(t){o(!this.Gt(),"plot list should not be empty"),o(this.hr[this.na-1].Bi===t.Bi,"last row index should match new row index"),this.za(t),this.ra.delete(t.Bi),this.ea.delete(t.Bi),this.hr[this.na-1]=t},t.prototype.Na=function(t){return o(0!==t.length,"plot rows should not be empty"),this.ra.clear(),this.ea.clear(),this.ha.clear(),this.hr=function(t,i){var n=function(t,i){var n=t.length,s=i.length,h=n+s,r=0,e=0;for(;r<n&&e<s;)t[r].Bi<i[e].Bi?r++:t[r].Bi>i[e].Bi?e++:(r++,e++,h--);return h}(t,i),s=new Array(n),h=0,r=0,e=t.length,u=i.length,o=0;for(;h<e&&r<u;)t[h].Bi<i[r].Bi?(s[o]=t[h],h++):t[h].Bi>i[r].Bi?(s[o]=i[r],r++):(s[o]=i[r],h++,r++),o++;for(;h<e;)s[o]=t[h],h++,o++;for(;r<u;)s[o]=i[r],r++,o++;return s}(this.hr,t),this.ia=0,this.na=this.hr.length,t[0]},t.prototype.pa=function(t,i,n){if(this.Gt())return null;var s=null,h=f(this.ur()),r=f(this.Yi()),e=t-n.Fa,u=i-n.Fa;e=Math.max(e,h),u=Math.min(u,r);var o=30*Math.ceil(e/30),a=Math.max(o,30*Math.floor(u/30)),l=this.da(e),c=this.ba(Math.min(u,o,i));s=Ki(s,this.Aa(l,c,n));var v=this.ha.get(n.La);void 0===v&&(v=new Map,this.ha.set(n.La,v));for(var _=Math.max(o+1,e);_<a;_+=30){var d=Math.floor(_/30),w=v.get(d);if(void 0===w){var M=this.da(30*d),b=this.ba(30*(d+1)-1);w=this.Aa(M,b,n),v.set(d,w)}s=Ki(s,w)}l=this.da(a),c=this.ba(u);return s=Ki(s,this.Aa(l,c,n))},t}();function Ki(t,i){return null===t?i:null===i?t:{Ba:Math.min(t.Ba,i.Ba),Va:Math.max(t.Va,i.Va)}}var $i={open:function(t){return t[0]},high:function(t){return t[1]},low:function(t){return t[2]},close:function(t){return t[3]},hl2:function(t){return(t[1]+t[2])/2},hlc3:function(t){return(t[1]+t[2]+t[3])/3},ohlc4:function(t){return(t[0]+t[1]+t[2]+t[3])/4}},Xi=["open","high","low","close","hl2","hlc3","ohlc4"];function Zi(t){return $i[t]}var Ji=function(){function t(){var t;this.Pa=new Yi((t=new Map,Xi.forEach((function(i,n){t.set(i,Zi(i))})),t))}return t.prototype.Ki=function(){return this.Pa},t.prototype.er=function(){return this.Pa.er()},t.prototype.Nu=function(t){this.Pa.Nu(t)},t.prototype.rr=function(){this.Pa.rr()},t.prototype.Gt=function(){return this.Pa.Gt()},t.prototype.aa=function(){return this.Pa.aa()},t.prototype.fa=function(){return this.Pa.fa()},t.prototype.va=function(t,i){return this.Ki().va(t,i)},t.prototype.ar=function(t){return this.va(t)},t}(),Gi=function(t){function i(i,n,s){var h=t.call(this,i)||this;h.G=new Ji,h.Ro=new Fi(h),h.Oa=[],h.Ia=new ki(h),h.Ra=!1,h.Wa=null,h.ja=new ji,h.Ua=[],h.qa=[],h.Si=n,h.Ha=s;var r=new Pi(h,{ct:i});return h.pi=[r],h.Ya=new pi(r,h,i),h.Ka(),h.$a(),h.Xa=h.ku(),h.Za(),h}return r(i,t),i.prototype.ln=function(){},i.prototype.Ja=function(){return this.Ra},i.prototype.To=function(t){return this.Si.priceLineColor||t},i.prototype.Do=function(t,i,n){var s={Co:!0},h=this.X();if(this.ct().j().Gt()||h.Gt()||this.pu().Gt())return s;var r,e,u=this.ct().j().Rr(),o=this.q();if(null===u||null===o)return s;if(i){var a=this.pu().Ki().fa();if(null===a)return s;r=a,e=a.Bi}else{var f=this.pu().Ki().va(u.gh(),-1);if(null===f)return s;if(null===(r=this.pu().Ki().ar(f.Bi)))return s;e=f.Bi}var l=void 0!==t?r.Z[t]:this.Xa(r.Z),c=this.K().Y(e,{Z:r}),v=h.$(l,o.Z);return{Co:!1,P:n?l:void 0,Tt:h.Qt(l,o.Z),zo:h.lh(l),Fo:h._h(l,o.Z),et:c.H,Bt:v,Bi:e}},i.prototype.pu=function(){return this.G},i.prototype.K=function(){return null!==this.Wa||(this.Wa=new Hi(this)),this.Wa},i.prototype.O=function(){return this.Si},i.prototype.ms=function(t){var i=t.priceScaleId;void 0!==i&&i!==this.Si.priceScaleId&&this.ct().Ga(this,i),c(this.Si,t),null!==this.oi&&void 0!==t.scaleMargins&&this.oi.ms({scaleMargins:t.scaleMargins}),void 0!==t.priceFormat&&this.Ka(),this.ct().Qa(this)},i.prototype.tf=function(){this.G.rr(),this.ja.rr(),this.Za()},i.prototype.if=function(t,i){void 0===i&&(i=!1),i&&this.G.rr(),this.G.Ki().gn(t),this.nf(),this.Li.B("data"),this.Di.B("data");var n=this.ct().ho(this);this.ct().sf(n),this.ct().Qa(this),this.ct().hf(),this.ct().se()},i.prototype.rf=function(t){this.Ua=t.map((function(t){return e({},t)})),this.nf();var i=this.ct().ho(this);this.Di.B("data"),this.ct().sf(i),this.ct().Qa(this),this.ct().hf(),this.ct().se()},i.prototype.ef=function(){return this.Ua},i.prototype.xo=function(){return this.qa},i.prototype.uf=function(t){var i=new Wi(this,t);return this.Oa.push(i),this.ct().Qa(this),i},i.prototype.af=function(t){var i=this.Oa.indexOf(t);-1!==i&&this.Oa.splice(i,1),this.ct().Qa(this)},i.prototype.Xu=function(){return this.ja},i.prototype.Ko=function(){return this.Ha},i.prototype.q=function(){var t=this.ff();return null===t?null:{Z:this.Xa(t.Z),ih:t.F}},i.prototype.ff=function(){var t=this.ct().j().Rr();if(null===t)return null;var i=t.ph();return this.pu().va(i,1)},i.prototype.Ki=function(){return this.G.Ki()},i.prototype.nr=function(t,i){var n=this.lf(t,i);return n?n.Bi:null},i.prototype.lf=function(t,i){return _(t)?this.pu().va(t,i):null},i.prototype.So=function(t){var i=this.pu().ar(t);return null===i?null:"Bar"===this.Ha||"Candlestick"===this.Ha?{open:i.Z[0],high:i.Z[1],low:i.Z[2],close:i.Z[3]}:this.ku()(i.Z)},i.prototype._i=function(){var t=[];this.cf()||t.push(this.Ia);for(var i=0,n=this.Oa;i<n.length;i++){var s=n[i];t.push(s.Wo())}return t.push(this.Li),t.push(this.Ro),t.push(this.Ya),t.push(this.Di),t},i.prototype.vi=function(t,i){for(var n=i===this.oi||this.cf()?u(this.pi):[],s=0,h=this.Oa;s<h.length;s++){var r=h[s];n.push(r.jo())}return n},i.prototype.mh=function(t,i){var n=this;if(void 0!==this.Si.autoscaleInfoProvider){var s=this.Si.autoscaleInfoProvider((function(){var s=n.vf(t,i);return null===s?null:s.Dn()}));return Oi.Cn(s)}return this.vf(t,i)},i.prototype.Mh=function(){return this.Si.priceFormat.minMove},i.prototype.ah=function(){return this.fs},i.prototype.ku=function(){return this.Xa},i.prototype.Ui=function(){this.Li.B(),this.Di.B();for(var t=0,i=this.pi;t<i.length;t++){i[t].B()}for(var n=0,s=this.Oa;n<s.length;n++){s[n].B()}this.Ro.B(),this.Ia.B()},i.prototype.ci=function(t){this.oi!==t&&(this.oi=t)},i.prototype.X=function(){return f(this.oi)},i.prototype.U=function(t){if(!(("Line"===this.Ha||"Area"===this.Ha)&&this.Si.crosshairMarkerVisible))return null;var i=this.G.ar(t);return null===i?null:{P:this.Xa(i.Z),k:this._f()}},i.prototype.Lo=function(){return this.Si.title},i.prototype.cf=function(){return!Ht(this.X().bs())},i.prototype.vf=function(t,i){if(!_(t)||!_(i)||this.pu().Gt())return null;var n,s="Line"===this.Ha||"Area"===this.Ha||"Histogram"===this.Ha?"close":null,h=null!==(n=null!==s?this.pu().Ki().ma(t,i,[{La:s,Fa:0}]):this.pu().Ki().ma(t,i,[{La:"low",Fa:0},{La:"high",Fa:0}]))?new ht(n.Ba,n.Va):null;if("Histogram"===this.Ko()){var r=this.Si.base,e=new ht(r,r);h=null!==h?h.gn(e):e}return new Oi(h,this.Di.No())},i.prototype._f=function(){switch(this.Ha){case"Line":case"Area":return this.Si.crosshairMarkerRadius}return 0},i.prototype.Ka=function(){switch(this.Si.priceFormat.type){case"custom":this.fs={Gi:this.Si.priceFormat.formatter};break;case"volume":this.fs=new Zt(this.Si.priceFormat.precision);break;case"percent":this.fs=new nt(this.Si.priceFormat.precision);break;default:var t=Math.pow(10,this.Si.priceFormat.precision);this.fs=new it(t,this.Si.priceFormat.minMove*t,!1,void 0)}null!==this.oi&&this.oi.ps()},i.prototype.$a=function(){this.Xa=Zi("close")},i.prototype.nf=function(){var t=this.ct().j().Hr();0!==t.er()?this.qa=this.Ua.map((function(i,n){return{time:f(t.cr(i.time.timestamp,!0)),position:i.position,shape:i.shape,color:i.color,id:i.id,vo:n,text:i.text,size:i.size}})):this.qa=[]},i.prototype.Za=function(){switch(this.Di=new zi(this,this.ct()),this.Ha){case"Bar":this.Li=new fi(this,this.ct());break;case"Candlestick":this.Li=new ci(this,this.ct());break;case"Line":this.Li=new wi(this,this.ct());break;case"Area":this.Li=new ui(this,this.ct());break;case"Histogram":this.Li=new di(this,this.ct());break;default:throw Error("Unknown chart style assigned: "+this.Ha)}},i}(Ui),Qi=function(){function t(t){this.Si=t}return t.prototype.df=function(t,i,n){var s=t;if(0===this.Si.mode)return s;var h=n.Ti(),r=h.q();if(null===r)return s;var e=h.$(t,r),u=n.Zs().filter((function(t){return t instanceof Gi})).reduce((function(t,s){if(n.wf(s))return t;var h=s.X(),r=s.Ki();if(h.Gt()||!r.Hh(i))return t;var e=r.ar(i);if(null===e)return t;var u=[e.Z[3]],o=l(s.q());return t.concat(u.map((function(t){return h.$(t,o.Z)})))}),[]);if(0===u.length)return s;u.sort((function(t,i){return Math.abs(t-e)-Math.abs(i-e)}));var o=u[0];return s=h.Ei(o,r)},t}(),tn=function(){function t(t,i){this.rs=[],this.Mf=new Map,this.Hn=0,this.br=0,this.bf=1e3,this.es=null,this.mf=new st,this.pf=t,this.ni=i;var n=i.O();this.gf=this.yf("left",n.leftPriceScale),this.kf=this.yf("right",n.rightPriceScale),this.gf.Ls().sn(this.Nf.bind(this,this.gf),this),this.kf.Ls().sn(this.Nf.bind(this,this.gf),this),this.xf(n)}return t.prototype.xf=function(t){if(t.leftPriceScale&&this.gf.ms(t.leftPriceScale),t.rightPriceScale&&this.kf.ms(t.rightPriceScale),t.localization&&(this.gf.ps(),this.kf.ps()),t.overlayPriceScales)for(var i=0,n=Array.from(this.Mf.values());i<n.length;i++){var s=f(n[i][0].X());s.ms(t.overlayPriceScales),t.localization&&s.ps()}},t.prototype.Sf=function(t){switch(t){case"left":return this.gf;case"right":return this.kf}return this.Mf.has(t)?a(this.Mf.get(t))[0].X():null},t.prototype.ln=function(){this.ct().Df().on(this),this.gf.Ls().on(this),this.kf.Ls().on(this),this.rs.forEach((function(t){t.ln&&t.ln()})),this.mf.an()},t.prototype.Cf=function(){return this.bf},t.prototype.Tf=function(t){this.bf=t},t.prototype.ct=function(){return this.ni},t.prototype.dt=function(){return this.br},t.prototype.wt=function(){return this.Hn},t.prototype.$r=function(t){this.br=t,this.Ui()},t.prototype.Bs=function(t){var i=this;this.Hn=t,this.gf.Bs(t),this.kf.Bs(t),this.rs.forEach((function(n){if(i.wf(n)){var s=n.X();null!==s&&s.Bs(t)}})),this.Ui()},t.prototype.Zs=function(){return this.rs},t.prototype.wf=function(t){var i=t.X();return null===i||this.gf!==i&&this.kf!==i},t.prototype.Gs=function(t,i,n){var s=void 0!==n?n:this.Af().Ef-1;this.Lf(t,i,s)},t.prototype.th=function(t){var i=this.rs.indexOf(t);o(-1!==i,"removeDataSource: invalid data source"),this.rs.splice(i,1);var n=f(t.X()).bs();if(this.Mf.has(n)){var s=a(this.Mf.get(n)),h=s.indexOf(t);-1!==h&&(s.splice(h,1),0===s.length&&this.Mf.delete(n))}var r=t.X();r&&r.Zs().indexOf(t)>=0&&r.th(t),null!==r&&(r.Qs(),this.Bf(r)),this.es=null},t.prototype.ro=function(t){return t===this.gf?"left":t===this.kf?"right":"overlay"},t.prototype.Vf=function(){return this.gf},t.prototype.zf=function(){return this.kf},t.prototype.Ff=function(t,i){t.sh(i)},t.prototype.Pf=function(t,i){t.hh(i),this.Ui()},t.prototype.Of=function(t){t.rh()},t.prototype.If=function(t,i){t.eh(i)},t.prototype.Rf=function(t,i){t.uh(i),this.Ui()},t.prototype.Wf=function(t){t.oh()},t.prototype.jf=function(t,i){t.gs({Cs:i}),this.pf.Gt()?t.Es(null):this.Bf(t)},t.prototype.Ui=function(){this.rs.forEach((function(t){t.Ui()}))},t.prototype.Ti=function(){var t=null;return this.ni.O().rightPriceScale.visible&&0!==this.kf.Zs().length?t=this.kf:this.ni.O().leftPriceScale.visible&&0!==this.gf.Zs().length?t=this.gf:0!==this.rs.length&&(t=this.rs[0].X()),null===t&&(t=this.kf),t},t.prototype.Bf=function(t){null!==t&&t.xs()&&this.Uf(t)},t.prototype.qf=function(t){var i=this.pf.Rr();t.gs({Cs:!0}),null!==i&&t.wh(i),this.Ui()},t.prototype.Hf=function(){this.Uf(this.gf),this.Uf(this.kf)},t.prototype.Yf=function(){var t=this;this.Bf(this.gf),this.Bf(this.kf),this.rs.forEach((function(i){t.wf(i)&&t.Bf(i.X())})),this.Ui(),this.ni.se()},t.prototype.Gt=function(){return 0===this.rs.length},t.prototype.Js=function(){return null===this.es&&(this.es=pt(this.rs)),this.es},t.prototype.Kf=function(){return this.mf},t.prototype.Uf=function(t){var i=t.dh();if(i&&i.length>0&&!this.pf.Gt()){var n=this.pf.Rr();null!==n&&t.wh(n)}t.Ui()},t.prototype.Af=function(){var t=this.Js();if(0===t.length)return{Ef:0,$f:0};for(var i=0,n=0,s=0;s<t.length;s++){var h=t[s].fi();null!==h&&(h<i&&(i=h),h>n&&(n=h))}return{Ef:i,$f:n}},t.prototype.Lf=function(t,i,n){var s=this.Sf(i);if(null===s&&(s=this.yf(i,this.ni.O().overlayPriceScales)),this.rs.push(t),!Ht(i)){var h=this.Mf.get(i)||[];h.push(t),this.Mf.set(i,h)}s.Gs(t),t.ci(s),t.li(n),this.Bf(s),this.es=null},t.prototype.Nf=function(t,i,n){i.ys!==n.ys&&this.Uf(t)},t.prototype.yf=function(t,i){var n=e({tt:!0,Cs:!0},b(i)),s=new Nt(t,n,this.ni.O().layout,this.ni.O().localization);return s.Bs(this.wt()),s},t}(),nn=function(t){function i(i){var n=t.call(this)||this;return n.Xf=new Map,n.G=i,n}return r(i,t),i.prototype.h=function(t){},i.prototype.o=function(t){if(this.G.tt){t.save();for(var i=0,n=0,s=this.G.Zf;n<s.length;n++){if(0!==(o=s[n]).Tt.length){t.font=o.gt;var h=this.Jf(t,o.Tt);h>this.G.dt?o.ve=this.G.dt/h:o.ve=1,i+=o.Gf*o.ve}}var r=0;switch(this.G.Qf){case"top":r=0;break;case"center":r=Math.max((this.G.wt-i)/2,0);break;case"bottom":r=Math.max(this.G.wt-i,0)}t.fillStyle=this.G.et;for(var e=0,u=this.G.Zf;e<u.length;e++){var o=u[e];t.save();var a=0;switch(this.G.tl){case"left":t.textAlign="left",a=o.Gf/2;break;case"center":t.textAlign="center",a=this.G.dt/2;break;case"right":t.textAlign="right",a=this.G.dt-1-o.Gf/2}t.translate(a,r),t.textBaseline="top",t.font=o.gt,t.scale(o.ve,o.ve),t.fillText(o.Tt,0,o.il),t.restore(),r+=o.Gf*o.ve}t.restore()}},i.prototype.Jf=function(t,i){var n=this.nl(t.font),s=n.get(i);return void 0===s&&(s=t.measureText(i).width,n.set(i,s)),s},i.prototype.nl=function(t){var i=this.Xf.get(t);return void 0===i&&(i=new Map,this.Xf.set(t,i)),i},i}(y),sn=function(){function t(t){this.T=!0,this.ot={tt:!1,et:"",wt:0,dt:0,Zf:[],Qf:"center",tl:"center"},this.at=new nn(this.ot),this.ft=t}return t.prototype.B=function(){this.T=!0},t.prototype.I=function(t,i){return this.T&&(this.R(t,i),this.T=!1),this.at},t.prototype.R=function(t,i){var n=this.ft.O(),s=this.ot;s.tt=n.visible,s.tt&&(s.et=n.color,s.dt=i,s.wt=t,s.tl=n.horzAlign,s.Qf=n.vertAlign,s.Zf=[{Tt:n.text,gt:Ut(n.fontSize),Gf:1.2*n.fontSize,il:0,ve:0}])},t}(),hn=function(t){function i(i,n){var s=t.call(this)||this;return s.Si=n,s.Li=new sn(s),s}return r(i,t),i.prototype._i=function(){return[this.Li]},i.prototype.O=function(){return this.Si},i.prototype.Ui=function(){this.Li.B()},i}(Z),rn=function(){function t(t,i){this.sl=[],this.hl=[],this.br=0,this.rl=null,this.el=null,this.ul=new st,this.ol=new st,this.al=t,this.Si=i,this.fl=new qt(this),this.pf=new Rt(this,i.timeScale,this.Si.localization),this.ll=new $t,this.L=new J(this,i.crosshair),this.cl=new Qi(i.crosshair),this.vl=new hn(this,i.watermark),this._l(),this.sl[0].Tf(2e3)}return t.prototype.dl=function(){this.wl(new Xt(3))},t.prototype.se=function(){this.wl(new Xt(2))},t.prototype.Qa=function(t){var i=this.Ml(t);this.wl(i)},t.prototype.bl=function(){return this.el},t.prototype.ml=function(t){var i=this.el;this.el=t,null!==i&&this.Qa(i.pl),null!==t&&this.Qa(t.pl)},t.prototype.O=function(){return this.Si},t.prototype.ms=function(t){c(this.Si,t),this.sl.forEach((function(i){return i.xf(t)})),void 0!==t.timeScale&&this.pf.ms(t.timeScale),void 0!==t.localization&&this.pf.zr(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.ul.an(),this.dl()},t.prototype.gl=function(t,i){var n=this.yl(t);null!==n&&(n.X.ms(i),this.ul.an())},t.prototype.yl=function(t){for(var i=0,n=this.sl;i<n.length;i++){var s=n[i],h=s.Sf(t);if(null!==h)return{lt:s,X:h}}return null},t.prototype.kl=function(){this.sl.forEach((function(t){return t.Ui()})),this.hf()},t.prototype.j=function(){return this.pf},t.prototype.Nl=function(){return this.sl},t.prototype.xl=function(){return this.ll},t.prototype.Sl=function(){return this.vl},t.prototype.Dl=function(){return this.L},t.prototype.Cl=function(){return this.ol},t.prototype.dt=function(){return this.br},t.prototype.Tl=function(t,i){t.Bs(i),this.ne(),this.se()},t.prototype.$r=function(t){this.br=t,this.pf.$r(this.br),this.sl.forEach((function(i){return i.$r(t)})),this.ne()},t.prototype._l=function(t){var i=new tn(this.pf,this);void 0!==t?this.sl.splice(t,0,i):this.sl.push(i);var n=void 0===t?this.sl.length-1:t,s=new Xt(3);return s.Xe(n,{Ze:0,Cs:!0}),this.qe(s),i},t.prototype.Ff=function(t,i,n){t.Ff(i,n)},t.prototype.Pf=function(t,i,n){t.Pf(i,n),this.hf(),this.wl(this.El(t,2))},t.prototype.Of=function(t,i){t.Of(i),this.wl(this.El(t,2))},t.prototype.If=function(t,i,n){i.xs()||t.If(i,n)},t.prototype.Rf=function(t,i,n){i.xs()||(t.Rf(i,n),this.hf(),this.wl(this.El(t,2)))},t.prototype.Wf=function(t,i){i.xs()||(t.Wf(i),this.wl(this.El(t,2)))},t.prototype.jf=function(t,i,n){t.jf(i,n),this.wl(this.El(t,2))},t.prototype.qf=function(t,i){t.qf(i),this.wl(this.El(t,2))},t.prototype.Al=function(t){this.pf.sh(t)},t.prototype.Ll=function(t,i){var n=this.j();if(!n.Gt()&&0!==i){var s=n.dt();t=Math.max(1,Math.min(t,s)),n.ve(t,i),this.hf(),this.ne(),this.se()}},t.prototype.Bl=function(t){this.Vl(0),this.zl(t),this.Fl()},t.prototype.Pl=function(t){this.pf.hh(t),this.ne(),this.hf(),this.se()},t.prototype.Ol=function(){this.pf.rh(),this.se()},t.prototype.Vl=function(t){this.rl=t,this.pf.eh(t)},t.prototype.zl=function(t){var i=!1;return null!==this.rl&&Math.abs(t-this.rl)>20&&(this.rl=null,i=!0),this.pf.uh(t),this.ne(),this.hf(),this.se(),i},t.prototype.Fl=function(){this.pf.oh(),this.se(),this.rl=null},t.prototype.Il=function(){this.pf.fe(),this.ne(),this.hf(),this.se()},t.prototype.qe=function(t){this.al&&this.al(t),this.ll.qe(),this.se()},t.prototype.V=function(){return this.hl},t.prototype.Rl=function(t,i,n){this.L.Vi(t,i);var s=NaN,h=this.pf.te(t),r=this.pf.Rr();null!==r&&(h=Math.min(Math.max(r.ph(),h),r.gh()));var e=n.Ti(),u=e.q();null!==u&&(s=e.Ei(i,u)),s=this.cl.df(s,h,n),this.L.Oi(h,s,n),this.Wl(),this.ol.an(this.L.W(),{x:t,y:i})},t.prototype.jl=function(){this.Dl().Ri(),this.Wl(),this.ol.an(null,null)},t.prototype.hf=function(){var t=this.L.lt();if(null!==t){var i=this.L.Fi(),n=this.L.Pi();this.Rl(i,n,t)}},t.prototype.Ul=function(t,i,n,s){s&&this.pf.Gh(),this.pf.B(t,i,n)},t.prototype.ql=function(t){var i=this.hl.reduce((function(t,i){var n=i.Ki();if(n.Gt())return t;var s=f(n.Yi());return void 0===t?s:Math.max(s,t)}),void 0);if(void 0!==i){var n=this.pf,s=n.Gr(),h=n.Rr();if(null!==h){var r=h.Hh(s);if(void 0!==t&&t>0&&!r){var e=i-s;n.Ir(n.ee()-e)}}n.ce(i)}this.hf(),this.ne(),this.se()},t.prototype.sf=function(t){null!==t&&t.Yf()},t.prototype.ho=function(t){var i=this.sl.find((function(i){return i.Js().includes(t)}));return void 0===i?null:i},t.prototype.ne=function(){this.sl.forEach((function(t){return t.Yf()})),this.kl()},t.prototype.ln=function(){this.sl.forEach((function(t){return t.ln()})),this.sl.length=0,this.Si.localization.priceFormatter=void 0,this.Si.localization.timeFormatter=void 0},t.prototype.Hl=function(){return this.fl},t.prototype.eo=function(){return this.fl.O()},t.prototype.Df=function(){return this.ul},t.prototype.Yl=function(t,i){var n=this.sl[0],s=this.Kl(i,t,n);return this.hl.push(s),1===this.hl.length?this.dl():this.se(),s},t.prototype.$l=function(t){var i=this.ho(t),n=this.hl.indexOf(t);o(-1!==n,"Series not found"),this.hl.splice(n,1),f(i).th(t),t.ln&&t.ln()},t.prototype.Ga=function(t,i){var n=f(this.ho(t));n.th(t);var s=this.yl(i);if(null===s){var h=t.fi();n.Gs(t,i,h)}else{h=s.lt===n?t.fi():void 0;s.lt.Gs(t,i,h)}},t.prototype.ge=function(){var t=new Xt(2);t.tu(),this.wl(t)},t.prototype.Xl=function(t){var i=new Xt(2);i.ye(t),this.wl(i)},t.prototype.Zl=function(){return this.Si.rightPriceScale.visible?"right":"left"},t.prototype.El=function(t,i){var n=new Xt(i);if(null!==t){var s=this.sl.indexOf(t);n.Xe(s,{Ze:i})}return n},t.prototype.Ml=function(t,i){return void 0===i&&(i=2),this.El(this.ho(t),i)},t.prototype.wl=function(t){this.al&&this.al(t),this.ll.qe()},t.prototype.Wl=function(){this.wl(new Xt(1))},t.prototype.Kl=function(t,i,n){var s=new Gi(this,t,i),h=void 0!==t.priceScaleId?t.priceScaleId:this.Zl();return n.Gs(s,h),Ht(h)||s.ms(t),s},t}(),en={allowDownsampling:!0};var un=function(){function t(t,i){var n=this;this._resolutionMediaQueryList=null,this._resolutionListener=function(t){return n._onResolutionChanged()},this._canvasConfiguredListeners=[],this.canvas=t,this._canvasSize={width:this.canvas.clientWidth,height:this.canvas.clientHeight},this._options=i,this._configureCanvas(),this._installResolutionListener()}return t.prototype.destroy=function(){this._canvasConfiguredListeners.length=0,this._uninstallResolutionListener(),this.canvas=null},Object.defineProperty(t.prototype,"canvasSize",{get:function(){return{width:this._canvasSize.width,height:this._canvasSize.height}},enumerable:!0,configurable:!0}),t.prototype.resizeCanvas=function(t){this._canvasSize={width:t.width,height:t.height},this._configureCanvas()},Object.defineProperty(t.prototype,"pixelRatio",{get:function(){var t=this.canvas.ownerDocument.defaultView;if(null==t)throw new Error("No window is associated with the canvas");return t.devicePixelRatio>1||this._options.allowDownsampling?t.devicePixelRatio:1},enumerable:!0,configurable:!0}),t.prototype.subscribeCanvasConfigured=function(t){this._canvasConfiguredListeners.push(t)},t.prototype.unsubscribeCanvasConfigured=function(t){this._canvasConfiguredListeners=this._canvasConfiguredListeners.filter((function(i){return i!=t}))},t.prototype._configureCanvas=function(){var t=this.pixelRatio;this.canvas.style.width=this._canvasSize.width+"px",this.canvas.style.height=this._canvasSize.height+"px",this.canvas.width=this._canvasSize.width*t,this.canvas.height=this._canvasSize.height*t,this._emitCanvasConfigured()},t.prototype._emitCanvasConfigured=function(){var t=this;this._canvasConfiguredListeners.forEach((function(i){return i.call(t)}))},t.prototype._installResolutionListener=function(){if(null!==this._resolutionMediaQueryList)throw new Error("Resolution listener is already installed");var t=this.canvas.ownerDocument.defaultView;if(null==t)throw new Error("No window is associated with the canvas");var i=t.devicePixelRatio;this._resolutionMediaQueryList=t.matchMedia("all and (resolution: "+i+"dppx)"),this._resolutionMediaQueryList.addListener(this._resolutionListener)},t.prototype._uninstallResolutionListener=function(){null!==this._resolutionMediaQueryList&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},t.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},t.prototype._onResolutionChanged=function(){this._configureCanvas(),this._reinstallResolutionListener()},t}(),on=function(){function t(t,i){this.st=t,this.ht=i}return t.prototype._n=function(t){return this.st===t.st&&this.ht===t.ht},t}();function an(t){return t.ownerDocument&&t.ownerDocument.defaultView&&t.ownerDocument.defaultView.devicePixelRatio||1}function fn(t){var i=f(t.getContext("2d"));return i.setTransform(1,0,0,1,0,0),i}function ln(t){var i=t.createElement("canvas");return function(t){t.style.userSelect="none",t.style.webkitUserSelect="none",t.style.msUserSelect="none",t.style.MozUserSelect="none",t.style.webkitTapHighlightColor="transparent"}(i),i}function cn(t,i){var n=ln(t),s=an(n);return n.style.width=i.st+"px",n.style.height=i.ht+"px",n.width=i.st*s,n.height=i.ht*s,n}function vn(t,i){var n=ln(f(t.ownerDocument));t.appendChild(n);var s=function(t,i){return void 0===i&&(i=en),new un(t,i)}(n);return s.resizeCanvas({width:i.st,height:i.ht}),s}var _n=!!navigator.maxTouchPoints||!!navigator.msMaxTouchPoints||"ontouchstart"in window||Boolean(window.DocumentTouch&&document instanceof window.DocumentTouch),dn="onorientationchange"in window&&_n,wn=/Android/i.test(navigator.userAgent),Mn=/iPhone|iPad|iPod|AppleWebKit.+Mobile/i.test(navigator.userAgent),bn=wn||Mn,mn=function(){function t(t,i,n){this.Jl=0,this.Gl=null,this.Ql=null,this.tc=!1,this.ic=null,this.nc=!1,this.sc=!1,this.hc=null,this.rc=null,this.ec=null,this.uc=null,this.oc=0,this.ac=!1,this.fc=!1,this.lc=!1,this.cc=t,this.vc=i,this.Si=n,this._c()}return t.prototype.ln=function(){null!==this.hc&&(this.hc(),this.hc=null),null!==this.rc&&(this.rc(),this.rc=null),null!==this.ec&&(this.ec(),this.ec=null),this.dc(),this.wc()},t.prototype.Mc=function(t){var i=this;this.rc&&this.rc();var n=this.bc.bind(this);this.rc=function(){i.cc.removeEventListener("mousemove",n)},this.cc.addEventListener("mousemove",n),yn(t)&&this.bc(t);var s=this.mc(t);this.pc(s,this.vc.gc)},t.prototype.wc=function(){null!==this.Gl&&clearTimeout(this.Gl),this.Jl=0,this.Gl=null},t.prototype.bc=function(t){if(!this.lc||yn(t)){var i=this.mc(t);this.pc(i,this.vc.yc)}},t.prototype.kc=function(t){if((!("button"in t)||0===t.button)&&null===this.uc){var i=yn(t);if(!this.fc||!i){this.ac=!0;var n=this.mc(t),s=l(this.ic),h=Math.abs(s.m-n.Nc),r=Math.abs(s.p-n.xc),e=h+r>5;if(e||!i){if(e&&!this.nc&&i){var u=.5*h,o=r>=u&&!this.Si.Sc,a=u>r&&!this.Si.Dc;o||a||(this.fc=!0)}e&&(this.nc=!0,this.sc=!0,i&&this.dc()),this.fc||(this.pc(n,this.vc.Cc),i&&kn(t))}}}},t.prototype.Tc=function(t){if(!("button"in t)||0===t.button){var i=this.mc(t);this.dc(),this.ic=null,this.lc=!1,this.ec&&(this.ec(),this.ec=null),yn(t)&&this.Ec(t),this.pc(i,this.vc.Ac),++this.Jl,this.Gl&&this.Jl>1?(this.pc(i,this.vc.Lc),this.wc()):this.sc||this.pc(i,this.vc.Bc),yn(t)&&(kn(t),this.Ec(t),0===t.touches.length&&(this.tc=!1))}},t.prototype.dc=function(){null!==this.Ql&&(clearTimeout(this.Ql),this.Ql=null)},t.prototype.Vc=function(t){if(!("button"in t)||0===t.button){var i=this.mc(t);this.sc=!1,this.nc=!1,this.fc=!1,yn(t)&&this.Mc(t),this.ic={m:i.Nc,p:i.xc},this.ec&&(this.ec(),this.ec=null);var n=this.kc.bind(this),s=this.Tc.bind(this),h=this.cc.ownerDocument.documentElement;this.ec=function(){h.removeEventListener("touchmove",n),h.removeEventListener("touchend",s),h.removeEventListener("mousemove",n),h.removeEventListener("mouseup",s)},h.addEventListener("touchmove",n,{passive:!1}),h.addEventListener("touchend",s,{passive:!1}),this.dc(),yn(t)&&1===t.touches.length?this.Ql=setTimeout(this.zc.bind(this,t),240):(h.addEventListener("mousemove",n),h.addEventListener("mouseup",s)),this.lc=!0,this.pc(i,this.vc.Fc),this.Gl||(this.Jl=0,this.Gl=setTimeout(this.wc.bind(this),500))}},t.prototype._c=function(){var t=this;this.cc.addEventListener("mouseenter",this.Mc.bind(this)),this.cc.addEventListener("touchcancel",this.dc.bind(this));var i=this.cc.ownerDocument,n=function(i){t.vc.Pc&&(i.target&&t.cc.contains(i.target)||t.vc.Pc())};this.hc=function(){i.removeEventListener("mousedown",n),i.removeEventListener("touchstart",n)},i.addEventListener("mousedown",n),i.addEventListener("touchstart",n,{passive:!0}),this.cc.addEventListener("mouseleave",this.Ec.bind(this)),this.cc.addEventListener("touchstart",this.Vc.bind(this),{passive:!0}),dn||this.cc.addEventListener("mousedown",this.Vc.bind(this)),this.Oc(),this.cc.addEventListener("touchmove",(function(){}),{passive:!1})},t.prototype.Oc=function(){var t=this;void 0===this.vc.Ic&&void 0===this.vc.Rc&&void 0===this.vc.Wc||(this.cc.addEventListener("touchstart",(function(i){return t.jc(i.touches)}),{passive:!0}),this.cc.addEventListener("touchmove",(function(i){if(2===i.touches.length&&null!==t.uc&&void 0!==t.vc.Rc){var n=gn(i.touches[0],i.touches[1])/t.oc;t.vc.Rc(t.uc,n),kn(i)}}),{passive:!1}),this.cc.addEventListener("touchend",(function(i){t.jc(i.touches)})))},t.prototype.jc=function(t){1===t.length&&(this.ac=!1),2!==t.length||this.ac||this.tc?this.Uc():this.qc(t)},t.prototype.qc=function(t){var i=pn(this.cc);this.uc={m:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,p:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.oc=gn(t[0],t[1]),void 0!==this.vc.Ic&&this.vc.Ic(),this.dc()},t.prototype.Uc=function(){null!==this.uc&&(this.uc=null,void 0!==this.vc.Wc&&this.vc.Wc())},t.prototype.Ec=function(t){this.rc&&this.rc();var i=this.mc(t);this.pc(i,this.vc.Hc)},t.prototype.zc=function(t){var i=this.mc(t);this.pc(i,this.vc.Yc),this.sc=!0,this.tc=!0},t.prototype.pc=function(t,i){i&&i.call(this.vc,t)},t.prototype.mc=function(t){var i;i="touches"in t&&t.touches.length?t.touches[0]:"changedTouches"in t&&t.changedTouches.length?t.changedTouches[0]:t;var n=pn(this.cc);return{Kc:i.clientX,$c:i.clientY,Nc:i.pageX,xc:i.pageY,Xc:i.screenX,Zc:i.screenY,Jc:i.clientX-n.left,Gc:i.clientY-n.top,Qc:t.ctrlKey,tv:t.altKey,iv:t.shiftKey,nv:t.metaKey,sv:t.type.startsWith("mouse")?"mouse":"touch",hv:i.target,rv:t.view}},t}();function pn(t){return t.getBoundingClientRect()||{left:0,top:0}}function gn(t,i){var n=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(n*n+s*s)}function yn(t){return Boolean(t.touches)}function kn(t){t.cancelable&&t.preventDefault()}var Nn=function(){function t(t,i,n,s){if(this.ev=0,this.uv=0,this.ov=0,this.av=0,this.fv=0,this.lv=0,this.cv=0,this.vv=t,this._v=t.dv()[i],this.wv=t.dv()[n],this.Mv=document.createElement("tr"),this.Mv.style.height="1px",this.bv=document.createElement("td"),this.bv.style.padding="0",this.bv.setAttribute("colspan","3"),this.mv(),this.Mv.appendChild(this.bv),s)this.pv=null,this.gv=null;else{this.pv=document.createElement("div"),this.pv.style.position="absolute",this.pv.style.zIndex="50",this.pv.style.height="5px",this.pv.style.width="100%",this.pv.style.backgroundColor="rgba(255, 255, 255, 0.02)",this.pv.style.cursor="ns-resize",this.bv.appendChild(this.pv);var h={Fc:this.yv.bind(this),Cc:this.kv.bind(this),Ac:this.Nv.bind(this)};this.gv=new mn(this.pv,h,{Sc:!1,Dc:!0})}}return t.prototype.ln=function(){null!==this.gv&&this.gv.ln()},t.prototype.xv=function(){return this.Mv},t.prototype.Sv=function(){return new on(this._v.Sv().st,1)},t.prototype.Dv=function(){var t=this.Sv(),i=cn(document,t),n=fn(i);return n.fillStyle=this.vv.O().timeScale.borderColor,n.fillRect(0,0,t.st,t.ht),i},t.prototype.B=function(){this.mv()},t.prototype.mv=function(){this.bv.style.background=this.vv.O().timeScale.borderColor},t.prototype.yv=function(t){this.ev=t.xc,this.uv=0,this.ov=this._v.Sv().ht+this.wv.Sv().ht,this.av=this._v.Cf()+this.wv.Cf(),this.fv=30,this.lv=this.ov-this.fv,this.cv=this.av/this.ov},t.prototype.kv=function(t){this.uv=t.xc-this.ev;var i=this._v.Sv().ht,n=rt(i+this.uv,this.fv,this.lv)*this.cv,s=this.av-n;this._v.Tf(n),this.wv.Tf(s),this.vv.ct().dl(),this._v.Sv().ht!==i&&(this.ev=t.xc)},t.prototype.Nv=function(t){this.ev=0,this.uv=0,this.ov=0,this.av=0,this.fv=0,this.lv=0,this.cv=0},t}(),xn=function(){function t(t,i,n,s){this.Qu=new bi(200),this.Le=0,this.Cv="",this.fo="",this.Tv=[],this.Ev=new Map,this.Le=t,this.Cv=i,this.fo=Ut(t,n,s)}return t.prototype.ln=function(){delete this.Qu,this.Tv=[],this.Ev.clear()},t.prototype.Av=function(t,i,n,s,h){var r=this.Lv(t,i);if("left"!==h){var e=an(t.canvas);n-=Math.floor(r.Bv*e)}s-=Math.floor(r.wt/2),t.drawImage(r.Vv,n,s,r.dt,r.wt)},t.prototype.Lv=function(t,i){var n,s=this;if(this.Ev.has(i))n=a(this.Ev.get(i));else{if(this.Tv.length>=200){var h=a(this.Tv.shift());this.Ev.delete(h)}var r=an(t.canvas),e=Math.ceil(this.Le/4.5),u=Math.round(this.Le/10),o=Math.ceil(this.Qu.Et(t,i)),f=ot(Math.round(o+2*e)),l=ot(this.Le+2*e),c=cn(document,new on(f,l));n={Tt:i,Bv:Math.round(Math.max(1,o)),dt:Math.ceil(f*r),wt:Math.ceil(l*r),Vv:c},0!==o&&(this.Tv.push(n.Tt),this.Ev.set(n.Tt,n)),W(t=fn(n.Vv),r,(function(){t.font=s.fo,t.fillStyle=s.Cv,t.fillText(i,0,l-e-u)}))}return n},t}(),Sn=function(){function t(t,i,n,s){var h=this;this.Zt=null,this.zv=null,this.Fv=null,this.Pv=!1,this.Ov=!0,this.Iv=new bi(50),this.Rv=new xn(11,"#000"),this.Cv=null,this.fo=null,this.Wv=0,this.jv=function(){h.Uv(h.fl.O()),h.wi.qv().ct().se()},this.Hv=function(){h.wi.qv().ct().se()},this.wi=t,this.Si=i,this.fl=n,this.Yv="left"===s,this.bv=document.createElement("div"),this.bv.style.height="100%",this.bv.style.overflow="hidden",this.bv.style.width="25px",this.bv.style.left="0",this.bv.style.position="relative",this.Kv=vn(this.bv,new on(16,16)),this.Kv.subscribeCanvasConfigured(this.jv);var r=this.Kv.canvas;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.$v=vn(this.bv,new on(16,16)),this.$v.subscribeCanvasConfigured(this.Hv);var e=this.$v.canvas;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0";var u={Fc:this.yv.bind(this),Cc:this.kv.bind(this),Pc:this.Xv.bind(this),Ac:this.Nv.bind(this),Lc:this.Zv.bind(this),gc:this.Jv.bind(this),Hc:this.Gv.bind(this)};this.gv=new mn(this.$v.canvas,u,{Sc:!1,Dc:!0})}return t.prototype.ln=function(){this.gv.ln(),this.$v.unsubscribeCanvasConfigured(this.Hv),this.$v.destroy(),this.Kv.unsubscribeCanvasConfigured(this.jv),this.Kv.destroy(),null!==this.Zt&&(this.Zt.nh().on(this),this.Zt.Ns().on(this)),this.Zt=null,null!==this.Fv&&(clearTimeout(this.Fv),this.Fv=null),this.Rv.ln()},t.prototype.xv=function(){return this.bv},t.prototype.Qv=function(){return this.Si.backgroundColor},t.prototype.N=function(){return f(this.Zt).O().borderColor},t.prototype.t_=function(){return this.Si.textColor},t.prototype.Lt=function(){return this.Si.fontSize},t.prototype.i_=function(){return Ut(this.Lt(),this.Si.fontFamily)},t.prototype.n_=function(){var t=this.fl.O(),i=this.Cv!==t.et,n=this.fo!==t.gt;return(i||n)&&(this.Uv(t),this.Cv=t.et),n&&(this.Iv.Gh(),this.fo=t.gt),t},t.prototype.s_=function(){if(!this.Ht()||null===this.Zt)return 0;var t=34,i=this.n_(),n=fn(this.Kv.canvas),s=this.Zt.qn();n.font=this.i_(),s.length>0&&(t=Math.max(this.Iv.Et(n,s[0].Wn),this.Iv.Et(n,s[s.length-1].Wn)));for(var h=this.h_(),r=h.length;r--;){var e=this.Iv.Et(n,h[r].Tt());e>t&&(t=e)}var u=Math.ceil(i.Nt+i.kt+i.Dt+i.Ct+t);return u+=u%2},t.prototype.r_=function(t){if(t.st<0||t.ht<0)throw new Error("Try to set invalid size to PriceAxisWidget "+JSON.stringify(t));null!==this.zv&&this.zv._n(t)||(this.zv=t,this.Kv.resizeCanvas({width:t.st,height:t.ht}),this.$v.resizeCanvas({width:t.st,height:t.ht}),this.bv.style.width=t.st+"px",this.bv.style.height=t.ht+"px",this.bv.style.minWidth=t.st+"px")},t.prototype.e_=function(){return f(this.zv).st},t.prototype.ci=function(t){this.Zt!==t&&(null!==this.Zt&&(this.Zt.nh().on(this),this.Zt.Ns().on(this)),this.Zt=t,t.nh().sn(this.ss.bind(this),this))},t.prototype.X=function(){return this.Zt},t.prototype.Ht=function(){return this.Ov},t.prototype.u_=function(t){t!==this.Ov&&(this.bv.style.display=t?"table-cell":"none",this.Ov=t)},t.prototype.o_=function(t){var i=this.wi.a_();this.wi.qv().ct().jf(i,f(this.X()),t)},t.prototype.Gh=function(){var t=this.wi.a_();this.wi.qv().ct().qf(t,f(this.X()))},t.prototype.f_=function(t){if(this.Ov&&null!==this.zv){if(1!==t){var i=fn(this.Kv.canvas);this.l_(),this.c_(i,this.Kv.pixelRatio),this.Fu(i,this.Kv.pixelRatio),this.v_(i,this.Kv.pixelRatio),this.__(i,this.Kv.pixelRatio)}var n=fn(this.$v.canvas),s=this.zv.st,h=this.zv.ht;W(n,this.$v.pixelRatio,(function(){n.clearRect(0,0,s,h)})),this.d_(n,this.$v.pixelRatio)}},t.prototype.Dv=function(){return this.Kv.canvas},t.prototype.w_=function(){return this.Yv},t.prototype.yv=function(t){if(null!==this.Zt&&!this.Zt.Gt()&&this.wi.qv().O().handleScale.axisPressedMouseMove.price){var i=this.wi.qv().ct(),n=this.wi.a_();this.Pv=!0,i.Ff(n,this.Zt,t.Gc)}},t.prototype.kv=function(t){if(null!==this.Zt&&this.wi.qv().O().handleScale.axisPressedMouseMove.price){var i=this.wi.qv().ct(),n=this.wi.a_(),s=this.Zt;i.Pf(n,s,t.Gc)}},t.prototype.Xv=function(){if(null!==this.Zt&&this.wi.qv().O().handleScale.axisPressedMouseMove.price){var t=this.wi.qv().ct(),i=this.wi.a_(),n=this.Zt;this.Pv&&(this.Pv=!1,t.Of(i,n))}},t.prototype.Nv=function(t){if(null!==this.Zt&&this.wi.qv().O().handleScale.axisPressedMouseMove.price){var i=this.wi.qv().ct(),n=this.wi.a_();this.Pv=!1,i.Of(n,this.Zt)}},t.prototype.Zv=function(t){this.wi.qv().O().handleScale.axisDoubleClickReset&&this.Gh()},t.prototype.Jv=function(t){null!==this.Zt&&(!this.wi.qv().ct().O().handleScale.axisPressedMouseMove.price||this.Zt.Ss()||this.Zt.Ds()||this.M_(1))},t.prototype.Gv=function(t){this.M_(0)},t.prototype.h_=function(){var t=this,i=[],n=null===this.Zt?void 0:this.Zt;return function(s){for(var h=0;h<s.length;++h)for(var r=s[h].vi(t.wi.a_(),n),e=0;e<r.length;e++)i.push(r[e])}(this.wi.a_().Js()),i},t.prototype.c_=function(t,i){var n=this;if(null!==this.zv){var s=this.zv.st,h=this.zv.ht;W(t,i,(function(){j(t,0,0,s,h,n.Qv())}))}},t.prototype.Fu=function(t,i){if(null!==this.zv&&null!==this.Zt&&this.Zt.O().borderVisible){t.save(),t.fillStyle=this.N();var n,s=Math.max(1,Math.floor(this.n_().Nt*i));n=this.Yv?Math.floor(this.zv.st*i)-s:0,t.fillRect(n,0,s,Math.ceil(this.zv.ht*i)),t.restore()}},t.prototype.v_=function(t,i){if(null!==this.zv&&null!==this.Zt){var n=this.Zt.qn();t.save(),t.strokeStyle=this.N(),t.font=this.i_(),t.fillStyle=this.N();var s=this.n_(),h=this.Zt.O().borderVisible,r=this.Yv?Math.floor((this.zv.st-s.kt)*i-s.Nt*i):Math.floor(s.Nt*i),e=this.Yv?Math.round(r-s.Dt*i):Math.round(r+s.kt*i+s.Dt*i),u=this.Yv?"right":"left",o=Math.max(1,Math.floor(i)),a=Math.floor(.5*i);if(h){var f=Math.round(s.kt*i);t.beginPath();for(var l=0,c=n;l<c.length;l++){var v=c[l];t.rect(r,Math.round(v.Rn*i)-a,f,o)}t.fill()}t.fillStyle=this.t_();for(var _=0,d=n;_<d.length;_++){v=d[_];this.Rv.Av(t,v.Wn,e,Math.round(v.Rn*i),u)}t.restore()}},t.prototype.l_=function(){if(null!==this.zv&&null!==this.Zt){var t=this.zv.ht/2,i=[],n=this.Zt.Js().slice(),s=this.wi.a_(),h=this.n_();this.Zt===s.Ti()&&this.wi.a_().Js().forEach((function(t){s.wf(t)&&n.push(t)}));var r=this.Zt.Zs()[0],e=this.Zt;n.forEach((function(n){var h=n.vi(s,e);h.forEach((function(t){t.qt(null),t.Ht()&&i.push(t)})),r===n&&h.length>0&&(t=h[0].Bt())}));var u=i.filter((function(i){return i.Bt()<=t})),o=i.filter((function(i){return i.Bt()>t}));if(u.sort((function(t,i){return i.Bt()-t.Bt()})),u.length&&o.length&&o.push(u[0]),o.sort((function(t,i){return t.Bt()-i.Bt()})),i.forEach((function(t){return t.qt(t.Bt())})),this.Zt.O().alignLabels){for(var a=1;a<u.length;a++){var f=u[a],l=(v=u[a-1]).wt(h,!1);f.Bt()>(_=v.Ut())-l&&f.qt(_-l)}for(var c=1;c<o.length;c++){var v,_;f=o[c],l=(v=o[c-1]).wt(h,!0);f.Bt()<(_=v.Ut())+l&&f.qt(_+l)}}}},t.prototype.__=function(t,i){var n=this;if(null!==this.zv){t.save();var s=this.zv,h=this.h_(),r=this.n_(),e=this.Yv?"right":"left";h.forEach((function(h){if(h.Yt()){var u=h.I();t.save(),u.s(t,r,n.Iv,s.st,e,i),t.restore()}})),t.restore()}},t.prototype.d_=function(t,i){var n=this;if(null!==this.zv&&null!==this.Zt){t.save();var s=this.zv,h=this.wi.qv().ct(),r=[],e=this.wi.a_(),u=h.Dl().vi(e,this.Zt);u.length&&r.push(u);var o=this.n_(),a=this.Yv?"right":"left";r.forEach((function(h){h.forEach((function(h){t.save(),h.I().s(t,o,n.Iv,s.st,a,i),t.restore()}))})),t.restore()}},t.prototype.M_=function(t){this.bv.style.cursor=1===t?"ns-resize":"default"},t.prototype.ss=function(){var t=this,i=this.s_();if(this.Wv<i){var n=this.wi.qv();null===this.Fv&&(this.Fv=setTimeout((function(){n&&n.ct().dl(),t.Fv=null}),100))}this.Wv=i},t.prototype.Uv=function(t){this.Rv.ln(),this.Rv=new xn(t.Lt,t.et,t.Ae)},t}(),Dn=bn,Cn=function(){function t(t,i){var n=this;this.zv=new on(0,0),this.b_=null,this.m_=null,this.p_=null,this.g_=!1,this.y_=new st,this.k_=0,this.N_=!1,this.x_=null,this.S_=!1,this.D_=null,this.jv=function(){return n.C_&&n.ni().se()},this.Hv=function(){return n.C_&&n.ni().se()},this.T_=t,this.C_=i,this.C_.Kf().sn(this.E_.bind(this),this,!0),this.A_=document.createElement("td"),this.A_.style.padding="0",this.A_.style.position="relative";var s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.position="relative",s.style.overflow="hidden",this.L_=document.createElement("td"),this.L_.style.padding="0",this.B_=document.createElement("td"),this.B_.style.padding="0",this.A_.appendChild(s),this.Kv=vn(s,new on(16,16)),this.Kv.subscribeCanvasConfigured(this.jv);var h=this.Kv.canvas;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this.$v=vn(s,new on(16,16)),this.$v.subscribeCanvasConfigured(this.Hv);var r=this.$v.canvas;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.Mv=document.createElement("tr"),this.Mv.appendChild(this.L_),this.Mv.appendChild(this.A_),this.Mv.appendChild(this.B_),this.V_();var e=this.qv().O().handleScroll;this.gv=new mn(this.$v.canvas,this,{Sc:!e.vertTouchDrag,Dc:!e.horzTouchDrag})}return t.prototype.ln=function(){null!==this.b_&&this.b_.ln(),null!==this.m_&&this.m_.ln(),this.$v.unsubscribeCanvasConfigured(this.Hv),this.$v.destroy(),this.Kv.unsubscribeCanvasConfigured(this.jv),this.Kv.destroy(),null!==this.C_&&this.C_.Kf().on(this),this.gv.ln()},t.prototype.a_=function(){return f(this.C_)},t.prototype.z_=function(){return this.C_},t.prototype.F_=function(i){null!==this.C_&&this.C_.Kf().on(this),this.C_=i,null!==this.C_&&this.C_.Kf().sn(t.prototype.E_.bind(this),this,!0),this.V_()},t.prototype.qv=function(){return this.T_},t.prototype.xv=function(){return this.Mv},t.prototype.V_=function(){if(null!==this.C_&&(this.P_(),0!==this.ni().V().length)){if(null!==this.b_){var t=this.C_.Vf();this.b_.ci(f(t))}if(null!==this.m_){var i=this.C_.zf();this.m_.ci(f(i))}}},t.prototype.Cf=function(){return null!==this.C_?this.C_.Cf():0},t.prototype.Tf=function(t){this.C_&&this.C_.Tf(t)},t.prototype.gc=function(t){if(this.C_){var i=t.Jc,n=t.Gc;dn||this.O_(i,n)}},t.prototype.Fc=function(t){if(this.N_=!1,this.S_=null!==this.x_,this.C_){if(document.activeElement!==document.body&&document.activeElement!==document.documentElement)f(document.activeElement).blur();else{var i=document.getSelection();null!==i&&i.removeAllRanges()}var n=this.ni();if(!this.C_.Ti().Gt()&&!n.j().Gt()){if(null!==this.x_){var s=n.Dl();this.D_={x:s.Mt(),y:s.bt()},this.x_={x:t.Jc,y:t.Gc}}dn||this.O_(t.Jc,t.Gc)}}},t.prototype.yc=function(t){if(this.C_){var i=t.Jc,n=t.Gc;if(this.I_()&&this.R_(),!dn){this.O_(i,n);var s=this.lo(i,n);this.ni().ml(s&&{pl:s.pl,W_:s.W_}),null!==s&&void 0!==s.rv.j_&&s.rv.j_(i,n)}}},t.prototype.Bc=function(t){if(null!==this.C_){var i=t.Jc,n=t.Gc,s=this.lo(i,n);if(null!==s&&void 0!==s.rv.U_&&s.rv.U_(i,n),this.y_.fn()){var h=this.ni().Dl().W();this.y_.an(h,{x:i,y:n})}this.q_()}},t.prototype.Cc=function(t){if(null!==this.C_){var i=this.ni(),n=t.Jc,s=t.Gc;if(null!==this.x_){this.S_=!1;var h=f(this.D_),r=h.x+(n-this.x_.x),e=h.y+(s-this.x_.y);this.O_(r,e)}else this.I_()||this.O_(n,s);if(!i.j().Gt()){var u=this.T_.O().handleScroll;if(u.pressedMouseMove&&"touch"!==t.sv||(u.horzTouchDrag||u.vertTouchDrag)&&"mouse"!==t.sv){var o=this.C_.Ti();null!==this.p_||this.H_()||(this.p_={x:t.Kc,y:t.$c}),null===this.p_||this.p_.x===t.Kc&&this.p_.y===t.$c||this.g_||(o.Gt()||i.If(this.C_,o,t.Gc),i.Vl(t.Jc),this.g_=!0),this.g_&&(o.Gt()||i.Rf(this.C_,o,t.Gc),i.zl(t.Jc))}}}},t.prototype.Ac=function(t){if(null!==this.C_){this.N_=!1;var i=this.ni();if(this.g_){var n=this.C_.Ti();i.Wf(this.C_,n),i.Fl(),this.p_=null,this.g_=!1}}},t.prototype.Yc=function(t){if(this.N_=!0,null===this.x_&&Dn){var i={m:t.Jc,p:t.Gc};this.Y_(i,i)}},t.prototype.Hc=function(t){null!==this.C_&&(this.C_.ct().ml(null),bn||this.R_())},t.prototype.K_=function(){return this.y_},t.prototype.Ic=function(){this.k_=1},t.prototype.Rc=function(t,i){if(this.T_.O().handleScale.pinch){var n=5*(i-this.k_);this.k_=i,this.ni().Ll(t.m,n)}},t.prototype.lo=function(t,i){var n=this.C_;if(null===n)return null;for(var s=0,h=n.Js();s<h.length;s++){var r=h[s],e=this.X_(r._i(n),t,i);if(null!==e)return{pl:r,rv:e.rv,W_:e.W_}}return null},t.prototype.Z_=function(t,i){f("left"===i?this.b_:this.m_).r_(new on(t,this.zv.ht))},t.prototype.Sv=function(){return this.zv},t.prototype.r_=function(t){if(t.st<0||t.ht<0)throw new Error("Try to set invalid size to PaneWidget "+JSON.stringify(t));this.zv._n(t)||(this.zv=t,this.Kv.resizeCanvas({width:t.st,height:t.ht}),this.$v.resizeCanvas({width:t.st,height:t.ht}),this.A_.style.width=t.st+"px",this.A_.style.height=t.ht+"px")},t.prototype.J_=function(){var t=f(this.C_);t.Bf(t.Vf()),t.Bf(t.zf());for(var i=0,n=t.Zs();i<n.length;i++){var s=n[i];if(t.wf(s)){var h=s.X();null!==h&&t.Bf(h),s.Ui()}}},t.prototype.Dv=function(){return this.Kv.canvas},t.prototype.f_=function(t){if(0!==t&&null!==this.C_){if(t>1&&this.J_(),null!==this.b_&&this.b_.f_(t),null!==this.m_&&this.m_.f_(t),1!==t){var i=fn(this.Kv.canvas);i.save(),this.c_(i,this.G_(),this.Kv.pixelRatio),this.C_&&(this.Q_(i,this.Kv.pixelRatio),this.td(i,this.Kv.pixelRatio),this.nd(i,this.Kv.pixelRatio)),i.restore()}var n=fn(this.$v.canvas);n.clearRect(0,0,Math.ceil(this.zv.st*this.$v.pixelRatio),Math.ceil(this.zv.ht*this.$v.pixelRatio)),this.sd(n,this.$v.pixelRatio)}},t.prototype.hd=function(){return this.b_},t.prototype.rd=function(){return this.m_},t.prototype.G_=function(){return this.T_.O().layout.backgroundColor},t.prototype.E_=function(){null!==this.C_&&this.C_.Kf().on(this),this.C_=null},t.prototype.c_=function(t,i,n){var s=this;W(t,n,(function(){j(t,0,0,s.zv.st,s.zv.ht,i)}))},t.prototype.Q_=function(t,i){for(var n=f(this.C_),s=this.ni().xl()._i(n),h=n.wt(),r=n.dt(),e=0,u=s;e<u.length;e++){var o=u[e];t.save();var a=o.I(h,r);null!==a&&a.s(t,i,!1),t.restore()}},t.prototype.td=function(t,i){var n=this.ni().Sl();null!==n&&(this.ed(n,t,i),this.ud(n,t,i))},t.prototype.sd=function(t,i){this.ud(this.ni().Dl(),t,i)},t.prototype.nd=function(t,i){for(var n=f(this.C_).Js(),s=0,h=n;s<h.length;s++){var r=h[s];this.ed(r,t,i)}for(var e=0,u=n;e<u.length;e++){r=u[e];this.ud(r,t,i)}},t.prototype.ud=function(t,i,n){for(var s=f(this.C_),h=t._i(s),r=s.wt(),e=s.dt(),u=s.ct().bl(),o=null!==u&&u.pl===t,a=null!==u&&o&&void 0!==u.W_?u.W_.co:void 0,l=0,c=h;l<c.length;l++){var v=c[l].I(r,e);null!==v&&(i.save(),v.s(i,n,o,a),i.restore())}},t.prototype.ed=function(t,i,n){for(var s=f(this.C_),h=t._i(s),r=s.wt(),e=s.dt(),u=s.ct().bl(),o=null!==u&&u.pl===t,a=null!==u&&o&&void 0!==u.W_?u.W_.co:void 0,l=0,c=h;l<c.length;l++){var v=c[l].I(r,e);null!==v&&void 0!==v.u&&(i.save(),v.u(i,n,o,a),i.restore())}},t.prototype.X_=function(t,i,n){for(var s=0,h=t;s<h.length;s++){var r=h[s],e=r.I(this.zv.ht,this.zv.st);if(null!==e&&e.lo){var u=e.lo(i,n);if(null!==u)return{rv:r,W_:u}}}return null},t.prototype.P_=function(){if(null!==this.C_){var t=this.T_;t.O().leftPriceScale.visible||null===this.b_||(this.L_.removeChild(this.b_.xv()),this.b_.ln(),this.b_=null),t.O().rightPriceScale.visible||null===this.m_||(this.B_.removeChild(this.m_.xv()),this.m_.ln(),this.m_=null);var i=t.ct().Hl();t.O().leftPriceScale.visible&&null===this.b_&&(this.b_=new Sn(this,t.O().layout,i,"left"),this.L_.appendChild(this.b_.xv())),t.O().rightPriceScale.visible&&null===this.m_&&(this.m_=new Sn(this,t.O().layout,i,"right"),this.B_.appendChild(this.m_.xv()))}},t.prototype.I_=function(){return Dn&&null===this.x_},t.prototype.H_=function(){return Dn&&this.N_||null!==this.x_},t.prototype.od=function(t){return Math.max(0,Math.min(t,this.zv.st-1))},t.prototype.ad=function(t){return Math.max(0,Math.min(t,this.zv.ht-1))},t.prototype.O_=function(t,i){this.ni().Rl(this.od(t),this.ad(i),f(this.C_))},t.prototype.R_=function(){this.ni().jl()},t.prototype.q_=function(){this.S_&&(this.x_=null,this.R_())},t.prototype.Y_=function(t,i){this.x_=t,this.S_=!1,this.O_(i.x,i.y);var n=this.ni().Dl();this.D_={x:n.Mt(),y:n.bt()}},t.prototype.ni=function(){return this.T_.ct()},t}(),Tn=function(){function t(t,i,n,s){var h=this;this.T=!0,this.zv=new on(0,0),this.jv=function(){return h.f_(3)},this.Yv="left"===t,this.fl=n.Hl,this.Si=i,this.fd=s,this.bv=document.createElement("div"),this.bv.style.width="25px",this.bv.style.height="100%",this.bv.style.overflow="hidden",this.Kv=vn(this.bv,new on(16,16)),this.Kv.subscribeCanvasConfigured(this.jv)}return t.prototype.ln=function(){this.Kv.unsubscribeCanvasConfigured(this.jv),this.Kv.destroy()},t.prototype.B=function(){this.T=!0},t.prototype.xv=function(){return this.bv},t.prototype.Sv=function(){return this.zv},t.prototype.r_=function(t){if(t.st<0||t.ht<0)throw new Error("Try to set invalid size to PriceAxisStub "+JSON.stringify(t));this.zv._n(t)||(this.zv=t,this.Kv.resizeCanvas({width:t.st,height:t.ht}),this.bv.style.width=t.st+"px",this.bv.style.minWidth=t.st+"px",this.bv.style.height=t.ht+"px",this.T=!0)},t.prototype.f_=function(t){if((!(t<3)||this.T)&&0!==this.zv.st&&0!==this.zv.ht){this.T=!1;var i=fn(this.Kv.canvas);this.c_(i,this.Kv.pixelRatio),this.Fu(i,this.Kv.pixelRatio)}},t.prototype.Dv=function(){return this.Kv.canvas},t.prototype.w_=function(){return this.Yv},t.prototype.Fu=function(t,i){if(this.fd()){var n=this.zv.st;t.save(),t.fillStyle=this.Si.timeScale.borderColor;var s=Math.floor(this.fl.O().Nt*i),h=this.Yv?Math.round(n*i)-s:0;t.fillRect(h,0,s,s),t.restore()}},t.prototype.c_=function(t,i){var n=this;W(t,i,(function(){j(t,0,0,n.zv.st,n.zv.ht,n.Si.layout.backgroundColor)}))},t}();function En(t,i){return t.Qh>i.Qh?t:i}var An=function(){function t(t){var i=this;this.ld=null,this.vd=null,this.Ee=null,this._d=!1,this.zv=new on(0,0),this.jv=function(){return i.T_.ct().se()},this.Hv=function(){return i.T_.ct().se()},this.T_=t,this.Si=t.O().layout,this.dd=document.createElement("tr"),this.wd=document.createElement("td"),this.wd.style.padding="0",this.Md=document.createElement("td"),this.Md.style.padding="0",this.bv=document.createElement("td"),this.bv.style.height="25px",this.bv.style.padding="0",this.bd=document.createElement("div"),this.bd.style.width="100%",this.bd.style.height="100%",this.bd.style.position="relative",this.bd.style.overflow="hidden",this.bv.appendChild(this.bd),this.Kv=vn(this.bd,new on(16,16)),this.Kv.subscribeCanvasConfigured(this.jv);var n=this.Kv.canvas;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.$v=vn(this.bd,new on(16,16)),this.$v.subscribeCanvasConfigured(this.Hv);var s=this.$v.canvas;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.dd.appendChild(this.wd),this.dd.appendChild(this.bv),this.dd.appendChild(this.Md),this.md(),this.T_.ct().Df().sn(this.md.bind(this),this),this.gv=new mn(this.$v.canvas,this,{Sc:!0,Dc:!1})}return t.prototype.ln=function(){this.gv.ln(),null!==this.ld&&this.ld.ln(),null!==this.vd&&this.vd.ln(),this.$v.unsubscribeCanvasConfigured(this.Hv),this.$v.destroy(),this.Kv.unsubscribeCanvasConfigured(this.jv),this.Kv.destroy()},t.prototype.xv=function(){return this.dd},t.prototype.pd=function(){return this.ld},t.prototype.gd=function(){return this.vd},t.prototype.Fc=function(t){if(!this._d){this._d=!0;var i=this.T_.ct();!i.j().Gt()&&this.T_.O().handleScale.axisPressedMouseMove.time&&i.Al(t.Jc)}},t.prototype.Pc=function(){var t=this.T_.ct();!t.j().Gt()&&this._d&&(this._d=!1,this.T_.O().handleScale.axisPressedMouseMove.time&&t.Ol())},t.prototype.Cc=function(t){var i=this.T_.ct();!i.j().Gt()&&this.T_.O().handleScale.axisPressedMouseMove.time&&i.Pl(t.Jc)},t.prototype.Ac=function(t){this._d=!1;var i=this.T_.ct();i.j().Gt()&&!this.T_.O().handleScale.axisPressedMouseMove.time||i.Ol()},t.prototype.Lc=function(){this.T_.O().handleScale.axisDoubleClickReset&&this.T_.ct().Il()},t.prototype.gc=function(t){this.T_.ct().O().handleScale.axisPressedMouseMove.time&&this.M_(1)},t.prototype.Hc=function(t){this.M_(0)},t.prototype.Sv=function(){return this.zv},t.prototype.yd=function(t,i,n){this.zv&&this.zv._n(t)||(this.zv=t,this.Kv.resizeCanvas({width:t.st,height:t.ht}),this.$v.resizeCanvas({width:t.st,height:t.ht}),this.bv.style.width=t.st+"px",this.bv.style.height=t.ht+"px"),null!==this.ld&&this.ld.r_(new on(i,t.ht)),null!==this.vd&&this.vd.r_(new on(n,t.ht))},t.prototype.dt=function(){return this.zv.st},t.prototype.wt=function(){return this.zv.ht},t.prototype.kd=function(){var t=this.Nd();return Math.ceil(t.Nt+t.kt+t.Lt+t.xt+t.St)},t.prototype.B=function(){this.T_.ct().j().qn()},t.prototype.Dv=function(){return this.Kv.canvas},t.prototype.f_=function(t){if(0!==t){if(1!==t){var i=fn(this.Kv.canvas);this.c_(i,this.Kv.pixelRatio),this.Fu(i,this.Kv.pixelRatio),this.v_(i,this.Kv.pixelRatio),null!==this.ld&&this.ld.f_(t),null!==this.vd&&this.vd.f_(t)}var n=fn(this.$v.canvas),s=this.$v.pixelRatio;n.clearRect(0,0,Math.ceil(this.zv.st*s),Math.ceil(this.zv.ht*s)),this.xd([this.T_.ct().Dl()],n,s)}},t.prototype.c_=function(t,i){var n=this;W(t,i,(function(){j(t,0,0,n.zv.st,n.zv.ht,n.G_())}))},t.prototype.Fu=function(t,i){if(this.T_.O().timeScale.borderVisible){t.save(),t.fillStyle=this.Sd();var n=Math.max(1,Math.floor(this.Nd().Nt*i));t.fillRect(0,0,Math.ceil(this.zv.st*i),n),t.restore()}},t.prototype.v_=function(t,i){var n=this,s=this.T_.ct().j().qn();if(s&&0!==s.length){var h=s.reduce(En,s[0]).Qh;h>30&&h<40&&(h=30),t.save(),t.strokeStyle=this.Sd();var r=this.Nd(),e=r.Nt+r.kt+r.xt+r.Lt-r.At;t.textAlign="center",t.fillStyle=this.Sd();var u=Math.floor(this.Nd().Nt*i),o=Math.max(1,Math.floor(i)),a=Math.floor(.5*i);if(this.T_.ct().j().O().borderVisible){t.beginPath();for(var f=Math.round(r.kt*i),l=s.length;l--;){var c=Math.round(s[l].Rn*i);t.rect(c-a,u,o,f)}t.fill()}t.fillStyle=this.Ve(),W(t,i,(function(){t.font=n.Dd();for(var i=0,r=s;i<r.length;i++){(a=r[i]).Qh<h&&t.fillText(a.Wn,a.Rn,e)}t.font=n.Cd();for(var u=0,o=s;u<o.length;u++){var a;(a=o[u]).Qh>=h&&t.fillText(a.Wn,a.Rn,e)}}))}},t.prototype.xd=function(t,i,n){for(var s=this.Nd(),h=0,r=t;h<r.length;h++)for(var e=0,u=r[h].di();e<u.length;e++){var o=u[e];i.save(),o.I().s(i,s,n),i.restore()}},t.prototype.G_=function(){return this.Si.backgroundColor},t.prototype.Sd=function(){return this.T_.O().timeScale.borderColor},t.prototype.Ve=function(){return this.Si.textColor},t.prototype.Le=function(){return this.Si.fontSize},t.prototype.Dd=function(){return Ut(this.Le(),this.Si.fontFamily)},t.prototype.Cd=function(){return Ut(this.Le(),this.Si.fontFamily,"bold")},t.prototype.Nd=function(){null===this.Ee&&(this.Ee={Nt:1,At:NaN,xt:NaN,St:NaN,ii:NaN,kt:3,Lt:NaN,gt:"",ti:new bi});var t=this.Ee,i=this.Dd();if(t.gt!==i){var n=this.Le();t.Lt=n,t.gt=i,t.xt=Math.ceil(n/2.5),t.St=t.xt,t.ii=Math.ceil(n/2),t.At=Math.round(this.Le()/5),t.ti.Gh()}return this.Ee},t.prototype.M_=function(t){this.bv.style.cursor=1===t?"ew-resize":"default"},t.prototype.md=function(){var t=this.T_.ct(),i=t.O();i.leftPriceScale.visible||null===this.ld||(this.wd.removeChild(this.ld.xv()),this.ld.ln(),this.ld=null),i.rightPriceScale.visible||null===this.vd||(this.Md.removeChild(this.vd.xv()),this.vd.ln(),this.vd=null);var n={Hl:this.T_.ct().Hl()};if(i.leftPriceScale.visible&&null===this.ld){var s=function(){return i.leftPriceScale.borderVisible&&t.j().O().borderVisible};this.ld=new Tn("left",this.T_.O(),n,s),this.wd.appendChild(this.ld.xv())}if(i.rightPriceScale.visible&&null===this.vd){s=function(){return i.rightPriceScale.borderVisible&&t.j().O().borderVisible};this.vd=new Tn("right",this.T_.O(),n,s),this.Md.appendChild(this.vd.xv())}},t}(),Ln=function(){function t(t,i){this.Td=[],this.Ed=[],this.Ad=0,this.Hn=0,this.br=0,this.Ld=0,this.Bd=0,this.Vd=null,this.zd=!1,this.y_=new st,this.ol=new st,this.Si=i,this.dd=document.createElement("div"),this.dd.classList.add("tv-lightweight-charts"),this.dd.style.overflow="hidden",this.dd.style.width="100%",this.dd.style.height="100%",this.Fd=document.createElement("table"),this.Fd.setAttribute("cellspacing","0"),this.dd.appendChild(this.Fd),this.Pd=this.Od.bind(this),this.dd.addEventListener("wheel",this.Pd,{passive:!1}),this.ni=new rn(this.al.bind(this),this.Si),this.ct().Cl().sn(this.Id.bind(this),this),this.Rd=new An(this),this.Fd.appendChild(this.Rd.xv());var n=this.Si.width,s=this.Si.height;if(0===n||0===s){var h=t.getBoundingClientRect();0===n&&(n=Math.floor(h.width),n-=n%2),0===s&&(s=Math.floor(h.height),s-=s%2)}n=Math.max(70,n),s=Math.max(50,s),this.Wd(n,s),this.jd(),t.appendChild(this.dd),this.Ud(),this.ni.j().me().sn(this.ni.dl.bind(this.ni),this),this.ni.Df().sn(this.ni.dl.bind(this.ni),this)}return t.prototype.ct=function(){return this.ni},t.prototype.O=function(){return this.Si},t.prototype.dv=function(){return this.Td},t.prototype.ln=function(){this.dd.removeEventListener("wheel",this.Pd),0!==this.Ad&&window.cancelAnimationFrame(this.Ad),this.ni.Cl().on(this),this.ni.j().me().on(this),this.ni.Df().on(this),this.ni.ln();for(var t=0,i=this.Td;t<i.length;t++){var n=i[t];this.Fd.removeChild(n.xv()),n.K_().on(this),n.ln()}this.Td=[];for(var s=0,h=this.Ed;s<h.length;s++){var r=h[s];this.qd(r)}this.Ed=[],f(this.Rd).ln(),null!==this.dd.parentElement&&this.dd.parentElement.removeChild(this.dd),this.ol.ln(),this.y_.ln(),delete this.dd},t.prototype.Wd=function(t,i,n){if(void 0===n&&(n=!1),this.Hn!==i||this.br!==t){this.Hn=i,this.br=t;var s=i+"px",h=t+"px";f(this.dd).style.height=s,f(this.dd).style.width=h,this.Fd.style.height=s,this.Fd.style.width=h,n?this.Hd(new Xt(3)):this.ni.dl()}},t.prototype.f_=function(t){void 0===t&&(t=new Xt(3));for(var i=0;i<this.Td.length;i++)this.Td[i].f_(t.Qe(i).Ze);this.Rd.f_(t.Ge())},t.prototype.ms=function(t){this.ni.ms(t),this.Ud();var i=t.width||this.br,n=t.height||this.Hn;this.Wd(i,n)},t.prototype.K_=function(){return this.y_},t.prototype.Cl=function(){return this.ol},t.prototype.Yd=function(){var t=this;null!==this.Vd&&(this.Hd(this.Vd),this.Vd=null);var i=this.Td[0],n=cn(document,new on(this.br,this.Hn)),s=fn(n),h=an(n);return W(s,h,(function(){var n=0,h=0,r=function(i){for(var r=0;r<t.Td.length;r++){var e=t.Td[r],u=e.Sv().ht,o=f("left"===i?e.hd():e.rd()),a=o.Dv();if(s.drawImage(a,n,h,o.e_(),u),h+=u,r<t.Td.length-1){var l=t.Ed[r],c=l.Sv(),v=l.Dv();s.drawImage(v,n,h,c.st,c.ht),h+=c.ht}}};t.Kd()&&(r("left"),n=f(i.hd()).e_()),h=0;for(var e=0;e<t.Td.length;e++){var u=t.Td[e],o=u.Sv(),a=u.Dv();if(s.drawImage(a,n,h,o.st,o.ht),h+=o.ht,e<t.Td.length-1){var l=t.Ed[e],c=l.Sv(),v=l.Dv();s.drawImage(v,n,h,c.st,c.ht),h+=c.ht}}n+=i.Sv().st,t.$d()&&(h=0,r("right"));var _=function(i){var r=f("left"===i?t.Rd.pd():t.Rd.gd()),e=r.Sv(),u=r.Dv();s.drawImage(u,n,h,e.st,e.ht)};if(t.Si.timeScale.visible){n=0,t.Kd()&&(_("left"),n=f(i.hd()).e_());var d=t.Rd.Sv();a=t.Rd.Dv();s.drawImage(a,n,h,d.st,d.ht),t.$d()&&(n=i.Sv().st,_("right"),s.restore())}})),n},t.prototype.Xd=function(t){return"none"===t?0:("left"!==t||this.Kd())&&("right"!==t||this.$d())?0===this.Td.length?0:f("left"===t?this.Td[0].hd():this.Td[0].rd()).e_():0},t.prototype.Zd=function(){for(var t=0,i=0,n=0,s=0,h=this.Td;s<h.length;s++){var r=h[s];this.Kd()&&(i=Math.max(i,f(r.hd()).s_())),this.$d()&&(n=Math.max(n,f(r.rd()).s_())),t+=r.Cf()}var e=this.br,u=this.Hn,o=Math.max(e-i-n,0),a=1*this.Ed.length,l=this.Si.timeScale.visible?this.Rd.kd():0;l%2&&(l+=1);for(var c=a+l,v=u<c?0:u-c,_=v/t,d=0,w=0;w<this.Td.length;++w){(r=this.Td[w]).F_(this.ni.Nl()[w]);var M,b=0;b=w===this.Td.length-1?v-d:Math.round(r.Cf()*_),d+=M=Math.max(b,2),r.r_(new on(o,M)),this.Kd()&&r.Z_(i,"left"),this.$d()&&r.Z_(n,"right"),r.a_()&&this.ni.Tl(r.a_(),M)}this.Rd.yd(new on(o,l),i,n),this.ni.$r(o),this.Ld!==i&&(this.Ld=i),this.Bd!==n&&(this.Bd=n)},t.prototype.Od=function(t){var i=t.deltaX/100,n=-t.deltaY/100;if(0!==i&&this.Si.handleScroll.mouseWheel||0!==n&&this.Si.handleScale.mouseWheel){switch(t.cancelable&&t.preventDefault(),t.deltaMode){case t.DOM_DELTA_PAGE:i*=120,n*=120;break;case t.DOM_DELTA_LINE:i*=32,n*=32}if(0!==n&&this.Si.handleScale.mouseWheel){var s=Math.sign(n)*Math.min(1,Math.abs(n)),h=t.clientX-this.dd.getBoundingClientRect().left;this.ct().Ll(h,s)}0!==i&&this.Si.handleScroll.mouseWheel&&this.ct().Bl(-80*i)}},t.prototype.Hd=function(t){var i=t.Ge();if(3===i&&this.Jd(),3===i||2===i){for(var n=this.ni.Nl(),s=0;s<n.length;s++)t.Qe(s).Cs&&n[s].Hf();t.iu()&&this.ni.j().ge();var h=t.nu();null!==h&&this.ni.j().ye(h),this.Rd.B()}this.f_(t)},t.prototype.al=function(t){var i=this;null!==this.Vd?this.Vd.gn(t):this.Vd=t,this.zd||(this.zd=!0,this.Ad=window.requestAnimationFrame((function(){i.zd=!1,i.Ad=0,null!==i.Vd&&(i.Hd(i.Vd),i.Vd=null)})))},t.prototype.Jd=function(){this.jd()},t.prototype.qd=function(t){this.Fd.removeChild(t.xv()),t.ln()},t.prototype.jd=function(){for(var t=this.ni.Nl(),i=t.length,n=this.Td.length,s=i;s<n;s++){var h=a(this.Td.pop());this.Fd.removeChild(h.xv()),h.K_().on(this),h.ln(),void 0!==(r=this.Ed.pop())&&this.qd(r)}for(s=n;s<i;s++){if((h=new Cn(this,t[s])).K_().sn(this.Gd.bind(this),this),this.Td.push(h),s>1){var r=new Nn(this,s-1,s,!0);this.Ed.push(r),this.Fd.insertBefore(r.xv(),this.Rd.xv())}this.Fd.insertBefore(h.xv(),this.Rd.xv())}for(s=0;s<i;s++){var e=t[s];(h=this.Td[s]).a_()!==e?h.F_(e):h.V_()}this.Ud(),this.Zd()},t.prototype.Qd=function(t,i){var n,s=new Map;null!==t&&this.ni.V().forEach((function(i){var n=i.So(t);null!==n&&s.set(i,n)}));if(null!==t){var h=this.ni.j().si(t);null!==h&&(n=h)}var r=this.ct().bl(),e=null!==r&&r.pl instanceof Gi?r.pl:void 0,u=null!==r&&void 0!==r.W_?r.W_._o:void 0;return{F:n,tw:i||void 0,iw:e,nw:s,sw:u}},t.prototype.Gd=function(t,i){var n=this;this.y_.an((function(){return n.Qd(t,i)}))},t.prototype.Id=function(t,i){var n=this;this.ol.an((function(){return n.Qd(t,i)}))},t.prototype.Ud=function(){var t=this.Si.timeScale.visible?"":"none";this.Rd.xv().style.display=t},t.prototype.Kd=function(){return this.Si.leftPriceScale.visible},t.prototype.$d=function(){return this.Si.rightPriceScale.visible},t}();function Bn(t){if(!Wt(t))throw new Error("time must be of type BusinessDay");var i=new Date(Date.UTC(t.year,t.month-1,t.day,0,0,0,0));return{timestamp:Math.round(i.getTime()/1e3),businessDay:t}}function Vn(t){if(!jt(t))throw new Error("time must be of type isUTCTimestamp");return{timestamp:t}}function zn(t){return 0===t.length?null:Wt(t[0].time)?Bn:Vn}function Fn(t){return jt(t)?Vn(t):Wt(t)?Bn(t):Bn(Kn(t))}function Pn(t,i){var n=t.value,s=null;return"color"in t&&void 0!==t.color&&(s=i.Yo(t.color)),[n,n,n,n,s]}function On(t,i){return[t.open,t.high,t.low,t.close,null]}var In={Candlestick:On,Bar:On,Area:Pn,Histogram:Pn,Line:Pn};function Rn(t){return In[t]}function Wn(t){return 60*t*60*1e3}function jn(t){return 60*t*1e3}var Un,qn=[{hw:1,Qh:20},{hw:(Un=1,1e3*Un),Qh:19},{hw:jn(1),Qh:20},{hw:jn(5),Qh:21},{hw:jn(30),Qh:22},{hw:Wn(1),Qh:30},{hw:Wn(3),Qh:31},{hw:Wn(6),Qh:32},{hw:Wn(12),Qh:33}];function Hn(t,i){if(null!==i){var n=new Date(1e3*i),s=new Date(1e3*t);if(s.getUTCFullYear()!==n.getUTCFullYear())return 70;if(s.getUTCMonth()!==n.getUTCMonth())return 60;if(s.getUTCDate()!==n.getUTCDate())return 50;for(var h=qn.length-1;h>=0;--h)if(Math.floor(n.getTime()/qn[h].hw)!==Math.floor(s.getTime()/qn[h].hw))return qn[h].Qh}return 20}function Yn(t,i){return t.timestamp<i.timestamp}function Kn(t){var i=new Date(t);if(isNaN(i.getTime()))throw new Error("Invalid date string="+t+", expected format=yyyy-mm-dd");return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function $n(t){d(t.time)&&(t.time=Kn(t.time))}var Xn=function(){function t(){this.rw=new Map,this.ew=new Map,this.uw=[]}return t.prototype.ln=function(){this.rw.clear(),this.ew.clear(),this.uw=[]},t.prototype.ow=function(t,i){var n=this;t.tf(),function(t){t.forEach($n)}(i),this.rw.forEach((function(i){return i.aw.delete(t)}));var s=zn(i);null!==s&&i.forEach((function(i){var h=s(i.time),r=n.rw.get(h.timestamp)||{Bi:0,aw:new Map,ih:h};r.aw.set(t,i),n.rw.set(h.timestamp,r)}));var h=new Map;return this.rw.forEach((function(t,i){t.aw.size>0&&h.set(i,t)})),this.fw(h)},t.prototype.$l=function(t){return this.ow(t,[])},t.prototype.lw=function(t,i){$n(i);var n=t.pu().Ki();if(n.er()>0)if(void 0!==f(n.fa()).F.businessDay){if(!Wt(i.time))throw new Error("time must be of type BusinessDay")}else if(!jt(i.time))throw new Error("time must be of type isUTCTimestamp");var s=f(zn([i]))(i.time),h=this.rw.get(s.timestamp)||{Bi:0,aw:new Map,ih:s},r=0===h.aw.size;h.aw.set(t,i);var e=!1;if(r){var u=this.rw.size;this.uw.length>0&&this.uw[this.uw.length-1].timestamp>s.timestamp?(u=ii(this.uw,s,Yn),this.uw.splice(u,0,s),this.cw(u),e=!0):this.uw.push(s),h.Bi=u,this.ew.set(h.Bi,s)}this.rw.set(s.timestamp,h);var o=new Map,l=function(i){var n=a(c.ew.get(i));a(c.rw.get(n.timestamp)).aw.forEach((function(s,h){if(e||h===t){var r=Rn(h.Ko()),u=o.get(h)||{B:[]},a={Bi:i,F:n,Z:r(s,h.Xu())};u.B.push(a),o.set(h,u)}}))},c=this;for(u=h.Bi;u<this.rw.size;++u)l(u);var v=r?this.vw(h.Bi):[],_=r?this.uw.slice(h.Bi):[];return{_w:{dw:o,ww:_,Bi:h.Bi,qn:v}}},t.prototype.fw=function(t){var i=this;this.rw=t,this.uw=Array.from(this.rw.values()).map((function(t){return t.ih})),this.uw.sort((function(t,i){return t.timestamp-i.timestamp}));var n=new Map;this.uw.forEach((function(t,s){var h=a(i.rw.get(t.timestamp));h.Bi=s,h.aw.forEach((function(i,h){var r=Rn(h.Ko()),e=n.get(h)||{B:[]},u={Bi:s,F:t,Z:r(i,h.Xu())};e.B.push(u),n.set(h,e)}))}));var s=null,h=0,r=this.uw.map((function(t,i){h+=t.timestamp-(s||t.timestamp);var n=Hn(t.timestamp,s);return s=t.timestamp,{Qh:n,F:t,Bi:i}}));if(r.length>1){var e=Math.ceil(h/(r.length-1)),u=r[0].F.timestamp-e;r[0].Qh=Hn(r[0].F.timestamp,u)}var o={dw:n,ww:this.uw.slice(),Bi:0,qn:r};return this.Mw(),{_w:o}},t.prototype.cw=function(t){for(var i=this.ew.size-1;i>=t;--i){var n=a(this.ew.get(i)),s=i+1;a(this.rw.get(n.timestamp)).Bi=s,this.ew.delete(i),this.ew.set(s,n)}},t.prototype.Mw=function(){var t=this;this.ew.clear(),this.rw.forEach((function(i,n){t.ew.set(i.Bi,i.ih)}))},t.prototype.vw=function(t){for(var i,n=[],s=(null===(i=this.ew.get(t-1))||void 0===i?void 0:i.timestamp)||null,h=t;h<this.ew.size;++h){var r=a(this.ew.get(h)),e=Hn(r.timestamp,s);s=r.timestamp,n.push({Qh:e,F:r,Bi:h})}return n},t}(),Zn={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,axisLabelVisible:!0},Jn=function(){function t(t){this.Oo=t}return t.prototype.applyOptions=function(t){this.Oo.ms(t)},t.prototype.options=function(){return this.Oo.O()},t.prototype.bw=function(){return this.Oo},t}();function Gn(t){var i=t.overlay,n=function(t,i){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(s=Object.getOwnPropertySymbols(t);h<s.length;h++)i.indexOf(s[h])<0&&Object.prototype.propertyIsEnumerable.call(t,s[h])&&(n[s[h]]=t[s[h]])}return n}(t,["overlay"]);return i&&(n.priceScaleId=""),n}var Qn=function(){function t(t,i,n){this.vu=t,this.mw=i,this.pw=n}return t.prototype.ln=function(){delete this.vu,delete this.mw},t.prototype.priceFormatter=function(){return this.vu.ah()},t.prototype.gw=function(){return this.vu},t.prototype.priceToCoordinate=function(t){var i=this.vu.q();return null===i?null:this.vu.X().$(t,i.Z)},t.prototype.coordinateToPrice=function(t){var i=this.vu.q();return null===i?null:this.vu.X().Ei(t,i.Z)},t.prototype.barsInLogicalRange=function(t){if(null===t)return null;var i=new It(new Bt(t.from,t.to)).dr(),n=this.vu.pu().Ki();if(n.Gt())return null;var s=n.va(i.ph(),1),h=n.va(i.gh(),-1),r=f(n.ur()),e=f(n.Yi());if(null!==s&&null!==h&&s.Bi>h.Bi)return{barsBefore:t.from-r,barsAfter:e-t.to};var u={barsBefore:null===s||s.Bi===r?t.from-r:s.Bi-r,barsAfter:null===h||h.Bi===e?e-t.to:e-h.Bi};return null!==s&&null!==h&&(u.from=s.F.businessDay||s.F.timestamp,u.to=h.F.businessDay||h.F.timestamp),u},t.prototype.setData=function(t){this.mw.yw(this.vu,t)},t.prototype.update=function(t){this.mw.if(this.vu,t)},t.prototype.setMarkers=function(t){var i=t.map((function(t){return e(e({},t),{time:Fn(t.time)})}));this.vu.rf(i)},t.prototype.applyOptions=function(t){var i=Gn(t);this.vu.ms(i)},t.prototype.options=function(){return b(this.vu.O())},t.prototype.priceScale=function(){return this.pw.X(this.vu.X().bs())},t.prototype.createPriceLine=function(t){var i=c(b(Zn),t),n=this.vu.uf(i);return new Jn(n)},t.prototype.removePriceLine=function(t){this.vu.af(t.bw())},t}(),ts=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),i.prototype.applyOptions=function(i){xt(i),t.prototype.applyOptions.call(this,i)},i}(Qn),is={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,scaleMargins:{bottom:.1,top:.2}};var ns={rightOffset:0,barSpacing:6,fixLeftEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,tickMarkFormatter:function(t,i,n){var s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=!1,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=!1,s.hour="2-digit",s.minute="2-digit",s.second="2-digit"}var h=void 0===t.businessDay?new Date(1e3*t.timestamp):new Date(Date.UTC(t.businessDay.year,t.businessDay.month-1,t.businessDay.day));return new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()).toLocaleString(n,s)}},ss={width:0,height:0,layout:{backgroundColor:"#FFFFFF",textColor:"#191919",fontSize:11,fontFamily:"'Trebuchet MS', Roboto, Ubuntu, sans-serif"},crosshair:{vertLine:{color:"#758696",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#4c525e"},horzLine:{color:"#758696",width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:"#4c525e"},mode:1},grid:{vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},overlayPriceScales:e({},is),leftPriceScale:e(e({},is),{visible:!1}),rightPriceScale:e(e({},is),{visible:!0}),timeScale:ns,watermark:{color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,text:"",horzAlign:"center",vertAlign:"center"},localization:{locale:navigator.language,dateFormat:"dd MMM 'yy"},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:!0,mouseWheel:!0,pinch:!0}},hs={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},rs={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},es={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4},us={topColor:"rgba( 46, 220, 135, 0.4)",bottomColor:"rgba( 40, 221, 100, 0)",lineColor:"#33D778",lineStyle:0,lineWidth:3,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4},os={color:"#26a69a",base:0},as={title:"",lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:"",priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:"#B2B5BE",baseLineStyle:0,priceFormat:{type:"price",precision:2,minMove:.01}},fs=function(){function t(t,i){this.vv=t,this.kw=i}return t.prototype.ln=function(){delete this.vv},t.prototype.bs=function(){return this.Zt().bs()},t.prototype.applyOptions=function(t){this.vv.ct().gl(this.kw,t)},t.prototype.options=function(){return this.Zt().O()},t.prototype.width=function(){return Ht(this.kw)?this.vv.Xd("left"===this.kw?"left":"right"):0},t.prototype.Zt=function(){return f(this.vv.ct().yl(this.kw)).X},t}(),ls=function(){function t(t){this.Nw=new st,this.Sr=new st,this.ni=t,this.pf().Me().sn(this.xw.bind(this)),this.pf().be().sn(this.Sw.bind(this))}return t.prototype.getBarSpacing=function(){return this.pf().he()},t.prototype.ln=function(){this.pf().Me().on(this),this.pf().be().on(this),this.Nw.ln(),delete this.ni},t.prototype.scrollPosition=function(){return this.pf().ee()},t.prototype.scrollToPosition=function(t,i){i?this.pf().we(t,1e3):this.pf().Ir(t)},t.prototype.scrollToRealTime=function(){this.pf().de()},t.prototype.getVisibleRange=function(){var t,i,n=this.pf().Ur();return null===n?null:{from:null!==(t=n.from.businessDay)&&void 0!==t?t:n.from.timestamp,to:null!==(i=n.to.businessDay)&&void 0!==i?i:n.to.timestamp}},t.prototype.setVisibleRange=function(t){var i={from:Fn(t.from),to:Fn(t.to)},n=this.pf().Yr(i);this.ni.Xl(n)},t.prototype.getVisibleLogicalRange=function(){var t=this.pf().jr();return null===t?null:{from:t.ph(),to:t.gh()}},t.prototype.setVisibleLogicalRange=function(t){o(t.from<=t.to,"The from index cannot be after the to index."),this.ni.Xl(t)},t.prototype.resetTimeScale=function(){this.ni.Il()},t.prototype.fitContent=function(){this.ni.ge()},t.prototype.timeToCoordinate=function(t){var i=Fn(t),n=this.ni.j(),s=n.Hr().cr(i.timestamp,!1);return null===s?null:n.J(s)},t.prototype.coordinateToTime=function(t){var i,n=this.ni.j(),s=n.te(t),h=n.Hr().ar(s);return null===h?null:null!==(i=h.businessDay)&&void 0!==i?i:h.timestamp},t.prototype.subscribeVisibleTimeRangeChange=function(t){this.Nw.sn(t)},t.prototype.unsubscribeVisibleTimeRangeChange=function(t){this.Nw.un(t)},t.prototype.subscribeVisibleLogicalRangeChange=function(t){this.Sr.sn(t)},t.prototype.unsubscribeVisibleLogicalRangeChange=function(t){this.Sr.un(t)},t.prototype.applyOptions=function(t){this.pf().ms(t)},t.prototype.options=function(){return b(this.pf().O())},t.prototype.pf=function(){return this.ni.j()},t.prototype.xw=function(){this.Nw.fn()&&this.Nw.an(this.getVisibleRange())},t.prototype.Sw=function(){this.Sr.fn()&&this.Sr.an(this.getVisibleLogicalRange())},t}();function cs(t){if(void 0!==t&&"custom"!==t.type){var i=t;void 0!==i.minMove&&void 0===i.precision&&(i.precision=function(t){if(t>=1)return 0;for(var i=0;i<8;i++){var n=Math.round(t);if(Math.abs(n-t)<1e-8)return i;t*=10}return i}(i.minMove))}}function vs(t){return function(t){if(M(t.handleScale)){var i=t.handleScale;t.handleScale={axisDoubleClickReset:i,axisPressedMouseMove:{time:i,price:i},mouseWheel:i,pinch:i}}else if(void 0!==t.handleScale&&M(t.handleScale.axisPressedMouseMove)){var n=t.handleScale.axisPressedMouseMove;t.handleScale.axisPressedMouseMove={time:n,price:n}}var s=t.handleScroll;M(s)&&(t.handleScroll={horzTouchDrag:s,vertTouchDrag:s,mouseWheel:s,pressedMouseMove:s})}(t),function(t){if(t.priceScale){t.leftPriceScale=t.leftPriceScale||{},t.rightPriceScale=t.rightPriceScale||{};var i=t.priceScale.position;delete t.priceScale.position,t.leftPriceScale=c(t.leftPriceScale,t.priceScale),t.rightPriceScale=c(t.rightPriceScale,t.priceScale),"left"===i&&(t.leftPriceScale.visible=!0,t.rightPriceScale.visible=!1),"right"===i&&(t.leftPriceScale.visible=!1,t.rightPriceScale.visible=!0),"none"===i&&(t.leftPriceScale.visible=!1,t.rightPriceScale.visible=!1),t.overlayPriceScales=t.overlayPriceScales||{},void 0!==t.priceScale.invertScale&&(t.overlayPriceScales.invertScale=t.priceScale.invertScale),void 0!==t.priceScale.scaleMargins&&(t.overlayPriceScales.scaleMargins=t.priceScale.scaleMargins)}}(t),t}var _s=function(){function t(t,i){var n=this;this.Dw=new Xn,this.Cw=new Map,this.Tw=new Map,this.Ew=new st,this.Aw=new st;var s=void 0===i?b(ss):c(b(ss),vs(i));this.vv=new Ln(t,s),this.vv.K_().sn((function(t){n.Ew.fn()&&n.Ew.an(n.Lw(t()))}),this),this.vv.Cl().sn((function(t){n.Aw.fn()&&n.Aw.an(n.Lw(t()))}),this);var h=this.vv.ct();this.Bw=new ls(h)}return t.prototype.remove=function(){this.vv.K_().on(this),this.vv.Cl().on(this),this.Bw.ln(),this.vv.ln(),delete this.vv,this.Cw.forEach((function(t,i){i.ln()})),this.Cw.clear(),this.Tw.clear(),this.Ew.ln(),this.Aw.ln(),this.Dw.ln(),delete this.Dw},t.prototype.resize=function(t,i,n){this.vv.Wd(t,i,n)},t.prototype.addAreaSeries=function(t){void 0===t&&(t={}),cs(t.priceFormat);var i=c(b(as),us,t),n=this.vv.ct().Yl("Area",i),s=new Qn(n,this,this);return this.Cw.set(s,n),this.Tw.set(n,s),s},t.prototype.addBarSeries=function(t){void 0===t&&(t={}),cs(t.priceFormat);var i=c(b(as),rs,t),n=this.vv.ct().Yl("Bar",i),s=new Qn(n,this,this);return this.Cw.set(s,n),this.Tw.set(n,s),s},t.prototype.addCandlestickSeries=function(t){void 0===t&&(t={}),xt(t),cs(t.priceFormat);var i=c(b(as),hs,t),n=this.vv.ct().Yl("Candlestick",i),s=new ts(n,this,this);return this.Cw.set(s,n),this.Tw.set(n,s),s},t.prototype.addHistogramSeries=function(t){void 0===t&&(t={}),cs(t.priceFormat);var i=c(b(as),os,t),n=this.vv.ct().Yl("Histogram",i),s=new Qn(n,this,this);return this.Cw.set(s,n),this.Tw.set(n,s),s},t.prototype.addLineSeries=function(t){void 0===t&&(t={}),cs(t.priceFormat);var i=c(b(as),es,t),n=this.vv.ct().Yl("Line",i),s=new Qn(n,this,this);return this.Cw.set(s,n),this.Tw.set(n,s),s},t.prototype.removeSeries=function(t){var i=t,n=a(this.Cw.get(i)),s=this.Dw.$l(n),h=this.vv.ct();h.$l(n);var r=s._w;h.Ul(r.Bi,r.ww,r.qn,!0),r.dw.forEach((function(t,i){i.if(t.B)})),h.ql(0),this.Cw.delete(i),this.Tw.delete(n)},t.prototype.yw=function(t,i){var n=this.Dw.ow(t,i),s=this.vv.ct(),h=n._w;s.Ul(h.Bi,h.ww,h.qn,!0),h.dw.forEach((function(t,i){i.if(t.B,!0)})),s.ql(0)},t.prototype.if=function(t,i){var n=this.Dw.lw(t,i),s=this.vv.ct(),h=n._w;s.Ul(h.Bi,h.ww,h.qn,!1),h.dw.forEach((function(t,i){i.if(t.B)})),s.ql(0)},t.prototype.subscribeClick=function(t){this.Ew.sn(t)},t.prototype.unsubscribeClick=function(t){this.Ew.un(t)},t.prototype.subscribeCrosshairMove=function(t){this.Aw.sn(t)},t.prototype.unsubscribeCrosshairMove=function(t){this.Aw.un(t)},t.prototype.priceScale=function(t){return t=t||this.vv.ct().Zl(),new fs(this.vv,t)},t.prototype.timeScale=function(){return this.Bw},t.prototype.applyOptions=function(t){this.vv.ms(vs(t))},t.prototype.options=function(){return this.vv.O()},t.prototype.takeScreenshot=function(){return this.vv.Yd()},t.prototype.Vw=function(t){return a(this.Tw.get(t))},t.prototype.Lw=function(t){var i=this,n=new Map;t.nw.forEach((function(t,s){n.set(i.Vw(s),t)}));var s=void 0===t.iw?void 0:this.Vw(t.iw);return{time:t.F&&(t.F.businessDay||t.F.timestamp),point:t.tw,hoveredSeries:s,hoveredMarkerId:t.sw,seriesPrices:n}},t}();var ds=Object.freeze({__proto__:null,version:function(){return"2.1.0-dev+202005300152"},get LineStyle(){return i},get LineType(){return t},get CrosshairMode(){return U},get PriceScaleMode(){return Mt},get PriceLineSource(){return gt},get TickMarkType(){return Ft},isBusinessDay:Wt,isUTCTimestamp:jt,createChart:function(t,i){var n=f(d(t)?document.getElementById(t):t);return new _s(n,i)}});window.LightweightCharts=ds}();