From bafdfdd244ed18496a57f87f5ac20664791c164b Mon Sep 17 00:00:00 2001 From: Aurelien Rebourg Date: Thu, 8 Apr 2021 20:41:56 +0100 Subject: [PATCH] release v2.0.0 --- dist/kaktana-react-lightweight-charts.min.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/kaktana-react-lightweight-charts.min.js b/dist/kaktana-react-lightweight-charts.min.js index ea24ec4..94b9e9c 100644 --- a/dist/kaktana-react-lightweight-charts.min.js +++ b/dist/kaktana-react-lightweight-charts.min.js @@ -1,7 +1,7 @@ -module.exports=function(t){var i={};function n(e){if(i[e])return i[e].exports;var r=i[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=i,n.d=function(t,i,e){n.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,i){if(1&i&&(t=n(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var r in t)n.d(e,r,function(i){return t[i]}.bind(null,r));return e},n.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(i,"a",i),i},n.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},n.p="",n(n.s=2)}([function(t,i){t.exports=require("react")},function(t,i,n){"use strict";t.exports=function t(i,n){if(i===n)return!0;if(i&&n&&"object"==typeof i&&"object"==typeof n){if(i.constructor!==n.constructor)return!1;var e,r,s;if(Array.isArray(i)){if((e=i.length)!=n.length)return!1;for(r=e;0!=r--;)if(!t(i[r],n[r]))return!1;return!0}if(i.constructor===RegExp)return i.source===n.source&&i.flags===n.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===n.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===n.toString();if((e=(s=Object.keys(i)).length)!==Object.keys(n).length)return!1;for(r=e;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=e;0!=r--;){var o=s[r];if(!t(i[o],n[o]))return!1}return!0}return i!=i&&n!=n}},function(t,i,n){"use strict";n.r(i),n.d(i,"CrosshairMode",(function(){return j})),n.d(i,"LineStyle",(function(){return h})),n.d(i,"LineType",(function(){return o})),n.d(i,"PriceLineSource",(function(){return wt})),n.d(i,"PriceScaleMode",(function(){return gt})),n.d(i,"TickMarkType",(function(){return zt})),n.d(i,"createChart",(function(){return ee})),n.d(i,"isBusinessDay",(function(){return Dt})),n.d(i,"isUTCTimestamp",(function(){return Jt})),n.d(i,"version",(function(){return re}));var e=n(0),r=n.n(e),s={allowDownsampling:!0};var o,h,u,a=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}(); +module.exports=function(t){var i={};function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var r in t)e.d(n,r,function(i){return t[i]}.bind(null,r));return n},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=2)}([function(t,i){t.exports=require("react")},function(t,i,e){"use strict";t.exports=function t(i,e){if(i===e)return!0;if(i&&e&&"object"==typeof i&&"object"==typeof e){if(i.constructor!==e.constructor)return!1;var n,r,s;if(Array.isArray(i)){if((n=i.length)!=e.length)return!1;for(r=n;0!=r--;)if(!t(i[r],e[r]))return!1;return!0}if(i.constructor===RegExp)return i.source===e.source&&i.flags===e.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===e.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===e.toString();if((n=(s=Object.keys(i)).length)!==Object.keys(e).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;for(r=n;0!=r--;){var o=s[r];if(!t(i[o],e[o]))return!1}return!0}return i!=i&&e!=e}},function(t,i,e){"use strict";e.r(i),e.d(i,"CrosshairMode",(function(){return K})),e.d(i,"LineStyle",(function(){return o})),e.d(i,"LineType",(function(){return s})),e.d(i,"PriceLineSource",(function(){return Ri})),e.d(i,"PriceScaleMode",(function(){return ki})),e.d(i,"createChart",(function(){return _n})),e.d(i,"isBusinessDay",(function(){return Oi})),e.d(i,"isUTCTimestamp",(function(){return Bi})),e.d(i,"version",(function(){return En}));var n=e(0),r=e.n(n);var s,o,h,a=function(){function t(t){var i=this;this._resolutionMediaQueryList=null,this._resolutionListener=function(t){return i._onResolutionChanged()},this._canvasConfiguredListeners=[],this.canvas=t,this._canvasSize={width:this.canvas.clientWidth,height:this.canvas.clientHeight},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},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}(); /*! * @license - * TradingView Lightweight Charts v3.3.0 - * Copyright (c) 2020 TradingView, Inc. + * TradingView Lightweight Charts v2.0.0 + * Copyright (c) 2019 TradingView, Inc. * Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0 - */function l(t,i){var n,e=((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(e)}function c(t,i,n,e){t.beginPath();var r=t.lineWidth%2?.5:0;t.moveTo(n,i+r),t.lineTo(e,i+r),t.stroke()}(u=o||(o={}))[u.Simple=0]="Simple",u[u.WithSteps=1]="WithSteps",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"}(h||(h={}));var f=function(t,i){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])})(t,i)};function p(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}f(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var v=function(){return(v=Object.assign||function(t){for(var i,n=1,e=arguments.length;n=i.from;--r){var s=n.m[r];t.moveTo(s.g,s.p),t.arc(s.g,s.p,e,0,2*Math.PI)}t.fill()};t.fillStyle=n.k,e(n.N+2),t.fillStyle=n.S,e(n.N)}},i}(O),L={from:0,to:1},B=function(){function t(t,i){this.C=new k,this.D=[],this.T=[],this.B=!0,this.L=t,this.A=i,this.C.i(this.D)}return t.prototype.V=function(t){var i=this,n=this.L.O();n.length!==this.D.length&&(this.T=n.map((function(){return{m:[{g:0,p:0,P:0,F:0}],S:"",k:i.L.I().layout.backgroundColor,N:0,M:null}})),this.D=this.T.map((function(t){var i=new E;return i._(t),i})),this.C.i(this.D)),this.B=!0},t.prototype.W=function(t,i,n){return this.B&&(this.R(),this.B=!1),this.C},t.prototype.R=function(){var t=this,i=this.L.O(),n=this.A.j(),e=this.L.U();i.forEach((function(i,r){var s=t.T[r],o=i.q(n);if(null!==o&&i.H()){var h=m(i.Y());s.S=o.K,s.k=o.$,s.N=o.N,s.m[0].F=o.F,s.m[0].p=i.Z().X(o.F,h.J),s.m[0].P=n,s.m[0].g=e.G(n),s.M=L}else s.M=null}))},t}(),I=function(){function t(t){this.tt=t}return t.prototype.h=function(t,i,n,e){if(null!==this.tt){var r=this.tt.it.H,s=this.tt.nt.H;if(r||s){t.save();var o=Math.round(this.tt.g*i),h=Math.round(this.tt.p*i),u=Math.ceil(this.tt.ht*i),a=Math.ceil(this.tt.st*i);t.lineCap="butt",r&&o>=0&&(t.lineWidth=Math.floor(this.tt.it.rt*i),t.strokeStyle=this.tt.it.et,t.fillStyle=this.tt.it.et,l(t,this.tt.it.ut),function(t,i,n,e){t.beginPath();var r=t.lineWidth%2?.5:0;t.moveTo(i+r,0),t.lineTo(i+r,e),t.stroke()}(t,o,0,a)),s&&h>=0&&(t.lineWidth=Math.floor(this.tt.nt.rt*i),t.strokeStyle=this.tt.nt.et,t.fillStyle=this.tt.nt.et,l(t,this.tt.nt.ut),c(t,h,0,u)),t.restore()}}},t}(),z=function(){function t(t){this.B=!0,this.at={it:{rt:1,ut:0,et:"",H:!1},nt:{rt:1,ut:0,et:"",H:!1},ht:0,st:0,g:0,p:0},this.ot=new I(this.at),this.lt=t}return t.prototype.V=function(){this.B=!0},t.prototype.W=function(t,i){return this.B&&(this.R(),this.B=!1),this.ot},t.prototype.R=function(){var t=this.lt.H(),i=m(this.lt.ft()),n=i.ct().I().crosshair,e=this.at;e.nt.H=t&&this.lt.vt(i),e.it.H=t&&this.lt._t(),e.nt.rt=n.horzLine.width,e.nt.ut=n.horzLine.style,e.nt.et=n.horzLine.color,e.it.rt=n.vertLine.width,e.it.ut=n.vertLine.style,e.it.et=n.vertLine.color,e.ht=i.dt(),e.st=i.wt(),e.g=this.lt.Mt(),e.p=this.lt.bt()},t}(),V={khaki:"#f0e68c",azure:"#f0ffff",aliceblue:"#f0f8ff",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",gray:"#808080",green:"#008000",honeydew:"#f0fff0",floralwhite:"#fffaf0",lightblue:"#add8e6",lightcoral:"#f08080",lemonchiffon:"#fffacd",hotpink:"#ff69b4",lightyellow:"#ffffe0",greenyellow:"#adff2f",lightgoldenrodyellow:"#fafad2",limegreen:"#32cd32",linen:"#faf0e6",lightcyan:"#e0ffff",magenta:"#f0f",maroon:"#800000",olive:"#808000",orange:"#ffa500",oldlace:"#fdf5e6",mediumblue:"#0000cd",transparent:"#0000",lime:"#0f0",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",midnightblue:"#191970",orchid:"#da70d6",mediumorchid:"#ba55d3",mediumturquoise:"#48d1cc",orangered:"#ff4500",royalblue:"#4169e1",powderblue:"#b0e0e6",red:"#f00",coral:"#ff7f50",turquoise:"#40e0d0",white:"#fff",whitesmoke:"#f5f5f5",wheat:"#f5deb3",teal:"#008080",steelblue:"#4682b4",bisque:"#ffe4c4",aquamarine:"#7fffd4",aqua:"#0ff",sienna:"#a0522d",silver:"#c0c0c0",springgreen:"#00ff7f",antiquewhite:"#faebd7",burlywood:"#deb887",brown:"#a52a2a",beige:"#f5f5dc",chocolate:"#d2691e",chartreuse:"#7fff00",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cadetblue:"#5f9ea0",tomato:"#ff6347",fuchsia:"#f0f",blue:"#00f",salmon:"#fa8072",blanchedalmond:"#ffebcd",slateblue:"#6a5acd",slategray:"#708090",thistle:"#d8bfd8",tan:"#d2b48c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",blueviolet:"#8a2be2",black:"#000",darkmagenta:"#8b008b",darkslateblue:"#483d8b",darkkhaki:"#bdb76b",darkorchid:"#9932cc",darkorange:"#ff8c00",darkgreen:"#006400",darkred:"#8b0000",dodgerblue:"#1e90ff",darkslategray:"#2f4f4f",dimgray:"#696969",deepskyblue:"#00bfff",firebrick:"#b22222",forestgreen:"#228b22",indigo:"#4b0082",ivory:"#fffff0",lavenderblush:"#fff0f5",feldspar:"#d19275",indianred:"#cd5c5c",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightskyblue:"#87cefa",lightslategray:"#789",lightslateblue:"#8470ff",snow:"#fffafa",lightseagreen:"#20b2aa",lightsalmon:"#ffa07a",darksalmon:"#e9967a",darkviolet:"#9400d3",mediumpurple:"#9370d8",mediumaquamarine:"#66cdaa",skyblue:"#87ceeb",lavender:"#e6e6fa",lightsteelblue:"#b0c4de",mediumvioletred:"#c71585",mintcream:"#f5fffa",navajowhite:"#ffdead",navy:"#000080",olivedrab:"#6b8e23",palevioletred:"#d87093",violetred:"#d02090",yellow:"#ff0",yellowgreen:"#9acd32",lawngreen:"#7cfc00",pink:"#ffc0cb",paleturquoise:"#afeeee",palegoldenrod:"#eee8aa",darkolivegreen:"#556b2f",darkseagreen:"#8fbc8f",darkturquoise:"#00ced1",peachpuff:"#ffdab9",deeppink:"#ff1493",violet:"#ee82ee",palegreen:"#98fb98",mediumseagreen:"#3cb371",peru:"#cd853f",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",purple:"#800080",seagreen:"#2e8b57",seashell:"#fff5ee",papayawhip:"#ffefd5",mediumslateblue:"#7b68ee",plum:"#dda0dd",mediumspringgreen:"#00fa9a"};function R(t){return t<0?0:t>255?255:Math.round(t)||0}var A=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,D=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,J=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,N=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?[\d]{0,10}(?:\.\d+)?)\s*\)$/;function F(t){var i,n=function(t){var i;if((t=t.toLowerCase())in V&&(t=V[t]),i=N.exec(t)||J.exec(t))return[R(parseInt(i[1],10)),R(parseInt(i[2],10)),R(parseInt(i[3],10))];if(i=D.exec(t))return[R(parseInt(i[1],16)),R(parseInt(i[2],16)),R(parseInt(i[3],16))];if(i=A.exec(t))return[R(17*parseInt(i[1],16)),R(17*parseInt(i[2],16)),R(17*parseInt(i[3],16))];throw new Error("Cannot parse color: "+t)}(t);return{gt:"rgb("+n[0]+", "+n[1]+", "+n[2]+")",yt:(i=n,.199*i[0]+.687*i[1]+.114*i[2]>160?"black":"white")}}function U(t,i,n,e,r,s){t.fillRect(i+s,n,e-2*s,s),t.fillRect(i+s,n+r-s,e-2*s,s),t.fillRect(i,n,s,r),t.fillRect(i+e-s,n,s,r)}function H(t,i,n){t.save(),t.scale(i,i),n(),t.restore()}function W(t,i,n,e,r,s){t.save(),t.globalCompositeOperation="copy",t.fillStyle=s,t.fillRect(i,n,e,r),t.restore()}var j,Y=function(){function t(t,i){this._(t,i)}return t.prototype._=function(t,i){this.tt=t,this.kt=i},t.prototype.h=function(t,i,n,e,r,s){if(this.tt.H){t.font=i.xt;var o=this.tt.Nt||!this.tt.St?i.Ct:0,h=i.Dt,u=i.Tt,a=i.Bt,l=i.Et,c=i.Lt,f=this.tt.At,p=Math.ceil(n.Vt(t,f)),v=i.Ot,d=i.zt+u+a,y=Math.ceil(.5*d),g=h+p+l+c+o,m=this.kt.Pt;this.kt.Ft&&(m=this.kt.Ft);var b,M,w=(m=Math.round(m))-y,_=w+d,S="right"===r,x=S?e:0,C=Math.ceil(e*s),T=x;if(t.fillStyle=this.kt.gt,t.lineWidth=1,t.lineCap="butt",f){S?(b=x-o,M=(T=x-g)+c):(T=x+g,b=x+o,M=x+h+o+l);var P=Math.max(1,Math.floor(s)),k=Math.max(1,Math.floor(h*s)),O=S?C:0,E=Math.round(w*s),L=Math.round(T*s),B=Math.round(m*s)-Math.floor(.5*s),I=B+P+(B-E),z=Math.round(b*s);t.save(),t.beginPath(),t.moveTo(O,E),t.lineTo(L,E),t.lineTo(L,I),t.lineTo(O,I),t.fill(),t.fillStyle=this.tt.$,t.fillRect(S?C-k:0,E,k,I-E),this.tt.Nt&&(t.fillStyle=this.kt.et,t.fillRect(O,B,z-O,P)),t.textAlign="left",t.fillStyle=this.kt.et,H(t,s,(function(){t.fillText(f,M,_-a-v)})),t.restore()}}},t.prototype.wt=function(t,i){return this.tt.H?t.zt+t.Tt+t.Bt:0},t}(),Z=function(){function t(t){this.It={Pt:0,et:"#FFF",gt:"#000"},this.Wt={At:"",H:!1,Nt:!0,St:!1,$:""},this.Rt={At:"",H:!1,Nt:!1,St:!0,$:""},this.B=!0,this.jt=new(t||Y)(this.Wt,this.It),this.Ut=new(t||Y)(this.Rt,this.It)}return t.prototype.At=function(){return this.Wt.At},t.prototype.Pt=function(){return this.qt(),this.It.Pt},t.prototype.V=function(){this.B=!0},t.prototype.wt=function(t,i){return void 0===i&&(i=!1),Math.max(this.jt.wt(t,i),this.Ut.wt(t,i))},t.prototype.Ht=function(){return this.It.Ft||0},t.prototype.Yt=function(t){this.It.Ft=t},t.prototype.Kt=function(){return this.qt(),this.Wt.H||this.Rt.H},t.prototype.$t=function(){return this.qt(),this.Wt.H},t.prototype.W=function(t){return this.qt(),this.Wt.Nt=this.Wt.Nt&&t.I().drawTicks,this.Rt.Nt=this.Rt.Nt&&t.I().drawTicks,this.jt._(this.Wt,this.It),this.Ut._(this.Rt,this.It),this.jt},t.prototype.Xt=function(){return this.qt(),this.jt._(this.Wt,this.It),this.Ut._(this.Rt,this.It),this.Ut},t.prototype.qt=function(){this.B&&(this.Wt.Nt=!0,this.Rt.Nt=!1,this.Zt(this.Wt,this.Rt,this.It))},t}(),X=function(t){function i(i,n,e){var r=t.call(this)||this;return r.lt=i,r.Jt=n,r.Gt=e,r}return p(i,t),i.prototype.Zt=function(t,i,n){t.H=!1;var e=this.lt.I().horzLine;if(e.labelVisible){var r=this.Jt.Y();if(this.lt.H()&&!this.Jt.Qt()&&null!==r){var s=F(e.labelBackgroundColor);n.gt=s.gt,n.et=s.yt;var o=this.Gt(this.Jt);n.Pt=o.Pt,t.At=this.Jt.ti(o.F,r),t.H=!0}}},i}(Z),Q=/[1-9]/g,K=function(){function t(){this.tt=null}return t.prototype._=function(t){this.tt=t},t.prototype.h=function(t,i,n){var e=this;if(null!==this.tt&&!1!==this.tt.H&&0!==this.tt.At.length){t.font=i.xt;var r=Math.round(i.ii.Vt(t,this.tt.At,Q));if(!(r<=0)){t.save();var s=i.ni,o=r+2*s,h=o/2,u=this.tt.dt,a=this.tt.Pt,l=Math.floor(a-h)+.5;l<0?(a+=Math.abs(0-l),l=Math.floor(a-h)+.5):l+o>u&&(a-=Math.abs(u-(l+o)),l=Math.floor(a-h)+.5);var c=l+o,f=0+i.Dt+i.Tt+i.zt+i.Bt;t.fillStyle=this.tt.gt;var p=Math.round(l*n),v=Math.round(0*n),d=Math.round(c*n),y=Math.round(f*n);t.fillRect(p,v,d-p,y-v);var g=Math.round(this.tt.Pt*n),b=v,M=Math.round((b+i.Dt+i.Ct)*n);t.fillStyle=this.tt.et;var w=Math.max(1,Math.floor(n)),_=Math.floor(.5*n);t.fillRect(g-_,b,w,M-b);var S=f-i.Ot-i.Bt;t.textAlign="left",t.fillStyle=this.tt.et,H(t,n,(function(){t.fillText(m(e.tt).At,l+s,S)})),t.restore()}}},t}(),q=function(){function t(t,i,n){this.B=!0,this.ot=new K,this.at={H:!1,gt:"#4c525e",et:"white",At:"",dt:0,Pt:NaN},this.A=t,this.hi=i,this.Gt=n}return t.prototype.V=function(){this.B=!0},t.prototype.W=function(){return this.B&&(this.R(),this.B=!1),this.ot._(this.at),this.ot},t.prototype.R=function(){var t=this.at;t.H=!1;var i=this.A.I().vertLine;if(i.labelVisible){var n=this.hi.U();if(!n.Qt()){var e=n.si(this.A.j());t.dt=n.dt();var r=this.Gt();if(r.P){t.Pt=r.Pt,t.At=n.ri(m(e)),t.H=!0;var s=F(i.labelBackgroundColor);t.gt=s.gt,t.et=s.yt}}}},t}(),$=function(){function t(){this.ei=null,this.ui=0}return t.prototype.ai=function(){return this.ui},t.prototype.oi=function(t){this.ui=t},t.prototype.Z=function(){return this.ei},t.prototype.li=function(t){this.ei=t},t.prototype.fi=function(t,i){return[]},t.prototype.ci=function(t){return[]},t.prototype.vi=function(){return[]},t.prototype.H=function(){return!0},t}();!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet"}(j||(j={}));var G=function(t){function i(i,n){var e,r,s=t.call(this)||this;s._i=null,s.di=NaN,s.wi=0,s.Mi=!0,s.bi=new Map,s.mi=!1,s.gi=NaN,s.pi=NaN,s.yi=NaN,s.ki=NaN,s.hi=i,s.xi=n,s.Ni=new B(i,s),s.Si=(e=function(){return s.di},r=function(){return s.pi},function(t){var i=r(),n=e();if(t===m(s._i).Ci())return{F:n,Pt:i};var o=m(t.Y());return{F:t.Di(i,o),Pt:i}});var o=function(){return{P:s.hi.U().si(s.wi),Pt:s.Mt()}};return s.Ti=new q(s,i,o),s.Bi=new z(s),s}return p(i,t),i.prototype.I=function(){return this.xi},i.prototype.Ei=function(t,i){this.yi=t,this.ki=i},i.prototype.Li=function(){this.yi=NaN,this.ki=NaN},i.prototype.Ai=function(){return this.yi},i.prototype.Vi=function(){return this.ki},i.prototype.Oi=function(t,i,n){this.mi||(this.mi=!0),this.Mi=!0,this.zi(t,i,n)},i.prototype.j=function(){return this.wi},i.prototype.Mt=function(){return this.gi},i.prototype.bt=function(){return this.pi},i.prototype.H=function(){return this.Mi},i.prototype.Pi=function(){this.Mi=!1,this.Fi(),this.di=NaN,this.gi=NaN,this.pi=NaN,this._i=null,this.Li()},i.prototype.ci=function(t){return null!==this._i?[this.Bi,this.Ni]:[]},i.prototype.vt=function(t){return t===this._i&&this.xi.horzLine.visible},i.prototype._t=function(){return this.xi.vertLine.visible},i.prototype.fi=function(t,i){this.Mi&&this._i===t||this.bi.clear();var n=[];return this._i===t&&n.push(this.Ii(this.bi,i,this.Si)),n},i.prototype.vi=function(){return this.Mi?[this.Ti]:[]},i.prototype.ft=function(){return this._i},i.prototype.Wi=function(){this.Bi.V(),this.bi.forEach((function(t){return t.V()})),this.Ti.V(),this.Ni.V()},i.prototype.Ri=function(t){return t&&!t.Ci().Qt()?t.Ci():null},i.prototype.zi=function(t,i,n){this.ji(t,i,n)&&this.Wi()},i.prototype.ji=function(t,i,n){var e=this.gi,r=this.pi,s=this.di,o=this.wi,h=this._i,u=this.Ri(n);this.wi=t,this.gi=isNaN(t)?NaN:this.hi.U().G(t),this._i=n;var a=null!==u?u.Y():null;return null!==u&&null!==a?(this.di=i,this.pi=u.X(i,a)):(this.di=NaN,this.pi=NaN),e!==this.gi||r!==this.pi||o!==this.wi||s!==this.di||h!==this._i},i.prototype.Fi=function(){var t=this.hi.O().map((function(t){return t.qi().Ui()})).filter(T),i=0===t.length?null:Math.max.apply(Math,t);this.wi=null!==i?i:NaN},i.prototype.Ii=function(t,i,n){var e=t.get(i);return void 0===e&&(e=new X(this,i,n),t.set(i,e)),e},i}($);function tt(t,i){if(!w(t))return"n/a";if(!_(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");return 0===i?t.toString():("0000000000000000"+t.toString()).slice(-i)}var it=function(){function t(t,i){if(i||(i=1),w(t)&&_(t)||(t=100),t<0)throw new TypeError("invalid base");this.Jt=t,this.Hi=i,this.Yi()}return t.prototype.Ki=function(t){var i=t<0?"−":"";return t=Math.abs(t),i+this.$i(t)},t.prototype.Yi=function(){if(this.Xi=0,this.Jt>0&&this.Hi>0)for(var t=this.Jt;t>1;)t/=10,this.Xi++},t.prototype.$i=function(t){var i=this.Jt/this.Hi,n=Math.floor(t),e="",r=void 0!==this.Xi?this.Xi:NaN;if(i>1){var s=+(Math.round(t*i)-n*i).toFixed(this.Xi);s>=i&&(s-=i,n+=1),e="."+tt(+s.toFixed(this.Xi)*this.Hi,r)}else n=Math.round(n*i)/i,r>0&&(e="."+tt(0,r));return n.toFixed(0)+e},t}(),nt=function(t){function i(i){return void 0===i&&(i=100),t.call(this,i)||this}return p(i,t),i.prototype.Ki=function(i){return t.prototype.Ki.call(this,i)+"%"},i}(it),et=function(){function t(){this.Zi=[]}return t.prototype.Ji=function(t,i,n){var e={Gi:t,Qi:i,tn:!0===n};this.Zi.push(e)},t.prototype.nn=function(t){var i=this.Zi.findIndex((function(i){return t===i.Gi}));i>-1&&this.Zi.splice(i,1)},t.prototype.hn=function(t){this.Zi=this.Zi.filter((function(i){return i.Qi===t}))},t.prototype.sn=function(t,i){var n=d(this.Zi);this.Zi=this.Zi.filter((function(t){return!t.tn})),n.forEach((function(n){return n.Gi(t,i)}))},t.prototype.rn=function(){return this.Zi.length>0},t.prototype.en=function(){this.Zi=[]},t}(),rt=function(){function t(t,i){this.un=t,this.an=i}return t.prototype.on=function(t){return null!==t&&this.un===t.un&&this.an===t.an},t.prototype.ln=function(){return new t(this.un,this.an)},t.prototype.fn=function(){return this.un},t.prototype.cn=function(){return this.an},t.prototype.vn=function(){return this.an-this.un},t.prototype.Qt=function(){return this.an===this.un||Number.isNaN(this.an)||Number.isNaN(this.un)},t.prototype._n=function(i){return null===i?this:new t(Math.min(this.fn(),i.fn()),Math.max(this.cn(),i.cn()))},t.prototype.dn=function(t){if(w(t)&&0!=this.an-this.un){var i=.5*(this.an+this.un),n=this.an-i,e=this.un-i;n*=t,e*=t,this.an=i+n,this.un=i+e}},t.prototype.wn=function(t){w(t)&&(this.an+=t,this.un+=t)},t.prototype.Mn=function(){return{minValue:this.un,maxValue:this.an}},t.bn=function(i){return null===i?null:new t(i.minValue,i.maxValue)},t}();function st(t,i,n){return Math.min(Math.max(t,i),n)}function ot(t,i,n){return i-t<=n}function ht(t){return t<=0?NaN:Math.log(t)/Math.log(10)}function ut(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 lt(t,i){var n=100*(t-i)/i;return i<0?-n:n}function ct(t,i){var n=lt(t.fn(),i),e=lt(t.cn(),i);return new rt(n,e)}function ft(t,i){var n=100*(t-i)/i+100;return i<0?-n:n}function pt(t,i){var n=ft(t.fn(),i),e=ft(t.cn(),i);return new rt(n,e)}function vt(t){var i=Math.abs(t);if(i<1e-8)return 0;var n=ht(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 yt(t){if(null===t)return null;var i=vt(t.fn()),n=vt(t.cn());return new rt(i,n)}var gt,mt=function(){function t(t,i){if(this.mn=t,this.gn=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.mn))this.pn=[2,2.5,2];else{this.pn=[];for(var n=this.mn;1!==n;){if(n%2==0)this.pn.push(2),n/=2;else{if(n%5!=0)throw new Error("unexpected base");this.pn.push(2,2.5),n/=5}if(this.pn.length>100)throw new Error("something wrong with base")}}}return t.prototype.yn=function(t,i,n){for(var e,r=0===this.mn?0:1/this.mn,s=1e-9,o=Math.pow(10,Math.max(0,Math.ceil(ht(t-i)))),h=0,u=this.gn[0];;){var a=ot(o,r,s)&&o>r+s,l=ot(o,n*u,s),c=ot(o,1,s);if(!(a&&l&&c))break;o/=u,u=this.gn[++h%this.gn.length]}if(o<=r+s&&(o=r),o=Math.max(1,o),this.pn.length>0&&(e=o,1,s,Math.abs(e-1)<1e-9))for(h=0,u=this.pn[0];ot(o,n*u,s)&&o>r+s;)o/=u,u=this.pn[++h%this.pn.length];return o},t}(),bt=function(){function t(t,i,n,e){this.kn=[],this.Jt=t,this.mn=i,this.xn=n,this.Nn=e}return t.prototype.yn=function(t,i){if(t=a?1:-1,p=null,v=0,d=u-(c+=c<0?l:0);d>a;d-=l){var y=this.Nn(d,i,!0);null!==p&&Math.abs(y-p)h||(v1)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.ah(),this.Kn=null}},t.prototype.oh=function(){return this.xi.autoScale},t.prototype.Ln=function(){return 1===this.xi.mode},t.prototype.lh=function(){return 2===this.xi.mode},t.prototype.fh=function(){return 3===this.xi.mode},t.prototype.uh=function(){return{_h:this.xi.autoScale,dh:this.xi.invertScale,uh:this.xi.mode}},t.prototype.eh=function(t){var i=this.uh(),n=null;void 0!==t._h&&(this.xi.autoScale=t._h),void 0!==t.uh&&(this.xi.mode=t.uh,2!==t.uh&&3!==t.uh||(this.xi.autoScale=!0),this.Fn.In=!1),1===i.uh&&t.uh!==i.uh&&(function(t){if(null===t)return!1;var i=dt(t.fn()),n=dt(t.cn());return isFinite(i)&&isFinite(n)}(this.zn)?null!==(n=function(t){if(null===t)return null;var i=dt(t.fn()),n=dt(t.cn());return new rt(i,n)}(this.zn))&&this.wh(n):this.xi.autoScale=!0),1===t.uh&&t.uh!==i.uh&&null!==(n=yt(this.zn))&&this.wh(n);var e=i.uh!==this.xi.mode;e&&(2===i.uh||this.lh())&&this.rh(),e&&(3===i.uh||this.fh())&&this.rh(),void 0!==t.dh&&i.dh!==t.dh&&(this.xi.invertScale=t.dh,this.Mh()),this.qn.sn(i,this.uh())},t.prototype.bh=function(){return this.qn},t.prototype.zt=function(){return this.Gn.fontSize},t.prototype.wt=function(){return this.Vn},t.prototype.mh=function(t){this.Vn!==t&&(this.Vn=t,this.ah(),this.Kn=null)},t.prototype.gh=function(){if(this.On)return this.On;var t=this.wt()-this.ph()-this.yh();return this.On=t,t},t.prototype.kh=function(){return this.xh(),this.zn},t.prototype.wh=function(t,i){var n=this.zn;(i||null===n&&null!==t||null!==n&&!n.on(t))&&(this.Kn=null,this.zn=t)},t.prototype.Qt=function(){return this.xh(),0===this.Vn||!this.zn||this.zn.Qt()},t.prototype.Nh=function(t){return this.dh()?t:this.wt()-1-t},t.prototype.X=function(t,i){return this.lh()?t=lt(t,i):this.fh()&&(t=ft(t,i)),this.nh(t,i)},t.prototype.Sh=function(t,i,n){this.xh();for(var e=this.yh(),r=m(this.kh()),s=r.fn(),o=r.cn(),h=this.gh()-1,u=this.dh(),a=h/(o-s),l=void 0===n?0:n.from,c=void 0===n?t.length:n.to,f=this.Ch(),p=l;p= left"),this.Bs=t,this.Es=i}return t.prototype.ss=function(){return this.Bs},t.prototype.rs=function(){return this.Es},t.prototype.Ls=function(){return this.Es-this.Bs+1},t.prototype.As=function(t){return this.Bs<=t&&t<=this.Es},t.prototype.on=function(t){return this.Bs===t.ss()&&this.Es===t.rs()},t}();function It(t,i){return null===t||null===i?t===i:t.on(i)}var zt,Vt=function(){function t(){this.Vs=new Map,this.ys=null}return t.prototype.Os=function(t){var i=this;this.ys=null,this.Vs.clear(),t.forEach((function(t,n){var e=i.Vs.get(t.zs);void 0===e&&(e=[],i.Vs.set(t.zs,e)),e.push({Ps:n,P:t.P,Fs:t.zs})}))},t.prototype.Is=function(t,i){var n=Math.ceil(i/t);return null!==this.ys&&this.ys.Ws===n||(this.ys={An:this.Rs(n),Ws:n}),this.ys.An},t.prototype.Rs=function(t){for(var i=[],n=0,e=Array.from(this.Vs.keys()).sort((function(t,i){return i-t}));n=t&&v-c>=t&&(i.push(p),c=v)}for(;hthis.$s[this.$s.length-1].P.Cs)return i?this.$s.length-1:null;for(var n=0;n=1,u=h?t:e+(t-e)*o;n._r(u),h||setTimeout(s,20)};s()},t.prototype.V=function(t){this.Gs=!0,this.$s=t,this.Xs.Os(t),this.Tr()},t.prototype.Yr=function(){return this.Qs},t.prototype.Kr=function(){return this.tr},t.prototype.$r=function(){return this.ir},t.prototype.Br=function(){return this.Ks||0},t.prototype.Xr=function(t){var i=t.Ls();this.Cr(this.Ys/i),this.rr=t.rs()-this.Br(),this.Tr(),this.Gs=!0,this.hi.Vr(),this.hi.Or()},t.prototype.Zr=function(){var t=this.pr(),i=this.yr();null!==t&&null!==i&&this.Xr(new Bt(t,i+this.xi.rightOffset))},t.prototype.Jr=function(t){var i=new Bt(t.from,t.to);this.Xr(i)},t.prototype.ri=function(t){return void 0!==this.Qn.timeFormatter?this.Qn.timeFormatter(t.Ss||t.Cs):this.Gr.Ki(new Date(1e3*t.Cs))},t.prototype.pr=function(){return 0===this.$s.length?null:0},t.prototype.yr=function(){return 0===this.$s.length?null:this.$s.length-1},t.prototype.Qr=function(t){return(this.Ys+1-t)/this.er},t.prototype.Ar=function(t){var i=this.Qr(t),n=this.Br()+this.rr-i;return Math.round(1e6*n)/1e6},t.prototype.Cr=function(t){var i=this.er;this.er=t,this.Dr(),i!==this.er&&(this.Gs=!0,this.te())},t.prototype.Mr=function(){if(this.Gs)if(this.Gs=!1,this.Qt())this.ie(Rt.Hs());else{var t=this.Br(),i=this.Ys/this.er,n=this.rr+t,e=new Bt(n-i+1,n);this.ie(new Rt(e))}},t.prototype.Dr=function(){if(this.er<.5&&(this.er=.5,this.Gs=!0),0!==this.Ys){var t=.5*this.Ys;this.er>t&&(this.er=t,this.Gs=!0)}},t.prototype.Tr=function(){var t=this.ne();this.rr>t&&(this.rr=t,this.Gs=!0);var i=this.he();null!==i&&this.rr=1e-15&&t<1?t.toFixed(this.xe).replace(/\.?0+$/,""):String(t)).replace(/(\.[1-9]*)0+$/,(function(t,i){return i}))},t}();function Yt(t,i,n,e){if(0!==i.length){var r=i[e.from].g,s=i[e.from].p;t.moveTo(r,s);for(var o=e.from+1;othis.v.M.from&&(t.lineTo(this.v.m[this.v.M.to-1].g,this.v.Ce),t.lineTo(this.v.m[this.v.M.from].g,this.v.Ce));t.closePath();var e=t.createLinearGradient(0,0,0,this.v.Ce);e.addColorStop(0,this.v.Te),e.addColorStop(1,this.v.Be),t.fillStyle=e,t.fill()}},i}(O),Xt=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.v=null,i}return p(i,t),i.prototype._=function(t){this.v=t},i.prototype.u=function(t){if(null!==this.v&&0!==this.v.m.length&&null!==this.v.M){if(t.lineCap="butt",t.lineWidth=this.v.rt,l(t,this.v.ut),t.strokeStyle=this.v.S,t.lineJoin="miter",t.beginPath(),1===this.v.m.length){var i=this.v.m[0];t.moveTo(i.g-this.v.Se/2,i.p),t.lineTo(i.g+this.v.Se/2,i.p)}else Yt(t,this.v.m,this.v.De,this.v.M);t.stroke()}},i}(O);function Qt(t,i,n,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length);for(var s=r-e;0>1,h=e+o;n(t[h],i)?(e=h+1,s-=o+1):s=o}return e}function Kt(t,i,n,e,r){void 0===e&&(e=0),void 0===r&&(r=t.length);for(var s=r-e;0>1,h=e+o;n(i,t[h])?s=o:(e=h+1,s-=o+1)}return e}function qt(t,i){return t.P0&&s=e&&(h=s-1),o>0&&o=2&&Math.max(1,Math.floor(i))%2!=this.Ze%2&&this.Ze--,this.Je=this.tt.Qe?Math.min(this.Ze,Math.floor(i)):this.Ze;for(var r=null,s=this.Je<=this.Ze&&this.tt.zr>=Math.floor(1.5*i),o=this.tt.M.from;od+g-1&&(M=(w=d+g-1)-c+1),t.fillRect(b,M,l-b,w-M+1)}var _=a+m,S=Math.max(d,Math.round(h.Lh*i)-u),x=S+c-1;x>d+g-1&&(S=(x=d+g-1)-c+1),t.fillRect(f+1,S,_-f,x-S+1)}}}},t.prototype.Ge=function(t){var i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(m(this.tt).zr,t)))},t}(),ri=function(t){function i(i,n){return t.call(this,i,n,!1)||this}return p(i,t),i.prototype.Ue=function(t,i,n){i.Er(this.Ae,P(this.Ve)),t.Dh(this.Ae,n,P(this.Ve))},i.prototype.iu=function(t,i,n){return{P:t,open:i.J[0],high:i.J[1],low:i.J[2],close:i.J[3],g:NaN,Th:NaN,Bh:NaN,Eh:NaN,Lh:NaN}},i.prototype.Ie=function(){var t=this,i=this.Oe.He();this.Ae=this.Oe.qi().Ye().map((function(n){return t.Ke(n.Ps,n,i)}))},i}(ti),si=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.ot=new ei,i}return p(i,t),i.prototype.W=function(t,i){if(!this.Oe.H())return null;var n=this.Oe.I();this.Fe();var e={qi:this.Ae,zr:this.ze.U().zr(),tu:n.openVisible,Qe:n.thinBars,M:this.Ve};return this.ot._(e),this.ot},i.prototype.Ke=function(t,i,n){return v(v({},this.iu(t,i,n)),{et:n.hu(t).nu})},i}(ri),oi=function(){function t(){this.tt=null,this.Ze=0}return t.prototype._=function(t){this.tt=t},t.prototype.h=function(t,i,n,e){if(null!==this.tt&&0!==this.tt.qi.length&&null!==this.tt.M){this.Ze=function(t,i){if(t>=2.5&&t<=4)return Math.floor(3*i);var n=1-.2*Math.atan(Math.max(4,t)-4)/(.5*Math.PI),e=Math.floor(t*n*i),r=Math.floor(t*i),s=Math.min(e,r);return Math.max(Math.floor(i),s)}(this.tt.zr,i),this.Ze>=2&&Math.floor(i)%2!=this.Ze%2&&this.Ze--;var r=this.tt.qi;this.tt.su&&this.ru(t,r,this.tt.M,i),this.tt.eu&&this.uu(t,r,this.tt.M,this.tt.zr,i);var s=this.au(i);(!this.tt.eu||this.Ze>2*s)&&this.ou(t,r,this.tt.M,i)}},t.prototype.ru=function(t,i,n,e){if(null!==this.tt){var r="",s=Math.min(Math.floor(e),Math.floor(this.tt.zr*e));s=Math.max(Math.floor(e),Math.min(s,this.Ze));for(var o=Math.floor(.5*s),h=null,u=n.from;u2*o)U(t,l,f,c-l+1,p-f+1,o);else{var v=c-l+1;t.fillRect(l,f,v,p-f+1)}h=c}},t.prototype.ou=function(t,i,n,e){if(null!==this.tt)for(var r="",s=this.au(e),o=n.from;oa||t.fillRect(l,u,c-l+1,a-u+1)}},t}(),hi=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.ot=new oi,i}return p(i,t),i.prototype.W=function(t,i){if(!this.Oe.H())return null;var n=this.Oe.I();this.Fe();var e={qi:this.Ae,zr:this.ze.U().zr(),su:n.wickVisible,eu:n.borderVisible,M:this.Ve};return this.ot._(e),this.ot},i.prototype.Ke=function(t,i,n){var e=n.hu(t);return v(v({},this.iu(t,i,n)),{et:e.nu,lu:e.fu,$:e.cu})},i}(ri),ui=function(){function t(){this.tt=null,this.vu=[]}return t.prototype._=function(t){this.tt=t,this.vu=[]},t.prototype.h=function(t,i,n,e){if(null!==this.tt&&0!==this.tt.m.length&&null!==this.tt.M){this.vu.length||this._u(i);for(var r=Math.max(1,Math.floor(i)),s=Math.round(this.tt.du*i)-Math.floor(r/2),o=s+r,h=this.tt.M.from;hl.Mu?l.rs=a.ss-i-1:a.ss=l.rs+i+1)}var c=Math.ceil(this.tt.zr*t);for(e=this.tt.M.from;e0&&c<4)for(e=this.tt.M.from;ec&&(a.wu>a.Mu?a.rs-=1:a.ss+=1)}else this.vu=[]},t}();function ai(t){return{m:[],zr:t,du:NaN,M:null}}function li(t,i,n){return{P:t,F:i,g:NaN,p:NaN,et:n}}var ci=function(t){function i(i,n){var e=t.call(this,i,n,!1)||this;return e.C=new k,e.bu=ai(0),e.ot=new ui,e}return p(i,t),i.prototype.W=function(t,i){return this.Oe.H()?(this.Fe(),this.C):null},i.prototype.Ie=function(){var t=this.ze.U().zr();this.bu=ai(t);for(var i=0,n=0,e=this.Oe.I().color,r=0,s=this.Oe.qi().Ye();rMath.ceil(this.tt.wt*i))){var s=Math.ceil(this.tt.dt*i);t.lineCap="butt",t.strokeStyle=this.tt.et,t.lineWidth=Math.floor(this.tt.rt*i),l(t,this.tt.ut),c(t,r,0,s)}}},t}(),mi=function(){function t(t){this.Lu={dt:0,wt:0,p:0,et:"rgba(0, 0, 0, 0)",rt:1,ut:0,H:!1},this.Au=new gi,this.B=!0,this.Oe=t,this.ze=t.ct(),this.Au._(this.Lu)}return t.prototype.V=function(){this.B=!0},t.prototype.W=function(t,i){return this.Oe.H()?(this.B&&(this.Vu(t,i),this.B=!1),this.Au):null},t}(),bi=function(t){function i(i){return t.call(this,i)||this}return p(i,t),i.prototype.Vu=function(t,i){this.Lu.H=!1;var n=this.Oe.Z(),e=n.uh().uh;if(2===e||3===e){var r=this.Oe.I();if(r.baseLineVisible&&this.Oe.H()){var s=this.Oe.Y();null!==s&&(this.Lu.H=!0,this.Lu.p=n.X(s.J,s.J),this.Lu.dt=i,this.Lu.wt=t,this.Lu.et=r.baseLineColor,this.Lu.rt=r.baseLineWidth,this.Lu.ut=r.baseLineStyle)}}},i}(mi);function Mi(t,i){return at(Math.min(Math.max(t,12),30)*i)}function wi(t,i){switch(t){case"arrowDown":case"arrowUp":return Mi(i,1);case"circle":return Mi(i,.8);case"square":return Mi(i,.7)}}function _i(t){return ut(Mi(t,1))}function Si(t){return Math.max(Mi(t,.1),3)}function xi(t,i,n,e,r){var s=wi("square",n),o=(s-1)/2,h=t-o,u=i-o;return e>=h&&e<=h+s&&r>=u&&r<=u+s}function Ci(t,i,n,e,r){var s=(wi("arrowUp",r)-1)/2,o=(at(r/2)-1)/2;i.beginPath(),t?(i.moveTo(n-s,e),i.lineTo(n,e-s),i.lineTo(n+s,e),i.lineTo(n+o,e),i.lineTo(n+o,e+s),i.lineTo(n-o,e+s),i.lineTo(n-o,e)):(i.moveTo(n-s,e),i.lineTo(n,e+s),i.lineTo(n+s,e),i.lineTo(n+o,e),i.lineTo(n+o,e-s),i.lineTo(n-o,e-s),i.lineTo(n-o,e)),i.fill()}var Ti=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.tt=null,i.xu=new vi,i.ue=-1,i.ae="",i.Ou="",i}return p(i,t),i.prototype._=function(t){this.tt=t},i.prototype.Nu=function(t,i){this.ue===t&&this.ae===i||(this.ue=t,this.ae=i,this.Ou=Ft(t,i),this.xu.pu())},i.prototype.zu=function(t,i){if(null===this.tt||null===this.tt.M)return null;for(var n=this.tt.M.from;n=t&&r<=t+n&&s>=i-o&&s<=i+o}(t.g,t.At.p,t.At.dt,t.At.wt,i,n))||function(t,i,n){if(0===t.je)return!1;switch(t.Ru){case"arrowDown":case"arrowUp":return function(t,i,n,e,r,s){return xi(i,n,e,r,s)}(0,t.g,t.p,t.je,i,n);case"circle":return function(t,i,n,e,r){var s=2+wi("circle",n)/2,o=t-e,h=i-r;return Math.sqrt(o*o+h*h)<=s}(t.g,t.p,t.je,i,n);case"square":return xi(t.g,t.p,t.je,i,n)}t.Ru}(t,i,n)}function Oi(t,i,n,e,r,s,o,h,u){var a=w(n)?n:n.close,l=w(n)?n:n.high,c=w(n)?n:n.low,f=w(i.size)?Math.max(i.size,0):1,p=_i(h.zr())*f,v=p/2;switch(t.je=p,i.position){case"inBar":return t.p=o.X(a,u),void(void 0!==t.At&&(t.At.p=t.p+v+s+.6*r));case"aboveBar":return t.p=o.X(l,u)-v-e.ju,void 0!==t.At&&(t.At.p=t.p-v-.6*r,e.ju+=1.2*r),void(e.ju+=p+s);case"belowBar":return t.p=o.X(c,u)+v+e.Uu,void 0!==t.At&&(t.At.p=t.p+v+s+.6*r,e.Uu+=1.2*r),void(e.Uu+=p+s)}i.position}var Ei=function(){function t(t,i){this.B=!0,this.qu=!0,this.Hu=!0,this.Yu=null,this.ot=new Ti,this.Ku=t,this.hi=i,this.tt={m:[],M:null}}return t.prototype.V=function(t){this.B=!0,this.Hu=!0,"data"===t&&(this.qu=!0)},t.prototype.W=function(t,i,n){if(!this.Ku.H())return null;this.B&&this.Fe();var e=this.hi.I().layout;return this.ot.Nu(e.fontSize,e.fontFamily),this.ot._(this.tt),this.ot},t.prototype.$u=function(){if(this.Hu){if(this.Ku.Xu().length>0){var t=this.hi.U().zr(),i=Si(t),n=1.5*_i(t)+2*i;this.Yu={above:n,below:n}}else this.Yu=null;this.Hu=!1}return this.Yu},t.prototype.Fe=function(){var t=this.Ku.Z(),i=this.hi.U(),n=this.Ku.Xu();this.qu&&(this.tt.m=n.map((function(t){return{P:t.time,g:0,p:0,je:0,Ru:t.shape,et:t.color,Fu:t.Fu,Iu:t.id,At:void 0}})),this.qu=!1);var e=this.hi.I().layout;this.tt.M=null;var r=i.wr();if(null!==r){var s=this.Ku.Y();if(null!==s&&0!==this.tt.m.length){var o=NaN,h=Si(i.zr()),u={ju:h,Uu:h};this.tt.M=Gt(this.tt.m,r,!0);for(var a=this.tt.M.from;a0&&(c.At={Wu:l.text,p:0,dt:0,wt:0});var f=this.Ku.Zu(l.time);null!==f&&Oi(c,l,f,u,e.fontSize,h,t,i,s.J)}this.B=!1}}},t}(),Li=function(t){function i(i){return t.call(this,i)||this}return p(i,t),i.prototype.Vu=function(t,i){var n=this.Lu;n.H=!1;var e=this.Oe.I();if(e.priceLineVisible&&this.Oe.H()){var r=this.Oe.Ju(0===e.priceLineSource);r.Gu||(n.H=!0,n.p=r.Pt,n.et=this.Oe.Qu(r.et),n.dt=i,n.wt=t,n.rt=e.priceLineWidth,n.ut=e.priceLineStyle)}},i}(mi),Bi=function(t){function i(i){var n=t.call(this)||this;return n.lt=i,n}return p(i,t),i.prototype.Zt=function(t,i,n){if(t.H=!1,i.H=!1,this.lt.H()){var e=this.lt.I(),r=e.lastValueVisible,s=""!==this.lt.ta(),o=0===e.seriesLastValueMode,h=this.lt.Ju(!1);if(!h.Gu){r&&(t.At=this.ia(h,r,o),t.H=0!==t.At.length),(s||o)&&(i.At=this.na(h,r,s,o),i.H=i.At.length>0);var u=this.lt.Qu(h.et),a=F(u);n.gt=a.gt,n.et=a.yt,n.Pt=h.Pt,i.$=this.lt.ct().I().layout.backgroundColor,t.$=u}}},i.prototype.na=function(t,i,n,e){var r="",s=this.lt.ta();return n&&0!==s.length&&(r+=s+" "),i&&e&&(r+=this.lt.Z().lh()?t.ha:t.sa),r.trim()},i.prototype.ia=function(t,i,n){return i?n?this.lt.Z().lh()?t.sa:t.ha:t.At:""},i}(Z),Ii=function(){function t(t,i){this.zn=t,this.ra=i||null}return t.prototype.kh=function(){return this.zn},t.prototype.es=function(){return this.ra},t.prototype.Mn=function(){return null===this.zn?null:{priceRange:this.zn.Mn(),margins:this.ra||void 0}},t.bn=function(i){return null===i?null:new t(rt.bn(i.priceRange),i.margins)},t}(),zi=function(t){function i(i,n){var e=t.call(this,i)||this;return e.ea=n,e}return p(i,t),i.prototype.Vu=function(t,i){var n=this.Lu;if(n.H=!1,this.Oe.H()){var e=this.ea.ua();if(null!==e){var r=this.ea.I();n.H=!0,n.p=e,n.et=r.color,n.dt=i,n.wt=t,n.rt=r.lineWidth,n.ut=r.lineStyle}}},i}(mi),Vi=function(t){function i(i,n){var e=t.call(this)||this;return e.Ku=i,e.ea=n,e}return p(i,t),i.prototype.Zt=function(t,i,n){t.H=!1,i.H=!1;var e=this.ea.I(),r=e.axisLabelVisible,s=""!==e.title;if(r&&this.Ku.H()){var o=this.ea.ua();if(null!==o){s&&(i.At=e.title,i.H=!0),i.$=this.Ku.ct().I().layout.backgroundColor,t.At=this.Ku.Z().Xh(e.price),t.H=!0;var h=F(e.color);n.gt=h.gt,n.et=h.yt,n.Pt=o}}},i}(Z),Ri=function(){function t(t,i){this.Ku=t,this.xi=i,this.aa=new zi(t,this),this.Su=new Vi(t,this),this.oa=new yi(this.Su,t,t.ct())}return t.prototype.sh=function(t){M(this.xi,t),this.V(),this.Ku.ct().Or()},t.prototype.I=function(){return this.xi},t.prototype.ci=function(){return[this.aa,this.oa]},t.prototype.la=function(){return this.Su},t.prototype.V=function(){this.aa.V(),this.Su.V()},t.prototype.ua=function(){var t=this.Ku,i=t.Z();if(t.ct().U().Qt()||i.Qt())return null;var n=t.Y();return null===n?null:i.X(this.xi.price,n.J)},t}(),Ai=function(t){function i(i){var n=t.call(this)||this;return n.hi=i,n}return p(i,t),i.prototype.ct=function(){return this.hi},i}($),Di={nu:"",cu:"",fu:""},Ji=function(){function t(t){this.Ku=t}return t.prototype.hu=function(t,i){var n=this.Ku.fa(),e=this.Ku.I();switch(n){case"Line":return this.ca(e);case"Area":return this.va(e);case"Bar":return this._a(e,t,i);case"Candlestick":return this.da(e,t,i);case"Histogram":return this.wa(e,t,i)}throw new Error("Unknown chart style")},t.prototype._a=function(t,i,n){var e=v({},Di),r=t.upColor,s=t.downColor,o=r,h=s,u=m(this.Ma(i,n)),a=b(u.J[0])<=b(u.J[3]);return e.nu=a?r:s,e.cu=a?o:h,e},t.prototype.da=function(t,i,n){var e=v({},Di),r=t.upColor,s=t.downColor,o=t.borderUpColor,h=t.borderDownColor,u=t.wickUpColor,a=t.wickDownColor,l=m(this.Ma(i,n)),c=b(l.J[0])<=b(l.J[3]);return e.nu=c?r:s,e.cu=c?o:h,e.fu=c?u:a,e},t.prototype.va=function(t){return v(v({},Di),{nu:t.lineColor})},t.prototype.ca=function(t){return v(v({},Di),{nu:t.color})},t.prototype.wa=function(t,i,n){var e=v({},Di),r=m(this.Ma(i,n));return e.nu=void 0!==r.et?r.et:t.color,e},t.prototype.Ma=function(t,i){return void 0!==i?i.J:this.Ku.qi().ba(t)},t}(),Ni=function(){function t(){this.ma=[],this.ga=new Map,this.pa=new Map}return t.prototype.ya=function(){this.ma=[],this.ga.clear(),this.pa.clear()},t.prototype.ka=function(){return this.je()>0?this.ma[this.ma.length-1]:null},t.prototype.xa=function(){return this.je()>0?this.Na(0):null},t.prototype.Ui=function(){return this.je()>0?this.Na(this.ma.length-1):null},t.prototype.je=function(){return this.ma.length},t.prototype.Qt=function(){return 0===this.je()},t.prototype.As=function(t){return null!==this.Sa(t,0)},t.prototype.ba=function(t){return this.Ca(t)},t.prototype.Ca=function(t,i){void 0===i&&(i=0);var n=this.Sa(t,i);return null===n?null:v(v({},this.Da(n)),{Ps:this.Na(n)})},t.prototype.Ye=function(){return this.ma},t.prototype.Ta=function(t,i,n){if(this.Qt())return null;for(var e=null,r=0,s=n;rthis.ma[this.ma.length-1].Ps?this.La(t):1!==t.length||t[0].Ps!==this.ma[this.ma.length-1].Ps?this.Aa(t):this.Va(t[0]))},t.prototype.Na=function(t){return this.ma[t].Ps},t.prototype.Da=function(t){return this.ma[t]},t.prototype.Sa=function(t,i){var n=this.Oa(t);if(null===n&&0!==i)switch(i){case-1:return this.za(t);case 1:return this.Pa(t);default:throw new TypeError("Unknown search mode")}return n},t.prototype.za=function(t){var i=this.Fa(t);return i>0&&(i-=1),i!==this.ma.length&&this.Na(i)t}))},t.prototype.Wa=function(t,i,n){for(var e=null,r=t;re.ja&&(e.ja=s)))}return e},t.prototype.Ua=function(t){var i=Math.floor(t.Ps/30);this.ga.forEach((function(t){return t.delete(i)}))},t.prototype.Ea=function(t){y(0!==t.length,"plotRows should not be empty"),this.pa.clear(),this.ga.clear(),this.ma=t.concat(this.ma)},t.prototype.La=function(t){y(0!==t.length,"plotRows should not be empty"),this.pa.clear(),this.ga.clear(),this.ma=this.ma.concat(t)},t.prototype.Va=function(t){y(!this.Qt(),"plot list should not be empty"),y(this.ma[this.ma.length-1].Ps===t.Ps,"last row index should match new row index"),this.Ua(t),this.pa.delete(t.Ps),this.ma[this.ma.length-1]=t},t.prototype.Aa=function(t){y(0!==t.length,"plot rows should not be empty"),this.pa.clear(),this.ga.clear(),this.ma=function(t,i){for(var n=function(t,i){for(var n=t.length,e=i.length,r=n+e,s=0,o=0;si[o].Ps?o++:(s++,o++,r--);return r}(t,i),e=new Array(n),r=0,s=0,o=t.length,h=i.length,u=0;ri[s].Ps?(e[u]=i[s],s++):(e[u]=i[s],r++,s++),u++;for(;r=0&&s.Fh(t),null!==s&&(s.Ph(),this.qo(s)),this.Yn=null},t.prototype.Bu=function(t){return t===this.Eo?"left":t===this.Ao?"right":"overlay"},t.prototype.Ho=function(){return this.Eo},t.prototype.Yo=function(){return this.Ao},t.prototype.Ko=function(t,i){t.Rh(i)},t.prototype.$o=function(t,i){t.jh(i),this.Wo()},t.prototype.Xo=function(t){t.Uh()},t.prototype.Zo=function(t,i){t.qh(i)},t.prototype.Jo=function(t,i){t.Hh(i),this.Wo()},t.prototype.Go=function(t){t.Yh()},t.prototype.Wo=function(){this.Hn.forEach((function(t){t.Wi()}))},t.prototype.Ci=function(){var t=null;return this.hi.I().rightPriceScale.visible&&0!==this.Ao.Vh().length?t=this.Ao:this.hi.I().leftPriceScale.visible&&0!==this.Eo.Vh().length?t=this.Eo:0!==this.Hn.length&&(t=this.Hn[0].Z()),null===t&&(t=this.Ao),t},t.prototype.qo=function(t){null!==t&&t.oh()&&this.Qo(t)},t.prototype.tl=function(t){var i=this.To.wr();t.eh({_h:!0}),null!==i&&t.Qh(i),this.Wo()},t.prototype.il=function(){this.Qo(this.Eo),this.Qo(this.Ao)},t.prototype.nl=function(){var t=this;this.qo(this.Eo),this.qo(this.Ao),this.Hn.forEach((function(i){t.Tu(i)&&t.qo(i.Z())})),this.Wo(),this.hi.Or()},t.prototype.Oh=function(){return null===this.Yn&&(this.Yn=Mt(this.Hn)),this.Yn},t.prototype.hl=function(){return this.Do},t.prototype.sl=function(){return this.Bo},t.prototype.Qo=function(t){var i=t.Gh();if(i&&i.length>0&&!this.To.Qt()){var n=this.To.wr();null!==n&&t.Qh(n)}t.Wi()},t.prototype.jo=function(){var t=this.Oh();if(0===t.length)return{Ro:0,rl:0};for(var i=0,n=0,e=0;en&&(n=r))}return{Ro:i,rl:n}},t.prototype.Uo=function(t,i,n){var e=this.zo(i);if(null===e&&(e=this.Lo(i,this.hi.I().overlayPriceScales)),this.Hn.push(t),!Ht(i)){var r=this.So.get(i)||[];r.push(t),this.So.set(i,r)}e.zh(t),t.li(e),t.oi(n),this.qo(e),this.Yn=null},t.prototype.Vo=function(t,i,n){i.uh!==n.uh&&this.Qo(t)},t.prototype.Lo=function(t,i){var n=v({visible:!0,autoScale:!0},C(i)),e=new xt(t,n,this.hi.I().layout,this.hi.I().localization);return e.mh(this.wt()),e},t}(),Xi=function(t){function i(i){var n=t.call(this)||this;return n.el=new Map,n.tt=i,n}return p(i,t),i.prototype.u=function(t){},i.prototype.l=function(t){if(this.tt.H){t.save();for(var i=0,n=0,e=this.tt.ul;nthis.tt.dt?u.Rr=this.tt.dt/r:u.Rr=1,i+=u.ol*u.Rr}var s=0;switch(this.tt.ll){case"top":s=0;break;case"center":s=Math.max((this.tt.wt-i)/2,0);break;case"bottom":s=Math.max(this.tt.wt-i,0)}t.fillStyle=this.tt.et;for(var o=0,h=this.tt.ul;o20&&(this.wl=null,i=!0),this.To.Hh(t),this.Vr(),i},t.prototype.ql=function(){this.To.Yh(),this.Or(),this.wl=null},t.prototype.O=function(){return this.dl},t.prototype.Kl=function(t,i,n){this.A.Ei(t,i);var e=NaN,r=this.To.Lr(t),s=this.To.wr();null!==s&&(r=Math.min(Math.max(s.ss(),r),s.rs()));var o=n.Ci(),h=o.Y();null!==h&&(e=o.Di(i,h)),e=this.yl.do(e,r,n),this.A.Oi(r,e,n),this.$l(),this.ml.sn(this.A.j(),{x:t,y:i})},t.prototype.Xl=function(){this.Ol().Pi(),this.$l(),this.ml.sn(null,null)},t.prototype.io=function(){var t=this.A.ft();if(null!==t){var i=this.A.Ai(),n=this.A.Vi();this.Kl(i,n,t)}this.A.Wi()},t.prototype.Zl=function(t,i){var n=this.To.si(0);void 0!==i&&this.To.V(i);var e=this.To.si(0),r=this.To.Br(),s=this.To.wr();if(null!==s&&null!==n&&null!==e){var o=s.As(r),h=n.Cs>e.Cs,u=t>r&&!h,a=o&&this.To.I().shiftVisibleRangeOnNewBar;if(u&&!a){var l=t-r;this.To._r(this.To.Pr()-l)}}this.To.Wr(t)},t.prototype.ro=function(t){null!==t&&t.nl()},t.prototype.Du=function(t){var i=this._l.find((function(i){return i.Oh().includes(t)}));return void 0===i?null:i},t.prototype.Vr=function(){this.kl.Wi(),this._l.forEach((function(t){return t.nl()})),this.io()},t.prototype.en=function(){this._l.forEach((function(t){return t.en()})),this._l.length=0,this.xi.localization.priceFormatter=void 0,this.xi.localization.timeFormatter=void 0},t.prototype.Jl=function(){return this.pl},t.prototype.Eu=function(){return this.pl.I()},t.prototype.Po=function(){return this.bl},t.prototype.Gl=function(t,i){var n=this._l[0],e=this.Ql(i,t,n);return this.dl.push(e),1===this.dl.length?this.Nl():this.Or(),e},t.prototype.tf=function(t){var i=this.Du(t),n=this.dl.indexOf(t);y(-1!==n,"Series not found"),this.dl.splice(n,1),m(i).Fh(t),t.en&&t.en()},t.prototype.Ga=function(t,i){var n=m(this.Du(t));n.Fh(t);var e=this.Ll(i);if(null===e){var r=t.ai();n.zh(t,i,r)}else r=e.ft===n?t.ai():void 0,e.ft.zh(t,i,r)},t.prototype.Zr=function(){var t=new Wt(2);t.be(),this.Sl(t)},t.prototype.if=function(t){var i=new Wt(2);i.ge(t),this.Sl(i)},t.prototype.pe=function(){var t=new Wt(2);t.pe(),this.Sl(t)},t.prototype.vr=function(t){var i=new Wt(2);i.vr(t),this.Sl(i)},t.prototype._r=function(t){var i=new Wt(2);i._r(t),this.Sl(i)},t.prototype.nf=function(){return this.xi.rightPriceScale.visible?"right":"left"},t.prototype.Fl=function(t,i){var n=new Wt(i);if(null!==t){var e=this._l.indexOf(t);n._e(e,{de:i})}return n},t.prototype.Cl=function(t,i){return void 0===i&&(i=2),this.Fl(this.Du(t),i)},t.prototype.Sl=function(t){this.gl&&this.gl(t),this._l.forEach((function(t){return t.sl().No().V()}))},t.prototype.$l=function(){this.Sl(new Wt(1))},t.prototype.Ql=function(t,i,n){var e=new Ui(this,t,i),r=void 0!==t.priceScaleId?t.priceScaleId:this.nf();return n.zh(e,r),Ht(r)||e.sh(t),e},t}(),$i=function(){function t(t,i){this.ht=t,this.st=i}return t.prototype.on=function(t){return this.ht===t.ht&&this.st===t.st},t}();function Gi(t){return t.ownerDocument&&t.ownerDocument.defaultView&&t.ownerDocument.defaultView.devicePixelRatio||1}function tn(t){var i=m(t.getContext("2d"));return i.setTransform(1,0,0,1,0,0),i}function nn(t,i){var n=t.createElement("canvas"),e=Gi(n);return n.style.width=i.ht+"px",n.style.height=i.st+"px",n.width=i.ht*e,n.height=i.st*e,n}function en(t,i){var n=m(t.ownerDocument).createElement("canvas");t.appendChild(n);var e,r=(void 0===e&&(e=s),new a(n,e));return r.resizeCanvas({width:i.ht,height:i.st}),r}var rn="undefined"!=typeof window,sn=function(){if(!rn)return!1;var t=!!navigator.maxTouchPoints||!!navigator.msMaxTouchPoints||!!rn&&("ontouchstart"in window||Boolean(window.DocumentTouch&&document instanceof window.DocumentTouch));return"onorientationchange"in window&&t}(),on=function(){if(!rn)return!1;var t=/Android/i.test(navigator.userAgent),i=/iPhone|iPad|iPod|AppleWebKit.+Mobile/i.test(navigator.userAgent);return t||i}(),hn=function(){function t(t,i,n){this.hf=0,this.sf=null,this.rf=null,this.ef=!1,this.uf=null,this.af=!1,this.lf=!1,this.ff=null,this.cf=null,this.vf=null,this._f=null,this.df=0,this.wf=!1,this.Mf=!1,this.bf=!1,this.mf=t,this.gf=i,this.xi=n,this.pf()}return t.prototype.en=function(){null!==this.ff&&(this.ff(),this.ff=null),null!==this.cf&&(this.cf(),this.cf=null),null!==this.vf&&(this.vf(),this.vf=null),this.yf(),this.kf()},t.prototype.xf=function(t){var i=this;this.cf&&this.cf();var n=this.Nf.bind(this);this.cf=function(){i.mf.removeEventListener("mousemove",n)},this.mf.addEventListener("mousemove",n),ln(t)&&this.Nf(t);var e=this.Sf(t);this.Cf(e,this.gf.Df)},t.prototype.kf=function(){null!==this.sf&&clearTimeout(this.sf),this.hf=0,this.sf=null},t.prototype.Nf=function(t){if(!this.bf||ln(t)){var i=this.Sf(t);this.Cf(i,this.gf.Tf)}},t.prototype.Bf=function(t){if((!("button"in t)||0===t.button)&&null===this._f){var i=ln(t);if(!this.Mf||!i){this.wf=!0;var n=this.Sf(t),e=b(this.uf),r=Math.abs(e.g-n.Ef),s=Math.abs(e.p-n.Lf),o=r+s>5;if(o||!i){if(o&&!this.af&&i){var h=.5*r,u=s>=h&&!this.xi.Af,a=h>s&&!this.xi.Vf;u||a||(this.Mf=!0)}o&&(this.af=!0,this.lf=!0,i&&this.yf()),this.Mf||(this.Cf(n,this.gf.Of),i&&cn(t))}}}},t.prototype.zf=function(t){if(!("button"in t)||0===t.button){var i=this.Sf(t);this.yf(),this.uf=null,this.bf=!1,this.vf&&(this.vf(),this.vf=null),ln(t)&&this.Pf(t),this.Cf(i,this.gf.Ff),++this.hf,this.sf&&this.hf>1?(this.Cf(i,this.gf.If),this.kf()):this.lf||this.Cf(i,this.gf.Wf),ln(t)&&(cn(t),this.Pf(t),0===t.touches.length&&(this.ef=!1))}},t.prototype.yf=function(){null!==this.rf&&(clearTimeout(this.rf),this.rf=null)},t.prototype.Rf=function(t){if(!("button"in t)||0===t.button){var i=this.Sf(t);this.lf=!1,this.af=!1,this.Mf=!1,ln(t)&&this.xf(t),this.uf={g:i.Ef,p:i.Lf},this.vf&&(this.vf(),this.vf=null);var n=this.Bf.bind(this),e=this.zf.bind(this),r=this.mf.ownerDocument.documentElement;this.vf=function(){r.removeEventListener("touchmove",n),r.removeEventListener("touchend",e),r.removeEventListener("mousemove",n),r.removeEventListener("mouseup",e)},r.addEventListener("touchmove",n,{passive:!1}),r.addEventListener("touchend",e,{passive:!1}),this.yf(),ln(t)&&1===t.touches.length?this.rf=setTimeout(this.jf.bind(this,t),240):(r.addEventListener("mousemove",n),r.addEventListener("mouseup",e)),this.bf=!0,this.Cf(i,this.gf.Uf),this.sf||(this.hf=0,this.sf=setTimeout(this.kf.bind(this),500))}},t.prototype.pf=function(){var t=this;this.mf.addEventListener("mouseenter",this.xf.bind(this)),this.mf.addEventListener("touchcancel",this.yf.bind(this));var i=this.mf.ownerDocument,n=function(i){t.gf.qf&&(i.composed&&t.mf.contains(i.composedPath()[0])||i.target&&t.mf.contains(i.target)||t.gf.qf())};this.ff=function(){i.removeEventListener("mousedown",n),i.removeEventListener("touchstart",n)},i.addEventListener("mousedown",n),i.addEventListener("touchstart",n,{passive:!0}),this.mf.addEventListener("mouseleave",this.Pf.bind(this)),this.mf.addEventListener("touchstart",this.Rf.bind(this),{passive:!0}),sn||this.mf.addEventListener("mousedown",this.Rf.bind(this)),this.Hf(),this.mf.addEventListener("touchmove",(function(){}),{passive:!1})},t.prototype.Hf=function(){var t=this;void 0===this.gf.Yf&&void 0===this.gf.Kf&&void 0===this.gf.$f||(this.mf.addEventListener("touchstart",(function(i){return t.Xf(i.touches)}),{passive:!0}),this.mf.addEventListener("touchmove",(function(i){if(2===i.touches.length&&null!==t._f&&void 0!==t.gf.Kf){var n=an(i.touches[0],i.touches[1])/t.df;t.gf.Kf(t._f,n),cn(i)}}),{passive:!1}),this.mf.addEventListener("touchend",(function(i){t.Xf(i.touches)})))},t.prototype.Xf=function(t){1===t.length&&(this.wf=!1),2!==t.length||this.wf||this.ef?this.Zf():this.Jf(t)},t.prototype.Jf=function(t){var i=un(this.mf);this._f={g:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,p:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.df=an(t[0],t[1]),void 0!==this.gf.Yf&&this.gf.Yf(),this.yf()},t.prototype.Zf=function(){null!==this._f&&(this._f=null,void 0!==this.gf.$f&&this.gf.$f())},t.prototype.Pf=function(t){this.cf&&this.cf();var i=this.Sf(t);this.Cf(i,this.gf.Gf)},t.prototype.jf=function(t){var i=this.Sf(t);this.Cf(i,this.gf.Qf),this.lf=!0,this.ef=!0},t.prototype.Cf=function(t,i){i&&i.call(this.gf,t)},t.prototype.Sf=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=un(this.mf);return{tc:i.clientX,ic:i.clientY,Ef:i.pageX,Lf:i.pageY,nc:i.screenX,hc:i.screenY,sc:i.clientX-n.left,rc:i.clientY-n.top,ec:t.ctrlKey,uc:t.altKey,ac:t.shiftKey,oc:t.metaKey,me:t.type.startsWith("mouse")?"mouse":"touch",lc:t.view}},t}();function un(t){return t.getBoundingClientRect()||{left:0,top:0}}function an(t,i){var n=t.clientX-i.clientX,e=t.clientY-i.clientY;return Math.sqrt(n*n+e*e)}function ln(t){return Boolean(t.touches)}function cn(t){t.cancelable&&t.preventDefault()}var fn=function(){function t(t,i,n,e){this.xu=new vi(200),this.ue=0,this.fc="",this.Ou="",this.gu=[],this.cc=new Map,this.ue=t,this.fc=i,this.Ou=Ft(t,n,e)}return t.prototype.en=function(){this.xu.pu(),this.gu=[],this.cc.clear()},t.prototype.vc=function(t,i,n,e,r){var s=this._c(t,i);if("left"!==r){var o=Gi(t.canvas);n-=Math.floor(s.dc*o)}e-=Math.floor(s.wt/2),t.drawImage(s.wc,n,e,s.dt,s.wt)},t.prototype._c=function(t,i){var n,e=this;if(this.cc.has(i))n=g(this.cc.get(i));else{if(this.gu.length>=200){var r=g(this.gu.shift());this.cc.delete(r)}var s=Gi(t.canvas),o=Math.ceil(this.ue/4.5),h=Math.round(this.ue/10),u=Math.ceil(this.xu.Vt(t,i)),a=ut(Math.round(u+2*o)),l=ut(this.ue+2*o),c=nn(document,new $i(a,l));n={At:i,dc:Math.round(Math.max(1,u)),dt:Math.ceil(a*s),wt:Math.ceil(l*s),wc:c},0!==u&&(this.gu.push(n.At),this.cc.set(n.At,n)),H(t=tn(n.wc),s,(function(){t.font=e.Ou,t.fillStyle=e.fc,t.fillText(i,0,l-o-h)}))}return n},t}(),pn=function(){function t(t,i,n,e){var r=this;this.Jt=null,this.Mc=null,this.bc=null,this.mc=!1,this.gc=new vi(50),this.yc=new fn(11,"#000"),this.fc=null,this.Ou=null,this.kc=0,this.xc=function(){r.Nc(r.pl.I()),r._i.Sc().ct().Or()},this.Cc=function(){r._i.Sc().ct().Or()},this._i=t,this.xi=i,this.pl=n,this.Dc="left"===e,this.Tc=document.createElement("div"),this.Tc.style.height="100%",this.Tc.style.overflow="hidden",this.Tc.style.width="25px",this.Tc.style.left="0",this.Tc.style.position="relative",this.Bc=en(this.Tc,new $i(16,16)),this.Bc.subscribeCanvasConfigured(this.xc);var s=this.Bc.canvas;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Ec=en(this.Tc,new $i(16,16)),this.Ec.subscribeCanvasConfigured(this.Cc);var o=this.Ec.canvas;o.style.position="absolute",o.style.zIndex="2",o.style.left="0",o.style.top="0";var h={Uf:this.Lc.bind(this),Of:this.Ac.bind(this),qf:this.Vc.bind(this),Ff:this.Oc.bind(this),If:this.zc.bind(this),Df:this.Pc.bind(this),Gf:this.Fc.bind(this)};this.Ic=new hn(this.Ec.canvas,h,{Af:!1,Vf:!0})}return t.prototype.en=function(){this.Ic.en(),this.Ec.unsubscribeCanvasConfigured(this.Cc),this.Ec.destroy(),this.Bc.unsubscribeCanvasConfigured(this.xc),this.Bc.destroy(),null!==this.Jt&&this.Jt.Wh().hn(this),this.Jt=null,null!==this.bc&&(clearTimeout(this.bc),this.bc=null),this.yc.en()},t.prototype.Wc=function(){return this.Tc},t.prototype.K=function(){return this.xi.backgroundColor},t.prototype.S=function(){return m(this.Jt).I().borderColor},t.prototype.Rc=function(){return this.xi.textColor},t.prototype.zt=function(){return this.xi.fontSize},t.prototype.jc=function(){return Ft(this.zt(),this.xi.fontFamily)},t.prototype.Uc=function(){var t=this.pl.I(),i=this.fc!==t.et,n=this.Ou!==t.xt;return(i||n)&&(this.Nc(t),this.fc=t.et),n&&(this.gc.pu(),this.Ou=t.xt),t},t.prototype.qc=function(){if(null===this.Jt)return 0;var t=34,i=this.Uc(),n=tn(this.Bc.canvas),e=this.Jt.An();n.font=this.jc(),e.length>0&&(t=Math.max(this.gc.Vt(n,e[0].Bn),this.gc.Vt(n,e[e.length-1].Bn)));for(var r=this.Hc(),s=r.length;s--;){var o=this.gc.Vt(n,r[s].At());o>t&&(t=o)}var h=Math.ceil(i.Dt+i.Ct+i.Et+i.Lt+t);return h+h%2},t.prototype.Yc=function(t){if(t.ht<0||t.st<0)throw new Error("Try to set invalid size to PriceAxisWidget "+JSON.stringify(t));null!==this.Mc&&this.Mc.on(t)||(this.Mc=t,this.Bc.resizeCanvas({width:t.ht,height:t.st}),this.Ec.resizeCanvas({width:t.ht,height:t.st}),this.Tc.style.width=t.ht+"px",this.Tc.style.height=t.st+"px",this.Tc.style.minWidth=t.ht+"px")},t.prototype.Kc=function(){return m(this.Mc).ht},t.prototype.li=function(t){this.Jt!==t&&(null!==this.Jt&&this.Jt.Wh().hn(this),this.Jt=t,t.Wh().Ji(this.Un.bind(this),this))},t.prototype.Z=function(){return this.Jt},t.prototype.pu=function(){var t=this._i.$c();this._i.Sc().ct().tl(t,m(this.Z()))},t.prototype.Xc=function(t){if(null!==this.Mc){if(1!==t){var i=tn(this.Bc.canvas);this.Zc(),this.Jc(i,this.Bc.pixelRatio),this.uu(i,this.Bc.pixelRatio),this.Gc(i,this.Bc.pixelRatio),this.Qc(i,this.Bc.pixelRatio)}var n=tn(this.Ec.canvas),e=this.Mc.ht,r=this.Mc.st;H(n,this.Ec.pixelRatio,(function(){n.clearRect(0,0,e,r)})),this.tv(n,this.Ec.pixelRatio)}},t.prototype.iv=function(){return this.Bc.canvas},t.prototype.Lc=function(t){if(null!==this.Jt&&!this.Jt.Qt()&&this._i.Sc().I().handleScale.axisPressedMouseMove.price){var i=this._i.Sc().ct(),n=this._i.$c();this.mc=!0,i.Ko(n,this.Jt,t.rc)}},t.prototype.Ac=function(t){if(null!==this.Jt&&this._i.Sc().I().handleScale.axisPressedMouseMove.price){var i=this._i.Sc().ct(),n=this._i.$c(),e=this.Jt;i.$o(n,e,t.rc)}},t.prototype.Vc=function(){if(null!==this.Jt&&this._i.Sc().I().handleScale.axisPressedMouseMove.price){var t=this._i.Sc().ct(),i=this._i.$c(),n=this.Jt;this.mc&&(this.mc=!1,t.Xo(i,n))}},t.prototype.Oc=function(t){if(null!==this.Jt&&this._i.Sc().I().handleScale.axisPressedMouseMove.price){var i=this._i.Sc().ct(),n=this._i.$c();this.mc=!1,i.Xo(n,this.Jt)}},t.prototype.zc=function(t){this._i.Sc().I().handleScale.axisDoubleClickReset&&this.pu()},t.prototype.Pc=function(t){null!==this.Jt&&(!this._i.Sc().ct().I().handleScale.axisPressedMouseMove.price||this.Jt.lh()||this.Jt.fh()||this.nv(1))},t.prototype.Fc=function(t){this.nv(0)},t.prototype.Hc=function(){var t=this,i=[],n=null===this.Jt?void 0:this.Jt;return function(e){for(var r=0;r0&&(t=r[0].Pt())}));var h=i.filter((function(i){return i.Pt()<=t})),u=i.filter((function(i){return i.Pt()>t}));if(h.sort((function(t,i){return i.Pt()-t.Pt()})),h.length&&u.length&&u.push(h[0]),u.sort((function(t,i){return t.Pt()-i.Pt()})),i.forEach((function(t){return t.Yt(t.Pt())})),this.Jt.I().alignLabels){for(var a=1;a(v=p.Ht())-c&&l.Yt(v-c)}for(var f=1;f1&&this.zv(),null!==this.hv&&this.hv.Xc(t),null!==this.sv&&this.sv.Xc(t),1!==t){var i=tn(this.Bc.canvas);i.save(),this.Jc(i,this.Pv(),this.Bc.pixelRatio),this.vv&&(this.Fv(i,this.Bc.pixelRatio),this.Iv(i,this.Bc.pixelRatio),this.Wv(i,this.Bc.pixelRatio)),i.restore()}var n=tn(this.Ec.canvas);n.clearRect(0,0,Math.ceil(this.Mc.ht*this.Ec.pixelRatio),Math.ceil(this.Mc.st*this.Ec.pixelRatio)),this.Rv(n,this.Ec.pixelRatio)}},t.prototype.jv=function(){return this.hv},t.prototype.Uv=function(){return this.sv},t.prototype.Pv=function(){return this._v.I().layout.backgroundColor},t.prototype.dv=function(){null!==this.vv&&this.vv.hl().hn(this),this.vv=null},t.prototype.Jc=function(t,i,n){var e=this;H(t,n,(function(){W(t,0,0,e.Mc.ht,e.Mc.st,i)}))},t.prototype.Fv=function(t,i){var n=m(this.vv),e=n.sl().No().W(n.wt(),n.dt());null!==e&&(t.save(),e.h(t,i,!1),t.restore())},t.prototype.Iv=function(t,i){var n=this.hi().Vl();this.qv(n,t,i),this.Hv(n,t,i)},t.prototype.Rv=function(t,i){this.Hv(this.hi().Ol(),t,i)},t.prototype.Wv=function(t,i){for(var n=m(this.vv).Oh(),e=0,r=n;ei.Fs?t:i}var mn=function(){function t(t){var i=this;this.Xv=null,this.Zv=null,this.re=null,this.Jv=!1,this.Mc=new $i(0,0),this.xc=function(){return i._v.ct().Or()},this.Cc=function(){return i._v.ct().Or()},this._v=t,this.xi=t.I().layout,this.Gv=document.createElement("tr"),this.Qv=document.createElement("td"),this.Qv.style.padding="0",this.t_=document.createElement("td"),this.t_.style.padding="0",this.Tc=document.createElement("td"),this.Tc.style.height="25px",this.Tc.style.padding="0",this.i_=document.createElement("div"),this.i_.style.width="100%",this.i_.style.height="100%",this.i_.style.position="relative",this.i_.style.overflow="hidden",this.Tc.appendChild(this.i_),this.Bc=en(this.i_,new $i(16,16)),this.Bc.subscribeCanvasConfigured(this.xc);var n=this.Bc.canvas;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.Ec=en(this.i_,new $i(16,16)),this.Ec.subscribeCanvasConfigured(this.Cc);var e=this.Ec.canvas;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0",this.Gv.appendChild(this.Qv),this.Gv.appendChild(this.Tc),this.Gv.appendChild(this.t_),this.n_(),this._v.ct().Po().Ji(this.n_.bind(this),this),this.Ic=new hn(this.Ec.canvas,this,{Af:!0,Vf:!1})}return t.prototype.en=function(){this.Ic.en(),null!==this.Xv&&this.Xv.en(),null!==this.Zv&&this.Zv.en(),this.Ec.unsubscribeCanvasConfigured(this.Cc),this.Ec.destroy(),this.Bc.unsubscribeCanvasConfigured(this.xc),this.Bc.destroy()},t.prototype.Wc=function(){return this.Gv},t.prototype.h_=function(){return this.Xv},t.prototype.s_=function(){return this.Zv},t.prototype.Uf=function(t){if(!this.Jv){this.Jv=!0;var i=this._v.ct();!i.U().Qt()&&this._v.I().handleScale.axisPressedMouseMove.time&&i.Il(t.sc)}},t.prototype.qf=function(){var t=this._v.ct();!t.U().Qt()&&this.Jv&&(this.Jv=!1,this._v.I().handleScale.axisPressedMouseMove.time&&t.Yl())},t.prototype.Of=function(t){var i=this._v.ct();!i.U().Qt()&&this._v.I().handleScale.axisPressedMouseMove.time&&i.Hl(t.sc)},t.prototype.Ff=function(t){this.Jv=!1;var i=this._v.ct();i.U().Qt()&&!this._v.I().handleScale.axisPressedMouseMove.time||i.Yl()},t.prototype.If=function(){this._v.I().handleScale.axisDoubleClickReset&&this._v.ct().pe()},t.prototype.Df=function(t){this._v.ct().I().handleScale.axisPressedMouseMove.time&&this.nv(1)},t.prototype.Gf=function(t){this.nv(0)},t.prototype.Ov=function(){return this.Mc},t.prototype.r_=function(t,i,n){this.Mc&&this.Mc.on(t)||(this.Mc=t,this.Bc.resizeCanvas({width:t.ht,height:t.st}),this.Ec.resizeCanvas({width:t.ht,height:t.st}),this.Tc.style.width=t.ht+"px",this.Tc.style.height=t.st+"px"),null!==this.Xv&&this.Xv.Yc(new $i(i,t.st)),null!==this.Zv&&this.Zv.Yc(new $i(n,t.st))},t.prototype.e_=function(){var t=this.u_();return Math.ceil(t.Dt+t.Ct+t.zt+t.Tt+t.Bt)},t.prototype.V=function(){this._v.ct().U().An()},t.prototype.iv=function(){return this.Bc.canvas},t.prototype.Xc=function(t){if(0!==t){if(1!==t){var i=tn(this.Bc.canvas);this.Jc(i,this.Bc.pixelRatio),this.uu(i,this.Bc.pixelRatio),this.Gc(i,this.Bc.pixelRatio),null!==this.Xv&&this.Xv.Xc(t),null!==this.Zv&&this.Zv.Xc(t)}var n=tn(this.Ec.canvas),e=this.Ec.pixelRatio;n.clearRect(0,0,Math.ceil(this.Mc.ht*e),Math.ceil(this.Mc.st*e)),this.a_([this._v.ct().Ol()],n,e)}},t.prototype.Jc=function(t,i){var n=this;H(t,i,(function(){W(t,0,0,n.Mc.ht,n.Mc.st,n.Pv())}))},t.prototype.uu=function(t,i){if(this._v.I().timeScale.borderVisible){t.save(),t.fillStyle=this.o_();var n=Math.max(1,Math.floor(this.u_().Dt*i));t.fillRect(0,0,Math.ceil(this.Mc.ht*i),n),t.restore()}},t.prototype.Gc=function(t,i){var n=this,e=this._v.ct().U().An();if(e&&0!==e.length){var r=e.reduce(gn,e[0]).Fs;r>30&&r<40&&(r=30),t.save(),t.strokeStyle=this.o_();var s=this.u_(),o=s.Dt+s.Ct+s.Tt+s.zt-s.Ot;t.textAlign="center",t.fillStyle=this.o_();var h=Math.floor(this.u_().Dt*i),u=Math.max(1,Math.floor(i)),a=Math.floor(.5*i);if(this._v.ct().U().I().borderVisible){t.beginPath();for(var l=Math.round(s.Ct*i),c=e.length;c--;){var f=Math.round(e[c].Tn*i);t.rect(f-a,h,u,l)}t.fill()}t.fillStyle=this.oe(),H(t,i,(function(){t.font=n.l_();for(var i=0,s=e;i=r&&t.fillText(a.Bn,a.Tn,o)}}))}},t.prototype.a_=function(t,i,n){for(var e=this.u_(),r=0,s=t;r0&&(this.hi.Vr(),this.hi.io(),this.hi.Or()),this.y_.V()}this.Xc(t)},t.prototype.ke=function(t){var i=this.hi.U();switch(t.me){case 0:i.Zr();break;case 1:i.Jr(t.J);break;case 2:i.vr(t.J);break;case 3:i._r(t.J);break;case 4:i.Ir()}},t.prototype.gl=function(t){var i=this;null!==this.w_?this.w_._n(t):this.w_=t,this.M_||(this.M_=!0,this.v_=window.requestAnimationFrame((function(){i.M_=!1,i.v_=0,null!==i.w_&&(i.C_(i.w_),i.w_=null)})))},t.prototype.A_=function(){this.x_()},t.prototype.x_=function(){for(var t=this.hi.Al(),i=t.length,n=this.c_.length,e=i;e=0;--r)if(Math.floor(n.getTime()/kn[r].W_)!==Math.floor(e.getTime()/kn[r].W_))return kn[r].Fs}return 20}function En(t){if(!Dt(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{Cs:Math.round(i.getTime()/1e3),Ss:t}}function Ln(t){if(!Jt(t))throw new Error("time must be of type isUTCTimestamp");return{Cs:t}}function Bn(t){return 0===t.length?null:Dt(t[0].time)?En:Ln}function In(t){return Jt(t)?Ln(t):Dt(t)?En(t):En(zn(t))}function zn(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 Vn(t){S(t.time)&&(t.time=zn(t.time))}function Rn(t){return{Ps:0,R_:new Map,Ih:t}}var An=function(){function t(){this.j_=new Map,this.U_=new Map,this.q_=new Map,this.H_=[]}return t.prototype.en=function(){this.j_.clear(),this.U_.clear(),this.q_.clear(),this.H_=[]},t.prototype.Y_=function(t,i){var n=this;this.q_.has(t)&&this.j_.forEach((function(i){return i.R_.delete(t)}));var e=[];if(0!==i.length){!function(t){t.forEach(Vn)}(i);var r=m(Bn(i)),s=Cn(t.fa());e=i.map((function(i){var e=r(i.time),o=n.j_.get(e.Cs);void 0===o&&(o=Rn(e),n.j_.set(e.Cs,o));var h=s(e,o.Ps,i);return o.R_.set(t,h),h}))}return this.K_(),this.X_(t,e),this.Z_(t)},t.prototype.tf=function(t){return this.Y_(t,[])},t.prototype.J_=function(t,i){Vn(i);var n=m(Bn([i]))(i.time),e=this.q_.get(t);if(void 0!==e&&n.Csr.Ps)return{barsBefore:t.from-s,barsAfter:o-t.to};var h={barsBefore:null===e||e.Ps===s?t.from-s:e.Ps-s,barsAfter:null===r||r.Ps===o?o-t.to:o-r.Ps};return null!==e&&null!==r&&(h.from=e.P.Ss||e.P.Cs,h.to=r.P.Ss||r.P.Cs),h},t.prototype.setData=function(t){this.Oe.fa(),this.ed.ad(this.Oe,t)},t.prototype.update=function(t){this.Oe.fa(),this.ed.ho(this.Oe,t)},t.prototype.setMarkers=function(t){var i=t.map((function(t){return v(v({},t),{time:In(t.time)})}));this.Oe.eo(i)},t.prototype.applyOptions=function(t){var i=Nn(t);this.Oe.sh(i)},t.prototype.options=function(){return C(this.Oe.I())},t.prototype.priceScale=function(){return this.ud.priceScale(this.Oe.Z().hh())},t.prototype.createPriceLine=function(t){var i=M(C(Dn),t),n=this.Oe.uo(i);return new Jn(n)},t.prototype.removePriceLine=function(t){this.Oe.ao(t.rd())},t.prototype.seriesType=function(){return this.Oe.fa()},t}(),Un=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return p(i,t),i.prototype.applyOptions=function(i){Ct(i),t.prototype.applyOptions.call(this,i)},i}(Fn),Hn={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,drawTicks:!0,scaleMargins:{bottom:.1,top:.2}},Wn={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:Nt,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"},jn={width:0,height:0,layout:{backgroundColor:"#FFFFFF",textColor:"#191919",fontSize:11,fontFamily:Nt},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:v({},Hn),leftPriceScale:v(v({},Hn),{visible:!1}),rightPriceScale:v(v({},Hn),{visible:!0}),timeScale:{rightOffset:0,barSpacing:6,fixLeftEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0},watermark:Wn,localization:{locale:rn?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}},Yn={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},Zn={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},Xn={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBackgroundColor:""},Qn={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,crosshairMarkerBorderColor:"",crosshairMarkerBackgroundColor:""},Kn={color:"#26a69a",base:0},qn={title:"",visible:!0,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}},$n=function(){function t(t,i){this.od=t,this.ld=i}return t.prototype.applyOptions=function(t){this.od.ct().El(this.ld,t)},t.prototype.options=function(){return this.Jt().I()},t.prototype.width=function(){return Ht(this.ld)?this.od.E_("left"===this.ld?"left":"right"):0},t.prototype.Jt=function(){return m(this.od.ct().Ll(this.ld)).Z},t}(),Gn=function(){function t(t){this.fd=new et,this.tr=new et,this.hi=t,this.To().Yr().Ji(this.vd.bind(this)),this.To().Kr().Ji(this._d.bind(this))}return t.prototype.en=function(){this.To().Yr().hn(this),this.To().Kr().hn(this),this.fd.en()},t.prototype.scrollPosition=function(){return this.To().Pr()},t.prototype.scrollToPosition=function(t,i){i?this.To().Hr(t,1e3):this.hi._r(t)},t.prototype.scrollToRealTime=function(){this.To().qr()},t.prototype.getVisibleRange=function(){var t,i,n=this.To().mr();return null===n?null:{from:null!==(t=n.from.Ss)&&void 0!==t?t:n.from.Cs,to:null!==(i=n.to.Ss)&&void 0!==i?i:n.to.Cs}},t.prototype.setVisibleRange=function(t){var i={from:In(t.from),to:In(t.to)},n=this.To().kr(i);this.hi.if(n)},t.prototype.getVisibleLogicalRange=function(){var t=this.To().br();return null===t?null:{from:t.ss(),to:t.rs()}},t.prototype.setVisibleLogicalRange=function(t){y(t.from<=t.to,"The from index cannot be after the to index."),this.hi.if(t)},t.prototype.resetTimeScale=function(){this.hi.pe()},t.prototype.fitContent=function(){this.hi.Zr()},t.prototype.logicalToCoordinate=function(t){var i=this.hi.U();return i.Qt()?null:i.G(t)},t.prototype.coordinateToLogical=function(t){var i=this.hi.U();return i.Qt()?null:i.Lr(t)},t.prototype.timeToCoordinate=function(t){var i=In(t),n=this.hi.U(),e=n.dr(i,!1);return null===e?null:n.G(e)},t.prototype.coordinateToTime=function(t){var i,n=this.hi.U(),e=n.Lr(t),r=n.si(e);return null===r?null:null!==(i=r.Ss)&&void 0!==i?i:r.Cs},t.prototype.subscribeVisibleTimeRangeChange=function(t){this.fd.Ji(t)},t.prototype.unsubscribeVisibleTimeRangeChange=function(t){this.fd.nn(t)},t.prototype.subscribeVisibleLogicalRangeChange=function(t){this.tr.Ji(t)},t.prototype.unsubscribeVisibleLogicalRangeChange=function(t){this.tr.nn(t)},t.prototype.applyOptions=function(t){this.To().sh(t)},t.prototype.options=function(){return C(this.To().I())},t.prototype.To=function(){return this.hi.U()},t.prototype.vd=function(){this.fd.rn()&&this.fd.sn(this.getVisibleRange())},t.prototype._d=function(){this.tr.rn()&&this.tr.sn(this.getVisibleLogicalRange())},t}();function te(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 ie(t){return function(t){if(x(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&&x(t.handleScale.axisPressedMouseMove)){var n=t.handleScale.axisPressedMouseMove;t.handleScale.axisPressedMouseMove={time:n,price:n}}var e=t.handleScroll;x(e)&&(t.handleScroll={horzTouchDrag:e,vertTouchDrag:e,mouseWheel:e,pressedMouseMove:e})}(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=M(t.leftPriceScale,t.priceScale),t.rightPriceScale=M(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 ne=function(){function t(t,i){var n=this;this.dd=new An,this.wd=new Map,this.Md=new Map,this.bd=new et,this.md=new et;var e=void 0===i?C(jn):M(C(jn),ie(i));this.od=new bn(t,e),this.od.Lv().Ji((function(t){n.bd.rn()&&n.bd.sn(n.gd(t()))}),this),this.od.zl().Ji((function(t){n.md.rn()&&n.md.sn(n.gd(t()))}),this);var r=this.od.ct();this.pd=new Gn(r)}return t.prototype.remove=function(){this.od.Lv().hn(this),this.od.zl().hn(this),this.pd.en(),this.od.en(),this.wd.clear(),this.Md.clear(),this.bd.en(),this.md.en(),this.dd.en()},t.prototype.resize=function(t,i,n){this.od.k_(t,i,n)},t.prototype.addAreaSeries=function(t){void 0===t&&(t={}),te((t=Nn(t)).priceFormat);var i=M(C(qn),Qn,t),n=this.od.ct().Gl("Area",i),e=new Fn(n,this,this);return this.wd.set(e,n),this.Md.set(n,e),e},t.prototype.addBarSeries=function(t){void 0===t&&(t={}),te((t=Nn(t)).priceFormat);var i=M(C(qn),Zn,t),n=this.od.ct().Gl("Bar",i),e=new Fn(n,this,this);return this.wd.set(e,n),this.Md.set(n,e),e},t.prototype.addCandlestickSeries=function(t){void 0===t&&(t={}),Ct(t=Nn(t)),te(t.priceFormat);var i=M(C(qn),Yn,t),n=this.od.ct().Gl("Candlestick",i),e=new Un(n,this,this);return this.wd.set(e,n),this.Md.set(n,e),e},t.prototype.addHistogramSeries=function(t){void 0===t&&(t={}),te((t=Nn(t)).priceFormat);var i=M(C(qn),Kn,t),n=this.od.ct().Gl("Histogram",i),e=new Fn(n,this,this);return this.wd.set(e,n),this.Md.set(n,e),e},t.prototype.addLineSeries=function(t){void 0===t&&(t={}),te((t=Nn(t)).priceFormat);var i=M(C(qn),Xn,t),n=this.od.ct().Gl("Line",i),e=new Fn(n,this,this);return this.wd.set(e,n),this.Md.set(n,e),e},t.prototype.removeSeries=function(t){var i=g(this.wd.get(t)),n=this.dd.tf(i);this.od.ct().tf(i),this.yd(n),this.wd.delete(t),this.Md.delete(i)},t.prototype.ad=function(t,i){this.yd(this.dd.Y_(t,i))},t.prototype.ho=function(t,i){this.yd(this.dd.J_(t,i))},t.prototype.subscribeClick=function(t){this.bd.Ji(t)},t.prototype.unsubscribeClick=function(t){this.bd.nn(t)},t.prototype.subscribeCrosshairMove=function(t){this.md.Ji(t)},t.prototype.unsubscribeCrosshairMove=function(t){this.md.nn(t)},t.prototype.priceScale=function(t){return void 0===t&&(t=this.od.ct().nf()),new $n(this.od,t)},t.prototype.timeScale=function(){return this.pd},t.prototype.applyOptions=function(t){this.od.sh(ie(t))},t.prototype.options=function(){return this.od.I()},t.prototype.takeScreenshot=function(){return this.od.D_()},t.prototype.yd=function(t){var i=this.od.ct();i.Zl(t.U.Br,t.U.sd),t.Q_.forEach((function(t,i){return i.ho(t.nd,t.Nl)})),i.Vr()},t.prototype.kd=function(t){return g(this.Md.get(t))},t.prototype.gd=function(t){var i=this,n=new Map;t.F_.forEach((function(t,e){n.set(i.kd(e),t)}));var e=void 0===t.P_?void 0:this.kd(t.P_);return{time:t.P&&(t.P.Ss||t.P.Cs),point:t.z_,hoveredSeries:e,hoveredMarkerId:t.I_,seriesPrices:n}},t}();function ee(t,i){var n;if(S(t)){var e=document.getElementById(t);y(null!==e,"Cannot find element in DOM with id="+t),n=e}else n=t;return new ne(n,i)}function re(){return"3.3.0"}var se=n(1),oe=n.n(se);function he(t){return(he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ue(t,i){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);i&&(e=e.filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable}))),n.push.apply(n,e)}return n}function ae(t){for(var i=1;i0)}function C(t){return"boolean"==typeof t}function T(t){var i,e,n,r=t;if(!r||"object"!=typeof r)return r;for(e in i=Array.isArray(r)?[]:{},r)r.hasOwnProperty(e)&&(n=r[e],i[e]=n&&"object"==typeof n?T(n):n);return i}function k(t){return null!==t}function P(t){return null===t?void 0:t}var _,E,L,R,V=function(){function t(){this.t=[]}return t.prototype.setRenderers=function(t){this.t=t},t.prototype.draw=function(t,i,e,n){this.t.forEach((function(r){t.save(),r.draw(t,i,e,n),t.restore()}))},t}(),F=function(){function t(){}return t.prototype.draw=function(t,i,e,n){t.save(),t.scale(i,i),this._drawImpl(t,e,n),t.restore()},t.prototype.drawBackground=function(t,i,e,n){t.save(),t.scale(i,i),this._drawBackgroundImpl(t,e,n),t.restore()},t.prototype._drawBackgroundImpl=function(t,i,e){},t}(),D=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i._data=null,i}return p(i,t),i.prototype.setData=function(t){this._data=t},i.prototype._drawImpl=function(t){if(null!==this._data&&null!==this._data.visibleRange){var i=this._data.visibleRange,e=this._data,n=function(n){t.beginPath();for(var r=i.to-1;r>=i.from;--r){var s=e.items[r];t.moveTo(s.x,s.y),t.arc(s.x,s.y,n,0,2*Math.PI)}t.fill()};t.fillStyle=e.backColor,n(e.radius+2),t.fillStyle=e.lineColor,n(e.radius)}},i}(F),z={from:0,to:1},A=function(){function t(t,i){this.i=new V,this.s=[],this.u=[],this.o=!0,this.l=t,this.v=i,this.i.setRenderers(this.s)}return t.prototype.update=function(t){var i=this,e=this.l.serieses();e.length!==this.s.length&&(this.u=e.map((function(){return{items:[{x:0,y:0,time:0,price:0}],lineColor:"",backColor:i.l.options().layout.backgroundColor,radius:0,visibleRange:null}})),this.s=this.u.map((function(t){var i=new D;return i.setData(t),i})),this.i.setRenderers(this.s)),this.o=!0},t.prototype.renderer=function(t,i,e){return this.o&&(this.M(),this.o=!1),this.i},t.prototype.M=function(){var t=this,i=this.l.serieses(),e=this.v.appliedIndex(),n=this.l.timeScale();i.forEach((function(i,r){var s=t.u[r],o=i.markerDataAtIndex(e);if(null!==o){var h=y(i.firstValue());s.lineColor=i.barColorer().barStyle(e).barColor,s.backColor=t.l.options().layout.backgroundColor,s.radius=o.radius,s.items[0].price=o.price,s.items[0].y=i.priceScale().priceToCoordinate(o.price,h.value),s.items[0].time=e,s.items[0].x=n.indexToCoordinate(e),s.visibleRange=z}else s.visibleRange=null}))},t}(),O=function(){function t(t){this.m=t}return t.prototype.draw=function(t,i,e,n){if(null!==this.m){var r=this.m.vertLine.visible,s=this.m.horzLine.visible;if(r||s){t.save();var o=Math.round(this.m.x*i),h=Math.round(this.m.y*i),a=Math.ceil(this.m.w*i),c=Math.ceil(this.m.h*i);t.lineCap="butt",r&&o>=0&&(t.lineWidth=Math.floor(this.m.vertLine.lineWidth*i),t.strokeStyle=this.m.vertLine.color,t.fillStyle=this.m.vertLine.color,u(t,this.m.vertLine.lineStyle),function(t,i,e,n){t.beginPath();var r=t.lineWidth%2?.5:0;t.moveTo(i+r,0),t.lineTo(i+r,n),t.stroke()}(t,o,0,c)),s&&h>=0&&(t.lineWidth=Math.floor(this.m.horzLine.lineWidth*i),t.strokeStyle=this.m.horzLine.color,t.fillStyle=this.m.horzLine.color,u(t,this.m.horzLine.lineStyle),l(t,h,0,a)),t.restore()}}},t}(),B=function(){function t(t){this.o=!0,this.p={vertLine:{lineWidth:1,lineStyle:0,color:"",visible:!1},horzLine:{lineWidth:1,lineStyle:0,color:"",visible:!1},w:0,h:0,x:0,y:0},this.g=new O(this.p),this.k=t}return t.prototype.update=function(){this.o=!0},t.prototype.renderer=function(t,i){return this.o&&this.M(),this.g},t.prototype.M=function(){var t=this.k.visible(),i=y(this.k.pane()),e=i.model().options().crosshair,n=this.p;n.horzLine.visible=t&&this.k.horzLineVisible(i),n.vertLine.visible=t&&this.k.vertLineVisible(),n.horzLine.lineWidth=e.horzLine.width,n.horzLine.lineStyle=e.horzLine.style,n.horzLine.color=e.horzLine.color,n.vertLine.lineWidth=e.vertLine.width,n.vertLine.lineStyle=e.vertLine.style,n.vertLine.color=e.vertLine.color,n.w=i.width(),n.h=i.height(),n.x=this.k.appliedX(),n.y=this.k.appliedY()},t}(),I={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 N(t){return x(i=t)||i<0?0:i>255?255:Math.round(i);var i}function $(t){return x(i=t)||i<0?0:i>1?1:Math.round(1e4*i)/1e4;var i}function W(t){var i=function(t){(t=t.toLowerCase())in I&&(t=I[t]);var i,e,n=(i=t,null!==(e=L.re.exec(i))?L.parse(e):null);if(null!==n)return n;var r=function(t){var i=E.re.exec(t);return null!==i?E.parse(i):null}(t);if(null!==r)return r;var s=function(t){var i=_.re.exec(t);return null!==i?_.parse(i):null}(t);if(null!==s)return s;var o=function(t){var i=R.re.exec(t);return null!==i?R.parse(i):null}(t);return null!==o?[o[0],o[1],o[2]]:null}(t);if(null!==i)return i;throw new Error("Passed color string "+t+" does not match any of the known color representations")}function U(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 Y(t){return"black"===U(W(t),160)?"white":"black"}function j(t,i,e,n,r,s){t.fillRect(i,e,s,r),t.fillRect(i+s,e,n-2*s,s),t.fillRect(i+s,e+r-s,n-2*s,s),t.fillRect(i+n-s,e,s,r)}function H(t,i,e){t.save(),t.scale(i,i),e(),t.restore()}function q(t,i,e,n,r,s){t.save(),t.globalCompositeOperation="copy",t.fillStyle=s,t.fillRect(i,e,n,r),t.restore()}!function(t){t.re=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/,t.parse=function(t){return[N(parseInt(t[1]+t[1],16)),N(parseInt(t[2]+t[2],16)),N(parseInt(t[3]+t[3],16))]}}(_||(_={})),function(t){t.re=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,t.parse=function(t){return[N(parseInt(t[1],16)),N(parseInt(t[2],16)),N(parseInt(t[3],16))]}}(E||(E={})),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[N(parseInt(t[1],10)),N(parseInt(t[2],10)),N(parseInt(t[3],10))]}}(L||(L={})),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[N(parseInt(t[1],10)),N(parseInt(t[2],10)),N(parseInt(t[3],10)),$(parseFloat(t[4]))]}}(R||(R={}));var K,X=function(){function t(t,i){this.setData(t,i)}return t.prototype.setData=function(t,i){this.m=t,this.N=i},t.prototype.draw=function(t,i,e,n,r,s){if(this.m.visible){t.font=i.font;var o=this.m.tickVisible?i.tickLength:0,h=i.borderSize,a=i.paddingTop,u=i.paddingBottom,l=i.paddingInner,c=i.paddingOuter,p=this.m.text,f=Math.ceil(e.measureText(t,p)),d=i.baselineOffset,v=i.fontSize+a+u,m=Math.ceil(.5*v),y=h+f+l+c+o,g=this.N.coordinate;this.N.fixedCoordinate&&(g=this.N.fixedCoordinate);var b,S,w=(g=Math.round(g))-m,M=w+v,x="right"===r,C=x?n:0,T=Math.ceil(n*s),k=C;if(t.fillStyle=function(t){return function(t){return 0===t.indexOf("#")}(t)?t:(1,"rgba("+(i=[(e=W(t))[0],e[1],e[2],$(1)])[0]+", "+i[1]+", "+i[2]+", "+i[3]+")");var i,e}(this.N.background),t.lineWidth=1,t.lineCap="butt",p){x?(b=C-o,S=(k=C-y)+c):(k=C+y,b=C+o,S=C+h+o+l);var P=Math.max(1,Math.floor(s)),_=Math.max(1,Math.floor(h*s)),E=x?T:0,L=Math.round(w*s),R=Math.round(k*s),V=Math.round(g*s)-Math.floor(.5*s),F=V+P+(V-L),D=Math.round(b*s);t.save(),t.beginPath(),t.moveTo(E,L),t.lineTo(R,L),t.lineTo(R,F),t.lineTo(E,F),t.fill(),t.fillStyle=this.m.borderColor,t.fillRect(x?T-_:0,L,_,F-L),this.m.tickVisible&&(t.fillStyle=this.N.color,t.fillRect(E,V,D-E,P)),t.textAlign="left",t.fillStyle=this.N.color,H(t,s,(function(){t.fillText(p,S,M-u-d)})),t.restore()}}},t.prototype.height=function(t,i){return this.m.visible?t.fontSize+t.paddingTop+t.paddingBottom:0},t}(),J=function(){function t(t){this.S={coordinate:0,color:"#FFF",background:"#000"},this.D={text:"",visible:!1,tickVisible:!0,borderColor:""},this.C={text:"",visible:!1,tickVisible:!1,borderColor:""},this.o=!0,this.T=new(t||X)(this.D,this.S),this.L=new(t||X)(this.C,this.S)}return t.prototype.text=function(){return this.D.text},t.prototype.background=function(){return this.S.background},t.prototype.color=function(){return Y(this.background())},t.prototype.coordinate=function(){return this.A(),this.S.coordinate},t.prototype.update=function(){this.o=!0},t.prototype.height=function(t,i){return void 0===i&&(i=!1),Math.max(this.T.height(t,i),this.L.height(t,i))},t.prototype.getFixedCoordinate=function(){return this.S.fixedCoordinate||0},t.prototype.setFixedCoordinate=function(t){this.S.fixedCoordinate=t},t.prototype.isVisible=function(){return this.A(),this.D.visible||this.C.visible},t.prototype.isAxisLabelVisible=function(){return this.A(),this.D.visible},t.prototype.isPaneLabelVisible=function(){return this.A(),this.C.visible},t.prototype.renderer=function(){return this.A(),this.T.setData(this.D,this.S),this.L.setData(this.C,this.S),this.T},t.prototype.paneRenderer=function(){return this.A(),this.T.setData(this.D,this.S),this.L.setData(this.C,this.S),this.L},t.prototype.A=function(){this.o&&(this._updateRendererData(this.D,this.C,this.S),this.o=!1)},t}(),Z=function(t){function i(i,e,n){var r=t.call(this)||this;return r.k=i,r.B=e,r.V=n,r}return p(i,t),i.prototype._updateRendererData=function(t,i,e){t.visible=!1;var n=this.k.options().horzLine;if(n.labelVisible){var r=this.B.firstValue();if(this.k.visible()&&!this.B.isEmpty()&&null!==r){e.background=n.labelBackgroundColor,e.color=Y(n.labelBackgroundColor);var s=this.V(this.B);e.coordinate=s.coordinate,t.text=this.B.formatPrice(s.price,r),t.visible=!0}}},i}(J),Q=/[1-9]/g,G=function(){function t(){this.m=null}return t.prototype.setData=function(t){this.m=t},t.prototype.draw=function(t,i,e){var n=this;if(null!==this.m&&!1!==this.m.visible&&0!==this.m.text.length){t.font=i.font;var r=Math.round(i.widthCache.measureText(t,this.m.text,Q));if(!(r<=0)){t.save();var s=i.paddingHorizontal,o=r+2*s,h=o/2,a=this.m.width,u=this.m.coordinate,l=Math.floor(u-h)+.5;l<0?(u+=Math.abs(0-l),l=Math.floor(u-h)+.5):l+o>a&&(u-=Math.abs(a-(l+o)),l=Math.floor(u-h)+.5);var c=l+o,p=0+i.borderSize+i.paddingTop+i.fontSize+i.paddingBottom;t.fillStyle=this.m.background;var f=Math.round(l*e),d=Math.round(0*e),v=Math.round(c*e),m=Math.round(p*e);t.fillRect(f,d,v-f,m-d);var g=Math.round(this.m.coordinate*e),b=d,S=Math.round((b+i.borderSize+i.tickLength)*e);t.fillStyle=this.m.color;var w=Math.max(1,Math.floor(e)),M=Math.floor(.5*e);t.fillRect(g-M,b,w,S-b);var x=p-i.baselineOffset-i.paddingBottom;t.textAlign="left",t.fillStyle=this.m.color,H(t,e,(function(){t.fillText(y(n.m).text,l+s,x)})),t.restore()}}},t}(),tt=function(t){function i(i,e,n){var r=t.call(this)||this;return r.o=!0,r.g=new G,r.p={visible:!1,background:"#4c525e",color:"white",text:"",width:0,coordinate:NaN},r.v=i,r.F=e,r.V=n,r}return p(i,t),i.prototype.update=function(){this.o=!0},i.prototype.renderer=function(){return this.o&&(this.M(),this.o=!1),this.g.setData(this.p),this.g},i.prototype.M=function(){var t=this.p;t.visible=!1;var i=this.v.options().vertLine;if(i.labelVisible){var e=this.F.timeScale();if(!e.isEmpty()){var n=e.indexToUserTime(this.v.appliedIndex());t.width=e.width();var r=this.V();r.time&&(t.coordinate=r.coordinate,t.text=e.formatDateTime(y(n)),t.visible=!0,t.background=i.labelBackgroundColor,t.color=Y(i.labelBackgroundColor))}}},i}(function(){function t(){this._text="",this._background="#585858",this._coordinate=0}return t.prototype.text=function(){return this._text},t.prototype.background=function(){return this._background},t.prototype.color=function(){return"black"===U(W(this._background),150)?"white":"black"},t.prototype.coordinate=function(){return this._coordinate},t}()),it=function(){function t(){this._priceScale=null,this.P=0}return t.prototype.zorder=function(){return this.P},t.prototype.setZorder=function(t){this.P=t},t.prototype.priceScale=function(){return this._priceScale},t.prototype.setPriceScale=function(t){this._priceScale=t},t.prototype.priceAxisViews=function(t,i){return[]},t.prototype.paneViews=function(t){return[]},t.prototype.timeAxisViews=function(){return[]},t}();!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet"}(K||(K={}));var et=function(t){function i(i,e){var n,r,s=t.call(this)||this;s.I=null,s.O=NaN,s.R=0,s.W=!0,s.U=new Map,s.q=!1,s.j=NaN,s.H=NaN,s.Y=NaN,s.K=NaN,s.F=i,s.$=e,s._=new A(i,s),s.X=(n=function(){return s.O},r=function(){return s.H},function(t){var i=r(),e=n();if(t===y(s.I).defaultPriceScale())return{price:e,coordinate:i};var o=y(t.firstValue());return{price:t.coordinateToPrice(i,o),coordinate:i}});var o=function(){return{time:s.F.timeScale().indexToUserTime(s.R),coordinate:s.appliedX()}};return s.Z=new tt(s,i,o),s.J=new B(s),s}return p(i,t),i.prototype.index=function(){return this.R},i.prototype.options=function(){return this.$},i.prototype.saveOriginCoord=function(t,i){this.Y=t,this.K=i},i.prototype.clearOriginCoord=function(){this.Y=NaN,this.K=NaN},i.prototype.originCoordX=function(){return this.Y},i.prototype.originCoordY=function(){return this.K},i.prototype.setPosition=function(t,i,e){this.q||(this.q=!0),this.W=!0,this.G(t,i,e)},i.prototype.appliedIndex=function(){return this.R},i.prototype.appliedX=function(){return this.j},i.prototype.appliedY=function(){return this.H},i.prototype.visible=function(){return this.W},i.prototype.clearPosition=function(){this.W=!1,this.tt(),this.O=NaN,this.j=NaN,this.H=NaN,this.I=null,this.clearOriginCoord()},i.prototype.paneViews=function(t){return null!==this.I?[this.J,this._]:[]},i.prototype.horzLineVisible=function(t){return t===this.I&&this.$.horzLine.visible},i.prototype.vertLineVisible=function(){return this.$.vertLine.visible},i.prototype.priceAxisViews=function(t,i){this.W&&this.I===t||this.U.clear();var e=[];return this.I===t&&e.push(this.it(this.U,i,this.X)),e},i.prototype.timeAxisViews=function(){return this.W?[this.Z]:[]},i.prototype.pane=function(){return this.I},i.prototype.updateAllViews=function(){this.U.forEach((function(t){return t.update()})),this.Z.update(),this._.update()},i.prototype.nt=function(t){return t&&!t.defaultPriceScale().isEmpty()?t.defaultPriceScale():null},i.prototype.G=function(t,i,e){this.st(t,i,e)&&this.updateAllViews()},i.prototype.st=function(t,i,e){var n=this.j,r=this.H,s=this.O,o=this.R,h=this.I,a=this.nt(e);this.R=t,this.j=isNaN(t)?NaN:this.F.timeScale().indexToCoordinate(t),this.I=e;var u=null!==a?a.firstValue():null;return null!==a&&null!==u?(this.O=i,this.H=a.priceToCoordinate(i,u)):(this.O=NaN,this.H=NaN),n!==this.j||r!==this.H||o!==this.R||s!==this.O||h!==this.I},i.prototype.tt=function(){var t=this.F.serieses().map((function(t){return t.bars().lastIndex()})).filter(k),i=0===t.length?null:Math.max.apply(Math,t);this.R=null!==i?i:NaN},i.prototype.it=function(t,i,e){var n=t.get(i);return void 0===n&&(n=new Z(this,i,e),t.set(i,n)),n},i}(it);function nt(t,i){if(!S(t))return"n/a";if(!w(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");return 0===i?t.toString():("0000000000000000"+t.toString()).slice(-i)}var rt,st=function(){function t(t,i,e,n){if(i||(i=1),S(t)&&w(t)||(t=100),t<0)throw new TypeError("invalid base");this.B=t,this.ht=i,this.rt=n,e&&void 0!==n&&n>0&&2!==n&&4!==n&&8!==n||(this.ut=e,this.et())}return t.prototype.format=function(t){var i=t<0?"−":"";return t=Math.abs(t),this.ut?i+this.ot(t):i+this.ft(t)},t.prototype.et=function(){if(this._fractionalLength=0,this.B>0&&this.ht>0){var t=this.B;for(this.ut&&this.rt&&(t/=this.rt);t>1;)t/=10,this._fractionalLength++}},t.prototype.ft=function(t){var i;i=this.ut?Math.pow(10,this._fractionalLength||0):this.B/this.ht;var e=Math.floor(t),n="",r=void 0!==this._fractionalLength?this._fractionalLength:NaN;if(i>1){var s=+(Math.round(t*i)-e*i).toFixed(this._fractionalLength);s>=i&&(s-=i,e+=1),n="."+nt(+s.toFixed(this._fractionalLength)*this.ht,r)}else e=Math.round(e*i)/i,r>0&&(n="."+nt(0,r));return e.toFixed(0)+n},t.prototype.ot=function(t){var i=this.B/this.ht,e=Math.floor(t),n=Math.round(t*i)-e*i;if(n===i&&(n=0,e+=1),!this._fractionalLength)throw new Error("_fractionalLength is not calculated");var r="";if(this.rt){var s=n%this.rt;r=nt(n=(n-s)/this.rt,this._fractionalLength)+"'"+(2===this.rt?["0","5"][s]:8===this.rt?["0","1","2","3","4","5","6","7"][s]:["0","2","5","7"][s])}else r=nt(n*this.ht,this._fractionalLength);return e.toString()+"'"+r},t}(),ot=function(t){function i(i){return void 0===i&&(i=100),t.call(this,i)||this}return p(i,t),i.prototype.format=function(i){return t.prototype.format.call(this,i)+"%"},i}(st),ht=function(){function t(){this.at=[]}return t.prototype.subscribe=function(t,i,e){var n={callback:t,linkedObject:i,singleshot:!0===e};this.at.push(n)},t.prototype.unsubscribe=function(t){var i=this.at.findIndex((function(i){return t===i.callback}));i>-1&&this.at.splice(i,1)},t.prototype.unsubscribeAll=function(t){this.at=this.at.filter((function(i){return i.linkedObject===t}))},t.prototype.fire=function(t,i){var e=d(this.at);this.at=this.at.filter((function(t){return!t.singleshot})),e.forEach((function(e){return e.callback(t,i)}))},t.prototype.hasListeners=function(){return this.at.length>0},t.prototype.destroy=function(){this.at=[]},t}(),at=function(t){function i(i){var e=t.call(this)||this;return e.F=i,e}return p(i,t),i.prototype.model=function(){return this.F},i.prototype.minMove=function(){return 0},i.prototype.autoscaleInfo=function(t,i){return null},i}(it),ut=function(){function t(t,i){this.ct=t,this.lt=i}return t.prototype.equals=function(t){return null!==t&&this.ct===t.ct&&this.lt===t.lt},t.prototype.clone=function(){return new t(this.ct,this.lt)},t.prototype.minValue=function(){return this.ct},t.prototype.setMinValue=function(t){this.ct=t},t.prototype.maxValue=function(){return this.lt},t.prototype.setMaxValue=function(t){this.lt=t},t.prototype.length=function(){return this.lt-this.ct},t.prototype.isEmpty=function(){return this.lt===this.ct||Number.isNaN(this.lt)||Number.isNaN(this.ct)},t.prototype.merge=function(i){return null===i?this:new t(Math.min(this.minValue(),i.minValue()),Math.max(this.maxValue(),i.maxValue()))},t.prototype.apply=function(t,i){this.ct=Math.min(this.ct,t),this.lt=Math.max(this.lt,i)},t.prototype.set=function(t,i){this.ct=t,this.lt=i},t.prototype.scaleAroundCenter=function(t){if(S(t)&&0!=this.lt-this.ct){var i=.5*(this.lt+this.ct),e=this.lt-i,n=this.ct-i;e*=t,n*=t,this.lt=i+e,this.ct=i+n}},t.prototype.shift=function(t){S(t)&&(this.lt+=t,this.ct+=t)},t.prototype.containsStrictly=function(t){return t.minValue()>this.ct&&t.maxValue()1;i/=10)if(i%10!=0)return!1;return!0}(this.vt))this.Mt=[2,2.5,2];else{this.Mt=[];for(var e=this.vt;1!==e;){if(e%2==0)this.Mt.push(2),e/=2;else{if(e%5!=0)throw new Error("unexpected base");this.Mt.push(2),this.Mt.push(2.5),e/=5}if(this.Mt.length>100)throw new Error("something wrong with base")}}}return t.prototype.tickSpan=function(t,i,e){for(var n,r=0===this.vt?0:1/this.vt,s=Math.pow(10,Math.max(0,Math.ceil(pt(t-i)))),o=0,h=this.dt[0];;){var a=ct(s,r,1e-9)&&s>r+1e-9,u=ct(s,e*h,1e-9),l=ct(s,1,1e-9);if(!(a&&u&&l))break;s/=h,h=this.dt[++o%this.dt.length]}if(s<=r+1e-9&&(s=r),s=Math.max(1,s),this.Mt.length>0&&(n=s,1,1e-9,Math.abs(n-1)<1e-9))for(o=0,h=this.Mt[0];ct(s,e*h,1e-9)&&s>r+1e-9;)s/=h,h=this.Mt[++o%this.Mt.length];return s},t}(),xt=function(){function t(t,i,e,n){this.wt=[],this.B=t,this.vt=i,this.bt=e,this.pt=n}return t.prototype.setBase=function(t){if(t<0)throw new Error("base < 0");this.vt=t},t.prototype.tickSpan=function(t,i){if(t=u?1:-1,f=null,d=0,v=a-(c+=c<0?l:0);v>u;v-=l){var m=this.pt(v,i,!0);null!==f&&Math.abs(m-f)h||(d=1e-15&&t<1?t.toFixed(this.kt).replace(/\.?0+$/,""):String(t)).replace(/(\.[1-9]*)0+$/,(function(t,i){return i}))},t}();function Tt(t,i,e,n){if(0!==i.length){var r=i[n.from].x,s=i[n.from].y;t.moveTo(r,s);for(var o=n.from+1;o>1,h=n+o;e(t[h],i)?(n=h+1,s-=o+1):s=o}return n}function Et(t,i,e,n,r){void 0===n&&(n=0),void 0===r&&(r=t.length);for(var s=r-n;0>1,h=n+o;e(i,t[h])?s=o:(n=h+1,s-=o+1)}return n}function Lt(t,i){return t.time0&&s=n&&(h=s-1),o>0&&o=2&&Math.floor(i)%2!=this.Ct%2&&this.Ct--,this.Tt=this.m.thinBars?Math.min(this.Ct,Math.floor(i)):this.Ct;for(var r=null,s=this.m.visibleRange.from;sp+d-1&&(y=(g=p+d-1)-l+1),t.fillRect(m,y,u-m,g-y+1)}var b=a+v,S=Math.max(p,Math.round(o.closeY*i)-h),w=S+l-1;w>p+d-1&&(S=(w=p+d-1)-l+1),t.fillRect(c+1,S,b-c,w-S+1)}}}},t}(),Bt=function(t){function i(i,e){return t.call(this,i,e,!1)||this}return p(i,t),i.prototype._convertToCoordinates=function(t,i,e){i.indexesToCoordinates(this._items,P(this._itemsVisibleRange)),t.barPricesToCoordinates(this._items,e,P(this._itemsVisibleRange))},i.prototype._createDefaultItem=function(t,i,e){return{time:t,open:i.value[0],high:i.value[1],low:i.value[2],close:i.value[3],x:NaN,openY:NaN,highY:NaN,lowY:NaN,closeY:NaN}},i.prototype._fillRawPoints=function(){var t=this,i=[],e=this._series.barColorer();this._series.bars().each((function(n,r){var s=t._createRawItem(n,r,e);return i.push(s),!1})),this._items=i},i}(Dt),It=function(t){function i(i,e){var n=t.call(this,i,e)||this;return n.g=new Ot,n}return p(i,t),i.prototype.renderer=function(t,i){this._makeValid();var e=this._series.options(),n={bars:this._items,barSpacing:this._model.timeScale().barSpacing(),openVisible:e.openVisible,thinBars:e.thinBars,visibleRange:this._itemsVisibleRange};return this.g.setData(n),this.g},i.prototype._createRawItem=function(t,i,e){return f(f({},this._createDefaultItem(t,i,e)),{color:e.barStyle(t).barColor})},i}(Bt);!function(t){t[t.BarBorderWidth=1]="BarBorderWidth"}(Ft||(Ft={}));var Nt=function(){function t(){this.m=null,this.Ct=0}return t.prototype.setData=function(t){this.m=t},t.prototype.draw=function(t,i,e,n){if(null!==this.m&&0!==this.m.bars.length&&null!==this.m.visibleRange){this.Ct=function(t,i){var e=Math.floor(.8*t*i),n=Math.floor(t*i),r=Math.min(e,n-1);return Math.max(1,r)}(this.m.barSpacing,i),this.Ct>=2&&Math.floor(i)%2!=this.Ct%2&&this.Ct--;var r=this.m.bars;this.m.wickVisible&&this.Et(t,r,this.m.visibleRange,i),this.m.borderVisible&&this.Lt(t,r,this.m.visibleRange,this.m.barSpacing,i);var s=this.At(i);(!this.m.borderVisible||this.Ct>2*s)&&this.Bt(t,r,this.m.visibleRange,i)}},t.prototype.Et=function(t,i,e,n){if(null!==this.m){var r="",s=Math.min(Math.floor(n),Math.floor(this.m.barSpacing*n));s=Math.min(s,this.Ct);for(var o=Math.floor(.5*s),h=e.from;h2*o?j(t,u,c,l-u+1,p-c+1,o):t.fillRect(u,c,l-u+1,p-c+1)}},t.prototype.Bt=function(t,i,e,n){if(null!==this.m)for(var r="",s=this.At(n),o=e.from;ou)){if(h.color!==r){var p=h.color;t.fillStyle=p,r=p}t.fillRect(l,a,c-l+1,u-a+1)}}},t}(),$t=function(t){function i(i,e){var n=t.call(this,i,e)||this;return n.g=new Nt,n}return p(i,t),i.prototype.renderer=function(t,i){this._makeValid();var e=this._series.options(),n={bars:this._items,barSpacing:this._model.timeScale().barSpacing(),wickVisible:e.wickVisible,borderVisible:e.borderVisible,visibleRange:this._itemsVisibleRange};return this.g.setData(n),this.g},i.prototype._createRawItem=function(t,i,e){var n=e.barStyle(t);return f(f({},this._createDefaultItem(t,i,e)),{color:n.barColor,wickColor:n.barWickColor,borderColor:n.barBorderColor})},i}(Bt),Wt=function(){function t(){this.m=null,this.zt=[]}return t.prototype.setData=function(t){this.m=t,this.zt=[]},t.prototype.draw=function(t,i,e,n){if(null!==this.m&&0!==this.m.items.length&&null!==this.m.visibleRange){this.zt.length||this.Vt(i);for(var r=Math.round(this.m.histogramBase*i),s=Math.max(1,Math.floor(i)),o=this.m.visibleRange.from;ol.center?l.right=u.left-i-1:u.left=l.right+i+1)}var c=Math.ceil(this.m.barSpacing*t);for(n=this.m.visibleRange.from;n0&&c<4)for(n=this.m.visibleRange.from;nc&&(u.roundedCenter>u.center?u.right-=1:u.left+=1)}else this.zt=[]},t}();function Ut(t){return{items:[],barSpacing:t,histogramBase:NaN,visibleRange:null}}var Yt,jt=function(t){function i(i,e){var n=t.call(this,i,e,!1)||this;return n.i=new V,n.Ft=Ut(0),n.Pt=new Int32Array(0),n.g=new Wt,n}return p(i,t),i.prototype.renderer=function(t,i){return this._makeValid(),this.i},i.prototype._fillRawPoints=function(){var t=this,i=this._model.timeScale().barSpacing(),e=this._series.palette();this.Ft=Ut(i);var n=this._series.barFunction();this.Pt=new Int32Array(this._series.bars().size());var r=0,s=0,o=0,h=this._series.options().color;this._series.bars().each((function(i,a){var u=n(a.value),l=a.value[4],c=function(t,i,e){return{time:t,price:i,x:NaN,y:NaN,color:e}}(i,u,null!=l?e.colorByIndex(l):h),p=null==l?0:l+1;return++sMath.ceil(this.m.height*i))){var s=Math.ceil(this.m.width*i);t.lineCap="butt",t.strokeStyle=this.m.color,t.lineWidth=Math.floor(this.m.lineWidth*i),u(t,this.m.lineStyle),l(t,r,0,s)}}},t}(),Qt=function(){function t(t){this._lineRendererData={width:0,height:0,y:0,color:"rgba(0, 0, 0, 0)",lineWidth:1,lineStyle:0,visible:!1},this._lineRenderer=new Zt,this.o=!0,this._series=t,this._model=t.model(),this._lineRenderer.setData(this._lineRendererData)}return t.prototype.update=function(){this.o=!0},t.prototype.renderer=function(t,i){return this.o&&(this._updateImpl(t,i),this.o=!1),this._lineRenderer},t}(),Gt=function(t){function i(i){return t.call(this,i)||this}return p(i,t),i.prototype._updateImpl=function(t,i){this._lineRendererData.visible=!1;var e=this._series.priceScale(),n=e.mode().mode;if(2===n||3===n){var r=this._series.options();if(r.baseLineVisible){var s=this._series.firstValue();null!==s&&(this._lineRendererData.visible=!0,this._lineRendererData.y=e.priceToCoordinate(s.value,s.value),this._lineRendererData.width=i,this._lineRendererData.height=t,this._lineRendererData.color=r.baseLineColor,this._lineRendererData.lineWidth=r.baseLineWidth,this._lineRendererData.lineStyle=r.baseLineStyle)}}},i}(Qt);function ti(t,i){return dt(Math.min(Math.max(t,12),30)*i)}function ii(t,i){switch(t){case"arrowDown":case"arrowUp":return ti(i,1);case"circle":return ti(i,.8);case"square":return ti(i,.7)}}function ei(t){return ft(ti(t,1))}function ni(t){return Math.max(ti(t,.1),3)}function ri(t,i,e,n,r){var s=ii("square",e),o=(s-1)/2,h=t-o,a=i-o;return n>=h&&n<=h+s&&r>=a&&r<=a+s}function si(t,i,e,n,r,s){var o=(ii("arrowUp",s)-1)/2,h=(dt(s/2)-1)/2;i.fillStyle=r,i.beginPath(),t?(i.moveTo(e-o,n),i.lineTo(e,n-o),i.lineTo(e+o,n),i.lineTo(e+h,n),i.lineTo(e+h,n+o),i.lineTo(e-h,n+o),i.lineTo(e-h,n)):(i.moveTo(e-o,n),i.lineTo(e,n+o),i.lineTo(e+o,n),i.lineTo(e+h,n),i.lineTo(e+h,n-o),i.lineTo(e-h,n-o),i.lineTo(e-h,n)),i.fill()}!function(t){t[t.MinShapeSize=12]="MinShapeSize",t[t.MaxShapeSize=30]="MaxShapeSize",t[t.MinShapeMargin=3]="MinShapeMargin"}(Yt||(Yt={}));var oi=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.m=null,i}return p(i,t),i.prototype.setData=function(t){this.m=t},i.prototype.hitTest=function(t,i){if(null===this.m||null===this.m.visibleRange)return null;for(var e=this.m.visibleRange.from;e0){var t=this.F.timeScale().barSpacing(),i=ni(t),e=1.5*ei(t)+2*i;this.Qt={above:e,below:e}}else this.Qt=null;this.Gt=!1}return this.Qt},t.prototype._makeValid=function(){var t=this.ti.priceScale(),i=this.F.timeScale(),e=this.ti.indexedMarkers();this.Jt&&(this.m.items=e.map((function(t){return{time:t.time,x:0,y:0,size:0,shape:t.shape,color:t.color,internalId:t.internalId,externalId:t.id}})),this.Jt=!1),this.m.visibleRange=null;var n=i.visibleBars();if(null!==n){var r=this.ti.firstValue();if(null!==r&&0!==this.m.items.length){var s=NaN,o=ni(i.barSpacing()),h={aboveBar:o,belowBar:o};this.m.visibleRange=Vt(this.m.items,n,!0);for(var a=this.m.visibleRange.from;a0),e.background=this.k.priceLineColor(h.color),e.color=Y(e.background),e.coordinate=h.coordinate,i.borderColor=this.k.model().options().layout.backgroundColor,t.borderColor=e.background)},i.prototype._paneText=function(t,i,e,n){var r="",s=this.k.title();return e&&0!==s.length&&(r+=s+" "),i&&n&&(r+=this.k.priceScale().isPercentage()?t.formattedPriceAbsolute:t.formattedPricePercentage),r.trim()},i.prototype._axisText=function(t,i,e){return i?e?this.k.priceScale().isPercentage()?t.formattedPricePercentage:t.formattedPriceAbsolute:t.text:""},i}(J),di=function(t){function i(i,e){var n=t.call(this,i)||this;return n.ii=e,n}return p(i,t),i.prototype._updateImpl=function(t,i){var e=this._lineRendererData;e.visible=!1;var n=this.ii.yCoord();if(null!==n){var r=this.ii.options();e.visible=!0,e.y=n,e.color=r.color,e.width=i,e.height=t,e.lineWidth=r.lineWidth,e.lineStyle=r.lineStyle}},i}(Qt),vi=function(t){function i(i,e){var n=t.call(this)||this;return n.ti=i,n.ii=e,n}return p(i,t),i.prototype._updateRendererData=function(t,i,e){t.visible=!1,i.visible=!1;var n=this.ii.options();if(n.axisLabelVisible){var r=this.ii.yCoord();null!==r&&(t.text=this.ti.priceScale().formatPriceAbsolute(n.price),t.visible=!0,e.background=n.color,e.color=Y(n.color),e.coordinate=r)}},i}(J),mi=function(){function t(t,i){this.ti=t,this.$=i,this.ni=new di(t,this),this._t=new vi(t,this)}return t.prototype.applyOptions=function(t){b(this.$,t),this.update(),this.ti.model().lightUpdate()},t.prototype.options=function(){return this.$},t.prototype.paneView=function(){return this.ni},t.prototype.priceAxisView=function(){return this._t},t.prototype.update=function(){this.ni.update(),this._t.update()},t.prototype.yCoord=function(){var t=this.ti,i=t.priceScale();if(t.model().timeScale().isEmpty()||i.isEmpty())return null;var e=t.firstValue();return null===e?null:i.priceToCoordinate(this.$.price,e.value)},t}(),yi=function(){function t(){this.si=0,this.hi=new Map,this.ri=new Map}return t.prototype.colorByIndex=function(t){return m(this.ri.get(t))},t.prototype.addColor=function(t){var i=this.hi.get(t);return void 0===i&&(i=this.si++,this.hi.set(t,i),this.ri.set(i,t)),i},t.prototype.clear=function(){this.si=0,this.hi.clear(),this.ri.clear()},t.prototype.size=function(){return this.ri.size},t}(),gi={barColor:"",barBorderColor:"",barWickColor:""},bi=function(){function t(t){this.ti=t}return t.prototype.barStyle=function(t,i){var e=this.ti.seriesType(),n=this.ti.options();switch(e){case"Line":return this.ui(n);case"Area":return this.ei(n);case"Bar":return this.oi(n,t,i);case"Candlestick":return this.fi(n,t,i);case"Histogram":return this.ai(n,t,i)}throw new Error("Unknown chart style")},t.prototype.oi=function(t,i,e){var n=f({},gi),r=t.upColor,s=t.downColor,o=r,h=s,a=y(this.ci(i,e)),u=g(a.value[0])<=g(a.value[3]);return n.barColor=u?r:s,n.barBorderColor=u?o:h,n},t.prototype.fi=function(t,i,e){var n=f({},gi),r=t.upColor,s=t.downColor,o=t.borderUpColor,h=t.borderDownColor,a=t.wickUpColor,u=t.wickDownColor,l=y(this.ci(i,e)),c=g(l.value[0])<=g(l.value[3]);return n.barColor=c?r:s,n.barBorderColor=c?o:h,n.barWickColor=c?a:u,n},t.prototype.ei=function(t){return f(f({},gi),{barColor:t.lineColor})},t.prototype.ui=function(t){return f(f({},gi),{barColor:t.color})},t.prototype.ai=function(t,i,e){var n=f({},gi),r=y(this.ci(i,e)).value[4];if(null!=r){var s=y(this.ti.palette());n.barColor=s.colorByIndex(r)}else n.barColor=t.color;return n},t.prototype.li=function(){return this.ti.bars()},t.prototype.ci=function(t,i){return void 0!==i?i.value:this.li().valueAt(t)},t}();!function(t){t[t.NearestLeft=-1]="NearestLeft",t[t.Exact=0]="Exact",t[t.NearestRight=1]="NearestRight"}(li||(li={}));var Si,wi=function(){function t(t,i){void 0===t&&(t=null),void 0===i&&(i=null),this.vi=[],this.di=0,this.Mi=0,this.wi=!1,this.bi=new Map,this.mi=new Map,this.pi=new Map,this.gi=t||new Map,this.yi=i}return t.prototype.clear=function(){this.vi=[],this.di=0,this.Mi=0,this.wi=!1,this.bi.clear(),this.mi.clear(),this.pi.clear()},t.prototype.first=function(){return this.size()>0?this.vi[this.di]:null},t.prototype.last=function(){return this.size()>0?this.vi[this.Mi-1]:null},t.prototype.firstIndex=function(){return this.size()>0?this.ki(this.di):null},t.prototype.lastIndex=function(){return this.size()>0?this.ki(this.Mi-1):null},t.prototype.size=function(){return this.Mi-this.di},t.prototype.isEmpty=function(){return 0===this.size()},t.prototype.contains=function(t){return null!==this.Ni(t,0)},t.prototype.valueAt=function(t){return this.search(t)},t.prototype.add=function(t,i,e){if(this.wi)return!1;var n={index:t,value:e,time:i},r=this.Ni(t,0);return this.mi.clear(),this.pi.clear(),null===r?(this.vi.splice(this.Si(t),0,n),this.di=0,this.Mi=this.vi.length,!0):(this.vi[r]=n,!1)},t.prototype.search=function(t,i,e){void 0===i&&(i=0);var n=this.Ni(t,i,e);if(null===n)return null;var r=this.xi(n);return{index:this.ki(n),time:r.time,value:r.value}},t.prototype.each=function(t){for(var i=this.di;ithis.vi[this.vi.length-1].index?this.Ei(t):1===t.length&&t[0].index===this.vi[this.vi.length-1].index?(this.Li(t[0]),t[0]):this.Ai(t)},t.prototype.remove=function(t){if(this.wi)return null;var i=this.Ni(t,1);if(null===i)return null;var e=this.vi.splice(i);return this.Mi=this.vi.length,this.bi.clear(),this.mi.clear(),this.pi.clear(),e.length>0?e[0]:null},t.prototype.ki=function(t){return this.vi[t].index},t.prototype.xi=function(t){return this.vi[t]},t.prototype.Ni=function(t,i,e){var n=this.Bi(t);if(null===n&&0!==i)switch(i){case-1:return this.zi(t,e);case 1:return this.Vi(t,e);default:throw new TypeError("Unknown search mode")}if(!e||null===n||0===i)return n;switch(i){case-1:return this.Fi(n);case 1:return this.Pi(n);default:throw new TypeError("Unknown search mode")}},t.prototype.Pi=function(t){for(var i=y(this.yi);t=this.di&&i(this.xi(t).value);)t-=1;return tthis.di&&(e-=1);var n=e!==this.Mi&&this.ki(e)t}),this.di,this.Mi)},t.prototype.Ii=function(t,i,e){var n=null,r=this.gi.get(e.name);if(void 0===r)throw new Error('Plot "'+e.name+'" is not registered');for(var s=t;sn.max&&(n.max=o)))}return n},t.prototype.Oi=function(t){var i=Math.floor(t.index/30);this.bi.forEach((function(t){return t.delete(i)}))},t.prototype.Ti=function(t){return v(!this.wi,"collection should not be readonly"),v(0!==t.length,"plotRows should not be empty"),this.mi.clear(),this.pi.clear(),this.bi.clear(),this.vi=t.concat(this.vi),this.di=0,this.Mi=this.vi.length,t[0]},t.prototype.Ei=function(t){return v(!this.wi,"collection should not be readonly"),v(0!==t.length,"plotRows should not be empty"),this.mi.clear(),this.pi.clear(),this.bi.clear(),this.vi=this.vi.concat(t),this.di=0,this.Mi=this.vi.length,t[0]},t.prototype.Li=function(t){v(!this.isEmpty(),"plot list should not be empty"),v(this.vi[this.Mi-1].index===t.index,"last row index should match new row index"),this.Oi(t),this.mi.delete(t.index),this.pi.delete(t.index),this.vi[this.Mi-1]=t},t.prototype.Ai=function(t){return v(0!==t.length,"plot rows should not be empty"),this.mi.clear(),this.pi.clear(),this.bi.clear(),this.vi=function(t,i){for(var e=function(t,i){for(var e=t.length,n=i.length,r=e+n,s=0,o=0;si[o].index?o++:(s++,o++,r--);return r}(t,i),n=new Array(e),r=0,s=0,o=t.length,h=i.length,a=0;ri[s].index?(n[a]=i[s],s++):(n[a]=i[s],r++,s++),a++;for(;r1)throw new Error("Invalid top margin - expect value between 0 and 1, given="+i);if(e<0||e>1||i+e>1)throw new Error("Invalid bottom margin - expect value between 0 and 1, given="+e);if(i+e>1)throw new Error("Invalid margins - sum of margins must be less than 1, given="+(i+e));this.Dn(),this.bn=null}},t.prototype.optionsChanged=function(){return this.gn},t.prototype.isAutoScale=function(){return this.$.autoScale},t.prototype.isLog=function(){return 1===this.$.mode},t.prototype.isPercentage=function(){return 2===this.$.mode},t.prototype.isIndexedTo100=function(){return 3===this.$.mode},t.prototype.mode=function(){return{autoScale:this.$.autoScale,isInverted:this.$.invertScale,mode:this.$.mode}},t.prototype.setMode=function(t){var i=this.mode(),e=null;void 0!==t.autoScale&&(this.$.autoScale=t.autoScale),void 0!==t.mode&&(this.$.mode=t.mode,2!==t.mode&&3!==t.mode||(this.$.autoScale=!0),this.on.isValid=!1),1===i.mode&&t.mode!==i.mode&&(function(t){if(null===t)return!1;var i=St(t.minValue()),e=St(t.maxValue());return isFinite(i)&&isFinite(e)}(this.rn)?null!==(e=function(t){if(null===t)return null;var i=St(t.minValue()),e=St(t.maxValue());return new ut(i,e)}(this.rn))&&this.setPriceRange(e):this.$.autoScale=!0),1===t.mode&&t.mode!==i.mode&&null!==(e=wt(this.rn))&&this.setPriceRange(e);var n=i.mode!==this.$.mode;n&&(2===i.mode||this.isPercentage())&&this.updateFormatter(),n&&(3===i.mode||this.isIndexedTo100())&&this.updateFormatter(),void 0!==t.isInverted&&i.isInverted!==t.isInverted&&(this.$.invertScale=t.isInverted,this.Cn()),this.ln.fire(i,this.mode())},t.prototype.modeChanged=function(){return this.ln},t.prototype.fontSize=function(){return this.yn.fontSize},t.prototype.height=function(){return this.nn},t.prototype.setHeight=function(t){this.nn!==t&&(this.nn=t,this.Dn(),this.bn=null)},t.prototype.internalHeight=function(){if(this.sn)return this.sn;var t=this.height()-this.Tn()-this.En();return this.sn=t,t},t.prototype.internalHeightChanged=function(){return this.hn},t.prototype.priceRange=function(){return this.Ln(),this.rn},t.prototype.priceRangeChanged=function(){return this.en},t.prototype.setPriceRange=function(t,i,e){var n=this.rn;(i||null===n&&null!==t||null!==n&&!n.equals(t))&&(this.bn=null,this.rn=t,e||this.en.fire(n,t))},t.prototype.isEmpty=function(){return this.Ln(),0===this.nn||!this.rn||this.rn.isEmpty()},t.prototype.invertedCoordinate=function(t){return this.isInverted()?t:this.height()-1-t},t.prototype.priceToCoordinate=function(t,i){return this.isPercentage()?t=vt(t,i):this.isIndexedTo100()&&(t=yt(t,i)),this.xn(t,i)},t.prototype.pointsArrayToCoordinates=function(t,i,e){this.Ln();for(var n=this.En(),r=y(this.priceRange()),s=r.minValue(),o=r.maxValue(),h=this.internalHeight()-1,a=this.isInverted(),u=h/(o-s),l=void 0===e?0:e.from,c=void 0===e?t.length:e.to,p=this.An(),f=l;f=0&&n.removeDataSource(t),n&&null===n.mainSource()){var r=n.dataSources().length;v(0===r,"Invalid priceScale state: empty mainSource but non-empty data sources="+r),n!==this._n&&n.modeChanged().unsubscribeAll(this)}t instanceof at&&this.Gn(),n&&t instanceof at&&(n.invalidateSourcesCache(),this.recalculatePriceScale(n)),this.dn=null},t.prototype.priceScalePosition=function(){var t=this.F.options().priceScale.position;return"none"===t?"overlay":t},t.prototype.startScalePrice=function(t,i){t.startScale(i)},t.prototype.scalePriceTo=function(t,i){t.scaleTo(i),this.updateAllViews()},t.prototype.endScalePrice=function(t){t.endScale()},t.prototype.startScrollPrice=function(t,i){t.startScroll(i)},t.prototype.scrollPriceTo=function(t,i){t.scrollTo(i),this.updateAllViews()},t.prototype.endScrollPrice=function(t){t.endScroll()},t.prototype.setPriceAutoScale=function(t,i){t.setMode({autoScale:i}),this.$n.isEmpty()?t.setPriceRange(null):this.recalculatePriceScale(t)},t.prototype.updateAllViews=function(){this.vn.forEach((function(t){t.updateAllViews()}))},t.prototype.defaultPriceScale=function(){var t=this.mainDataSource(),i=null!==t?t.priceScale():null;return null===i&&(i=this._n),i},t.prototype.mainDataSource=function(){return this.Yn},t.prototype.recalculatePriceScale=function(t){null!==t&&t.isAutoScale()&&this.Qn(t)},t.prototype.resetPriceScale=function(t){var i=this.$n.visibleBars();t.setMode({autoScale:!0}),null!==i&&t.recalculatePriceRange(i),this.updateAllViews()},t.prototype.momentaryAutoScale=function(){this.Qn(this._n)},t.prototype.recalculate=function(){var t=this;this.recalculatePriceScale(this._n),this.vn.forEach((function(i){t.isOverlay(i)&&t.recalculatePriceScale(i.priceScale())})),this.updateAllViews(),this.F.lightUpdate()},t.prototype.isEmpty=function(){return null===this.Yn},t.prototype.containsSeries=function(){return this.vn.some((function(t){return t instanceof _i}))},t.prototype.orderedSources=function(){return null===this.dn&&(this.dn=Ei(this.vn)),this.dn},t.prototype.onDestroyed=function(){return this.Kn},t.prototype.ts=function(t,i){return"overlay"!==i?this._n:this.Xn(!0)},t.prototype.Qn=function(t){var i=t.sourcesForAutoScale();if(i&&i.length>0&&!this.$n.isEmpty()){var e=this.$n.visibleBars();null!==e&&t.recalculatePriceRange(e)}t.updateAllViews()},t.prototype.Zn=function(){var t=this.orderedSources();if(0===t.length)return{minZOrder:0,maxZOrder:0};for(var i=0,e=0,n=0;ne&&(e=r))}return{minZOrder:i,maxZOrder:e}},t.prototype.Jn=function(t,i,e){var n="overlay",r=null;if(!i){var s=this.model().options().priceScale.position;n="none"===s?"overlay":s}t instanceof at&&(r=this.ts(t,n)),this.vn.push(t),i&&this.jn.push(t),null!==r&&(r.addDataSource(t),t.setPriceScale(r)),t.setZorder(e),this.Gn(),t instanceof at&&this.recalculatePriceScale(r),this.dn=null},t.prototype.ns=function(t,i,e){i.mode!==e.mode&&this.Qn(t)},t.prototype.Gn=function(){if(null===this.Yn||-1!==this.jn.indexOf(this.Yn)){for(var t=0,i=this.vn;to&&(this.vs=o),this.ds2;){if(1e3*m(this.Ms.get(i)).time.timestamp===t)return i;if(1e3*m(this.Ms.get(e)).time.timestamp===t)return e;var n=Math.round((i+e)/2);1e3*m(this.Ms.get(n)).time.timestamp>t?e=n:i=n}return i},t.prototype.build=function(t,i){var e=Math.ceil(i/t);if(this.ms===e&&this.Ut)return this.Ut;this.ms=e;for(var n=[],r=this.ws.length;r--;)if(this.ws[r]){var s=n;n=[];for(var o=s.length,h=0,a=m(this.ws[r]),u=a.length,l=1/0,c=-1/0,p=0;p=e&&d-c>=e&&(n.push(f),c=d)}for(;h=this.ds&&this.ds--,this.dsthis.vi.length){n=o-this.vi.length;for(var h=s;hthis.vi[this.vi.length-1].timestamp)return i?this.vi.length-1:null;for(var e=0;e=i[e])return e;var n=0,r=i[n];if(tn+1;){var s=n+e>>1,o=i[s];if(o.timestamp>t.timestamp)e=s;else{if(!(o.timestamp=1,a=h?t:n+(t-n)*o;e.setRightOffset(a),h||setTimeout(s,20)};s()},t.prototype.update=function(t,i,e){if(this.Cs=!0,i.length>0){var n=this.Ns.size();this.Ns.merge(t,i),this.Vs<0&&this.Ns.size()===n+1&&(this.Vs-=1,this.Cs=!0)}this.Ss.merge(e),this.qs()},t.prototype.visibleBarsChanged=function(){return this.Ts},t.prototype.optionsApplied=function(){return this.Es},t.prototype.baseIndex=function(){return this.ks||0},t.prototype.setVisibleRange=function(t){var i=t.count();this.Ws(this.Kt/i),this.Vs=t.lastBar()-this.baseIndex(),this.qs(),this.Cs=!0,this.F.recalculateAllPanes(),this.F.lightUpdate()},t.prototype.fitContent=function(){var t=this.Ns.firstIndex(),i=this.Ns.lastIndex();null!==t&&null!==i&&this.setVisibleRange(new oe(t,i+this.$.rightOffset))},t.prototype.setTimePointsRange=function(t){var i=this.points(),e=i.firstIndex(),n=i.lastIndex();if(null!==e&&null!==n){var r=y(i.valueAt(e)).timestamp,s=y(i.valueAt(n)).timestamp,o=new oe(y(i.indexOf(Math.max(r,t.from.timestamp),!0)),y(i.indexOf(Math.min(s,t.to.timestamp),!0)));this.setVisibleRange(o)}},t.prototype.formatDateTime=function(t){return void 0!==this.kn.timeFormatter?this.kn.timeFormatter(t.businessDay||t.timestamp):this.$s.format(new Date(1e3*t.timestamp))},t.prototype._s=function(t){return(this.Kt+1-t)/this.Fs},t.prototype.js=function(t){var i=this._s(t),e=this.baseIndex()+this.Vs-i;return Math.round(1e6*e)/1e6},t.prototype.Ws=function(t){var i=this.Fs;this.Fs=t,this.Us(),i!==this.Fs&&(this.Cs=!0,this.Xs())},t.prototype.Rs=function(){if(this.isEmpty())this.Zs(null);else{var t=this.baseIndex(),i=Math.ceil(this.Kt/this.Fs)-1,e=Math.round(this.Vs+t),n=e-i;this.Zs(new oe(n,e))}},t.prototype.Us=function(){if(this.Fs<.5&&(this.Fs=.5,this.Cs=!0),0!==this.Kt){var t=.5*this.Kt;this.Fs>t&&(this.Fs=t,this.Cs=!0)}},t.prototype.qs=function(){var t=this.Js();this.Vs>t&&(this.Vs=t,this.Cs=!0);var i=this.Gs();null!==i&&this.Vsthis.m.width?a.zoom=this.m.width/r:a.zoom=1,i+=a.lineHeight*a.zoom}var s=0;switch(this.m.vertAlign){case"top":s=0;break;case"center":s=Math.max((this.m.height-i)/2,0);break;case"bottom":s=Math.max(this.m.height-i,0)}t.fillStyle=this.m.color;for(var o=0,h=this.m.lines;o20&&(this.rh=null,i=!0),this.$n.scrollTo(t),this.recalculateAllPanes(),this.updateCrosshair(),this.lightUpdate(),i},t.prototype.endScrollTime=function(){this.$n.endScroll(),this.lightUpdate(),this.rh=null},t.prototype.resetTimeScale=function(){this.$n.restoreDefault(),this.recalculateAllPanes(),this.updateCrosshair(),this.lightUpdate()},t.prototype.invalidate=function(t){this.fh&&this.fh(t),this.lh.invalidate(),this.lightUpdate()},t.prototype.dataSources=function(){return this.sh.reduce((function(t,i){return t.concat(i.dataSources())}),[])},t.prototype.serieses=function(){return this.hh},t.prototype.setAndSaveCurrentPosition=function(t,i,e){this.v.saveOriginCoord(t,i);var n=NaN,r=this.$n.coordinateToIndex(t),s=this.$n.visibleBars();if(null!==s&&(r=Math.min(Math.max(s.firstBar(),r),s.lastBar())),null!==e.mainDataSource()){var o=e.defaultPriceScale(),h=o.firstValue();null!==h&&(n=o.coordinateToPrice(i,h)),n=this.vh.align(n,r,e)}this.v.setPosition(r,n,e),this.mh(),this.oh.fire(this.v.appliedIndex(),{x:t,y:i})},t.prototype.clearCurrentPosition=function(){this.crosshairSource().clearPosition(),this.mh(),this.oh.fire(null,null)},t.prototype.updateCrosshair=function(){var t=this.v.pane();if(null!==t){var i=this.v.originCoordX(),e=this.v.originCoordY();this.setAndSaveCurrentPosition(i,e,t)}},t.prototype.updateTimeScale=function(t,i,e,n){n&&this.$n.reset(),this.$n.update(t,i,e)},t.prototype.updateTimeScaleBaseIndex=function(t){var i=this.hh.reduce((function(t,i){var e=i.bars();if(e.isEmpty())return t;var n=y(e.lastIndex());return void 0===t?n:Math.max(n,t)}),void 0);if(void 0!==i){var e=this.$n,n=e.baseIndex(),r=e.visibleBars();if(null!==r){var s=r.contains(n);if(void 0!==t&&t>0&&!s){var o=i-n;e.setRightOffset(e.rightOffset()-o)}}e.setBaseIndex(i)}this.updateCrosshair(),this.recalculateAllPanes(),this.lightUpdate()},t.prototype.recalculatePane=function(t){null!==t&&t.recalculate()},t.prototype.paneForSource=function(t){var i=this.sh.find((function(i){return i.orderedSources().includes(t)}));return void 0===i?null:i},t.prototype.recalculateAllPanes=function(){this.sh.forEach((function(t){return t.recalculate()})),this.updateAllPaneViews()},t.prototype.destroy=function(){this.sh.forEach((function(t){return t.destroy()})),this.sh.length=0,this.$.localization.priceFormatter=void 0,this.$.localization.timeFormatter=void 0},t.prototype.setPriceAutoScaleForAllMainSources=function(){this.sh.map((function(t){return t.mainDataSource()})).forEach((function(t){null!==t&&y(t.priceScale()).setMode({autoScale:!0})}))},t.prototype.rendererOptionsProvider=function(){return this.ah},t.prototype.priceAxisRendererOptions=function(){return this.ah.options()},t.prototype.mainPriceScaleOptionsChanged=function(){return this.eh},t.prototype.mainPriceScale=function(){return this.sh[0].defaultPriceScale()},t.prototype.createSeries=function(t,i){var e=this.sh[0],n=this.ph(i,t,e);return this.hh.push(n),1===this.hh.length?this.fullUpdate():this.lightUpdate(),n},t.prototype.removeSeries=function(t){var i=this.paneForSource(t),e=this.hh.indexOf(t);v(-1!==e,"Series not found"),this.hh.splice(e,1),y(i).removeDataSource(t),t.destroy&&t.destroy()},t.prototype.fitContent=function(){var t=new ji(2);t.setFitContent(),this.Mh(t)},t.prototype.setTargetTimeRange=function(t){var i=new ji(2);i.setTargetTimeRange(t),this.Mh(i)},t.prototype.bh=function(t,i){var e=new ji(i);if(null!==t){var n=this.sh.indexOf(t);e.invalidatePane(n,{level:i})}return e},t.prototype.wh=function(t,i){return void 0===i&&(i=2),this.bh(this.paneForSource(t),i)},t.prototype.Mh=function(t){this.fh&&this.fh(t),this.lh.invalidate()},t.prototype.mh=function(){this.Mh(new ji(1))},t.prototype.ph=function(t,i,e){var n=new _i(this,t,i);return e.addDataSource(n,Boolean(t.overlay),!1),t.overlay&&n.applyOptions(t),n},t}(),ge=function(){function t(t,i){this.w=t,this.h=i}return t.prototype.equals=function(t){return this.w===t.w&&this.h===t.h},t}();function be(t){return t.ownerDocument&&t.ownerDocument.defaultView&&t.ownerDocument.defaultView.devicePixelRatio||1}function Se(t){var i=y(t.getContext("2d"));return i.setTransform(1,0,0,1,0,0),i}function we(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 Me(t,i){var e=we(t),n=be(e);return e.style.width=i.w+"px",e.style.height=i.h+"px",e.width=i.w*n,e.height=i.h*n,e}function xe(t,i){var e=we(y(t.ownerDocument));t.appendChild(e);var n=new a(e);return n.resizeCanvas({width:i.w,height:i.h}),n}var Ce,Te=!!navigator.maxTouchPoints||!!navigator.msMaxTouchPoints||"ontouchstart"in window||Boolean(window.DocumentTouch&&document instanceof window.DocumentTouch),ke="onorientationchange"in window&&Te,Pe=/Android/i.test(navigator.userAgent),_e=/iPhone|iPad|iPod|AppleWebKit.+Mobile/i.test(navigator.userAgent),Ee=Pe||_e;!function(t){t[t.ResetClick=500]="ResetClick",t[t.LongTap=240]="LongTap"}(Ce||(Ce={}));var Le=function(){function t(t,i,e){this.gh=0,this.yh=null,this.kh=null,this.Nh=!1,this.Sh=null,this.xh=!1,this.Dh=!1,this.Ch=null,this.Th=null,this.Eh=null,this.Lh=null,this.Ah=0,this.Bh=!1,this.zh=!1,this.Vh=!1,this.Fh=t,this.Ph=i,this.$=e,this.Ih()}return t.prototype.destroy=function(){null!==this.Ch&&(this.Ch(),this.Ch=null),null!==this.Th&&(this.Th(),this.Th=null),null!==this.Eh&&(this.Eh(),this.Eh=null),this.Oh(),this.Rh()},t.prototype.Wh=function(t){var i=this;this.Th&&this.Th();var e=this.Uh.bind(this);this.Th=function(){i.Fh.removeEventListener("mousemove",e)},this.Fh.addEventListener("mousemove",e),Fe(t)&&this.Uh(t);var n=this.qh(t);this.jh(n,this.Ph.mouseEnterEvent)},t.prototype.Rh=function(){null!==this.yh&&clearTimeout(this.yh),this.gh=0,this.yh=null},t.prototype.Uh=function(t){if(!this.Vh||Fe(t)){var i=this.qh(t);this.jh(i,this.Ph.mouseMoveEvent)}},t.prototype.Hh=function(t){if((!("button"in t)||0===t.button)&&null===this.Lh){var i=Fe(t);if(!this.zh||!i){this.Bh=!0;var e=this.qh(t),n=g(this.Sh),r=Math.abs(n.x-e.pageX),s=Math.abs(n.y-e.pageY),o=r+s>5;if(o||!i){if(o&&!this.xh&&i){var h=.5*r,a=s>=h&&!this.$.treatVertTouchDragAsPageScroll,u=h>s&&!this.$.treatHorzTouchDragAsPageScroll;a||u||(this.zh=!0)}o&&(this.xh=!0,this.Dh=!0,i&&this.Oh()),this.zh||(this.jh(e,this.Ph.pressedMouseMoveEvent),i&&De(t))}}}},t.prototype.Yh=function(t){if(!("button"in t)||0===t.button){var i=this.qh(t);this.Oh(),this.Sh=null,this.Vh=!1,this.Eh&&(this.Eh(),this.Eh=null),Fe(t)&&this.Kh(t),this.jh(i,this.Ph.mouseUpEvent),++this.gh,this.yh&&this.gh>1?(this.jh(i,this.Ph.mouseDoubleClickEvent),this.Rh()):this.Dh||this.jh(i,this.Ph.mouseClickEvent),Fe(t)&&(De(t),this.Kh(t),0===t.touches.length&&(this.Nh=!1))}},t.prototype.Oh=function(){null!==this.kh&&(clearTimeout(this.kh),this.kh=null)},t.prototype.$h=function(t){if(!("button"in t)||0===t.button){var i=this.qh(t);this.Dh=!1,this.xh=!1,this.zh=!1,Fe(t)&&this.Wh(t),this.Sh={x:i.pageX,y:i.pageY},this.Eh&&(this.Eh(),this.Eh=null);var e=this.Hh.bind(this),n=this.Yh.bind(this),r=this.Fh.ownerDocument.documentElement;this.Eh=function(){r.removeEventListener("touchmove",e),r.removeEventListener("touchend",n),r.removeEventListener("mousemove",e),r.removeEventListener("mouseup",n)},r.addEventListener("touchmove",e,{passive:!1}),r.addEventListener("touchend",n,{passive:!1}),this.Oh(),Fe(t)&&1===t.touches.length?this.kh=setTimeout(this._h.bind(this,t),240):(r.addEventListener("mousemove",e),r.addEventListener("mouseup",n)),this.Vh=!0,this.jh(i,this.Ph.mouseDownEvent),this.yh||(this.gh=0,this.yh=setTimeout(this.Rh.bind(this),500))}},t.prototype.Ih=function(){var t=this;this.Fh.addEventListener("mouseenter",this.Wh.bind(this)),this.Fh.addEventListener("touchcancel",this.Oh.bind(this));var i=this.Fh.ownerDocument,e=function(i){t.Ph.mouseDownOutsideEvent&&(i.target&&t.Fh.contains(i.target)||t.Ph.mouseDownOutsideEvent())};this.Ch=function(){i.removeEventListener("mousedown",e),i.removeEventListener("touchstart",e)},i.addEventListener("mousedown",e),i.addEventListener("touchstart",e,{passive:!0}),this.Fh.addEventListener("mouseleave",this.Kh.bind(this)),this.Fh.addEventListener("touchstart",this.$h.bind(this),{passive:!0}),ke||this.Fh.addEventListener("mousedown",this.$h.bind(this)),this.Xh(),this.Fh.addEventListener("touchmove",(function(){}),{passive:!1})},t.prototype.Xh=function(){var t=this;void 0===this.Ph.pinchStartEvent&&void 0===this.Ph.pinchEvent&&void 0===this.Ph.pinchEndEvent||(this.Fh.addEventListener("touchstart",(function(i){return t.Zh(i.touches)}),{passive:!0}),this.Fh.addEventListener("touchmove",(function(i){if(2===i.touches.length&&null!==t.Lh&&void 0!==t.Ph.pinchEvent){var e=Ve(i.touches[0],i.touches[1])/t.Ah;t.Ph.pinchEvent(t.Lh,e),De(i)}}),{passive:!1}),this.Fh.addEventListener("touchend",(function(i){t.Zh(i.touches)})))},t.prototype.Zh=function(t){1===t.length&&(this.Bh=!1),2!==t.length||this.Bh||this.Nh?this.Jh():this.Gh(t)},t.prototype.Gh=function(t){var i=Re(this.Fh);this.Lh={x:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,y:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.Ah=Ve(t[0],t[1]),void 0!==this.Ph.pinchStartEvent&&this.Ph.pinchStartEvent(),this.Oh()},t.prototype.Jh=function(){null!==this.Lh&&(this.Lh=null,void 0!==this.Ph.pinchEndEvent&&this.Ph.pinchEndEvent())},t.prototype.Kh=function(t){this.Th&&this.Th();var i=this.qh(t);this.jh(i,this.Ph.mouseLeaveEvent)},t.prototype._h=function(t){var i=this.qh(t);this.jh(i,this.Ph.longTapEvent),this.Dh=!0,this.Nh=!0},t.prototype.jh=function(t,i){i&&i.call(this.Ph,t)},t.prototype.qh=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 e=Re(this.Fh);return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,localX:i.clientX-e.left,localY:i.clientY-e.top,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,metaKey:t.metaKey,type:t.type.startsWith("mouse")?"mouse":"touch",target:i.target,view:t.view}},t}();function Re(t){return t.getBoundingClientRect()||{left:0,top:0}}function Ve(t,i){var e=t.clientX-i.clientX,n=t.clientY-i.clientY;return Math.sqrt(e*e+n*n)}function Fe(t){return Boolean(t.touches)}function De(t){t.cancelable&&t.preventDefault()}var ze,Ae=function(){function t(t,i,e,n){if(this.Qh=0,this.tr=0,this.ir=0,this.nr=0,this.sr=0,this.hr=0,this.rr=0,this.ur=t,this.er=t.paneWidgets()[i],this.or=t.paneWidgets()[e],this.ar=document.createElement("tr"),this.ar.style.height="1px",this.cr=document.createElement("td"),this.cr.style.padding="0",this.cr.setAttribute("colspan","3"),this.lr(),this.ar.appendChild(this.cr),n)this.vr=null,this.dr=null;else{this.vr=document.createElement("div"),this.vr.style.position="absolute",this.vr.style.zIndex="50",this.vr.style.height="5px",this.vr.style.width="100%",this.vr.style.backgroundColor="rgba(255, 255, 255, 0.02)",this.vr.style.cursor="ns-resize",this.cr.appendChild(this.vr);var r={mouseDownEvent:this.Mr.bind(this),pressedMouseMoveEvent:this.wr.bind(this),mouseUpEvent:this.br.bind(this)};this.dr=new Le(this.vr,r,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0})}}return t.prototype.destroy=function(){null!==this.dr&&this.dr.destroy()},t.prototype.getElement=function(){return this.ar},t.prototype.getSize=function(){return new ge(this.er.getSize().w,1)},t.prototype.getImage=function(){var t=this.getSize(),i=Me(document,t),e=Se(i);return e.fillStyle=this.ur.options().timeScale.borderColor,e.fillRect(0,0,t.w,t.h),i},t.prototype.update=function(){this.lr()},t.prototype.lr=function(){this.cr.style.background=this.ur.options().timeScale.borderColor},t.prototype.Mr=function(t){this.Qh=t.pageY,this.tr=0,this.ir=this.er.getSize().h+this.or.getSize().h,this.nr=this.er.stretchFactor()+this.or.stretchFactor(),this.sr=30,this.hr=this.ir-this.sr,this.rr=this.nr/this.ir},t.prototype.wr=function(t){this.tr=t.pageY-this.Qh;var i=this.er.getSize().h,e=lt(i+this.tr,this.sr,this.hr)*this.rr,n=this.nr-e;this.er.setStretchFactor(e),this.or.setStretchFactor(n),this.ur.adjustSize(),this.er.getSize().h!==i&&(this.Qh=t.pageY)},t.prototype.br=function(t){this.Qh=0,this.tr=0,this.ir=0,this.nr=0,this.sr=0,this.hr=0,this.rr=0},t}(),Oe=function(){function t(t,i,e,n){this.$t=new Kt(200),this.Zt=0,this.mr="",this.pr="",this.gr=[],this.yr=new Map,this.Zt=t,this.mr=i,this.pr=Ii(t,e,n)}return t.prototype.destroy=function(){delete this.$t,this.gr=[],this.yr.clear()},t.prototype.paintTo=function(t,i,e,n,r){var s=this.kr(t,i);if("left"!==r){var o=be(t.canvas);e-=Math.floor(s.textWidth*o)}n-=Math.floor(s.height/2),t.drawImage(s.canvas,e,n,s.width,s.height)},t.prototype.kr=function(t,i){var e,n=this;if(this.yr.has(i))e=m(this.yr.get(i));else{if(this.gr.length>=200){var r=m(this.gr.shift());this.yr.delete(r)}var s=be(t.canvas),o=Math.ceil(this.Zt/4.5),h=Math.round(this.Zt/10),a=Math.ceil(this.$t.measureText(t,i)),u=ft(Math.round(a+2*o)),l=ft(this.Zt+2*o),c=Me(document,new ge(u,l));e={text:i,textWidth:Math.round(Math.max(1,a)),width:Math.ceil(u*s),height:Math.ceil(l*s),canvas:c},0!==a&&(this.gr.push(e.text),this.yr.set(e.text,e)),H(t=Se(e.canvas),s,(function(){t.font=n.pr,t.fillStyle=n.mr,t.fillText(i,0,l-o-h)}))}return e},t}();!function(t){t[t.Default=0]="Default",t[t.NsResize=1]="NsResize"}(ze||(ze={}));var Be,Ie,Ne=function(){function t(t,i,e,n){var r=this;this.B=null,this.Nr=null,this.Sr=null,this.xr=!1,this.Dr=!0,this.Cr=new Kt(50),this.Tr=new Oe(11,"#000"),this.mr=null,this.pr=null,this.Er=0,this.Lr=function(){r.Ar(r.ah.options()),r.I.chart().model().lightUpdate()},this.Br=function(){r.I.chart().model().lightUpdate()},this.I=t,this.$=i,this.ah=e,this.zr="left"===n,this.cr=document.createElement("div"),this.cr.style.height="100%",this.cr.style.overflow="hidden",this.cr.style.width="25px",this.cr.style.left="0",this.cr.style.position="relative",this.Vr=xe(this.cr,new ge(16,16)),this.Vr.subscribeCanvasConfigured(this.Lr);var s=this.Vr.canvas;s.style.position="absolute",s.style.zIndex="1",s.style.left="0",s.style.top="0",this.Fr=xe(this.cr,new ge(16,16)),this.Fr.subscribeCanvasConfigured(this.Br);var o=this.Fr.canvas;o.style.position="absolute",o.style.zIndex="2",o.style.left="0",o.style.top="0";var h={mouseDownEvent:this.Mr.bind(this),pressedMouseMoveEvent:this.wr.bind(this),mouseDownOutsideEvent:this.Pr.bind(this),mouseUpEvent:this.br.bind(this),mouseDoubleClickEvent:this.Ir.bind(this),mouseEnterEvent:this.Or.bind(this),mouseLeaveEvent:this.Rr.bind(this)};this.dr=new Le(this.Fr.canvas,h,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0})}return t.prototype.destroy=function(){this.dr.destroy(),this.Fr.unsubscribeCanvasConfigured(this.Br),this.Fr.destroy(),this.Vr.unsubscribeCanvasConfigured(this.Lr),this.Vr.destroy(),null!==this.B&&(this.B.onMarksChanged().unsubscribeAll(this),this.B.optionsChanged().unsubscribeAll(this)),this.B=null,null!==this.Sr&&(clearTimeout(this.Sr),this.Sr=null),this.Tr.destroy()},t.prototype.getElement=function(){return this.cr},t.prototype.backgroundColor=function(){return this.$.backgroundColor},t.prototype.lineColor=function(){return this.I.chart().options().priceScale.borderColor},t.prototype.textColor=function(){return this.$.textColor},t.prototype.fontSize=function(){return this.$.fontSize},t.prototype.baseFont=function(){return Ii(this.fontSize(),this.$.fontFamily)},t.prototype.rendererOptions=function(){var t=this.ah.options(),i=this.mr!==t.color,e=this.pr!==t.font;return(i||e)&&(this.Ar(t),this.mr=t.color),e&&(this.Cr.reset(),this.pr=t.font),t},t.prototype.optimalWidth=function(){if(!this.isVisible()||null===this.B)return 0;var t=34,i=this.rendererOptions(),e=Se(this.Vr.canvas),n=this.B.marks();e.font=this.baseFont(),n.length>0&&(t=Math.max(this.Cr.measureText(e,n[0].label),this.Cr.measureText(e,n[n.length-1].label)));for(var r=this.Wr(),s=r.length;s--;){var o=this.Cr.measureText(e,r[s].text());o>t&&(t=o)}var h=Math.ceil(i.borderSize+i.tickLength+i.paddingInner+i.paddingOuter+t);return h+h%2},t.prototype.setSize=function(t){if(t.w<0||t.h<0)throw new Error("Try to set invalid size to PriceAxisWidget "+JSON.stringify(t));null!==this.Nr&&this.Nr.equals(t)||(this.Nr=t,this.Vr.resizeCanvas({width:t.w,height:t.h}),this.Fr.resizeCanvas({width:t.w,height:t.h}),this.cr.style.width=t.w+"px",this.cr.style.height=t.h+"px",this.cr.style.minWidth=t.w+"px")},t.prototype.getWidth=function(){return y(this.Nr).w},t.prototype.setPriceScale=function(t){this.B!==t&&(null!==this.B&&(this.B.onMarksChanged().unsubscribeAll(this),this.B.optionsChanged().unsubscribeAll(this)),this.B=t,t.onMarksChanged().subscribe(this.cn.bind(this),this))},t.prototype.priceScale=function(){return this.B},t.prototype.isVisible=function(){return this.Dr},t.prototype.setVisible=function(t){t!==this.Dr&&(this.cr.style.display=t?"table-cell":"none",this.Dr=t)},t.prototype.setAutoScale=function(t){var i=this.I.state();this.I.chart().model().setPriceAutoScale(i,y(this.priceScale()),t)},t.prototype.reset=function(){var t=this.I.state();this.I.chart().model().resetPriceScale(t,y(this.priceScale()))},t.prototype.paint=function(t){if(this.Dr&&null!==this.Nr){if(1!==t){var i=Se(this.Vr.canvas);this.Ur(),this.qr(i,this.Vr.pixelRatio),this.Lt(i,this.Vr.pixelRatio),this.jr(i,this.Vr.pixelRatio),this.Hr(i,this.Vr.pixelRatio)}var e=Se(this.Fr.canvas),n=this.Nr.w,r=this.Nr.h;H(e,this.Fr.pixelRatio,(function(){e.clearRect(0,0,n,r)})),this.Yr(e,this.Fr.pixelRatio)}},t.prototype.getImage=function(){return this.Vr.canvas},t.prototype.isLeft=function(){return this.zr},t.prototype.Mr=function(t){if(null!==this.B&&!this.B.isEmpty()&&this.I.chart().options().handleScale.axisPressedMouseMove){var i=this.I.chart().model(),e=this.I.state();this.xr=!0,i.startScalePrice(e,this.B,t.localY)}},t.prototype.wr=function(t){if(null!==this.B&&this.I.chart().options().handleScale.axisPressedMouseMove){var i=this.I.chart().model(),e=this.I.state(),n=this.B;i.scalePriceTo(e,n,t.localY)}},t.prototype.Pr=function(){if(null!==this.B&&this.I.chart().options().handleScale.axisPressedMouseMove){var t=this.I.chart().model(),i=this.I.state(),e=this.B;this.xr&&(this.xr=!1,t.endScalePrice(i,e))}},t.prototype.br=function(t){if(null!==this.B&&this.I.chart().options().handleScale.axisPressedMouseMove){var i=this.I.chart().model(),e=this.I.state();this.xr=!1,i.endScalePrice(e,this.B)}},t.prototype.Ir=function(t){this.I.chart().options().handleScale.axisDoubleClickReset&&this.reset()},t.prototype.Or=function(t){null!==this.B&&(!this.I.chart().model().options().handleScale.axisPressedMouseMove||this.B.isPercentage()||this.B.isIndexedTo100()||this.Kr(1))},t.prototype.Rr=function(t){this.Kr(0)},t.prototype.Wr=function(){var t=this,i=[],e=null===this.B?void 0:this.B;return function(n){for(var r=0;r0&&(t=r[0].coordinate())}));var h=i.filter((function(i){return i.coordinate()<=t})),a=i.filter((function(i){return i.coordinate()>t}));if(h.sort((function(t,i){return i.coordinate()-t.coordinate()})),h.length&&a.length&&a.push(h[0]),a.sort((function(t,i){return t.coordinate()-i.coordinate()})),i.forEach((function(t){return t.setFixedCoordinate(t.coordinate())})),this.B.options().alignLabels){for(var u=1;u(d=f.getFixedCoordinate())-c&&l.setFixedCoordinate(d-c)}for(var p=1;p1&&this.recalculatePriceScale(),null!==this.$r&&this.$r.paint(t),1!==t){var i=Se(this.Vr.canvas);i.save(),this.qr(i,this.mu(),this.Vr.pixelRatio),this.su&&(this.pu(i,this.Vr.pixelRatio),this.gu(i,this.Vr.pixelRatio),this.yu(i,this.Vr.pixelRatio)),i.restore()}var e=Se(this.Fr.canvas);e.clearRect(0,0,Math.ceil(this.Nr.w*this.Fr.pixelRatio),Math.ceil(this.Nr.h*this.Fr.pixelRatio)),this.ku(e,this.Fr.pixelRatio)}},t.prototype.priceAxisWidget=function(){return this.$r},t.prototype.mu=function(){return this.hu.options().layout.backgroundColor},t.prototype.ru=function(){null!==this.su&&this.su.onDestroyed().unsubscribeAll(this),this.su=null},t.prototype.qr=function(t,i,e){var n=this;H(t,e,(function(){q(t,0,0,n.Nr.w,n.Nr.h,i)}))},t.prototype.pu=function(t,i){for(var e=y(this.su),n=this.F().gridSource().paneViews(e),r=e.height(),s=e.width(),o=0,h=n;oi.span?t:i}!function(t){t[t.BorderSize=1]="BorderSize",t[t.TickLength=3]="TickLength"}(Be||(Be={})),function(t){t[t.Default=0]="Default",t[t.EwResize=1]="EwResize"}(Ie||(Ie={}));var je=function(){function t(t){var i=this;this.Tu=null,this.Eu=70,this.Ht=null,this.Lu=!1,this.Nr=new ge(0,0),this.Zr="none",this.Lr=function(){return i.hu.model().lightUpdate()},this.Br=function(){return i.hu.model().lightUpdate()},this.hu=t,this.$=t.options().layout,this.Au=document.createElement("tr"),this.Bu=document.createElement("td"),this.Bu.style.padding="0",this.zu=document.createElement("td"),this.zu.style.padding="0",this.cr=document.createElement("td"),this.cr.style.height="25px",this.cr.style.padding="0",this.Vu=document.createElement("div"),this.Vu.style.width="100%",this.Vu.style.height="100%",this.Vu.style.position="relative",this.Vu.style.overflow="hidden",this.cr.appendChild(this.Vu),this.Vr=xe(this.Vu,new ge(16,16)),this.Vr.subscribeCanvasConfigured(this.Lr);var e=this.Vr.canvas;e.style.position="absolute",e.style.zIndex="1",e.style.left="0",e.style.top="0",this.Fr=xe(this.Vu,new ge(16,16)),this.Fr.subscribeCanvasConfigured(this.Br);var n=this.Fr.canvas;n.style.position="absolute",n.style.zIndex="2",n.style.left="0",n.style.top="0",this.Au.appendChild(this.Bu),this.Au.appendChild(this.cr),this.Au.appendChild(this.zu),this.Fu(),this.hu.model().mainPriceScaleOptionsChanged().subscribe(this.Fu.bind(this),this),this.dr=new Le(this.Fr.canvas,this,{treatVertTouchDragAsPageScroll:!0,treatHorzTouchDragAsPageScroll:!1})}return t.prototype.destroy=function(){this.dr.destroy(),null!==this.Tu&&this.Tu.destroy(),this.Fr.unsubscribeCanvasConfigured(this.Br),this.Fr.destroy(),this.Vr.unsubscribeCanvasConfigured(this.Lr),this.Vr.destroy()},t.prototype.getElement=function(){return this.Au},t.prototype.stub=function(){return this.Tu},t.prototype.mouseDownEvent=function(t){if(!this.Lu){this.Lu=!0;var i=this.hu.model();!i.timeScale().isEmpty()&&this.hu.options().handleScale.axisPressedMouseMove&&i.startScaleTime(t.localX)}},t.prototype.mouseDownOutsideEvent=function(){var t=this.hu.model();!t.timeScale().isEmpty()&&this.Lu&&(this.Lu=!1,this.hu.options().handleScale.axisPressedMouseMove&&t.endScaleTime())},t.prototype.pressedMouseMoveEvent=function(t){var i=this.hu.model();!i.timeScale().isEmpty()&&this.hu.options().handleScale.axisPressedMouseMove&&i.scaleTimeTo(t.localX)},t.prototype.mouseUpEvent=function(t){this.Lu=!1;var i=this.hu.model();i.timeScale().isEmpty()&&!this.hu.options().handleScale.axisPressedMouseMove||i.endScaleTime()},t.prototype.mouseDoubleClickEvent=function(){this.hu.options().handleScale.axisDoubleClickReset&&this.hu.model().resetTimeScale()},t.prototype.mouseEnterEvent=function(t){this.hu.model().options().handleScale.axisPressedMouseMove&&this.Kr(1)},t.prototype.mouseLeaveEvent=function(t){this.Kr(0)},t.prototype.getSize=function(){return this.Nr},t.prototype.setSizes=function(t,i){this.Nr&&this.Nr.equals(t)||(this.Nr=t,this.Vr.resizeCanvas({width:t.w,height:t.h}),this.Fr.resizeCanvas({width:t.w,height:t.h}),this.cr.style.width=t.w+"px",this.cr.style.height=t.h+"px"),null!==this.Tu&&this.Tu.setSize(new ge(i,t.h))},t.prototype.width=function(){return this.Nr.w},t.prototype.height=function(){return this.Nr.h},t.prototype.optimalHeight=function(){var t=this.Pu();return Math.ceil(t.borderSize+t.tickLength+t.fontSize+t.paddingTop+t.paddingBottom)},t.prototype.update=function(){var t=this,i=this.hu.model().timeScale().marks();i&&(this.Eu=70,i.forEach((function(i){t.Eu=Math.min(i.span,t.Eu)})))},t.prototype.getImage=function(){return this.Vr.canvas},t.prototype.paint=function(t){if(0!==t){if(1!==t){var i=Se(this.Vr.canvas);this.qr(i,this.Vr.pixelRatio),this.Lt(i,this.Vr.pixelRatio),this.jr(i,this.Vr.pixelRatio),this.Hr(i,this.Vr.pixelRatio),null!==this.Tu&&this.Tu.paint(t)}var e=Se(this.Fr.canvas);this.Yr(e,this.Fr.pixelRatio)}},t.prototype.qr=function(t,i){var e=this;H(t,i,(function(){q(t,0,0,e.Nr.w,e.Nr.h,e.mu())}))},t.prototype.Lt=function(t,i){if(this.hu.options().timeScale.borderVisible){t.save(),t.fillStyle=this.Iu();var e=Math.max(1,Math.floor(this.Pu().borderSize*i));t.fillRect(0,0,Math.ceil(this.Nr.w*i),e),t.restore()}},t.prototype.jr=function(t,i){var e=this,n=this.hu.model().timeScale().marks();if(n&&0!==n.length){var r=n.reduce(Ye,n[0]).span;r>30&&r<40&&(r=30),t.save(),t.strokeStyle=this.Iu();var s=this.Pu(),o=s.borderSize+s.tickLength+s.paddingTop+s.fontSize-s.baselineOffset;t.textAlign="center",t.fillStyle=this.Iu();var h=Math.floor(this.Pu().borderSize*i),a=Math.max(1,Math.floor(i)),u=Math.floor(.5*i);if(this.hu.model().timeScale().options().borderVisible){t.beginPath();for(var l=Math.round(s.tickLength*i),c=n.length;c--;){var p=Math.round(n[c].coord*i);t.rect(p-u,h,a,l)}t.fill()}t.fillStyle=this.Pn(),H(t,i,(function(){t.font=e.Ou();for(var i=0,s=n;i=r&&t.fillText(u.label,u.coord,o)}}))}},t.prototype.Hr=function(t,i){t.save();var e=new Set,n=this.hu.model(),r=n.dataSources();e.add(n.crosshairSource());for(var s=this.Pu(),o=0,h=r;o1){var s=new Ae(this,n-1,n,!0);this.Uu.push(s),this.$u.insertBefore(s.getElement(),this.Ju.getElement())}this.$u.insertBefore(r.getElement(),this.Ju.getElement())}for(n=0;n=0;--r)if(Math.floor(e.getTime()/rn[r].divisor)!==Math.floor(n.getTime()/rn[r].divisor))return rn[r].span}return 20}function on(t,i){return t.timestamp0&&r.set(i,t)})),this.ae(r)},t.prototype.removeSeries=function(t){return this.setSeriesData(t,[])},t.prototype.updateSeriesData=function(t,i){an(i);var e=t.data().bars();if(e.size()>0)if(void 0!==y(e.last()).time.businessDay){if(!Oi(i.time))throw new Error("time must be of type BusinessDay")}else if(!Bi(i.time))throw new Error("time must be of type isUTCTimestamp");var n=y(Xe([i]))(i.time),r=this.ee.get(n.timestamp)||{index:0,mapping:new Map,timePoint:n},s=0===r.mapping.size;r.mapping.set(t,i);var o=!1;if(s){var h=this.ee.size;this.fe.length>0&&this.fe[this.fe.length-1].timestamp>n.timestamp?(h=Et(this.fe,n,on),this.fe.splice(h,0,n),this.ce(h),o=!0):this.fe.push(n),r.index=h,this.oe.set(r.index,n)}this.ee.set(n.timestamp,r);var a=new Map,u=function(i){var e=m(l.oe.get(i));m(l.ee.get(e.timestamp)).mapping.forEach((function(n,r){if(o||r===t){var s=tn(r.seriesType()),h=a.get(r)||{update:[]},u={index:i,time:e,value:s(n,r.palette())};h.update.push(u),a.set(r,h)}}))},l=this;for(h=r.index;h=t;--i){var e=m(this.oe.get(i)),n=i+1;m(this.ee.get(e.timestamp)).index=n,this.oe.delete(i),this.oe.set(n,e)}},t.prototype.ve=function(){var t=this;this.oe.clear(),this.ee.forEach((function(i,e){t.oe.set(i.index,i.timePoint)}))},t.prototype.le=function(t){for(var i=[],e=this.oe.get(t-1)||null,n=t;n=1)return 0;for(var i=0;i<8;i++){var e=Math.round(t);if(Math.abs(e-t)<1e-8)return i;t*=10}return i}(i.minMove))}}function kn(t){var i=t.handleScale;C(i)&&(t.handleScale={axisDoubleClickReset:i,axisPressedMouseMove:i,mouseWheel:i,pinch:i});var e=t.handleScroll;return C(e)&&(t.handleScroll={horzTouchDrag:e,vertTouchDrag:e,mouseWheel:e,pressedMouseMove:e}),t}var Pn=function(){function t(t,i){var e=this;this.de=new ln,this.Me=new ht,this.we=new Map,this.be=new Map,this.me=new ht,this.pe=new ht;var n=void 0===i?T(vn):b(T(vn),kn(i));this.ur=new He(t,n),this.ur.model().timeScale().visibleBarsChanged().subscribe(this.ge.bind(this)),this.ur.clicked().subscribe((function(t){e.me.hasListeners()&&e.me.fire(e.ye(t()))}),this),this.ur.crosshairMoved().subscribe((function(t){e.pe.hasListeners()&&e.pe.fire(e.ye(t()))}),this);var r=this.ur.model();this.ke=new Mn(r),this.Ne=new xn(r)}return t.prototype.remove=function(){this.ur.model().timeScale().visibleBarsChanged().unsubscribeAll(this),this.ur.clicked().unsubscribeAll(this),this.ur.crosshairMoved().unsubscribeAll(this),this.ke.destroy(),this.Ne.destroy(),this.ur.destroy(),delete this.ur,this.we.forEach((function(t,i){i.destroy()})),this.we.clear(),this.be.clear(),this.Me.destroy(),this.me.destroy(),this.pe.destroy(),this.de.destroy(),delete this.de},t.prototype.resize=function(t,i,e){this.ur.resize(t,i,e)},t.prototype.addAreaSeries=function(t){void 0===t&&(t={}),Tn(t.priceFormat);var i=b(T(wn),bn,t),e=this.ur.model().createSeries("Area",i),n=new fn(e,this);return this.we.set(n,e),this.be.set(e,n),n},t.prototype.addBarSeries=function(t){void 0===t&&(t={}),Tn(t.priceFormat);var i=b(T(wn),yn,t),e=this.ur.model().createSeries("Bar",i),n=new fn(e,this);return this.we.set(n,e),this.be.set(e,n),n},t.prototype.addCandlestickSeries=function(t){void 0===t&&(t={}),Ai(t),Tn(t.priceFormat);var i=b(T(wn),mn,t),e=this.ur.model().createSeries("Candlestick",i),n=new dn(e,this);return this.we.set(n,e),this.be.set(e,n),n},t.prototype.addHistogramSeries=function(t){void 0===t&&(t={}),Tn(t.priceFormat);var i=b(T(wn),Sn,t),e=this.ur.model().createSeries("Histogram",i),n=new fn(e,this);return this.we.set(n,e),this.be.set(e,n),n},t.prototype.addLineSeries=function(t){void 0===t&&(t={}),Tn(t.priceFormat);var i=b(T(wn),gn,t),e=this.ur.model().createSeries("Line",i),n=new fn(e,this);return this.we.set(n,e),this.be.set(e,n),n},t.prototype.removeSeries=function(t){var i=t,e=m(this.we.get(i)),n=this.de.removeSeries(e),r=this.ur.model();r.removeSeries(e);var s=n.timeScaleUpdate;r.updateTimeScale(s.index,s.changes,s.marks,!0),s.seriesUpdates.forEach((function(t,i){i.updateData(t.update)})),r.updateTimeScaleBaseIndex(0),this.we.delete(i),this.be.delete(e)},t.prototype.applyNewData=function(t,i){var e=this.de.setSeriesData(t,i),n=this.ur.model(),r=e.timeScaleUpdate;n.updateTimeScale(r.index,r.changes,r.marks,!0),r.seriesUpdates.forEach((function(t,i){i.updateData(t.update,!0)})),n.updateTimeScaleBaseIndex(0)},t.prototype.updateData=function(t,i){var e=this.de.updateSeriesData(t,i),n=this.ur.model(),r=e.timeScaleUpdate;n.updateTimeScale(r.index,r.changes,r.marks,!1),r.seriesUpdates.forEach((function(t,i){i.updateData(t.update)})),n.updateTimeScaleBaseIndex(0)},t.prototype.subscribeClick=function(t){this.me.subscribe(t)},t.prototype.unsubscribeClick=function(t){this.me.unsubscribe(t)},t.prototype.subscribeCrosshairMove=function(t){this.pe.subscribe(t)},t.prototype.unsubscribeCrosshairMove=function(t){this.pe.unsubscribe(t)},t.prototype.subscribeVisibleTimeRangeChange=function(t){this.Me.subscribe(t)},t.prototype.unsubscribeVisibleTimeRangeChange=function(t){this.Me.unsubscribe(t)},t.prototype.priceScale=function(){return this.ke},t.prototype.timeScale=function(){return this.Ne},t.prototype.applyOptions=function(t){this.ur.applyOptions(kn(t))},t.prototype.options=function(){return this.ur.options()},t.prototype.takeScreenshot=function(){return this.ur.takeScreenshot()},t.prototype.ge=function(){this.Me.hasListeners()&&this.Me.fire(this.timeScale().getVisibleRange())},t.prototype.Se=function(t){return m(this.be.get(t))},t.prototype.ye=function(t){var i=this,e=new Map;t.seriesPrices.forEach((function(t,n){e.set(i.Se(n),t)}));var n=void 0===t.hoveredSeries?void 0:this.Se(t.hoveredSeries);return{time:t.time&&(t.time.businessDay||t.time.timestamp),point:t.point,hoveredSeries:n,hoveredMarkerId:t.hoveredObject,seriesPrices:e}},t}();function _n(t,i){var e=y(M(t)?document.getElementById(t):t);return new Pn(e,i)}function En(){return"2.0.0"}var Ln=e(1),Rn=e.n(Ln);function Vn(t){return(Vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Fn(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);i&&(n=n.filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable}))),e.push.apply(e,n)}return e}function Dn(t){for(var i=1;i