dipping-charts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +216 -0
- package/dist/__tests__/FullFeaturedChart.test.d.ts +2 -0
- package/dist/__tests__/FullFeaturedChart.test.d.ts.map +1 -0
- package/dist/__tests__/indicators-accuracy.test.d.ts +2 -0
- package/dist/__tests__/indicators-accuracy.test.d.ts.map +1 -0
- package/dist/__tests__/indicators.test.d.ts +2 -0
- package/dist/__tests__/indicators.test.d.ts.map +1 -0
- package/dist/__tests__/setup.d.ts +1 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/__tests__/validateCandle.test.d.ts +2 -0
- package/dist/__tests__/validateCandle.test.d.ts.map +1 -0
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/index.js +5 -0
- package/dist/chart/index.js.map +1 -0
- package/dist/components/TradingChart.d.ts +24 -0
- package/dist/components/TradingChart.d.ts.map +1 -0
- package/dist/components/TradingChart.js +100 -0
- package/dist/components/TradingChart.js.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/dipping-charts.css +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/indicators/atr.d.ts +15 -0
- package/dist/indicators/atr.d.ts.map +1 -0
- package/dist/indicators/atr.js +30 -0
- package/dist/indicators/atr.js.map +1 -0
- package/dist/indicators/bollingerBands.d.ts +11 -0
- package/dist/indicators/bollingerBands.d.ts.map +1 -0
- package/dist/indicators/bollingerBands.js +39 -0
- package/dist/indicators/bollingerBands.js.map +1 -0
- package/dist/indicators/currencyStrength.d.ts +43 -0
- package/dist/indicators/currencyStrength.d.ts.map +1 -0
- package/dist/indicators/currencyStrength.js +53 -0
- package/dist/indicators/currencyStrength.js.map +1 -0
- package/dist/indicators/ema.d.ts +11 -0
- package/dist/indicators/ema.d.ts.map +1 -0
- package/dist/indicators/ema.js +24 -0
- package/dist/indicators/ema.js.map +1 -0
- package/dist/indicators/index.d.ts +19 -0
- package/dist/indicators/index.d.ts.map +1 -0
- package/dist/indicators/index.js +23 -0
- package/dist/indicators/index.js.map +1 -0
- package/dist/indicators/macd.d.ts +11 -0
- package/dist/indicators/macd.d.ts.map +1 -0
- package/dist/indicators/macd.js +52 -0
- package/dist/indicators/macd.js.map +1 -0
- package/dist/indicators/rsi.d.ts +11 -0
- package/dist/indicators/rsi.d.ts.map +1 -0
- package/dist/indicators/rsi.js +29 -0
- package/dist/indicators/rsi.js.map +1 -0
- package/dist/indicators/sma.d.ts +13 -0
- package/dist/indicators/sma.d.ts.map +1 -0
- package/dist/indicators/sma.js +22 -0
- package/dist/indicators/sma.js.map +1 -0
- package/dist/indicators/stochastic.d.ts +15 -0
- package/dist/indicators/stochastic.d.ts.map +1 -0
- package/dist/indicators/stochastic.js +34 -0
- package/dist/indicators/stochastic.js.map +1 -0
- package/dist/indicators/types.d.ts +102 -0
- package/dist/indicators/types.d.ts.map +1 -0
- package/dist/indicators/vwap.d.ts +14 -0
- package/dist/indicators/vwap.d.ts.map +1 -0
- package/dist/indicators/vwap.js +17 -0
- package/dist/indicators/vwap.js.map +1 -0
- package/dist/indicators/williamsR.d.ts +17 -0
- package/dist/indicators/williamsR.d.ts.map +1 -0
- package/dist/indicators/williamsR.js +19 -0
- package/dist/indicators/williamsR.js.map +1 -0
- package/dist/react/FullFeaturedChart.d.ts +3 -0
- package/dist/react/FullFeaturedChart.d.ts.map +1 -0
- package/dist/react/FullFeaturedChart.js +640 -0
- package/dist/react/FullFeaturedChart.js.map +1 -0
- package/dist/react/components/IndicatorSettings.d.ts +20 -0
- package/dist/react/components/IndicatorSettings.d.ts.map +1 -0
- package/dist/react/components/IndicatorSettings.js +748 -0
- package/dist/react/components/IndicatorSettings.js.map +1 -0
- package/dist/react/hooks/useChart.d.ts +15 -0
- package/dist/react/hooks/useChart.d.ts.map +1 -0
- package/dist/react/hooks/useChart.js +155 -0
- package/dist/react/hooks/useChart.js.map +1 -0
- package/dist/react/hooks/useIndicators.d.ts +10 -0
- package/dist/react/hooks/useIndicators.d.ts.map +1 -0
- package/dist/react/hooks/useIndicators.js +264 -0
- package/dist/react/hooks/useIndicators.js.map +1 -0
- package/dist/react/hooks/useLineTools.d.ts +26 -0
- package/dist/react/hooks/useLineTools.d.ts.map +1 -0
- package/dist/react/hooks/useLineTools.js +189 -0
- package/dist/react/hooks/useLineTools.js.map +1 -0
- package/dist/react/hooks/useShiftSnap.d.ts +12 -0
- package/dist/react/hooks/useShiftSnap.d.ts.map +1 -0
- package/dist/react/hooks/useShiftSnap.js +54 -0
- package/dist/react/hooks/useShiftSnap.js.map +1 -0
- package/dist/react/index.d.ts +14 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +18 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/loadLightweightCharts.d.ts +18 -0
- package/dist/react/loadLightweightCharts.d.ts.map +1 -0
- package/dist/react/loadLightweightCharts.js +32 -0
- package/dist/react/loadLightweightCharts.js.map +1 -0
- package/dist/react/locale.d.ts +79 -0
- package/dist/react/locale.d.ts.map +1 -0
- package/dist/react/locale.js +158 -0
- package/dist/react/locale.js.map +1 -0
- package/dist/react/types.d.ts +130 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +24 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/getToolId.d.ts +9 -0
- package/dist/utils/getToolId.d.ts.map +1 -0
- package/dist/utils/getToolId.js +12 -0
- package/dist/utils/getToolId.js.map +1 -0
- package/dist/utils/mockData.d.ts +10 -0
- package/dist/utils/mockData.d.ts.map +1 -0
- package/dist/utils/mockData.js +61 -0
- package/dist/utils/mockData.js.map +1 -0
- package/dist/utils/snapCrosshair.d.ts +25 -0
- package/dist/utils/snapCrosshair.d.ts.map +1 -0
- package/dist/utils/validateCandle.d.ts +30 -0
- package/dist/utils/validateCandle.d.ts.map +1 -0
- package/dist/utils/validateCandle.js +21 -0
- package/dist/utils/validateCandle.js.map +1 -0
- package/examples/css/base.css +209 -0
- package/examples/css/chart.css +282 -0
- package/examples/css/indicators.css +255 -0
- package/examples/index.html +163 -0
- package/examples/js/chart.js +370 -0
- package/examples/js/indicators.js +27 -0
- package/examples/js/main.js +6 -0
- package/examples/js/ui.js +1641 -0
- package/lib/lightweight-charts.standalone.production.js +7 -0
- package/package.json +106 -0
- package/src/react/FullFeaturedChart.css +1007 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @license
|
|
3
|
+
* TradingView Lightweight Charts v3.8.0-dev+202511100116
|
|
4
|
+
* Copyright (c) 2020 TradingView, Inc.
|
|
5
|
+
* Licensed under Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*/
|
|
7
|
+
!function(){"use strict";var t,i,n,s=function(){function t(t,i){this.x=t,this.y=i}return t.prototype.add=function(i){return new t(this.x+i.x,this.y+i.y)},t.prototype.addScaled=function(i,n){return new t(this.x+n*i.x,this.y+n*i.y)},t.prototype.subtract=function(i){return new t(this.x-i.x,this.y-i.y)},t.prototype.dotProduct=function(t){return this.x*t.x+this.y*t.y},t.prototype.crossProduct=function(t){return this.x*t.y-this.y*t.x},t.prototype.signedAngle=function(t){return Math.atan2(this.crossProduct(t),this.dotProduct(t))},t.prototype.angle=function(t){return Math.acos(this.dotProduct(t)/(this.length()*t.length()))},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.scaled=function(i){return new t(this.x*i,this.y*i)},t.prototype.normalized=function(){return this.scaled(1/this.length())},t.prototype.transposed=function(){return new t(-this.y,this.x)},t.prototype.clone=function(){return new t(this.x,this.y)},t}(),h=function(t,i){this.t=new s(Math.min(t.x,i.x),Math.min(t.y,i.y)),this.i=new s(Math.max(t.x,i.x),Math.max(t.y,i.y))},r=function(t,i){this.h=t,this.u=i};function e(t,i){return t.x===i.x&&t.y===i.y}function u(t,i){if(e(t,i))throw new Error("Points should be distinct");return function(t,i,n){return{o:t,l:i,v:n}}(t.y-i.y,i.x-t.x,t.x*i.y-i.x*t.y)}function o(t,i){if(e(t,i))throw new Error("Points of a segment should be distinct");return[t,i]}function l(t,i){var n=i.h;return n.o*t.x+n.l*t.y+n.v>0===i.u}function a(t,i){for(var n=0;n<t.length;n++)if(e(t[n],i))return!1;return t.push(i),!0}function f(t,i,n){var h=c(t,i,n.t,new s(n.i.x,n.t.y)),r=c(t,i,new s(n.i.x,n.t.y),n.i),e=c(t,i,n.i,new s(n.t.x,n.i.y)),u=c(t,i,new s(n.t.x,n.i.y),n.t),o=[];if(null!==h&&h>=0&&o.push(h),null!==r&&r>=0&&o.push(r),null!==e&&e>=0&&o.push(e),null!==u&&u>=0&&o.push(u),0===o.length)return null;o.sort(function(t,i){return t-i});var l=_(t,n)?o[0]:o[o.length-1];return t.addScaled(i.subtract(t),l)}function c(t,i,n,s){var h=function(t,i,n,s){var h=i.subtract(t),r=s.subtract(n),e=h.x*r.y-h.y*r.x;if(Math.abs(e)<1e-6)return null;var u=t.subtract(n);return(u.y*r.x-u.x*r.y)/e}(t,i,n,s);if(null===h)return null;var r=d(n,s,i.subtract(t).scaled(h).add(t));return Math.abs(r._)<1e-6?h:null}function v(t,i,n){var s=i.subtract(t),h=n.subtract(t).dotProduct(s)/s.dotProduct(s);return{M:h,_:t.addScaled(s,h).subtract(n).length()}}function d(t,i,n){var s=v(t,i,n);if(0<=s.M&&s.M<=1)return s;var h=t.subtract(n).length(),r=i.subtract(n).length();return h<r?{M:0,_:h}:{M:1,_:r}}function _(t,i){return t.x>=i.t.x&&t.x<=i.i.x&&t.y>=i.t.y&&t.y<=i.i.y}function w(t,i){for(var n=t.x,s=t.y,h=!1,r=i.length-1,e=0;e<i.length;e++){var u=i[e],o=i[r];r=e,(u.y<s&&o.y>=s||o.y<s&&u.y>=s)&&u.x+(s-u.y)/(o.y-u.y)*(o.x-u.x)<n&&(h=!h)}return h}function b(t,i){var n=t.o*i.l-i.o*t.l;if(Math.abs(n)<1e-6)return null;var h=(t.l*i.v-i.l*t.v)/n,r=(i.o*t.v-t.o*i.v)/n;return new s(h,r)}function M(t,i){return!(t.length<=0||!e(t[t.length-1],i)||!e(t[0],i))||(t.push(i),!1)}function m(t){return[[t.lineWidth,t.lineWidth],[2*t.lineWidth,2*t.lineWidth],[6*t.lineWidth,6*t.lineWidth],[t.lineWidth,4*t.lineWidth],[2*t.lineWidth,t.lineWidth]][t.lineStyle-1]||[]}function p(t){var i=1;switch(t){case 1:i=3.5;break;case 2:i=2;break;case 3:i=1.5;break;case 4:i=1.25}return i}function g(t,i){t.lineStyle=i,k(t,m(t))}function k(t,i){t.setLineDash?t.setLineDash(i):void 0!==t.mozDash?t.mozDash=i:void 0!==t.webkitLineDash&&(t.webkitLineDash=i)}function y(t,i,n,s){t.beginPath();var h=t.lineWidth%2?.5:0;t.moveTo(n,i+h),t.lineTo(s,i+h),t.stroke()}function x(t,i,n,s){t.beginPath();var h=t.lineWidth%2?.5:0;t.moveTo(i+h,n),t.lineTo(i+h,s),t.stroke()}function N(t,i,n,s,h){isFinite(i)&&isFinite(n)&&isFinite(s)&&isFinite(h)&&(0!==t.lineStyle?function(t,i,n,s,h){t.save(),t.beginPath(),k(t,m(t)),t.moveTo(i,n),t.lineTo(s,h),t.stroke(),t.restore()}(t,i,n,s,h):function(t,i,n,s,h){t.beginPath(),t.moveTo(i,n),t.lineTo(s,h),t.stroke()}(t,i,n,s,h))}function S(t,i,n,r,l,c){if(e(t,i))return null;var v=new s(0,0),d=new s(n,r);if(l){if(c){var _=function(t,i){if(0===t.o){var n=-t.v/t.l;return i.t.y<=n&&n<=i.i.y?o(new s(i.t.x,n),new s(i.i.x,n)):null}if(0===t.l){var h=-t.v/t.o;return i.t.x<=h&&h<=i.i.x?o(new s(h,i.t.y),new s(h,i.i.y)):null}var r=[],u=function(n){var h=-(t.v+t.o*n)/t.l;i.t.y<=h&&h<=i.i.y&&a(r,new s(n,h))},l=function(n){var h=-(t.v+t.l*n)/t.o;i.t.x<=h&&h<=i.i.x&&a(r,new s(h,n))};switch(u(i.t.x),l(i.t.y),u(i.i.x),l(i.i.y),r.length){case 0:return null;case 1:return r[0];case 2:return e(r[0],r[1])?r[0]:o(r[0],r[1])}throw new Error("We should have at most two intersection points")}(u(t,i),new h(v,d));return Array.isArray(_)?_:null}var w;return null===(w=f(i,t,new h(v,d)))||e(i,w)?null:o(i,w)}if(c)return null===(w=f(t,i,new h(v,d)))||e(t,w)?null:o(t,w);_=function(t,i){var n=t[0].x,h=t[0].y,r=t[1].x,u=t[1].y,l=i.t.x,a=i.t.y,f=i.i.x,c=i.i.y;function v(t,i,n,s,h,r){var e=0;return t<n?e|=1:t>h&&(e|=2),i<s?e|=4:i>r&&(e|=8),e}for(var d=!1,_=v(n,h,l,a,f,c),w=v(r,u,l,a,f,c),b=0;;){if(b>1e3)throw new Error("Cohen - Sutherland algorithm: infinity loop");if(b++,!(_|w)){d=!0;break}if(_&w)break;var M=_||w,m=void 0,p=void 0;8&M?(m=n+(r-n)*(c-h)/(u-h),p=c):4&M?(m=n+(r-n)*(a-h)/(u-h),p=a):2&M?(p=h+(u-h)*(f-n)/(r-n),m=f):(p=h+(u-h)*(l-n)/(r-n),m=l),M===_?_=v(n=m,h=p,l,a,f,c):w=v(r=m,u=p,l,a,f,c)}return d?e(new s(n,h),new s(r,u))?new s(n,h):o(new s(n,h),new s(r,u)):null}(o(t,i),new h(v,d));return Array.isArray(_)?_:null}function C(t,i,n,s){var h=p(n);i.save(),i.fillStyle="#000000",i.beginPath(),i.arc(t.x*s,t.y*s,n*h*s,0,2*Math.PI,!1),i.fill(),i.restore()}function T(t,i,n,s,h){if(!(i.subtract(t).length()<1))for(var r=function(t,i,n){var s=.5*n,h=Math.sqrt(2),r=i.subtract(t),e=r.normalized(),u=p(n),o=5*n*u,l=1*s;if(o*h*.2<=l)return[];var a=e.scaled(o),f=i.subtract(a),c=e.transposed(),v=1*o,d=c.scaled(v),_=f.add(d),w=f.subtract(d),b=_.subtract(i).normalized().scaled(l),M=w.subtract(i).normalized().scaled(l),m=i.add(b),g=i.add(M),k=s*(h-1),y=c.scaled(k),x=Math.min(o-1*s/h,s*h*1),N=e.scaled(x),S=i.subtract(y),C=i.add(y),T=i.subtract(N);return[[_,m],[w,g],[S,T.subtract(y)],[C,T.add(y)]]}(t,i,s),e=0;e<r.length;++e){var u=r[e][0],o=r[e][1];N(n,u.x*h,u.y*h,o.x*h,o.y*h)}}function L(t,i){if(!t)throw new Error("Assertion failed"+(i?": "+i:""))}function F(t){if(void 0===t)throw new Error("Value is undefined");return t}function A(t){if(null===t)throw new Error("Value is null");return t}function P(t){return A(F(t))}!function(t){t[t.Simple=0]="Simple",t[t.WithSteps=1]="WithSteps"}(t||(t={})),function(t){t[t.Normal=0]="Normal",t[t.Arrow=1]="Arrow",t[t.Circle=2]="Circle"}(i||(i={})),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",t[t.SmallDashed=5]="SmallDashed"}(n||(n={}));var E={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 B(t){return t<0?0:t>255?255:Math.round(t)||0}function D(t){return t<=0||t>0?t<0?0:t>1?1:Math.round(1e4*t)/1e4:0}var O=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,z=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,R=/^rgb\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*\)$/,W=/^rgba\(\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?\d{1,10})\s*,\s*(-?[\d]{0,10}(?:\.\d+)?)\s*\)$/;function V(t){var i;if((t=t.toLowerCase())in E&&(t=E[t]),i=W.exec(t)||R.exec(t))return[B(parseInt(i[1],10)),B(parseInt(i[2],10)),B(parseInt(i[3],10)),D(i.length<5?1:parseFloat(i[4]))];if(i=z.exec(t))return[B(parseInt(i[1],16)),B(parseInt(i[2],16)),B(parseInt(i[3],16)),1];if(i=O.exec(t))return[B(17*parseInt(i[1],16)),B(17*parseInt(i[2],16)),B(17*parseInt(i[3],16)),1];throw new Error("Cannot parse color: ".concat(t))}function I(t,i){if("transparent"===t)return t;var n=V(t),s=n[3];return"rgba(".concat(n[0],", ").concat(n[1],", ").concat(n[2],", ").concat(i*s,")")}function j(t){var i,n=V(t);return{m:"rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")"),p:(i=n,.199*i[0]+.687*i[1]+.114*i[2]>160?"black":"white")}}var H=function(t,i){return H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},H(t,i)};function J(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}H(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var q=function(){return q=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var h in i=arguments[n])Object.prototype.hasOwnProperty.call(i,h)&&(t[h]=i[h]);return t},q.apply(this,arguments)};function U(t,i,n){for(var s,h=0,r=i.length;h<r;h++)!s&&h in i||(s||(s=Array.prototype.slice.call(i,0,h)),s[h]=i[h]);return t.concat(s||Array.prototype.slice.call(i))}var Y=function(){function t(){this.k=[]}return t.prototype.N=function(t,i,n){var s={S:t,C:i,T:!0===n};this.k.push(s)},t.prototype.L=function(t){var i=this.k.findIndex(function(i){return t===i.S});i>-1&&this.k.splice(i,1)},t.prototype.F=function(t){this.k=this.k.filter(function(i){return i.C!==t})},t.prototype.A=function(t,i){var n=U([],this.k);this.k=this.k.filter(function(t){return!t.T}),n.forEach(function(n){return n.S(t,i)})},t.prototype.P=function(){return this.k.length>0},t.prototype.B=function(){this.k=[]},t}();function $(t){for(var i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];for(var s=0,h=i;s<h.length;s++){var r=h[s];for(var e in r)if(void 0!==r[e]){var u=r[e],o=t[e];if(Array.isArray(u)&&Array.isArray(o)){u.length<o.length&&(o.length=u.length);for(var l=0;l<u.length;l++){var a=u[l],f=o[l];"object"!=typeof a||null===a||void 0===f?o[l]=a:"object"==typeof f&&null!==f?$(o[l],u[l]):o[l]=u[l]}}else"object"!=typeof u||null===u||void 0===o?t[e]=u:$(o,u)}}return t}function K(t){return"number"==typeof t&&isFinite(t)}function X(t){return"number"==typeof t&&t%1==0}function Z(t){return"string"==typeof t}function G(t){return"boolean"==typeof t}function Q(t){var i,n,s,h=t;if(!h||"object"!=typeof h)return h;for(n in i=Array.isArray(h)?[]:{},h)h.hasOwnProperty(n)&&(s=h[n],i[n]=s&&"object"==typeof s?Q(s):s);return i}function tt(t){return null!==t}function it(t){return null===t?void 0:t}var nt="'Trebuchet MS', Roboto, Ubuntu, sans-serif";function st(t,i,n){return n=void 0!==n?"".concat(n," "):"",void 0===i&&(i=nt),"".concat(n).concat(t,"px ").concat(i)}var ht=function(){function t(t){this.D={O:1,R:4,W:NaN,V:"",I:"",j:"",H:0,J:0,q:0,U:0,Y:0},this.$=t}return t.prototype.K=function(){var t=this.D,i=this.X(),n=this.Z();return t.W===i&&t.I===n||(t.W=i,t.I=n,t.V=st(i,n),t.U=Math.floor(i/3.5),t.H=t.U,t.J=Math.max(Math.ceil(i/2-t.R/2),0),t.q=Math.ceil(i/2+t.R/2),t.Y=Math.round(i/10)),t.j=this.G(),this.D},t.prototype.G=function(){return this.$.K().layout.textColor},t.prototype.X=function(){return this.$.K().layout.fontSize},t.prototype.Z=function(){return this.$.K().layout.fontFamily},t}(),rt=function(){function t(){this.tt=[],this.it=1}return t.prototype.nt=function(t){this.it=t},t.prototype.st=function(t){this.tt.push(t)},t.prototype.ht=function(t,i){this.tt.splice(i,0,t)},t.prototype.rt=function(){this.tt.length=0},t.prototype.et=function(){return 0===this.tt.length},t.prototype.ut=function(t){this.tt=t},t.prototype.ot=function(t,i,n,s){var h=this;this.tt.forEach(function(r){t.save(),t.globalAlpha=h.it,r.ot(t,i,n,s),t.restore()})},t.prototype.lt=function(t,i,n){for(var s=null,h=this.tt.length-1;h>=0;h--){var r=this.tt[h];if(r.lt&&(s=r.lt(t,i,n)||null),s)break}return s},t}(),et=function(){function t(){}return t.prototype.ot=function(t,i,n,s){t.save(),t.scale(i,i),this.ft(t,n,s),t.restore()},t.prototype.ct=function(t,i,n,s){t.save(),t.scale(i,i),this.vt(t,n,s),t.restore()},t.prototype.vt=function(t,i,n){},t}(),ut=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.dt=null,i}return J(i,t),i.prototype._t=function(t){this.dt=t},i.prototype.ft=function(t){if(null!==this.dt&&null!==this.dt.wt){var i=this.dt.wt,n=this.dt,s=function(s){t.beginPath();for(var h=i.to-1;h>=i.from;--h){var r=n.bt[h];t.moveTo(r.Mt,r.gt),t.arc(r.Mt,r.gt,s,0,2*Math.PI)}t.fill()};t.fillStyle=n.kt,s(n.yt+2),t.fillStyle=n.xt,s(n.yt)}},i}(et);function ot(){return{bt:[{Mt:0,gt:0,Nt:0,St:0}],xt:"",kt:"",yt:0,wt:null}}var lt={from:0,to:1},at=function(){function t(t,i){this.Ct=new rt,this.Tt=[],this.Lt=[],this.Ft=!0,this.$=t,this.At=i,this.Ct.ut(this.Tt)}return t.prototype.Pt=function(t){var i=this.$.Et();i.length!==this.Tt.length&&(this.Lt=i.map(ot),this.Tt=this.Lt.map(function(t){var i=new ut;return i._t(t),i}),this.Ct.ut(this.Tt)),this.Ft=!0},t.prototype.Bt=function(t,i,n){return this.Ft&&(this.Dt(t),this.Ft=!1),this.Ct},t.prototype.Dt=function(t){var i=this,n=this.$.Et(),s=this.At.Ot(),h=this.$.zt();n.forEach(function(n,r){var e,u=i.Lt[r],o=n.Rt(s);if(null!==o&&n.Wt()){var l=A(n.Vt());u.xt=o.It,u.yt=o.yt,u.bt[0].St=o.St,u.bt[0].gt=n.Ht().jt(o.St,l.Jt),u.kt=null!==(e=o.qt)&&void 0!==e?e:i.$.Ut(u.bt[0].gt/t),u.bt[0].Nt=s,u.bt[0].Mt=h.Yt(s),u.wt=lt}else u.wt=null})},t}(),ft=function(){function t(t){this.$t=t}return t.prototype.ot=function(t,i,n,s){if(null!==this.$t){var h=this.$t.Kt.Wt,r=this.$t.Xt.Wt;if(h||r){t.save();var e=Math.round(this.$t.Mt*i),u=Math.round(this.$t.gt*i),o=Math.ceil(this.$t.Zt*i),l=Math.ceil(this.$t.Gt*i);t.lineCap="butt",h&&e>=0&&(t.lineWidth=Math.floor(this.$t.Kt.Qt*i),t.strokeStyle=this.$t.Kt.j,t.fillStyle=this.$t.Kt.j,g(t,this.$t.Kt.ti),x(t,e,0,l)),r&&u>=0&&(t.lineWidth=Math.floor(this.$t.Xt.Qt*i),t.strokeStyle=this.$t.Xt.j,t.fillStyle=this.$t.Xt.j,g(t,this.$t.Xt.ti),y(t,u,0,o)),t.restore()}}},t}(),ct=function(){function t(t){this.Ft=!0,this.ii={Kt:{Qt:1,ti:0,j:"",Wt:!1},Xt:{Qt:1,ti:0,j:"",Wt:!1},Zt:0,Gt:0,Mt:0,gt:0},this.ni=new ft(this.ii),this.si=t}return t.prototype.Pt=function(){this.Ft=!0},t.prototype.Bt=function(t,i){return this.Ft&&(this.Dt(),this.Ft=!1),this.ni},t.prototype.Dt=function(){var t=this.si.Wt(),i=A(this.si.hi()),n=i.ri().K().crosshair,s=this.ii;s.Xt.Wt=t&&this.si.ei(i),s.Kt.Wt=t&&this.si.ui(),s.Xt.Qt=n.horzLine.width,s.Xt.ti=n.horzLine.style,s.Xt.j=n.horzLine.color,s.Kt.Qt=n.vertLine.width,s.Kt.ti=n.vertLine.style,s.Kt.j=n.vertLine.color,s.Zt=i.oi(),s.Gt=i.li(),s.Mt=this.si.ai(),s.gt=this.si.fi()},t}();function vt(t,i,n,s,h,r){t.fillRect(i+r,n,s-2*r,r),t.fillRect(i+r,n+h-r,s-2*r,r),t.fillRect(i,n,r,h),t.fillRect(i+s-r,n,r,h)}function dt(t,i,n){t.save(),t.scale(i,i),n(),t.restore()}function _t(t,i,n,s,h,r){t.save(),t.globalCompositeOperation="copy",t.fillStyle=r,t.fillRect(i,n,s,h),t.restore()}function wt(t,i,n,s,h,r,e){t.save(),t.globalCompositeOperation="copy";var u=t.createLinearGradient(0,0,0,h);u.addColorStop(0,r),u.addColorStop(1,e),t.fillStyle=u,t.fillRect(i,n,s,h),t.restore()}var bt=function(){function t(t,i){this._t(t,i)}return t.prototype._t=function(t,i){this.$t=t,this.ci=i},t.prototype.ot=function(t,i,n,s,h,r){if(this.$t.Wt){t.font=i.V;var e=this.$t.di||!this.$t._i?i.R:0,u=i.O,o=i.U,l=i.H,a=i.J,f=i.q,c=this.$t.wi,v=Math.ceil(n.bi(t,c)),d=i.Y,_=i.W+o+l,w=Math.ceil(.5*_),b=u+v+a+f+e,M=this.ci.Mi;this.ci.mi&&(M=this.ci.mi);var m,p,g=(M=Math.round(M))-w,k=g+_,y="right"===h,x=y?s:0,N=Math.ceil(s*r),S=x;if(t.fillStyle=this.ci.m,t.lineWidth=1,t.lineCap="butt",c){y?(m=x-e,p=(S=x-b)+f):(S=x+b,m=x+e,p=x+u+e+a);var C=Math.max(1,Math.floor(r)),T=Math.max(1,Math.floor(u*r)),L=y?N:0,F=Math.round(g*r),A=Math.round(S*r),P=Math.round(M*r)-Math.floor(.5*r),E=P+C+(P-F),B=Math.round(m*r);t.save(),t.beginPath(),t.moveTo(L,F),t.lineTo(A,F),t.lineTo(A,E),t.lineTo(L,E),t.fill(),t.fillStyle=this.$t.qt,t.fillRect(y?N-T:0,F,T,E-F),this.$t.di&&(t.fillStyle=this.ci.j,t.fillRect(L,P,B-L,C)),t.textAlign="left",t.fillStyle=this.ci.j,dt(t,r,function(){t.fillText(c,p,k-l-d)}),t.restore()}}},t.prototype.li=function(t,i){return this.$t.Wt?t.W+t.U+t.H:0},t}(),Mt=function(){function t(t){this.pi={Mi:0,j:"#FFF",m:"#000"},this.gi={wi:"",Wt:!1,di:!0,_i:!1,qt:""},this.ki={wi:"",Wt:!1,di:!1,_i:!0,qt:""},this.Ft=!0,this.yi=new(t||bt)(this.gi,this.pi),this.xi=new(t||bt)(this.ki,this.pi)}return t.prototype.wi=function(){return this.Ni(),this.gi.wi},t.prototype.Mi=function(){return this.Ni(),this.pi.Mi},t.prototype.Pt=function(){this.Ft=!0},t.prototype.li=function(t,i){return void 0===i&&(i=!1),Math.max(this.yi.li(t,i),this.xi.li(t,i))},t.prototype.Si=function(){return this.pi.mi||0},t.prototype.Ci=function(t){this.pi.mi=t},t.prototype.Ti=function(){return this.Ni(),this.gi.Wt||this.ki.Wt},t.prototype.Li=function(){return this.Ni(),this.gi.Wt},t.prototype.Bt=function(t){return this.Ni(),this.gi.di=this.gi.di&&t.K().drawTicks,this.ki.di=this.ki.di&&t.K().drawTicks,this.yi._t(this.gi,this.pi),this.xi._t(this.ki,this.pi),this.yi},t.prototype.Fi=function(){return this.Ni(),this.yi._t(this.gi,this.pi),this.xi._t(this.ki,this.pi),this.xi},t.prototype.Ni=function(){this.Ft&&(this.gi.di=!0,this.ki.di=!1,this.Ai(this.gi,this.ki,this.pi))},t}(),mt=function(t){function i(i,n,s){var h=t.call(this)||this;return h.si=i,h.Pi=n,h.Ei=s,h}return J(i,t),i.prototype.Ai=function(t,i,n){t.Wt=!1;var s=this.si.K().horzLine;if(s.labelVisible){var h=this.Pi.Vt();if(this.si.Wt()&&!this.Pi.et()&&null!==h){var r=j(s.labelBackgroundColor);n.m=r.m,n.j=r.p;var e=this.Ei(this.Pi);n.Mi=e.Mi,t.wi=this.Pi.Bi(e.St,h),t.Wt=!0}}},i}(Mt),pt=/[1-9]/g,gt=function(){function t(){this.$t=null}return t.prototype._t=function(t){this.$t=t},t.prototype.ot=function(t,i,n){var s=this;if(null!==this.$t&&!1!==this.$t.Wt&&0!==this.$t.wi.length){t.font=i.V;var h=Math.round(i.Di.bi(t,this.$t.wi,pt));if(!(h<=0)){t.save();var r=i.Oi,e=h+2*r,u=e/2,o=this.$t.oi,l=this.$t.Mi,a=Math.floor(l-u)+.5;a<0?(l+=Math.abs(0-a),a=Math.floor(l-u)+.5):a+e>o&&(l-=Math.abs(o-(a+e)),a=Math.floor(l-u)+.5);var f=a+e,c=0+i.O+i.U+i.W+i.H;t.fillStyle=this.$t.m;var v=Math.round(a*n),d=Math.round(0*n),_=Math.round(f*n),w=Math.round(c*n);t.fillRect(v,d,_-v,w-d);var b=Math.round(this.$t.Mi*n),M=d,m=Math.round((M+i.O+i.R)*n);t.fillStyle=this.$t.j;var p=Math.max(1,Math.floor(n)),g=Math.floor(.5*n);t.fillRect(b-g,M,p,m-M);var k=c-i.Y-i.H;t.textAlign="left",t.fillStyle=this.$t.j,dt(t,n,function(){t.fillText(A(s.$t).wi,a+r,k)}),t.restore()}}},t}(),kt=function(){function t(t,i,n){this.Ft=!0,this.ni=new gt,this.ii={Wt:!1,m:"#4c525e",j:"white",wi:"",oi:0,Mi:NaN},this.At=t,this.zi=i,this.Ei=n}return t.prototype.Pt=function(){this.Ft=!0},t.prototype.Bt=function(){return this.Ft&&(this.Dt(),this.Ft=!1),this.ni._t(this.ii),this.ni},t.prototype.Dt=function(){var t=this.ii;t.Wt=!1;var i=this.At.K().vertLine;if(i.labelVisible){var n=this.zi.zt();if(!n.et()){var s=n.Ri(this.At.Ot());t.oi=n.oi();var h=this.Ei();t.Mi=h.Mi,t.Mi=n.Wi(A(s)),t.wi=n.Vi(A(s)),t.Wt=!0;var r=j(i.labelBackgroundColor);t.m=r.m,t.j=r.p}}},t}(),yt="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var xt,Nt=function(){function t(){this.Ii=null,this.ji=function(t){for(var i="",n=0;n<t;++n){var s=Math.floor(62*Math.random());i+=yt[s]}return i}(6),this.Hi=0}return t.prototype.Ji=function(){return this.ji},t.prototype.qi=function(t){this.ji=t},t.prototype.Ui=function(){return this.Hi},t.prototype.Yi=function(t){this.Hi=t},t.prototype.Ht=function(){return this.Ii},t.prototype.$i=function(t){this.Ii=t},t.prototype.Ki=function(){return[]},t.prototype.Wt=function(){return!0},t}();!function(t){t[t.Normal=0]="Normal",t[t.Magnet=1]="Magnet"}(xt||(xt={}));var St=function(t){function i(i,n){var s=t.call(this)||this;s.Xi=null,s.Zi=NaN,s.Gi=0,s.Qi=!0,s.tn=new Map,s.nn=!1,s.sn=NaN,s.hn=NaN,s.rn=NaN,s.en=NaN,s.zi=i,s.un=n,s.ln=new at(i,s);var h,r;s.an=(h=function(){return s.Zi},r=function(){return s.hn},function(t){var i=r(),n=h();if(t===A(s.Xi).fn())return{St:n,Mi:i};var e=A(t.Vt());return{St:t.cn(i,e),Mi:i}});var e=function(t,i){return function(){return{Nt:s.zi.zt().vn(t()),Mi:i()}}}(function(){return s.Gi},function(){return s.ai()});return s.dn=new kt(s,i,e),s._n=new ct(s),s}return J(i,t),i.prototype.K=function(){return this.un},i.prototype.wn=function(t,i){this.rn=t,this.en=i},i.prototype.bn=function(){this.rn=NaN,this.en=NaN},i.prototype.Mn=function(){return this.rn},i.prototype.mn=function(){return this.en},i.prototype.pn=function(t,i,n){this.nn||(this.nn=!0),this.Qi=!0,this.gn(t,i,n)},i.prototype.Ot=function(){return this.Gi},i.prototype.ai=function(){return this.sn},i.prototype.fi=function(){return this.hn},i.prototype.Wt=function(){return this.Qi},i.prototype.kn=function(){this.Qi=!1,this.yn(),this.Zi=NaN,this.sn=NaN,this.hn=NaN,this.Xi=null,this.bn()},i.prototype.xn=function(t){return null!==this.Xi?[this._n,this.ln]:[]},i.prototype.ei=function(t){return t===this.Xi&&this.un.horzLine.visible},i.prototype.ui=function(){return this.un.vertLine.visible},i.prototype.Nn=function(t,i){this.Qi&&this.Xi===t||this.tn.clear();var n=[];return this.Xi===t&&n.push(this.Sn(this.tn,i,this.an)),n},i.prototype.Ki=function(){return this.Qi?[this.dn]:[]},i.prototype.hi=function(){return this.Xi},i.prototype.Cn=function(){this._n.Pt(),this.tn.forEach(function(t){return t.Pt()}),this.dn.Pt(),this.ln.Pt()},i.prototype.Tn=function(t){return t&&!t.fn().et()?t.fn():null},i.prototype.gn=function(t,i,n){this.Ln(t,i,n)&&this.Cn()},i.prototype.Ln=function(t,i,n){var s=this.sn,h=this.hn,r=this.Zi,e=this.Gi,u=this.Xi,o=this.Tn(n);this.Gi=t,this.sn=isNaN(t)?NaN:this.zi.zt().Yt(t),this.Xi=n;var l=null!==o?o.Vt():null;return null!==o&&null!==l?(this.Zi=i,this.hn=o.jt(i,l)):(this.Zi=NaN,this.hn=NaN),s!==this.sn||h!==this.hn||e!==this.Gi||r!==this.Zi||u!==this.Xi},i.prototype.yn=function(){var t=this.zi.Et().map(function(t){return t.An().Fn()}).filter(tt),i=0===t.length?null:Math.max.apply(Math,t);this.Gi=null!==i?i:NaN},i.prototype.Sn=function(t,i,n){var s=t.get(i);return void 0===s&&(s=new mt(this,i,n),t.set(i,s)),s},i}(Nt);function Ct(t){return"left"===t||"right"===t}var Tt=function(){function t(t){this.Pn=new Map,this.En=[],this.Bn=t}return t.prototype.Dn=function(t,i){var n=function(t,i){return void 0===t?i:{On:Math.max(t.On,i.On),zn:t.zn||i.zn}}(this.Pn.get(t),i);this.Pn.set(t,n)},t.prototype.Rn=function(){return this.Bn},t.prototype.Wn=function(t){var i=this.Pn.get(t);return void 0===i?{On:this.Bn}:{On:Math.max(this.Bn,i.On),zn:i.zn}},t.prototype.Vn=function(){this.En=[{In:0}]},t.prototype.jn=function(t){this.En=[{In:1,Jt:t}]},t.prototype.Hn=function(){this.En=[{In:4}]},t.prototype.Jn=function(t){this.En.push({In:2,Jt:t})},t.prototype.qn=function(t){this.En.push({In:3,Jt:t})},t.prototype.Un=function(){return this.En},t.prototype.Yn=function(t){for(var i=this,n=0,s=t.En;n<s.length;n++){var h=s[n];this.$n(h)}this.Bn=Math.max(this.Bn,t.Bn),t.Pn.forEach(function(t,n){i.Dn(n,t)})},t.prototype.$n=function(t){switch(t.In){case 0:this.Vn();break;case 1:this.jn(t.Jt);break;case 2:this.Jn(t.Jt);break;case 3:this.qn(t.Jt);break;case 4:this.Hn()}},t}(),Lt={value:"",padding:0,wordWrapWidth:0,forceTextAlign:!1,forceCalculateMaxLineWidth:!1,alignment:"left",font:{family:nt,color:"#2962ff",size:12,bold:!1,italic:!1},box:{scale:1,angle:0,alignment:{vertical:"top",horizontal:"left"}}},Ft={visible:!0,editable:!0,line:{width:1,color:"#2962ff",style:0,extend:{left:!1,right:!1},end:{left:0,right:0}},text:Lt},At={visible:!0,editable:!0,line:{width:2,color:"rgba(74,144,226,1)",style:0,extend:{left:!1,right:!1},end:{left:1,right:0}},text:{value:"this is some text",padding:0,wordWrapWidth:150,forceTextAlign:!1,forceCalculateMaxLineWidth:!0,alignment:"left",font:{family:nt,color:"rgba(255,255,255,1)",size:14,bold:!1,italic:!1},box:{scale:1,angle:0,alignment:{vertical:"middle",horizontal:"center"},offset:{x:0,y:0},padding:{x:0,y:0},maxHeight:500,shadow:{blur:0,color:"rgba(255,255,255,1)",offset:{x:0,y:0}},border:{color:"rgba(74,144,226,1)",width:4,radius:20,highlight:!1,style:0},background:{color:"rgba(19,73,133,1)",inflation:{x:10,y:10}}}}},Pt={visible:!0,editable:!0,line:{width:1,color:"#2962ff",style:0,extend:{left:!0,right:!0},end:{left:0,right:0}},text:Lt},Et={visible:!0,editable:!0,showMiddleLine:!0,extend:{left:!1,right:!1},background:{color:I("#2962ff",.2)},middleLine:{width:1,color:"#2962ff",style:2},channelLine:{width:1,color:"#2962ff",style:0}},Bt={visible:!0,editable:!0,rectangle:{extend:{left:!1,right:!1},background:{color:I("#9c27b0",.2)},border:{width:1,style:0,color:"#9c27b0"}},text:Lt},Dt={visible:!0,editable:!0,showAutoText:!0,entryStopLossRectangle:{background:{color:I("red",.2)},border:{width:1,style:0,color:"red"},extend:{left:!1,right:!1}},entryPtRectangle:{background:{color:I("green",.2)},border:{width:1,style:0,color:"green"},extend:{left:!1,right:!1}},entryStopLossText:Q(Lt),entryPtText:Q(Lt)},Ot={visible:!0,editable:!0,circle:{extend:{left:!1,right:!1},background:{color:I("#9c27b0",.2)},border:{width:1,style:0,color:"#9c27b0"}},text:Lt},zt={visible:!0,editable:!0,priceRange:{extend:{left:!1,right:!1},background:{color:I("#9c27b0",.2)},border:{width:1,style:0,color:"#9c27b0"},showCenterHorizontalLine:!0,showCenterVerticalLine:!0,centerHorizontalLineWidth:1,centerHorizontalLineStyle:1},text:Lt},Rt={visible:!0,editable:!0,marketDepth:{lineWidth:1,lineStyle:0,lineOffset:30,lineLength:300,lineBidColor:I("#2a7a81",1),lineAskColor:I("#d24949",1),timestampStartOffset:50,totalBidAskCalcMethod:"combined",marketDepthData:{Bids:[],Asks:[]}},text:Lt},Wt={visible:!0,editable:!0,triangle:{background:{color:I("#f57c00",.2)},border:{width:1,style:0,color:"#f57c00"}}},Vt={visible:!0,editable:!0,text:Lt,line:{width:1,color:"#2962ff",style:0}},It={visible:!0,editable:!0,line:{color:I("#f23645",.15)}},jt={visible:!0,editable:!0,text:$(Q(Lt),{value:"Text"})},Ht={Ray:$(Q(Ft),{line:{extend:{right:!0}}}),Arrow:$(Q(Ft),{line:{end:{right:1}}}),ExtendedLine:$(Q(Ft),{line:{extend:{right:!0,left:!0}}}),HorizontalRay:$(Q(Pt),{line:{extend:{left:!1}}}),FibRetracement:{visible:!0,editable:!0,extend:{left:!1,right:!1},line:{width:1,style:0},levels:[{color:"#787b86",coeff:0,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#f23645",coeff:.236,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#81c784",coeff:.382,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#4caf50",coeff:.5,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#089981",coeff:.618,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#64b5f6",coeff:.786,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#787b86",coeff:1,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#2962ff",coeff:1.618,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#f23645",coeff:2.618,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#9c27b0",coeff:3.618,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0},{color:"#e91e63",coeff:4.236,opacity:0,distanceFromCoeffEnabled:!1,distanceFromCoeff:0}],tradeStrategy:{enabled:!1,longOrShort:"",fibBracketOrders:[{uniqueId:null,conditionLevelCoeff:null,conditionLevelPrice:0,entryLevelCoeff:null,entryLevelPrice:0,stopMethod:"fib",stopLevelCoeff:null,stopPriceInput:null,stopPointsInput:null,finalStopPrice:0,ptMethod:"fib",ptLevelCoeff:null,ptPriceInput:null,ptPointsInput:null,finalPtPrice:0,isMoveStopToEnabled:!1,moveStopToMethod:"fib",moveStopToLevelCoeff:null,moveStopToPriceInput:null,moveStopToPointsInput:null,finalMoveStopToPrice:0,triggerBracketUniqueId:null}]}},ParallelChannel:Et,HorizontalLine:Pt,VerticalLine:Vt,Highlighter:It,CrossLine:{visible:!0,editable:!0,line:{width:1,color:"#2962ff",style:0}},TrendLine:Ft,Callout:At,Rectangle:Bt,LongShortPosition:Dt,Circle:Ot,PriceRange:zt,Triangle:Wt,Brush:{visible:!0,editable:!0,line:{width:1,color:"#00bcd4",join:"round",style:0,end:{left:0,right:0}}},Path:{visible:!0,editable:!0,line:{width:1,color:"#2962ff",style:0,end:{left:0,right:1}}},Text:jt,MarketDepth:Rt},Jt=function(){function t(){this.$t=null}return t.prototype._t=function(t){this.$t=t},t.prototype.ct=function(t,i,n){if(null!==this.$t&&!1!==this.$t.Wt){var s=this.$t,h=s.Mi,r=s.li,e=s.j,u=t.canvas.clientWidth;dt(t,n,function(){t.fillStyle=e,t.fillRect(0,h,u,r)})}},t}(),qt=function(t){function i(i){var n=t.call(this)||this;return n.Kn=new Jt,n.Xn={j:"rgba(41, 98, 255, 0.25)",Wt:!1,Mi:0,li:0},n.Zn=i,n.Gn=i.ri(),n.Kn._t(n.Xn),n}return J(i,t),i.prototype.Ai=function(){this.Xn.Wt=!1;var t=this.Zn.Ht();if(t&&!t.et()&&this.Zn.Qn()){var i=this.Zn.ts().map(function(i){return t.jt(i.price,i.price)}),n=Math.max.apply(Math,i),s=Math.min.apply(Math,i);this.Xn.Mi=s,this.Xn.li=n-s,this.Xn.Wt=!0}},i}(Mt),Ut=function(t){function i(i,n){var s=t.call(this)||this;return s.ns=!1,s.ns=!1,s.Zn=i,s.ss=n,s}return J(i,t),i.prototype.hs=function(t){this.ns=t},i.prototype.Ai=function(t,i,n){var s;t.Wt=!1;var h=this.Zn.ri();if(h.zt()&&!h.zt().et()){var r=this.rs();if(null!==r){var e=this.Zn.Ht();if(null!==e&&!e.et()&&null!==h.zt().es()){var u=this.Zn.ts();if(!(u.length<=this.ss)){var o=u[this.ss];if(isFinite(o.price)){var l=this.Zn.us(),a=null!==l?l.Vt():null;null!==a&&(n.m=r,n.j=j(n.m).p,n.Mi=e.jt(o.price,a.Jt),t.wi=(null===(s=this.Zn.Ht())||void 0===s?void 0:s.Bi(o.price,a.Jt))||"",t.Wt=!0)}}}}}},i.prototype.rs=function(){return this.Zn.ls()},i}(Mt),Yt=function(){function t(){this.$t=null}return t.prototype._t=function(t){this.$t=t},t.prototype.ot=function(t,i,n){if(null!==this.$t&&!1!==this.$t.Wt){var s=this.$t,h=s.Mi,r=s.oi,e=s.j,u=t.canvas.clientHeight;dt(t,n,function(){t.fillStyle=e,t.fillRect(h,0,r,u)})}},t}(),$t=function(){function t(t){this.Kn=new Yt,this.fs=!0,this.Xn={j:"rgba(41, 98, 255, 0.25)",Wt:!1,Mi:0,oi:0},this.Zn=t,this.Gn=t.ri(),this.Kn._t(this.Xn)}return t.prototype.Pt=function(){this.fs=!0},t.prototype.Bt=function(){return this.fs&&this.cs(),this.fs=!1,this.Kn},t.prototype.cs=function(){var t=this;if(this.Xn.Wt=!1,!this.Gn.zt().et()&&this.Zn.Qn()){var i=this.Zn.vs().map(function(i){return t.Gn.zt().Wi({timestamp:i.timestamp})}),n=Math.max.apply(Math,i),s=Math.min.apply(Math,i);this.Xn.Mi=s,this.Xn.oi=n-s,this.Xn.Wt=!0,this.fs=!1}},t}(),Kt=function(){function t(t,i,n){this.Kn=new gt,this.fs=!0,this.Xn={m:"",Mi:0,j:"",wi:"",oi:0,Wt:!1,di:!1},this.Gn=t,this.Zn=i,this.ss=n,this.Kn._t(this.Xn)}return t.prototype.Pt=function(){this.fs=!0},t.prototype.Bt=function(){return this.fs&&this.cs(),this.fs=!1,this.Kn},t.prototype.cs=function(){if(this.Xn.Wt=!1,!this.Gn.zt().et()){var t=this.rs();if(null!==t){var i=this.ds();if(null!==i){var n=j(t);this.Xn.m=n.m,this.Xn.j=n.p,this.Xn.Mi=this.Gn.zt().Wi({timestamp:i}),this.Xn.wi=this.Gn.zt().Vi({timestamp:i}),this.Xn.oi=this.Gn.zt().oi(),this.Xn.Wt=!0,this.fs=!1}}}},t.prototype.rs=function(){return this.Zn._s()},t.prototype.ds=function(){var t=this.Zn.vs();return t.length<=this.ss?null:t[this.ss].timestamp},t}(),Xt=function(t){function i(i){var n=t.call(this)||this;return n.zi=i,n}return J(i,t),i.prototype.ri=function(){return this.zi},i}(Nt),Zt=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i)||this;h.ws=new Y,h.bs=new Y,h.Ms=[],h.ps=[],h.gs=[],h.ks=!1,h.ys=!1,h.xs=!1,h.Ns=!1,h.Ss=!1,h.Cs=null,h.Ts=null,h.Ls=[],h.Ls=s,h.Fs=n;for(var r=0;r<h.As();r++)h.Ms.push(new Ut(h,r)),h.ps.push(new Kt(i,h,r));return h.As()>1&&(h.Ms.push(new qt(h)),h.ps.push(new $t(h))),h.Cs=i.Et()[0],h.xs=h.Ls.length>=(-1===h.As()?2:h.As()),h.Ss=0===h.Ls.length||!h.Ps(),h}return J(i,t),i.prototype.Ps=function(){return this.xs},i.prototype.Es=function(){this.Ls.length>=Math.max(1,this.As())&&(this.xs=!0,this.ys=!0,this.Ss=!1,this.Ts=null,this.ri().Bs(this))},i.prototype.Ds=function(){var t=U(U([],this.Ls),this.Ts?[this.Ts]:[]);return-1===this.As()?t:t.slice(0,this.As())},i.prototype.Os=function(t){this.Ls.push(t)},i.prototype.zs=function(t){return this.Ds()[t]||null},i.prototype.Rs=function(t,i){this.Ls[t].price=i.price,this.Ls[t].timestamp=i.timestamp},i.prototype.Ws=function(t){this.Ls=t},i.prototype.Vs=function(t){this.Ts=t},i.prototype.Is=function(t){var i,n,h=(null===(n=null===(i=this.us())||void 0===i?void 0:i.Vt())||void 0===n?void 0:n.Jt)||0,r=this.Ht(),e=this.zt();if(!r||r.et()||e.et())return null;var u=e.Wi({timestamp:t.timestamp}),o=r.jt(t.price,h);return new s(u,o)},i.prototype.js=function(t){var i,n,s=(null===(n=null===(i=this.us())||void 0===i?void 0:i.Vt())||void 0===n?void 0:n.Jt)||0,h=this.Ht(),r=this.zt();return h?{price:h.cn(t.y,s),timestamp:r.Hs(t.x).timestamp}:null},i.prototype.Js=function(){return{Ji:this.Ji(),In:this.qs,K:this.Fs}},i.prototype.Ht=function(){return this.ri().Ys()[0].Us()},i.prototype.zt=function(){return this.ri().zt()},i.prototype.us=function(){return this.Cs},i.prototype.K=function(){return this.Fs},i.prototype.Wt=function(){return this.Fs.visible},i.prototype.$s=function(t){$(this.Fs,t),this.ri().Bs(this),this.gs.forEach(function(t){t.Pt("options")})},i.prototype.xn=function(t){return this.gs},i.prototype.Cn=function(){if(this.K().visible){this.Ks();for(var t=0;t<this.Ms.length;t++)this.Ms[t].Pt();for(t=0;t<this.ps.length;t++)this.ps[t].Pt()}},i.prototype.Xs=function(){return this.ks},i.prototype.Zs=function(t){var i=t!==this.ks;return this.ks=t,i},i.prototype.Qn=function(){return this.ys},i.prototype.Gs=function(t){var i=t!==this.ys;return this.ys=t,i&&this.Cn(),i},i.prototype.Qs=function(){return this.Ns},i.prototype.th=function(t){var i=t!==this.Ns;return this.Ns=t,i},i.prototype.ih=function(){return this.Ss},i.prototype.nh=function(t){var i=t!==this.Ss;return this.Ss=t,i},i.prototype.sh=function(){return this.qs},i.prototype.B=function(){},i.prototype.vs=function(){return this.Ds()},i.prototype.ts=function(){return this.Ds()},i.prototype._s=function(){return this.Qn()?"#2962FF":null},i.prototype.ls=function(){return this.Qn()?"#2962FF":null},i.prototype.Ki=function(){return this.ps},i.prototype.Nn=function(){return this.Ms},i.prototype.hh=function(){return!1},i.prototype.rh=function(){return!0},i.prototype.eh=function(){return this.Cs?this.Cs.eh():.01},i.prototype.uh=function(t,i){return null},i.prototype.Vt=function(){return null},i.prototype.oh=function(){return this.ah},i.prototype.fh=function(t){return t},i.prototype.dh=function(){return{id:this.Ji(),toolType:this.qs,options:this.K(),points:this.Ds()}},i.prototype._h=function(t){this.gs=t},i.prototype.Ks=function(){this.gs.forEach(function(t){return t.Pt()})},i}(Xt);function Gt(t){var i;if("object"!=typeof t||null===t||"number"==typeof t.nodeType)i=t;else if(t instanceof Date)i=new Date(t.valueOf());else if(Array.isArray(t)){i=[];for(var n=0;n<t.length;n++)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=Gt(t[n]))}else i={},Object.keys(t).forEach(function(n){i[n]=Gt(t[n])});return i}var Qt,ti=function(){function t(t,i){this.wh=t,this.$t=i||null}return t.prototype.In=function(){return this.wh},t.prototype.bh=function(){return this.$t},t}();!function(t){t[t.Mh=1]="_internal_Regular",t[t.mh=2]="_internal_MovePoint",t[t.ph=3]="_internal_MovePointBackground",t[t.gh=4]="_internal_ChangePoint",t[t.kh=5]="_internal_Custom"}(Qt||(Qt={}));var ii=3,ni=2,si=function(){function t(){this.yh=1e3,this.xh=1e3,this.dt=null,this.Nh=new ti(Qt.mh)}return t.prototype._t=function(t){this.dt=t},t.prototype.Sh=function(t){this.Nh=t},t.prototype.ot=function(t,i,n,s){if(this.dt&&!(this.dt.Ds.length<2)){this.xh=t.canvas.width,this.yh=t.canvas.height;var h=this.dt.Ch.width||1,r=this.dt.Ch.color||"white",e=this.dt.Ch.style||0;t.lineCap="butt",t.strokeStyle=r,t.lineWidth=Math.max(1,Math.floor(h*i)),g(t,e);var u=this.dt.Ds[0],o=this.dt.Ds[1];this.Th(t,[u,o],h,i);var l=this.Lh(u,o);null!==l&&h>0&&(l[0].x===l[1].x?x(t,Math.round(l[0].x*i),l[0].y*i,l[1].y*i):l[0].y===l[1].y?y(t,Math.round(l[0].y*i),l[0].x*i,l[1].x*i):N(t,l[0].x*i,l[0].y*i,l[1].x*i,l[1].y*i))}},t.prototype.lt=function(t,i){if(null===this.dt||this.dt.Ds.length<2)return null;var n=ii,h=this.Lh(this.dt.Ds[0],this.dt.Ds[1]);return null!==h&&d(h[0],h[1],new s(t,i))._<=n?this.Nh:null},t.prototype.Lh=function(t,i){var n,s,h=A(this.dt);return S(t,i,this.xh,this.yh,!!(null===(n=h.Ch.extend)||void 0===n?void 0:n.left),!!(null===(s=h.Ch.extend)||void 0===s?void 0:s.right))},t.prototype.Th=function(t,i,n,s){var h,r,e=A(this.dt);switch(null===(h=e.Ch.end)||void 0===h?void 0:h.left){case 1:T(i[1],i[0],t,n,s);break;case 2:C(i[0],t,n,s)}switch(null===(r=e.Ch.end)||void 0===r?void 0:r.right){case 1:T(i[0],i[1],t,n,s);break;case 2:C(i[1],t,n,s)}},t}();function hi(t,i,n,s,h,r,e){var u,o,l,a;if(Array.isArray(r))if(2===r.length){var f=Math.max(0,r[0]),c=Math.max(0,r[1]);u=f,o=f,l=c,a=c}else{if(4!==r.length)throw new Error("Wrong border radius - it should be like css border radius");u=Math.max(0,r[0]),o=Math.max(0,r[1]),l=Math.max(0,r[2]),a=Math.max(0,r[3])}else u=f=Math.max(0,r),o=f,l=f,a=f;t.beginPath(),g(t,e||0),t.moveTo(i+u,n),t.lineTo(i+s-o,n),0!==o&&t.arcTo(i+s,n,i+s,n+o,o),t.lineTo(i+s,n+h-l),0!==l&&t.arcTo(i+s,n+h,i+s-l,n+h,l),t.lineTo(i+a,n+h),0!==a&&t.arcTo(i,n+h,i,n+h-a,a),t.lineTo(i,n+u),0!==u&&t.arcTo(i,n,i+u,n,u),t.stroke()}function ri(t,i,n,h,r,e,u,o,l,a,f){void 0===e&&(e=0);var c=l?0:i.x,v=a?f:n.x;if(void 0!==h&&(t.fillStyle=h,t.fillRect(c,i.y,v-c,n.y-i.y)),void 0!==r&&e>0){t.beginPath(),g(t,u||0);var d=new s(0,0),_=new s(0,0),w=new s(0,0),b=new s(0,0);switch(o){case"outer":w=new s(0,p=.5*e),b=new s(0,p),d=new s(p,-e),_=new s(p,-e);break;case"center":var M=e%2?.5:0,m=e%2?.5:1;w=new s((p=.5*e)-M,-M),b=new s(m+p,-M),d=new s(-M,M+p),_=new s(m,M+p);break;case"inner":var p;w=new s(0,-(p=.5*e)),b=new s(1,-p),d=new s(-p,e),_=new s(1-p,e)}t.lineWidth=e,t.strokeStyle=r,t.moveTo(c-w.x,i.y-w.y),t.lineTo(v+b.x,i.y-b.y),t.moveTo(n.x+_.x,i.y+_.y),t.lineTo(n.x+_.x,n.y-_.y),t.moveTo(c-w.x,n.y+w.y),t.lineTo(v+b.x,n.y+b.y),t.moveTo(i.x-d.x,i.y+d.y),t.lineTo(i.x-d.x,n.y-d.y),t.stroke()}}var ei,ui=function(){function t(t,i){this.Fh=null,this.Ah=null,this.Ph=null,this.Eh=null,this.Bh=null,this.dt=null,this.Nh=i||new ti(Qt.mh),void 0!==t&&this._t(t)}return t.prototype._t=function(t){!function(t,i){var n,s,h,r,e,u,o,l,a,f,c,v,d,_,w,b,M,m,p,g,k,y,x,N,S,C,T,L,F,A,P,E,B,D,O,z,R,W,V,I,j,H,J,q,U,Y,$,K,X,Z,G,Q,tt,it,nt,st,ht,rt,et,ut,ot,lt,at,ft,ct,vt,dt,_t,wt,bt,Mt,mt,pt,gt,kt,yt,xt,Nt,St,Ct,Tt,Lt,Ft,At,Pt,Et,Bt,Dt,Ot,zt,Rt,Wt,Vt,It,jt,Ht,Jt,qt,Ut,Yt,$t,Kt,Xt,Zt,Gt,Qt,ti,ii,ni,si,hi,ri,ei,ui,oi,li,ai,fi,ci,vi,di,_i;if(null===t||null===i)return null===t==(null===i);if(void 0===t.Ds!=(void 0===i.Ds))return!1;if(void 0!==t.Ds&&void 0!==i.Ds){if(t.Ds.length!==i.Ds.length)return!1;for(var wi=0;wi<t.Ds.length;++wi)if(t.Ds[wi].x!==i.Ds[wi].x||t.Ds[wi].y!==i.Ds[wi].y)return!1}return(null===(n=t.wi)||void 0===n?void 0:n.forceCalculateMaxLineWidth)===(null===(s=i.wi)||void 0===s?void 0:s.forceCalculateMaxLineWidth)&&(null===(h=t.wi)||void 0===h?void 0:h.forceTextAlign)===(null===(r=i.wi)||void 0===r?void 0:r.forceTextAlign)&&(null===(e=t.wi)||void 0===e?void 0:e.wordWrapWidth)===(null===(u=i.wi)||void 0===u?void 0:u.wordWrapWidth)&&(null===(o=t.wi)||void 0===o?void 0:o.padding)===(null===(l=i.wi)||void 0===l?void 0:l.padding)&&(null===(a=t.wi)||void 0===a?void 0:a.value)===(null===(f=i.wi)||void 0===f?void 0:f.value)&&(null===(c=t.wi)||void 0===c?void 0:c.alignment)===(null===(v=i.wi)||void 0===v?void 0:v.alignment)&&(null===(_=null===(d=t.wi)||void 0===d?void 0:d.font)||void 0===_?void 0:_.bold)===(null===(b=null===(w=i.wi)||void 0===w?void 0:w.font)||void 0===b?void 0:b.bold)&&(null===(m=null===(M=t.wi)||void 0===M?void 0:M.font)||void 0===m?void 0:m.size)===(null===(g=null===(p=i.wi)||void 0===p?void 0:p.font)||void 0===g?void 0:g.size)&&(null===(y=null===(k=t.wi)||void 0===k?void 0:k.font)||void 0===y?void 0:y.family)===(null===(N=null===(x=i.wi)||void 0===x?void 0:x.font)||void 0===N?void 0:N.family)&&(null===(C=null===(S=t.wi)||void 0===S?void 0:S.font)||void 0===C?void 0:C.italic)===(null===(L=null===(T=i.wi)||void 0===T?void 0:T.font)||void 0===L?void 0:L.italic)&&(null===(A=null===(F=t.wi)||void 0===F?void 0:F.box)||void 0===A?void 0:A.angle)===(null===(E=null===(P=i.wi)||void 0===P?void 0:P.box)||void 0===E?void 0:E.angle)&&(null===(D=null===(B=t.wi)||void 0===B?void 0:B.box)||void 0===D?void 0:D.scale)===(null===(z=null===(O=i.wi)||void 0===O?void 0:O.box)||void 0===z?void 0:z.scale)&&(null===(V=null===(W=null===(R=t.wi)||void 0===R?void 0:R.box)||void 0===W?void 0:W.offset)||void 0===V?void 0:V.x)===(null===(H=null===(j=null===(I=i.wi)||void 0===I?void 0:I.box)||void 0===j?void 0:j.offset)||void 0===H?void 0:H.x)&&(null===(U=null===(q=null===(J=t.wi)||void 0===J?void 0:J.box)||void 0===q?void 0:q.offset)||void 0===U?void 0:U.y)===(null===(K=null===($=null===(Y=i.wi)||void 0===Y?void 0:Y.box)||void 0===$?void 0:$.offset)||void 0===K?void 0:K.y)&&(null===(Z=null===(X=t.wi)||void 0===X?void 0:X.box)||void 0===Z?void 0:Z.maxHeight)===(null===(Q=null===(G=i.wi)||void 0===G?void 0:G.box)||void 0===Q?void 0:Q.maxHeight)&&(null===(nt=null===(it=null===(tt=t.wi)||void 0===tt?void 0:tt.box)||void 0===it?void 0:it.padding)||void 0===nt?void 0:nt.x)===(null===(rt=null===(ht=null===(st=i.wi)||void 0===st?void 0:st.box)||void 0===ht?void 0:ht.padding)||void 0===rt?void 0:rt.x)&&(null===(ot=null===(ut=null===(et=t.wi)||void 0===et?void 0:et.box)||void 0===ut?void 0:ut.padding)||void 0===ot?void 0:ot.y)===(null===(ft=null===(at=null===(lt=i.wi)||void 0===lt?void 0:lt.box)||void 0===at?void 0:at.padding)||void 0===ft?void 0:ft.y)&&(null===(dt=null===(vt=null===(ct=t.wi)||void 0===ct?void 0:ct.box)||void 0===vt?void 0:vt.alignment)||void 0===dt?void 0:dt.vertical)===(null===(bt=null===(wt=null===(_t=i.wi)||void 0===_t?void 0:_t.box)||void 0===wt?void 0:wt.alignment)||void 0===bt?void 0:bt.vertical)&&(null===(pt=null===(mt=null===(Mt=t.wi)||void 0===Mt?void 0:Mt.box)||void 0===mt?void 0:mt.alignment)||void 0===pt?void 0:pt.horizontal)===(null===(yt=null===(kt=null===(gt=i.wi)||void 0===gt?void 0:gt.box)||void 0===kt?void 0:kt.alignment)||void 0===yt?void 0:yt.horizontal)&&(null===(Ct=null===(St=null===(Nt=null===(xt=t.wi)||void 0===xt?void 0:xt.box)||void 0===Nt?void 0:Nt.background)||void 0===St?void 0:St.inflation)||void 0===Ct?void 0:Ct.x)===(null===(At=null===(Ft=null===(Lt=null===(Tt=i.wi)||void 0===Tt?void 0:Tt.box)||void 0===Lt?void 0:Lt.background)||void 0===Ft?void 0:Ft.inflation)||void 0===At?void 0:At.x)&&(null===(Dt=null===(Bt=null===(Et=null===(Pt=t.wi)||void 0===Pt?void 0:Pt.box)||void 0===Et?void 0:Et.background)||void 0===Bt?void 0:Bt.inflation)||void 0===Dt?void 0:Dt.y)===(null===(Wt=null===(Rt=null===(zt=null===(Ot=i.wi)||void 0===Ot?void 0:Ot.box)||void 0===zt?void 0:zt.background)||void 0===Rt?void 0:Rt.inflation)||void 0===Wt?void 0:Wt.y)&&(null===(jt=null===(It=null===(Vt=t.wi)||void 0===Vt?void 0:Vt.box)||void 0===It?void 0:It.border)||void 0===jt?void 0:jt.highlight)===(null===(qt=null===(Jt=null===(Ht=i.wi)||void 0===Ht?void 0:Ht.box)||void 0===Jt?void 0:Jt.border)||void 0===qt?void 0:qt.highlight)&&(null===($t=null===(Yt=null===(Ut=t.wi)||void 0===Ut?void 0:Ut.box)||void 0===Yt?void 0:Yt.border)||void 0===$t?void 0:$t.radius)===(null===(Zt=null===(Xt=null===(Kt=i.wi)||void 0===Kt?void 0:Kt.box)||void 0===Xt?void 0:Xt.border)||void 0===Zt?void 0:Zt.radius)&&(null===(ti=null===(Qt=null===(Gt=t.wi)||void 0===Gt?void 0:Gt.box)||void 0===Qt?void 0:Qt.shadow)||void 0===ti?void 0:ti.offset)===(null===(si=null===(ni=null===(ii=i.wi)||void 0===ii?void 0:ii.box)||void 0===ni?void 0:ni.shadow)||void 0===si?void 0:si.offset)&&(null===(ei=null===(ri=null===(hi=t.wi)||void 0===hi?void 0:hi.box)||void 0===ri?void 0:ri.shadow)||void 0===ei?void 0:ei.color)===(null===(li=null===(oi=null===(ui=i.wi)||void 0===ui?void 0:ui.box)||void 0===oi?void 0:oi.shadow)||void 0===li?void 0:li.color)&&(null===(ci=null===(fi=null===(ai=t.wi)||void 0===ai?void 0:ai.box)||void 0===fi?void 0:fi.shadow)||void 0===ci?void 0:ci.blur)===(null===(_i=null===(di=null===(vi=i.wi)||void 0===vi?void 0:vi.box)||void 0===di?void 0:di.shadow)||void 0===_i?void 0:_i.blur)}(this.dt,t)?(this.dt=t,this.Ah=null,this.Fh=null,this.Ph=null,this.Eh=null,this.Bh=null):this.dt=t},t.prototype.lt=function(t,i){return null===this.dt||void 0===this.dt.Ds||0===this.dt.Ds.length?null:w(new s(t,i),this.Dh())?this.Nh:null},t.prototype.Oh=function(t){return null!==this.dt&&void 0!==this.dt.Ds&&0!==this.dt.Ds.length&&_(this.dt.Ds[0],t)},t.prototype.zh=function(){return null===this.dt?{oi:0,li:0}:this.Rh()},t.prototype.Wh=function(){if(null===this.dt)return{Mt:0,gt:0,oi:0,li:0};var t=this.Vh();return{Mt:t.Ih,gt:t.jh,oi:t.Hh,li:t.Jh}},t.prototype.qh=function(t,i){if(null===this.dt||void 0===this.dt.Ds||0===this.dt.Ds.length)return!0;var n=this.Vh();if(n.Ih+n.Hh<0||n.Ih>t){var r=new h(new s(0,0),new s(t,i));return this.Dh().every(function(t){return!_(t,r)})}return!1},t.prototype.Ws=function(t,i){A(this.dt).Ds=t,this.Nh=i||new ti(Qt.mh)},t.prototype.Uh=function(){return null===this.dt?"":this.Yh().Uh},t.prototype.$h=function(t,i,n){return function(t,i,n){ei||oi();n="[object String]"===Object.prototype.toString.call(n)?parseInt(n):n,t+="";var s=!Number.isInteger(n)||!isFinite(n)||n<=0?t.split(/\r\n|\r|\n|$/):t.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/);s[s.length-1]||s.pop();if(!Number.isInteger(n)||!isFinite(n)||n<=0)return s;ei.font=i;for(var h=[],r=0;r<s.length;r++){var e=s[r],u=ei.measureText(e).width;if(u<=n)h.push(e);else for(var o=e.split(/([-)\]},.!?:;])|(\s+)/);o.length;){var l=Math.floor(n/u*(o.length+2)/3);if(l<=0||ei.measureText(o.slice(0,3*l-1).join("")).width<=n)for(;ei.measureText(o.slice(0,3*(l+1)-1).join("")).width<=n;)l++;else for(;l>0&&ei.measureText(o.slice(0,3*--l-1).join("")).width>n;);if(l>0)h.push(o.slice(0,3*l-1).join("")),o.splice(0,3*l);else{var a=o[0]+(o[1]||""),f=Math.floor(n/ei.measureText(a).width*a.length);if(ei.measureText(a.substring(0,f)).width<=n)for(;ei.measureText(a.substring(0,f+1)).width<=n;)f++;else for(;f>1&&ei.measureText(a.substring(0,--f)).width>n;);f=Math.max(1,f),h.push(a.substring(0,f)),o[0]=a.substring(f),o[1]=""}if(ei.measureText(o.join("")).width<=n){h.push(o.join(""));break}}}return h}(t,n||this.Uh(),i)},t.prototype.ot=function(t,i){var n,s,h,r,e,u,o,l,a,f,c,v,d,_,w,b,M,m,p,g,k;if(null!==this.dt&&void 0!==this.dt.Ds&&0!==this.dt.Ds.length){var y=t.canvas.width,x=t.canvas.height;if(!this.qh(y,x)){var N=this.dt.wi,S=this.Vh(),C=this.Kh().scaled(i),T=-((null===(n=N.box)||void 0===n?void 0:n.angle)||0)*Math.PI/180;t.save(),t.translate(C.x,C.y),t.rotate(T),t.translate(-C.x,-C.y);var L=this.Yh().W;t.textAlign=S.Xh,t.textBaseline="middle",t.font=this.Uh();var F=Math.round(S.jh*i),A=Math.round(S.Ih*i),P=A+Math.round(S.Hh*i),E=F+Math.round(S.Jh*i);if((null===(h=null===(s=N.box)||void 0===s?void 0:s.background)||void 0===h?void 0:h.color)||(null===(e=null===(r=N.box)||void 0===r?void 0:r.border)||void 0===e?void 0:e.color)||(null===(o=null===(u=N.box)||void 0===u?void 0:u.border)||void 0===o?void 0:o.highlight)&&N.wordWrapWidth){var B=Math.round(((null===(a=null===(l=N.box)||void 0===l?void 0:l.border)||void 0===a?void 0:a.width)||Math.max(L/12,1))*i),D=B/2,O=!1;if(null===(f=N.box)||void 0===f?void 0:f.shadow){var z=null===(c=N.box)||void 0===c?void 0:c.shadow,R=z.color,W=z.blur,V=z.offset;t.save(),t.shadowColor=R,t.shadowBlur=W,t.shadowOffsetX=(null==V?void 0:V.x)||0,t.shadowOffsetY=(null==V?void 0:V.y)||0,O=!0}if(null===(v=N.box.border)||void 0===v?void 0:v.width){(null===(d=N.box.border)||void 0===d?void 0:d.color)&&(t.strokeStyle=N.box.border.color),t.lineWidth=B;var I=null!==(b=null===(w=null===(_=N.box)||void 0===_?void 0:_.border)||void 0===w?void 0:w.radius)&&void 0!==b?b:0*i+B,j=null===(m=null===(M=N.box)||void 0===M?void 0:M.border)||void 0===m?void 0:m.style;hi(t,A-D,F-D,P-A+B,E-F+B,I,j),(null===(p=N.box.background)||void 0===p?void 0:p.color)&&(t.fillStyle=N.box.background.color,t.fill()),O&&(t.restore(),O=!1)}else(null===(g=N.box.background)||void 0===g?void 0:g.color)&&(t.fillStyle=N.box.background.color,t.fillRect(A,F,P-A,E-F)),O&&(t.restore(),O=!1)}t.fillStyle=null===(k=N.font)||void 0===k?void 0:k.color;for(var H=this.Gh().Zh,J=.05*L,q=wi(this.dt),U=(A+Math.round(S.Qh*i))/i,Y=(F+Math.round((S.tr+J)*i))/i,$=function(n){dt(t,i,function(){return t.fillText(n,U,Y)}),Y+=L+q},K=0,X=H;K<X.length;K++){$(X[K])}t.restore()}}},t.prototype.Vh=function(){var t,i,n,s,h,r,e,u,o,l,a,f,c,v,d,_,w,b,M,m,p;if(null!==this.Fh)return this.Fh;var g=A(this.dt),k=vi(g),y=ci(g),x=_i(g)+k,N=di(g)+y,S=F(g.Ds)[0],C=this.Rh(),T=C.oi,L=C.li,P=S.y,E=S.x;switch(null===(n=null===(i=null===(t=g.wi)||void 0===t?void 0:t.box)||void 0===i?void 0:i.alignment)||void 0===n?void 0:n.vertical){case"top":P-=L+((null===(r=null===(h=null===(s=g.wi)||void 0===s?void 0:s.box)||void 0===h?void 0:h.offset)||void 0===r?void 0:r.y)||0);break;case"middle":P-=L/2;break;case"bottom":P+=(null===(o=null===(u=null===(e=g.wi)||void 0===e?void 0:e.box)||void 0===u?void 0:u.offset)||void 0===o?void 0:o.y)||0}var B=P+N+bi(g)/2,D="start",O=0;switch(null===(f=null===(a=null===(l=g.wi)||void 0===l?void 0:l.box)||void 0===a?void 0:a.alignment)||void 0===f?void 0:f.horizontal){case"left":E+=(null===(d=null===(v=null===(c=g.wi)||void 0===c?void 0:c.box)||void 0===v?void 0:v.offset)||void 0===d?void 0:d.x)||0;break;case"center":E-=T/2;break;case"right":E-=T+((null===(b=null===(w=null===(_=g.wi)||void 0===_?void 0:_.box)||void 0===w?void 0:w.offset)||void 0===b?void 0:b.x)||0)}switch(F(null===(M=g.wi)||void 0===M?void 0:M.alignment)){case"start":case"left":D="start",O=E+x,pi()&&((null===(m=g.wi)||void 0===m?void 0:m.forceTextAlign)?D="left":(O=E+T-x,D="right"));break;case"center":D="center",O=E+T/2;break;case"right":case"end":D="end",O=E+T-x,pi()&&(null===(p=g.wi)||void 0===p?void 0:p.forceTextAlign)&&(D="right")}return this.Fh={Ih:E,jh:P,Hh:T,Jh:L,Xh:D,tr:B-P,Qh:O-E},this.Fh},t.prototype.ir=function(t){var i,n,s;if(ei||oi(),ei.textBaseline="alphabetic",ei.font=this.Uh(),null!==this.dt&&(null===(i=this.dt.wi)||void 0===i?void 0:i.wordWrapWidth)&&!(null===(n=this.dt.wi)||void 0===n?void 0:n.forceCalculateMaxLineWidth))return(null===(s=this.dt.wi)||void 0===s?void 0:s.wordWrapWidth)*mi(this.dt);for(var h=0,r=0,e=t;r<e.length;r++){var u=e[r];h=Math.max(h,ei.measureText(u).width)}return h},t.prototype.Gh=function(){var t,i,n,s,h,r;if(null===this.Ph){var e=A(this.dt),u=this.$h((null===(t=e.wi)||void 0===t?void 0:t.value)||"",null===(i=e.wi)||void 0===i?void 0:i.wordWrapWidth);if(void 0!==(null===(s=null===(n=e.wi)||void 0===n?void 0:n.box)||void 0===s?void 0:s.maxHeight)){var o=F(null===(r=null===(h=e.wi)||void 0===h?void 0:h.box)||void 0===r?void 0:r.maxHeight),l=bi(e),a=wi(e),f=Math.floor((o+a)/(l+a));u.length>f&&(u=u.slice(0,f))}this.Ph={nr:this.ir(u),Zh:u}}return this.Ph},t.prototype.Yh=function(){var t,i,n,s,h,r;if(null===this.Eh){var e=A(this.dt),u=bi(e),o=((null===(i=null===(t=e.wi)||void 0===t?void 0:t.font)||void 0===i?void 0:i.bold)?"bold ":"")+((null===(s=null===(n=e.wi)||void 0===n?void 0:n.font)||void 0===s?void 0:s.italic)?"italic ":"")+u+"px "+(null===(r=null===(h=e.wi)||void 0===h?void 0:h.font)||void 0===r?void 0:r.family);this.Eh={Uh:o,W:u}}return this.Eh},t.prototype.Rh=function(){if(null===this.Bh){var t=this.Gh(),i=A(this.dt);this.Bh={oi:ai(i,t.nr),li:fi(i,t.Zh.length)}}return this.Bh},t.prototype.Dh=function(){var t,i;if(null!==this.Ah)return this.Ah;if(null===this.dt)return[];var n=this.Vh(),h=n.Ih,r=n.jh,e=n.Hh,u=n.Jh,o=this.Kh(),l=-((null===(i=null===(t=this.dt.wi)||void 0===t?void 0:t.box)||void 0===i?void 0:i.angle)||0)*Math.PI/180;return this.Ah=[li(new s(h,r),o,l),li(new s(h+e,r),o,l),li(new s(h+e,r+u),o,l),li(new s(h,r+u),o,l)],this.Ah},t.prototype.Kh=function(){var t,i,n,h=this.Vh(),r=h.Ih,e=h.jh,u=h.Hh,o=h.Jh,l=F(null===(n=null===(i=null===(t=this.dt)||void 0===t?void 0:t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.alignment),a=l.horizontal,f=l.vertical,c=0,v=0;switch(a){case"center":c=r+u/2;break;case"left":c=r;break;case"right":c=r+u}switch(f){case"middle":v=e+o/2;break;case"bottom":v=e;break;case"top":v=e+o}return new s(c,v)},t}();function oi(){var t=document.createElement("canvas");t.width=0,t.height=0,ei=A(t.getContext("2d"))}function li(t,i,n){if(0===n)return t.clone();var h=(t.x-i.x)*Math.cos(n)-(t.y-i.y)*Math.sin(n)+i.x,r=(t.x-i.x)*Math.sin(n)+(t.y-i.y)*Math.cos(n)+i.y;return new s(h,r)}function ai(t,i){return i+2*_i(t)+2*vi(t)}function fi(t,i){return bi(t)*i+wi(t)*(i-1)+2*di(t)+2*ci(t)}function ci(t){var i,n,s,h,r,e;return void 0!==(null===(s=null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.padding)||void 0===s?void 0:s.y)?(null===(e=null===(r=null===(h=t.wi)||void 0===h?void 0:h.box)||void 0===r?void 0:r.padding)||void 0===e?void 0:e.y)*mi(t):bi(t)/3}function vi(t){var i,n,s,h,r,e;return(null===(s=null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.padding)||void 0===s?void 0:s.x)?(null===(e=null===(r=null===(h=t.wi)||void 0===h?void 0:h.box)||void 0===r?void 0:r.padding)||void 0===e?void 0:e.x)*mi(t):bi(t)/3}function di(t){var i,n,s,h;return((null===(h=null===(s=null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.background)||void 0===s?void 0:s.inflation)||void 0===h?void 0:h.y)||0)*mi(t)}function _i(t){var i,n,s,h;return((null===(h=null===(s=null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.background)||void 0===s?void 0:s.inflation)||void 0===h?void 0:h.x)||0)*mi(t)}function wi(t){var i;return((null===(i=t.wi)||void 0===i?void 0:i.padding)||0)*mi(t)}function bi(t){return Math.ceil(Mi(t)*mi(t))}function Mi(t){var i,n;return(null===(n=null===(i=t.wi)||void 0===i?void 0:i.font)||void 0===n?void 0:n.size)||30}function mi(t){var i,n,s=Math.min(1,Math.max(.2,(null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.scale)||1));if(1===s)return s;var h=Mi(t);return Math.ceil(s*h)/h}function pi(){return"rtl"===window.document.dir}var gi=function(){function t(){this.$t=null}return t.prototype._t=function(t){this.$t=t},t.prototype.ot=function(t,i,n,s){var h=this;if(null!==this.$t){var r=Math.max(1,Math.floor(i));t.lineWidth=r;var e=Math.ceil(this.$t.Gt*i),u=Math.ceil(this.$t.Zt*i);!function(t,i){t.save(),t.lineWidth%2&&t.translate(.5,.5),i(),t.restore()}(t,function(){var n=A(h.$t);if(n.sr){t.strokeStyle=n.hr,g(t,n.rr),t.beginPath();for(var s=0,o=n.er;s<o.length;s++){var l=o[s],a=Math.round(l.ur*i);t.moveTo(a,-r),t.lineTo(a,e+r)}t.stroke()}if(n.lr){t.strokeStyle=n.ar,g(t,n.cr),t.beginPath();for(var f=0,c=n.vr;f<c.length;f++){var v=c[f],d=Math.round(v.ur*i);t.moveTo(-r,d),t.lineTo(u+r,d)}t.stroke()}})}},t}(),ki=function(){function t(t){this.ni=new gi,this.Ft=!0,this.Xi=t}return t.prototype.Pt=function(){this.Ft=!0},t.prototype.Bt=function(t,i){if(this.Ft){var n=this.Xi.ri().K().grid,s={Gt:t,Zt:i,lr:n.horzLines.visible,sr:n.vertLines.visible,ar:n.horzLines.color,hr:n.vertLines.color,cr:n.horzLines.style,rr:n.vertLines.style,vr:this.Xi.fn().dr(),er:this.Xi.ri().zt().dr()||[]};this.ni._t(s),this.Ft=!1}return this.ni},t}(),yi=function(){function t(t){this._n=new ki(t)}return t.prototype._r=function(){return this._n},t}(),xi=".";function Ni(t,i){if(!K(t))return"n/a";if(!X(i))throw new TypeError("invalid length");if(i<0||i>16)throw new TypeError("invalid length");if(0===i)return t.toString();return("0000000000000000"+t.toString()).slice(-i)}var Si=function(){function t(t,i){if(i||(i=1),K(t)&&X(t)||(t=100),t<0)throw new TypeError("invalid base");this.Pi=t,this.wr=i,this.br()}return t.prototype.format=function(t){var i=t<0?"−":"";return t=Math.abs(t),i+this.Mr(t)},t.prototype.br=function(){if(this.mr=0,this.Pi>0&&this.wr>0)for(var t=this.Pi;t>1;)t/=10,this.mr++},t.prototype.Mr=function(t){var i=this.Pi/this.wr,n=Math.floor(t),s="",h=void 0!==this.mr?this.mr:NaN;if(i>1){var r=+(Math.round(t*i)-n*i).toFixed(this.mr);r>=i&&(r-=i,n+=1),s=xi+Ni(+r.toFixed(this.mr)*this.wr,h)}else n=Math.round(n*i)/i,h>0&&(s=xi+Ni(0,h));return n.toFixed(0)+s},t}(),Ci=function(t){function i(i){return void 0===i&&(i=100),t.call(this,i)||this}return J(i,t),i.prototype.format=function(i){return"".concat(t.prototype.format.call(this,i),"%")},i}(Si),Ti=function(){function t(t,i){this.pr=t,this.gr=i}return t.prototype.kr=function(t){return null!==t&&(this.pr===t.pr&&this.gr===t.gr)},t.prototype.yr=function(){return new t(this.pr,this.gr)},t.prototype.Nr=function(){return this.pr},t.prototype.Sr=function(){return this.gr},t.prototype.Cr=function(){return this.gr-this.pr},t.prototype.et=function(){return this.gr===this.pr||Number.isNaN(this.gr)||Number.isNaN(this.pr)},t.prototype.Yn=function(i){return null===i?this:new t(Math.min(this.Nr(),i.Nr()),Math.max(this.Sr(),i.Sr()))},t.prototype.Tr=function(t){if(K(t)&&0!==this.gr-this.pr){var i=.5*(this.gr+this.pr),n=this.gr-i,s=this.pr-i;n*=t,s*=t,this.gr=i+n,this.pr=i+s}},t.prototype.Lr=function(t){K(t)&&(this.gr+=t,this.pr+=t)},t.prototype.Fr=function(){return{minValue:this.pr,maxValue:this.gr}},t.Ar=function(i){return null===i?null:new t(i.minValue,i.maxValue)},t}();function Li(t,i,n){return Math.min(Math.max(t,i),n)}function Fi(t,i,n){return i-t<=n}function Ai(t){return t<=0?NaN:Math.log(t)/Math.log(10)}function Pi(t){var i=Math.ceil(t);return i%2!=0?i-1:i}function Ei(t){var i=Math.ceil(t);return i%2==0?i-1:i}var Bi={Pr:4,Er:1e-4};function Di(t,i){var n=100*(t-i)/i;return i<0?-n:n}function Oi(t,i){var n=Di(t.Nr(),i),s=Di(t.Sr(),i);return new Ti(n,s)}function zi(t,i){var n=100*(t-i)/i+100;return i<0?-n:n}function Ri(t,i){var n=zi(t.Nr(),i),s=zi(t.Sr(),i);return new Ti(n,s)}function Wi(t,i){var n=Math.abs(t);if(n<1e-15)return 0;var s=Ai(n+i.Er)+i.Pr;return t<0?-s:s}function Vi(t,i){var n=Math.abs(t);if(n<1e-15)return 0;var s=Math.pow(10,n-i.Pr)-i.Er;return t<0?-s:s}function Ii(t,i){if(null===t)return null;var n=Wi(t.Nr(),i),s=Wi(t.Sr(),i);return new Ti(n,s)}function ji(t,i){if(null===t)return null;var n=Vi(t.Nr(),i),s=Vi(t.Sr(),i);return new Ti(n,s)}function Hi(t){if(null===t)return Bi;var i=Math.abs(t.Sr()-t.Nr());if(i>=1||i<1e-15)return Bi;var n=Math.ceil(Math.abs(Math.log10(i))),s=Bi.Pr+n;return{Pr:s,Er:1/Math.pow(10,s)}}var Ji,qi=function(){function t(t,i){if(this.Br=t,this.Dr=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.Br))this.Or=[2,2.5,2];else{this.Or=[];for(var n=this.Br;1!==n;){if(n%2==0)this.Or.push(2),n/=2;else{if(n%5!=0)throw new Error("unexpected base");this.Or.push(2,2.5),n/=5}if(this.Or.length>100)throw new Error("something wrong with base")}}}return t.prototype.zr=function(t,i,n){for(var s,h,r,e=0===this.Br?0:1/this.Br,u=Math.pow(10,Math.max(0,Math.ceil(Ai(t-i)))),o=0,l=this.Dr[0];;){var a=Fi(u,e,1e-14)&&u>e+1e-14,f=Fi(u,n*l,1e-14),c=Fi(u,1,1e-14);if(!(a&&f&&c))break;u/=l,l=this.Dr[++o%this.Dr.length]}if(u<=e+1e-14&&(u=e),u=Math.max(1,u),this.Or.length>0&&(s=u,h=1,r=1e-14,Math.abs(s-h)<r))for(o=0,l=this.Or[0];Fi(u,n*l,1e-14)&&u>e+1e-14;)u/=l,l=this.Or[++o%this.Or.length];return u},t}(),Ui=function(){function t(t,i,n,s){this.Rr=[],this.Pi=t,this.Br=i,this.Wr=n,this.Vr=s}return t.prototype.zr=function(t,i){if(t<i)throw new Error("high < low");var n=this.Pi.li(),s=(t-i)*this.Ir()/n,h=new qi(this.Br,[2,2.5,2]),r=new qi(this.Br,[2,2,2.5]),e=new qi(this.Br,[2.5,2,2]),u=[];return u.push(h.zr(t,i,s),r.zr(t,i,s),e.zr(t,i,s)),function(t){if(t.length<1)throw Error("array is empty");for(var i=t[0],n=1;n<t.length;++n)t[n]<i&&(i=t[n]);return i}(u)},t.prototype.jr=function(){var t=this.Pi,i=t.Vt();if(null!==i){var n=t.li(),s=this.Wr(n-1,i),h=this.Wr(0,i),r=this.Pi.K().entireTextOnly?this.Hr()/2:0,e=r,u=n-1-r,o=Math.max(s,h),l=Math.min(s,h);if(o!==l){for(var a=this.zr(o,l),f=o%a,c=o>=l?1:-1,v=null,d=0,_=o-(f+=f<0?a:0);_>l;_-=a){var w=this.Vr(_,i,!0);null!==v&&Math.abs(w-v)<this.Ir()||(w<e||w>u||(d<this.Rr.length?(this.Rr[d].ur=w,this.Rr[d].Jr=t.qr(_)):this.Rr.push({ur:w,Jr:t.qr(_)}),d++,v=w,t.Ur()&&(a=this.zr(_*c,l))))}this.Rr.length=d}else this.Rr=[]}else this.Rr=[]},t.prototype.dr=function(){return this.Rr},t.prototype.Hr=function(){return this.Pi.W()},t.prototype.Ir=function(){return Math.ceil(2.5*this.Hr())},t}();function Yi(t){return t.slice().sort(function(t,i){return A(t.Ui())-A(i.Ui())})}!function(t){t[t.Normal=0]="Normal",t[t.Logarithmic=1]="Logarithmic",t[t.Percentage=2]="Percentage",t[t.IndexedTo100=3]="IndexedTo100"}(Ji||(Ji={}));var $i,Ki=new Ci,Xi=new Si(100,1),Zi=function(){function t(t,i,n,s){this.Yr=0,this.$r=null,this.Kr=null,this.Xr=null,this.Zr={Gr:!1,Qr:null},this.te=0,this.ie=0,this.ne=new Y,this.se=new Y,this.he=[],this.re=null,this.ee=null,this.ue=null,this.oe=null,this.ah=Xi,this.le=Hi(null),this.ji=t,this.un=i,this.ae=n,this.fe=s,this.ce=new Ui(this,100,this.ve.bind(this),this.de.bind(this))}return t.prototype.Ji=function(){return this.ji},t.prototype.K=function(){return this.un},t.prototype.$s=function(t){if($(this.un,t),this._e(),void 0!==t.mode&&this.we({be:t.mode}),void 0!==t.scaleMargins){var i=F(t.scaleMargins.top),n=F(t.scaleMargins.bottom);if(i<0||i>1)throw new Error("Invalid top margin - expect value between 0 and 1, given=".concat(i));if(n<0||n>1||i+n>1)throw new Error("Invalid bottom margin - expect value between 0 and 1, given=".concat(n));if(i+n>1)throw new Error("Invalid margins - sum of margins must be less than 1, given=".concat(i+n));this.Me(),this.ee=null}},t.prototype.me=function(){return this.un.autoScale},t.prototype.Ur=function(){return 1===this.un.mode},t.prototype.pe=function(){return 2===this.un.mode},t.prototype.ge=function(){return 3===this.un.mode},t.prototype.be=function(){return{zn:this.un.autoScale,ke:this.un.invertScale,be:this.un.mode}},t.prototype.we=function(t){var i=this.be(),n=null;void 0!==t.zn&&(this.un.autoScale=t.zn),void 0!==t.be&&(this.un.mode=t.be,2!==t.be&&3!==t.be||(this.un.autoScale=!0),this.Zr.Gr=!1),1===i.be&&t.be!==i.be&&(!function(t,i){if(null===t)return!1;var n=Vi(t.Nr(),i),s=Vi(t.Sr(),i);return isFinite(n)&&isFinite(s)}(this.Kr,this.le)?this.un.autoScale=!0:null!==(n=ji(this.Kr,this.le))&&this.ye(n)),1===t.be&&t.be!==i.be&&null!==(n=Ii(this.Kr,this.le))&&this.ye(n);var s=i.be!==this.un.mode;s&&(2===i.be||this.pe())&&this._e(),s&&(3===i.be||this.ge())&&this._e(),void 0!==t.ke&&i.ke!==t.ke&&(this.un.invertScale=t.ke,this.xe()),this.se.A(i,this.be())},t.prototype.Ne=function(){return this.se},t.prototype.W=function(){return this.ae.fontSize},t.prototype.li=function(){return this.Yr},t.prototype.Se=function(t){this.Yr!==t&&(this.Yr=t,this.Me(),this.ee=null)},t.prototype.Ce=function(){if(this.$r)return this.$r;var t=this.li()-this.Te()-this.Le();return this.$r=t,t},t.prototype.Fe=function(){return this.Ae(),this.Kr},t.prototype.ye=function(t,i){var n=this.Kr;(i||null===n&&null!==t||null!==n&&!n.kr(t))&&(this.ee=null,this.Kr=t)},t.prototype.et=function(){return this.Ae(),0===this.Yr||!this.Kr||this.Kr.et()},t.prototype.Pe=function(t){return this.ke()?t:this.li()-1-t},t.prototype.jt=function(t,i){return this.pe()?t=Di(t,i):this.ge()&&(t=zi(t,i)),this.de(t,i)},t.prototype.Ee=function(t,i,n){this.Ae();for(var s=this.Le(),h=A(this.Fe()),r=h.Nr(),e=h.Sr(),u=this.Ce()-1,o=this.ke(),l=u/(e-r),a=void 0===n?0:n.from,f=void 0===n?t.length:n.to,c=this.Be(),v=a;v<f;v++){var d=t[v],_=d.St;if(!isNaN(_)){var w=_;null!==c&&(w=c(d.St,i));var b=s+l*(w-r),M=o?b:this.Yr-1-b;d.gt=M}}},t.prototype.De=function(t,i,n){this.Ae();for(var s=this.Le(),h=A(this.Fe()),r=h.Nr(),e=h.Sr(),u=this.Ce()-1,o=this.ke(),l=u/(e-r),a=void 0===n?0:n.from,f=void 0===n?t.length:n.to,c=this.Be(),v=a;v<f;v++){var d=t[v],_=d.open,w=d.high,b=d.low,M=d.close;null!==c&&(_=c(d.open,i),w=c(d.high,i),b=c(d.low,i),M=c(d.close,i));var m=s+l*(_-r),p=o?m:this.Yr-1-m;d.Oe=p,m=s+l*(w-r),p=o?m:this.Yr-1-m,d.ze=p,m=s+l*(b-r),p=o?m:this.Yr-1-m,d.Re=p,m=s+l*(M-r),p=o?m:this.Yr-1-m,d.We=p}},t.prototype.cn=function(t,i){var n=this.ve(t,i);return this.Ve(n,i)},t.prototype.Ve=function(t,i){var n=t;return this.pe()?n=function(t,i){return i<0&&(t=-t),t/100*i+i}(n,i):this.ge()&&(n=function(t,i){return t-=100,i<0&&(t=-t),t/100*i+i}(n,i)),n},t.prototype.Ie=function(){return this.he},t.prototype.je=function(){if(this.re)return this.re;for(var t=[],i=0;i<this.he.length;i++){var n=this.he[i];null===n.Ui()&&n.Yi(i+1),t.push(n)}return t=Yi(t),this.re=t,this.re},t.prototype.He=function(t){-1===this.he.indexOf(t)&&(this.he.push(t),this._e(),this.Je())},t.prototype.qe=function(t){var i=this.he.indexOf(t);if(-1===i)throw new Error("source is not attached to scale");this.he.splice(i,1),0===this.he.length&&(this.we({zn:!0}),this.ye(null)),this._e(),this.Je()},t.prototype.Vt=function(){for(var t=null,i=0,n=this.he;i<n.length;i++){var s=n[i].Vt();null!==s&&((null===t||s.Ue<t.Ue)&&(t=s))}return null===t?null:t.Jt},t.prototype.ke=function(){return this.un.invertScale},t.prototype.dr=function(){var t=null===this.Vt();if(null!==this.ee&&(t||this.ee.Ye===t))return this.ee.dr;this.ce.jr();var i=this.ce.dr();return this.ee={dr:i,Ye:t},this.ne.A(),i},t.prototype.$e=function(){return this.ne},t.prototype.Ke=function(t){this.pe()||this.ge()||null===this.ue&&null===this.Xr&&(this.et()||(this.ue=this.Yr-t,this.Xr=A(this.Fe()).yr()))},t.prototype.Xe=function(t){if(!this.pe()&&!this.ge()&&null!==this.ue){this.we({zn:!1}),(t=this.Yr-t)<0&&(t=0);var i=(this.ue+.2*(this.Yr-1))/(t+.2*(this.Yr-1)),n=A(this.Xr).yr();i=Math.max(i,.1),n.Tr(i),this.ye(n)}},t.prototype.Ze=function(){this.pe()||this.ge()||(this.ue=null,this.Xr=null)},t.prototype.Ge=function(t){this.me()||null===this.oe&&null===this.Xr&&(this.et()||(this.oe=t,this.Xr=A(this.Fe()).yr()))},t.prototype.Qe=function(t){if(!this.me()&&null!==this.oe){var i=A(this.Fe()).Cr()/(this.Ce()-1),n=t-this.oe;this.ke()&&(n*=-1);var s=n*i,h=A(this.Xr).yr();h.Lr(s),this.ye(h,!0),this.ee=null}},t.prototype.tu=function(){this.me()||null!==this.oe&&(this.oe=null,this.Xr=null)},t.prototype.oh=function(){return this.ah||this._e(),this.ah},t.prototype.Bi=function(t,i){switch(this.un.mode){case 2:return this.oh().format(Di(t,i));case 3:return this.oh().format(zi(t,i));default:return this.iu(t)}},t.prototype.qr=function(t){switch(this.un.mode){case 2:case 3:return this.oh().format(t);default:return this.iu(t)}},t.prototype.nu=function(t){return this.iu(t,A(this.su()).oh())},t.prototype.hu=function(t,i){return t=Di(t,i),Ki.format(t)},t.prototype.ru=function(){return this.he},t.prototype.eu=function(t){this.Zr={Qr:t,Gr:!1}},t.prototype.Cn=function(){this.he.forEach(function(t){return t.Cn()})},t.prototype._e=function(){this.ee=null;var t=this.su(),i=100;null!==t&&(i=Math.round(1/t.eh())),this.ah=Xi,this.pe()?(this.ah=Ki,i=100):this.ge()?(this.ah=new Si(100,1),i=100):null!==t&&(this.ah=t.oh()),this.ce=new Ui(this,i,this.ve.bind(this),this.de.bind(this)),this.ce.jr()},t.prototype.Je=function(){this.re=null},t.prototype.su=function(){return this.he[0]||null},t.prototype.Te=function(){return this.ke()?this.un.scaleMargins.bottom*this.li()+this.ie:this.un.scaleMargins.top*this.li()+this.te},t.prototype.Le=function(){return this.ke()?this.un.scaleMargins.top*this.li()+this.te:this.un.scaleMargins.bottom*this.li()+this.ie},t.prototype.Ae=function(){this.Zr.Gr||(this.Zr.Gr=!0,this.uu())},t.prototype.Me=function(){this.$r=null},t.prototype.de=function(t,i){if(this.Ae(),this.et())return 0;t=this.Ur()&&t?Wi(t,this.le):t;var n=A(this.Fe()),s=this.Le()+(this.Ce()-1)*(t-n.Nr())/n.Cr();return this.Pe(s)},t.prototype.ve=function(t,i){if(this.Ae(),this.et())return 0;var n=this.Pe(t),s=A(this.Fe()),h=s.Nr()+s.Cr()*((n-this.Le())/(this.Ce()-1));return this.Ur()?Vi(h,this.le):h},t.prototype.xe=function(){this.ee=null,this.ce.jr()},t.prototype.uu=function(){var t=this.Zr.Qr;if(null!==t){for(var i,n,s=null,h=0,r=0,e=0,u=this.ru();e<u.length;e++){var o=u[e];if(o.Wt()){var l=o.Vt();if(null!==l){var a=o.uh(t.ou(),t.lu()),f=a&&a.Fe();if(null!==f){switch(this.un.mode){case 1:f=Ii(f,this.le);break;case 2:f=Oi(f,l.Jt);break;case 3:f=Ri(f,l.Jt)}if(s=null===s?f:s.Yn(A(f)),null!==a){var c=a.au();null!==c&&(h=Math.max(h,c.above),r=Math.max(h,c.below))}}}}}if(h===this.te&&r===this.ie||(this.te=h,this.ie=r,this.ee=null,this.Me()),null!==s){if(s.Nr()===s.Sr()){var v=this.su(),d=5*(null===v||this.pe()||this.ge()?1:v.eh());this.Ur()&&(s=ji(s,this.le)),s=new Ti(s.Nr()-d,s.Sr()+d),this.Ur()&&(s=Ii(s,this.le))}if(this.Ur()){var _=ji(s,this.le),w=Hi(_);if(i=w,n=this.le,i.Pr!==n.Pr||i.Er!==n.Er){var b=null!==this.Xr?ji(this.Xr,this.le):null;this.le=w,s=Ii(_,w),null!==b&&(this.Xr=Ii(b,w))}}this.ye(s)}else null===this.Kr&&(this.ye(new Ti(-.5,.5)),this.le=Hi(null));this.Zr.Gr=!0}},t.prototype.Be=function(){var t=this;return this.pe()?Di:this.ge()?zi:this.Ur()?function(i){return Wi(i,t.le)}:null},t.prototype.iu=function(t,i){return void 0===this.fe.priceFormatter?(void 0===i&&(i=this.oh()),i.format(t)):this.fe.priceFormatter(t)},t}();!function(t){t.fu="default",t.cu="crosshair",t.vu="pointer",t.du="grabbing",t._u="zoom-in",t.wu="n-resize",t.bu="e-resize",t.Mu="nesw-resize",t.mu="nwse-resize",t.pu="not-allowed"}($i||($i={}));var Gi=function(){function t(t,i){this.he=[],this.gu=new Map,this.Yr=0,this.ku=0,this.yu=1e3,this.re=null,this.xu=new Y,this.Nu=t,this.zi=i,this.Su=new yi(this);var n=i.K();this.Cu=this.Tu("left",n.leftPriceScale),this.Lu=this.Tu("right",n.rightPriceScale),this.Cu.Ne().N(this.Fu.bind(this,this.Cu),this),this.Lu.Ne().N(this.Fu.bind(this,this.Cu),this),this.Au(n)}return t.prototype.Au=function(t){if(t.leftPriceScale&&this.Cu.$s(t.leftPriceScale),t.rightPriceScale&&this.Lu.$s(t.rightPriceScale),t.localization&&(this.Cu._e(),this.Lu._e()),t.overlayPriceScales)for(var i=0,n=Array.from(this.gu.values());i<n.length;i++){var s=A(n[i][0].Ht());s.$s(t.overlayPriceScales),t.localization&&s._e()}},t.prototype.Pu=function(t){switch(t){case"left":return this.Cu;case"right":return this.Lu}return this.gu.has(t)?F(this.gu.get(t))[0].Ht():null},t.prototype.B=function(){this.ri().Eu().F(this),this.Cu.Ne().F(this),this.Lu.Ne().F(this),this.he.forEach(function(t){t.B&&t.B()}),this.xu.A()},t.prototype.Bu=function(){return this.yu},t.prototype.Du=function(t){this.yu=t},t.prototype.ri=function(){return this.zi},t.prototype.oi=function(){return this.ku},t.prototype.li=function(){return this.Yr},t.prototype.Ou=function(t){this.ku=t,this.zu()},t.prototype.Se=function(t){var i=this;this.Yr=t,this.Cu.Se(t),this.Lu.Se(t),this.he.forEach(function(n){if(i.Ru(n)){var s=n.Ht();null!==s&&s.Se(t)}}),this.zu()},t.prototype.Ie=function(){return this.he},t.prototype.Ru=function(t){var i=t.Ht();return null===i||this.Cu!==i&&this.Lu!==i},t.prototype.He=function(t,i,n){var s=void 0!==n?n:this.Vu().Wu+1;this.Iu(t,i,s)},t.prototype.qe=function(t){var i=this.he.indexOf(t);L(-1!==i,"removeDataSource: invalid data source"),this.he.splice(i,1);var n=A(t.Ht()).Ji();if(this.gu.has(n)){var s=F(this.gu.get(n)),h=s.indexOf(t);-1!==h&&(s.splice(h,1),0===s.length&&this.gu.delete(n))}var r=t.Ht();r&&r.Ie().indexOf(t)>=0&&r.qe(t),null!==r&&(r.Je(),this.ju(r)),this.re=null},t.prototype.Hu=function(){return this.he.filter(function(t){return t instanceof Zt}).map(function(t){return t})},t.prototype.Ju=function(t){var i=this.he.filter(function(i){return i instanceof Zt&&i.Ji()===t}).map(function(t){return t});return i.length>0?i[0]:null},t.prototype.qu=function(){return this.he.filter(function(t){return t instanceof Zt&&t.Qn()}).map(function(t){return t})},t.prototype.Uu=function(t){return t===this.Cu?"left":t===this.Lu?"right":"overlay"},t.prototype.Yu=function(){return this.Cu},t.prototype.Us=function(){return this.Lu},t.prototype.$u=function(t,i){t.Ke(i)},t.prototype.Ku=function(t,i){t.Xe(i),this.zu()},t.prototype.Xu=function(t){t.Ze()},t.prototype.Zu=function(t,i){t.Ge(i)},t.prototype.Gu=function(t,i){t.Qe(i),this.zu()},t.prototype.Qu=function(t){t.tu()},t.prototype.zu=function(){this.he.forEach(function(t){t.Cn()})},t.prototype.fn=function(){var t=null;return this.zi.K().rightPriceScale.visible&&0!==this.Lu.Ie().length?t=this.Lu:this.zi.K().leftPriceScale.visible&&0!==this.Cu.Ie().length?t=this.Cu:0!==this.he.length&&(t=this.he[0].Ht()),null===t&&(t=this.Lu),t},t.prototype.io=function(){var t=null;return this.zi.K().rightPriceScale.visible?t=this.Lu:this.zi.K().leftPriceScale.visible&&(t=this.Cu),t},t.prototype.ju=function(t){null!==t&&t.me()&&this.no(t)},t.prototype.so=function(t){var i=this.Nu.es();t.we({zn:!0}),null!==i&&t.eu(i),this.zu()},t.prototype.ho=function(){this.no(this.Cu),this.no(this.Lu)},t.prototype.ro=function(){var t=this;this.ju(this.Cu),this.ju(this.Lu),this.he.forEach(function(i){t.Ru(i)&&t.ju(i.Ht())}),this.zu(),this.zi.eo()},t.prototype.je=function(){return null===this.re&&(this.re=Yi(this.he)),this.re},t.prototype.uo=function(){return this.xu},t.prototype.oo=function(){return this.Su},t.prototype.no=function(t){var i=t.ru();if(i&&i.length>0&&!this.Nu.et()){var n=this.Nu.es();null!==n&&t.eu(n)}t.Cn()},t.prototype.Vu=function(){var t=this.je();if(0===t.length)return{lo:0,Wu:0};for(var i=0,n=0,s=0;s<t.length;s++){var h=t[s].Ui();null!==h&&(h<i&&(i=h),h>n&&(n=h))}return{lo:i,Wu:n}},t.prototype.Iu=function(t,i,n){var s=this.Pu(i);if(null===s&&(s=this.Tu(i,this.zi.K().overlayPriceScales)),this.he.push(t),!Ct(i)){var h=this.gu.get(i)||[];h.push(t),this.gu.set(i,h)}s.He(t),t.$i(s),t.Yi(n),this.ju(s),this.re=null},t.prototype.Fu=function(t,i,n){i.be!==n.be&&this.no(t)},t.prototype.Tu=function(t,i){var n=q({visible:!0,autoScale:!0},Q(i)),s=new Zi(t,n,this.zi.K().layout,this.zi.K().localization);return s.Se(this.li()),s},t}(),Qi=function(t){function i(i,n,s,h){var r=t.call(this,i,n)||this;return r.bh=s,r.ao=h,r}return J(i,t),i.prototype.clone=function(){return new i(this.x,this.y,this.bh,this.ao)},i}(s),tn=function(){function t(t){this.dt=void 0!==t?t:null}return t.prototype._t=function(t){this.dt=t},t.prototype.fo=function(t){this.dt=$(this.dt,t)},t.prototype.ot=function(t,i,n,s){if(null!==this.dt&&this.dt.Wt){for(var h=[],r=[],e=[],u=[],o=0;o<this.dt.Ds.length;++o){var l=this.dt.Ds[o],a=this.dt.co[o];l.ao?(h.push(l),r.push(a)):(e.push(l),u.push(a))}t.strokeStyle=this.dt.j,h.length&&this.vo(t,i,h,r,hn,sn),e.length&&this.vo(t,i,e,u,en,rn)}},t.prototype.lt=function(t,i){if(null===this.dt)return null;for(var n=new s(t,i),h=0;h<this.dt.Ds.length;++h){var r=this.dt.Ds[h];if(r.subtract(n).length()<=this.dt.yt+ni){var e=void 0!==this.dt.do?this.dt.do[h]:$i.fu,u=r.bh;return new ti(this.dt._o,{wo:u,bo:e})}}return null},t.prototype.vo=function(t,i,n,s,h,r){var e=A(this.dt),u=e.Mo,o=Math.max(1,Math.floor((e.mo||2)*i));e.Qn&&(o+=Math.max(1,Math.floor(i/2)));var l=Math.max(1,Math.floor(i)),a=Math.round(e.yt*i*2);i%2!=l%2&&(a+=1);for(var f=l%2/2,c=0;c<n.length;++c){var v=n[c];if(t.fillStyle=s[c],!Number.isInteger(v.bh)||e.po!==v.bh){var d=Math.round(v.x*i)+f,_=Math.round(v.y*i)+f;if(h(t,new Qi(d,_,v.bh,v.ao),a/2,o),v.subtract(u).length()<=e.yt+ni){var w=Math.max(1,Math.floor(e.ko*i));r(t,new Qi(d,_,v.bh,v.ao),a/2,w)}}}},t}();function nn(t,i,n,s){t.lineWidth=s;var h=n+s/2;hi(t,i.x-h,i.y-h,2*h,2*h,(n+s)/2),t.closePath()}function sn(t,i,n,s){t.globalAlpha=.2,nn(t,i,n,s),t.stroke(),t.globalAlpha=1}function hn(t,i,n,s){nn(t,i,n-s,s),t.fill(),t.stroke()}function rn(t,i,n,s){t.lineWidth=s,t.globalAlpha=.2,t.beginPath(),t.arc(i.x,i.y,n+s/2,0,2*Math.PI,!0),t.closePath(),t.stroke(),t.globalAlpha=1}function en(t,i,n,s){t.lineWidth=s,t.beginPath(),t.arc(i.x,i.y,n-s/2,0,2*Math.PI,!0),t.closePath(),t.fill(),t.stroke()}var un=function(){function t(t,i){this.Ls=[],this.fs=!0,this.yo=null,this.xo=null,this.No=[],this.Kn=null,this.So=[],this.Co=!1,this.Zn=t,this.Gn=i}return t.prototype.To=function(t,i,n,h){if(h&&(this.Kn&&this.Kn.lt||!this.Zn.Ps())){var r=this.Gn.Lo(),e=new s(r.ai(),r.fi()),u=new s(r.Mn(),r.mn()),o=11!==n||h.Fo?9===n?this.Ao(t,i,u,e,h):6===n?this.Po(t,i,u,e,h):10===n&&this.Eo(t):this.Bo(t,i,u,e,h);h.Fo||(h.Fo=this.Zn.Qs()||!this.Zn.Ps()),(o||this.Zn.Xs()||this.Zn.Qs()||!this.Zn.Ps())&&this.Do()}},t.prototype.Bt=function(t,i,n){return this.Zn.K().visible?(this.fs&&this.cs(t,i),this.Kn):null},t.prototype.jt=function(t){var i=this.Zn.Ht(),n=this.Zn.us();if(null===i)return null;var s=null!==n?n.Vt():null;return null===s?null:i.jt(t,s.Jt)},t.prototype.Mo=function(){var t=this.Gn.Lo();return new s(t.Mn(),t.mn())},t.prototype.po=function(){return this.Zn.Qs()?this.xo:null},t.prototype.Oo=function(){return this.Zn.Xs()||this.Zn.Qn()||this.Zn.Qs()||!this.Zn.Ps()},t.prototype.Pt=function(){this.fs=!0},t.prototype.zo=function(t){t.st(this.Ro({Ds:this.Ls},0))},t.prototype.Do=function(){var t=this;this.No.forEach(function(i){i.fo({Ds:t.Ls,Qn:t.Zn.Qn(),Wt:t.Oo(),Mo:t.Mo(),po:t.po()})}),this.Gn.Bs(this.Zn),this.Zn.Cn()},t.prototype.Ro=function(t,i){var n=this.Wo(i);return n._t(q(q({},t),{yt:6,mo:1,j:"#1E53E5",ko:4,Qn:this.Zn.Qn(),Wt:this.Oo(),Mo:this.Mo(),co:this.Vo(t.Ds),po:this.Zn.Qs()?this.po():null,_o:Qt.gh})),n},t.prototype.Io=function(t,i,n){var s=t.Js().Ju(n);if(null!==s){var h=Q(s.dh());this.Gn.jo(h,i)}},Object.defineProperty(t.prototype,"Ho",{get:function(){return this.Co},enumerable:!1,configurable:!0}),t.prototype.Jo=function(t){this.Co=t},t.prototype.Eo=function(t){if("LongShortPosition"===this.Zn.sh()&&this.Jo(!1),this.Zn.Ps()){if(this.Zn.Qs()){this.Gn.Uo().qo(),this.Yo(),this.yo=null,this.xo=null,this.Zn.th(!1),this.Zn.nh(!1);i=this.Zn.Ji();return this.Io(t,"lineToolEdited",i),!0}}else{"LongShortPosition"!==this.Zn.sh()&&this.Zn.Es();var i=this.Zn.Ji();this.Zn.Qs()||this.Zn.ih()?this.Zn.Ps()&&this.Io(t,"pathFinished",i):this.Io(t,"lineToolFinished",i)}return!1},t.prototype.Bo=function(t,i,n,s,h){var r;if(!this.Zn.Ps())return this.Zn.hh()&&this.Zn.Os(this.Zn.js(s)),!1;if(!this.Zn.Qn())return!1;if(this.Zn.Qs()){if(t.$o(null!==this.xo?$i.fu:$i.du),null!==this.xo)if(this.Ko(s,h,!0,n),"LongShortPosition"===this.Zn.sh()){var e=this.Zn,u=A(this.Zn.Ht()),o=this.Gn.zt(),l=A(this.Zn.us()).Vt(),a=JSON.parse(JSON.stringify(e.Xo())),f=JSON.parse(JSON.stringify(s));if(null!==l){if(0!==this.xo&&1!==this.xo||!e.Zo(this.xo,f,a)||(e.Go(e.Qo()),this.Jo(!0),e.tl()),0===this.xo||1===this.xo){var c=o.Hs(s.x).timestamp,v=u.cn(s.y,l.Jt);v=Number(u.Bi(v,l.Jt)),this.Zn.Rs(this.xo,{price:v,timestamp:c});var d=o.Wi({timestamp:c}),_=u.jt(v,l.Jt);this.Ls[this.xo].x=d,this.Ls[this.xo].y=_}else if(2===this.xo){var w=u.cn(s.y,l.Jt);w=Number(u.Bi(w,l.Jt)),this.Zn.Rs(this.xo,{price:w,timestamp:this.Zn.Ds()[1].timestamp})}this.Ls[2].x=o.Wi({timestamp:this.Zn.Ds()[2].timestamp}),this.Ls[2].y=u.jt(this.Zn.Ds()[2].price,l.Jt)}}else this.Zn.Rs(this.xo,this.Zn.js(s));else if(this.yo){var b=s.subtract(this.yo);this.Ls.forEach(function(t){t.x=t.x+b.x,t.y=t.y+b.y}),this.yo=s,this.Yo()}}else{var M=this.Nh(t,i,n),m=null==M?void 0:M.bh();this.Zn.th(this.Zn.Xs()||!!M),this.yo=s,this.xo=null!==(r=null==m?void 0:m.wo)&&void 0!==r?r:this.xo,m&&this.Gn.Uo().il()}return!1},t.prototype.Ao=function(t,i,n,s,h){var r,e,u,o;if(this.Zn.Ps()){var l=this.Nh(t,i,n),a=this.Zn.Zs(null!==l&&!h.Fo);return this.Zn.Xs()&&!h.Fo&&(!0===this.Zn.K().editable?(t.$o((null===(r=null==l?void 0:l.bh())||void 0===r?void 0:r.bo)||$i.vu),this.xo=null!==(u=null===(e=null==l?void 0:l.bh())||void 0===e?void 0:e.wo)&&void 0!==u?u:null):t.$o((null===(o=null==l?void 0:l.bh())||void 0===o?void 0:o.bo)||$i.pu)),a}if("LongShortPosition"===this.Zn.sh()){var f=this.Zn;if(!this.Zn.Ps()&&1===f.nl()){this.Zn.rh()&&this.Gn.Uo().il();var c=A(this.Zn.Ht()),v=c.Vt();this.Ko(s,h,!1,n);var d=this.Zn.js(s);null!==v&&(d.price=Number(c.Bi(d.price,v))),this.Zn.sl(d)}}else this.Zn.rh()&&this.Gn.Uo().il(),this.Ko(s,h,!1,n),this.Zn.Vs(this.Zn.js(s));return!1},t.prototype.Po=function(t,i,n,s,h){if(this.So=this.Ls,"LongShortPosition"===this.Zn.sh()){var r=this.Zn;if(3===this.Zn.Ds().length&&2===r.nl()){var e=A(this.Zn.Ht()),u=A(e.Vt()),o=Number(e.Bi(this.Zn.Ds()[0].price,u)),l=Number(e.Bi(this.Zn.Ds()[1].price,u));r.Go(o>l)}}if(!this.Zn.Ps()){if("LongShortPosition"===this.Zn.sh()){this.Jo(!1);r=this.Zn;!this.Zn.Ps()&&r.nl()<2&&(r.hl(r.nl()+1),this.Zn.Os(this.Zn.js(s)))}else this.Ko(s,h,!1,n),this.Zn.Os(this.Zn.js(s));return!1}if(!0===this.Zn.K().editable){var a=this.Nh(t,i,n);return null===a?(this.Zn.Gs(!1),!0):this.Zn.Gs(null!==a&&!h.Fo)}return!1},t.prototype.Yo=function(){var t=this;this.Zn.Ws(this.Ls.map(function(i){return t.Zn.js(i)}))},t.prototype.Nh=function(t,i,n){var s;return(null===(s=this.Kn)||void 0===s?void 0:s.lt)?this.Kn.lt(n.x,n.y,i):null},t.prototype.Vo=function(t){var i=this,n=A(this.Gn.rl(this.Zn)).li();return t.map(function(t){return i.Gn.Ut(t.y/n)})},t.prototype.cs=function(t,i){if(this.fs=!1,!this.Gn.zt().et()&&this.el()){this.Ls=[];var n=this.Zn.Ds(),s=A(this.Zn.Ht()),h=this.Gn.zt(),r=A(this.Zn.us()).Vt();if("LongShortPosition"===this.Zn.sh()){for(var e=this.Zn,u=0;u<2;u++){if(void 0!==(f=n[u])){var o=h.Wi({timestamp:f.timestamp}),l=NaN;null!==r&&(l=s.jt(f.price,r.Jt)),this.Ls.push(new Qi(o,l,u,!1))}}if(n.length>=3){var a=e.ul(e.Ds()[2]);o=h.Wi({timestamp:a.timestamp}),l=NaN;null!==r&&(l=s.jt(a.price,r.Jt)),this.Ls.push(new Qi(o,l,2,!1))}}else for(u=0;u<n.length;u++){var f;if(!(f=this.Zn.Is(n[u])))return;f.bh=u,this.Ls.push(f)}}},t.prototype.el=function(){var t=this.Zn.Ht();return null!==t&&!t.et()},t.prototype.Wo=function(t){for(;this.No.length<=t;)this.No.push(new tn);return this.No[t]},t.prototype.Ko=function(t,i,n,s){var h=this.ol(),r=String(this.Zn.sh());if(!0===i.ll&&!0===h&&this.Ls.length>0)if(n)if(1===this.xo)t.y=this.Ls[0].y;else if(0===this.xo)t.y=this.Ls[1].y;else if(2===this.xo){var e=this.Ls[0].y-this.Ls[1].y;t.y=this.Ls[2].y-e}else 3===this.xo&&(t.y=this.Ls[2].y);else!0===i.ll&&!0===h&&this.Ls.length>0&&(t.y=this.Ls[0].y);"FibRetracement"===r&&!0===i.ll&&2===this.Ls.length&&null!==this.xo&&2===this.So.length&&(t.y=this.So[this.xo].y),"LongShortPosition"===r&&!0===i.ll&&this.Ls.length>=2&&null!==this.xo&&this.So.length>=2&&(0===this.xo?t.y=this.So[0].y:1===this.xo&&(t.y=this.So[1].y)),"Rectangle"===r&&!0===i.ll&&2===this.Ls.length&&null!==this.xo&&2===this.So.length&&(0===this.xo||3===this.xo?t.y=this.So[0].y:1!==this.xo&&2!==this.xo||(t.y=this.So[1].y)),"PriceRange"===r&&!0===i.ll&&2===this.Ls.length&&null!==this.xo&&2===this.So.length&&(0===this.xo||3===this.xo?t.y=this.So[0].y:1!==this.xo&&2!==this.xo||(t.y=this.So[1].y))},t.prototype.ol=function(){var t=!1,i=String(this.Zn.sh());return"TrendLine"!==i&&"Ray"!==i&&"Arrow"!==i&&"ExtendedLine"!==i&&"ParallelChannel"!==i||(t=!0),t},t}(),on=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.al=new si,s.fl=new ui,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){var i,n=this.Zn.K();if(n.visible){this.Kn=null,this.fs=!1;var h=this.Zn.Ht(),r=this.Gn.zt();if(h&&!h.et()&&!r.et()){var e=r.cl();if(null!==e){var u=this.Zn.Ds();if(!(u.length<2)){var o=u[0],l=u[1];if(o&&l){var a=this.Zn.us(),f=null==a?void 0:a.Vt();if(f){var c=h.jt(o.price,f.Jt),v=h.jt(l.price,f.Jt),d=this.Gn.rl(this.Zn),_=null!==(i=null==d?void 0:d.li())&&void 0!==i?i:0,w=c<0&&v<0||c>_&&v>_,b=Math.min(u[0].timestamp,u[1].timestamp)>Number(e.to),M=Math.max(u[0].timestamp,u[1].timestamp)<Number(e.from);if(!(w||(b||M))||n.line.extend.left||n.line.extend.right){if(t.prototype.cs.call(this),this.Ls.length<2)return;var m=new rt;if(this.al._t({Ch:n.line,Ds:this.Ls}),m.st(this.al),n.text.value){var p=this.Ls[0],g=this.Ls[1],k=p.x<g.x?p:g,y=k===p?g:p,x=Math.atan((y.y-k.y)/(y.x-k.x))/Math.PI*-180,N=n.text.box.alignment.horizontal,S="left"===N?k.clone():"right"===N?y.clone():new s((p.x+g.x)/2,(p.y+g.y)/2),C=Gt(n.text);C.box=q(q({},C.box),{angle:x}),this.fl._t({wi:C,Ds:[S]}),m.st(this.fl)}this.zo(m),this.Kn=m}}}}}}}},i}(un),ln=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="TrendLine",h._h([new on(h,i)]),h}return J(i,t),i.prototype.As=function(){return 2},i}(Zt),an=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.qs="Arrow",i}return J(i,t),i}(ln),fn=function(t){function i(i){var n=t.call(this)||this;return n.vl=new ti(Qt.ph),n.Nh=i||new ti(Qt.mh),n.dt=null,n}return J(i,t),i.prototype._t=function(t){this.dt=t},i.prototype.lt=function(t,i){if(null===this.dt)return null;var n=this.dt.Ch.width||1,h=new s(t,i),r=Math.max(ii,Math.ceil(n/2)),e=this.dt.Ds.length;if(1===e)return function(t,i,n){return(t.x-i.x)*(t.x-i.x)+(t.y-i.y)*(t.y-i.y)<=n*n}(h,this.dt.Ds[0],r)?this.Nh:null;for(var u=1;u<e;u++)if(d(this.dt.Ds[u-1],this.dt.Ds[u],h)._<=r)return this.Nh;return this.dt.m&&e>0&&d(this.dt.Ds[0],this.dt.Ds[e-1],h)._<=r?this.Nh:this.dt.m&&w(h,this.dt.Ds)?this.vl:null},i.prototype.ft=function(t,i,n){var s,h;if(null!==this.dt&&this.dt.Ds&&this.dt.Ds.length){var r=this.dt.Ds.length,e=this.dt.Ch.style||0,u=this.dt.Ch.join||"round",o=this.dt.Ch.cap||"butt",l=this.dt.Ch.color||"white",a=this.dt.Ch.width||1;if(1===r)return this.dl(t,this.dt.Ds[0],r/2,l);t.beginPath(),t.lineCap=o,t.lineJoin=u,t.lineWidth=a,t.strokeStyle=l,g(t,e),t.moveTo(this.dt.Ds[0].x,this.dt.Ds[0].y);for(var f=0,c=this.dt.Ds;f<c.length;f++){var v=c[f];t.lineTo(v.x,v.y)}if(this.dt.m&&(t.fillStyle=this.dt.m.color,t.fill()),a>0&&t.stroke(),r>1){var d;if("butt"!==o&&(t.lineCap="butt"),1===(null===(s=this.dt.Ch.end)||void 0===s?void 0:s.left))T((d=this._l(this.dt.Ds[1],this.dt.Ds[0],a,o))[0],d[1],t,a,1);if(1===(null===(h=this.dt.Ch.end)||void 0===h?void 0:h.right))T((d=this._l(this.dt.Ds[r-2],this.dt.Ds[r-1],a,o))[0],d[1],t,a,1)}}},i.prototype.dl=function(t,i,n,s){0===n&&(t.beginPath(),t.fillStyle=s,t.arc(i.x,i.y,n,0,2*Math.PI,!0),t.fill(),t.closePath())},i.prototype._l=function(t,i,n,s){var h=i.subtract(t),r=h.length();if("butt"===s||r<1)return[t,i];var e=r+n/2;return[t,h.scaled(e/r).add(t)]},i}(et),cn=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.wl=new fn,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){if(t.prototype.cs.call(this),this.Kn=null,0!==this.Ls.length){for(var i=this.Zn.bl(),n=Math.max(1,this.Zn.Ml()),s=[this.Ls[0]],h=1;h<this.Ls.length;h++){for(var r=this.Ls[h].subtract(this.Ls[h-1]),e=r.length(),u=Math.min(5,Math.floor(e/n)),o=r.normalized().scaled(e/u),l=0;l<u-1;l++)s.push(this.Ls[h-1].add(o.scaled(l)));s.push(this.Ls[h])}var a=this.ml(s,n);this.wl._t({Ch:i.line,m:i.background,Ds:a});var f=new rt;f.st(this.wl),this.Kn=f}},i.prototype.ml=function(t,i){var n=new Array(t.length);if(1===t.length)return t;for(var h=0;h<t.length;h++){for(var r=new s(0,0),e=0;e<i;e++){var u=Math.max(h-e,0),o=Math.min(h+e,t.length-1);r=(r=r.add(t[u])).add(t[o])}n[h]=r.scaled(.5/i)}return n.push(t[t.length-1]),n},i}(un),vn=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="Brush",h._h([new cn(h,i)]),h}return J(i,t),i.prototype.As=function(){return-1},i.prototype.Ml=function(){return 5},i.prototype.bl=function(){return this.K()},i.prototype.Os=function(i){if(!this.xs){if(this.Ts=null,this.Ls.length>0){var n=this.Ls[this.Ls.length-1],s=A(this.Is(n));if(A(this.Is(i)).subtract(s).length()<2)return}return t.prototype.Os.call(this,i)}},i.prototype.rh=function(){return!1},i.prototype.hh=function(){return!0},i}(Zt),dn=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.al=new si,s.fl=new ui,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){var i,n=this.Zn.K();if(n.visible){this.Kn=null,this.fs=!1;var s=this.Zn.Ht(),h=this.Gn.zt();if(s&&!s.et()&&!h.et()){var r=h.cl();if(null!==r){var e=this.Zn.Ds();if(!(e.length<2)){var u=e[0],o=e[1];if(u&&o){var l=this.Zn.us(),a=null==l?void 0:l.Vt();if(a){var f=s.jt(u.price,a.Jt),c=s.jt(o.price,a.Jt),v=this.Gn.rl(this.Zn),d=null!==(i=null==v?void 0:v.li())&&void 0!==i?i:0,_=f<0&&c<0||f>d&&c>d,w=Math.min(e[0].timestamp,e[1].timestamp)>Number(r.to),b=Math.max(e[0].timestamp,e[1].timestamp)<Number(r.from);if(!(_||(w||b))||n.line.extend.left||n.line.extend.right){if(t.prototype.cs.call(this),this.Ls.length<2)return;var M=new rt;if(this.al._t({Ch:n.line,Ds:this.Ls}),M.st(this.al),n.text.value){var m=this.Ls[1].clone(),p=Gt(n.text);p.box=q(q({},p.box),{angle:0}),this.fl._t({wi:p,Ds:[m]}),M.st(this.fl)}this.zo(M),this.Kn=M}}}}}}}},i}(un),_n=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="Callout",h._h([new dn(h,i)]),h}return J(i,t),i.prototype.As=function(){return 2},i}(Zt),wn=function(){function t(t,i){this.vl=i||new ti(Qt.ph),this.Nh=t||new ti(Qt.mh),this.dt=null}return t.prototype._t=function(t){this.dt=t},t.prototype.lt=function(t,i,n){if(null===this.dt||this.dt.points.length<2)return null;var h=new s(t,i),r=this.dt.points,e=r[0],u=r[1],o=Math.sqrt(Math.pow(e.x-h.x,2)+Math.pow(e.y-h.y,2)),l=bn(e,u),a=this.pl(1);return o>=l+a-12&&o<=l+a||o<=24?this.Nh:null},t.prototype.ot=function(t,i,n,s){var h;if(!(this.gl()||null===this.dt||this.dt.points.length<2)){t.save();var r=this.pl(i),e=this.dt.points,u=e[0],o=e[1],l=this.kl(u),a=l[0],f=l[1],c=this.yl(u,o);if(this.xl(t,a,f,c)){var v=this.dt.background,d=null===(h=this.dt.border)||void 0===h?void 0:h.color;this.Nl(t,a,f,this.yl(u,o),null==v?void 0:v.color),this.Sl(t,a,f,this.yl(u,o),r,d,void 0!==d),t.restore()}}},t.prototype.gl=function(){var t,i,n,s;return null===this.dt||this.dt.points.length<2||((null===(i=null===(t=this.dt)||void 0===t?void 0:t.border)||void 0===i?void 0:i.width)||0)<=0&&!(null===(s=null===(n=this.dt)||void 0===n?void 0:n.background)||void 0===s?void 0:s.color)},t.prototype.pl=function(t){var i,n,s=(null===(n=null===(i=this.dt)||void 0===i?void 0:i.border)||void 0===n?void 0:n.width)||0;return s?Math.max(1,Math.floor(s*t)):0},t.prototype.kl=function(t){return[t.x,t.y]},t.prototype.yl=function(t,i){return bn(t,i)},t.prototype.Nl=function(t,i,n,s,h){void 0!==h&&(t.fillStyle=h,t.beginPath(),t.arc(i,n,s,0,2*Math.PI),t.fill())},t.prototype.Sl=function(t,i,n,s,h,r,e){var u,o;e&&void 0!==r&&h>0&&(t.beginPath(),g(t,(null===(o=null===(u=this.dt)||void 0===u?void 0:u.border)||void 0===o?void 0:o.style)||0),t.arc(i,n,s,0,2*Math.PI),t.lineWidth=h,t.strokeStyle=r,t.stroke())},t.prototype.xl=function(t,i,n,s){var h=t.canvas.width,r=t.canvas.height;return i+s>=0&&i-s<=h&&n+s>=0&&n-s<=r},t}();function bn(t,i){var n=i.x-t.x,s=i.y-t.y;return Math.sqrt(n*n+s*s)}var Mn,mn=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.Cl=new wn,s.fl=new ui,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){var i=this.Zn.K();if(i.visible&&(this.Kn=null,this.fs=!1,!(this.Zn.Ds().length<2||(t.prototype.cs.call(this),this.Ls.length<2)))){var n=new rt;this.Cl._t(q(q({},Gt(i.circle)),{points:this.Ls,hitTestBackground:!1})),n.st(this.Cl);var s=this.Ls[0],h=this.Ls[1];if(i.text.value){var r=bn(s,h),e=s.x-r,u=s.x+r,o=s.y-r,l=s.y+r,a=s.clone(),f=i.text.font.size/3,c=0;switch(i.text.box.alignment.vertical){case"middle":a.y=(o+l)/2,c=f;break;case"top":a.y=o;break;case"bottom":a.y=l}switch(i.text.box.alignment.horizontal){case"center":a.x=(e+u)/2;break;case"left":a.x=e;break;case"right":a.x=u}var v=Gt(i.text);v.box=q(q({},v.box),{padding:{y:f,x:c}}),"middle"===i.text.box.alignment.vertical&&(v.box.maxHeight=l-o),this.fl._t({wi:v,Ds:[a]}),n.st(this.fl)}this.Tl(s,h,n),this.Kn=n}},i.prototype.Tl=function(t,i,n){var s={Ds:[new Qi(t.x,t.y,0,!1),new Qi(i.x,i.y,1,!1)],do:[$i.fu,$i.mu]};n.st(this.Ro(s,0))},i}(un),pn=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="Circle",h._h([new mn(h,i)]),h}return J(i,t),i.prototype.As=function(){return 2},i.prototype.Rs=function(i,n){switch(i<2&&t.prototype.Rs.call(this,i,n),i){case 2:this.Ls[1].price=n.price,this.Ls[0].timestamp=n.timestamp;break;case 3:this.Ls[0].price=n.price,this.Ls[1].timestamp=n.timestamp;break;case 4:this.Ls[0].timestamp=n.timestamp;break;case 5:this.Ls[1].timestamp=n.timestamp;break;case 6:this.Ls[0].price=n.price;break;case 7:this.Ls[1].price=n.price}},i.prototype.zs=function(i){return i<2?t.prototype.zs.call(this,i):this.Ll(i)},i.prototype.Ll=function(t){var i=this.Ds()[0],n=this.Ds()[1];return[{St:i.price,Fl:i.timestamp},{St:n.price,Fl:n.timestamp},{St:n.price,Fl:i.timestamp},{St:i.price,Fl:n.timestamp},{St:(n.price+i.price)/2,Fl:i.timestamp},{St:(n.price+i.price)/2,Fl:n.timestamp},{St:i.price,Fl:(n.timestamp+i.timestamp)/2},{St:n.price,Fl:(n.timestamp+i.timestamp)/2}][t]},i}(Zt),gn=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.Al=new si,s.Pl=new si,s.Kn=null,s.Al.Sh(new ti(Qt.mh)),s.Pl.Sh(new ti(Qt.mh)),s}return J(i,t),i.prototype.cs=function(i,n){this.Kn=null;var s=this.Zn.Ht(),h=this.Gn.zt();if(s&&!s.et()&&!h.et()&&!(this.Zn.Ds().length<1)){t.prototype.cs.call(this);var r=this.Zn.K();if(!(this.Ls.length<1)){var e=this.Ls[0],u=new Qi(e.x,i,0),o=new Qi(e.x,0,1),l=new Qi(0,e.y,0),a=new Qi(n,e.y,1),f={ou:!1,lu:!1},c={ou:0,lu:0},v=new rt;this.Al._t({Ch:q(q({},Gt(r.line)),{end:c,extend:f}),Ds:[u,o]}),this.Pl._t({Ch:q(q({},Gt(r.line)),{end:c,extend:f}),Ds:[l,a]}),v.st(this.Al),v.st(this.Pl),this.zo(v),this.Kn=v}}},i}(un),kn=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="CrossLine",h._h([new gn(h,i)]),h}return J(i,t),i.prototype.As=function(){return 1},i.prototype._s=function(){return this.K().line.color},i.prototype.ls=function(){return this.K().line.color},i}(Zt),yn=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.qs="ExtendedLine",i}return J(i,t),i}(ln),xn=function(){function t(t,i){this.vl=i||new ti(Qt.ph),this.Nh=t||new ti(Qt.mh),this.dt=null}return t.prototype._t=function(t){this.dt=t},t.prototype.lt=function(t,i,n){if(null===this.dt||this.dt.points.length<2)return null;var h=n.canvas.ownerDocument&&n.canvas.ownerDocument.defaultView&&n.canvas.ownerDocument.defaultView.devicePixelRatio||1,r=n.canvas.width,e=new s(t,i),u=this.El(h),o=u[0],l=u[1],a=new s(l.x,o.y),f=new s(o.x,l.y),c=this.Bl(e,o,a,r);if(null!==c)return c;var v=this.Bl(e,f,l,r);if(null!==v)return v;var d=this.Dl(e,o,l,r);return this.dt.hitTestBackground&&null!==d?d:null},t.prototype.ot=function(t,i,n,s){var h,r,e,u,o,l,a,f=(null===(r=null===(h=this.dt)||void 0===h?void 0:h.border)||void 0===r?void 0:r.width)||0,c=null===(u=null===(e=this.dt)||void 0===e?void 0:e.border)||void 0===u?void 0:u.color,v=null===(l=null===(o=this.dt)||void 0===o?void 0:o.background)||void 0===l?void 0:l.color;if(!(null===this.dt||this.dt.points.length<2||f<=0&&!v)){t.save();var d=f?Math.max(1,Math.floor(f*i)):0,_=(null===(a=this.dt.border)||void 0===a?void 0:a.style)||0,w=this.El(i),b=w[0],M=w[1],m=this.dt.extend||{};ri(t,b,M,v,c,d,_,"center",!!m.left,!!m.right,t.canvas.width),t.restore()}},t.prototype.El=function(t){var i=A(this.dt).points,n=i[0],h=i[1],r=Math.min(n.x,h.x),e=Math.max(n.x,h.x),u=Math.min(n.y,h.y),o=Math.max(n.y,h.y),l=Math.round(r*t),a=Math.round(e*t),f=Math.round(u*t),c=Math.round(o*t);return[new s(l,f),new s(a,c)]},t.prototype.Ol=function(t,i,n){var h,r,u=A(this.dt);if(e(t,i))return null;var o=Math.min(t.x,i.x),l=Math.max(t.x,i.x),a=(null===(h=u.extend)||void 0===h?void 0:h.left)?0:Math.max(o,0),f=(null===(r=u.extend)||void 0===r?void 0:r.right)?n:Math.min(l,n);return a>f||f<=0||a>=n?null:[new s(a,t.y),new s(f,i.y)]},t.prototype.Bl=function(t,i,n,s){var h=this.Ol(i,n,s);return null!==h&&d(h[0],h[1],t)._<=3?this.Nh:null},t.prototype.Dl=function(t,i,n,s){var r=this.Ol(i,n,s);return null!==r&&_(t,new h(r[0],r[1]))?this.vl:null},t}(),Nn=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.zl=[],s.Rl=[],s.Wl=[],s.Kn=null,s}return J(i,t),i.prototype.cs=function(){var i=this.Zn.K();if(i.visible){this.Kn=null,this.fs=!1;var n=this.Zn.Ht(),s=this.Gn.zt();if(n&&!n.et()&&!s.et()){var h=s.cl();if(null!==h){var r=this.Zn.Ds();if(!(r.length<2)){var e=Math.min(r[0].timestamp,r[1].timestamp)>Number(h.to),u=Math.max(r[0].timestamp,r[1].timestamp)<Number(h.from);if(!(e||u)||i.extend.left||i.extend.right){if(t.prototype.cs.call(this),this.Ls.length<2)return;for(var o=new rt,l=Math.min(this.Ls[0].x,this.Ls[1].x),a=Math.max(this.Ls[0].x,this.Ls[1].x),f=this.Vl(this.Zn.Ds()[0].price,this.Zn.Ds()[1].price,i.levels),c="",v=function(t,i,n){for(var s=0;s<t.length;s++)if(t[s][i]===n)return s;return-1},d=0,_=-1;d<f.length;d++,_++){if(i.levels[d].distanceFromCoeffEnabled){var w=v(i.levels,"coeff",i.levels[d].distanceFromCoeff);if(w>=0){var b=Number(f[w].St),M=Number(f[d].St),m=Math.abs(M-b);m>0&&(c=">>>>"+m+" from "+i.levels[w].coeff+" line")}}this.Wl[d]||(this.Wl.push(new si),this.Rl.push(new ui));var p=[new Qi(l,f[d].Mi,0),new Qi(a,f[d].Mi,0)];this.Wl[d]._t({Ch:q(q({},i.line),{extend:i.extend,color:i.levels[d].color}),Ds:p}),this.Rl[d]._t({wi:{alignment:"right",value:"".concat(i.levels[d].coeff,"(").concat(f[d].St,")").concat(c),font:{color:i.levels[d].color,size:11,family:nt},box:{alignment:{horizontal:"right",vertical:"middle"}}},Ds:p}),c="",o.st(this.Rl[d]),o.st(this.Wl[d]),_<0||(this.zl[_]||this.zl.push(new xn),this.zl[_]._t(q(q({},i.line),{extend:i.extend,background:{color:I(i.levels[d].color,i.levels[d].opacity)},points:[new Qi(l,f[d-1].Mi,0),new Qi(a,f[d].Mi,0)]})),o.st(this.zl[_]))}this.zo(o),this.Kn=o}}}}}},i.prototype.Vl=function(t,i,n){var s,h,r=(null===(h=null===(s=this.Zn.us())||void 0===s?void 0:s.Vt())||void 0===h?void 0:h.Jt)||0,e=this.Zn.Ht(),u=i-t;return e&&r?n.map(function(t){var n=i-t.coeff*u;return{Mi:e.jt(n,r),St:e.Bi(n,r)}}):[]},i}(un),Sn=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="FibRetracement",h._h([new Nn(h,i)]),h}return J(i,t),i.prototype.As=function(){return 2},i}(Zt),Cn=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.qs="Highlighter",i}return J(i,t),i.prototype.bl=function(){var t=this.K();return{visible:t.visible,editable:t.editable,line:{width:20,cap:"round",join:"round",style:0,color:t.line.color,end:{left:0,right:0}}}},i}(vn),Tn=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.al=new si,s.fl=new ui,s.Kn=null,s.al.Sh(new ti(Qt.mh)),s}return J(i,t),i.prototype.cs=function(i,n){var h,r=this.Zn.K();if(r.visible){this.Kn=null;var e=this.Zn.Ht(),u=this.Gn.zt();if(e&&!e.et()&&!u.et()){var o=this.Zn.Ds();if(!(o.length<1)){var l=o[0],a=this.Zn.us(),f=null==a?void 0:a.Vt();if(f){var c=e.jt(l.price,f.Jt),v=this.Gn.rl(this.Zn),d=null!==(h=null==v?void 0:v.li())&&void 0!==h?h:0,_=c<0||c>d,w=r.line.extend||{},b=w.left,M=w.right;if(!_){if(t.prototype.cs.call(this),this.Ls.length<1)return;var m=this.Ls[0],p=new Qi(b?0:m.x,m.y,0),g=new Qi(M?n:m.x,m.y,1);if(Math.floor(p.x)===Math.floor(g.x)||Math.max(p.x,g.x)<=0||g.x<p.x)return;b&&M&&(m.x=n/2,m.ao=!0);var k=new rt;if(this.al._t({Ch:q(q({},Gt(r.line)),{end:{ou:0,lu:0}}),Ds:[p,g]}),k.st(this.al),r.text.value){var y=Math.atan((g.y-p.y)/(g.x-p.x))/Math.PI*-180,x=r.text.box.alignment.horizontal,N="left"===x?p.clone():"right"===x?g.clone():new s((p.x+g.x)/2,(p.y+g.y)/2),S=Gt(r.text);S.box=q(q({},S.box),{angle:y}),this.fl._t({wi:S,Ds:[N]}),k.st(this.fl)}this.zo(k),this.Kn=k}}}}}},i}(un),Ln=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="HorizontalLine",h._h([new Tn(h,i)]),h}return J(i,t),i.prototype.As=function(){return 1},i.prototype.Ki=function(){return[]},i.prototype.vs=function(){return[]},i.prototype.ls=function(){return this.K().line.color},i}(Zt),Fn=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.qs="HorizontalRay",i}return J(i,t),i}(Ln),An=function(){function t(t,i){this.vl=i||new ti(Qt.ph),this.Nh=t||new ti(Qt.mh),this.dt=null}return t.prototype._t=function(t){this.dt=t},t.prototype.lt=function(t,i,n){if(null===this.dt||this.dt.points.length<2)return null;var h=n.canvas.ownerDocument&&n.canvas.ownerDocument.defaultView&&n.canvas.ownerDocument.defaultView.devicePixelRatio||1,r=n.canvas.width,e=new s(t,i),u=this.El(h),o=u[0],l=u[1],a=new s(l.x,o.y),f=new s(o.x,l.y),c=this.Bl(e,o,a,r);if(null!==c)return c;var v=this.Bl(e,f,l,r);if(null!==v)return v;if(d(a,l,e)._<=3)return this.Nh;if(d(o,f,e)._<=3)return this.Nh;var _=this.Dl(e,o,l,r);return this.dt.hitTestBackground&&null!==_?_:null},t.prototype.ot=function(t,i,n,s){var h,r,e,u,o,l,a,f=(null===(r=null===(h=this.dt)||void 0===h?void 0:h.border)||void 0===r?void 0:r.width)||0,c=null===(u=null===(e=this.dt)||void 0===e?void 0:e.border)||void 0===u?void 0:u.color,v=null===(l=null===(o=this.dt)||void 0===o?void 0:o.background)||void 0===l?void 0:l.color;if(!(null===this.dt||this.dt.points.length<2||f<=0&&!v)){t.save();var d=f?Math.max(1,Math.floor(f*i)):0,_=(null===(a=this.dt.border)||void 0===a?void 0:a.style)||0,w=this.El(i),b=w[0],M=w[1],m=this.dt.extend||{};ri(t,b,M,v,c,d,_,"center",!!m.left,!!m.right,t.canvas.width),t.restore()}},t.prototype.El=function(t){var i=A(this.dt).points,n=i[0],h=i[1],r=Math.min(n.x,h.x),e=Math.max(n.x,h.x),u=Math.min(n.y,h.y),o=Math.max(n.y,h.y),l=Math.round(r*t),a=Math.round(e*t),f=Math.round(u*t),c=Math.round(o*t);return[new s(l,f),new s(a,c)]},t.prototype.Ol=function(t,i,n){var h,r,u=A(this.dt);if(e(t,i))return null;var o=Math.min(t.x,i.x),l=Math.max(t.x,i.x),a=(null===(h=u.extend)||void 0===h?void 0:h.left)?0:Math.max(o,0),f=(null===(r=u.extend)||void 0===r?void 0:r.right)?n:Math.min(l,n);return a>f||f<=0||a>=n?null:[new s(a,t.y),new s(f,i.y)]},t.prototype.Bl=function(t,i,n,s){var h=this.Ol(i,n,s);return null!==h&&d(h[0],h[1],t)._<=3?this.Nh:null},t.prototype.Dl=function(t,i,n,s){var r=this.Ol(i,n,s);return null!==r&&_(t,new h(r[0],r[1]))?this.vl:null},t}(),Pn=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.Il=new An,s.jl=new An,s.fl=new ui,s.Hl=new ui,s.Jl=new ui,s.Kn=null,i.ql=function(t){s.Ul("lineToolFinished",t)},s}return J(i,t),i.prototype.Ul=function(t,i){var n=Q(this.Zn.dh());this.Gn.jo(n,t)},i.prototype.cs=function(){var i,n=this.Zn.K();if(n.visible){this.Kn=null,this.fs=!1;var s=this.Zn.Ht(),h=this.Gn.zt();if(s&&!s.et()&&!h.et()){var r=h.cl();if(null!==r){var e=this.Zn.Ds(),u=e[0],o=e[1],l=e[2];if(u&&o&&l){var a=this.Zn.us(),f=null==a?void 0:a.Vt();if(f){var c=s.jt(u.price,f.Jt),v=s.jt(o.price,f.Jt),d=s.jt(l.price,f.Jt),_=this.Gn.rl(this.Zn),w=null!==(i=null==_?void 0:_.li())&&void 0!==i?i:0,b=c<0&&v<0&&d<0||c>w&&v>w&&d>w,M=Math.min(e[0].timestamp,e[1].timestamp,e[2].timestamp)>Number(r.to),m=Math.max(e[0].timestamp,e[1].timestamp,e[2].timestamp)<Number(r.from);if(!(b||(M||m))||n.entryStopLossRectangle.extend.left||n.entryStopLossRectangle.extend.right||n.entryPtRectangle.extend.left||n.entryPtRectangle.extend.right){if(t.prototype.cs.call(this),0===this.Ls.length)return;var p=new rt,g=[this.Ls[0],this.Ls[1]],k=[this.Ls[0],this.Ls[2]];this.Il._t({points:g,background:n.entryStopLossRectangle.background,border:n.entryStopLossRectangle.border,extend:n.entryStopLossRectangle.extend,hitTestBackground:!1}),this.jl._t({points:k,background:n.entryPtRectangle.background,border:n.entryPtRectangle.border,extend:n.entryPtRectangle.extend,hitTestBackground:!1}),p.st(this.Il),p.st(this.jl);var y=this.Yl(n.entryStopLossText,g,!1);(n.entryStopLossText.value||""!==y.wi.value)&&(this.Hl._t({wi:y.wi,Ds:[y.$l]}),p.st(this.Hl));var x=this.Yl(n.entryPtText,k,!0);if((n.entryPtText.value||""!==x.wi.value)&&(this.Jl._t({wi:x.wi,Ds:[x.$l]}),p.st(this.Jl)),this.Zn.Ds().length>=3){var N=Number(this.Zn.eh()),S=this.Zn.Ds()[2].price,C=this.Zn.Ds()[0].price;if(S=this.Zn.Qo()?Math.max(S,C+N):Math.min(S,C-N),this.Zn.Rs(2,{price:S,timestamp:this.Zn.Ds()[2].timestamp}),null!==f){var T=h.Wi({timestamp:this.Zn.Ds()[2].timestamp}),L=s.jt(S,A(f.Jt));this.Ls[2].x=T,this.Ls[2].y=L}}this.Tl(p),this.Kn=p}}}}}}},i.prototype.Tl=function(t){t.st(this.Ro({Ds:[this.Ls[0],this.Ls[1],this.Ls[2]],do:[$i.mu,$i.Mu,$i.wu]},0))},i.prototype.Yl=function(t,i,n){void 0===n&&(n=!1);var s=i[0],h=i[1],r=Math.min(s.x,h.x),e=Math.max(s.x,h.x),u=Math.min(s.y,h.y),o=Math.max(s.y,h.y),l=s.clone(),a=t.font.size/3,f=0;switch(t.box.alignment.vertical){case"middle":l.y=(u+o)/2,f=a;break;case"top":l.y=u;break;case"bottom":l.y=o}switch(t.box.alignment.horizontal){case"center":l.x=(r+e)/2;break;case"left":l.x=r;break;case"right":l.x=e}var c=Gt(t);if(c.box=q(q({},c.box),{padding:{y:a,x:f}}),"middle"===t.box.alignment.vertical&&(c.box.maxHeight=o-u),this.Zn.K().showAutoText){var v=A(this.Zn.Ht()),d=A(v.Vt()),_=0;if(n){w=Number(v.Bi(this.Zn.Ds()[2].price,d)),b=Number(v.Bi(this.Zn.Ds()[0].price,d));_=Math.abs(w-b),c.value="PT: "+v.Bi(this.Zn.Ds()[2].price,d)+"\n"+"(".concat(_.toFixed(2)," pts)")}else{var w=Number(v.Bi(this.Zn.Ds()[0].price,d)),b=Number(v.Bi(this.Zn.Ds()[1].price,d));_=Math.abs(w-b),c.value="Entry: "+v.Bi(this.Zn.Ds()[0].price,d)+"\nStop: "+v.Bi(this.Zn.Ds()[1].price,d)+"\n"+"(".concat(_.toFixed(2)," pts)")}switch(c.font={family:"Arial",size:14,color:"rgba(255, 255, 255, 1)",bold:!1,italic:!1},this.Zn.Qo()?c.box.alignment=n?{vertical:"top",horizontal:"center"}:{vertical:"bottom",horizontal:"center"}:c.box.alignment=n?{vertical:"bottom",horizontal:"center"}:{vertical:"top",horizontal:"center"},c.box.alignment.horizontal){case"center":l.x=(r+e)/2;break;case"left":l.x=r;break;case"right":l.x=e}switch(c.box.alignment.vertical){case"middle":l.y=(u+o)/2;break;case"top":l.y=u;break;case"bottom":l.y=o}}return{wi:c,$l:l}},i}(un),En=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.ql=null,h.qs="LongShortPosition",h.Kl=null,h.Xl=null,h.Zl=0,h._h([new Pn(h,i)]),3===h.Ls.length&&(h.Zl=2),h}return J(i,t),i.prototype.As=function(){return 3},i.prototype.Qo=function(){return 3===this.Ls.length&&this.Ls[0].price>this.Ls[1].price},i.prototype.nl=function(){return this.Zl},i.prototype.hl=function(t){this.Zl=t},i.prototype.Os=function(i){var n=A(this.Ht()),s=A(n.Vt());i.price=Number(n.Bi(i.price,s)),0===this.Ls.length&&1===this.Zl?(t.prototype.Os.call(this,i),this.Ls.push(i),this.Ls.push(this.ul(i,!0))):this.xs||1!==this.Zl?2!==this.Zl||this.xs?t.prototype.Os.call(this,i):(this.Ls[1]=i,this.Ls[2]=this.ul(i,!0),this.Es(),this.Ps()&&null!==this.ql&&this.ql(this.Ji()),this.th(!1),this.nh(!1)):(this.Ls[1]=i,this.Ls[2]=this.ul(i,!0))},i.prototype.sl=function(t){if(!this.xs){var i=A(this.Ht()),n=A(i.Vt());t.price=Number(i.Bi(t.price,n)),this.Ls[1]=t,this.Xl=this.Ls[0].price>t.price,this.Ls[2]=this.ul(t,!0)}},i.prototype.Rs=function(i,n){var s=A(this.Ht()),h=A(s.Vt());if(n.price=Number(s.Bi(n.price,h)),t.prototype.Rs.call(this,i,n),(0===i||1===i||2===i)&&3===this.Ls.length){var r=this.ul(this.Ls[2]);this.Ls[2]=r}},i.prototype.zs=function(i){return i<this.As()?t.prototype.zs.call(this,i):3===i?this.ul(this.Ds()[2]):null},i.prototype.Ho=function(){return null!==this.Kl&&this.Kl!==this.Qo()},i.prototype.Zo=function(t,i,n){if(this.Ls.length<2||0!==t&&1!==t)return!1;var s=A(this.Ht()),h=A(this.us()),r=A(h.Vt()),e=s.cn(i.y,r.Jt);if(null===e)return!1;var u=Number(s.Bi(e,r.Jt)),o=!1;return 0===t?(n&&u<this.Ls[1].price||!n&&u>this.Ls[1].price)&&(o=!0):1===t&&(n&&u>this.Ls[0].price||!n&&u<this.Ls[0].price)&&(o=!0),o},i.prototype.tl=function(){if(3===this.Ls.length){var i=this.ul(this.Ls[2]);t.prototype.Rs.call(this,2,i)}},i.prototype.Go=function(t){this.Kl=t},i.prototype.Xo=function(){return this.Kl},i.prototype.ul=function(t,i){if(void 0===i&&(i=!1),this.Ls.length<2)return{price:0,timestamp:0};var n=Number(this.eh()),s=A(this.Ht()),h=A(s.Vt()),r=Number(s.Bi(this.Ls[0].price,h)),e=Number(s.Bi(this.Ls[1].price,h)),u=Math.abs(r-e),o=Number(s.Bi(t.price,h));i?o=this.Xl?r+3*u:r-3*u:(this.gs[0].Ho&&(o=this.Qo()?r+3*u:r-3*u),o=this.Qo()?Math.max(o,r+n):Math.min(o,r-n));return{price:o,timestamp:this.Ls[1].timestamp}},i.prototype.Ll=function(t){var i=this.Ds()[0],n=this.Ds()[1],s=this.Ds()[2];return[{St:i.price,Fl:i.timestamp},{St:n.price,Fl:n.timestamp},{St:s.price,Fl:s.timestamp},{St:n.price,Fl:s.timestamp}][t]},i}(Zt),Bn=function(){function t(t,i){this.Fh=null,this.Ah=null,this.Ph=null,this.Eh=null,this.Bh=null,this.dt=null,this.Nh=i||new ti(Qt.mh),void 0!==t&&this._t(t)}return t.prototype._t=function(t){this.dt=t,this.Ah=null,this.Fh=null,this.Ph=null,this.Eh=null,this.Bh=null},t.prototype.lt=function(t,i){return null===this.dt||void 0===this.dt.Ds||0===this.dt.Ds.length?null:w(new s(t,i),this.Dh())?this.Nh:null},t.prototype.Oh=function(t){return null!==this.dt&&void 0!==this.dt.Ds&&0!==this.dt.Ds.length&&_(this.dt.Ds[0],t)},t.prototype.zh=function(){return null===this.dt?{oi:0,li:0}:this.Rh()},t.prototype.Wh=function(t){if(null===this.dt)return{Mt:0,gt:0,oi:0,li:0};var i=this.Vh(t);return{Mt:i.Ih,gt:i.jh,oi:i.Hh,li:i.Jh}},t.prototype.qh=function(t,i,n){if(null===this.dt||void 0===this.dt.Ds||0===this.dt.Ds.length)return!0;var r=this.Vh(n);if(r.Ih+r.Hh<0||r.Ih>t){var e=new h(new s(0,0),new s(t,i));return this.Dh().every(function(t){return!_(t,e)})}return!1},t.prototype.Ws=function(t,i){A(this.dt).Ds=t,this.Nh=i||new ti(Qt.mh)},t.prototype.Uh=function(){return null===this.dt?"":this.Yh().Uh},t.prototype.$h=function(t,i,n){return function(t,i,n){Mn||Dn();n="[object String]"===Object.prototype.toString.call(n)?parseInt(n):n,t+="";var s=!Number.isInteger(n)||!isFinite(n)||n<=0?t.split(/\r\n|\r|\n|$/):t.split(/[^\S\r\n]*(?:\r\n|\r|\n|$)/);s[s.length-1]||s.pop();if(!Number.isInteger(n)||!isFinite(n)||n<=0)return s;Mn.font=i;for(var h=[],r=0;r<s.length;r++){var e=s[r],u=Mn.measureText(e).width;if(u<=n)h.push(e);else for(var o=e.split(/([-)\]},.!?:;])|(\s+)/);o.length;){var l=Math.floor(n/u*(o.length+2)/3);if(l<=0||Mn.measureText(o.slice(0,3*l-1).join("")).width<=n)for(;Mn.measureText(o.slice(0,3*(l+1)-1).join("")).width<=n;)l++;else for(;l>0&&Mn.measureText(o.slice(0,3*--l-1).join("")).width>n;);if(l>0)h.push(o.slice(0,3*l-1).join("")),o.splice(0,3*l);else{var a=o[0]+(o[1]||""),f=Math.floor(n/Mn.measureText(a).width*a.length);if(Mn.measureText(a.substring(0,f)).width<=n)for(;Mn.measureText(a.substring(0,f+1)).width<=n;)f++;else for(;f>1&&Mn.measureText(a.substring(0,--f)).width>n;);f=Math.max(1,f),h.push(a.substring(0,f)),o[0]=a.substring(f),o[1]=""}if(Mn.measureText(o.join("")).width<=n){h.push(o.join(""));break}}}return h}(t,n||this.Uh(),i)},t.prototype.ot=function(t,i){var n=this;if(null!==this.dt&&void 0!==this.dt.Ds&&0!==this.dt.Ds.length){var s,h=function(s,h){var e,u,o,l,a,f,c,v,d,_,w,b,M,m,p,g,k,y,x,N,S,C;if(null!==n.dt&&null!==n.dt.wi){var T=A(n.dt.Ht),L=A(T.Vt()),F=0;void 0!==n.dt.Ds&&n.dt.Ds.length>0&&void 0!==r.timestampStartOffset&&(F=Number(A(n.dt.Ds[0]).x*i)+r.timestampStartOffset);var P=Number(T.jt(Number(h),Number(L))),E=n.dt.wi,B=n.Vh(s,F,P),D=n.Kh(s,F,P).scaled(i),O=-((null===(e=E.box)||void 0===e?void 0:e.angle)||0)*Math.PI/180,z=B.Hh,R=B.Jh,W=F,V=P-R/2;t.save(),t.translate(D.x,D.y),t.rotate(O),t.translate(-D.x,-D.y);var I=n.Yh().W;if(t.textAlign=B.Xh,t.textBaseline="middle",t.font=n.Uh(),(null===(o=null===(u=E.box)||void 0===u?void 0:u.background)||void 0===o?void 0:o.color)||(null===(a=null===(l=E.box)||void 0===l?void 0:l.border)||void 0===a?void 0:a.color)||(null===(c=null===(f=E.box)||void 0===f?void 0:f.border)||void 0===c?void 0:c.highlight)&&E.wordWrapWidth){var j=Math.round(((null===(d=null===(v=E.box)||void 0===v?void 0:v.border)||void 0===d?void 0:d.width)||Math.max(I/12,1))*i),H=j/2,J=!1;if(null===(_=E.box)||void 0===_?void 0:_.shadow){var q=null===(w=E.box)||void 0===w?void 0:w.shadow,U=q.color,Y=q.blur,$=q.offset;t.save(),t.shadowColor=U,t.shadowBlur=Y,t.shadowOffsetX=(null==$?void 0:$.x)||0,t.shadowOffsetY=(null==$?void 0:$.y)||0,J=!0}var K=0,X=0;if(null===(b=E.box.border)||void 0===b?void 0:b.width){(null===(M=E.box.border)||void 0===M?void 0:M.color)&&(t.strokeStyle=E.box.border.color),t.lineWidth=j;var Z=null!==(g=null===(p=null===(m=E.box)||void 0===m?void 0:m.border)||void 0===p?void 0:p.radius)&&void 0!==g?g:0*i+j,G=null===(y=null===(k=E.box)||void 0===k?void 0:k.border)||void 0===y?void 0:y.style;hi(t,K=W-H-z/2,X=V-H,z*i+j,R*i+j,Z,G),(null===(x=E.box.background)||void 0===x?void 0:x.color)&&(t.fillStyle=E.box.background.color,t.fill()),J&&(t.restore(),J=!1)}else(null===(N=E.box.background)||void 0===N?void 0:N.color)&&(t.fillStyle=E.box.background.color,t.fillRect(K,X,z*i,R*i)),J&&(t.restore(),J=!1)}t.fillStyle=null===(S=E.font)||void 0===S?void 0:S.color;for(var Q=n.Gh(s).Zh,tt=null!==(C=r.lineWidth)&&void 0!==C?C:1,it=function(n){dt(t,i,function(){return t.fillText(n,F,P+tt*i)})},nt=0,st=Q;nt<st.length;nt++){it(st[nt])}t.restore()}},r=A(this.dt).Gl,e=A(r.marketDepthData),u=0,o=0,l=0;s=r,void 0!==e&&void 0!==s.marketDepthData&&void 0!==s.marketDepthData.Bids&&void 0!==s.marketDepthData.Asks&&(u=Math.max.apply(Math,s.marketDepthData.Bids.map(function(t){return Number(t.TotalSize)})),o=Math.max.apply(Math,s.marketDepthData.Asks.map(function(t){return Number(t.TotalSize)})),l=u>=o?u:o),void 0!==e&&void 0!==e.Bids&&e.Bids.forEach(function(s,e){var o,a;h(null!==(o=s.TotalSize)&&void 0!==o?o:"",null!==(a=s.Price)&&void 0!==a?a:""),"combined"===r.totalBidAskCalcMethod?n.Ql(t,i,s,r,"bid",l,e):n.Ql(t,i,s,r,"bid",u,e)}),void 0!==e&&void 0!==e.Asks&&e.Asks.forEach(function(s,e){var u,a;h(null!==(u=s.TotalSize)&&void 0!==u?u:"",null!==(a=s.Price)&&void 0!==a?a:""),"combined"===r.totalBidAskCalcMethod?n.Ql(t,i,s,r,"ask",l,e):n.Ql(t,i,s,r,"ask",o,e)}),t.restore()}},t.prototype.Ql=function(t,i,n,s,h,r,e){var u,o,l,a,f;if(null!==this.dt&&void 0!==this.dt.Ds&&0!==this.dt.Ds.length){var c=JSON.parse(JSON.stringify(n)),v=A(this.dt.Ht),d=A(v.Vt()),_=null===(u=this.Fh)||void 0===u?void 0:u.Hh,w=A(this.dt.Ds[0]).x*i+s.timestampStartOffset,b=v.jt(Number(c.Price),Number(d)),M=w+(null!==(o=s.lineOffset)&&void 0!==o?o:0)*i,m="yellow";"bid"===h?m=s.lineBidColor:"ask"===h&&(m=s.lineAskColor),t.strokeStyle=m,t.lineWidth=(null!==(l=s.lineWidth)&&void 0!==l?l:1)*i,g(t,null!==(a=s.lineStyle)&&void 0!==a?a:0),t.beginPath(),void 0!==_&&t.moveTo(M,b);var p=Number(c.TotalSize)/r*(null!==(f=s.lineLength)&&void 0!==f?f:100)*i;t.lineTo(M+p,b),t.stroke()}},t.prototype.Vh=function(t,i,n){var h,r,e,u,o,l,a,f,c,v,d,_,w,b,M,m,p,g,k,y,x,N,S=A(this.dt),C=Vn(S),T=Wn(S),L=jn(S)+C,P=In(S)+T,E=void 0!==i&&void 0!==n?new s(i,n):F(null===(h=this.dt)||void 0===h?void 0:h.Ds)[0],B=t||"",D=this.Rh(B),O=D.oi,z=D.li,R=E.y,W=E.x;switch(null===(u=null===(e=null===(r=S.wi)||void 0===r?void 0:r.box)||void 0===e?void 0:e.alignment)||void 0===u?void 0:u.vertical){case"top":R-=z+((null===(a=null===(l=null===(o=S.wi)||void 0===o?void 0:o.box)||void 0===l?void 0:l.offset)||void 0===a?void 0:a.y)||0);break;case"middle":R-=z/2;break;case"bottom":R+=(null===(v=null===(c=null===(f=S.wi)||void 0===f?void 0:f.box)||void 0===c?void 0:c.offset)||void 0===v?void 0:v.y)||0}var V=R+P+Jn(S)/2,I="start",j=0;switch(null===(w=null===(_=null===(d=S.wi)||void 0===d?void 0:d.box)||void 0===_?void 0:_.alignment)||void 0===w?void 0:w.horizontal){case"left":W+=(null===(m=null===(M=null===(b=S.wi)||void 0===b?void 0:b.box)||void 0===M?void 0:M.offset)||void 0===m?void 0:m.x)||0;break;case"center":W-=O/2;break;case"right":W-=O+((null===(k=null===(g=null===(p=S.wi)||void 0===p?void 0:p.box)||void 0===g?void 0:g.offset)||void 0===k?void 0:k.x)||0)}switch(F(null===(y=S.wi)||void 0===y?void 0:y.alignment)){case"start":case"left":I="start",j=W+L,Yn()&&((null===(x=S.wi)||void 0===x?void 0:x.forceTextAlign)?I="left":(j=W+O-L,I="right"));break;case"center":I="center",j=W+O/2;break;case"right":case"end":I="end",j=W+O-L,Yn()&&(null===(N=S.wi)||void 0===N?void 0:N.forceTextAlign)&&(I="right")}return this.Fh={Ih:W,jh:R,Hh:O,Jh:z,Xh:I,tr:V-R,Qh:j-W},this.Fh},t.prototype.ir=function(t){var i,n,s;if(Mn||Dn(),Mn.textBaseline="alphabetic",Mn.font=this.Uh(),null!==this.dt&&(null===(i=this.dt.wi)||void 0===i?void 0:i.wordWrapWidth)&&!(null===(n=this.dt.wi)||void 0===n?void 0:n.forceCalculateMaxLineWidth))return(null===(s=this.dt.wi)||void 0===s?void 0:s.wordWrapWidth)*Un(this.dt);for(var h=0,r=0,e=t;r<e.length;r++){var u=e[r];h=Math.max(h,Mn.measureText(u).width)}return h},t.prototype.Gh=function(t){var i,n,s,h,r,e=A(this.dt),u=t||"",o=this.$h(u,null===(i=e.wi)||void 0===i?void 0:i.wordWrapWidth);if(void 0!==(null===(s=null===(n=e.wi)||void 0===n?void 0:n.box)||void 0===s?void 0:s.maxHeight)){var l=F(null===(r=null===(h=e.wi)||void 0===h?void 0:h.box)||void 0===r?void 0:r.maxHeight),a=Jn(e),f=Hn(e),c=Math.floor((l+f)/(a+f));o.length>c&&(o=o.slice(0,c))}return this.Ph={nr:this.ir(o),Zh:o},this.Ph},t.prototype.Yh=function(){var t,i,n,s,h,r,e=A(this.dt),u=Jn(e),o=((null===(i=null===(t=e.wi)||void 0===t?void 0:t.font)||void 0===i?void 0:i.bold)?"bold ":"")+((null===(s=null===(n=e.wi)||void 0===n?void 0:n.font)||void 0===s?void 0:s.italic)?"italic ":"")+u+"px "+(null===(r=null===(h=e.wi)||void 0===h?void 0:h.font)||void 0===r?void 0:r.family);return this.Eh={Uh:o,W:u},this.Eh},t.prototype.Rh=function(t){var i=this.Gh(t),n=A(this.dt);return this.Bh={oi:zn(n,i.nr),li:Rn(n,i.Zh.length)},this.Bh},t.prototype.Dh=function(t){var i,n;if(null===this.dt)return[];var h=this.Vh(t),r=h.Ih,e=h.jh,u=h.Hh,o=h.Jh,l=this.Kh(t),a=-((null===(n=null===(i=this.dt.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.angle)||0)*Math.PI/180;return this.Ah=[On(new s(r,e),l,a),On(new s(r+u,e),l,a),On(new s(r+u,e+o),l,a),On(new s(r,e+o),l,a)],this.Ah},t.prototype.Kh=function(t,i,n){var h,r,e,u=this.Vh(t,i,n),o=u.Ih,l=u.jh,a=u.Hh,f=u.Jh,c=F(null===(e=null===(r=null===(h=this.dt)||void 0===h?void 0:h.wi)||void 0===r?void 0:r.box)||void 0===e?void 0:e.alignment),v=c.horizontal,d=c.vertical,_=0,w=0;switch(v){case"center":_=o+a/2;break;case"left":_=o;break;case"right":_=o+a}switch(d){case"middle":w=l+f/2;break;case"bottom":w=l;break;case"top":w=l+f}return new s(_,w)},t}();function Dn(){var t=document.createElement("canvas");t.width=0,t.height=0,Mn=A(t.getContext("2d"))}function On(t,i,n){if(0===n)return t.clone();var h=(t.x-i.x)*Math.cos(n)-(t.y-i.y)*Math.sin(n)+i.x,r=(t.x-i.x)*Math.sin(n)+(t.y-i.y)*Math.cos(n)+i.y;return new s(h,r)}function zn(t,i){return i+2*jn(t)+2*Vn(t)}function Rn(t,i){return Jn(t)*i+Hn(t)*(i-1)+2*In(t)+2*Wn(t)}function Wn(t){var i,n,s,h,r,e;return void 0!==(null===(s=null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.padding)||void 0===s?void 0:s.y)?(null===(e=null===(r=null===(h=t.wi)||void 0===h?void 0:h.box)||void 0===r?void 0:r.padding)||void 0===e?void 0:e.y)*Un(t):Jn(t)/3}function Vn(t){var i,n,s,h,r,e;return(null===(s=null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.padding)||void 0===s?void 0:s.x)?(null===(e=null===(r=null===(h=t.wi)||void 0===h?void 0:h.box)||void 0===r?void 0:r.padding)||void 0===e?void 0:e.x)*Un(t):Jn(t)/3}function In(t){var i,n,s,h;return((null===(h=null===(s=null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.background)||void 0===s?void 0:s.inflation)||void 0===h?void 0:h.y)||0)*Un(t)}function jn(t){var i,n,s,h;return((null===(h=null===(s=null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.background)||void 0===s?void 0:s.inflation)||void 0===h?void 0:h.x)||0)*Un(t)}function Hn(t){var i;return((null===(i=t.wi)||void 0===i?void 0:i.padding)||0)*Un(t)}function Jn(t){return Math.ceil(qn(t)*Un(t))}function qn(t){var i,n;return(null===(n=null===(i=t.wi)||void 0===i?void 0:i.font)||void 0===n?void 0:n.size)||30}function Un(t){var i,n,s=Math.min(1,Math.max(.2,(null===(n=null===(i=t.wi)||void 0===i?void 0:i.box)||void 0===n?void 0:n.scale)||1));if(1===s)return s;var h=qn(t);return Math.ceil(s*h)/h}function Yn(){return"rtl"===window.document.dir}var $n=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.fl=new Bn,s.Kn=null,s}return J(i,t),i.prototype.cs=function(i,n){this.Kn=null;var s=this.Zn.Ht(),h=this.Gn.zt();if(s&&!s.et()&&!h.et()&&(t.prototype.cs.call(this),!(this.Ls.length<1))){var r=this.Zn.K(),e=Gt(r.text),u=Gt(r.marketDepth);e.box.alignment={vertical:"top",horizontal:"center"},e.alignment="center";var o=this.Ls[0].clone(),l=new rt;this.fl._t({wi:e,Ds:[o],Gl:u,Ht:s}),l.st(this.fl),this.zo(l),this.Kn=l}},i}(un),Kn=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="MarketDepth",h._h([new $n(h,i)]),h}return J(i,t),i.prototype.As=function(){return 1},i}(Zt),Xn=function(t){function i(i,n){var s=t.call(this)||this;return s.yh=1e3,s.xh=1e3,s.vl=n||new ti(Qt.ph),s.Nh=i||new ti(Qt.mh),s.dt=null,s}return J(i,t),i.prototype._t=function(t){this.dt=t},i.prototype.lt=function(t,i){if(null===this.dt||this.dt.points.length<2)return null;var n=this.dt.points,h=n[0],r=n[1],e=new s(t,i),u=this.Bl(e,h,r);if(null!==u)return u;if(4===this.dt.points.length){var o=this.dt.points,l=o[2],a=o[3],f=this.Bl(e,l,a);if(null!==f)return f;if(this.dt.showMiddleLine){var c=h.add(l).scaled(.5),v=r.add(a).scaled(.5),d=this.Bl(e,c,v);if(null!==d)return d}}return this.dt.hitTestBackground?this.Dl(e):null},i.prototype.ft=function(t){var i,n,s,h,r,e;if(!(null===this.dt||this.dt.points.length<2)){g(t,(null===(i=this.dt.channelLine)||void 0===i?void 0:i.style)||0),t.strokeStyle=(null===(n=this.dt.channelLine)||void 0===n?void 0:n.color)||"transparent",t.lineWidth=(null===(s=this.dt.channelLine)||void 0===s?void 0:s.width)||0,t.lineCap="butt",this.xh=t.canvas.width,this.yh=t.canvas.height;var u=this.dt.points,o=u[0],l=u[1];if(this.ta(t,o,l),4===this.dt.points.length){var a=this.dt.points,f=a[2],c=a[3];if(this.ta(t,f,c),this.ia(t,this.dt.points),this.dt.showMiddleLine){g(t,(null===(h=this.dt.middleLine)||void 0===h?void 0:h.style)||0),t.strokeStyle=(null===(r=this.dt.middleLine)||void 0===r?void 0:r.color)||"transparent",t.lineWidth=(null===(e=this.dt.middleLine)||void 0===e?void 0:e.width)||0;var v=o.add(f).scaled(.5),d=l.add(c).scaled(.5);this.ta(t,v,d)}}}},i.prototype.ta=function(t,i,n){var s=this.Ol(i,n);null!==s&&N(t,s[0].x,s[0].y,s[1].x,s[1].y)},i.prototype.Bl=function(t,i,n){var s=this.Ol(i,n);return null!==s&&d(s[0],s[1],t)._<=3?this.Nh:null},i.prototype.Ol=function(t,i){var n,s,h=A(this.dt);return S(t,i,this.xh,this.yh,!!(null===(n=h.extend)||void 0===n?void 0:n.left),!!(null===(s=h.extend)||void 0===s?void 0:s.right))},i.prototype.ia=function(t,i){var n,h,r,u,o,l,a=A(this.dt),f=i[0],c=i[1],d=i[2],_=i[3],w=t.canvas.width,b=t.canvas.height;if(!e(f,c)&&!e(d,_)&&!(w<=0||b<=0||v(f,c,d)._<1e-6||v(f,c,_)._<1e-6)){var M=[new s(0,0),new s(w,0),new s(w,b),new s(0,b)];if(M=this.na(M,f,c,_),(null===(n=a.extend)||void 0===n?void 0:n.right)||(M=this.na(M,c,_,d)),M=this.na(M,_,d,f),(null===(h=a.extend)||void 0===h?void 0:h.left)||(M=this.na(M,d,f,c)),null!==M){t.beginPath(),t.moveTo(M[0].x,M[0].y);for(var m=1;m<M.length;m++)t.lineTo(M[m].x,M[m].y);t.fillStyle=(null===(u=null===(r=this.dt)||void 0===r?void 0:r.background)||void 0===u?void 0:u.color)||"transparent",(null===(l=null===(o=this.dt)||void 0===o?void 0:o.background)||void 0===l?void 0:l.color)&&t.fill()}}},i.prototype.Dl=function(t){var i,n,s=A(this.dt);if(4!==s.points.length)return null;var h=s.points,r=h[0],e=h[1],u=h[2],o=(e.y-r.y)/(e.x-r.x),l=u.y+o*(t.x-u.x),a=r.y+o*(t.x-r.x),f=Math.max(a,l),c=Math.min(a,l),v=Math.max(r.x,e.x),d=Math.min(r.x,e.x);return!(null===(i=s.extend)||void 0===i?void 0:i.left)&&t.x<d||!(null===(n=s.extend)||void 0===n?void 0:n.right)&&t.x>v?null:t.y>=c&&t.y<=f?this.vl:null},i.prototype.na=function(t,i,n,s){return null!==t?function(t,i){for(var n=[],s=0;s<t.length;++s){var h=t[s],r=t[(s+1)%t.length],e=u(h,r);if(l(h,i))M(n,h),l(r,i)||null!==(o=b(e,i.h))&&M(n,o);else if(l(r,i)){var o;null!==(o=b(e,i.h))&&M(n,o)}}return n.length>=3?n:null}(t,(h=u(i,n),e=s,new r(h,h.o*e.x+h.l*e.y+h.v>0))):null;var h,e},i}(et),Zn=[$i.fu,$i.fu,$i.fu,$i.fu,$i.wu,$i.wu],Gn=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.sa=new Xn,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){var i,n=this.Zn.K();if(n.visible){t.prototype.cs.call(this),this.Kn=null;var s=this.Zn.Ht();if(s&&!s.et()&&0!==this.Zn.Ds().length&&!(this.Ls.length<=1)){var h=!1;if(3===this.Ls.length){var r=this.Gn.zt().cl();if(null===r)return;var e=this.Zn.Ds(),u=e[0],o=e[1],l=e[2],a=this.Zn.us(),f=null==a?void 0:a.Vt();if(!f)return;var c=s.jt(u.price,f.Jt),v=s.jt(o.price,f.Jt),d=s.jt(l.price,f.Jt),_=this.Gn.rl(this.Zn),w=null!==(i=null==_?void 0:_.li())&&void 0!==i?i:0,b=c<0&&v<0&&d<0||c>w&&v>w&&d>w,M=Math.min(u.timestamp,o.timestamp,l.timestamp)>Number(r.to),m=Math.max(u.timestamp,o.timestamp,l.timestamp)<Number(r.from);h=b||(M||m)}if(!h||n.extend.left||n.extend.right){var p=this.Ls[0],g=this.Ls[1],k=null,y=null;if(3===this.Ls.length){var x=this.Ls[2].y-this.Ls[0].y;k=new Qi(p.x,p.y+x,2),y=new Qi(g.x,g.y+x,3)}var N=k&&y?[p,g,k,y]:[p,g];this.sa._t(q(q({},Gt(n)),{points:N,hitTestBackground:!1}));var S=new rt;S.st(this.sa);var C=[];if(this.Ls[0]&&C.push(new Qi(p.x,p.y,0)),this.Ls[1]&&C.push(new Qi(g.x,g.y,1)),k&&y){C.push(new Qi(k.x,k.y,2),new Qi(y.x,y.y,3));var T=k.add(y).scaled(.5);T.bh=4,T.ao=!0,C.push(T);var L=C[0].add(C[1]).scaled(.5);L.ao=!0,L.bh=5,C.push(L)}var F={Ds:C,do:Zn};S.st(this.Ro(F,0)),this.Kn=S}}}},i}(un),Qn=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="ParallelChannel",h.Ms.push(new Ut(h,3)),h._h([new Gn(h,i)]),h}return J(i,t),i.prototype.As=function(){return 3},i.prototype.Os=function(i){2===this.Ls.length?t.prototype.Os.call(this,this.ha(i)):t.prototype.Os.call(this,i)},i.prototype.Ds=function(){var i=t.prototype.Ds.call(this);return 3!==i.length||this.Ps()?i:[i[0],i[1],this.ha(i[2])]},i.prototype.Rs=function(i,n){if(!(this.Ls[0].timestamp===this.Ls[1].timestamp&&i>=4)){var s=A(this.Is(this.Ls[0])),h=A(this.Is(this.Ls[1])),r=A(this.Is(n)),e=this.ra()||0,u=A(this.Ht()),o=this.us(),l=P(null===o?void 0:o.Vt());if(0===i)t.prototype.Rs.call(this,i,n),this.Ls[2].price=u.cn(r.y+e,l.Jt);else if(1===i)t.prototype.Rs.call(this,i,n);else if(2===i)t.prototype.Rs.call(this,i,n),this.Ls[0].timestamp=n.timestamp,this.Ls[0].price=u.cn(r.y-e,l.Jt);else if(3===i)this.Ls[1].timestamp=n.timestamp,this.Ls[1].price=u.cn(r.y-e,l.Jt);else if(4===i){var a=h.subtract(s),f=(r.x-s.x)/a.x,c=r.y-s.addScaled(a,f).y;this.Ls[2].price=u.cn(s.y+c,l.Jt)}else if(5===i){a=h.subtract(s),f=(r.x-s.x)/a.x,c=r.y-s.addScaled(a,f).y;this.Ls[0].price=u.cn(s.y+c,l.Jt),this.Ls[1].price=u.cn(h.y+c,l.Jt)}}},i.prototype.zs=function(i){if(i<3)return t.prototype.zs.call(this,i);var n=this.Is(this.Ls[0]),h=this.Is(this.Ls[1]),r=this.Is(this.Ls[2]);if(!n||!h||!r)return null;switch(i){case 3:var e=r.y-n.y,u=h.add(new s(0,e));return this.js(u);case 4:e=r.y-n.y,u=h.add(new s(0,e));var o=r.add(u).scaled(.5);return this.js(o);case 5:var l=n.add(h).scaled(.5);return this.js(l)}return null},i.prototype.ts=function(){return this.ea()},i.prototype.vs=function(){return this.ea().slice(0,2)},i.prototype.ra=function(){var t=this.Is(this.Ls[2]),i=this.Is(this.Ls[0]);return t&&i?t.y-i.y:null},i.prototype.ea=function(){var t=this.Ds(),i=this.Ls[0]?this.Is(this.Ls[0]):null,n=this.Ls[1]?this.Is(this.Ls[1]):null,h=this.Ls[2]?this.Is(this.Ls[2]):null;if(i&&n&&h){var r=n.y-i.y,e=h.add(new s(0,r));t.push(A(this.js(e)))}return t},i.prototype.ha=function(t){if(this.Ls.length<2||this.Ls[1].timestamp===this.Ls[0].timestamp)return t;var i=A(this.Is(t)),n=A(this.Is(this.Ls[1])),h=A(this.Is(this.Ls[0])),r=n.subtract(h),e=(i.x-h.x)/r.x,u=h.addScaled(r,e),o=i.y-u.y,l=h.add(new s(0,o));return A(this.js(l))},i}(Zt),ts=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.wl=new fn,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){t.prototype.cs.call(this),this.Kn=null;var i=this.Zn.K();this.wl._t({Ch:Gt(i.line),Ds:this.Ls});var n=new rt;n.st(this.wl),this.Kn=n,this.zo(n)},i}(un),is=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="Path",h._h([new ts(h,i)]),h}return J(i,t),i.prototype.As=function(){return-1},i.prototype.Es=function(){if(this.Ls.length>1){var t=this.Ls[this.Ls.length-1],i=this.Ls[this.Ls.length-2],n=A(this.Is(t)),s=A(this.Is(i));n.subtract(s).length()<10&&(this.Ls.pop(),this.xs=!0,this.ys=!0,this.Ts=null)}},i}(Zt),ns=function(){function t(t,i){this.vl=i||new ti(Qt.ph),this.Nh=t||new ti(Qt.mh),this.dt=null}return t.prototype._t=function(t){this.dt=t},t.prototype.lt=function(t,i,n){if(null===this.dt||this.dt.points.length<2)return null;var h=n.canvas.ownerDocument&&n.canvas.ownerDocument.defaultView&&n.canvas.ownerDocument.defaultView.devicePixelRatio||1,r=n.canvas.width,e=new s(t,i),u=this.El(h),o=u[0],l=u[1],a=new s(l.x,o.y),f=new s(o.x,l.y),c=this.Bl(e,o,a,r);if(null!==c)return c;var v=this.Bl(e,f,l,r);if(null!==v)return v;if(d(a,l,e)._<=3)return this.Nh;if(d(o,f,e)._<=3)return this.Nh;var _=this.Dl(e,o,l,r);return this.dt.hitTestBackground&&null!==_?_:null},t.prototype.ot=function(t,i,n,s){var h,r,e,u,o,l,a,f=(null===(r=null===(h=this.dt)||void 0===h?void 0:h.border)||void 0===r?void 0:r.width)||0,c=null===(u=null===(e=this.dt)||void 0===e?void 0:e.border)||void 0===u?void 0:u.color,v=null===(l=null===(o=this.dt)||void 0===o?void 0:o.background)||void 0===l?void 0:l.color;if(!(null===this.dt||this.dt.points.length<2||f<=0&&!v)){t.save();var d=f?Math.max(1,Math.floor(f*i)):0,_=10,w=(null===(a=this.dt.border)||void 0===a?void 0:a.style)||0,b=this.dt.points,M=b[0],m=b[1],p=this.dt.extend||{},k=p.left,y=p.right;if(void 0!==v&&(t.fillStyle=v,t.fillRect(M.x,M.y,m.x-M.x,m.y-M.y)),void 0!==c&&f>0){t.beginPath(),g(t,w||0),t.lineWidth=d,t.strokeStyle=c;var x=.5*d;if(t.moveTo(M.x-(k?x:0),M.y-x),t.lineTo(m.x+(y?x:0),M.y-x),t.moveTo(M.x-(k?x:0),m.y+x),t.lineTo(m.x+(y?x:0),m.y+x),this.dt.showCenterVerticalLine){var N=(M.x+m.x)/2;t.moveTo(N,M.y),t.lineTo(N,m.y);var S=0,C=Math.abs(M.y-m.y);M.y>=m.y&&C>_?(S=m.y+d,t.moveTo(N-_,S+_),t.lineTo(N,S),t.lineTo(N+_,S+_)):M.y<m.y&&C>_&&(S=m.y-d,t.moveTo(N-_,S-_),t.lineTo(N,S),t.lineTo(N+_,S-_))}t.stroke()}if(this.dt.showCenterHorizontalLine&&void 0!==c&&f>0){t.beginPath(),g(t,this.dt.centerHorizontalLineStyle);var T=this.dt.centerHorizontalLineWidth?Math.max(1,Math.floor(this.dt.centerHorizontalLineWidth*i)):0;t.lineWidth=T,t.strokeStyle=c;x=.5*d;var L=(M.y+m.y)/2,F=M.x,A=(M.y+m.y)/2,P=m.x;t.moveTo(F-(k?x:0),L),t.lineTo(P+(y?x:0),A),t.stroke()}t.restore()}},t.prototype.El=function(t){var i=A(this.dt).points,n=i[0],h=i[1],r=Math.min(n.x,h.x),e=Math.max(n.x,h.x),u=Math.min(n.y,h.y),o=Math.max(n.y,h.y),l=Math.round(r*t),a=Math.round(e*t),f=Math.round(u*t),c=Math.round(o*t);return[new s(l,f),new s(a,c)]},t.prototype.Ol=function(t,i,n){var h,r,u=A(this.dt);if(e(t,i))return null;var o=Math.min(t.x,i.x),l=Math.max(t.x,i.x),a=(null===(h=u.extend)||void 0===h?void 0:h.left)?0:Math.max(o,0),f=(null===(r=u.extend)||void 0===r?void 0:r.right)?n:Math.min(l,n);return a>f||f<=0||a>=n?null:[new s(a,t.y),new s(f,i.y)]},t.prototype.Bl=function(t,i,n,s){var h=this.Ol(i,n,s);return null!==h&&d(h[0],h[1],t)._<=3?this.Nh:null},t.prototype.Dl=function(t,i,n,s){var r=this.Ol(i,n,s);return null!==r&&_(t,new h(r[0],r[1]))?this.vl:null},t}(),ss=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.ua=new ns,s.fl=new ui,s.oa=new ui,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){var i,n=this.Zn.K();if(n.visible){this.Kn=null,this.fs=!1;var s=this.Zn.Ht(),h=this.Gn.zt();if(s&&!s.et()&&!h.et()){var r=h.cl();if(null!==r){var e=this.Zn.Ds();if(!(e.length<2)){var u=e[0],o=e[1];if(u&&o){var l=this.Zn.us(),a=null==l?void 0:l.Vt();if(a){var f=s.jt(u.price,a.Jt),c=s.jt(o.price,a.Jt),v=this.Gn.rl(this.Zn),d=null!==(i=null==v?void 0:v.li())&&void 0!==i?i:0,_=f<0&&c<0||f>d&&c>d,w=Math.min(e[0].timestamp,e[1].timestamp)>Number(r.to),b=Math.max(e[0].timestamp,e[1].timestamp)<Number(r.from);if(!(_||(w||b))||n.priceRange.extend.left||n.priceRange.extend.right){if(t.prototype.cs.call(this),this.Ls.length<2)return;var M=new rt;this.ua._t(q(q({},Gt(n.priceRange)),{points:this.Ls,hitTestBackground:!1})),M.st(this.ua);var m=this.Ls[0],p=this.Ls[1];if(n.text.value){var g=Math.min(m.x,p.x),k=Math.max(m.x,p.x),y=Math.min(m.y,p.y),x=Math.max(m.y,p.y),N=m.clone(),S=n.text.font.size/3,C=0;switch(n.text.box.alignment.vertical){case"middle":N.y=(y+x)/2,C=S;break;case"top":N.y=y;break;case"bottom":N.y=x}switch(n.text.box.alignment.horizontal){case"center":N.x=(g+k)/2;break;case"left":N.x=g;break;case"right":N.x=k}var T=Gt(n.text);T.box=q(q({},T.box),{padding:{y:S,x:C}}),"middle"===n.text.box.alignment.vertical&&(T.box.maxHeight=x-y),this.fl._t({wi:T,Ds:[N]}),M.st(this.fl)}var L=Math.min(m.x,p.x),F=Math.max(m.x,p.x),A=Math.min(m.y,p.y),P=Math.max(m.y,p.y),E=m.clone(),B=n.text.font.size/3,D=0,O=Gt(n.text);O.box.alignment.horizontal="center",O.box.alignment.vertical="top";var z=s.Vt();switch(p.y>=m.y?(O.box.alignment.vertical="bottom",null!==z&&(O.value=String(Number(s.Bi(s.cn(p.y,z),z))-Number(s.Bi(s.cn(m.y,z),z))))):m.y>p.y&&(O.box.alignment.vertical="top",null!==z&&(O.value="+"+String(Number(s.Bi(s.cn(p.y,z),z))-Number(s.Bi(s.cn(m.y,z),z))))),O.box.alignment.vertical){case"middle":E.y=(A+P)/2,D=B;break;case"top":E.y=A;break;case"bottom":E.y=P}switch(O.box.alignment.horizontal){case"center":E.x=(L+F)/2;break;case"left":E.x=L;break;case"right":E.x=F}O.box=q(q({},O.box),{padding:{y:B,x:D}}),O.font.size=28,O.font.color=n.text.font.color,O.font.bold=!0,O.box.offset={x:0,y:10},"middle"===O.box.alignment.vertical&&(O.box.maxHeight=P-A),this.oa._t({wi:O,Ds:[E]}),M.st(this.oa),this.Tl(m,p,M),this.Kn=M}}}}}}}},i.prototype.Tl=function(t,i,n){var s=new Qi(t.x,i.y,2),h=new Qi(i.x,t.y,3),r=new Qi(t.x,.5*(t.y+i.y),4,!0),e=new Qi(i.x,.5*(t.y+i.y),5,!0),u=new Qi(.5*(t.x+i.x),t.y,6,!0),o=new Qi(.5*(t.x+i.x),i.y,7,!0),l=t.x-i.x,a=t.y-i.y,f=Math.sign(l*a),c={Ds:[t,i,s,h,r,e,u,o],do:[f<0?$i.Mu:$i.mu,f<0?$i.Mu:$i.mu,f>0?$i.Mu:$i.mu,f>0?$i.Mu:$i.mu,$i.bu,$i.bu,$i.wu,$i.wu]};n.st(this.Ro(c,0))},i}(un),hs=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="PriceRange",h._h([new ss(h,i)]),h}return J(i,t),i.prototype.As=function(){return 2},i.prototype.Rs=function(i,n){switch(i<2&&t.prototype.Rs.call(this,i,n),i){case 2:this.Ls[1].price=n.price,this.Ls[0].timestamp=n.timestamp;break;case 3:this.Ls[0].price=n.price,this.Ls[1].timestamp=n.timestamp;break;case 4:this.Ls[0].timestamp=n.timestamp;break;case 5:this.Ls[1].timestamp=n.timestamp;break;case 6:this.Ls[0].price=n.price;break;case 7:this.Ls[1].price=n.price}},i.prototype.zs=function(i){return i<2?t.prototype.zs.call(this,i):this.Ll(i)},i.prototype.Ll=function(t){var i=this.Ds()[0],n=this.Ds()[1];return[{St:i.price,Fl:i.timestamp},{St:n.price,Fl:n.timestamp},{St:n.price,Fl:i.timestamp},{St:i.price,Fl:n.timestamp},{St:(n.price+i.price)/2,Fl:i.timestamp},{St:(n.price+i.price)/2,Fl:n.timestamp},{St:i.price,Fl:(n.timestamp+i.timestamp)/2},{St:n.price,Fl:(n.timestamp+i.timestamp)/2}][t]},i}(Zt),rs=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.qs="Ray",i}return J(i,t),i}(ln),es=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.la=new An,s.fl=new ui,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){var i,n=this.Zn.K();if(n.visible){this.Kn=null,this.fs=!1;var s=this.Zn.Ht(),h=this.Gn.zt();if(s&&!s.et()&&!h.et()){var r=h.cl();if(null!==r){var e=this.Zn.Ds();if(!(e.length<2)){var u=e[0],o=e[1];if(u&&o){var l=this.Zn.us(),a=null==l?void 0:l.Vt();if(a){var f=s.jt(u.price,a.Jt),c=s.jt(o.price,a.Jt),v=this.Gn.rl(this.Zn),d=null!==(i=null==v?void 0:v.li())&&void 0!==i?i:0,_=f<0&&c<0||f>d&&c>d,w=Math.min(e[0].timestamp,e[1].timestamp)>Number(r.to),b=Math.max(e[0].timestamp,e[1].timestamp)<Number(r.from);if(!(_||(w||b))||n.rectangle.extend.left||n.rectangle.extend.right){if(t.prototype.cs.call(this),this.Ls.length<2)return;var M=new rt;this.la._t(q(q({},Gt(n.rectangle)),{points:this.Ls,hitTestBackground:!1})),M.st(this.la);var m=this.Ls[0],p=this.Ls[1];if(n.text.value){var g=Math.min(m.x,p.x),k=Math.max(m.x,p.x),y=Math.min(m.y,p.y),x=Math.max(m.y,p.y),N=m.clone(),S=n.text.font.size/3,C=0;switch(n.text.box.alignment.vertical){case"middle":N.y=(y+x)/2,C=S;break;case"top":N.y=y;break;case"bottom":N.y=x}switch(n.text.box.alignment.horizontal){case"center":N.x=(g+k)/2;break;case"left":N.x=g;break;case"right":N.x=k}var T=Gt(n.text);T.box=q(q({},T.box),{padding:{y:S,x:C}}),"middle"===n.text.box.alignment.vertical&&(T.box.maxHeight=x-y),this.fl._t({wi:T,Ds:[N]}),M.st(this.fl)}this.Tl(m,p,M),this.Kn=M}}}}}}}},i.prototype.Tl=function(t,i,n){var s=new Qi(t.x,i.y,2),h=new Qi(i.x,t.y,3),r=new Qi(t.x,.5*(t.y+i.y),4,!0),e=new Qi(i.x,.5*(t.y+i.y),5,!0),u=new Qi(.5*(t.x+i.x),t.y,6,!0),o=new Qi(.5*(t.x+i.x),i.y,7,!0),l=t.x-i.x,a=t.y-i.y,f=Math.sign(l*a),c={Ds:[t,i,s,h,r,e,u,o],do:[f<0?$i.Mu:$i.mu,f<0?$i.Mu:$i.mu,f>0?$i.Mu:$i.mu,f>0?$i.Mu:$i.mu,$i.bu,$i.bu,$i.wu,$i.wu]};n.st(this.Ro(c,0))},i}(un),us=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="Rectangle",h._h([new es(h,i)]),h}return J(i,t),i.prototype.As=function(){return 2},i.prototype.Rs=function(i,n){switch(i<2&&t.prototype.Rs.call(this,i,n),i){case 2:this.Ls[1].price=n.price,this.Ls[0].timestamp=n.timestamp;break;case 3:this.Ls[0].price=n.price,this.Ls[1].timestamp=n.timestamp;break;case 4:this.Ls[0].timestamp=n.timestamp;break;case 5:this.Ls[1].timestamp=n.timestamp;break;case 6:this.Ls[0].price=n.price;break;case 7:this.Ls[1].price=n.price}},i.prototype.zs=function(i){return i<2?t.prototype.zs.call(this,i):this.Ll(i)},i.prototype.Ll=function(t){var i=this.Ds()[0],n=this.Ds()[1];return[{St:i.price,Fl:i.timestamp},{St:n.price,Fl:n.timestamp},{St:n.price,Fl:i.timestamp},{St:i.price,Fl:n.timestamp},{St:(n.price+i.price)/2,Fl:i.timestamp},{St:(n.price+i.price)/2,Fl:n.timestamp},{St:i.price,Fl:(n.timestamp+i.timestamp)/2},{St:n.price,Fl:(n.timestamp+i.timestamp)/2}][t]},i}(Zt),os=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.fl=new ui,s.Kn=null,s}return J(i,t),i.prototype.cs=function(i,n){var s,h=this.Zn.K();if(h.visible){this.Kn=null;var r=this.Zn.Ht(),e=this.Gn.zt();if(r&&!r.et()&&!e.et()&&(t.prototype.cs.call(this),!(this.Ls.length<1))){var u=e.cl();if(null!==u){var o=this.Zn.Ds(),l=o[0];if(l){var a=this.Zn.us(),f=null==a?void 0:a.Vt();if(f){var c=r.jt(l.price,f.Jt),v=this.Gn.rl(this.Zn),d=null!==(s=null==v?void 0:v.li())&&void 0!==s?s:0,_=c<0||c>d,w=Math.min(o[0].timestamp)>Number(u.to),b=Math.max(o[0].timestamp)<Number(u.from);if(!(_||(w||b))){var M=Gt(h.text);M.box.alignment={vertical:"top",horizontal:"center"},M.alignment="center";var m=this.Ls[0].clone(),p=new rt;this.fl._t({wi:M,Ds:[m]}),p.st(this.fl),this.zo(p),this.Kn=p}}}}}}},i}(un),ls=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="Text",h._h([new os(h,i)]),h}return J(i,t),i.prototype.As=function(){return 1},i}(Zt),as=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.dt=null,i}return J(i,t),i.prototype._t=function(t){this.dt=t},i.prototype.lt=function(t,i){if(null===this.dt||this.dt.points.length<2)return null;var n=this.dt.points,h=n[0],r=n[1],e=new s(t,i);if(d(h,r,e)._<=ii)return new ti(Qt.mh);if(3!==this.dt.points.length)return null;var u=this.dt.points[2];return d(r,u,e)._<=ii||d(u,h,e)._<=ii?new ti(Qt.mh):this.dt.hitTestBackground&&function(t,i,n,s){var h=i.add(n).scaled(.5).add(s).scaled(.5);return null===c(i,n,h,t)&&null===c(n,s,h,t)&&null===c(s,i,h,t)}(e,h,r,u)?new ti(Qt.ph):null},i.prototype.ft=function(t){var i,n,s,h;if(!(null===this.dt||this.dt.points.length<2)){var r=this.dt.points,e=r[0],u=r[1],o=2===this.dt.points.length?u:this.dt.points[2];t.lineCap="butt",t.lineWidth=(null===(i=this.dt.border)||void 0===i?void 0:i.width)||0,t.strokeStyle=(null===(n=this.dt.border)||void 0===n?void 0:n.color)||"transparent",void 0!==(null===(s=this.dt.border)||void 0===s?void 0:s.style)&&g(t,this.dt.border.style),t.beginPath(),t.fillStyle=(null===(h=this.dt.background)||void 0===h?void 0:h.color)||"transparent",t.moveTo(e.x,e.y),t.lineTo(u.x,u.y),t.lineTo(o.x,o.y),t.lineTo(e.x,e.y),t.fill(),t.stroke()}},i}(et),fs=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.aa=new as,s.Kn=null,s}return J(i,t),i.prototype.cs=function(){var i,n=this.Zn.K();if(n.visible){var s=this.Zn.Ds(),h=!1;if(3===this.Ls.length){var r=this.Zn.Ht(),e=this.Gn.zt();if(!r||r.et()||e.et())return;var u=e.cl();if(null===u)return;var o=s[0],l=s[1],a=s[2];if(!o||!l||!a)return;var f=this.Zn.us(),c=null==f?void 0:f.Vt();if(!c)return;var v=r.jt(o.price,c.Jt),d=r.jt(l.price,c.Jt),_=r.jt(a.price,c.Jt),w=this.Gn.rl(this.Zn),b=null!==(i=null==w?void 0:w.li())&&void 0!==i?i:0,M=v<0&&d<0&&_<0||v>b&&d>b&&_>b,m=Math.min(s[0].timestamp,s[1].timestamp,s[2].timestamp)>Number(u.to),p=Math.max(s[0].timestamp,s[1].timestamp,s[2].timestamp)<Number(u.from);h=M||(m||p)}if(!h&&n.visible){t.prototype.cs.call(this),this.Kn=null,this.aa._t(q(q({},n.triangle),{points:this.Ls,hitTestBackground:!1}));var g=new rt;g.st(this.aa),this.zo(g),this.Kn=g}}},i}(un),cs=function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="Triangle",h._h([new fs(h,i)]),h}return J(i,t),i.prototype.As=function(){return 3},i}(Zt),vs=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.al=new si,s.fl=new ui,s.Kn=null,s.al.Sh(new ti(Qt.mh)),s}return J(i,t),i.prototype.cs=function(i,n){this.Kn=null;var h=this.Zn.Ht(),r=this.Gn.zt();if(h&&!h.et()&&!r.et()){var e=this.Zn.Ds();if(!(e.length<1)){var u=r.Hs(0),o=r.Hs(n),l=this.Zn.K();if(!(e[0].timestamp>o.timestamp||e[0].timestamp<u.timestamp)){if(t.prototype.cs.call(this),this.Ls.length<1)return;var a=this.Ls[0],f=new Qi(a.x,i,0),c=new Qi(a.x,0,1);a.y=i/2,a.ao=!0;var v=new rt;if(this.al._t({Ch:q(q({},Gt(l.line)),{end:{ou:0,lu:0},extend:{ou:!1,lu:!1}}),Ds:[f,c]}),v.st(this.al),l.text.value){var d=Math.atan((c.y-f.y)/(c.x-f.x))/Math.PI*-180,_=l.text.box.alignment.horizontal,w="left"===_?f.clone():"right"===_?c.clone():new s((f.x+c.x)/2,(f.y+c.y)/2),b=Gt(l.text);b.box=q(q({},b.box),{angle:d}),this.fl._t({wi:b,Ds:[w]}),v.st(this.fl)}this.zo(v),this.Kn=v}}}},i}(un),ds={FibRetracement:Sn,ParallelChannel:Qn,HorizontalLine:Ln,VerticalLine:function(t){function i(i,n,s){void 0===s&&(s=[]);var h=t.call(this,i,n,s)||this;return h.qs="VerticalLine",h._h([new vs(h,i)]),h}return J(i,t),i.prototype.As=function(){return 1},i.prototype.Nn=function(){return[]},i.prototype.ts=function(){return[]},i.prototype._s=function(){return this.K().line.color},i}(Zt),Highlighter:Cn,CrossLine:kn,TrendLine:ln,Callout:_n,Rectangle:us,LongShortPosition:En,Circle:pn,PriceRange:hs,Triangle:cs,Brush:vn,Path:is,Text:ls,Ray:rs,Arrow:an,ExtendedLine:yn,HorizontalRay:Fn,MarketDepth:Kn},_s=function(){function t(t){this.fa=null,this.ca=null,this.va=null,this.Gn=t}return t.prototype.da=function(t,i){this.ca=i||{},this.va=t,this.Gn.Ie().forEach(function(t){t instanceof Zt&&(t.Gs(!1),t.Zs(!1),t.th(!1),t.nh(!1))}),this.Gn.eo()},t.prototype._a=function(){return null!==this.va},t.prototype.To=function(t,i,n,s){var h;if(this.va&&this.ca&&(s.Fo=!0,6===n)){var r=(null===(h=t.Js().Ie()[0].Ht())||void 0===h?void 0:h.Ji())||t.Js().ri().wa(),e=$(Q(Ht[this.va]),this.ca||{});this.fa=new ds[this.va](this.Gn,e,[]),t.Js().He(this.fa,r),this.va=null,this.ca=null}},t}(),ws=function(){function t(t){this.ba=t}return t.prototype.format=function(t){var i="";return t<0&&(i="-",t=-t),t<995?i+this.Ma(t):t<999995?i+this.Ma(t/1e3)+"K":t<999999995?(t=1e3*Math.round(t/1e3),i+this.Ma(t/1e6)+"M"):(t=1e6*Math.round(t/1e6),i+this.Ma(t/1e9)+"B")},t.prototype.Ma=function(t){var i=Math.pow(10,this.ba);return((t=Math.round(t*i)/i)>=1e-15&&t<1?t.toFixed(this.ba).replace(/\.?0+$/,""):String(t)).replace(/(\.[1-9]*)0+$/,function(t,i){return i})},t}();function bs(t,i,n,s){if(0!==i.length){var h=i[s.from].Mt,r=i[s.from].gt;t.moveTo(h,r);for(var e=s.from+1;e<s.to;++e){var u=i[e];if(1===n){var o=i[e-1].gt,l=u.Mt;t.lineTo(l,o)}t.lineTo(u.Mt,u.gt)}}}var Ms=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.dt=null,i}return J(i,t),i.prototype._t=function(t){this.dt=t},i.prototype.ft=function(t){if(null!==this.dt&&0!==this.dt.bt.length&&null!==this.dt.wt){if(t.lineCap="butt",t.lineJoin="round",t.lineWidth=this.dt.Qt,g(t,this.dt.ti),t.lineWidth=1,t.beginPath(),1===this.dt.bt.length){var i=this.dt.bt[0],n=this.dt.ma/2;t.moveTo(i.Mt-n,this.dt.pa),t.lineTo(i.Mt-n,i.gt),t.lineTo(i.Mt+n,i.gt),t.lineTo(i.Mt+n,this.dt.pa)}else t.moveTo(this.dt.bt[this.dt.wt.from].Mt,this.dt.pa),t.lineTo(this.dt.bt[this.dt.wt.from].Mt,this.dt.bt[this.dt.wt.from].gt),bs(t,this.dt.bt,this.dt.ga,this.dt.wt),this.dt.wt.to>this.dt.wt.from&&(t.lineTo(this.dt.bt[this.dt.wt.to-1].Mt,this.dt.pa),t.lineTo(this.dt.bt[this.dt.wt.from].Mt,this.dt.pa));t.closePath(),t.fillStyle=this.ka(t),t.fill()}},i}(et),ms=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return J(i,t),i.prototype.ka=function(t){var i=this.dt,n=t.createLinearGradient(0,0,0,i.ya);return n.addColorStop(0,i.xa),n.addColorStop(1,i.Na),n},i}(Ms),ps=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.dt=null,i}return J(i,t),i.prototype._t=function(t){this.dt=t},i.prototype.ft=function(t){if(null!==this.dt&&0!==this.dt.bt.length&&null!==this.dt.wt)if(t.lineCap="butt",t.lineWidth=this.dt.Qt,g(t,this.dt.ti),t.strokeStyle=this.Sa(t),t.lineJoin="round",1===this.dt.bt.length){t.beginPath();var i=this.dt.bt[0];t.moveTo(i.Mt-this.dt.ma/2,i.gt),t.lineTo(i.Mt+this.dt.ma/2,i.gt),void 0!==i.j&&(t.strokeStyle=i.j),t.stroke()}else this.Ca(t,this.dt)},i.prototype.Ca=function(t,i){t.beginPath(),bs(t,i.bt,i.ga,i.wt),t.stroke()},i}(et),gs=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return J(i,t),i.prototype.Ca=function(t,i){var n,s,h=i.bt,r=i.wt,e=i.ga,u=i.xt;if(0!==h.length&&null!==r){t.beginPath();var o=h[r.from];t.moveTo(o.Mt,o.gt);var l=null!==(n=o.j)&&void 0!==n?n:u;t.strokeStyle=l;for(var a=function(i){t.stroke(),t.beginPath(),t.strokeStyle=i,l=i},f=r.from+1;f<r.to;++f){var c=h[f],v=h[f-1],d=null!==(s=c.j)&&void 0!==s?s:u;1===e&&(t.lineTo(c.Mt,v.gt),d!==l&&(a(d),t.moveTo(c.Mt,v.gt))),t.lineTo(c.Mt,c.gt),1!==e&&d!==l&&(a(d),t.moveTo(c.Mt,c.gt))}t.stroke()}},i.prototype.Sa=function(){return this.dt.xt},i}(ps);function ks(t,i,n,s,h){void 0===s&&(s=0),void 0===h&&(h=t.length);for(var r=h-s;0<r;){var e=r>>1,u=s+e;n(t[u],i)?(s=u+1,r-=e+1):r=e}return s}function ys(t,i,n,s,h){void 0===s&&(s=0),void 0===h&&(h=t.length);for(var r=h-s;0<r;){var e=r>>1,u=s+e;n(i,t[u])?r=e:(s=u+1,r-=e+1)}return s}function xs(t,i){return t.Nt<i}function Ns(t,i){return t<i.Nt}function Ss(t,i,n){var s=i.ou(),h=i.lu(),r=ks(t,s,xs),e=ys(t,h,Ns);if(!n)return{from:r,to:e};var u=r,o=e;return r>0&&r<t.length&&t[r].Nt>=s&&(u=r-1),e>0&&e<t.length&&t[e-1].Nt<=h&&(o=e+1),{from:u,to:o}}var Cs=function(){function t(t,i,n){this.fs=!0,this.Ta=!0,this.La=!0,this.Fa=[],this.Aa=null,this.Pa=t,this.Gn=i,this.Ea=n}return t.prototype.Pt=function(t){this.fs=!0,"data"===t&&(this.Ta=!0),"options"===t&&(this.La=!0)},t.prototype.Ba=function(){this.Ta&&(this.Da(),this.Ta=!1),this.fs&&(this.Oa(),this.fs=!1),this.La&&(this.za(),this.La=!1)},t.prototype.Ra=function(){this.Aa=null},t.prototype.Oa=function(){var t=this.Pa.Ht(),i=this.Gn.zt();if(this.Ra(),!i.et()&&!t.et()){var n=i.es();if(null!==n&&0!==this.Pa.An().Wa()){var s=this.Pa.Vt();null!==s&&(this.Aa=Ss(this.Fa,n,this.Ea),this.Va(t,i,s.Jt))}}},t}(),Ts=function(t){function i(i,n){return t.call(this,i,n,!0)||this}return J(i,t),i.prototype.Va=function(t,i,n){i.Ia(this.Fa,it(this.Aa)),t.Ee(this.Fa,n,it(this.Aa))},i.prototype.ja=function(t,i){return{Nt:t,St:i,Mt:NaN,gt:NaN}},i.prototype.za=function(){},i.prototype.Da=function(){var t=this,i=this.Pa.Ha();this.Fa=this.Pa.An().Ja().map(function(n){var s=n.value[3];return t.qa(n.index,s,i)})},i}(Cs),Ls=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.ni=new rt,s.Ua=new ms,s.Ya=new gs,s.ni.ut([s.Ua,s.Ya]),s}return J(i,t),i.prototype.Bt=function(t,i){if(!this.Pa.Wt())return null;var n=this.Pa.K();return this.Ba(),this.Ua._t({ga:n.lineType,bt:this.Fa,ti:n.lineStyle,Qt:n.lineWidth,xa:n.topColor,Na:n.bottomColor,pa:t,ya:t,wt:this.Aa,ma:this.Gn.zt().$a()}),this.Ya._t({ga:n.lineType,bt:this.Fa,xt:n.lineColor,ti:n.lineStyle,Qt:n.lineWidth,wt:this.Aa,ma:this.Gn.zt().$a()}),this.ni},i.prototype.qa=function(t,i){return this.ja(t,i)},i}(Ts),Fs=function(){function t(){this.$t=null,this.Ka=0,this.Xa=0}return t.prototype._t=function(t){this.$t=t},t.prototype.ot=function(t,i,n,s){if(null!==this.$t&&0!==this.$t.An.length&&null!==this.$t.wt){if(this.Ka=this.Za(i),this.Ka>=2)Math.max(1,Math.floor(i))%2!=this.Ka%2&&this.Ka--;this.Xa=this.$t.Ga?Math.min(this.Ka,Math.floor(i)):this.Ka;for(var h=null,r=this.Xa<=this.Ka&&this.$t.$a>=Math.floor(1.5*i),e=this.$t.wt.from;e<this.$t.wt.to;++e){var u=this.$t.An[e];h!==u.j&&(t.fillStyle=u.j,h=u.j);var o=Math.floor(.5*this.Xa),l=Math.round(u.Mt*i),a=l-o,f=this.Xa,c=a+f-1,v=Math.min(u.ze,u.Re),d=Math.max(u.ze,u.Re),_=Math.round(v*i)-o,w=Math.round(d*i)+o,b=Math.max(w-_,this.Xa);t.fillRect(a,_,f,b);var M=Math.ceil(1.5*this.Ka);if(r){if(this.$t.Qa){var m=l-M,p=Math.max(_,Math.round(u.Oe*i)-o),g=p+f-1;g>_+b-1&&(p=(g=_+b-1)-f+1),t.fillRect(m,p,a-m,g-p+1)}var k=l+M,y=Math.max(_,Math.round(u.We*i)-o),x=y+f-1;x>_+b-1&&(y=(x=_+b-1)-f+1),t.fillRect(c+1,y,k-c,x-y+1)}}}},t.prototype.Za=function(t){var i=Math.floor(t);return Math.max(i,Math.floor(function(t,i){return Math.floor(.3*t*i)}(A(this.$t).$a,t)))},t}(),As=function(t){function i(i,n){return t.call(this,i,n,!1)||this}return J(i,t),i.prototype.Va=function(t,i,n){i.Ia(this.Fa,it(this.Aa)),t.De(this.Fa,n,it(this.Aa))},i.prototype.tf=function(t,i,n){return{Nt:t,open:i.value[0],high:i.value[1],low:i.value[2],close:i.value[3],Mt:NaN,Oe:NaN,ze:NaN,Re:NaN,We:NaN}},i.prototype.Da=function(){var t=this,i=this.Pa.Ha();this.Fa=this.Pa.An().Ja().map(function(n){return t.qa(n.index,n,i)})},i}(Cs),Ps=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.ni=new Fs,i}return J(i,t),i.prototype.Bt=function(t,i){if(!this.Pa.Wt())return null;var n=this.Pa.K();this.Ba();var s={An:this.Fa,$a:this.Gn.zt().$a(),Qa:n.openVisible,Ga:n.thinBars,wt:this.Aa};return this.ni._t(s),this.ni},i.prototype.za=function(){var t=this;this.Fa.forEach(function(i){i.j=t.Pa.Ha().nf(i.Nt).if})},i.prototype.qa=function(t,i,n){return q(q({},this.tf(t,i,n)),{j:n.nf(t).if})},i}(As),Es=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return J(i,t),i.prototype.ka=function(t){var i=this.dt,n=t.createLinearGradient(0,0,0,i.ya),s=Li(i.pa/i.ya,0,1);return n.addColorStop(0,i.sf),n.addColorStop(s,i.hf),n.addColorStop(s,i.rf),n.addColorStop(1,i.ef),n},i}(Ms),Bs=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return J(i,t),i.prototype.Sa=function(t){var i=this.dt,n=t.createLinearGradient(0,0,0,i.ya),s=Li(i.pa/i.ya,0,1);return n.addColorStop(0,i.xa),n.addColorStop(s,i.xa),n.addColorStop(s,i.Na),n.addColorStop(1,i.Na),n},i}(ps),Ds=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.uf=new Es,s.lf=new Bs,s.Ct=new rt,s.Ct.ut([s.uf,s.lf]),s}return J(i,t),i.prototype.Bt=function(t,i){if(!this.Pa.Wt())return null;var n=this.Pa.Vt();if(null===n)return null;var s=this.Pa.K();this.Ba();var h=this.Pa.Ht().jt(s.baseValue.price,n.Jt),r=this.Gn.zt().$a();return this.uf._t({bt:this.Fa,sf:s.topFillColor1,hf:s.topFillColor2,rf:s.bottomFillColor1,ef:s.bottomFillColor2,Qt:s.lineWidth,ti:s.lineStyle,ga:0,pa:h,ya:t,wt:this.Aa,ma:r}),this.lf._t({bt:this.Fa,xa:s.topLineColor,Na:s.bottomLineColor,Qt:s.lineWidth,ti:s.lineStyle,ga:0,pa:h,ya:t,wt:this.Aa,ma:r}),this.Ct},i.prototype.qa=function(t,i){return this.ja(t,i)},i}(Ts),Os=function(){function t(){this.$t=null,this.Ka=0}return t.prototype._t=function(t){this.$t=t},t.prototype.ot=function(t,i,n,s){if(null!==this.$t&&0!==this.$t.An.length&&null!==this.$t.wt){if(this.Ka=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),s=Math.floor(t*n*i),h=Math.floor(t*i),r=Math.min(s,h);return Math.max(Math.floor(i),r)}(this.$t.$a,i),this.Ka>=2)Math.floor(i)%2!=this.Ka%2&&this.Ka--;var h=this.$t.An;this.$t.af&&this.ff(t,h,this.$t.wt,i),this.$t.cf&&this.Sl(t,h,this.$t.wt,this.$t.$a,i);var r=this.vf(i);(!this.$t.cf||this.Ka>2*r)&&this.df(t,h,this.$t.wt,i)}},t.prototype.ff=function(t,i,n,s){if(null!==this.$t){var h="",r=Math.min(Math.floor(s),Math.floor(this.$t.$a*s));r=Math.max(Math.floor(s),Math.min(r,this.Ka));for(var e=Math.floor(.5*r),u=null,o=n.from;o<n.to;o++){var l=i[o];l._f!==h&&(t.fillStyle=l._f,h=l._f);var a=Math.round(Math.min(l.Oe,l.We)*s),f=Math.round(Math.max(l.Oe,l.We)*s),c=Math.round(l.ze*s),v=Math.round(l.Re*s),d=Math.round(s*l.Mt)-e,_=d+r-1;null!==u&&(d=Math.max(u+1,d),d=Math.min(d,_));var w=_-d+1;t.fillRect(d,c,w,a-c),t.fillRect(d,f+1,w,v-f),u=_}}},t.prototype.vf=function(t){var i=Math.floor(1*t);this.Ka<=2*i&&(i=Math.floor(.5*(this.Ka-1)));var n=Math.max(Math.floor(t),i);return this.Ka<=2*n?Math.max(Math.floor(t),Math.floor(1*t)):n},t.prototype.Sl=function(t,i,n,s,h){if(null!==this.$t)for(var r="",e=this.vf(h),u=null,o=n.from;o<n.to;o++){var l=i[o];l.qt!==r&&(t.fillStyle=l.qt,r=l.qt);var a=Math.round(l.Mt*h)-Math.floor(.5*this.Ka),f=a+this.Ka-1,c=Math.round(Math.min(l.Oe,l.We)*h),v=Math.round(Math.max(l.Oe,l.We)*h);if(null!==u&&(a=Math.max(u+1,a),a=Math.min(a,f)),this.$t.$a*h>2*e)vt(t,a,c,f-a+1,v-c+1,e);else{var d=f-a+1;t.fillRect(a,c,d,v-c+1)}u=f}},t.prototype.df=function(t,i,n,s){if(null!==this.$t)for(var h="",r=this.vf(s),e=n.from;e<n.to;e++){var u=i[e],o=Math.round(Math.min(u.Oe,u.We)*s),l=Math.round(Math.max(u.Oe,u.We)*s),a=Math.round(u.Mt*s)-Math.floor(.5*this.Ka),f=a+this.Ka-1;if(u.j!==h){var c=u.j;t.fillStyle=c,h=c}this.$t.cf&&(a+=r,o+=r,f-=r,l-=r),o>l||t.fillRect(a,o,f-a+1,l-o+1)}},t}(),zs=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.ni=new Os,i}return J(i,t),i.prototype.Bt=function(t,i){if(!this.Pa.Wt())return null;var n=this.Pa.K();this.Ba();var s={An:this.Fa,$a:this.Gn.zt().$a(),af:n.wickVisible,cf:n.borderVisible,wt:this.Aa};return this.ni._t(s),this.ni},i.prototype.za=function(){var t=this;this.Fa.forEach(function(i){var n=t.Pa.Ha().nf(i.Nt);i.j=n.if,i._f=n.wf,i.qt=n.bf})},i.prototype.qa=function(t,i,n){var s=n.nf(t);return q(q({},this.tf(t,i,n)),{j:s.if,_f:s.wf,qt:s.bf})},i}(As),Rs=function(){function t(){this.$t=null,this.Mf=[]}return t.prototype._t=function(t){this.$t=t,this.Mf=[]},t.prototype.ot=function(t,i,n,s){if(null!==this.$t&&0!==this.$t.bt.length&&null!==this.$t.wt){this.Mf.length||this.mf(i);for(var h=Math.max(1,Math.floor(i)),r=Math.round(this.$t.pf*i)-Math.floor(h/2),e=r+h,u=this.$t.wt.from;u<this.$t.wt.to;u++){var o=this.$t.bt[u],l=this.Mf[u-this.$t.wt.from],a=Math.round(o.gt*i);t.fillStyle=o.j;var f=void 0,c=void 0;a<=r?(f=a,c=e):(f=r,c=a-Math.floor(h/2)+h),t.fillRect(l.ou,f,l.lu-l.ou+1,c-f)}}},t.prototype.mf=function(t){if(null!==this.$t&&0!==this.$t.bt.length&&null!==this.$t.wt){var i=Math.ceil(this.$t.$a*t)<=1?0:Math.max(1,Math.floor(t)),n=Math.round(this.$t.$a*t)-i;this.Mf=new Array(this.$t.wt.to-this.$t.wt.from);for(var s=this.$t.wt.from;s<this.$t.wt.to;s++){var h,r=this.$t.bt[s],e=Math.round(r.Mt*t),u=void 0,o=void 0;if(n%2)u=e-(h=(n-1)/2),o=e+h;else u=e-(h=n/2),o=e+h-1;this.Mf[s-this.$t.wt.from]={ou:u,lu:o,gf:e,kf:r.Mt*t,Nt:r.Nt}}for(s=this.$t.wt.from+1;s<this.$t.wt.to;s++){var l=this.Mf[s-this.$t.wt.from],a=this.Mf[s-this.$t.wt.from-1];l.Nt===a.Nt+1&&(l.ou-a.lu!==i+1&&(a.gf>a.kf?a.lu=l.ou-i-1:l.ou=a.lu+i+1))}var f=Math.ceil(this.$t.$a*t);for(s=this.$t.wt.from;s<this.$t.wt.to;s++){(l=this.Mf[s-this.$t.wt.from]).lu<l.ou&&(l.lu=l.ou);var c=l.lu-l.ou+1;f=Math.min(c,f)}if(i>0&&f<4)for(s=this.$t.wt.from;s<this.$t.wt.to;s++){(c=(l=this.Mf[s-this.$t.wt.from]).lu-l.ou+1)>f&&(l.gf>l.kf?l.lu-=1:l.ou+=1)}}else this.Mf=[]},t}();function Ws(t){return{bt:[],$a:t,pf:NaN,wt:null}}function Vs(t,i,n){return{Nt:t,St:i,Mt:NaN,gt:NaN,j:n}}var Is=function(t){function i(i,n){var s=t.call(this,i,n,!1)||this;return s.Ct=new rt,s.yf=Ws(0),s.ni=new Rs,s}return J(i,t),i.prototype.Bt=function(t,i){return this.Pa.Wt()?(this.Ba(),this.Ct):null},i.prototype.Da=function(){var t=this.Gn.zt().$a();this.yf=Ws(t);for(var i=0,n=0,s=this.Pa.K().color,h=0,r=this.Pa.An().Ja();h<r.length;h++){var e=r[h],u=e.value[3],o=void 0!==e.color?e.color:s,l=Vs(e.index,u,o);++i<this.yf.bt.length?this.yf.bt[i]=l:this.yf.bt.push(l),this.Fa[n++]={Nt:e.index,Mt:0}}this.ni._t(this.yf),this.Ct.ut([this.ni])},i.prototype.za=function(){},i.prototype.Ra=function(){t.prototype.Ra.call(this),this.yf.wt=null},i.prototype.Va=function(t,i,n){if(null!==this.Aa){var s=i.$a(),h=A(i.es()),r=t.jt(this.Pa.K().base,n);i.Ia(this.yf.bt),t.Ee(this.yf.bt,n),this.yf.pf=r,this.yf.wt=Ss(this.yf.bt,h,!1),this.yf.$a=s,this.ni._t(this.yf)}},i}(Cs),js=function(t){function i(i,n){var s=t.call(this,i,n)||this;return s.Ya=new gs,s}return J(i,t),i.prototype.Bt=function(t,i){if(!this.Pa.Wt())return null;var n=this.Pa.K();this.Ba();var s={bt:this.Fa,xt:n.color,ti:n.lineStyle,ga:n.lineType,Qt:n.lineWidth,wt:this.Aa,ma:this.Gn.zt().$a()};return this.Ya._t(s),this.Ya},i.prototype.za=function(){var t=this;this.Fa.forEach(function(i){i.j=t.Pa.Ha().nf(i.Nt).if})},i.prototype.qa=function(t,i,n){var s=this.ja(t,i);return s.j=n.nf(t).if,s},i}(Ts),Hs=/[2-9]/g,Js=function(){function t(t){void 0===t&&(t=50),this.xf=new Map,this.Nf=0,this.Sf=Array.from(new Array(t))}return t.prototype.Cf=function(){this.xf.clear(),this.Sf.fill(void 0)},t.prototype.bi=function(t,i,n){var s=n||Hs,h=String(i).replace(s,"0"),r=this.xf.get(h);if(void 0===r){if(0===(r=t.measureText(h).width)&&0!==i.length)return 0;var e=this.Sf[this.Nf];void 0!==e&&this.xf.delete(e),this.Sf[this.Nf]=h,this.Nf=(this.Nf+1)%this.Sf.length,this.xf.set(h,r)}return r},t}(),qs=function(){function t(t){this.Tf=null,this.D=null,this.Lf="right",this.ku=0,this.Ff=t}return t.prototype.Af=function(t,i,n,s){this.Tf=t,this.D=i,this.ku=n,this.Lf=s},t.prototype.ot=function(t,i){null!==this.D&&null!==this.Tf&&this.Tf.ot(t,this.D,this.Ff,this.ku,this.Lf,i)},t}(),Us=function(){function t(t,i,n){this.Pf=t,this.Ff=new Js(50),this.Ef=i,this.$=n,this.X=-1,this.ni=new qs(this.Ff)}return t.prototype.Bt=function(t,i){var n=this.$.rl(this.Ef);if(null===n)return null;var s=n.Ru(this.Ef)?n.io():this.Ef.Ht();if(null===s)return null;var h=n.Uu(s);if("overlay"===h)return null;var r=this.$.Bf();return r.W!==this.X&&(this.X=r.W,this.Ff.Cf()),this.ni.Af(this.Pf.Fi(),r,i,h),this.ni},t}(),Ys=function(){function t(){this.$t=null}return t.prototype._t=function(t){this.$t=t},t.prototype.ot=function(t,i,n,s){if(null!==this.$t&&!1!==this.$t.Wt){var h=Math.round(this.$t.gt*i);if(!(h<0||h>Math.ceil(this.$t.li*i))){var r=0;!0===this.$t.Df&&(r=this.$t.Of);var e=Math.ceil(this.$t.oi*i);t.lineCap="butt",t.strokeStyle=this.$t.j,t.lineWidth=Math.floor(this.$t.Qt*i),g(t,this.$t.ti),y(t,h,r,e)}}},t}(),$s=function(){function t(t){this.zf={oi:0,li:0,gt:0,j:"rgba(0, 0, 0, 0)",Qt:1,ti:0,Wt:!1,Df:!1,Of:0},this.al=new Ys,this.Ft=!0,this.Pa=t,this.Gn=t.ri(),this.al._t(this.zf)}return t.prototype.Pt=function(){this.Ft=!0},t.prototype.Bt=function(t,i){return this.Pa.Wt()?(this.Ft&&(this.cs(t,i),this.Ft=!1),this.al):null},t}(),Ks=function(t){function i(i){return t.call(this,i)||this}return J(i,t),i.prototype.cs=function(t,i){this.zf.Wt=!1;var n=this.Pa.Ht(),s=n.be().be;if(2===s||3===s){var h=this.Pa.K();if(h.baseLineVisible&&this.Pa.Wt()){var r=this.Pa.Vt();null!==r&&(this.zf.Wt=!0,this.zf.gt=n.jt(r.Jt,r.Jt),this.zf.oi=i,this.zf.li=t,this.zf.j=h.baseLineColor,this.zf.Qt=h.baseLineWidth,this.zf.ti=h.baseLineStyle)}}},i}($s),Xs=function(){function t(){this.$t=null}return t.prototype._t=function(t){this.$t=t},t.prototype.bh=function(){return this.$t},t.prototype.ot=function(t,i,n,s){var h=this.$t;if(null!==h){t.save();var r=Math.max(1,Math.floor(i)),e=r%2/2,u=Math.round(h.kf.x*i)+e,o=h.kf.y*i;t.fillStyle=h.Rf,t.beginPath();var l=Math.max(2,1.5*h.Wf)*i;t.arc(u,o,l,0,2*Math.PI,!1),t.fill(),t.fillStyle=h.Vf,t.beginPath(),t.arc(u,o,h.yt*i,0,2*Math.PI,!1),t.fill(),t.lineWidth=r,t.strokeStyle=h.If,t.beginPath(),t.arc(u,o,h.yt*i+r/2,0,2*Math.PI,!1),t.stroke(),t.restore()}},t}(),Zs=[{jf:0,Hf:.25,Jf:4,qf:10,Uf:.25,Yf:0,$f:.4,Kf:.8},{jf:.25,Hf:.525,Jf:10,qf:14,Uf:0,Yf:0,$f:.8,Kf:0},{jf:.525,Hf:1,Jf:14,qf:14,Uf:0,Yf:0,$f:0,Kf:0}];function Gs(t,i,n,s){return I(t,n+(s-n)*i)}function Qs(t,i){for(var n,s=t%2600/2600,h=0,r=Zs;h<r.length;h++){var e=r[h];if(s>=e.jf&&s<=e.Hf){n=e;break}}L(void 0!==n,"Last price animation internal logic error");var u,o,l,a=(s-n.jf)/(n.Hf-n.jf);return{Vf:Gs(i,a,n.Uf,n.Yf),If:Gs(i,a,n.$f,n.Kf),yt:(u=a,o=n.Jf,l=n.qf,o+(l-o)*u)}}var th=function(){function t(t){this.ni=new Xs,this.Ft=!0,this.Xf=!0,this.Zf=performance.now(),this.Gf=this.Zf-1,this.Qf=t}return t.prototype.tc=function(){this.Gf=this.Zf-1,this.Pt()},t.prototype.nc=function(){if(this.Pt(),2===this.Qf.K().lastPriceAnimation){var t=performance.now(),i=this.Gf-t;if(i>0)return void(i<650&&(this.Gf+=2600));this.Zf=t,this.Gf=t+2600}},t.prototype.Pt=function(){this.Ft=!0},t.prototype.sc=function(){this.Xf=!0},t.prototype.Wt=function(){return 0!==this.Qf.K().lastPriceAnimation},t.prototype.hc=function(){switch(this.Qf.K().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.Gf}},t.prototype.Bt=function(t,i){return this.Ft?(this.Dt(t,i),this.Ft=!1,this.Xf=!1):this.Xf&&(this.rc(),this.Xf=!1),this.ni},t.prototype.Dt=function(t,i){this.ni._t(null);var n=this.Qf.ri().zt(),h=n.es(),r=this.Qf.Vt();if(null!==h&&null!==r){var e=this.Qf.ec(!0);if(!e.uc&&h.oc(e.lc)){var u=new s(n.Yt(e.lc),this.Qf.Ht().jt(e.St,r.Jt)),o=e.j,l=this.Qf.K().lineWidth,a=Qs(this.ac(),o);this.ni._t({Rf:o,Wf:l,Vf:a.Vf,If:a.If,yt:a.yt,kf:u})}}},t.prototype.rc=function(){var t=this.ni.bh();if(null!==t){var i=Qs(this.ac(),t.Rf);t.Vf=i.Vf,t.If=i.If,t.yt=i.yt}},t.prototype.ac=function(){return this.hc()?performance.now()-this.Zf:2599},t}();function ih(t,i){return Ei(Math.min(Math.max(t,12),30)*i)}function nh(t,i){switch(t){case"arrowDown":case"arrowUp":case"triangle":return ih(i,1);case"circle":return ih(i,.8);case"square":return ih(i,.7)}}function sh(t){return Pi(ih(t,1))}function hh(t){return Math.max(ih(t,.1),3)}function rh(t,i,n,s,h){var r=(nh("arrowUp",h)-1)/2,e=(Ei(h/2)-1)/2;i.beginPath(),t?(i.moveTo(n-r,s),i.lineTo(n,s-r),i.lineTo(n+r,s),i.lineTo(n+e,s),i.lineTo(n+e,s+r),i.lineTo(n-e,s+r),i.lineTo(n-e,s)):(i.moveTo(n-r,s),i.lineTo(n,s+r),i.lineTo(n+r,s),i.lineTo(n+e,s),i.lineTo(n+e,s-r),i.lineTo(n-e,s-r),i.lineTo(n-e,s)),i.fill()}var eh=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.$t=null,i.Ff=new Js,i.X=-1,i.Z="",i.fc="",i}return J(i,t),i.prototype._t=function(t){this.$t=t},i.prototype.Af=function(t,i){this.X===t&&this.Z===i||(this.X=t,this.Z=i,this.fc=st(t,i),this.Ff.Cf())},i.prototype.lt=function(t,i){return null},i.prototype.ft=function(t,i,n){if(null!==this.$t&&null!==this.$t.wt){t.textBaseline="middle",t.font=this.fc;for(var s=this.$t.wt.from;s<this.$t.wt.to;s++){var h=this.$t.bt[s];void 0!==h.wi&&(h.wi.oi=this.Ff.bi(t,h.wi.cc),h.wi.li=this.X),uh(h,t)}}},i}(et);function uh(t,i){var n,s,h=t.vc||("bottom"===t.dc?180:"right"===t.dc?90:"left"===t.dc?-90:0);i.strokeStyle=(null===(n=t._c)||void 0===n?void 0:n.color)||"transparent",i.lineWidth=(null===(s=t._c)||void 0===s?void 0:s.width)||1,i.fillStyle=t.j,void 0!==t.wi&&function(t,i,n,s){t.fillText(i,n,s)}(i,t.wi.cc,t.Mt-t.wi.oi/2,t.wi.gt),h&&(i.save(),i.translate(t.Mt,t.gt),i.rotate(h*(Math.PI/180)),i.translate(-t.Mt,-t.gt)),function(t,i){if(0===t.Wa)return;switch(t.wc){case"triangle":return void function(t,i,n,s){var h=s/2;t.beginPath(),t.moveTo(i,n-h),t.lineTo(i+h,n+h),t.lineTo(i-h,n+h),t.closePath(),t.fill(),t.stroke()}(i,t.Mt,t.gt,t.Wa);case"arrowDown":return void rh(!1,i,t.Mt,t.gt,t.Wa);case"arrowUp":return void rh(!0,i,t.Mt,t.gt,t.Wa);case"circle":return void function(t,i,n,s){var h=(nh("circle",s)-1)/2;t.beginPath(),t.arc(i,n,h,0,2*Math.PI,!1),t.fill()}(i,t.Mt,t.gt,t.Wa);case"square":return void function(t,i,n,s){var h=nh("square",s),r=(h-1)/2,e=i-r,u=n-r;t.fillRect(e,u,h,h)}(i,t.Mt,t.gt,t.Wa)}t.wc}(t,i),h&&i.restore()}function oh(t,i,n,s,h,r,e,u,o){var l=K(n)?n:n.close,a=K(n)?n:n.high,f=K(n)?n:n.low,c=K(i.size)?Math.max(i.size,0):1,v=sh(u.$a())*c,d=v/2;switch(t.Wa=v,i.position){case"price":var _=i.price||l,w=i.anchor||"center",b="top"===w?1:"bottom"===w?-1:0,M="left"===w?1:"right"===w?-1:0;return t.gt=e.jt(_,o)+d*b,t.Mt=t.Mt+d*M,void(void 0!==t.wi&&(t.wi.gt=t.gt+(d+r+.6*h)*b||1));case"inBar":return t.gt=e.jt(l,o),void(void 0!==t.wi&&(t.wi.gt=t.gt+d+r+.6*h));case"aboveBar":return t.gt=e.jt(a,o)-d-s.bc,void 0!==t.wi&&(t.wi.gt=t.gt-d-.6*h,s.bc+=1.2*h),void(s.bc+=v+r);case"belowBar":return t.gt=e.jt(f,o)+d+s.Mc,void 0!==t.wi&&(t.wi.gt=t.gt+d+r+.6*h,s.Mc+=1.2*h),void(s.Mc+=v+r)}i.position}var lh=function(){function t(t,i){this.Ft=!0,this.mc=!0,this.gc=!0,this.kc=null,this.ni=new eh,this.Qf=t,this.zi=i,this.$t={bt:[],wt:null}}return t.prototype.Pt=function(t){this.Ft=!0,this.gc=!0,"data"===t&&(this.mc=!0)},t.prototype.Bt=function(t,i,n){if(!this.Qf.Wt())return null;this.Ft&&this.Ba();var s=this.zi.K().layout;return this.ni.Af(s.fontSize,s.fontFamily),this.ni._t(this.$t),this.ni},t.prototype.yc=function(){if(this.gc){if(this.Qf.xc().length>0){var t=this.zi.zt().$a(),i=hh(t),n=1.5*sh(t)+2*i;this.kc={above:n,below:n}}else this.kc=null;this.gc=!1}return this.kc},t.prototype.Ba=function(){var t=this.Qf.Ht(),i=this.zi.zt(),n=this.Qf.xc();this.mc&&(this.$t.bt=n.map(function(t){return{Nt:t.time,Mt:0,gt:0,Wa:0,wc:t.shape,j:t.color,Nc:t.Nc,Sc:t.id,wi:void 0}}),this.mc=!1);var s=this.zi.K().layout;this.$t.wt=null;var h=i.es();if(null!==h){var r=this.Qf.Vt();if(null!==r&&0!==this.$t.bt.length){var e=NaN,u=hh(i.$a()),o={bc:u,Mc:u};this.$t.wt=Ss(this.$t.bt,h,!0);for(var l=this.$t.wt.from;l<this.$t.wt.to;l++){var a=n[l];a.time!==e&&(o.bc=u,o.Mc=u,e=a.time);var f=this.$t.bt[l];f.Mt=i.Yt(a.time),void 0!==a.text&&a.text.length>0&&(f.wi={cc:a.text,gt:0,oi:0,li:0});var c=this.Qf.Cc(a.time);null!==c&&oh(f,a,c,o,s.fontSize,u,t,i,r.Jt)}this.Ft=!1}}},t}(),ah=function(t){function i(i){return t.call(this,i)||this}return J(i,t),i.prototype.cs=function(t,i){var n=this.zf;n.Wt=!1;var s=this.Pa.K();if(s.priceLineVisible&&this.Pa.Wt()){var h=this.Pa.ec(0===s.priceLineSource);h.uc||(n.Wt=!0,n.gt=h.Mi,n.j=this.Pa.fh(h.j),n.oi=i,n.li=t,n.Qt=s.priceLineWidth,n.ti=s.priceLineStyle)}},i}($s),fh=function(t){function i(i){var n=t.call(this)||this;return n.si=i,n}return J(i,t),i.prototype.Ai=function(t,i,n){t.Wt=!1,i.Wt=!1;var s=this.si;if(s.Wt()){var h=s.K(),r=h.lastValueVisible,e=""!==s.Tc(),u=0===h.seriesLastValueMode,o=s.ec(!1);if(!o.uc){r&&(t.wi=this.Lc(o,r,u),t.Wt=0!==t.wi.length),(e||u)&&(i.wi=this.Fc(o,r,e,u),i.Wt=i.wi.length>0);var l=s.fh(o.j),a=j(l);n.m=a.m,n.j=a.p,n.Mi=o.Mi,i.qt=s.ri().Ut(o.Mi/s.Ht().li()),t.qt=l}}},i.prototype.Fc=function(t,i,n,s){var h="",r=this.si.Tc();return n&&0!==r.length&&(h+="".concat(r," ")),i&&s&&(h+=this.si.Ht().pe()?t.Ac:t.Pc),h.trim()},i.prototype.Lc=function(t,i,n){return i?n?this.si.Ht().pe()?t.Pc:t.Ac:t.wi:""},i}(Mt),ch=function(){function t(t,i){this.Kr=t,this.Ec=i||null}return t.prototype.Fe=function(){return this.Kr},t.prototype.au=function(){return this.Ec},t.prototype.Fr=function(){return null===this.Kr?null:{priceRange:this.Kr.Fr(),margins:this.Ec||void 0}},t.Ar=function(i){return null===i?null:new t(Ti.Ar(i.priceRange),i.margins)},t}(),vh=function(t){function i(i,n){var s=t.call(this,i)||this;return s.Bc=n,s}return J(i,t),i.prototype.Dc=function(){var t=this.Bc.K();return this.Oc(t.rayStart)},i.prototype.cs=function(t,i){var n=this.zf;n.Wt=!1;var s=this.Bc.K();if(this.Pa.Wt()&&s.lineVisible){var h=this.Bc.zc();if(null!==h){var r=this.Dc();null!==r&&(n.Wt=!0,n.gt=h,n.j=s.color,n.oi=i,n.li=t,n.Qt=s.lineWidth,n.ti=s.lineStyle,n.Df=s.ray,n.Of=r)}}},i.prototype.Oc=function(t){var i=this.Pa.ri().zt(),n=i.Rc({timestamp:t},!0);return i.et()||null===n?null:i.Yt(n)},i}($s),dh=function(t){function i(i,n){var s=t.call(this)||this;return s.Qf=i,s.Bc=n,s}return J(i,t),i.prototype.Ai=function(t,i,n){t.Wt=!1,i.Wt=!1;var s=this.Bc.K(),h=s.axisLabelVisible,r=""!==s.title,e=this.Qf;if(h&&e.Wt()){var u=this.Bc.zc();if(null!==u){r&&(i.wi=s.title,i.Wt=!0),i.qt=e.ri().Ut(u/e.Ht().li()),t.wi=e.Ht().nu(s.price),t.Wt=!0;var o=j(s.color);n.m=o.m,n.j=o.p,n.Mi=u}}},i}(Mt),_h=function(){function t(t,i){this.Qf=t,this.un=i,this.Wc=new vh(t,this),this.Pf=new dh(t,this),this.Vc=new Us(this.Pf,t,t.ri())}return t.prototype.$s=function(t){$(this.un,t),this.Pt(),this.Qf.ri().eo()},t.prototype.K=function(){return this.un},t.prototype.xn=function(){return[this.Wc,this.Vc]},t.prototype.Ic=function(){return this.Pf},t.prototype.Pt=function(){this.Wc.Pt(),this.Pf.Pt()},t.prototype.zc=function(){var t=this.Qf,i=t.Ht();if(t.ri().zt().et()||i.et())return null;var n=t.Vt();return null===n?null:i.jt(this.un.price,n.Jt)},t}(),wh={if:"",bf:"",wf:""},bh=function(){function t(t){this.Qf=t}return t.prototype.nf=function(t,i){var n=this.Qf.jc(),s=this.Qf.K();switch(n){case"Line":return this.Hc(s,t,i);case"Area":return this.Jc(s);case"Baseline":return this.qc(s,t,i);case"Bar":return this.Uc(s,t,i);case"Candlestick":return this.Yc(s,t,i);case"Histogram":return this.$c(s,t,i)}throw new Error("Unknown chart style")},t.prototype.Uc=function(t,i,n){var s=q({},wh),h=t.upColor,r=t.downColor,e=h,u=r,o=A(this.Kc(i,n)),l=P(o.value[0])<=P(o.value[3]);return void 0!==o.color?(s.if=o.color,s.bf=o.color):(s.if=l?h:r,s.bf=l?e:u),s},t.prototype.Yc=function(t,i,n){var s,h,r,e=q({},wh),u=t.upColor,o=t.downColor,l=t.borderUpColor,a=t.borderDownColor,f=t.wickUpColor,c=t.wickDownColor,v=A(this.Kc(i,n)),d=P(v.value[0])<=P(v.value[3]);return e.if=null!==(s=v.color)&&void 0!==s?s:d?u:o,e.bf=null!==(h=v.borderColor)&&void 0!==h?h:d?l:a,e.wf=null!==(r=v.wickColor)&&void 0!==r?r:d?f:c,e},t.prototype.Jc=function(t){return q(q({},wh),{if:t.lineColor})},t.prototype.qc=function(t,i,n){var s=A(this.Kc(i,n)).value[3]>=t.baseValue.price;return q(q({},wh),{if:s?t.topLineColor:t.bottomLineColor})},t.prototype.Hc=function(t,i,n){var s,h=A(this.Kc(i,n));return q(q({},wh),{if:null!==(s=h.color)&&void 0!==s?s:t.color})},t.prototype.$c=function(t,i,n){var s=q({},wh),h=A(this.Kc(i,n));return s.if=void 0!==h.color?h.color:t.color,s},t.prototype.Kc=function(t,i){return void 0!==i?i.Jt:this.Qf.An().Xc(t)},t}(),Mh=30,mh=function(){function t(){this.Zc=[],this.Gc=new Map,this.Qc=new Map}return t.prototype.tv=function(){return this.Wa()>0?this.Zc[this.Zc.length-1]:null},t.prototype.iv=function(){return this.Wa()>0?this.nv(0):null},t.prototype.Fn=function(){return this.Wa()>0?this.nv(this.Zc.length-1):null},t.prototype.Wa=function(){return this.Zc.length},t.prototype.et=function(){return 0===this.Wa()},t.prototype.oc=function(t){return null!==this.sv(t,0)},t.prototype.Xc=function(t){return this.hv(t)},t.prototype.hv=function(t,i){void 0===i&&(i=0);var n=this.sv(t,i);return null===n?null:q(q({},this.rv(n)),{index:this.nv(n)})},t.prototype.Ja=function(){return this.Zc},t.prototype.ev=function(t,i,n){if(this.et())return null;for(var s=null,h=0,r=n;h<r.length;h++){var e=r[h];s=ph(s,this.uv(t,i,e))}return s},t.prototype._t=function(t){this.Qc.clear(),this.Gc.clear(),this.Zc=t},t.prototype.nv=function(t){return this.Zc[t].index},t.prototype.rv=function(t){return this.Zc[t]},t.prototype.sv=function(t,i){var n=this.ov(t);if(null===n&&0!==i)switch(i){case-1:return this.lv(t);case 1:return this.av(t);default:throw new TypeError("Unknown search mode")}return n},t.prototype.lv=function(t){var i=this.fv(t);return i>0&&(i-=1),i!==this.Zc.length&&this.nv(i)<t?i:null},t.prototype.av=function(t){var i=this.cv(t);return i!==this.Zc.length&&t<this.nv(i)?i:null},t.prototype.ov=function(t){var i=this.fv(t);return i===this.Zc.length||t<this.Zc[i].index?null:i},t.prototype.fv=function(t){return ks(this.Zc,t,function(t,i){return t.index<i})},t.prototype.cv=function(t){return ys(this.Zc,t,function(t,i){return i.index>t})},t.prototype.vv=function(t,i,n){for(var s=null,h=t;h<i;h++){var r=this.Zc[h].value[n];Number.isNaN(r)||(null===s?s={t:r,i:r}:(r<s.t&&(s.t=r),r>s.i&&(s.i=r)))}return s},t.prototype.uv=function(t,i,n){if(this.et())return null;var s=null,h=A(this.iv()),r=A(this.Fn()),e=Math.max(t,h),u=Math.min(i,r),o=Math.ceil(e/Mh)*Mh,l=Math.max(o,Math.floor(u/Mh)*Mh),a=this.fv(e),f=this.cv(Math.min(u,o,i));s=ph(s,this.vv(a,f,n));var c=this.Gc.get(n);void 0===c&&(c=new Map,this.Gc.set(n,c));for(var v=Math.max(o+1,e);v<l;v+=Mh){var d=Math.floor(v/Mh),_=c.get(d);if(void 0===_){var w=this.fv(d*Mh),b=this.cv((d+1)*Mh-1);_=this.vv(w,b,n),c.set(d,_)}s=ph(s,_)}a=this.fv(l),f=this.cv(u);return s=ph(s,this.vv(a,f,n))},t}();function ph(t,i){return null===t?i:null===i?t:{t:Math.min(t.t,i.t),i:Math.max(t.i,i.i)}}var gh=function(t){function i(i,n,s){var h=t.call(this,i)||this;h.$t=new mh,h.Wc=new ah(h),h.dv=[],h._v=new Ks(h),h.wv=null,h.bv=null,h.Mv=[],h.mv=[],h.pv=null,h.un=n,h.gv=s;var r=new fh(h);return h.tn=[r],h.Vc=new Us(r,h,i),"Area"!==s&&"Line"!==s&&"Baseline"!==s||(h.wv=new th(h)),h.kv(),h.yv(),h}return J(i,t),i.prototype.B=function(){null!==this.pv&&clearTimeout(this.pv)},i.prototype.fh=function(t){return this.un.priceLineColor||t},i.prototype.ec=function(t){var i={uc:!0},n=this.Ht();if(this.ri().zt().et()||n.et()||this.$t.et())return i;var s,h,r=this.ri().zt().es(),e=this.Vt();if(null===r||null===e)return i;if(t){var u=this.$t.tv();if(null===u)return i;s=u,h=u.index}else{var o=this.$t.hv(r.lu(),-1);if(null===o)return i;if(null===(s=this.$t.Xc(o.index)))return i;h=o.index}var l=s.value[3],a=this.Ha().nf(h,{Jt:s}),f=n.jt(l,e.Jt);return{uc:!1,St:l,wi:n.Bi(l,e.Jt),Ac:n.nu(l),Pc:n.hu(l,e.Jt),j:a.if,Mi:f,lc:h}},i.prototype.Ha=function(){return null!==this.bv||(this.bv=new bh(this)),this.bv},i.prototype.K=function(){return this.un},i.prototype.$s=function(t){var i=t.priceScaleId;void 0!==i&&i!==this.un.priceScaleId&&this.ri().xv(this,i),$(this.un,t),null!==this.Ii&&void 0!==t.scaleMargins&&this.Ii.$s({scaleMargins:t.scaleMargins}),void 0!==t.priceFormat&&(this.kv(),this.ri().Nv()),this.ri().Bs(this),this.ri().Sv(),this._n.Pt("options")},i.prototype._t=function(t,i){this.$t._t(t),this.Cv(),this._n.Pt("data"),this.ln.Pt("data"),null!==this.wv&&(i&&i.Tv?this.wv.nc():0===t.length&&this.wv.tc());var n=this.ri().rl(this);this.ri().Lv(n),this.ri().Bs(this),this.ri().Sv(),this.ri().eo()},i.prototype.Fv=function(t){this.Mv=t.map(function(t){return q({},t)}),this.Cv();var i=this.ri().rl(this);this.ln.Pt("data"),this.ri().Lv(i),this.ri().Bs(this),this.ri().Sv(),this.ri().eo()},i.prototype.xc=function(){return this.mv},i.prototype.Av=function(t){var i=new _h(this,t);return this.dv.push(i),this.ri().Bs(this),i},i.prototype.Pv=function(t){var i=this.dv.indexOf(t);-1!==i&&this.dv.splice(i,1),this.ri().Bs(this)},i.prototype.jc=function(){return this.gv},i.prototype.Vt=function(){var t=this.Ev();return null===t?null:{Jt:t.value[3],Ue:t.time}},i.prototype.Ev=function(){var t=this.ri().zt().es();if(null===t)return null;var i=t.ou();return this.$t.hv(i,1)},i.prototype.An=function(){return this.$t},i.prototype.Cc=function(t){var i=this.$t.Xc(t);return null===i?null:"Bar"===this.gv||"Candlestick"===this.gv?{open:i.value[0],high:i.value[1],low:i.value[2],close:i.value[3]}:i.value[3]},i.prototype.Bv=function(t){var i=this,n=this.wv;return null!==n&&n.Wt()?(null===this.pv&&n.hc()&&(this.pv=setTimeout(function(){i.pv=null,i.ri().Dv()},0)),n.sc(),[n]):[]},i.prototype.xn=function(){var t=[];this.Ov()||t.push(this._v);for(var i=0,n=this.dv;i<n.length;i++){var s=n[i];t.push.apply(t,s.xn())}return t.push(this._n,this.Wc,this.Vc,this.ln),t},i.prototype.Nn=function(t,i){if(i!==this.Ii&&!this.Ov())return[];for(var n=U([],this.tn),s=0,h=this.dv;s<h.length;s++){var r=h[s];n.push(r.Ic())}return n},i.prototype.uh=function(t,i){var n=this;if(void 0!==this.un.autoscaleInfoProvider){var s=this.un.autoscaleInfoProvider(function(){var s=n.zv(t,i);return null===s?null:s.Fr()});return ch.Ar(s)}return this.zv(t,i)},i.prototype.eh=function(){return this.un.priceFormat.minMove},i.prototype.oh=function(){return this.ah},i.prototype.Cn=function(){var t;this._n.Pt(),this.ln.Pt();for(var i=0,n=this.tn;i<n.length;i++){n[i].Pt()}for(var s=0,h=this.dv;s<h.length;s++){h[s].Pt()}this.Wc.Pt(),this._v.Pt(),null===(t=this.wv)||void 0===t||t.Pt()},i.prototype.Ht=function(){return A(t.prototype.Ht.call(this))},i.prototype.Rt=function(t){if(!(("Line"===this.gv||"Area"===this.gv||"Baseline"===this.gv)&&this.un.crosshairMarkerVisible))return null;var i=this.$t.Xc(t);return null===i?null:{St:i.value[3],yt:this.Rv(),qt:this.Wv(),It:this.Vv(t)}},i.prototype.Tc=function(){return this.un.title},i.prototype.Wt=function(){return this.un.visible},i.prototype.Ov=function(){return!Ct(this.Ht().Ji())},i.prototype.zv=function(t,i){if(!X(t)||!X(i)||this.$t.et())return null;var n="Line"===this.gv||"Area"===this.gv||"Baseline"===this.gv||"Histogram"===this.gv?[3]:[2,1],s=this.$t.ev(t,i,n),h=null!==s?new Ti(s.t,s.i):null;if("Histogram"===this.jc()){var r=this.un.base,e=new Ti(r,r);h=null!==h?h.Yn(e):e}return new ch(h,this.ln.yc())},i.prototype.Rv=function(){switch(this.gv){case"Line":case"Area":case"Baseline":return this.un.crosshairMarkerRadius}return 0},i.prototype.Wv=function(){switch(this.gv){case"Line":case"Area":case"Baseline":var t=this.un.crosshairMarkerBorderColor;if(0!==t.length)return t}return null},i.prototype.Vv=function(t){switch(this.gv){case"Line":case"Area":case"Baseline":var i=this.un.crosshairMarkerBackgroundColor;if(0!==i.length)return i}return this.Ha().nf(t).if},i.prototype.kv=function(){switch(this.un.priceFormat.type){case"custom":this.ah={format:this.un.priceFormat.formatter};break;case"volume":this.ah=new ws(this.un.priceFormat.precision);break;case"percent":this.ah=new Ci(this.un.priceFormat.precision);break;default:var t=Math.pow(10,this.un.priceFormat.precision);this.ah=new Si(t,this.un.priceFormat.minMove*t)}null!==this.Ii&&this.Ii._e()},i.prototype.Cv=function(){var t=this,i=this.ri().zt();if(i.et()||0===this.$t.Wa())this.mv=[];else{var n=A(this.$t.iv());this.mv=this.Mv.map(function(s,h){var r=A(i.Rc(s.time,!0)),e=r<n?1:-1;return{time:A(t.$t.hv(r,e)).index,position:s.position,shape:s.shape,color:s.color,id:s.id,Nc:h,text:s.text,size:s.size}})}},i.prototype.yv=function(){switch(this.ln=new lh(this,this.ri()),this.gv){case"Bar":this._n=new Ps(this,this.ri());break;case"Candlestick":this._n=new zs(this,this.ri());break;case"Line":this._n=new js(this,this.ri());break;case"Area":this._n=new Ls(this,this.ri());break;case"Baseline":this._n=new Ds(this,this.ri());break;case"Histogram":this._n=new Is(this,this.ri());break;default:throw Error("Unknown chart style assigned: "+this.gv)}},i}(Xt),kh=function(){function t(t){this.Iv=!0,this.un=t}return t.prototype.il=function(){this.Iv=!0},t.prototype.qo=function(){this.Iv=!1},t.prototype.jv=function(t,i,n){var s=t;if(0===this.un.mode)return s;if(!this.Iv)return t;var h=n.fn(),r=h.Vt();if(null===r)return s;var e=h.jt(t,r),u=n.Ie().filter(function(t){return t instanceof gh}).reduce(function(t,s){if(n.Ru(s)||!s.Wt())return t;var h=s.Ht(),r=s.An();if(h.et()||!r.oc(i))return t;var e=r.Xc(i);if(null===e)return t;var u=P(s.Vt());return t.concat([h.jt(e.value[3],u.Jt)],[h.jt(e.value[2],u.Jt)],[h.jt(e.value[1],u.Jt)],[h.jt(e.value[0],u.Jt)])},[]);if(0===u.length)return s;u.sort(function(t,i){return Math.abs(t-e)-Math.abs(i-e)});var o=u[0];return Math.abs(o-e)<this.un.magnetThreshold&&(s=h.cn(o,r)),s},t}(),yh=function(t){return t.getUTCFullYear()};function xh(t,i,n){return i.replace(/yyyy/g,function(t){return Ni(yh(t),4)}(t)).replace(/yy/g,function(t){return Ni(yh(t)%100,2)}(t)).replace(/MMMM/g,function(t,i){return new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"long"})}(t,n)).replace(/MMM/g,function(t,i){return new Date(t.getUTCFullYear(),t.getUTCMonth(),1).toLocaleString(i,{month:"short"})}(t,n)).replace(/MM/g,function(t){return Ni(function(t){return t.getUTCMonth()+1}(t),2)}(t)).replace(/dd/g,function(t){return Ni(function(t){return t.getUTCDate()}(t),2)}(t))}var Nh=function(){function t(t,i){void 0===t&&(t="yyyy-MM-dd"),void 0===i&&(i="default"),this.Hv=t,this.Jv=i}return t.prototype.qv=function(t){return xh(t,this.Hv,this.Jv)},t}(),Sh=function(){function t(t){this.Uv=t||"%h:%m:%s"}return t.prototype.qv=function(t){return this.Uv.replace("%h",Ni(t.getUTCHours(),2)).replace("%m",Ni(t.getUTCMinutes(),2)).replace("%s",Ni(t.getUTCSeconds(),2))},t}(),Ch={Yv:"yyyy-MM-dd",$v:"%h:%m:%s",Kv:" ",Xv:"default"},Th=function(){function t(t){void 0===t&&(t={});var i=q(q({},Ch),t);this.Zv=new Nh(i.Yv,i.Xv),this.Gv=new Sh(i.$v),this.Qv=i.Kv}return t.prototype.qv=function(t){return"".concat(this.Zv.qv(t)).concat(this.Qv).concat(this.Gv.qv(t))},t}();var Lh=function(){function t(t,i){void 0===i&&(i=50),this.td=0,this.nd=1,this.sd=1,this.xf=new Map,this.hd=new Map,this.rd=t,this.ed=i}return t.prototype.qv=function(t){var i=void 0===t.businessDay?new Date(1e3*t.timestamp).getTime():new Date(Date.UTC(t.businessDay.year,t.businessDay.month-1,t.businessDay.day)).getTime(),n=this.xf.get(i);if(void 0!==n)return n.ud;if(this.td===this.ed){var s=this.hd.get(this.sd);this.hd.delete(this.sd),this.xf.delete(F(s)),this.sd++,this.td--}var h=this.rd(t);return this.xf.set(i,{ud:h,od:this.nd}),this.hd.set(this.nd,i),this.td++,this.nd++,h},t}(),Fh=function(){function t(t,i){L(t<=i,"right should be >= left"),this.ld=t,this.ad=i}return t.prototype.ou=function(){return this.ld},t.prototype.lu=function(){return this.ad},t.prototype.fd=function(){return this.ad-this.ld+1},t.prototype.oc=function(t){return this.ld<=t&&t<=this.ad},t.prototype.kr=function(t){return this.ld===t.ou()&&this.ad===t.lu()},t}();function Ah(t,i){return null===t||null===i?t===i:t.kr(i)}var Ph,Eh=function(){function t(){this.vd=new Map,this.xf=null}return t.prototype.dd=function(t,i){this._d(i),this.xf=null;for(var n=i;n<t.length;++n){var s=t[n],h=this.vd.get(s.wd);void 0===h&&(h=[],this.vd.set(s.wd,h)),h.push({lc:n,Nt:s.Nt,bd:s.wd})}},t.prototype.Md=function(t,i){var n=Math.ceil(i/t);return null!==this.xf&&this.xf.md===n||(this.xf={dr:this.pd(n),md:n}),this.xf.dr},t.prototype._d=function(t){if(0!==t){var i=[];this.vd.forEach(function(n,s){t<=n[0].lc?i.push(s):n.splice(ks(n,t,function(i){return i.lc<t}),1/0)});for(var n=0,s=i;n<s.length;n++){var h=s[n];this.vd.delete(h)}}else this.vd.clear()},t.prototype.pd=function(t){for(var i=[],n=0,s=Array.from(this.vd.keys()).sort(function(t,i){return i-t});n<s.length;n++){var h=s[n];if(this.vd.get(h)){var r=i;i=[];for(var e=r.length,u=0,o=F(this.vd.get(h)),l=o.length,a=1/0,f=-1/0,c=0;c<l;c++){for(var v=o[c],d=v.lc;u<e;){var _=r[u],w=_.lc;if(!(w<d)){a=w;break}u++,i.push(_),f=w,a=1/0}a-d>=t&&d-f>=t&&(i.push(v),f=d)}for(;u<e;u++)i.push(r[u])}}return i},t}(),Bh=function(){function t(t){this.gd=t}return t.prototype.kd=function(){return null===this.gd?null:new Fh(Math.floor(this.gd.ou()),Math.ceil(this.gd.lu()))},t.prototype.yd=function(){return this.gd},t.xd=function(){return new t(null)},t}();!function(t){t[t.Year=0]="Year",t[t.Month=1]="Month",t[t.DayOfMonth=2]="DayOfMonth",t[t.Time=3]="Time",t[t.TimeWithSeconds=4]="TimeWithSeconds"}(Ph||(Ph={}));var Dh=function(){function t(t,i,n){this.ku=0,this.Nd=null,this.Sd=[],this.oe=null,this.ue=null,this.Cd=new Eh,this.Td=new Map,this.Ld=Bh.xd(),this.Fd=!0,this.Ad=new Y,this.Pd=new Y,this.Ed=new Y,this.Bd=null,this.Dd=null,this.Od=[],this.un=i,this.fe=n,this.zd=i.rightOffset,this.Rd=i.barSpacing,this.zi=t,this.Wd()}return t.prototype.K=function(){return this.un},t.prototype.Vd=function(t){$(this.fe,t),this.Id(),this.Wd()},t.prototype.$s=function(t,i){var n;$(this.un,t),this.un.fixLeftEdge&&this.jd(),this.un.fixRightEdge&&this.Hd(),void 0!==t.barSpacing&&this.zi.Jn(t.barSpacing),void 0!==t.rightOffset&&this.zi.qn(t.rightOffset),void 0!==t.minBarSpacing&&this.zi.Jn(null!==(n=t.barSpacing)&&void 0!==n?n:this.Rd),this.Id(),this.Wd(),this.Ed.A()},t.prototype.vn=function(t){var i;return(null===(i=this.Sd[t])||void 0===i?void 0:i.Nt)||null},t.prototype.Ri=function(t){var i,n,s,h,r=Math.floor(t),e=Math.ceil(t),u=null===(i=this.Sd[r])||void 0===i?void 0:i.Nt.timestamp,o=null===(n=this.Sd[e])||void 0===n?void 0:n.Nt.timestamp,l=null===(s=this.Sd[0])||void 0===s?void 0:s.Nt.timestamp,a=null===(h=this.Sd[this.Sd.length-1])||void 0===h?void 0:h.Nt.timestamp,f=this.Sd[1].Nt.timestamp-this.Sd[0].Nt.timestamp;return t>=this.Sd.length-1?{timestamp:a+f*(t-this.Sd.length+1)}:t<0?{timestamp:l-f*-t}:u&&o?{timestamp:u+(o-u)*(t-r)}:null},t.prototype.Rc=function(t,i){if(this.Sd.length<1)return null;if(t.timestamp>this.Sd[this.Sd.length-1].Nt.timestamp)return i?this.Sd.length-1:null;var n=ks(this.Sd,t.timestamp,function(t,i){return t.Nt.timestamp<i});return t.timestamp<this.Sd[n].Nt.timestamp?i?n:null:n},t.prototype.et=function(){return 0===this.ku||0===this.Sd.length||null===this.Nd},t.prototype.es=function(){return this.Jd(),this.Ld.kd()},t.prototype.qd=function(){return this.Jd(),this.Ld.yd()},t.prototype.Ud=function(){var t=this.es();if(null===t)return null;var i={from:t.ou(),to:t.lu()};return this.Yd(i)},t.prototype.Yd=function(t){var i=Math.round(t.from),n=Math.round(t.to),s=A(this.$d()),h=A(this.Kd());return{from:A(this.vn(Math.max(s,i))),to:A(this.vn(Math.min(h,n)))}},t.prototype.Xd=function(t){return{from:A(this.Rc(t.from,!0)),to:A(this.Rc(t.to,!0))}},t.prototype.oi=function(){return this.ku},t.prototype.Ou=function(t){if(isFinite(t)&&!(t<=0)&&this.ku!==t){if(this.un.lockVisibleTimeRangeOnResize&&this.ku){var i=this.Rd*t/this.ku;this.Rd=i}if(this.un.fixLeftEdge){var n=this.es();if(null!==n)if(n.ou()<=0){var s=this.ku-t;this.zd-=Math.round(s/this.Rd)+1}}this.ku=t,this.Fd=!0,this.Zd(),this.Gd()}},t.prototype.Yt=function(t){if(this.et()||!X(t))return 0;var i=this.Qd()+this.zd-t;return this.ku-(i+.5)*this.Rd-1},t.prototype.Ia=function(t,i){for(var n=this.Qd(),s=void 0===i?0:i.from,h=void 0===i?t.length:i.to,r=s;r<h;r++){var e=t[r].Nt,u=n+this.zd-e,o=this.ku-(u+.5)*this.Rd-1;t[r].Mt=o}},t.prototype.Wi=function(t){var i=this.Rc(t,!0),n=this.Sd[i].Nt.timestamp,s=this.Yt(i);if(n===t.timestamp)return s;if(0===i||i===this.Sd.length-1){var h=this.Sd[1].Nt.timestamp-this.Sd[0].Nt.timestamp;return s+(t.timestamp-n)/h*this.$a()}return s},t.prototype.t_=function(t){return Math.ceil(this.i_(t))},t.prototype.Hs=function(t){var i=this.Sd[1].Nt.timestamp-this.Sd[0].Nt.timestamp,n=this.t_(t);if(n>=this.Sd.length){var s=i*(n-this.Sd.length+1);return{timestamp:this.Sd[this.Sd.length-1].Nt.timestamp+s}}if(n<0){s=i*-n;return{timestamp:this.Sd[0].Nt.timestamp-s}}return this.Sd[n].Nt},t.prototype.n_=function(t){return this.et()?null:this.Yt(t)},t.prototype.s_=function(t){return this.et()?null:this.t_(t)},t.prototype.cl=function(){var t=this.qd();if(null===t)return null;var i=t.ou(),n=t.lu(),s=this.n_(Math.floor(i)),h=this.n_(Math.ceil(n)),r=this.Hs(s),e=this.Hs(h);return{from:r.timestamp,to:e.timestamp}},t.prototype.qn=function(t){this.Fd=!0,this.zd=t,this.Gd(),this.zi.h_(),this.zi.eo()},t.prototype.$a=function(){return this.Rd},t.prototype.Jn=function(t){this.r_(t),this.Gd(),this.zi.h_(),this.zi.eo()},t.prototype.e_=function(){return this.zd},t.prototype.dr=function(){if(this.et())return null;if(null!==this.Dd)return this.Dd;for(var t=this.Rd,i=5*(this.zi.K().layout.fontSize+4),n=Math.round(i/t),s=A(this.es()),h=Math.max(s.ou(),s.ou()-n),r=Math.max(s.lu(),s.lu()-n),e=this.Cd.Md(t,i),u=this.$d()+n,o=this.Kd()-n,l=this.u_(),a=this.un.fixLeftEdge||l,f=this.un.fixRightEdge||l,c=0,v=0,d=e;v<d.length;v++){var _=d[v];if(h<=_.lc&&_.lc<=r){var w=void 0;c<this.Od.length?((w=this.Od[c]).ur=this.Yt(_.lc),w.Jr=this.o_(_.Nt,_.bd),w.bd=_.bd):(w={l_:!1,ur:this.Yt(_.lc),Jr:this.o_(_.Nt,_.bd),bd:_.bd},this.Od.push(w)),this.Rd>i/2&&!l?w.l_=!1:w.l_=a&&_.lc<=u||f&&_.lc>=o,c++}}return this.Od.length=c,this.Dd=this.Od,this.Od},t.prototype.a_=function(){this.Fd=!0,this.Jn(this.un.barSpacing),this.qn(this.un.rightOffset)},t.prototype.f_=function(t){this.Fd=!0,this.Nd=t,this.Gd(),this.jd()},t.prototype.c_=function(t,i){var n=this.i_(t),s=this.$a(),h=s+i*(s/10);this.Jn(h),this.un.rightBarStaysOnScroll||this.qn(this.e_()+(n-this.i_(t)))},t.prototype.Ke=function(t){this.oe&&this.tu(),null===this.ue&&null===this.Bd&&(this.et()||(this.ue=t,this.v_()))},t.prototype.Xe=function(t){if(null!==this.Bd){var i=Li(this.ku-t,0,this.ku),n=Li(this.ku-A(this.ue),0,this.ku);0!==i&&0!==n&&this.Jn(this.Bd.$a*i/n)}},t.prototype.Ze=function(){null!==this.ue&&(this.ue=null,this.d_())},t.prototype.Ge=function(t){null===this.oe&&null===this.Bd&&(this.et()||(this.oe=t,this.v_()))},t.prototype.Qe=function(t){if(null!==this.oe){var i=(this.oe-t)/this.$a();this.zd=A(this.Bd).e_+i,this.Fd=!0,this.Gd()}},t.prototype.tu=function(){null!==this.oe&&(this.oe=null,this.d_())},t.prototype.__=function(){this.w_(this.un.rightOffset)},t.prototype.w_=function(t,i){var n=this;if(void 0===i&&(i=400),!isFinite(t))throw new RangeError("offset is required and must be finite number");if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");var s=this.zd,h=performance.now(),r=function(){var e=(performance.now()-h)/i,u=e>=1,o=u?t:s+(t-s)*e;n.qn(o),u||setTimeout(r,20)};r()},t.prototype.Pt=function(t,i){this.Fd=!0,this.Sd=t,this.Cd.dd(t,i),this.Gd()},t.prototype.b_=function(){return this.Ad},t.prototype.M_=function(){return this.Pd},t.prototype.m_=function(){return this.Ed},t.prototype.Qd=function(){return this.Nd||0},t.prototype.p_=function(t){var i=t.fd();this.r_(this.ku/i),this.zd=t.lu()-this.Qd(),this.Gd(),this.Fd=!0,this.zi.h_(),this.zi.eo()},t.prototype.g_=function(){var t=this.$d(),i=this.Kd();null!==t&&null!==i&&this.p_(new Fh(t,i+this.un.rightOffset))},t.prototype.k_=function(t){var i=new Fh(t.from,t.to);this.p_(i)},t.prototype.Vi=function(t){return void 0!==this.fe.timeFormatter?this.fe.timeFormatter(t.businessDay||t.timestamp):this.y_.qv(new Date(1e3*t.timestamp))},t.prototype.u_=function(){var t=this.zi.K(),i=t.handleScroll,n=t.handleScale;return!(i.horzTouchDrag||i.mouseWheel||i.pressedMouseMove||i.vertTouchDrag||n.axisDoubleClickReset||n.axisPressedMouseMove.time||n.mouseWheel||n.pinch)},t.prototype.$d=function(){return 0===this.Sd.length?null:0},t.prototype.Kd=function(){return 0===this.Sd.length?null:this.Sd.length-1},t.prototype.x_=function(t){return(this.ku-1-t)/this.Rd},t.prototype.i_=function(t){var i=this.x_(t),n=this.Qd()+this.zd-i;return Math.round(1e6*n)/1e6},t.prototype.r_=function(t){var i=this.Rd;this.Rd=t,this.Zd(),i!==this.Rd&&(this.Fd=!0,this.N_())},t.prototype.Jd=function(){if(this.Fd)if(this.Fd=!1,this.et())this.S_(Bh.xd());else{var t=this.Qd(),i=this.ku/this.Rd,n=this.zd+t,s=new Fh(n-i+1,n);this.S_(new Bh(s))}},t.prototype.Zd=function(){var t=this.C_();if(this.Rd<t&&(this.Rd=t,this.Fd=!0),0!==this.ku){var i=.5*this.ku;this.Rd>i&&(this.Rd=i,this.Fd=!0)}},t.prototype.C_=function(){return this.un.fixLeftEdge&&this.un.fixRightEdge&&0!==this.Sd.length?this.ku/this.Sd.length:this.un.minBarSpacing},t.prototype.Gd=function(){var t=this.T_();this.zd>t&&(this.zd=t,this.Fd=!0);var i=this.L_();null!==i&&this.zd<i&&(this.zd=i,this.Fd=!0)},t.prototype.L_=function(){var t=this.$d(),i=this.Nd;return null===t||null===i?null:t-i-1+(this.un.fixLeftEdge?this.ku/this.Rd:Math.min(2,this.Sd.length))},t.prototype.T_=function(){return this.un.fixRightEdge?0:this.ku/this.Rd-Math.min(2,this.Sd.length)},t.prototype.v_=function(){this.Bd={$a:this.$a(),e_:this.e_()}},t.prototype.d_=function(){this.Bd=null},t.prototype.o_=function(t,i){var n=this,s=this.Td.get(i);return void 0===s&&(s=new Lh(function(t){return n.F_(t,i)}),this.Td.set(i,s)),s.qv(t)},t.prototype.F_=function(t,i){var n,s=function(t,i,n){switch(t){case 0:case 10:return i?n?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return i?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(i,this.un.timeVisible,this.un.secondsVisible);return void 0!==this.un.tickMarkFormatter?this.un.tickMarkFormatter(null!==(n=t.businessDay)&&void 0!==n?n:t.timestamp,s,this.fe.locale):function(t,i,n){var s={};switch(i){case 0:s.year="numeric";break;case 1:s.month="short";break;case 2:s.day="numeric";break;case 3:s.hour12=!1,s.hour="2-digit",s.minute="2-digit";break;case 4:s.hour12=!1,s.hour="2-digit",s.minute="2-digit",s.second="2-digit"}var h=void 0===t.businessDay?new Date(1e3*t.timestamp):new Date(Date.UTC(t.businessDay.year,t.businessDay.month-1,t.businessDay.day));return new Date(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate(),h.getUTCHours(),h.getUTCMinutes(),h.getUTCSeconds(),h.getUTCMilliseconds()).toLocaleString(n,s)}(t,s,this.fe.locale)},t.prototype.S_=function(t){var i=this.Ld;this.Ld=t,Ah(i.kd(),this.Ld.kd())||this.Ad.A(),Ah(i.yd(),this.Ld.yd())||this.Pd.A(),this.N_()},t.prototype.N_=function(){this.Dd=null},t.prototype.Id=function(){this.N_(),this.Td.clear()},t.prototype.Wd=function(){var t=this.fe.dateFormat;this.un.timeVisible?this.y_=new Th({Yv:t,$v:this.un.secondsVisible?"%h:%m:%s":"%h:%m",Kv:" ",Xv:this.fe.locale}):this.y_=new Nh(t,this.fe.locale)},t.prototype.jd=function(){if(this.un.fixLeftEdge){var t=this.$d();if(null!==t){var i=this.es();if(null!==i){var n=i.ou()-t;if(n<0){var s=this.zd-n-1;this.qn(s)}this.Zd()}}}},t.prototype.Hd=function(){this.Gd(),this.Zd()},t}();var Oh,zh=function(t){function i(i){var n=t.call(this)||this;return n.A_=new Map,n.$t=i,n}return J(i,t),i.prototype.ft=function(t){},i.prototype.vt=function(t){if(this.$t.Wt){t.save();for(var i=0,n=0,s=this.$t.Zh;n<s.length;n++){if(0!==(o=s[n]).wi.length){t.font=o.V;var h=this.P_(t,o.wi);h>this.$t.oi?o.c_=this.$t.oi/h:o.c_=1,i+=o.E_*o.c_}}var r=0;switch(this.$t.B_){case"top":r=0;break;case"center":r=Math.max((this.$t.li-i)/2,0);break;case"bottom":r=Math.max(this.$t.li-i,0)}t.fillStyle=this.$t.j;for(var e=0,u=this.$t.Zh;e<u.length;e++){var o=u[e];t.save();var l=0;switch(this.$t.D_){case"left":t.textAlign="left",l=o.E_/2;break;case"center":t.textAlign="center",l=this.$t.oi/2;break;case"right":t.textAlign="right",l=this.$t.oi-1-o.E_/2}t.translate(l,r),t.textBaseline="top",t.font=o.V,t.scale(o.c_,o.c_),t.fillText(o.wi,0,o.O_),t.restore(),r+=o.E_*o.c_}t.restore()}},i.prototype.P_=function(t,i){var n=this.z_(t.font),s=n.get(i);return void 0===s&&(s=t.measureText(i).width,n.set(i,s)),s},i.prototype.z_=function(t){var i=this.A_.get(t);return void 0===i&&(i=new Map,this.A_.set(t,i)),i},i}(et),Rh=function(){function t(t){this.Ft=!0,this.ii={Wt:!1,j:"",li:0,oi:0,Zh:[],B_:"center",D_:"center"},this.ni=new zh(this.ii),this.si=t}return t.prototype.Pt=function(){this.Ft=!0},t.prototype.Bt=function(t,i){return this.Ft&&(this.Dt(t,i),this.Ft=!1),this.ni},t.prototype.Dt=function(t,i){var n=this.si.K(),s=this.ii;s.Wt=n.visible,s.Wt&&(s.j=n.color,s.oi=i,s.li=t,s.D_=n.horzAlign,s.B_=n.vertAlign,s.Zh=[{wi:n.text,V:st(n.fontSize,n.fontFamily,n.fontStyle),E_:1.2*n.fontSize,O_:0,c_:0}])},t}(),Wh=function(t){function i(i,n){var s=t.call(this)||this;return s.un=n,s._n=new Rh(s),s}return J(i,t),i.prototype.Nn=function(){return[]},i.prototype.xn=function(){return[this._n]},i.prototype.K=function(){return this.un},i.prototype.Cn=function(){this._n.Pt()},i}(Nt);!function(t){t[t.OnTouchEnd=0]="OnTouchEnd",t[t.OnNextTap=1]="OnNextTap"}(Oh||(Oh={}));var Vh,Ih,jh,Hh,Jh,qh,Uh=function(){function t(t,i){this.R_=[],this.W_=[],this.ku=0,this.V_=null,this.I_=null,this.j_=new Y,this.H_=new Y,this.J_=new Y,this.q_=new Y,this.U_=null,this.Y_=t,this.un=i,this.K_=new ht(this),this.Nu=new Dh(this,i.timeScale,this.un.localization),this.At=new St(this,i.crosshair),this.X_=new kh(i.crosshair),this.Z_=new Wh(this,i.watermark),this.G_=new _s(this),this.Q_(),this.R_[0].Du(2e3),this.tw=this.iw(0),this.nw=this.iw(1)}return t.prototype.Nv=function(){this.sw(new Tt(3))},t.prototype.eo=function(){this.sw(new Tt(2))},t.prototype.Dv=function(){this.sw(new Tt(1))},t.prototype.Bs=function(t){var i=this.hw(t);this.sw(i)},t.prototype.rw=function(){return this.I_},t.prototype.Ie=function(){for(var t=[],i=0,n=this.R_;i<n.length;i++)for(var s=0,h=n[i].Ie();s<h.length;s++){var r=h[s];t.push(r)}return t},t.prototype.ew=function(t){var i=this.I_;this.I_=t,null!==i&&this.Bs(i.uw),null!==t&&this.Bs(t.uw)},t.prototype.K=function(){return this.un},t.prototype.$s=function(t){$(this.un,t),this.R_.forEach(function(i){return i.Au(t)}),void 0!==t.timeScale&&this.Nu.$s(t.timeScale),void 0!==t.localization&&this.Nu.Vd(t.localization),(t.leftPriceScale||t.rightPriceScale)&&this.j_.A(),this.tw=this.iw(0),this.nw=this.iw(1),this.Nv()},t.prototype.ow=function(t,i){if("left"!==t)if("right"!==t){var n=this.lw(t);null!==n&&(n.Ht.$s(i),this.j_.A())}else this.$s({rightPriceScale:i});else this.$s({leftPriceScale:i})},t.prototype.lw=function(t){for(var i=0,n=this.R_;i<n.length;i++){var s=n[i],h=s.Pu(t);if(null!==h)return{hi:s,Ht:h}}return null},t.prototype.zt=function(){return this.Nu},t.prototype.aw=function(){return this.R_.length>0?this.R_[0]:null},t.prototype.Ys=function(){return this.R_},t.prototype.fw=function(){return this.Z_},t.prototype.cw=function(){return this.G_},t.prototype.Lo=function(){return this.At},t.prototype.Uo=function(){return this.X_},t.prototype.dw=function(){return this.H_},t.prototype._w=function(){return this.J_},t.prototype.ww=function(){return this.q_},t.prototype.bw=function(t,i){t.Se(i),this.h_()},t.prototype.Ou=function(t){this.ku=t,this.Nu.Ou(this.ku),this.R_.forEach(function(i){return i.Ou(t)}),this.h_()},t.prototype.Q_=function(t){var i=new Gi(this.Nu,this);void 0!==t?this.R_.splice(t,0,i):this.R_.push(i);var n=void 0===t?this.R_.length-1:t,s=new Tt(3);return s.Dn(n,{On:0,zn:!0}),this.sw(s),i},t.prototype.$u=function(t,i,n){t.$u(i,n)},t.prototype.Ku=function(t,i,n){t.Ku(i,n),this.Sv(),this.sw(this.Mw(t,2))},t.prototype.Xu=function(t,i){t.Xu(i),this.sw(this.Mw(t,2))},t.prototype.Zu=function(t,i,n){i.me()||t.Zu(i,n)},t.prototype.Gu=function(t,i,n){i.me()||(t.Gu(i,n),this.Sv(),this.sw(this.Mw(t,2)))},t.prototype.Qu=function(t,i){i.me()||(t.Qu(i),this.sw(this.Mw(t,2)))},t.prototype.so=function(t,i){t.so(i),this.sw(this.Mw(t,2))},t.prototype.mw=function(t){this.Nu.Ke(t)},t.prototype.pw=function(t,i){var n=this.zt();if(!n.et()&&0!==i){var s=n.oi();t=Math.max(1,Math.min(t,s)),n.c_(t,i),this.h_()}},t.prototype.gw=function(t){this.kw(0),this.yw(t),this.xw()},t.prototype.Nw=function(t){this.Nu.Xe(t),this.h_()},t.prototype.Sw=function(){this.Nu.Ze(),this.eo()},t.prototype.kw=function(t){this.V_=t,this.Nu.Ge(t)},t.prototype.yw=function(t){var i=!1;return null!==this.V_&&Math.abs(t-this.V_)>20&&(this.V_=null,i=!0),this.Nu.Qe(t),this.h_(),i},t.prototype.xw=function(){this.Nu.tu(),this.eo(),this.V_=null},t.prototype.Et=function(){return this.W_},t.prototype.Cw=function(t,i,n){this.At.wn(t,i);var h=NaN,r=this.Nu.t_(t),e=this.Nu.es();null!==e&&(r=Math.min(Math.max(e.ou(),r),e.lu()));var u=n.fn(),o=u.Vt();null!==o&&(h=u.cn(i,o)),h=this.X_.jv(h,r,n),this.At.pn(r,h,n),this.Dv(),this.H_.A(this.At.Ot(),new s(t,i))},t.prototype.Tw=function(){this.Lo().kn(),this.Dv(),this.H_.A(null,null)},t.prototype.Sv=function(){var t=this.At.hi();if(null!==t){var i=this.At.Mn(),n=this.At.mn();this.Cw(i,n,t)}this.At.Cn()},t.prototype.Lw=function(t,i,n,h){this.At.wn(t,i);var r=NaN,e=this.Nu.t_(t),u=this.Nu.es();null!==u&&(e=Math.min(Math.max(u.ou(),e),u.lu()));var o=h.fn(),l=o.Vt();null!==l&&(r=o.cn(i,l)),r=this.X_.jv(r,e,h),this.At.pn(e,r,h),this.Dv(),n&&this.H_.A(this.At.Ot(),new s(t,i))},t.prototype.Fw=function(t,i,n){var s=this.Nu.vn(0);void 0!==i&&void 0!==n&&this.Nu.Pt(i,n);var h=this.Nu.vn(0),r=this.Nu.Qd(),e=this.Nu.es();if(null!==e&&null!==s&&null!==h){var u=e.oc(r),o=s.timestamp>h.timestamp,l=null!==t&&t>r&&!o,a=u&&this.Nu.K().shiftVisibleRangeOnNewBar;if(l&&!a){var f=t-r;this.Nu.qn(this.Nu.e_()-f)}}this.Nu.f_(t)},t.prototype.Lv=function(t){null!==t&&t.ro()},t.prototype.rl=function(t){var i=this.R_.find(function(i){return i.je().includes(t)});return void 0===i?null:i},t.prototype.h_=function(){this.Z_.Cn(),this.R_.forEach(function(t){return t.ro()}),this.Sv()},t.prototype.Aw=function(t){this.J_.A(t)},t.prototype.jo=function(t,i){this.q_.A(t,i)},t.prototype.B=function(){this.R_.forEach(function(t){return t.B()}),this.R_.length=0,this.un.localization.priceFormatter=void 0,this.un.localization.timeFormatter=void 0},t.prototype.Pw=function(){return this.K_},t.prototype.Bf=function(){return this.K_.K()},t.prototype.Eu=function(){return this.j_},t.prototype.Ew=function(t,i){var n=this.R_[0],s=this.Bw(i,t,n);return this.W_.push(s),1===this.W_.length?this.Nv():this.eo(),s},t.prototype.Dw=function(t){var i=this.rl(t),n=this.W_.indexOf(t);L(-1!==n,"Series not found"),this.W_.splice(n,1),A(i).qe(t),t.B&&t.B()},t.prototype.Ow=function(t,i,n){var s=new ds[t](this,i,n);return this.R_[0].He(s,this.wa()),s},t.prototype.xv=function(t,i){var n=A(this.rl(t));n.qe(t);var s=this.lw(i);if(null===s){var h=t.Ui();n.He(t,i,h)}else{h=s.hi===n?t.Ui():void 0;s.hi.He(t,i,h)}},t.prototype.g_=function(){var t=new Tt(2);t.Vn(),this.sw(t)},t.prototype.zw=function(t){var i=new Tt(2);i.jn(t),this.sw(i)},t.prototype.Hn=function(){var t=new Tt(2);t.Hn(),this.sw(t)},t.prototype.Jn=function(t){var i=new Tt(2);i.Jn(t),this.sw(i)},t.prototype.qn=function(t){var i=new Tt(2);i.qn(t),this.sw(i)},t.prototype.wa=function(){return this.un.rightPriceScale.visible?"right":"left"},t.prototype.Rw=function(){return this.nw},t.prototype.Ww=function(){return this.tw},t.prototype.Ut=function(t){var i=this.nw,n=this.tw;if(i===n)return i;if(t=Math.max(0,Math.min(100,Math.round(100*t))),null===this.U_||this.U_.xa!==n||this.U_.Na!==i)this.U_={xa:n,Na:i,Vw:new Map};else{var s=this.U_.Vw.get(t);if(void 0!==s)return s}var h=function(t,i,n){var s=V(t),h=s[0],r=s[1],e=s[2],u=s[3],o=V(i),l=o[0],a=o[1],f=o[2],c=o[3],v=[B(h+n*(l-h)),B(r+n*(a-r)),B(e+n*(f-e)),D(u+n*(c-u))];return"rgba(".concat(v[0],", ").concat(v[1],", ").concat(v[2],", ").concat(v[3],")")}(n,i,t/100);return this.U_.Vw.set(t,h),h},t.prototype.Mw=function(t,i){var n=new Tt(i);if(null!==t){var s=this.R_.indexOf(t);n.Dn(s,{On:i})}return n},t.prototype.hw=function(t,i){return void 0===i&&(i=2),this.Mw(this.rl(t),i)},t.prototype.sw=function(t){this.Y_&&this.Y_(t),this.R_.forEach(function(t){return t.oo()._r().Pt()})},t.prototype.Bw=function(t,i,n){var s=new gh(this,t,i),h=void 0!==t.priceScaleId?t.priceScaleId:this.wa();return n.He(s,h),Ct(h)||s.$s(t),s},t.prototype.iw=function(t){var i=this.un.layout;return"gradient"===i.background.type?0===t?i.background.topColor:i.background.bottomColor:i.background.color},t}();function Yh(t){void 0!==t.borderColor&&(t.borderUpColor=t.borderColor,t.borderDownColor=t.borderColor),void 0!==t.wickColor&&(t.wickUpColor=t.wickColor,t.wickDownColor=t.wickColor)}function $h(t){return!K(t)&&!Z(t)}function Kh(t){return K(t)}!function(t){t[t.Disabled=0]="Disabled",t[t.Continuous=1]="Continuous",t[t.OnDataUpdate=2]="OnDataUpdate"}(Vh||(Vh={})),function(t){t[t.LastBar=0]="LastBar",t[t.LastVisible=1]="LastVisible"}(Ih||(Ih={})),function(t){t.Top="top",t.Middle="middle",t.Bottom="bottom"}(jh||(jh={})),function(t){t.Left="left",t.Center="center",t.Right="right"}(Hh||(Hh={})),function(t){t.Start="start",t.Center="center",t.End="end",t.Left="left",t.Right="right"}(Jh||(Jh={})),function(t){t.Solid="solid",t.VerticalGradient="gradient"}(qh||(qh={}));var Xh={allowDownsampling:!0};var Zh=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}(),Gh=function(){function t(t,i){this.Zt=t,this.Gt=i}return t.prototype.kr=function(t){return this.Zt===t.Zt&&this.Gt===t.Gt},t}();function Qh(t){return t.ownerDocument&&t.ownerDocument.defaultView&&t.ownerDocument.defaultView.devicePixelRatio||1}function tr(t){var i=A(t.getContext("2d"));return i.setTransform(1,0,0,1,0,0),i}function ir(t,i){var n=t.createElement("canvas"),s=Qh(n);return n.style.width="".concat(i.Zt,"px"),n.style.height="".concat(i.Gt,"px"),n.width=i.Zt*s,n.height=i.Gt*s,n}function nr(t,i){var n=A(t.ownerDocument).createElement("canvas");t.appendChild(n);var s=function(t,i){return void 0===i&&(i=Xh),new Zh(t,i)}(n,{allowDownsampling:!1});return s.resizeCanvas({width:i.Zt,height:i.Gt}),s}function sr(t,i){return t.Iw-i.Iw}function hr(t,i,n){var s=(t.Iw-i.Iw)/(t.Nt-i.Nt);return Math.sign(s)*Math.min(Math.abs(s),n)}var rr=function(){function t(t,i,n,s){this.jw=null,this.Hw=null,this.Jw=null,this.qw=null,this.Uw=null,this.Yw=0,this.$w=0,this.Kw=!1,this.Xw=t,this.Zw=i,this.Gw=n,this.wr=s}return t.prototype.Qw=function(t,i){if(null!==this.jw){if(this.jw.Nt===i)return void(this.jw.Iw=t);if(Math.abs(this.jw.Iw-t)<this.wr)return}this.qw=this.Jw,this.Jw=this.Hw,this.Hw=this.jw,this.jw={Nt:i,Iw:t}},t.prototype.jf=function(t,i){if(null!==this.jw&&null!==this.Hw&&!(i-this.jw.Nt>50)){var n=0,s=hr(this.jw,this.Hw,this.Zw),h=sr(this.jw,this.Hw),r=[s],e=[h];if(n+=h,null!==this.Jw){var u=hr(this.Hw,this.Jw,this.Zw);if(Math.sign(u)===Math.sign(s)){var o=sr(this.Hw,this.Jw);if(r.push(u),e.push(o),n+=o,null!==this.qw){var l=hr(this.Jw,this.qw,this.Zw);if(Math.sign(l)===Math.sign(s)){var a=sr(this.Jw,this.qw);r.push(l),e.push(a),n+=a}}}}for(var f,c,v,d=0,_=0;_<r.length;++_)d+=e[_]/n*r[_];if(!(Math.abs(d)<this.Xw))this.Uw={Iw:t,Nt:i},this.$w=d,this.Yw=(f=Math.abs(d),c=this.Gw,v=Math.log(c),Math.log(1*v/-f)/v)}},t.prototype.tb=function(t){var i=A(this.Uw),n=t-i.Nt;return i.Iw+this.$w*(Math.pow(this.Gw,n)-1)/Math.log(this.Gw)},t.prototype.Ps=function(t){return null===this.Uw||this.ib(t)===this.Yw},t.prototype.nb=function(){return this.Kw},t.prototype.sb=function(){this.Kw=!0},t.prototype.ib=function(t){var i=t-A(this.Uw).Nt;return Math.min(i,this.Yw)},t}(),er="undefined"!=typeof window;function ur(){return!!er&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1}function or(){return!!er&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function lr(t){er&&void 0!==window.chrome&&t.addEventListener("mousedown",function(t){if(1===t.button)return t.preventDefault(),!1})}var ar=function(){function t(t,i,n){var s=this;this.Zl=0,this.hb=null,this.rb={Mt:Number.NEGATIVE_INFINITY,gt:Number.POSITIVE_INFINITY},this.eb=0,this.ub=null,this.ob={Mt:Number.NEGATIVE_INFINITY,gt:Number.POSITIVE_INFINITY},this.lb=null,this.ab=!1,this.fb=null,this.cb=null,this._b=!1,this.wb=!1,this.bb=!1,this.Mb=null,this.mb=null,this.pb=null,this.gb=null,this.kb=null,this.yb=null,this.xb=null,this.Nb=0,this.Sb=!1,this.Cb=!1,this.Tb=!1,this.Lb=0,this.Fb=null,this.Ab=!or(),this.Pb=function(t){s.Eb(t)},this.Bb=function(t){if(s.Db(t)){var i=s.Ob(t);if(++s.eb,s.ub&&s.eb>1)s.Rb(vr(t),s.ob).zb<30&&!s.bb&&s.Wb(i,s.Ib.Vb),s.jb()}else{i=s.Ob(t);if(++s.Zl,s.hb&&s.Zl>1)s.Rb(vr(t),s.rb).zb<5&&!s.wb&&s.Hb(i,s.Ib.Jb),s.qb()}},this.Ub=t,this.Ib=i,this.un=n,this.Yb()}return t.prototype.B=function(){null!==this.Mb&&(this.Mb(),this.Mb=null),null!==this.mb&&(this.mb(),this.mb=null),null!==this.gb&&(this.gb(),this.gb=null),null!==this.kb&&(this.kb(),this.kb=null),null!==this.yb&&(this.yb(),this.yb=null),null!==this.pb&&(this.pb(),this.pb=null),this.$b(),this.qb()},t.prototype.Kb=function(t){var i=this;this.gb&&this.gb();var n=this.Xb.bind(this);if(this.gb=function(){i.Ub.removeEventListener("mousemove",n)},this.Ub.addEventListener("mousemove",n),!this.Db(t)){var s=this.Ob(t);this.Hb(s,this.Ib.Zb),this.Ab=!0}},t.prototype.qb=function(){null!==this.hb&&clearTimeout(this.hb),this.Zl=0,this.hb=null,this.rb={Mt:Number.NEGATIVE_INFINITY,gt:Number.POSITIVE_INFINITY}},t.prototype.jb=function(){null!==this.ub&&clearTimeout(this.ub),this.eb=0,this.ub=null,this.ob={Mt:Number.NEGATIVE_INFINITY,gt:Number.POSITIVE_INFINITY}},t.prototype.Xb=function(t){if(!this.Tb&&null===this.cb&&!this.Db(t)){var i=this.Ob(t);this.Hb(i,this.Ib.Gb),this.Ab=!0}},t.prototype.Qb=function(t){var i=_r(t.changedTouches,A(this.Fb));if(null!==i&&(this.Lb=dr(t),null===this.xb&&!this.Cb)){this.Sb=!0;var n=this.Rb(vr(i),A(this.cb)),s=n.tM,h=n.iM,r=n.zb;if(this._b||!(r<5)){if(!this._b){var e=.5*s,u=h>=e&&!this.un.nM(),o=e>h&&!this.un.sM();u||o||(this.Cb=!0),this._b=!0,this.bb=!0,this.$b(),this.jb()}if(!this.Cb){var l=this.Ob(t,i);this.Wb(l,this.Ib.hM),cr(t)}}}},t.prototype.rM=function(t){if(0===t.button&&(this.Rb(vr(t),A(this.fb)).zb>=5&&(this.wb=!0,this.qb()),this.wb)){var i=this.Ob(t);this.Hb(i,this.Ib.eM)}},t.prototype.Rb=function(t,i){var n=Math.abs(i.Mt-t.Mt),s=Math.abs(i.gt-t.gt);return{tM:n,iM:s,zb:n+s}},t.prototype.uM=function(t){var i=_r(t.changedTouches,A(this.Fb));if(null===i&&0===t.touches.length&&(i=t.changedTouches[0]),null!==i){this.Fb=null,this.Lb=dr(t),this.$b(),this.cb=null,this.yb&&(this.yb(),this.yb=null);var n=this.Ob(t,i);if(this.Wb(n,this.Ib.oM),++this.eb,this.ub&&this.eb>1)this.Rb(vr(i),this.ob).zb<30&&!this.bb&&this.Wb(n,this.Ib.Vb),this.jb();else this.bb||(this.Wb(n,this.Ib.lM),this.Ib.lM&&cr(t));0===this.eb&&cr(t),0===t.touches.length&&this.ab&&(this.ab=!1,cr(t))}},t.prototype.Eb=function(t){if(0===t.button){var i=this.Ob(t);if(this.fb=null,this.Tb=!1,this.kb&&(this.kb(),this.kb=null),ur())this.Ub.ownerDocument.documentElement.removeEventListener("mouseleave",this.Pb);if(!this.Db(t))if(this.Hb(i,this.Ib.aM),++this.Zl,this.hb&&this.Zl>1)this.Rb(vr(t),this.rb).zb<5&&!this.wb&&this.Hb(i,this.Ib.Jb),this.qb();else this.wb||this.Hb(i,this.Ib.fM)}},t.prototype.$b=function(){null!==this.lb&&(clearTimeout(this.lb),this.lb=null)},t.prototype.cM=function(t){if(null===this.Fb){var i=t.changedTouches[0];this.Fb=i.identifier,this.Lb=dr(t);var n=this.Ub.ownerDocument.documentElement;this.bb=!1,this._b=!1,this.Cb=!1,this.cb=vr(i),this.yb&&(this.yb(),this.yb=null);var s=this.Qb.bind(this),h=this.uM.bind(this);this.yb=function(){n.removeEventListener("touchmove",s),n.removeEventListener("touchend",h)},n.addEventListener("touchmove",s,{passive:!1}),n.addEventListener("touchend",h,{passive:!1}),this.$b(),this.lb=setTimeout(this.vM.bind(this,t),240);var r=this.Ob(t,i);this.Wb(r,this.Ib.dM),this.ub||(this.eb=0,this.ub=setTimeout(this.jb.bind(this),500),this.ob=vr(i))}},t.prototype._M=function(t){if(0===t.button){var i=this.Ub.ownerDocument.documentElement;ur()&&i.addEventListener("mouseleave",this.Pb),this.wb=!1,this.fb=vr(t),this.kb&&(this.kb(),this.kb=null);var n=this.rM.bind(this),s=this.Eb.bind(this);if(this.kb=function(){i.removeEventListener("mousemove",n),i.removeEventListener("mouseup",s)},i.addEventListener("mousemove",n),i.addEventListener("mouseup",s),this.Tb=!0,!this.Db(t)){var h=this.Ob(t);this.Hb(h,this.Ib.wM),this.hb||(this.Zl=0,this.hb=setTimeout(this.qb.bind(this),500),this.rb=vr(t))}}},t.prototype.Yb=function(){var t=this;this.Ub.addEventListener("mouseenter",this.Kb.bind(this)),this.Ub.addEventListener("touchcancel",this.$b.bind(this));var i=this.Ub.ownerDocument,n=function(i){t.Ib.bM&&(i.target&&t.Ub.contains(i.target)||t.Ib.bM())};this.mb=function(){i.removeEventListener("touchstart",n)},this.Mb=function(){i.removeEventListener("mousedown",n)},i.addEventListener("mousedown",n),i.addEventListener("touchstart",n,{passive:!0}),or()&&(this.pb=function(){t.Ub.removeEventListener("dblclick",t.Bb)},this.Ub.addEventListener("dblclick",this.Bb)),this.Ub.addEventListener("mouseleave",this.MM.bind(this)),this.Ub.addEventListener("touchstart",this.cM.bind(this),{passive:!0}),lr(this.Ub),this.Ub.addEventListener("mousedown",this._M.bind(this)),this.mM(),this.Ub.addEventListener("touchmove",function(){},{passive:!1})},t.prototype.mM=function(){var t=this;void 0===this.Ib.pM&&void 0===this.Ib.gM&&void 0===this.Ib.kM||(this.Ub.addEventListener("touchstart",function(i){return t.yM(i.touches)},{passive:!0}),this.Ub.addEventListener("touchmove",function(i){if(2===i.touches.length&&null!==t.xb&&void 0!==t.Ib.gM){var n=fr(i.touches[0],i.touches[1])/t.Nb;t.Ib.gM(t.xb,n),cr(i)}},{passive:!1}),this.Ub.addEventListener("touchend",function(i){t.yM(i.touches)}))},t.prototype.yM=function(t){1===t.length&&(this.Sb=!1),2!==t.length||this.Sb||this.ab?this.xM():this.NM(t)},t.prototype.NM=function(t){var i=this.Ub.getBoundingClientRect()||{left:0,top:0};this.xb={Mt:(t[0].clientX-i.left+(t[1].clientX-i.left))/2,gt:(t[0].clientY-i.top+(t[1].clientY-i.top))/2},this.Nb=fr(t[0],t[1]),void 0!==this.Ib.pM&&this.Ib.pM(),this.$b()},t.prototype.xM=function(){null!==this.xb&&(this.xb=null,void 0!==this.Ib.kM&&this.Ib.kM())},t.prototype.MM=function(t){if(this.gb&&this.gb(),!this.Db(t)&&this.Ab){var i=this.Ob(t);this.Hb(i,this.Ib.SM),this.Ab=!or()}},t.prototype.vM=function(t){var i=_r(t.touches,A(this.Fb));if(null!==i){var n=this.Ob(t,i);this.Wb(n,this.Ib.CM),this.bb=!0,this.ab=!0}},t.prototype.Db=function(t){return t.sourceCapabilities&&void 0!==t.sourceCapabilities.firesTouchEvents?t.sourceCapabilities.firesTouchEvents:dr(t)<this.Lb+500},t.prototype.Wb=function(t,i){i&&i.call(this.Ib,t)},t.prototype.Hb=function(t,i){i&&i.call(this.Ib,t)},t.prototype.Ob=function(t,i){var n=i||t,s=this.Ub.getBoundingClientRect()||{left:0,top:0};return{TM:n.clientX,LM:n.clientY,FM:n.pageX,AM:n.pageY,PM:n.screenX,EM:n.screenY,BM:n.clientX-s.left,DM:n.clientY-s.top,OM:t.ctrlKey,zM:t.altKey,ll:t.shiftKey,RM:t.metaKey,WM:!t.type.startsWith("mouse")&&"contextmenu"!==t.type&&"click"!==t.type,VM:t.type,IM:n.target,jM:t.view,HM:function(){"touchstart"!==t.type&&cr(t)}}},t}();function fr(t,i){var n=t.clientX-i.clientX,s=t.clientY-i.clientY;return Math.sqrt(n*n+s*s)}function cr(t){t.cancelable&&t.preventDefault()}function vr(t){return{Mt:t.pageX,gt:t.pageY}}function dr(t){return t.timeStamp||performance.now()}function _r(t,i){for(var n=0;n<t.length;++n)if(t[n].identifier===i)return t[n];return null}var wr=function(){function t(t,i,n,s){this.Ff=new Js(200),this.X=0,this.JM="",this.fc="",this.Sf=[],this.qM=new Map,this.X=t,this.JM=i,this.fc=st(t,n,s)}return t.prototype.B=function(){this.Ff.Cf(),this.Sf=[],this.qM.clear()},t.prototype.UM=function(t,i,n,s,h){var r=this.YM(t,i);if("left"!==h){var e=Qh(t.canvas);n-=Math.floor(r.$M*e)}s-=Math.floor(r.li/2),t.drawImage(r.KM,n,s,r.oi,r.li)},t.prototype.YM=function(t,i){var n,s=this;if(this.qM.has(i))n=F(this.qM.get(i));else{if(this.Sf.length>=200){var h=F(this.Sf.shift());this.qM.delete(h)}var r=Qh(t.canvas),e=Math.ceil(this.X/4.5),u=Math.round(this.X/10),o=Math.ceil(this.Ff.bi(t,i)),l=Pi(Math.round(o+2*e)),a=Pi(this.X+2*e),f=ir(document,new Gh(l,a));n={wi:i,$M:Math.round(Math.max(1,o)),oi:Math.ceil(l*r),li:Math.ceil(a*r),KM:f},0!==o&&(this.Sf.push(n.wi),this.qM.set(n.wi,n)),dt(t=tr(n.KM),r,function(){t.font=s.fc,t.fillStyle=s.JM,t.fillText(i,0,a-e-u)})}return n},t}(),br=function(){function t(t,i,n,s){var h=this;this.Pi=null,this.XM=null,this.ZM=!1,this.GM=new Js(50),this.QM=new wr(11,"#000"),this.JM=null,this.fc=null,this.tm=0,this.im=!1,this.nm=function(){h.sm(h.K_.K()),h.im||h.Xi.hm().ri().eo()},this.rm=function(){h.im||h.Xi.hm().ri().eo()},this.Xi=t,this.un=i,this.K_=n,this.um="left"===s,this.om=document.createElement("div"),this.om.style.height="100%",this.om.style.overflow="hidden",this.om.style.width="25px",this.om.style.left="0",this.om.style.position="relative",this.lm=nr(this.om,new Gh(16,16)),this.lm.subscribeCanvasConfigured(this.nm);var r=this.lm.canvas;r.style.position="absolute",r.style.zIndex="1",r.style.left="0",r.style.top="0",this.am=nr(this.om,new Gh(16,16)),this.am.subscribeCanvasConfigured(this.rm);var e=this.am.canvas;e.style.position="absolute",e.style.zIndex="2",e.style.left="0",e.style.top="0";var u={wM:this.fm.bind(this),dM:this.fm.bind(this),eM:this.vm.bind(this),hM:this.vm.bind(this),bM:this.dm.bind(this),aM:this._m.bind(this),oM:this._m.bind(this),Jb:this.wm.bind(this),Vb:this.wm.bind(this),Zb:this.bm.bind(this),SM:this.Mm.bind(this)};this.pm=new ar(this.am.canvas,u,{nM:function(){return!1},sM:function(){return!0}})}return t.prototype.B=function(){this.pm.B(),this.am.unsubscribeCanvasConfigured(this.rm),this.am.destroy(),this.lm.unsubscribeCanvasConfigured(this.nm),this.lm.destroy(),null!==this.Pi&&this.Pi.$e().F(this),this.Pi=null,this.QM.B()},t.prototype.gm=function(){return this.om},t.prototype.xt=function(){return A(this.Pi).K().borderColor},t.prototype.km=function(){return this.un.textColor},t.prototype.W=function(){return this.un.fontSize},t.prototype.ym=function(){return st(this.W(),this.un.fontFamily)},t.prototype.xm=function(){var t=this.K_.K(),i=this.JM!==t.j,n=this.fc!==t.V;return(i||n)&&(this.sm(t),this.JM=t.j),n&&(this.GM.Cf(),this.fc=t.V),t},t.prototype.Nm=function(){if(null===this.Pi)return 0;var t=0,i=this.xm(),n=tr(this.lm.canvas),s=this.Pi.dr();n.font=this.ym(),s.length>0&&(t=Math.max(this.GM.bi(n,s[0].Jr),this.GM.bi(n,s[s.length-1].Jr)));for(var h=this.Sm(),r=h.length;r--;){var e=this.GM.bi(n,h[r].wi());e>t&&(t=e)}var u=this.Pi.Vt();if(null!==u&&null!==this.XM){var o=this.Pi.cn(1,u),l=this.Pi.cn(this.XM.Gt-2,u);t=Math.max(t,this.GM.bi(n,this.Pi.Bi(Math.floor(Math.min(o,l))+.11111111111111,u)),this.GM.bi(n,this.Pi.Bi(Math.ceil(Math.max(o,l))-.11111111111111,u)))}var a=t||34,f=Math.ceil(i.O+i.R+i.J+i.q+a);return f+=f%2},t.prototype.Cm=function(t){if(t.Zt<0||t.Gt<0)throw new Error("Try to set invalid size to PriceAxisWidget "+JSON.stringify(t));null!==this.XM&&this.XM.kr(t)||(this.XM=t,this.im=!0,this.lm.resizeCanvas({width:t.Zt,height:t.Gt}),this.am.resizeCanvas({width:t.Zt,height:t.Gt}),this.im=!1,this.om.style.width=t.Zt+"px",this.om.style.height=t.Gt+"px",this.om.style.minWidth=t.Zt+"px")},t.prototype.Tm=function(){return A(this.XM).Zt},t.prototype.$i=function(t){this.Pi!==t&&(null!==this.Pi&&this.Pi.$e().F(this),this.Pi=t,t.$e().N(this.ne.bind(this),this))},t.prototype.Ht=function(){return this.Pi},t.prototype.Cf=function(){var t=this.Xi.Js();this.Xi.hm().ri().so(t,A(this.Ht()))},t.prototype.Lm=function(t){if(null!==this.XM){if(1!==t){var i=tr(this.lm.canvas);this.Fm(),this.Nl(i,this.lm.pixelRatio),this.Sl(i,this.lm.pixelRatio),this.Am(i,this.lm.pixelRatio),this.Pm(i,this.lm.pixelRatio)}var n=tr(this.am.canvas),s=this.XM.Zt,h=this.XM.Gt;dt(n,this.am.pixelRatio,function(){n.clearRect(0,0,s,h)}),this.Em(n,this.am.pixelRatio)}},t.prototype.Bm=function(){return this.lm.canvas},t.prototype.Pt=function(){var t;null===(t=this.Pi)||void 0===t||t.dr()},t.prototype.fm=function(t){if(null!==this.Pi&&!this.Pi.et()&&this.Xi.hm().K().handleScale.axisPressedMouseMove.price){var i=this.Xi.hm().ri(),n=this.Xi.Js();this.ZM=!0,i.$u(n,this.Pi,t.DM)}},t.prototype.vm=function(t){if(null!==this.Pi&&this.Xi.hm().K().handleScale.axisPressedMouseMove.price){var i=this.Xi.hm().ri(),n=this.Xi.Js(),s=this.Pi;i.Ku(n,s,t.DM)}},t.prototype.dm=function(){if(null!==this.Pi&&this.Xi.hm().K().handleScale.axisPressedMouseMove.price){var t=this.Xi.hm().ri(),i=this.Xi.Js(),n=this.Pi;this.ZM&&(this.ZM=!1,t.Xu(i,n))}},t.prototype._m=function(t){if(null!==this.Pi&&this.Xi.hm().K().handleScale.axisPressedMouseMove.price){var i=this.Xi.hm().ri(),n=this.Xi.Js();this.ZM=!1,i.Xu(n,this.Pi)}},t.prototype.wm=function(t){this.Xi.hm().K().handleScale.axisDoubleClickReset&&this.Cf()},t.prototype.bm=function(t){null!==this.Pi&&(!this.Xi.hm().ri().K().handleScale.axisPressedMouseMove.price||this.Pi.pe()||this.Pi.ge()||this.Dm(1))},t.prototype.Mm=function(t){this.Dm(0)},t.prototype.Sm=function(){var t=this,i=[],n=null===this.Pi?void 0:this.Pi;return function(s){for(var h=0;h<s.length;++h)for(var r=s[h].Nn(t.Xi.Js(),n),e=0;e<r.length;e++)i.push(r[e])}(this.Xi.Js().je()),i},t.prototype.Nl=function(t,i){var n=this;if(null!==this.XM){var s=this.XM.Zt,h=this.XM.Gt;dt(t,i,function(){var i=n.Xi.Js().ri(),r=i.Ww(),e=i.Rw();r===e?_t(t,0,0,s,h,r):wt(t,0,0,s,h,r,e)})}},t.prototype.Sl=function(t,i){if(null!==this.XM&&null!==this.Pi&&this.Pi.K().borderVisible){t.save(),t.fillStyle=this.xt();var n,s=Math.max(1,Math.floor(this.xm().O*i));n=this.um?Math.floor(this.XM.Zt*i)-s:0,t.fillRect(n,0,s,Math.ceil(this.XM.Gt*i)),t.restore()}},t.prototype.Am=function(t,i){if(null!==this.XM&&null!==this.Pi){var n=this.Pi.dr();t.save(),t.strokeStyle=this.xt(),t.font=this.ym(),t.fillStyle=this.xt();var s=this.xm(),h=this.Pi.K().borderVisible&&this.Pi.K().drawTicks,r=this.um?Math.floor((this.XM.Zt-s.R)*i-s.O*i):Math.floor(s.O*i),e=this.um?Math.round(r-s.J*i):Math.round(r+s.R*i+s.J*i),u=this.um?"right":"left",o=Math.max(1,Math.floor(i)),l=Math.floor(.5*i);if(h){var a=Math.round(s.R*i);t.beginPath();for(var f=0,c=n;f<c.length;f++){var v=c[f];t.rect(r,Math.round(v.ur*i)-l,a,o)}t.fill()}t.fillStyle=this.km();for(var d=0,_=n;d<_.length;d++){v=_[d];this.QM.UM(t,v.Jr,e,Math.round(v.ur*i),u)}t.restore()}},t.prototype.Fm=function(){if(null!==this.XM&&null!==this.Pi){var t=this.XM.Gt/2,i=[],n=this.Pi.je().slice(),s=this.Xi.Js(),h=this.xm();this.Pi===s.io()&&this.Xi.Js().je().forEach(function(t){s.Ru(t)&&n.push(t)});var r=this.Pi.Ie()[0],e=this.Pi;n.forEach(function(n){var h=n.Nn(s,e);h.forEach(function(t){t.Ci(null),t.Ti()&&i.push(t)}),r===n&&h.length>0&&(t=h[0].Mi())});var u=i.filter(function(i){return i.Mi()<=t}),o=i.filter(function(i){return i.Mi()>t});if(u.sort(function(t,i){return i.Mi()-t.Mi()}),u.length&&o.length&&o.push(u[0]),o.sort(function(t,i){return t.Mi()-i.Mi()}),i.forEach(function(t){return t.Ci(t.Mi())}),this.Pi.K().alignLabels){for(var l=1;l<u.length;l++){var a=u[l],f=(v=u[l-1]).li(h,!1);a.Mi()>(d=v.Si())-f&&a.Ci(d-f)}for(var c=1;c<o.length;c++){var v,d;a=o[c],f=(v=o[c-1]).li(h,!0);a.Mi()<(d=v.Si())+f&&a.Ci(d+f)}}}},t.prototype.Pm=function(t,i){var n=this;if(null!==this.XM){t.save();var s=this.XM,h=this.Sm(),r=this.xm(),e=this.um?"right":"left";h.forEach(function(h){if(h.Li()){var u=h.Bt(A(n.Pi));t.save(),u.ot(t,r,n.GM,s.Zt,e,i),t.restore()}}),t.restore()}},t.prototype.Em=function(t,i){var n=this;if(null!==this.XM&&null!==this.Pi){t.save();var s=this.XM,h=this.Xi.hm().ri(),r=[],e=this.Xi.Js(),u=h.Lo().Nn(e,this.Pi);u.length&&r.push(u);var o=this.xm(),l=this.um?"right":"left";r.forEach(function(h){h.forEach(function(h){t.save(),h.Bt(A(n.Pi)).ot(t,o,n.GM,s.Zt,l,i),t.restore()})}),t.restore()}},t.prototype.Dm=function(t){this.om.style.cursor=1===t?"ns-resize":"default"},t.prototype.ne=function(){var t=this.Nm();this.tm<t&&this.Xi.hm().ri().Nv(),this.tm=t},t.prototype.sm=function(t){this.QM.B(),this.QM=new wr(t.W,t.j,t.I)},t}();function Mr(t,i,n,s,h){t.ct&&t.ct(i,n,s,h)}function mr(t,i,n,s,h){t.ot(i,n,s,h)}function pr(t,i){return t.xn(i)}function gr(t,i){return void 0!==t.Bv?t.Bv(i):[]}var kr=function(){function t(t,i){var n=this;this.XM=new Gh(0,0),this.Om=null,this.zm=null,this.Rm=null,this.Wm=!1,this.Vm=new Y,this.Im=0,this.jm=!1,this.Hm=null,this.Jm=!1,this.qm=null,this.Um=null,this.im=!1,this.nm=function(){n.im||null===n.Ym||n.zi().eo()},this.rm=function(){n.im||null===n.Ym||n.zi().eo()},this.$m=t,this.Ym=i,this.Ym.uo().N(this.Km.bind(this),this,!0),this.Xm=document.createElement("td"),this.Xm.style.padding="0",this.Xm.style.position="relative";var s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.position="relative",s.style.overflow="hidden",this.Zm=document.createElement("td"),this.Zm.style.padding="0",this.Gm=document.createElement("td"),this.Gm.style.padding="0",this.Xm.appendChild(s),this.lm=nr(s,new Gh(16,16)),this.lm.subscribeCanvasConfigured(this.nm);var h=this.lm.canvas;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this.am=nr(s,new Gh(16,16)),this.am.subscribeCanvasConfigured(this.rm);var r=this.am.canvas;r.style.position="absolute",r.style.zIndex="2",r.style.left="0",r.style.top="0",this.Qm=document.createElement("tr"),this.Qm.appendChild(this.Zm),this.Qm.appendChild(this.Xm),this.Qm.appendChild(this.Gm),this.tp(),this.pm=new ar(this.am.canvas,this,{nM:function(){return null===n.Hm&&!n.$m.K().handleScroll.vertTouchDrag},sM:function(){return null===n.Hm&&!n.$m.K().handleScroll.horzTouchDrag}})}return t.prototype.B=function(){null!==this.Om&&this.Om.B(),null!==this.zm&&this.zm.B(),this.am.unsubscribeCanvasConfigured(this.rm),this.am.destroy(),this.lm.unsubscribeCanvasConfigured(this.nm),this.lm.destroy(),null!==this.Ym&&this.Ym.uo().F(this),this.pm.B()},t.prototype.Js=function(){return A(this.Ym)},t.prototype.ip=function(i){null!==this.Ym&&this.Ym.uo().F(this),this.Ym=i,null!==this.Ym&&this.Ym.uo().N(t.prototype.Km.bind(this),this,!0),this.tp()},t.prototype.$o=function(t){var i=t.toString();this.Xm.style.cursor!==i&&(this.Xm.style.cursor=i)},t.prototype.hm=function(){return this.$m},t.prototype.gm=function(){return this.Qm},t.prototype.tp=function(){if(null!==this.Ym&&(this.np(),0!==this.zi().Et().length)){if(null!==this.Om){var t=this.Ym.Yu();this.Om.$i(A(t))}if(null!==this.zm){var i=this.Ym.Us();this.zm.$i(A(i))}}},t.prototype.sp=function(){null!==this.Om&&this.Om.Pt(),null!==this.zm&&this.zm.Pt()},t.prototype.Bu=function(){return null!==this.Ym?this.Ym.Bu():0},t.prototype.Du=function(t){this.Ym&&this.Ym.Du(t)},t.prototype.Zb=function(t){if(this.Ym){this.hp();var i=t.BM,n=t.DM;this.rp(i,n)}},t.prototype.wM=function(t){this.hp(),this.ep(),this.rp(t.BM,t.DM),this.up(6,t)},t.prototype.Gb=function(t){if(this.Ym){var i=t.BM,n=t.DM;this.op()&&this.lp(),this.rp(i,n),this.up(9,t)}},t.prototype.fM=function(t){if(null!==this.Ym){this.hp(),this.up(3,t);var i=t.BM,n=t.DM;if(this.Vm.P()){var h=this.zi().Lo().Ot();this.Vm.A(h,new s(i,n))}this.ap()}},t.prototype.Jb=function(t){if(null!==this.Ym){this.hp(),this.up(4,t);var i=this.Js().qu();if(i.length>0){var n=i[0];if(n.ih())n.nh(!1);else{var s=Q(i[0].dh());this.zi().Aw(s)}}}},t.prototype.eM=function(t){this.fp(t)},t.prototype.aM=function(t){null!==this.Ym&&(this.hp(),this.up(10,t),this.jm=!1,this.cp(t))},t.prototype.CM=function(t){if(this.jm=!0,null===this.Hm){var i=new s(t.BM,t.DM);this.vp(i,i)}},t.prototype.SM=function(t){null!==this.Ym&&(this.hp(),this.Ym.ri().ew(null),this.lp())},t.prototype.dp=function(){return this.Vm},t.prototype.pM=function(){this.Im=1,this._p()},t.prototype.gM=function(t,i){if(this.$m.K().handleScale.pinch){var n=5*(i-this.Im);this.Im=i,this.zi().pw(t.Mt,n)}},t.prototype.dM=function(t){if(this.jm=!1,this.Jm=null!==this.Hm,this.ep(),this.up(6,t),null!==this.Hm){var i=this.zi().Lo();this.qm=new s(i.ai(),i.fi()),this.Hm=new s(t.BM,t.DM)}},t.prototype.hM=function(t){if(null!==this.Ym){var i=t.BM,n=t.DM;if(null!==this.Hm){this.Jm=!1;var s=A(this.qm),h=s.x+(i-this.Hm.x),r=s.y+(n-this.Hm.y);this.rp(h,r)}else this.op()||this.rp(i,n);this.fp(t)}},t.prototype.oM=function(t){0===this.hm().K().trackingMode.exitMode&&(this.Jm=!0),this.up(10,t),this.ap(),this.cp(t)},t.prototype.wp=function(t,i){A("left"===i?this.Om:this.zm).Cm(new Gh(t,this.XM.Gt))},t.prototype.bp=function(){return this.XM},t.prototype.Cm=function(t){if(t.Zt<0||t.Gt<0)throw new Error("Try to set invalid size to PaneWidget "+JSON.stringify(t));this.XM.kr(t)||(this.XM=t,this.im=!0,this.lm.resizeCanvas({width:t.Zt,height:t.Gt}),this.am.resizeCanvas({width:t.Zt,height:t.Gt}),this.im=!1,this.Xm.style.width=t.Zt+"px",this.Xm.style.height=t.Gt+"px")},t.prototype.Mp=function(){var t=A(this.Ym);t.ju(t.Yu()),t.ju(t.Us());for(var i=0,n=t.Ie();i<n.length;i++){var s=n[i];if(t.Ru(s)){var h=s.Ht();null!==h&&t.ju(h),s.Cn()}}},t.prototype.Bm=function(){return this.lm.canvas},t.prototype.Lm=function(t){if(0!==t&&null!==this.Ym){if(t>1&&this.Mp(),null!==this.Om&&this.Om.Lm(t),null!==this.zm&&this.zm.Lm(t),1!==t){var i=tr(this.lm.canvas);i.save(),this.Nl(i,this.lm.pixelRatio),this.Ym&&(this.mp(i,this.lm.pixelRatio),this.pp(i,this.lm.pixelRatio),this.gp(i,this.lm.pixelRatio,pr)),i.restore()}var n=tr(this.am.canvas);n.clearRect(0,0,Math.ceil(this.XM.Zt*this.am.pixelRatio),Math.ceil(this.XM.Gt*this.am.pixelRatio)),this.gp(n,this.lm.pixelRatio,gr),this.kp(n,this.am.pixelRatio)}},t.prototype.yp=function(){return this.Om},t.prototype.xp=function(){return this.zm},t.prototype.Np=function(t,i){this.zi().Cw(this.Sp(t),this.Cp(i),A(this.Ym))},t.prototype.Tp=function(t,i,n){if(this.Ym)if(n){var s=t,h=i;this.Lp(s,h)}else this.Ym.ri().ew(null),this.lp()},t.prototype.Fp=function(){this.lp()},t.prototype.up=function(t,i){var n=this;if(null!==this.Ym){this.$o($i.cu);var s=tr(this.Bm());this.zi().cw().To(this,s,t,i);for(var h=this.Ym.je(),r=h.length-1;r>=0;r--){var e=this.zi().rl(h[r]);if(null!==e)h[r].xn(e).forEach(function(h){void 0!==h.To&&h.To(n,s,t,i)})}}},t.prototype.Km=function(){null!==this.Ym&&this.Ym.uo().F(this),this.Ym=null},t.prototype.Nl=function(t,i){var n=this;dt(t,i,function(){var i=n.zi(),s=i.Ww(),h=i.Rw();s===h?_t(t,0,0,n.XM.Zt,n.XM.Gt,h):wt(t,0,0,n.XM.Zt,n.XM.Gt,s,h)})},t.prototype.mp=function(t,i){var n=A(this.Ym),s=n.oo()._r().Bt(n.li(),n.oi());null!==s&&(t.save(),s.ot(t,i,!1),t.restore())},t.prototype.pp=function(t,i){var n=this.zi().fw();this.Ap(t,i,pr,Mr,n),this.Ap(t,i,pr,mr,n)},t.prototype.kp=function(t,i){this.Ap(t,i,pr,mr,this.zi().Lo())},t.prototype.gp=function(t,i,n){for(var s=A(this.Ym).je(),h=0,r=s;h<r.length;h++){var e=r[h];this.Ap(t,i,n,Mr,e)}for(var u=0,o=s;u<o.length;u++){e=o[u];this.Ap(t,i,n,mr,e)}},t.prototype.Ap=function(t,i,n,s,h){for(var r=A(this.Ym),e=n(h,r),u=r.li(),o=r.oi(),l=r.ri().rw(),a=null!==l&&l.uw===h,f=null!==l&&a&&void 0!==l.Pp?l.Pp.Ep:void 0,c=0,v=e;c<v.length;c++){var d=v[c].Bt(u,o);null!==d&&(t.save(),s(d,t,i,a,f),t.restore())}},t.prototype.np=function(){if(null!==this.Ym){var t=this.$m,i=this.Ym.Yu().K().visible,n=this.Ym.Us().K().visible;i||null===this.Om||(this.Zm.removeChild(this.Om.gm()),this.Om.B(),this.Om=null),n||null===this.zm||(this.Gm.removeChild(this.zm.gm()),this.zm.B(),this.zm=null);var s=t.ri().Pw();i&&null===this.Om&&(this.Om=new br(this,t.K().layout,s,"left"),this.Zm.appendChild(this.Om.gm())),n&&null===this.zm&&(this.zm=new br(this,t.K().layout,s,"right"),this.Gm.appendChild(this.zm.gm()))}},t.prototype.op=function(){return null===this.Hm},t.prototype.Bp=function(t){return t.WM&&this.jm||null!==this.Hm},t.prototype.Sp=function(t){return Math.max(0,Math.min(t,this.XM.Zt-1))},t.prototype.Cp=function(t){return Math.max(0,Math.min(t,this.XM.Gt-1))},t.prototype.rp=function(t,i){this.zi().Cw(this.Sp(t),this.Cp(i),A(this.Ym))},t.prototype.lp=function(){this.zi().Tw()},t.prototype.Lp=function(t,i){this.zi().Lw(this.Sp(t),this.Cp(i),!1,A(this.Ym))},t.prototype.ap=function(){this.Jm&&(this.Hm=null,this.lp())},t.prototype.vp=function(t,i){this.Hm=t,this.Jm=!1,this.rp(i.x,i.y);var n=this.zi().Lo();this.qm=new s(n.ai(),n.fi())},t.prototype.zi=function(){return this.$m.ri()},t.prototype.Dp=function(){var t=this.zi(),i=this.Js(),n=i.fn();t.Qu(i,n),t.xw(),this.Rm=null,this.Wm=!1},t.prototype.cp=function(t){var i=this;if(this.Wm){var n=performance.now();if(null!==this.Um&&this.Um.jf(t.BM,n),null===this.Um||this.Um.Ps(n))this.Dp();else{var s=this.zi(),h=s.zt(),r=this.Um,e=function(){if(!r.nb()){var t=performance.now(),n=r.Ps(t);if(!r.nb()){var u=h.e_();s.yw(r.tb(t)),u===h.e_()&&(n=!0,i.Um=null)}n?i.Dp():requestAnimationFrame(e)}};requestAnimationFrame(e)}}},t.prototype.hp=function(){this.Hm=null},t.prototype.ep=function(){if(this.Ym){if(this._p(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)A(document.activeElement).blur();else{var t=document.getSelection();null!==t&&t.removeAllRanges()}!this.Ym.fn().et()&&this.zi().zt().et()}},t.prototype.fp=function(t){if(null!==this.Ym){var i=this.zi(),n=t.BM,h=t.DM;if(null!==this.Hm){this.Jm=!1;var r=A(this.qm),e=r.x+(n-this.Hm.x),u=r.y+(h-this.Hm.y);this.rp(e,u)}else this.rp(n,h);if(null===this.Rm&&this.up(11,t),!i.zt().et()&&!t.Fo){var o=this.$m.K(),l=o.handleScroll,a=o.kineticScroll;if(l.pressedMouseMove&&!t.WM||(l.horzTouchDrag||l.vertTouchDrag)&&t.WM){var f=this.Ym.fn(),c=performance.now();null!==this.Rm||this.Bp(t)||(this.Rm=new s(t.TM,t.LM),this.Rm.Fl=c,this.Rm.BM=t.BM,this.Rm.DM=t.DM),null!==this.Um&&this.Um.Qw(t.BM,c),null===this.Rm||this.Wm||this.Rm.x===t.TM&&this.Rm.y===t.LM||(null===this.Um&&(t.WM&&a.touch||!t.WM&&a.mouse)&&(this.Um=new rr(.2,7,.997,15),this.Um.Qw(this.Rm.BM,this.Rm.Fl),this.Um.Qw(t.BM,c)),f.et()||i.Zu(this.Ym,f,t.DM),i.kw(t.BM),this.Wm=!0),this.Wm&&(f.et()||i.Gu(this.Ym,f,t.DM),i.yw(t.BM))}}}},t.prototype._p=function(){var t=performance.now(),i=null===this.Um||this.Um.Ps(t);null!==this.Um&&(i||this.Dp()),null!==this.Um&&(this.Um.sb(),this.Um=null)},t}(),yr=function(){function t(t,i,n,s,h){var r=this;this.Ft=!0,this.XM=new Gh(0,0),this.nm=function(){return r.Lm(3)},this.um="left"===t,this.K_=n.Pw,this.un=i,this.Op=s,this.zp=h,this.om=document.createElement("div"),this.om.style.width="25px",this.om.style.height="100%",this.om.style.overflow="hidden",this.lm=nr(this.om,new Gh(16,16)),this.lm.subscribeCanvasConfigured(this.nm)}return t.prototype.B=function(){this.lm.unsubscribeCanvasConfigured(this.nm),this.lm.destroy()},t.prototype.gm=function(){return this.om},t.prototype.bp=function(){return this.XM},t.prototype.Cm=function(t){if(t.Zt<0||t.Gt<0)throw new Error("Try to set invalid size to PriceAxisStub "+JSON.stringify(t));this.XM.kr(t)||(this.XM=t,this.lm.resizeCanvas({width:t.Zt,height:t.Gt}),this.om.style.width="".concat(t.Zt,"px"),this.om.style.minWidth="".concat(t.Zt,"px"),this.om.style.height="".concat(t.Gt,"px"),this.Ft=!0)},t.prototype.Lm=function(t){if((!(t<3)||this.Ft)&&0!==this.XM.Zt&&0!==this.XM.Gt){this.Ft=!1;var i=tr(this.lm.canvas);this.Nl(i,this.lm.pixelRatio),this.Sl(i,this.lm.pixelRatio)}},t.prototype.Bm=function(){return this.lm.canvas},t.prototype.Sl=function(t,i){if(this.Op()){var n=this.XM.Zt;t.save(),t.fillStyle=this.un.timeScale.borderColor;var s=Math.floor(this.K_.K().O*i),h=this.um?Math.round(n*i)-s:0;t.fillRect(h,0,s,s),t.restore()}},t.prototype.Nl=function(t,i){var n=this;dt(t,i,function(){_t(t,0,0,n.XM.Zt,n.XM.Gt,n.zp())})},t}();function xr(t,i){return t.bd>i.bd?t:i}var Nr=function(){function t(t){var i=this;this.Rp=null,this.Wp=null,this.D=null,this.Vp=!1,this.XM=new Gh(0,0),this.Ip=new Y,this.GM=new Js(5),this.im=!1,this.nm=function(){i.im||i.$m.ri().eo()},this.rm=function(){i.im||i.$m.ri().eo()},this.$m=t,this.un=t.K().layout,this.jp=document.createElement("tr"),this.Hp=document.createElement("td"),this.Hp.style.padding="0",this.Jp=document.createElement("td"),this.Jp.style.padding="0",this.om=document.createElement("td"),this.om.style.height="25px",this.om.style.padding="0",this.qp=document.createElement("div"),this.qp.style.width="100%",this.qp.style.height="100%",this.qp.style.position="relative",this.qp.style.overflow="hidden",this.om.appendChild(this.qp),this.lm=nr(this.qp,new Gh(16,16)),this.lm.subscribeCanvasConfigured(this.nm);var n=this.lm.canvas;n.style.position="absolute",n.style.zIndex="1",n.style.left="0",n.style.top="0",this.am=nr(this.qp,new Gh(16,16)),this.am.subscribeCanvasConfigured(this.rm);var s=this.am.canvas;s.style.position="absolute",s.style.zIndex="2",s.style.left="0",s.style.top="0",this.jp.appendChild(this.Hp),this.jp.appendChild(this.om),this.jp.appendChild(this.Jp),this.Up(),this.$m.ri().Eu().N(this.Up.bind(this),this),this.pm=new ar(this.am.canvas,this,{nM:function(){return!0},sM:function(){return!1}})}return t.prototype.B=function(){this.pm.B(),null!==this.Rp&&this.Rp.B(),null!==this.Wp&&this.Wp.B(),this.am.unsubscribeCanvasConfigured(this.rm),this.am.destroy(),this.lm.unsubscribeCanvasConfigured(this.nm),this.lm.destroy()},t.prototype.gm=function(){return this.jp},t.prototype.Yp=function(){return this.Rp},t.prototype.$p=function(){return this.Wp},t.prototype.wM=function(t){if(!this.Vp){this.Vp=!0;var i=this.$m.ri();!i.zt().et()&&this.$m.K().handleScale.axisPressedMouseMove.time&&i.mw(t.BM)}},t.prototype.dM=function(t){this.wM(t)},t.prototype.bM=function(){var t=this.$m.ri();!t.zt().et()&&this.Vp&&(this.Vp=!1,this.$m.K().handleScale.axisPressedMouseMove.time&&t.Sw())},t.prototype.eM=function(t){var i=this.$m.ri();!i.zt().et()&&this.$m.K().handleScale.axisPressedMouseMove.time&&i.Nw(t.BM)},t.prototype.hM=function(t){this.eM(t)},t.prototype.aM=function(){this.Vp=!1;var t=this.$m.ri();t.zt().et()&&!this.$m.K().handleScale.axisPressedMouseMove.time||t.Sw()},t.prototype.oM=function(){this.aM()},t.prototype.Jb=function(){this.$m.K().handleScale.axisDoubleClickReset&&this.$m.ri().Hn()},t.prototype.Vb=function(){this.Jb()},t.prototype.Zb=function(){this.$m.ri().K().handleScale.axisPressedMouseMove.time&&this.Dm(1)},t.prototype.SM=function(){this.Dm(0)},t.prototype.bp=function(){return this.XM},t.prototype.Kp=function(){return this.Ip},t.prototype.Xp=function(t,i,n){this.XM&&this.XM.kr(t)||(this.XM=t,this.im=!0,this.lm.resizeCanvas({width:t.Zt,height:t.Gt}),this.am.resizeCanvas({width:t.Zt,height:t.Gt}),this.im=!1,this.om.style.width=t.Zt+"px",this.om.style.height=t.Gt+"px",this.Ip.A(t)),null!==this.Rp&&this.Rp.Cm(new Gh(i,t.Gt)),null!==this.Wp&&this.Wp.Cm(new Gh(n,t.Gt))},t.prototype.Zp=function(){var t=this.Gp();return Math.ceil(t.O+t.R+t.W+t.U+t.H)},t.prototype.Pt=function(){this.$m.ri().zt().dr()},t.prototype.Bm=function(){return this.lm.canvas},t.prototype.Lm=function(t){if(0!==t){if(1!==t){var i=tr(this.lm.canvas);this.Nl(i,this.lm.pixelRatio),this.Sl(i,this.lm.pixelRatio),this.Am(i,this.lm.pixelRatio),this.Qp(this.$m.ri().Ie(),i,this.lm.pixelRatio),null!==this.Rp&&this.Rp.Lm(t),null!==this.Wp&&this.Wp.Lm(t)}var n=tr(this.am.canvas),s=this.am.pixelRatio;n.clearRect(0,0,Math.ceil(this.XM.Zt*s),Math.ceil(this.XM.Gt*s)),this.Qp([this.$m.ri().Lo()],n,s)}},t.prototype.Nl=function(t,i){var n=this;dt(t,i,function(){_t(t,0,0,n.XM.Zt,n.XM.Gt,n.$m.ri().Rw())})},t.prototype.Sl=function(t,i){if(this.$m.K().timeScale.borderVisible){t.save(),t.fillStyle=this.tg();var n=Math.max(1,Math.floor(this.Gp().O*i));t.fillRect(0,0,Math.ceil(this.XM.Zt*i),n),t.restore()}},t.prototype.Am=function(t,i){var n=this,s=this.$m.ri().zt().dr();if(s&&0!==s.length){var h=s.reduce(xr,s[0]).bd;h>30&&h<50&&(h=30),t.save(),t.strokeStyle=this.tg();var r=this.Gp(),e=r.O+r.R+r.U+r.W-r.Y;t.textAlign="center",t.fillStyle=this.tg();var u=Math.floor(this.Gp().O*i),o=Math.max(1,Math.floor(i)),l=Math.floor(.5*i);if(this.$m.ri().zt().K().borderVisible){t.beginPath();for(var a=Math.round(r.R*i),f=s.length;f--;){var c=Math.round(s[f].ur*i);t.rect(c-l,u,o,a)}t.fill()}t.fillStyle=this.G(),dt(t,i,function(){t.font=n.ig();for(var i=0,r=s;i<r.length;i++){if((a=r[i]).bd<h){var u=a.l_?n.ng(t,a.ur,a.Jr):a.ur;t.fillText(a.Jr,u,e)}}t.font=n.sg();for(var o=0,l=s;o<l.length;o++){var a;if((a=l[o]).bd>=h){u=a.l_?n.ng(t,a.ur,a.Jr):a.ur;t.fillText(a.Jr,u,e)}}}),t.restore()}},t.prototype.ng=function(t,i,n){var s=this.GM.bi(t,n),h=s/2,r=Math.floor(i-h)+.5;return r<0?i+=Math.abs(0-r):r+s>this.XM.Zt&&(i-=Math.abs(this.XM.Zt-(r+s))),i},t.prototype.Qp=function(t,i,n){for(var s=this.Gp(),h=0,r=t;h<r.length;h++)for(var e=0,u=r[h].Ki();e<u.length;e++){var o=u[e].Bt();i.save(),o.ot(i,s,n),i.restore()}},t.prototype.tg=function(){return this.$m.K().timeScale.borderColor},t.prototype.G=function(){return this.un.textColor},t.prototype.X=function(){return this.un.fontSize},t.prototype.ig=function(){return st(this.X(),this.un.fontFamily)},t.prototype.sg=function(){return st(this.X(),this.un.fontFamily,"bold")},t.prototype.Gp=function(){null===this.D&&(this.D={O:1,Y:NaN,U:NaN,H:NaN,Oi:NaN,R:3,W:NaN,V:"",Di:new Js});var t=this.D,i=this.ig();if(t.V!==i){var n=this.X();t.W=n,t.V=i,t.U=Math.ceil(n/2.5),t.H=t.U,t.Oi=Math.ceil(n/2),t.Y=Math.round(this.X()/5),t.Di.Cf()}return this.D},t.prototype.Dm=function(t){this.om.style.cursor=1===t?"ew-resize":"default"},t.prototype.Up=function(){var t=this.$m.ri(),i=t.K();i.leftPriceScale.visible||null===this.Rp||(this.Hp.removeChild(this.Rp.gm()),this.Rp.B(),this.Rp=null),i.rightPriceScale.visible||null===this.Wp||(this.Jp.removeChild(this.Wp.gm()),this.Wp.B(),this.Wp=null);var n={Pw:this.$m.ri().Pw()},s=function(){return i.leftPriceScale.borderVisible&&t.zt().K().borderVisible},h=function(){return t.Rw()};i.leftPriceScale.visible&&null===this.Rp&&(this.Rp=new yr("left",i,n,s,h),this.Hp.appendChild(this.Rp.gm())),i.rightPriceScale.visible&&null===this.Wp&&(this.Wp=new yr("right",i,n,s,h),this.Jp.appendChild(this.Wp.gm()))},t}(),Sr=function(){function t(t,i){var n;this.hg=[],this.rg=0,this.Yr=0,this.ku=0,this.eg=0,this.ug=0,this.og=null,this.lg=!1,this.Vm=new Y,this.H_=new Y,this.J_=new Y,this.q_=new Y,this.un=i,this.jp=document.createElement("div"),this.jp.classList.add("tv-lightweight-charts"),this.jp.style.overflow="hidden",this.jp.style.width="100%",this.jp.style.height="100%",(n=this.jp).style.userSelect="none",n.style.webkitUserSelect="none",n.style.msUserSelect="none",n.style.MozUserSelect="none",n.style.webkitTapHighlightColor="transparent",this.ag=document.createElement("table"),this.ag.setAttribute("cellspacing","0"),this.jp.appendChild(this.ag),this.fg=this.cg.bind(this),this.jp.addEventListener("wheel",this.fg,{passive:!1}),this.zi=new Uh(this.Y_.bind(this),this.un),this.ri().dw().N(this.vg.bind(this),this),this.ri()._w().N(this.dg.bind(this),this),this.ri().ww().N(this._g.bind(this),this),this.wg=new Nr(this),this.ag.appendChild(this.wg.gm());var s=this.un.width,h=this.un.height;if(0===s||0===h){var r=t.getBoundingClientRect();0===s&&(s=Math.floor(r.width),s-=s%2),0===h&&(h=Math.floor(r.height),h-=h%2)}this.bg(s,h),this.Mg(),t.appendChild(this.jp),this.mg(),this.zi.zt().m_().N(this.zi.Nv.bind(this.zi),this),this.zi.Eu().N(this.zi.Nv.bind(this.zi),this)}return t.prototype.ri=function(){return this.zi},t.prototype.K=function(){return this.un},t.prototype.pg=function(){return this.hg},t.prototype.gg=function(){return this.wg},t.prototype.B=function(){this.jp.removeEventListener("wheel",this.fg),0!==this.rg&&window.cancelAnimationFrame(this.rg),this.zi.dw().F(this),this.zi._w().F(this),this.zi.zt().m_().F(this),this.zi.Eu().F(this),this.zi.B();for(var t=0,i=this.hg;t<i.length;t++){var n=i[t];this.ag.removeChild(n.gm()),n.dp().F(this),n.B()}this.hg=[],A(this.wg).B(),null!==this.jp.parentElement&&this.jp.parentElement.removeChild(this.jp),this.H_.B(),this.Vm.B()},t.prototype.bg=function(t,i,n){if(void 0===n&&(n=!1),this.Yr!==i||this.ku!==t){this.Yr=i,this.ku=t;var s=i+"px",h=t+"px";A(this.jp).style.height=s,A(this.jp).style.width=h,this.ag.style.height=s,this.ag.style.width=h,n?this.kg(new Tt(3)):this.zi.Nv()}},t.prototype.Lm=function(t){void 0===t&&(t=new Tt(3));for(var i=0;i<this.hg.length;i++)this.hg[i].Lm(t.Wn(i).On);this.un.timeScale.visible&&this.wg.Lm(t.Rn())},t.prototype.$s=function(t){this.zi.$s(t),this.mg();var i=t.width||this.ku,n=t.height||this.Yr;this.bg(i,n)},t.prototype.dp=function(){return this.Vm},t.prototype.dw=function(){return this.H_},t.prototype._w=function(){return this.J_},t.prototype.ww=function(){return this.q_},t.prototype.yg=function(){var t=this;null!==this.og&&(this.kg(this.og),this.og=null);var i=this.hg[0],n=ir(document,new Gh(this.ku,this.Yr)),s=tr(n),h=Qh(n);return dt(s,h,function(){var n=0,h=0,r=function(i){for(var r=0;r<t.hg.length;r++){var e=t.hg[r],u=e.bp().Gt,o=A("left"===i?e.yp():e.xp()),l=o.Bm();s.drawImage(l,n,h,o.Tm(),u),h+=u}};t.xg()&&(r("left"),n=A(i.yp()).Tm()),h=0;for(var e=0;e<t.hg.length;e++){var u=t.hg[e],o=u.bp(),l=u.Bm();s.drawImage(l,n,h,o.Zt,o.Gt),h+=o.Gt}n+=i.bp().Zt,t.Ng()&&(h=0,r("right"));var a=function(i){var r=A("left"===i?t.wg.Yp():t.wg.$p()),e=r.bp(),u=r.Bm();s.drawImage(u,n,h,e.Zt,e.Gt)};if(t.un.timeScale.visible){n=0,t.xg()&&(a("left"),n=A(i.yp()).Tm());var f=t.wg.bp();l=t.wg.Bm();s.drawImage(l,n,h,f.Zt,f.Gt),t.Ng()&&(n+=i.bp().Zt,a("right"),s.restore())}}),n},t.prototype.Sg=function(t){return"none"===t?0:("left"!==t||this.xg())&&("right"!==t||this.Ng())?0===this.hg.length?0:A("left"===t?this.hg[0].yp():this.hg[0].xp()).Tm():0},t.prototype.Cg=function(){for(var t=0,i=0,n=0,s=0,h=this.hg;s<h.length;s++){var r=h[s];this.xg()&&(i=Math.max(i,A(r.yp()).Nm())),this.Ng()&&(n=Math.max(n,A(r.xp()).Nm())),t+=r.Bu()}var e=this.ku,u=this.Yr,o=Math.max(e-i-n,0),l=this.un.timeScale.visible,a=l?this.wg.Zp():0;a%2&&(a+=1);for(var f=0+a,c=u<f?0:u-f,v=c/t,d=0,_=0;_<this.hg.length;++_){(r=this.hg[_]).ip(this.zi.Ys()[_]);var w,b=0;b=_===this.hg.length-1?c-d:Math.round(r.Bu()*v),d+=w=Math.max(b,2),r.Cm(new Gh(o,w)),this.xg()&&r.wp(i,"left"),this.Ng()&&r.wp(n,"right"),r.Js()&&this.zi.bw(r.Js(),w)}this.wg.Xp(new Gh(l?o:0,a),l?i:0,l?n:0),this.zi.Ou(o),this.eg!==i&&(this.eg=i),this.ug!==n&&(this.ug=n)},t.prototype.cg=function(t){var i=t.deltaX/100,n=-t.deltaY/100;if(0!==i&&this.un.handleScroll.mouseWheel||0!==n&&this.un.handleScale.mouseWheel){switch(t.cancelable&&t.preventDefault(),t.deltaMode){case t.DOM_DELTA_PAGE:i*=120,n*=120;break;case t.DOM_DELTA_LINE:i*=32,n*=32}if(0!==n&&this.un.handleScale.mouseWheel){var s=Math.sign(n)*Math.min(1,Math.abs(n)),h=t.clientX-this.jp.getBoundingClientRect().left;this.ri().pw(h,s)}0!==i&&this.un.handleScroll.mouseWheel&&this.ri().gw(-80*i)}},t.prototype.kg=function(t){var i,n=t.Rn();3===n&&this.Tg(),3!==n&&2!==n||(this.Lg(t),this.Fg(t),this.wg.Pt(),this.hg.forEach(function(t){t.sp()}),3===(null===(i=this.og)||void 0===i?void 0:i.Rn())&&(this.og.Yn(t),this.Tg(),this.Lg(this.og),this.Fg(this.og),t=this.og,this.og=null)),this.Lm(t)},t.prototype.Fg=function(t){for(var i=0,n=t.Un();i<n.length;i++){var s=n[i];this.$n(s)}},t.prototype.Lg=function(t){for(var i=this.zi.Ys(),n=0;n<i.length;n++)t.Wn(n).zn&&i[n].ho()},t.prototype.$n=function(t){var i=this.zi.zt();switch(t.In){case 0:i.g_();break;case 1:i.k_(t.Jt);break;case 2:i.Jn(t.Jt);break;case 3:i.qn(t.Jt);break;case 4:i.a_()}},t.prototype.Y_=function(t){var i=this;null!==this.og?this.og.Yn(t):this.og=t,this.lg||(this.lg=!0,this.rg=window.requestAnimationFrame(function(){if(i.lg=!1,i.rg=0,null!==i.og){var t=i.og;i.og=null,i.kg(t)}}))},t.prototype.Tg=function(){this.Mg()},t.prototype.Mg=function(){for(var t=this.zi.Ys(),i=t.length,n=this.hg.length,s=i;s<n;s++){var h=F(this.hg.pop());this.ag.removeChild(h.gm()),h.dp().F(this),h.B()}for(s=n;s<i;s++){(h=new kr(this,t[s])).dp().N(this.Ag.bind(this),this),this.hg.push(h),this.ag.insertBefore(h.gm(),this.wg.gm())}for(s=0;s<i;s++){var r=t[s];(h=this.hg[s]).Js()!==r?h.ip(r):h.tp()}this.mg(),this.Cg()},t.prototype.Pg=function(t,i){var n,s=new Map;null!==t&&this.zi.Et().forEach(function(i){var n=i.Cc(t);null!==n&&s.set(i,n)});if(null!==t){var h=this.zi.zt().vn(t);null!==h&&(n=h)}var r=this.ri().rw(),e=null!==r&&r.uw instanceof gh?r.uw:void 0,u=null!==r&&void 0!==r.Pp?r.Pp.Sc:void 0;return{Nt:n,$l:i||void 0,Eg:e,Bg:s,Dg:u}},t.prototype.Og=function(t){return{zg:t}},t.prototype.Rg=function(t,i){return{zg:t,Wg:i}},t.prototype.Ag=function(t,i){var n=this;this.Vm.A(function(){return n.Pg(t,i)})},t.prototype.vg=function(t,i){var n=this;this.H_.A(function(){return n.Pg(t,i)})},t.prototype.dg=function(t){var i=this;this.J_.A(function(){return i.Og(t)})},t.prototype._g=function(t,i){var n=this;this.q_.A(function(){return n.Rg(t,i)})},t.prototype.mg=function(){var t=this.un.timeScale.visible?"":"none";this.wg.gm().style.display=t},t.prototype.xg=function(){return this.hg[0].Js().Yu().K().visible},t.prototype.Ng=function(){return this.hg[0].Js().Us().K().visible},t}();function Cr(t,i,n){var s=n.value;return{index:i,time:t,value:[s,s,s,s]}}function Tr(t,i,n){var s=n.value,h={index:i,time:t,value:[s,s,s,s]};return"color"in n&&void 0!==n.color&&(h.color=n.color),h}function Lr(t){return void 0!==t.value}function Fr(t){return function(i,n,s){return void 0===(h=s).open&&void 0===h.value?{time:i,index:n}:t(i,n,s);var h}}var Ar={Candlestick:Fr(function(t,i,n){var s={index:i,time:t,value:[n.open,n.high,n.low,n.close]};return"color"in n&&void 0!==n.color&&(s.color=n.color),"borderColor"in n&&void 0!==n.borderColor&&(s.borderColor=n.borderColor),"wickColor"in n&&void 0!==n.wickColor&&(s.wickColor=n.wickColor),s}),Bar:Fr(function(t,i,n){var s={index:i,time:t,value:[n.open,n.high,n.low,n.close]};return"color"in n&&void 0!==n.color&&(s.color=n.color),s}),Area:Fr(Cr),Baseline:Fr(Cr),Histogram:Fr(Tr),Line:Fr(Tr)};function Pr(t){return Ar[t]}function Er(t){return 60*t*60*1e3}function Br(t){return 60*t*1e3}var Dr,Or=[{Vg:(Dr=1,1e3*Dr),bd:10},{Vg:Br(1),bd:20},{Vg:Br(5),bd:21},{Vg:Br(30),bd:22},{Vg:Er(1),bd:30},{Vg:Er(3),bd:31},{Vg:Er(6),bd:32},{Vg:Er(12),bd:33}];function zr(t,i){if(t.getUTCFullYear()!==i.getUTCFullYear())return 70;if(t.getUTCMonth()!==i.getUTCMonth())return 60;if(t.getUTCDate()!==i.getUTCDate())return 50;for(var n=Or.length-1;n>=0;--n)if(Math.floor(i.getTime()/Or[n].Vg)!==Math.floor(t.getTime()/Or[n].Vg))return Or[n].bd;return 0}function Rr(t,i){if(void 0===i&&(i=0),0!==t.length){for(var n=0===i?null:t[i-1].Nt.timestamp,s=null!==n?new Date(1e3*n):null,h=0,r=i;r<t.length;++r){var e=t[r],u=new Date(1e3*e.Nt.timestamp);null!==s&&(e.wd=zr(u,s)),h+=e.Nt.timestamp-(n||e.Nt.timestamp),n=e.Nt.timestamp,s=u}if(0===i&&t.length>1){var o=Math.ceil(h/(t.length-1)),l=new Date(1e3*(t[0].Nt.timestamp-o));t[0].wd=zr(new Date(1e3*t[0].Nt.timestamp),l)}}}function Wr(t){if(!$h(t))throw new Error("time must be of type BusinessDay");var i=new Date(Date.UTC(t.year,t.month-1,t.day,0,0,0,0));return{timestamp:Math.round(i.getTime()/1e3),businessDay:t}}function Vr(t){if(!Kh(t))throw new Error("time must be of type isUTCTimestamp");return{timestamp:t}}function Ir(t){return 0===t.length?null:$h(t[0].time)?Wr:Vr}function jr(t){return Kh(t)?Vr(t):$h(t)?Wr(t):Wr(Hr(t))}function Hr(t){var i=new Date(t);if(isNaN(i.getTime()))throw new Error("Invalid date string=".concat(t,", expected format=yyyy-mm-dd"));return{day:i.getUTCDate(),month:i.getUTCMonth()+1,year:i.getUTCFullYear()}}function Jr(t){Z(t.time)&&(t.time=Hr(t.time))}function qr(t){return{lc:0,Ig:new Map,Ue:t}}function Ur(t){if(void 0!==t&&0!==t.length)return{jg:t[0].time.timestamp,Hg:t[t.length-1].time.timestamp}}var Yr=function(){function t(){this.Jg=new Map,this.qg=new Map,this.Ug=new Map,this.Yg=[]}return t.prototype.B=function(){this.Jg.clear(),this.qg.clear(),this.Ug.clear(),this.Yg=[]},t.prototype.$g=function(t,i){var n=this,s=0!==this.Jg.size,h=!1,r=this.qg.get(t);if(void 0!==r)if(1===this.qg.size)s=!1,h=!0,this.Jg.clear();else for(var e=0,u=this.Yg;e<u.length;e++){u[e].pointData.Ig.delete(t)&&(h=!0)}var o=[];if(0!==i.length){!function(t){t.forEach(Jr)}(i);var l=A(Ir(i)),a=Pr(t.jc());o=i.map(function(i){var s=l(i.time),r=n.Jg.get(s.timestamp);void 0===r&&(r=qr(s),n.Jg.set(s.timestamp,r),h=!0);var e=a(s,r.lc,i);return r.Ig.set(t,e),e})}s&&this.Kg(),this.Xg(t,o);var f=-1;if(h){var c=[];this.Jg.forEach(function(t){c.push({wd:0,Nt:t.Ue,pointData:t})}),c.sort(function(t,i){return t.Nt.timestamp-i.Nt.timestamp}),f=this.Zg(c)}return this.Gg(t,f,function(t,i){var n=Ur(t),s=Ur(i);if(void 0!==n&&void 0!==s)return{Tv:n.Hg>=s.Hg&&n.jg>=s.jg}}(this.qg.get(t),r))},t.prototype.Dw=function(t){return this.$g(t,[])},t.prototype.Qg=function(t,i){Jr(i);var n=A(Ir([i]))(i.time),s=this.Ug.get(t);if(void 0!==s&&n.timestamp<s.timestamp)throw new Error("Cannot update oldest data, last time=".concat(s.timestamp,", new time=").concat(n.timestamp));var h=this.Jg.get(n.timestamp),r=void 0===h;void 0===h&&(h=qr(n),this.Jg.set(n.timestamp,h));var e=Pr(t.jc())(n,h.lc,i);h.Ig.set(t,e),this.tk(t,e);var u={Tv:Lr(e)};if(!r)return this.Gg(t,-1,u);var o={wd:0,Nt:h.Ue,pointData:h},l=ks(this.Yg,o.Nt.timestamp,function(t,i){return t.Nt.timestamp<i});this.Yg.splice(l,0,o);for(var a=l;a<this.Yg.length;++a)$r(this.Yg[a].pointData,a);return Rr(this.Yg,l),this.Gg(t,l,u)},t.prototype.tk=function(t,i){var n=this.qg.get(t);void 0===n&&(n=[],this.qg.set(t,n));var s=0!==n.length?n[n.length-1]:null;null===s||i.time.timestamp>s.time.timestamp?Lr(i)&&n.push(i):Lr(i)?n[n.length-1]=i:n.splice(-1,1),this.Ug.set(t,i.time)},t.prototype.Xg=function(t,i){0!==i.length?(this.qg.set(t,i.filter(Lr)),this.Ug.set(t,i[i.length-1].time)):(this.qg.delete(t),this.Ug.delete(t))},t.prototype.Kg=function(){for(var t=0,i=this.Yg;t<i.length;t++){var n=i[t];0===n.pointData.Ig.size&&this.Jg.delete(n.Nt.timestamp)}},t.prototype.Zg=function(t){for(var i=-1,n=0;n<this.Yg.length&&n<t.length;++n){var s=this.Yg[n],h=t[n];if(s.Nt.timestamp!==h.Nt.timestamp){i=n;break}h.wd=s.wd,$r(h.pointData,n)}if(-1===i&&this.Yg.length!==t.length&&(i=Math.min(this.Yg.length,t.length)),-1===i)return-1;for(n=i;n<t.length;++n)$r(t[n].pointData,n);return Rr(t,i),this.Yg=t,i},t.prototype.ik=function(){if(0===this.qg.size)return null;var t=0;return this.qg.forEach(function(i){0!==i.length&&(t=Math.max(t,i[i.length-1].index))}),t},t.prototype.Gg=function(t,i,n){var s={nk:new Map,zt:{Qd:this.ik()}};if(-1!==i)this.qg.forEach(function(i,h){s.nk.set(h,{bh:i,sk:h===t?n:void 0})}),this.qg.has(t)||s.nk.set(t,{bh:[],sk:n}),s.zt.Ds=this.Yg,s.zt.hk=i;else{var h=this.qg.get(t);s.nk.set(t,{bh:h||[],sk:n})}return s},t}();function $r(t,i){t.lc=i,t.Ig.forEach(function(t){t.index=i})}var Kr={color:"#FF0000",price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:"",ray:!1,rayStart:0},Xr=function(){function t(t){this.Bc=t}return t.prototype.applyOptions=function(t){this.Bc.$s(t)},t.prototype.options=function(){return this.Bc.K()},t.prototype.rk=function(){return this.Bc},t}();function Zr(t){var i=t.overlay,n=function(t,i){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(s=Object.getOwnPropertySymbols(t);h<s.length;h++)i.indexOf(s[h])<0&&Object.prototype.propertyIsEnumerable.call(t,s[h])&&(n[s[h]]=t[s[h]])}return n}(t,["overlay"]);return i&&(n.priceScaleId=""),n}var Gr=function(){function t(t,i,n){this.Pa=t,this.ek=i,this.uk=n}return t.prototype.priceFormatter=function(){return this.Pa.oh()},t.prototype.priceToCoordinate=function(t){var i=this.Pa.Vt();return null===i?null:this.Pa.Ht().jt(t,i.Jt)},t.prototype.coordinateToPrice=function(t){var i=this.Pa.Vt();return null===i?null:this.Pa.Ht().cn(t,i.Jt)},t.prototype.barsInLogicalRange=function(t){if(null===t)return null;var i=new Bh(new Fh(t.from,t.to)).kd(),n=this.Pa.An();if(n.et())return null;var s=n.hv(i.ou(),1),h=n.hv(i.lu(),-1),r=A(n.iv()),e=A(n.Fn());if(null!==s&&null!==h&&s.index>h.index)return{barsBefore:t.from-r,barsAfter:e-t.to};var u={barsBefore:null===s||s.index===r?t.from-r:s.index-r,barsAfter:null===h||h.index===e?e-t.to:e-h.index};return null!==s&&null!==h&&(u.from=s.time.businessDay||s.time.timestamp,u.to=h.time.businessDay||h.time.timestamp),u},t.prototype.setData=function(t){this.Pa.jc(),this.ek.lk(this.Pa,t)},t.prototype.update=function(t){this.Pa.jc(),this.ek.fo(this.Pa,t)},t.prototype.setMarkers=function(t){var i=t.map(function(t){return q(q({},t),{time:jr(t.time)})});this.Pa.Fv(i)},t.prototype.applyOptions=function(t){var i=Zr(t);this.Pa.$s(i)},t.prototype.options=function(){return Q(this.Pa.K())},t.prototype.priceScale=function(){return this.uk.priceScale(this.Pa.Ht().Ji())},t.prototype.createPriceLine=function(t){var i=$(Q(Kr),t),n=this.Pa.Av(i);return new Xr(n)},t.prototype.removePriceLine=function(t){this.Pa.Pv(t.rk())},t.prototype.seriesType=function(){return this.Pa.jc()},t.prototype.getDataInRange=function(t){var i=this.Pa.An();if(i.et())return[];var n=this.Pa.ri().zt(),s=n.Rc(jr(t.from),!0),h=n.Rc(jr(t.to),!0);if(null===s||null===h)return[];var r=new Bh(new Fh(s,h)).kd(),e=i.hv(r.ou(),1),u=i.hv(r.lu(),-1);if(null===e||null===u)return[];var o=e.index,l=u.index+1;return i.Ja().slice(o,l)},t}(),Qr=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return J(i,t),i.prototype.applyOptions=function(i){Yh(i),t.prototype.applyOptions.call(this,i)},i}(Gr),te=function(){function t(t){this.ak=t}return t.prototype.setPoints=function(t){this.ak.Ws(t)},t.prototype.applyOptions=function(t){this.ak.$s(t)},t.prototype.options=function(){return Q(this.ak.K())},t.prototype.toolType=function(){return this.ak.sh()},t}(),ie={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:"#2B2B43",entireTextOnly:!1,visible:!1,drawTicks:!0,scaleMargins:{bottom:.1,top:.2}},ne={color:"rgba(0, 0, 0, 0)",visible:!1,fontSize:48,fontFamily:nt,fontStyle:"",text:"",horzAlign:"center",vertAlign:"center"},se={width:0,height:0,layout:{background:{type:"solid",color:"#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,magnetThreshold:14},grid:{vertLines:{color:"#D6DCDE",style:0,visible:!0},horzLines:{color:"#D6DCDE",style:0,visible:!0}},overlayPriceScales:q({},ie),leftPriceScale:q(q({},ie),{visible:!1}),rightPriceScale:q(q({},ie),{visible:!0}),timeScale:{rightOffset:0,barSpacing:6,minBarSpacing:.5,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:"#2B2B43",visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0},watermark:ne,localization:{locale:er?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},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}},he={upColor:"#26a69a",downColor:"#ef5350",wickVisible:!0,borderVisible:!0,borderColor:"#378658",borderUpColor:"#26a69a",borderDownColor:"#ef5350",wickColor:"#737375",wickUpColor:"#26a69a",wickDownColor:"#ef5350"},re={upColor:"#26a69a",downColor:"#ef5350",openVisible:!0,thinBars:!0},ee={color:"#2196f3",lineStyle:0,lineWidth:3,lineType:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBackgroundColor:"",lastPriceAnimation:0},ue={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:"",lastPriceAnimation:0},oe={baseValue:{type:"price",price:0},topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",topLineColor:"rgba(38, 166, 154, 1)",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",bottomLineColor:"rgba(239, 83, 80, 1)",lineWidth:3,lineStyle:0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"",crosshairMarkerBackgroundColor:"",lastPriceAnimation:0},le={color:"#26a69a",base:0},ae={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}},fe=function(){function t(t,i){this.fk=t,this.ck=i}return t.prototype.applyOptions=function(t){this.fk.ri().ow(this.ck,t)},t.prototype.options=function(){return this.Pi().K()},t.prototype.width=function(){return Ct(this.ck)?this.fk.Sg("left"===this.ck?"left":"right"):0},t.prototype.Pi=function(){return A(this.fk.ri().lw(this.ck)).Ht},t}(),ce=function(){function t(t,i){this.vk=new Y,this.Pd=new Y,this.Ip=new Y,this.zi=t,this.Nu=t.zt(),this.wg=i,this.Nu.b_().N(this.dk.bind(this)),this.Nu.M_().N(this._k.bind(this)),this.wg.Kp().N(this.wk.bind(this))}return t.prototype.B=function(){this.Nu.b_().F(this),this.Nu.M_().F(this),this.wg.Kp().F(this),this.vk.B(),this.Pd.B(),this.Ip.B()},t.prototype.scrollPosition=function(){return this.Nu.e_()},t.prototype.scrollToPosition=function(t,i){i?this.Nu.w_(t,1e3):this.zi.qn(t)},t.prototype.scrollToRealTime=function(){this.Nu.__()},t.prototype.getVisibleRange=function(){var t,i,n=this.Nu.Ud();return null===n?null:{from:null!==(t=n.from.businessDay)&&void 0!==t?t:n.from.timestamp,to:null!==(i=n.to.businessDay)&&void 0!==i?i:n.to.timestamp}},t.prototype.setVisibleRange=function(t){var i={from:jr(t.from),to:jr(t.to)},n=this.Nu.Xd(i);this.zi.zw(n)},t.prototype.getVisibleLogicalRange=function(){var t=this.Nu.qd();return null===t?null:{from:t.ou(),to:t.lu()}},t.prototype.setVisibleLogicalRange=function(t){L(t.from<=t.to,"The from index cannot be after the to index."),this.zi.zw(t)},t.prototype.resetTimeScale=function(){this.zi.Hn()},t.prototype.fitContent=function(){this.zi.g_()},t.prototype.logicalToCoordinate=function(t){var i=this.zi.zt();return i.et()?null:i.Yt(t)},t.prototype.coordinateToLogical=function(t){return this.Nu.et()?null:this.Nu.t_(t)},t.prototype.timeToCoordinate=function(t){var i=jr(t),n=this.Nu.Rc(i,!1);return null===n?null:this.Nu.Yt(n)},t.prototype.coordinateToTime=function(t){var i,n=this.zi.zt(),s=n.t_(t),h=n.vn(s);return null===h?null:null!==(i=h.businessDay)&&void 0!==i?i:h.timestamp},t.prototype.width=function(){return this.wg.bp().Zt},t.prototype.height=function(){return this.wg.bp().Gt},t.prototype.subscribeVisibleTimeRangeChange=function(t){this.vk.N(t)},t.prototype.unsubscribeVisibleTimeRangeChange=function(t){this.vk.L(t)},t.prototype.subscribeVisibleLogicalRangeChange=function(t){this.Pd.N(t)},t.prototype.unsubscribeVisibleLogicalRangeChange=function(t){this.Pd.L(t)},t.prototype.subscribeSizeChange=function(t){this.Ip.N(t)},t.prototype.unsubscribeSizeChange=function(t){this.Ip.L(t)},t.prototype.applyOptions=function(t){this.Nu.$s(t)},t.prototype.options=function(){return Q(this.Nu.K())},t.prototype.dk=function(){this.vk.P()&&this.vk.A(this.getVisibleRange())},t.prototype._k=function(){this.Pd.P()&&this.Pd.A(this.getVisibleLogicalRange())},t.prototype.wk=function(t){this.Ip.A(t.Zt,t.Gt)},t}();function ve(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 de(t){return function(t){if(G(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&&G(t.handleScale.axisPressedMouseMove)){var n=t.handleScale.axisPressedMouseMove;t.handleScale.axisPressedMouseMove={time:n,price:n}}var s=t.handleScroll;G(s)&&(t.handleScroll={horzTouchDrag:s,vertTouchDrag:s,mouseWheel:s,pressedMouseMove:s})}(t),function(t){if(t.priceScale){t.leftPriceScale=t.leftPriceScale||{},t.rightPriceScale=t.rightPriceScale||{};var i=t.priceScale.position;delete t.priceScale.position,t.leftPriceScale=$(t.leftPriceScale,t.priceScale),t.rightPriceScale=$(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),function(t){t.layout&&t.layout.backgroundColor&&!t.layout.background&&(t.layout.background={type:"solid",color:t.layout.backgroundColor})}(t),t}var _e=function(){function t(t,i){var n=this;this.bk=new Yr,this.Mk=new Map,this.mk=new Map,this.pk=new Y,this.gk=new Y,this.kk=new Y,this.yk=new Y;var s=void 0===i?Q(se):$(Q(se),de(i));this.fk=new Sr(t,s),this.fk.dp().N(function(t){n.pk.P()&&n.pk.A(n.xk(t()))},this),this.fk.dw().N(function(t){n.gk.P()&&n.gk.A(n.xk(t()))},this),this.fk._w().N(function(t){n.kk.P()&&n.kk.A(n.Nk(t()))},this),this.fk.ww().N(function(t){n.yk.P()&&n.yk.A(n.Sk(t()))},this);var h=this.fk.ri();this.Ck=new ce(h,this.fk.gg())}return t.prototype.setCrossHairXY=function(t,i,n){this.fk.pg()[0].Tp(t,i,n)},t.prototype.clearCrossHair=function(){this.fk.pg()[0].Fp()},t.prototype.remove=function(){this.fk.dp().F(this),this.fk.dw().F(this),this.fk._w().F(this),this.fk.ww().F(this),this.Ck.B(),this.fk.B(),this.Mk.clear(),this.mk.clear(),this.pk.B(),this.gk.B(),this.kk.B(),this.yk.B(),this.bk.B()},t.prototype.resize=function(t,i,n){this.fk.bg(t,i,n)},t.prototype.addAreaSeries=function(t){void 0===t&&(t={}),ve((t=Zr(t)).priceFormat);var i=$(Q(ae),ue,t),n=this.fk.ri().Ew("Area",i),s=new Gr(n,this,this);return this.Mk.set(s,n),this.mk.set(n,s),s},t.prototype.addBaselineSeries=function(t){void 0===t&&(t={}),ve((t=Zr(t)).priceFormat);var i=$(Q(ae),Q(oe),t),n=this.fk.ri().Ew("Baseline",i),s=new Gr(n,this,this);return this.Mk.set(s,n),this.mk.set(n,s),s},t.prototype.addBarSeries=function(t){void 0===t&&(t={}),ve((t=Zr(t)).priceFormat);var i=$(Q(ae),re,t),n=this.fk.ri().Ew("Bar",i),s=new Gr(n,this,this);return this.Mk.set(s,n),this.mk.set(n,s),s},t.prototype.addCandlestickSeries=function(t){void 0===t&&(t={}),Yh(t=Zr(t)),ve(t.priceFormat);var i=$(Q(ae),he,t),n=this.fk.ri().Ew("Candlestick",i),s=new Qr(n,this,this);return this.Mk.set(s,n),this.mk.set(n,s),s},t.prototype.addHistogramSeries=function(t){void 0===t&&(t={}),ve((t=Zr(t)).priceFormat);var i=$(Q(ae),le,t),n=this.fk.ri().Ew("Histogram",i),s=new Gr(n,this,this);return this.Mk.set(s,n),this.mk.set(n,s),s},t.prototype.addLineSeries=function(t){void 0===t&&(t={}),ve((t=Zr(t)).priceFormat);var i=$(Q(ae),ee,t),n=this.fk.ri().Ew("Line",i),s=new Gr(n,this,this);return this.Mk.set(s,n),this.mk.set(n,s),s},t.prototype.removeSeries=function(t){var i=F(this.Mk.get(t)),n=this.bk.Dw(i);this.fk.ri().Dw(i),this.Tk(n),this.Mk.delete(t),this.mk.delete(i)},t.prototype.addLineTool=function(t,i,n){var s=$(Q(Ht[t]),n||{}),h=this.fk.ri().Ow(t,s,i);return new te(h)},t.prototype.setActiveLineTool=function(t,i){this.fk.ri().cw().da(t,i)},t.prototype.removeLineToolsById=function(t){if(Array.isArray(t)){var i=this.Lk();if(null===i)return;t.forEach(function(t){var n=i.Ju(t);null!==n&&i.qe(n)}),i.ro()}},t.prototype.getSelectedLineTools=function(){var t=[],i=this.Lk();if(null===i)return JSON.stringify(t);var n=i.qu();return n.length>0&&(t=n.map(function(t){return t.dh()})),JSON.stringify(t)},t.prototype.removeSelectedLineTools=function(){var t=this.Lk();if(null!==t){var i=t.qu();i.length>0&&(i.forEach(function(i){t.qe(i)}),t.ro())}},t.prototype.removeAllLineTools=function(){var t=this.Lk();if(null!==t){var i=t.Hu();i.length>0&&(i.forEach(function(i){t.qe(i)}),t.ro())}},t.prototype.exportLineTools=function(){var t=[],i=this.Lk();if(null===i)return JSON.stringify(t);var n=i.Hu();return n.length>0&&(t=n.map(function(t){return t.dh()})),JSON.stringify(t)},t.prototype.importLineTools=function(t){var i=this;if("undefined"===t||!t)return!1;JSON.parse(t).forEach(function(t){i.addLineTool(t.toolType,t.points,t.options).ak.qi(t.id)});var n=this.Lk();return null!==n&&n.ro(),!0},t.prototype.applyLineToolOptions=function(t){var i=this.Lk();if(null===i)return!1;var n=i.Ju(t.id);return null!==n&&(n.Qn()&&n.Gs(!1),n.Ws(t.points),new te(n).applyOptions(t.options),!0)},t.prototype.createOrUpdateLineTool=function(t,i,n,s){var h=this.Lk();if(null!==h){var r,e=h.Ju(s);if(null!==e)(r=new te(e)).setPoints(i),r.applyOptions(n);else(r=this.addLineTool(t,i,n)).ak.qi(s)}},t.prototype.getLineToolByID=function(t){var i=this.Lk();if(null===i)return JSON.stringify([]);var n=i.Ju(t);return null===n?JSON.stringify([]):JSON.stringify([n.dh()])},t.prototype.getLineToolsByIdRegex=function(t){if(!(t instanceof RegExp))return JSON.stringify([]);var i=this.Lk();if(null===i)return JSON.stringify([]);for(var n=[],s=0,h=i.Hu();s<h.length;s++){var r=h[s];t.lastIndex=0,t.test(r.Ji())&&n.push(r.dh())}return JSON.stringify(n)},t.prototype.removeLineToolsByIdRegex=function(t){if(t instanceof RegExp){var i=this.Lk();if(null!==i){for(var n=0,s=i.Hu();n<s.length;n++){var h=s[n];t.lastIndex=0,t.test(h.Ji())&&i.qe(h)}i.ro()}}},t.prototype.lk=function(t,i){this.Tk(this.bk.$g(t,i))},t.prototype.fo=function(t,i){this.Tk(this.bk.Qg(t,i))},t.prototype.subscribeClick=function(t){this.pk.N(t)},t.prototype.unsubscribeClick=function(t){this.pk.L(t)},t.prototype.subscribeCrosshairMove=function(t){this.gk.N(t)},t.prototype.unsubscribeCrosshairMove=function(t){this.gk.L(t)},t.prototype.subscribeLineToolsDoubleClick=function(t){this.kk.N(t)},t.prototype.unsubscribeLineToolsDoubleClick=function(t){this.kk.L(t)},t.prototype.subscribeLineToolsAfterEdit=function(t){this.yk.N(t)},t.prototype.unsubscribeLineToolsAfterEdit=function(t){this.yk.L(t)},t.prototype.priceScale=function(t){return void 0===t&&(t=this.fk.ri().wa()),new fe(this.fk,t)},t.prototype.timeScale=function(){return this.Ck},t.prototype.applyOptions=function(t){this.fk.$s(de(t))},t.prototype.options=function(){return this.fk.K()},t.prototype.takeScreenshot=function(){return this.fk.yg()},t.prototype.Tk=function(t){var i=this.fk.ri();i.Fw(t.zt.Qd,t.zt.Ds,t.zt.hk),t.nk.forEach(function(t,i){return i._t(t.bh,t.sk)}),i.h_()},t.prototype.Fk=function(t){return F(this.mk.get(t))},t.prototype.Lk=function(){return this.fk.ri().aw()},t.prototype.xk=function(t){var i=this,n=new Map;t.Bg.forEach(function(t,s){n.set(i.Fk(s),t)});var s=void 0===t.Eg?void 0:this.Fk(t.Eg);return{time:t.Nt&&(t.Nt.businessDay||t.Nt.timestamp),point:t.$l,hoveredSeries:s,hoveredMarkerId:t.Dg,seriesPrices:n}},t.prototype.Nk=function(t){return{selectedLineTool:t.zg}},t.prototype.Sk=function(t){return{selectedLineTool:t.zg,stage:t.Wg}},t}();var we=Object.freeze({__proto__:null,get BoxHorizontalAlignment(){return Hh},get BoxVerticalAlignment(){return jh},get ColorType(){return qh},get CrosshairMode(){return xt},get LasPriceAnimationMode(){return Vh},get LastPriceAnimationMode(){return Vh},get LineEnd(){return i},get LineStyle(){return n},get LineType(){return t},get PriceLineSource(){return Ih},get PriceScaleMode(){return Ji},get TextAlignment(){return Jh},get TickMarkType(){return Ph},get TrackingModeExitMode(){return Oh},createChart:function(t,i){var n;if(Z(t)){var s=document.getElementById(t);L(null!==s,"Cannot find element in DOM with id=".concat(t)),n=s}else n=t;return new _e(n,i)},isBusinessDay:$h,isUTCTimestamp:Kh,version:function(){return"3.8.0-dev+202511100116"}});window.LightweightCharts=we}();
|